X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fsuppliers_db.inc;h=e0f8078ea51e1bd0c5a3963cb72eb1cb4b266190;hb=107a22ab168c1102f3f534a22cd5b8290331f17d;hp=dd9e49c906fa3cbb4689ba5e95e2387d368555e3;hpb=7c5836f0236b223954d803717762a15942ec0ca2;p=fa-stable.git diff --git a/purchasing/includes/db/suppliers_db.inc b/purchasing/includes/db/suppliers_db.inc index dd9e49c9..e0f8078e 100644 --- a/purchasing/includes/db/suppliers_db.inc +++ b/purchasing/includes/db/suppliers_db.inc @@ -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)