X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep202.php;h=0ea9e5f80f8ca6eb12ad07bb680f1ddc99c0d386;hb=33dfc21a26f08e9ac19048bbcf80cce2351a6cfe;hp=4b788eb62fe46f4e0ad6521c6e00afaafb067957;hpb=107a22ab168c1102f3f534a22cd5b8290331f17d;p=fa-stable.git diff --git a/reporting/rep202.php b/reporting/rep202.php index 4b788eb6..0ea9e5f8 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -32,14 +32,13 @@ 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) $value = "(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)"; - else + else $value = "IF (".TB_PREF."supp_trans.type=".ST_SUPPINVOICE." OR ".TB_PREF."supp_trans.type=".ST_BANKDEPOSIT.", (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount - ".TB_PREF."supp_trans.alloc), (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount + ".TB_PREF."supp_trans.alloc))"; @@ -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, @@ -73,7 +72,7 @@ function get_invoices($supplier_id, $to, $all=true) function print_aged_supplier_analysis() { - global $path_to_root, $systypes_array; + global $path_to_root, $systypes_array, $SysPrefs; $to = $_POST['PARAM_0']; $fromsupp = $_POST['PARAM_1']; @@ -247,16 +246,15 @@ function print_aged_supplier_analysis() $rep->NewLine(); if ($graphics) { - global $decseps, $graph_skin; $pg->x = array(_('Current'), $nowdue, $pastdue1, $pastdue2); $pg->title = $rep->title; $pg->axis_x = _("Days"); $pg->axis_y = _("Amount"); $pg->graphic_1 = $to; $pg->type = $graphics; - $pg->skin = $graph_skin; + $pg->skin = $SysPrefs->graph_skin; $pg->built_in = false; - $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); + $pg->latin_notation = ($SysPrefs->decseps[user_dec_sep()] != "."); $filename = company_path(). "/pdf_files/". uniqid("").".png"; $pg->display($filename, true); $w = $pg->width / 1.5; @@ -270,4 +268,3 @@ function print_aged_supplier_analysis() $rep->End(); } -?>