From: Joe Hunt Date: Thu, 18 Jul 2019 22:29:39 +0000 (+0200) Subject: Paged transaction inquiries optimized for maximum links in Sales and Purchasing. X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=97c5e11dd178b2b10edd2b99276b3347470fafc8 Paged transaction inquiries optimized for maximum links in Sales and Purchasing. --- diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 0afbe162..a904c2ff 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -294,6 +294,8 @@ function get_sql_for_po_search_completed($from, $to, $supplier_id=ALL_TEXT, $loc 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 diff --git a/purchasing/inquiry/po_search.php b/purchasing/inquiry/po_search.php index 9e77d710..efd65075 100644 --- a/purchasing/inquiry/po_search.php +++ b/purchasing/inquiry/po_search.php @@ -123,8 +123,8 @@ $cols = array( _("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) { diff --git a/purchasing/inquiry/po_search_completed.php b/purchasing/inquiry/po_search_completed.php index 8c939aba..4046424e 100644 --- a/purchasing/inquiry/po_search_completed.php +++ b/purchasing/inquiry/po_search_completed.php @@ -38,6 +38,15 @@ function edit_link($row) 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); @@ -116,7 +125,8 @@ $cols = array( _("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) { diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index eb98d3da..4674989f 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -70,9 +70,15 @@ function credit_link($row) 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) diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index 2241e1f9..bc2c15f9 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -114,14 +114,19 @@ 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); @@ -302,6 +307,7 @@ if ($_POST['order_view_mode'] == 'OutstandingOnly') { } 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'))); };