From: Joe Date: Fri, 20 Feb 2015 00:44:21 +0000 (+0100) Subject: Rerun. The aging reports / inquiries had a 1 day error in presentation. Fixed. X-Git-Tag: 2.3-final~68 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=2e570d1c62dd7775213cfffe3cf1ab186b94117f Rerun. The aging reports / inquiries had a 1 day error in presentation. Fixed. --- diff --git a/purchasing/includes/db/suppliers_db.inc b/purchasing/includes/db/suppliers_db.inc index e0f8078e..d02353ba 100644 --- a/purchasing/includes/db/suppliers_db.inc +++ b/purchasing/includes/db/suppliers_db.inc @@ -84,9 +84,8 @@ function get_supplier_details($supplier_id, $to=null, $all=true) $todate = date("Y-m-d"); else $todate = date2sql($to); - $current = 1; - $past1 = get_company_pref('past_due_days') + $current; - $past2 = 2 * $past1 + $current; + $past1 = get_company_pref('past_due_days'); + $past2 = 2 * $past1; // removed - supp_trans.alloc from all summations if ($all) @@ -100,9 +99,9 @@ function get_supplier_details($supplier_id, $to=null, $all=true) Sum(IFNULL($value,0)) AS Balance, - 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, + Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) > 0,$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) * (ov_amount + ov_gst + ov_discount),0)) as cur_credit, supp.tax_group_id diff --git a/reporting/rep102.php b/reporting/rep102.php index 90f7db02..0034d786 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -30,9 +30,8 @@ print_aged_customer_analysis(); function get_invoices($customer_id, $to, $all=true) { $todate = date2sql($to); - $current = 1; - $PastDueDays1 = get_company_pref('past_due_days') + $current; - $PastDueDays2 = 2 * $PastDueDays1 + $current; + $PastDueDays1 = get_company_pref('past_due_days'); + $PastDueDays2 = 2 * $PastDueDays1; // Revomed allocated from sql if ($all) @@ -47,9 +46,9 @@ 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)) >= $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 + IF ((TO_DAYS('$todate') - TO_DAYS($due)) > 0,$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 FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans diff --git a/reporting/rep202.php b/reporting/rep202.php index 4b788eb6..c3b1e87a 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -32,9 +32,8 @@ print_aged_supplier_analysis(); function get_invoices($supplier_id, $to, $all=true) { $todate = date2sql($to); - $current = 1; - $PastDueDays1 = get_company_pref('past_due_days') + $current; - $PastDueDays2 = 2 * $PastDueDays1 + $current; + $PastDueDays1 = get_company_pref('past_due_days'); + $PastDueDays2 = 2 * $PastDueDays1; // Revomed allocated from sql if ($all) @@ -48,9 +47,9 @@ 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)) >= $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 + IF ((TO_DAYS('$todate') - TO_DAYS($due)) > 0,$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 FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms, diff --git a/sales/includes/db/customers_db.inc b/sales/includes/db/customers_db.inc index ca940bcd..71dfb9bd 100644 --- a/sales/includes/db/customers_db.inc +++ b/sales/includes/db/customers_db.inc @@ -68,9 +68,8 @@ function get_customer_details($customer_id, $to=null, $all=true) $todate = date("Y-m-d"); else $todate = date2sql($to); - $current = 1; - $past1 = get_company_pref('past_due_days') + $current; - $past2 = 2 * $past1 + $current; + $past1 = get_company_pref('past_due_days'); + $past2 = 2 * $past1; // 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) @@ -84,9 +83,9 @@ 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)) >= $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 + Sum(IF ((TO_DAYS('$todate') - TO_DAYS($due)) > 0,$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 FROM ".TB_PREF."debtors_master LEFT JOIN ".TB_PREF."debtor_trans trans ON diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 6c9a97cc..9fdd0276 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -48,7 +48,7 @@ if (!@$_GET['popup']) customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, !@$_GET['popup']); date_cells(_("From:"), 'TransAfterDate', '', null, -30); -date_cells(_("To:"), 'TransToDate', '', null, 1); +date_cells(_("To:"), 'TransToDate', '', null); if (!isset($_POST['filterType'])) $_POST['filterType'] = 0;