Credit note can be posted without customer selected when search customer List is...
[fa-stable.git] / reporting / rep202.php
index d327f8b9771ae77cb7bab72d9c88bfedf6cc2cab..0e122ab4f25a4f5c6bc9587a896dc14e030a3d06 100644 (file)
@@ -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)
@@ -211,7 +212,7 @@ function print_aged_supplier_analysis()
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->TextCol(2, 3,     sql2date($trans['tran_date']), -2);
                                foreach ($trans as $i => $value)
-                                       $trans[$i] *= $rate;
+                                       $trans[$i] = (float)$trans[$i] * $rate;
                                $str = array($trans["Balance"] - $trans["Due"],
                                        $trans["Due"]-$trans["Overdue1"],
                                        $trans["Overdue1"]-$trans["Overdue2"],
@@ -237,23 +238,23 @@ 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/". uniqid("").".png";
+               $filename = company_path(). "/pdf_files/". random_id().".png";
                $pg->display($filename, true);
                $w = $pg->width / 1.5;
                $h = $pg->height / 1.5;