X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep115.php;fp=reporting%2Frep115.php;h=28bbc57e8a24973bc7f0374d33e4fef7db7ddefa;hb=af03975abbd624d17cc6c4f61b71808a0a5c82ea;hp=d75e8cf5785df31bcd4f7f7cb064d7853ea47156;hpb=2ce280fb8619210f21485b723ec4cb2b306fcce9;p=fa-stable.git 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);