- alt_table_row_color($k);
-
- $date = sql2date($myrow["ord_date"]);
-
- label_cell(get_trans_view_str(systypes::po(), $myrow["order_no"]));
- label_cell($myrow["reference"]);
- label_cell($myrow["supp_name"]);
- if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all())
- label_cell($myrow["location_name"]);
- label_cell($myrow["requisition_no"]);
- label_cell($date);
- label_cell($myrow["curr_code"]);
- amount_cell($myrow["OrderValue"]);
- end_row();
-
- $j++;
- if ($j == 12)
- {
- $j = 1;
- table_header($th);
- }
+$sql = get_sql_for_po_search_completed(get_post('OrdersAfterDate'), get_post('OrdersToDate'),
+ get_post('supplier_id'), get_post('StockLocation'), get_post('order_number'),
+ get_post('SelectStockFromList'), get_post('also_closed'));
+
+$cols = array(
+ _("#") => array('fun'=>'trans_view', 'ord'=>'', 'align'=>'right'),
+ _("Reference"),
+ _("Supplier") => array('ord'=>''),
+ _("Location"),
+ _("Supplier's Reference"),
+ _("Order Date") => array('name'=>'ord_date', 'type'=>'date', 'ord'=>'desc'),
+ _("Currency") => array('align'=>'center'),
+ _("Order Total") => 'amount',
+ array('insert'=>true, 'fun'=>'edit_link'),
+ array('insert'=>true, 'fun'=>'prt_link'),
+);
+
+if (get_post('StockLocation') != ALL_TEXT) {
+ $cols[_("Location")] = 'skip';