Paged transaction inquiries optimized for maximum links in Sales and Purchasing.
[fa-stable.git] / sales / inquiry / sales_orders_view.php
index 2241e1f9dc05a7fe9c157f64d8e738280ec16a9c..bc2c15f93258a7cc442efcbe44fec00cced2cf94 100644 (file)
@@ -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')));
 };