Topic: Where to find array for this function get_sql_for_po_search_completed
im trying to find array for this function and added my own function. temp_pr is my other table i wanted to show database inside of this temp.pr_number, temp.requested_by, temp.cost_center, temp.remarks, but i don't know where the array for this to be displayed.
function get_sql_for_po_search_sheet($from, $to, $supplier_id=ALL_TEXT, $location=ALL_TEXT,
$order_number = '', $stock_id = '', $also_closed=false)
{
$sql = "SELECT
porder.order_no,
porder.reference,
temp.pr_number,
temp.requested_by,
temp.cost_center,
temp.remarks,
supplier.supp_name,
location.location_name,
porder.requisition_no,
porder.ord_date,
supplier.curr_code,
Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
porder.into_stock_location,
chk.isopen
FROM ".TB_PREF."purch_orders as porder
LEFT JOIN (
SELECT order_no, SUM(quantity_ordered-quantity_received + quantity_ordered-qty_invoiced) isopen
FROM ".TB_PREF."purch_order_details
GROUP BY order_no
) chk ON chk.order_no=porder.order_no,"
.TB_PREF."purch_order_details as line, "
.TB_PREF."suppliers as supplier, "
.TB_PREF."temp_pr as temp, "
.TB_PREF."locations as location
WHERE porder.order_no = line.order_no
AND porder.supplier_id = supplier.supplier_id
AND location.loc_code = porder.into_stock_location ";
if ($supplier_id != ALL_TEXT)
$sql .= "AND supplier.supplier_id=".$supplier_id." ";
if ($order_number != "")
{
$sql .= "AND porder.reference LIKE ".db_escape('%'. $order_number . '%');
}
else
{
$data_after = date2sql($from);
$date_before = date2sql($to);
$sql .= " AND porder.ord_date >= '$data_after'";
$sql .= " AND porder.ord_date <= '$date_before'";
if ($location != ALL_TEXT)
{
$sql .= " AND porder.into_stock_location = ".db_escape($location);
}
if ($stock_id !== '')
{
$sql .= " AND line.item_code=".db_escape($stock_id);
}
if ($supplier_id != ALL_TEXT)
$sql .= " AND supplier.supplier_id=".db_escape($supplier_id);
}
if (!$also_closed)
$sql .= " AND isopen";
$sql .= " GROUP BY porder.order_no";
return $sql;
}
I don't know where to find array for this to display my other table temp.pr_number, temp.requested_by, temp.cost_center, temp.remarks,
$sql = get_sql_for_po_search_sheet(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'),
_("Price") => array('align'=>'center'),
_("Total") => 'amount',
array('insert'=>true, 'fun'=>'edit_link'),
array('insert'=>true, 'fun'=>'prt_link'),
);
if (get_post('StockLocation') != ALL_TEXT) {
$cols[_("Location")] = 'skip';
}