Paged transaction inquiries optimized for maximum links, continued.
[fa-stable.git] / sales / inquiry / sales_orders_view.php
index f275bc7055c2957c14781c143f64188631ef6cf6..bc08889900f31fed6abf17d7a58d32c179c27d73 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);
@@ -249,7 +254,7 @@ $sql = get_sql_for_sales_orders_view($trans_type, get_post('OrderNumber'), get_p
 
 if ($trans_type == ST_SALESORDER)
        $cols = array(
-               _("Order #") => array('fun'=>'view_link'),
+               _("Order #") => array('fun'=>'view_link', 'align'=>'right'),
                _("Ref") => array('type' => 'sorder.reference', 'ord' => '') ,
                _("Customer") => array('type' => 'debtor.name' , 'ord' => '') ,
                _("Branch"), 
@@ -263,7 +268,7 @@ if ($trans_type == ST_SALESORDER)
        );
 else
        $cols = array(
-               _("Quote #") => array('fun'=>'view_link'),
+               _("Quote #") => array('fun'=>'view_link', 'align'=>'right'),
                _("Ref"),
                _("Customer"),
                _("Branch"), 
@@ -277,8 +282,9 @@ else
        );
 if ($_POST['order_view_mode'] == 'OutstandingOnly') {
        array_append($cols, array(
+               array('insert'=>true, 'fun'=>'edit_link'),
                array('insert'=>true, 'fun'=>'dispatch_link'),
-               array('insert'=>true, 'fun'=>'edit_link')));
+               array('insert'=>true, 'fun'=>'prt_link')));
 
 } elseif ($_POST['order_view_mode'] == 'InvoiceTemplates') {
        array_substitute($cols, 4, 1, _("Description"));
@@ -303,6 +309,7 @@ if ($_POST['order_view_mode'] == 'OutstandingOnly') {
         array_append($cols,array(
                        _("Tmpl") => array('insert'=>true, 'fun'=>'tmpl_checkbox'),
                                        array('insert'=>true, 'fun'=>'edit_link'),
+                                       array('insert'=>true, 'fun'=>'dispatch_link'),
                                        array('insert'=>true, 'fun'=>'prt_link')));
 };