From: Joe Date: Mon, 22 May 2023 04:56:06 +0000 (+0200) Subject: Mark Inactive Customers and Suppliers in Reports (when no Filter). X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=af03975abbd624d17cc6c4f61b71808a0a5c82ea Mark Inactive Customers and Suppliers in Reports (when no Filter). --- diff --git a/reporting/rep101.php b/reporting/rep101.php index 0ea49173..1a800d00 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -157,7 +157,7 @@ function print_customer_balances() $grandtotal = array(0,0,0,0); - $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master "; + $sql = "SELECT debtor_no, name, curr_code, inactive FROM ".TB_PREF."debtors_master "; if ($fromcust != ALL_TEXT) $sql .= "WHERE debtor_no=".db_escape($fromcust); $sql .= " ORDER BY name"; @@ -187,7 +187,7 @@ function print_customer_balances() if ($no_zeros && db_num_rows($res) == 0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; diff --git a/reporting/rep102.php b/reporting/rep102.php index 76cbe1a5..78d96c80 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -140,7 +140,7 @@ function print_aged_customer_analysis() $total = array(0,0,0,0, 0); - $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master"; + $sql = "SELECT debtor_no, name, curr_code, inactive FROM ".TB_PREF."debtors_master"; if ($fromcust != ALL_TEXT) $sql .= " WHERE debtor_no=".db_escape($fromcust); $sql .= " ORDER BY name"; @@ -168,7 +168,7 @@ function print_aged_customer_analysis() if ($no_zeros && floatcmp(array_sum($str), 0) == 0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow["name"]); + $rep->TextCol(0, 2, $myrow["name"].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; $total[0] += ($custrec["Balance"] - $custrec["Due"]); diff --git a/reporting/rep115.php b/reporting/rep115.php index d75e8cf5..28bbc57e 100644 --- a/reporting/rep115.php +++ b/reporting/rep115.php @@ -182,32 +182,32 @@ function print_customer_balances() $grandtotal = array(0,0,0,0); - $sql = "SELECT ".TB_PREF."debtors_master.debtor_no, name, curr_code FROM ".TB_PREF."debtors_master - INNER JOIN ".TB_PREF."cust_branch - ON ".TB_PREF."debtors_master.debtor_no=".TB_PREF."cust_branch.debtor_no - INNER JOIN ".TB_PREF."areas - ON ".TB_PREF."cust_branch.area = ".TB_PREF."areas.area_code - INNER JOIN ".TB_PREF."salesman - ON ".TB_PREF."cust_branch.salesman=".TB_PREF."salesman.salesman_code"; + $sql = "SELECT d.debtor_no, name, curr_code, d.inactive FROM ".TB_PREF."debtors_master d + INNER JOIN ".TB_PREF."cust_branch b + ON d.debtor_no=b.debtor_no + INNER JOIN ".TB_PREF."areas a + ON b.area = a.area_code + INNER JOIN ".TB_PREF."salesman s + ON b.salesman=s.salesman_code"; if ($fromcust != ALL_TEXT ) { // if ($area != 0 || $folk != 0) continue; - $sql .= " WHERE ".TB_PREF."debtors_master.debtor_no=".db_escape($fromcust); + $sql .= " WHERE d.debtor_no=".db_escape($fromcust); } elseif ($area != 0) { if ($folk != 0) - $sql .= " WHERE ".TB_PREF."salesman.salesman_code=".db_escape($folk)." - AND ".TB_PREF."areas.area_code=".db_escape($area); + $sql .= " WHERE s.salesman_code=".db_escape($folk)." + AND a.area_code=".db_escape($area); else - $sql .= " WHERE ".TB_PREF."areas.area_code=".db_escape($area); + $sql .= " WHERE a.area_code=".db_escape($area); } elseif ($folk != 0 ) { - $sql .= " WHERE ".TB_PREF."salesman.salesman_code=".db_escape($folk); + $sql .= " WHERE s.salesman_code=".db_escape($folk); } - $sql .= " GROUP BY ".TB_PREF."debtors_master.debtor_no ORDER BY name"; + $sql .= " GROUP BY d.debtor_no ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); @@ -229,7 +229,7 @@ function print_customer_balances() if (db_num_rows($res) == 0 && !$no_zeros) { - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); $rep->AmountCol(3, 4, $curr_open, $dec); $rep->AmountCol(7, 8, $curr_open, $dec); $rep->NewLine(1); @@ -249,7 +249,7 @@ function print_customer_balances() $tot_cur_cr += $curr_cr; if ($no_zeros && $curr_open == 0.0 && $curr_db == 0.0 && $curr_cr == 0.0) continue; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); $rep->AmountCol(3, 4, $curr_open, $dec); $rep->AmountCol(4, 5, $curr_db, $dec); $rep->AmountCol(5, 6, $curr_cr, $dec); diff --git a/reporting/rep201.php b/reporting/rep201.php index 3b7ee708..00c48d5b 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -136,11 +136,11 @@ function print_supplier_balances() $total = array(); $grandtotal = array(0,0,0,0); - $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; + $sql = "SELECT supplier_id, supp_name AS name, curr_code, inactive FROM ".TB_PREF."suppliers"; if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; - $result = db_query($sql, "The customers could not be retrieved"); + $result = db_query($sql, "The suppliers could not be retrieved"); while ($myrow=db_fetch($result)) { @@ -164,7 +164,7 @@ function print_supplier_balances() if ($no_zeros && db_num_rows($res) == 0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; $rep->TextCol(3, 4, _("Open Balance")); diff --git a/reporting/rep202.php b/reporting/rep202.php index e35e7ba0..4f13042e 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -158,7 +158,7 @@ function print_aged_supplier_analysis() $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . _('Days'); $pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days'); - $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; + $sql = "SELECT supplier_id, supp_name AS name, curr_code, inactive FROM ".TB_PREF."suppliers"; if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; @@ -188,7 +188,7 @@ function print_aged_supplier_analysis() if ($no_zeros && floatcmp(array_sum($str), 0) == 0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; $total[0] += ($supprec["Balance"] - $supprec["Due"]); diff --git a/reporting/rep203.php b/reporting/rep203.php index 2a5c7bb0..38b7ac9f 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -107,11 +107,11 @@ function print_payment_report() $total = array(); $grandtotal = array(0,0); - $sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms + $sql = "SELECT supplier_id, supp_name AS name, curr_code, s.inactive, pt.terms FROM ".TB_PREF."suppliers s, ".TB_PREF."payment_terms pt WHERE "; if ($fromsupp != ALL_TEXT) $sql .= "supplier_id=".db_escape($fromsupp)." AND "; - $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator + $sql .= "s.payment_terms = pt.terms_indicator ORDER BY supp_name"; $result = db_query($sql, "The customers could not be retrieved"); @@ -123,7 +123,7 @@ function print_payment_report() if ($no_zeros && db_num_rows($res)==0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 6, $myrow['name'] . " - " . $myrow['terms']); + $rep->TextCol(0, 6, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "") . " - " . $myrow['terms']); if ($convert) $rep->TextCol(6, 7, $myrow['curr_code']); $rep->fontSize -= 2; diff --git a/reporting/rep206.php b/reporting/rep206.php index 9d184556..776b13e4 100644 --- a/reporting/rep206.php +++ b/reporting/rep206.php @@ -134,11 +134,11 @@ function print_supplier_balances() $total = array(); $grandtotal = array(0,0,0,0); - $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; + $sql = "SELECT supplier_id, supp_name AS name, curr_code, inactive FROM ".TB_PREF."suppliers"; if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; - $result = db_query($sql, "The customers could not be retrieved"); + $result = db_query($sql, "The suppliers could not be retrieved"); $tot_cur_cr = $tot_cur_db = 0; while ($myrow=db_fetch($result)) @@ -167,7 +167,7 @@ function print_supplier_balances() if (db_num_rows($res) == 0 && !$no_zeros) { - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); $rep->AmountCol(3, 4, $init[3], $dec); $rep->AmountCol(7, 8, $init[3], $dec); //$rep->Line($rep->row - 2); @@ -209,7 +209,7 @@ function print_supplier_balances() $total[3] = $total[1] - $total[0]; } if ($no_zeros && $total[3] == 0.0 && $curr_db == 0.0 && $curr_cr == 0.0) continue; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); $rep->AmountCol(3, 4, $total[3] + $curr_cr - $curr_db, $dec); $rep->AmountCol(4, 5, $curr_db, $dec); $rep->AmountCol(5, 6, $curr_cr, $dec);