print_aged_customer_analysis();
-function get_invoices($costomer_id, $to)
+function get_invoices($customer_id, $to)
{
$todate = date2sql($to);
$PastDueDays1 = get_company_pref('past_due_days');
".TB_PREF."debtor_trans
WHERE ".TB_PREF."debtor_trans.type <> ".ST_CUSTDELIVERY."
- AND ".TB_PREF."debtors_master.payment_terms = ".TB_PREF."payment_terms.terms_indicator
+ AND ".TB_PREF."debtor_trans.payment_terms = ".TB_PREF."payment_terms.terms_indicator
AND ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."debtor_trans.debtor_no
- AND ".TB_PREF."debtor_trans.debtor_no = $costomer_id
+ AND ".TB_PREF."debtor_trans.debtor_no = $customer_id
AND ".TB_PREF."debtor_trans.tran_date <= '$todate'
AND ABS(".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) > 0.004
ORDER BY ".TB_PREF."debtor_trans.tran_date";
function print_aged_customer_analysis()
{
- global $comp_path, $path_to_root, $systypes_array;
+ global $path_to_root, $systypes_array;
$to = $_POST['PARAM_0'];
$fromcust = $_POST['PARAM_1'];
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
- $rep->Header();
+ $rep->NewPage();
$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 FROM ".TB_PREF."debtors_master";
if ($fromcust != ALL_NUMERIC)
- $sql .= "WHERE debtor_no=$fromcust ";
- $sql .= "ORDER BY name";
+ $sql .= " WHERE debtor_no=".db_escape($fromcust);
+ $sql .= " ORDER BY name";
$result = db_query($sql, "The customers could not be retrieved");
while ($myrow=db_fetch($result))
$pg->built_in = false;
$pg->fontfile = $path_to_root . "/reporting/fonts/Vera.ttf";
$pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
- $filename = $comp_path .'/'. user_company(). "/images/test.png";
+ $filename = company_path(). "/images/test.png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
$h = $pg->height / 1.5;
$x = ($rep->pageWidth - $w) / 2;
$rep->NewLine(2);
if ($rep->row - $h < $rep->bottomMargin)
- $rep->Header();
+ $rep->NewPage();
$rep->AddImage($filename, $x, $rep->row - $h, $w, $h);
}
$rep->NewLine();