The aging reports / inquiries had a 1 day error in presentation. Fixed.
authorJoe <unknown>
Thu, 19 Feb 2015 16:48:05 +0000 (17:48 +0100)
committerJoe <unknown>
Thu, 19 Feb 2015 16:48:05 +0000 (17:48 +0100)
purchasing/includes/db/suppliers_db.inc
reporting/rep102.php
reporting/rep202.php
sales/includes/db/customers_db.inc

index dd9e49c906fa3cbb4689ba5e95e2387d368555e3..e0f8078ea51e1bd0c5a3963cb72eb1cb4b266190 100644 (file)
@@ -84,8 +84,9 @@ function get_supplier_details($supplier_id, $to=null, $all=true)
                $todate = date("Y-m-d");
        else
                $todate = date2sql($to);
-       $past1 = get_company_pref('past_due_days');
-       $past2 = 2 * $past1;
+       $current = 1;   
+       $past1 = get_company_pref('past_due_days') + $current;
+       $past2 = 2 * $past1 + $current;
        // removed - supp_trans.alloc from all summations
 
        if ($all)
@@ -99,7 +100,7 @@ function get_supplier_details($supplier_id, $to=null, $all=true)
 
                Sum(IFNULL($value,0)) AS Balance,
 
-               Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0)) AS Due,
+               Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $current,$value,0)) AS Due,
                Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $past1,$value,0)) AS Overdue1,
                Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $past2,$value,0)) AS Overdue2,
                supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1) 
index beea87bcae78a995e0d93ec27de278231c2318b2..90f7db024a9b246bf5fa5795da37bd9919679459 100644 (file)
@@ -30,8 +30,9 @@ print_aged_customer_analysis();
 function get_invoices($customer_id, $to, $all=true)
 {
        $todate = date2sql($to);
-       $PastDueDays1 = get_company_pref('past_due_days');
-       $PastDueDays2 = 2 * $PastDueDays1;
+       $current = 1;
+       $PastDueDays1 = get_company_pref('past_due_days') + $current;
+       $PastDueDays2 = 2 * $PastDueDays1 + $current;
 
        // Revomed allocated from sql
        if ($all)
@@ -46,7 +47,7 @@ function get_invoices($customer_id, $to, $all=true)
        $sql = "SELECT ".TB_PREF."debtor_trans.type, ".TB_PREF."debtor_trans.reference,
                ".TB_PREF."debtor_trans.tran_date,
                $value as Balance,
-               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0) AS Due,
+               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $current,$value,0) AS Due,
                IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays1,$value,0) AS Overdue1,
                IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays2,$value,0) AS Overdue2
 
index 7ba8b0d7733ad3d5dcc53d1d3d36789af5ba74b6..4b788eb62fe46f4e0ad6521c6e00afaafb067957 100644 (file)
@@ -32,8 +32,9 @@ print_aged_supplier_analysis();
 function get_invoices($supplier_id, $to, $all=true)
 {
        $todate = date2sql($to);
-       $PastDueDays1 = get_company_pref('past_due_days');
-       $PastDueDays2 = 2 * $PastDueDays1;
+       $current = 1;
+       $PastDueDays1 = get_company_pref('past_due_days') + $current;
+       $PastDueDays2 = 2 * $PastDueDays1 + $current;
 
        // Revomed allocated from sql
        if ($all)
@@ -47,7 +48,7 @@ function get_invoices($supplier_id, $to, $all=true)
                ".TB_PREF."supp_trans.reference,
                ".TB_PREF."supp_trans.tran_date,
                $value as Balance,
-               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0) AS Due,
+               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $current,$value,0) AS Due,
                IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays1,$value,0) AS Overdue1,
                IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays2,$value,0) AS Overdue2
 
index 36db9e1a93b453196facf1964841f61629ce7195..ca940bcde2633477e6808272e754384710bdd59d 100644 (file)
@@ -68,8 +68,9 @@ function get_customer_details($customer_id, $to=null, $all=true)
                $todate = date("Y-m-d");
        else
                $todate = date2sql($to);
-       $past1 = get_company_pref('past_due_days');
-       $past2 = 2 * $past1;
+               $current = 1;
+       $past1 = get_company_pref('past_due_days') + $current;
+       $past2 = 2 * $past1 + $current;
        // removed - debtor_trans.alloc from all summations
        if ($all)
        $value = "IFNULL(IF(trans.type=11 OR trans.type=12 OR trans.type=2, -1, 1) 
@@ -83,7 +84,7 @@ function get_customer_details($customer_id, $to=null, $all=true)
                ".TB_PREF."debtors_master.credit_limit, ".TB_PREF."credit_status.dissallow_invoices, ".TB_PREF."credit_status.reason_description,
 
                Sum(IFNULL($value,0)) AS Balance,
-               Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0)) AS Due,
+               Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $current,$value,0)) AS Due,
                Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $past1,$value,0)) AS Overdue1,
                Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $past2,$value,0)) AS Overdue2