X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep202.php;h=4f13042e9c21b09026a306a844431a74f8121690;hb=af03975abbd624d17cc6c4f61b71808a0a5c82ea;hp=04d1afa1d5365b735759ebde3e44376685740745;hpb=ae6743606f3ceac7655aa4dc04a7f1567d096441;p=fa-stable.git diff --git a/reporting/rep202.php b/reporting/rep202.php index 04d1afa1..4f13042e 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -39,9 +39,9 @@ function get_invoices($supplier_id, $to, $all=true) if ($all) $value = "(trans.ov_amount + trans.ov_gst + trans.ov_discount)"; else - $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT.", - (trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc), - (trans.ov_amount + trans.ov_gst + trans.ov_discount + trans.alloc))"; + $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT." OR (trans.type=".ST_JOURNAL." AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), + (trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc), + (trans.ov_amount + trans.ov_gst + trans.ov_discount + trans.alloc))"; $due = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_SUPPCREDIT.",trans.due_date,trans.tran_date)"; $sql = "SELECT trans.type, trans.reference, @@ -59,7 +59,7 @@ function get_invoices($supplier_id, $to, $all=true) AND trans.tran_date <= '$todate' AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) > ".FLOAT_COMP_DELTA; if (!$all) - $sql .= " AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc > ".FLOAT_COMP_DELTA; + $sql .= "AND $value <> 0 "; $sql .= " ORDER BY trans.tran_date"; @@ -91,7 +91,8 @@ function print_aged_supplier_analysis() if ($graphics) { include_once($path_to_root . "/reporting/includes/class.graphic.inc"); - $pg = new graph(); + $pg = new chart($graphics); + $serie = array(); } if ($fromsupp == ALL_TEXT) @@ -157,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"; @@ -187,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"]); @@ -237,21 +238,21 @@ function print_aged_supplier_analysis() $rep->AmountCol($i + 3, $i + 4, $total[$i], $dec); if ($graphics && $i < count($total) - 1) { - $pg->y[$i] = abs($total[$i]); + $serie[$i] = abs($total[$i]); } } $rep->Line($rep->row - 8); $rep->NewLine(); if ($graphics) { - $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 = $SysPrefs->graph_skin; - $pg->built_in = false; + $pg->setStream('png'); + $pg->setLabels(array(_('Current'), $nowdue, $pastdue1, $pastdue2)); + $pg->addSerie(_("Balances"), $serie); + $pg->setTitle($rep->title); + $pg->setXTitle(_("Days")); + $pg->setYTitle(_("Amount")); + $pg->setDTitle(number_format2($total[4])); + $pg->setValues(true); $pg->latin_notation = ($SysPrefs->decseps[user_dec_sep()] != "."); $filename = company_path(). "/pdf_files/". random_id().".png"; $pg->display($filename, true);