Changed the Running Balance column in Customer Transaction to only show when the...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 8 Nov 2009 14:29:58 +0000 (14:29 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 8 Nov 2009 14:29:58 +0000 (14:29 +0000)
CHANGELOG.txt
sales/inquiry/customer_inquiry.php

index 9a60ee640375ffae09fe3c8f751f7734126a22e8..810cc8f7db986382bbc15459051c06e66541599a 100644 (file)
@@ -26,6 +26,10 @@ $ /sales/inquiry/sales_orders_view.php
 $ /purchasing/includes/ui/invoice_ui.inc
   /purchasing/view/view_po.php
   /sales/view/view_sales_order.php
+! Changed the Running Balance column in Customer Transaction
+  to only show when the type is selected. The order is not
+  good before sorting in date order
+$ /sales/inquiry/customer_inquiry.php  
 
 07-Nov-2009 Janusz Dobrowolski
 # Added missing help_context
index b2764d465595a2be828cda60e3f59921c316d165..de745b5a1a86ff07ee19777f18da28b01af050ae 100644 (file)
@@ -216,10 +216,16 @@ function check_overdue($row)
                debtor.name, 
                branch.br_name,
                debtor.curr_code,
-               @bal := @bal+trans.ov_amount,
                (trans.ov_amount + trans.ov_gst + trans.ov_freight 
-                       + trans.ov_freight_tax + trans.ov_discount)     AS TotalAmount, 
-               trans.alloc AS Allocated,
+                       + trans.ov_freight_tax + trans.ov_discount)     AS TotalAmount, "; 
+       if ($_POST['filterType'] != ALL_TEXT)
+               $sql .= "@bal := @bal+(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount), ";
+
+//     else
+//             $sql .= "IF(trans.type=".ST_CUSTDELIVERY.",'', IF(trans.type=".ST_SALESINVOICE." OR trans.type=".ST_BANKPAYMENT.",@bal := @bal+
+//                     (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount), @bal := @bal-
+//                     (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount))) , ";
+               $sql .= "trans.alloc AS Allocated,
                ((trans.type = ".ST_SALESINVOICE.")
                        AND trans.due_date < '" . date2sql(Today()) . "') AS OverDue
                FROM "
@@ -280,20 +286,22 @@ $cols = array(
        _("Customer") => array('ord'=>''), 
        _("Branch") => array('ord'=>''), 
        _("Currency") => array('align'=>'center'),
-       _("RB"),
        _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
        _("Credit") => array('align'=>'right','insert'=>true, 'fun'=>'fmt_credit'), 
+       _("RB") => array('align'=>'right', 'type'=>'amount'),
                array('insert'=>true, 'fun'=>'gl_view'),
                array('insert'=>true, 'fun'=>'credit_link'),
                array('insert'=>true, 'fun'=>'edit_link'),
                array('insert'=>true, 'fun'=>'prt_link')
        );
 
+
 if ($_POST['customer_id'] != ALL_TEXT) {
        $cols[_("Customer")] = 'skip';
        $cols[_("Currency")] = 'skip';
 }
-
+if ($_POST['filterType'] == ALL_TEXT)
+       $cols[_("RB")] = 'skip';
 
 $table =& new_db_pager('trans_tbl', $sql, $cols);
 $table->set_marker('check_overdue', _("Marked items are overdue."));