porder.ord_date,
supplier.curr_code,
Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
+ Sum(line.delivery_date < '". date2sql(Today()) ."'
+ AND (line.quantity_ordered > line.quantity_received)) As OverDue,
porder.into_stock_location,
chk.isopen
FROM ".TB_PREF."purch_orders as porder
_("Currency") => array('align'=>'center'),
_("Order Total") => 'amount',
array('insert'=>true, 'fun'=>'edit_link'),
- array('insert'=>true, 'fun'=>'prt_link'),
- array('insert'=>true, 'fun'=>'receive_link')
+ array('insert'=>true, 'fun'=>'receive_link'),
+ array('insert'=>true, 'fun'=>'prt_link')
);
if (get_post('StockLocation') != ALL_TEXT) {
trans_editor_link(ST_PURCHORDER, $row["order_no"]);
}
+function receive_link($row)
+{
+ global $page_nested;
+
+ return $page_nested || !$row['OverDue'] ? '' :
+ pager_link( _("Receive"),
+ "/purchasing/po_receive_items.php?PONumber=" . $row["order_no"], ICON_RECEIVE);
+}
+
function prt_link($row)
{
return print_document_link($row['order_no'], _("Print"), true, ST_PURCHORDER, ICON_PRINT);
_("Currency") => array('align'=>'center'),
_("Order Total") => 'amount',
array('insert'=>true, 'fun'=>'edit_link'),
- array('insert'=>true, 'fun'=>'prt_link'),
+ array('insert'=>true, 'fun'=>'receive_link'),
+ array('insert'=>true, 'fun'=>'prt_link')
);
if (get_post('StockLocation') != ALL_TEXT) {
if ($page_nested)
return '';
- return $row['type'] == ST_SALESINVOICE && $row["Outstanding"] > 0 ?
- pager_link(_("Credit This") ,
- "/sales/customer_credit_invoice.php?InvoiceNumber=". $row['trans_no'], ICON_CREDIT):'';
+ if ($row["Outstanding"] > 0)
+ {
+ if ($row['type'] == ST_CUSTDELIVERY)
+ return pager_link(_('Invoice'), "/sales/customer_invoice.php?DeliveryNumber="
+ .$row['trans_no'], ICON_DOC);
+ else if ($row['type'] == ST_SALESINVOICE)
+ return pager_link(_("Credit This") ,
+ "/sales/customer_credit_invoice.php?InvoiceNumber=". $row['trans_no'], ICON_CREDIT);
+ }
}
function edit_link($row)
function dispatch_link($row)
{
- global $trans_type;
+ global $trans_type, $page_nested;
if ($row['ord_payments'] + $row['inv_payments'] < $row['prep_amount'])
return '';
if ($trans_type == ST_SALESORDER)
- return pager_link( _("Dispatch"),
- "/sales/customer_delivery.php?OrderNumber=" .$row['order_no'], ICON_DOC);
+ {
+ if ($row['TotDelivered'] < $row['TotQuantity'] && !$page_nested)
+ return pager_link( _("Dispatch"),
+ "/sales/customer_delivery.php?OrderNumber=" .$row['order_no'], ICON_DOC);
+ else
+ return '';
+ }
else
return pager_link( _("Sales Order"),
"/sales/sales_order_entry.php?OrderNumber=" .$row['order_no'], ICON_DOC);
} elseif ($trans_type == ST_SALESORDER) {
array_append($cols,array(
_("Tmpl") => array('insert'=>true, 'fun'=>'tmpl_checkbox'),
+ array('insert'=>true, 'fun'=>'dispatch_link'),
array('insert'=>true, 'fun'=>'edit_link'),
array('insert'=>true, 'fun'=>'prt_link')));
};