$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";
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;
$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";
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"]);
$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");
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);
$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);
$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))
{
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"));
$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";
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"]);
$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");
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;
$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))
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);
$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);