diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index d805316dae6..1ef10f09dae 100755 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -22,7 +22,6 @@ */ require("../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/member.lib.php"); $graphwidth = 700; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 33829124cc0..b5473d1045f 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -73,31 +73,31 @@ $filenamenb = $dir.'/subscriptionsnbinyear-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscriptionsnbinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px1->SetData($data); + $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfSubscriptions")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("NbOfSubscriptions")); + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0,$px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfSubscriptions")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("NbOfSubscriptions")); - $px->draw($filenamenb); + $px1->draw($filenamenb,$fileurlnb); } // Build graphic amount of object @@ -108,31 +108,31 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); $filenameamount = $dir.'/subscriptionsamountinyear-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscriptionsamountinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px2->SetData($data); + $px2->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("AmountOfSubscriptions")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("AmountOfSubscriptions")); + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfSubscriptions")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("AmountOfSubscriptions")); - $px->draw($filenameamount); + $px2->draw($filenameamount,$fileurlamount); } @@ -214,9 +214,9 @@ print ''; print '
'; if ($mesg) { print $mesg; } else { - print ''.$langs->trans('; + print $px1->show(); print "
\n"; - print ''.$langs->trans('; + print $px2->show(); } print '
'; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 7aa5a8cde2f..bb30cec1f73 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -79,31 +79,31 @@ else $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px1->SetData($data); + $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfProposals")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("NumberOfProposalsByMonth")); + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0,$px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfProposals")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("NumberOfProposalsByMonth")); - $px->draw($filenamenb); + $px1->draw($filenamenb,$fileurlnb); } // Build graphic amount of object @@ -122,31 +122,31 @@ else $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px2->SetData($data); + $px2->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("AmountOfProposals")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("AmountOfProposalsByMonthHT")); + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfProposals")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT")); - $px->draw($filenameamount); + $px2->draw($filenameamount,$fileurlamount); } print ''; @@ -213,9 +213,9 @@ print ''; +// Graphs if ($mode == 'standard') { $prevyear=$year;$nextyear=$year; @@ -813,11 +829,11 @@ if ($mode == 'standard') print ''; print ''; // For year @@ -826,21 +842,18 @@ if ($mode == 'standard') print ''; print ''; print ''; } if ($mode == 'showalltime') { print ''; } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 81d6421df65..c4b0b4c913b 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -74,30 +74,30 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); $filenamenb = $dir."/tripsexpensesnbinyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnbinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px1->SetData($data); + $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("Number")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("NumberByMonth")); + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("Number")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("NumberByMonth")); - $px->draw($filenamenb); + $px1->draw($filenamenb,$fileurlnb); } // Build graphic amount of object @@ -108,30 +108,30 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); $filenameamount = $dir."/tripsexpensesamountinyear-".$year.".png"; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamountinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); + $px2->SetData($data); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("Amount")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("AmountTotal")); + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("Amount")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("AmountTotal")); - $px->draw($filenameamount); + $px2->draw($filenameamount,$fileurlamount); } @@ -201,13 +201,15 @@ print '
'; print '
'; if ($mesg) { print $mesg; } else { - print ''.$langs->trans('; + print $px1->show(); print "
\n"; - print ''.$langs->trans('; + print $px2->show(); } print '
'; diff --git a/htdocs/comm/propal/stats/month.php b/htdocs/comm/propal/stats/month.php index 82b0882dba0..e1f9cbc5fe6 100644 --- a/htdocs/comm/propal/stats/month.php +++ b/htdocs/comm/propal/stats/month.php @@ -70,19 +70,19 @@ else $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnb-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename); + $px1->SetData($data); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()); + $px1->SetWidth($GRAPHWIDTH); + $px1->SetHeight($GRAPHHEIGHT); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->draw($filename,$fileurl); } @@ -100,20 +100,20 @@ else $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamount-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountTotal")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_amount); + $px2->SetData($data); + $px2->SetYLabel($langs->trans("AmountTotal")); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue($px2->GetFloorMinValue()); + $px2->SetWidth($GRAPHWIDTH); + $px2->SetHeight($GRAPHHEIGHT); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->draw($filename_amount,$fileurl_amount); } @@ -137,38 +137,38 @@ else $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsaverage-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); - $px->SetYLabel($langs->trans("AmountAverage")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_avg); + $px3->SetData($data); + $px3->SetPrecisionY(0); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($GRAPHWIDTH); + $px3->SetHeight($GRAPHHEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->draw($filename_avg,$fileurl_avg); } print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("NumberOfProposalsByMonth").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px1->show(); } print '
'.$langs->trans("AmountTotal").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px2->show(); } print '
'.$langs->trans("AmountAverage").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px3->show(); } print '
'; $db->close(); diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 8de7332fdf1..12d4bafe827 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -94,30 +94,31 @@ else if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px1->SetData($data); + $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfOrder")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("NumberOfOrdersByMonth")); - $px->draw($filenamenb); + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0,$px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfOrder")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("NumberOfOrdersByMonth")); + + $px1->draw($filenamenb,$fileurlnb); } // Build graphic amount of object @@ -138,30 +139,30 @@ else if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); + $px2->SetData($data); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("AmountOfOrders")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfOrders")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); - $px->draw($filenameamount); + $px2->draw($filenameamount,$fileurlamount); } print ''; @@ -228,15 +229,15 @@ print '
'; print '
'; if ($mesg) { print $mesg; } else { - print ''.$langs->trans('; + print $px1->show(); print "
\n"; - print ''.$langs->trans('; + print $px2->show(); } print '
'; print '
'; -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/commande/stats/month.php b/htdocs/commande/stats/month.php index 48d0978221b..de2c595e048 100644 --- a/htdocs/commande/stats/month.php +++ b/htdocs/commande/stats/month.php @@ -86,20 +86,20 @@ else if ($mode == 'supplier') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnb-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetYLabel($langs->trans("NbOfOrders")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename); + $px1->SetData($data); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()); + $px1->SetWidth($GRAPHWIDTH); + $px1->SetHeight($GRAPHHEIGHT); + $px1->SetYLabel($langs->trans("NbOfOrders")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->draw($filename,$fileurl); } @@ -118,20 +118,20 @@ else if ($mode == 'supplier') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamount-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountTotal")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_amount); + $px2->SetData($data); + $px2->SetYLabel($langs->trans("AmountTotal")); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue($px2->GetFloorMinValue()); + $px2->SetWidth($GRAPHWIDTH); + $px2->SetHeight($GRAPHHEIGHT); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->draw($filename_amount,$fileurl_amount); } $res = $stats->getAverageByMonth($year); @@ -155,37 +155,37 @@ else if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; } -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountAverage")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_avg); + $px3->SetData($data); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($GRAPHWIDTH); + $px3->SetHeight($GRAPHHEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->draw($filename_avg,$fileurl_avg); } print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("NumberOfOrdersByMonth").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px1->show(); } print '
'.$langs->trans("AmountTotal").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px2->show(); } print '
'.$langs->trans("AmountAverage").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px3->show(); } print '
'; $db->close(); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 496c1605cf7..fa36854c1a8 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -222,6 +222,7 @@ else // Fabrication tableau 1 $file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png"; + $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($datas as $i => $val) @@ -230,25 +231,26 @@ else else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); - else $px->SetLegend(array($langs->transnoentities("Balance"))); - $px->SetLegendWidthMin(180); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->setBgColor('onglet'); - $px->setBgColorGrid(array(255,255,255)); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($file); + $px1 = new DolGraph(); + $px1->SetData($graph_datas); + if ($acct->min_desired) $px1->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); + else $px1->SetLegend(array($langs->transnoentities("Balance"))); + $px1->SetLegendWidthMin(180); + $px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue()); + $px1->SetTitle($title); + $px1->SetWidth($width); + $px1->SetHeight($height); + $px1->SetType('lines'); + $px1->setBgColor('onglet'); + $px1->setBgColorGrid(array(255,255,255)); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->draw($file,$fileurl); + $show1=$px1->show(); unset($graph_datas); - unset($px); + unset($px1); unset($datas); unset($datamin); unset($labels); @@ -351,6 +353,7 @@ else // Fabrication tableau 2 $file= $conf->banque->dir_temp."/balance".$account."-".$year.".png"; + $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($datas as $i => $val) @@ -358,25 +361,27 @@ else if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]); else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); - else $px->SetLegend(array($langs->transnoentities("Balance"))); - $px->SetLegendWidthMin(180); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->setBgColor('onglet'); - $px->setBgColorGrid(array(255,255,255)); - $px->SetHideXGrid(true); - //$px->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne - $px->SetPrecisionY(0); - $px->draw($file); + $px2 = new DolGraph(); + $px2->SetData($graph_datas); + if ($acct->min_desired) $px2->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); + else $px2->SetLegend(array($langs->transnoentities("Balance"))); + $px2->SetLegendWidthMin(180); + $px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue()); + $px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue()); + $px2->SetTitle($title); + $px2->SetWidth($width); + $px2->SetHeight($height); + $px2->SetType('lines'); + $px2->setBgColor('onglet'); + $px2->setBgColorGrid(array(255,255,255)); + $px2->SetHideXGrid(true); + //$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne + $px2->SetPrecisionY(0); + $px2->draw($file,$fileurl); - unset($px); + $show2=$px2->show(); + + unset($px2); unset($graph_datas); unset($datas); unset($datamin); @@ -457,6 +462,7 @@ else // Fabrication tableau 3 $file= $conf->banque->dir_temp."/balance".$account.".png"; + $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png"; $title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); $graph_datas=array(); foreach($datas as $i => $val) @@ -464,22 +470,25 @@ else if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]); else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); - else $px->SetLegend(array($langs->transnoentities("Balance"))); - $px->SetLegendWidthMin(180); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->setBgColor('onglet'); - $px->setBgColorGrid(array(255,255,255)); - $px->SetPrecisionY(0); - $px->draw($file); + $px3 = new DolGraph(); + $px3->SetData($graph_datas); + if ($acct->min_desired) $px3->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); + else $px3->SetLegend(array($langs->transnoentities("Balance"))); + $px3->SetLegendWidthMin(180); + $px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()>0?0:$px3->GetFloorMinValue()); + $px3->SetTitle($title); + $px3->SetWidth($width); + $px3->SetHeight($height); + $px3->SetType('lines'); + $px3->setBgColor('onglet'); + $px3->setBgColorGrid(array(255,255,255)); + $px3->SetPrecisionY(0); + $px3->draw($file,$fileurl); + $show3=$px3->show(); + + unset($px3); unset($graph_datas); unset($datas); unset($datamin); @@ -582,31 +591,34 @@ else // Fabrication tableau 4a $file= $conf->banque->dir_temp."/movement".$account."-".$year.$month.".png"; + $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($data_credit as $i => $val) { $graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit"))); - $px->SetLegendWidthMin(180); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('bars'); - $px->SetShading(3); - $px->setBgColor('onglet'); - $px->setBgColorGrid(array(255,255,255)); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($file); + $px4 = new DolGraph(); + $px4->SetData($graph_datas); + $px4->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit"))); + $px4->SetLegendWidthMin(180); + $px4->SetMaxValue($px4->GetCeilMaxValue()<0?0:$px4->GetCeilMaxValue()); + $px4->SetMinValue($px4->GetFloorMinValue()>0?0:$px4->GetFloorMinValue()); + $px4->SetTitle($title); + $px4->SetWidth($width); + $px4->SetHeight($height); + $px4->SetType('bars'); + $px4->SetShading(3); + $px4->setBgColor('onglet'); + $px4->setBgColorGrid(array(255,255,255)); + $px4->SetHorizTickIncrement(1); + $px4->SetPrecisionY(0); + $px4->draw($file,$fileurl); + + $show4=$px4->show(); unset($graph_datas); - unset($px); + unset($px4); unset($debits); unset($credits); } @@ -688,31 +700,34 @@ else // Fabrication tableau 4b $file= $conf->banque->dir_temp."/movement".$account."-".$year.".png"; + $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($data_credit as $i => $val) { $graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit"))); - $px->SetLegendWidthMin(180); - $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('bars'); - $px->SetShading(3); - $px->setBgColor('onglet'); - $px->setBgColorGrid(array(255,255,255)); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($file); + $px5 = new DolGraph(); + $px5->SetData($graph_datas); + $px5->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit"))); + $px5->SetLegendWidthMin(180); + $px5->SetMaxValue($px5->GetCeilMaxValue()<0?0:$px5->GetCeilMaxValue()); + $px5->SetMinValue($px5->GetFloorMinValue()>0?0:$px5->GetFloorMinValue()); + $px5->SetTitle($title); + $px5->SetWidth($width); + $px5->SetHeight($height); + $px5->SetType('bars'); + $px5->SetShading(3); + $px5->setBgColor('onglet'); + $px5->setBgColorGrid(array(255,255,255)); + $px5->SetHorizTickIncrement(1); + $px5->SetPrecisionY(0); + $px5->draw($file,$fileurl); + + $show5=$px5->show(); unset($graph_datas); - unset($px); + unset($px5); unset($debits); unset($credits); } @@ -800,6 +815,7 @@ else print '

'; $file = "movement".$account."-".$year.$month.".png"; - print ''; + print $show4; + print '
'; - $file = "balance".$account."-".$year.$month.".png"; - print ''; + print $show1; print '
'.$lien.'
'; - $file = "movement".$account."-".$year.".png"; - print ''; + print $show5; print '
'; - $file = "balance".$account."-".$year.".png"; - print ''; + print $show2; print '
'; - $file = "balance".$account.".png"; - print ''; + print $show3; print '
'; print '
'; if ($mesg) { print $mesg; } else { - print ''.$langs->trans('; + print $px1->show(); print "
\n"; - print ''.$langs->trans('; + print $px2->show(); } print '
'; print '
'; llxFooter(); + +$db->close(); ?> diff --git a/htdocs/compta/deplacement/stats/month.php b/htdocs/compta/deplacement/stats/month.php index f39d5a8e1b6..54b4d3b83af 100755 --- a/htdocs/compta/deplacement/stats/month.php +++ b/htdocs/compta/deplacement/stats/month.php @@ -69,19 +69,19 @@ $data = $stats->getNbByMonth($year); $filename = $dir."/tripsexpensesnb-".$year.".png"; $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnb-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename); + $px1->SetData($data); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()); + $px1->SetWidth($GRAPHWIDTH); + $px1->SetHeight($GRAPHHEIGHT); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->draw($filename,$fileurl); } @@ -91,20 +91,20 @@ $data = $stats->getAmountByMonth($year); $filename_amount = $dir."/tripsexpensesamount-".$year.".png"; $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamount-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountTotal")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_amount); + $px2->SetData($data); + $px2->SetYLabel($langs->trans("AmountTotal")); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue($px2->GetFloorMinValue()); + $px2->SetWidth($GRAPHWIDTH); + $px2->SetHeight($GRAPHHEIGHT); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->draw($filename_amount,$fileurl_amount); } @@ -121,37 +121,37 @@ for ($i = 1 ; $i < 13 ; $i++) $filename_avg = $dir."/tripsexpensesaverage-".$year.".png"; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesaverage-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountAverage")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_avg); + $px3->SetData($data); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($GRAPHWIDTH); + $px3->SetHeight($GRAPHHEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->draw($filename_avg,$fileurl_avg); } print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("NumberByMonth").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px1->show(); } print '
'.$langs->trans("AmountTotal").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px2->show(); } print '
'.$langs->trans("AmountAverage").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px3->show(); } print '
'; $db->close(); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index cf7ebb554f2..0a0a072220c 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -82,30 +82,30 @@ $filenamenb = $dir."/invoicesnbinyear-".$year.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnbinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetPrecisionY(0); + $px1->SetData($data); + $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NumberOfBills")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("NumberOfBillsByMonth")); + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NumberOfBills")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->mode='depth'; + $px1->SetTitle($langs->trans("NumberOfBillsByMonth")); - $px->draw($filenamenb); + $px1->draw($filenamenb,$fileurlnb); } // Build graphic amount of object @@ -117,30 +117,30 @@ $filenameamount = $dir."/invoicesamountinyear-".$year.".png"; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesamountinyear-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); + $px2->SetData($data); $i=$startyear; while ($i <= $endyear) { $legend[]=$i; $i++; } - $px->SetLegend($legend); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue(min(0,$px->GetFloorMinValue())); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("AmountOfBills")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->mode='depth'; - $px->SetTitle($langs->trans("AmountOfBillsByMonthHT")); + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfBills")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->mode='depth'; + $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT")); - $px->draw($filenameamount); + $px2->draw($filenameamount,$fileurlamount); } @@ -202,8 +202,6 @@ foreach ($data as $val) print ''; -$db->close(); - print ''; print ''; @@ -211,13 +209,15 @@ print ''; print '
'; if ($mesg) { print $mesg; } else { - print ''.$langs->trans('; + print $px1->show(); print "
\n"; - print ''.$langs->trans('; + print $px2->show(); } print '
'; print ''; llxFooter(); + +$db->close(); ?> diff --git a/htdocs/compta/facture/stats/month.php b/htdocs/compta/facture/stats/month.php index 9d6cfdd7294..89f4472d6e1 100644 --- a/htdocs/compta/facture/stats/month.php +++ b/htdocs/compta/facture/stats/month.php @@ -78,19 +78,20 @@ $filename = $dir."/invoicesnb-".$year.".png"; if ($mode == 'customer') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnb-'.$year.'.png'; if ($mode == 'supplier') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnb-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename); + $px1->SetData($data); + $px1->SetYLabel($langs->trans("NumberOfBillsByMonth")); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()); + $px1->SetWidth($GRAPHWIDTH); + $px1->SetHeight($GRAPHHEIGHT); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->SetPrecisionY(0); + $px1->draw($filename,$fileurl); } @@ -101,20 +102,20 @@ $filename_amount = $dir."/invoicesamount-".$year.".png"; if ($mode == 'customer') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamount-'.$year.'.png'; if ($mode == 'supplier') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesamount-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountTotal")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_amount); + $px2->SetData($data); + $px2->SetYLabel($langs->trans("AmountTotal")); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue($px2->GetFloorMinValue()); + $px2->SetWidth($GRAPHWIDTH); + $px2->SetHeight($GRAPHHEIGHT); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetPrecisionY(0); + $px2->draw($filename_amount,$fileurl_amount); } @@ -132,40 +133,40 @@ $filename_avg = $dir."/invoicesaverage-".$year.".png"; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesaverage-'.$year.'.png'; -$px = new DolGraph(); -$mesg = $px->isGraphKo(); +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); if (! $mesg) { - $px->SetData($data); - $px->SetYLabel($langs->trans("AmountAverage")); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetWidth($GRAPHWIDTH); - $px->SetHeight($GRAPHHEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); - $px->draw($filename_avg); + $px3->SetData($data); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($GRAPHWIDTH); + $px3->SetHeight($GRAPHHEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->draw($filename_avg,$fileurl_avg); } print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("NumberOfBillsByMonth").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px1->show(); } print '
'.$langs->trans("AmountTotal").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px2->show(); } print '
'.$langs->trans("AmountAverage").''; if ($mesg) { print $mesg; } -else { print ''; } +else { print $px3->show(); } print '
'; -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index dfae7d72d17..eaf35954bfb 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1,6 +1,6 @@ - * Copyright (c) 2004-2008 Laurent Destailleur + * Copyright (c) 2004-2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ /** * \file htdocs/core/class/dolgraph.class.php * \ingroup core - * \brief Fichier de la classe mere de gestion des graph + * \brief File for class to generate graph * * Usage: * $graph_data = array(array('labelA',yA),array('labelB',yB)); @@ -48,6 +48,7 @@ class DolGraph //! Tableau de donnees var $data; // array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) + var $title; var $width=380; var $height=200; var $MaxValue=0; @@ -76,6 +77,8 @@ class DolGraph var $bgcolorgrid; // array(R,G,B) var $datacolor; // array(array(R,G,B),...) + private $stringtoshow; // To store string to output graph into HTML page + /** * Constructor @@ -117,7 +120,7 @@ class DolGraph /** * Set Y precision - * + * * @param float $which_prec * @return string */ @@ -129,7 +132,7 @@ class DolGraph /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 - * + * * @param float $xi */ function SetHorizTickIncrement($xi) @@ -140,7 +143,7 @@ class DolGraph /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 - * + * * @param float $xt */ function SetNumXTicks($xt) @@ -151,7 +154,7 @@ class DolGraph /** * Set label interval to reduce number of labels - * + * * @param float $x */ function SetLabelInterval($x) @@ -179,7 +182,7 @@ class DolGraph } /** - * + * * @param unknown_type $label */ function SetYLabel($label) @@ -188,7 +191,7 @@ class DolGraph } /** - * + * * @param $w */ function SetWidth($w) @@ -197,7 +200,7 @@ class DolGraph } /** - * + * * @param $title */ function SetTitle($title) @@ -206,7 +209,7 @@ class DolGraph } /** - * + * * @param $data */ function SetData($data) @@ -215,7 +218,7 @@ class DolGraph } /** - * + * * @param $type */ function SetType($type) @@ -224,16 +227,16 @@ class DolGraph } /** - * + * * @param $legend */ function SetLegend($legend) { $this->Legend = $legend; } - + /** - * + * * @param $legendwidthmin */ function SetLegendWidthMin($legendwidthmin) @@ -242,16 +245,16 @@ class DolGraph } /** - * + * * @param $max */ function SetMaxValue($max) { $this->MaxValue = $max; } - + /** - * + * */ function GetMaxValue() { @@ -259,16 +262,16 @@ class DolGraph } /** - * + * * @param $min */ function SetMinValue($min) { $this->MinValue = $min; } - + /** - * + * */ function GetMinValue() { @@ -276,7 +279,7 @@ class DolGraph } /** - * + * * @param $h */ function SetHeight($h) @@ -285,7 +288,7 @@ class DolGraph } /** - * + * * @param $s */ function SetShading($s) @@ -294,7 +297,7 @@ class DolGraph } /** - * + * */ function ResetBgColor() { @@ -302,7 +305,7 @@ class DolGraph } /** - * + * */ function ResetBgColorGrid() { @@ -310,7 +313,7 @@ class DolGraph } /** - * + * */ function isGraphKo() { @@ -320,7 +323,7 @@ class DolGraph /** * Definie la couleur de fond de l'image complete - * + * * @param array $bg_color array(R,G,B) ou 'onglet' ou 'default' * @return void */ @@ -347,7 +350,7 @@ class DolGraph /** * Definie la couleur de fond de la grille - * + * * @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' */ function SetBgColorGrid($bg_colorgrid = array(255,255,255)) @@ -372,7 +375,7 @@ class DolGraph } /** - * + * */ function ResetDataColor() { @@ -380,7 +383,7 @@ class DolGraph } /** - * + * */ function GetMaxValueInData() { @@ -403,7 +406,7 @@ class DolGraph } /** - * + * */ function GetMinValueInData() { @@ -472,34 +475,36 @@ class DolGraph /** * Build a graph onto disk using correct library - * - * @param string $file Image file name on disk to generate + * + * @param string $file Image file name to use if we save onto disk + * @param string $fileurl Url path to show image if saved onto disk * @return void */ - function draw($file) + function draw($file,$fileurl='') { if (! is_array($this->data) || count($this->data) < 1) { $this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters"; - dol_syslog("DolGraph::draw ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR); return -1; } $call = "draw_".$this->library; - $this->$call($file); + $this->$call($file,$fileurl); } /** * Build a graph onto disk using Artichow library - * - * @param string $file Image file name on disk to generate + * + * @param string $file Image file name to use if we save onto disk + * @param string $fileurl Url path to show image if saved onto disk * @return void */ - private function draw_artichow($file) + private function draw_artichow($file,$fileurl) { global $artichow_defaultfont; - - dol_syslog("DolGraph.class::draw_artichow this->type=".$this->type); + + dol_syslog(get_class($this)."::draw_artichow this->type=".$this->type); if (! defined('SHADOW_RIGHT_TOP')) define('SHADOW_RIGHT_TOP',3); if (! defined('LEGEND_BACKGROUND')) define('LEGEND_BACKGROUND',2); @@ -662,8 +667,20 @@ class DolGraph // Generate file $graph->draw($file); + + $this->stringtoshow=''.dol_escape_htmltag($this->title?$this->title:$this->YLabel).''; } + + /** + * Output HTML string to show graph + * + * @return string HTML string to show graph + */ + function show() + { + return $this->stringtoshow; + } } ?> diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 4e1e0cc4837..590231c9003 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -29,6 +29,10 @@ require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php"); $langs->load("sendings"); +/* + * View + */ + llxHeader(); print_fiche_titre($langs->trans("StatisticsOfSendings"), $mesg); @@ -64,7 +68,7 @@ print ''; print '
'; print ''.$langs->trans("StatsOnShipmentsOnlyValidated").''; -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/expedition/stats/month.php b/htdocs/expedition/stats/month.php index 5cf8bb61297..42d898068e9 100644 --- a/htdocs/expedition/stats/month.php +++ b/htdocs/expedition/stats/month.php @@ -28,6 +28,10 @@ require_once(DOL_DOCUMENT_ROOT."/expedition/class/expeditionstats.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); +/* + * View + */ + llxHeader(); $WIDTH=500; @@ -35,7 +39,7 @@ $HEIGHT=200; $mesg = ''; -print_fiche_titre('Statistiques expeditions '.$_GET["year"], $mesg); +print_fiche_titre($langs->trans("StatisticsOfSendings").' '.$_GET["year"], $mesg); $stats = new ExpeditionStats($db); $data = $stats->getNbExpeditionByMonth($_GET["year"]); @@ -57,17 +61,17 @@ if (! $mesg) $px->SetShading(3); $px->SetHorizTickIncrement(1); $px->SetPrecisionY(0); - $px->draw($filename); + $px->draw($filename,$fileurl); } print ''; print ''; print ''; print '
Nombre d expedition par mois'; -print ''; +print $px->show(); print '
'; -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index eda21194932..bb5a307e56d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1480,7 +1480,7 @@ class Product extends CommonObject for ($j = 0 ; $j < 12 ; $j++) { - $idx=ucfirst(substr(dol_print_date(dol_mktime(12,0,0,$month,1,$year),"%b"),0,3) ); + $idx=ucfirst(dol_trunc(dol_print_date(dol_mktime(12,0,0,$month,1,$year),"%b"),3)); $monthnum=sprintf("%02s",$month); $result[$j] = array($idx,isset($tab[$year.$month])?$tab[$year.$month]:0); diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index f48b5d13e4d..04f5c030410 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -89,23 +89,6 @@ if (! empty($id) || ! empty($ref)) print $object->getLibStatut(2,1); print ''; - - // Graphs additionels generes pas le script product-graph.php - $year = strftime('%Y',time()); - $file = get_exdir($object->id, 3) . "ventes-".$year."-".$object->id.".png"; - if (file_exists (DOL_DATA_ROOT.'/product/temp/'.$file) ) - { - print 'Ventes'; - - $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_product&file='.$file; - print 'Ventes'; - $file = get_exdir($object->id, 3) . "ventes-".$object->id.".png"; - $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_product&file='.$file; - print 'Ventes'; - print ''; - } - - print ''; print ''; @@ -141,20 +124,16 @@ if (! empty($id) || ! empty($ref)) $graphfiles=array( 'propal' =>array('modulepart'=>'productstats_proposals', 'file' => $object->id.'/propal12m.png', - 'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsProposals"):$langs->trans("NumberOfProposals"))), + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))), 'orders' =>array('modulepart'=>'productstats_orders', 'file' => $object->id.'/orders12m.png', - 'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsCustomerOrders"):$langs->trans("NumberOfCustomerOrders"))), + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))), 'invoices' =>array('modulepart'=>'productstats_invoices', 'file' => $object->id.'/invoices12m.png', - 'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsCustomerInvoices"):$langs->trans("NumberOfCustomerInvoices"))), + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))), 'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers', 'file' => $object->id.'/invoicessuppliers12m.png', - 'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsSupplierInvoices"):$langs->trans("NumberOfSupplierInvoices"))), - - // 'orderssuppliers' =>array('modulepart'=>'productstats_orderssuppliers', 'file' => $object->id.'/orderssuppliers12m.png', 'label' => $langs->trans("Nombre commande fournisseurs sur les 12 derniers mois")), - // 'contracts' =>array('modulepart'=>'productstats_contracts', 'file' => $object->id.'/contracts12m.png', 'label' => $langs->trans("Nombre contrats sur les 12 derniers mois")), - + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))), ); $px = new DolGraph(); @@ -175,9 +154,11 @@ if (! empty($id) || ! empty($ref)) if ($key == 'orders') $graph_data = $object->get_nb_order($socid,$mode); if ($key == 'invoices') $graph_data = $object->get_nb_vente($socid,$mode); if ($key == 'invoicessuppliers') $graph_data = $object->get_nb_achat($socid,$mode); + if (is_array($graph_data)) { $px->SetData($graph_data); + $px->SetYLabel($graphfiles[$key]['label']); $px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue()); $px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue()); $px->SetWidth($WIDTH); @@ -187,7 +168,10 @@ if (! empty($id) || ! empty($ref)) $px->SetShading(3); //print 'x '.$key.' '.$graphfiles[$key]['file']; - $px->draw($dir."/".$graphfiles[$key]['file']); + $url=DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&file='.urlencode($graphfiles[$key]['file']); + $px->draw($dir."/".$graphfiles[$key]['file'],$url); + + $graphfiles[$key]['output']=$px->show(); } else { @@ -223,16 +207,14 @@ if (! empty($id) || ! empty($ref)) print ''; // Image print ''; - //print $graphfiles[$key]['modulepart']."x".urlencode($graphfiles[$key]['file']); - $url=DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&file='.urlencode($graphfiles[$key]['file']); - //print $url; - print ''.$graphfiles[$key]['label'].''; + print $graphfiles[$key]['output']; print ''; // Date generation print ''; - if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file']) && ! $px->isGraphKo()) + if ($graphfiles[$key]['output'] && ! $px->isGraphKo()) { - print ''.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).''; + if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print ''.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).''; + else print ''.$langs->trans("GeneratedOn",dol_print_date(dol_now()),"dayhour").''; } else { @@ -264,8 +246,7 @@ else dol_print_error(); } +llxFooter(); $db->close(); - -llxFooter(); ?> \ No newline at end of file diff --git a/scripts/banks/build-graph-sold-example.php b/scripts/banks/build-graph-sold-example.php index 1f7a81eea6b..8234510c1ac 100644 --- a/scripts/banks/build-graph-sold-example.php +++ b/scripts/banks/build-graph-sold-example.php @@ -238,16 +238,16 @@ foreach ($accounts as $account) { $graph_datas[$i]=array("$labels[$i]",$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->trans("Balance"))); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->draw($file); + $px1 = new DolGraph(); + $px1->SetData($graph_datas); + $px1->SetLegend(array($langs->trans("Balance"))); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue($px1->GetFloorMinValue()); + $px1->SetTitle($title); + $px1->SetWidth($width); + $px1->SetHeight($height); + $px1->SetType('lines'); + $px1->draw($file,''); // Chargement du tableau $amounts @@ -333,15 +333,15 @@ foreach ($accounts as $account) { $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->trans("Balance"))); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->draw($file); + $px2 = new DolGraph(); + $px2->SetData($graph_datas); + $px2->SetLegend(array($langs->trans("Balance"))); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetTitle($title); + $px2->SetWidth($width); + $px2->SetHeight($height); + $px2->SetType('lines'); + $px2->draw($file,''); // Chargement du tableau $amounts @@ -408,16 +408,16 @@ foreach ($accounts as $account) { $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->trans("Balance"))); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('lines'); - $px->draw($file); + $px3 = new DolGraph(); + $px3->SetData($graph_datas); + $px3->SetLegend(array($langs->trans("Balance"))); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetTitle($title); + $px3->SetWidth($width); + $px3->SetHeight($height); + $px3->SetType('lines'); + $px3->draw($file,''); // Chargement du tableau $credits, $debits @@ -488,17 +488,17 @@ foreach ($accounts as $account) { $graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]); } - $px = new DolGraph(); - $px->SetData($graph_datas); - $px->SetLegend(array($langs->trans("Debit"),$langs->trans("Credit"))); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetMinValue($px->GetFloorMinValue()); - $px->SetTitle($title); - $px->SetWidth($width); - $px->SetHeight($height); - $px->SetType('bars'); - $px->SetShading(3); - $px->draw($file); + $px4 = new DolGraph(); + $px4->SetData($graph_datas); + $px4->SetLegend(array($langs->trans("Debit"),$langs->trans("Credit"))); + $px4->SetMaxValue($px4->GetCeilMaxValue()); + $px4->SetMinValue($px4->GetFloorMinValue()); + $px4->SetTitle($title); + $px4->SetWidth($width); + $px4->SetHeight($height); + $px4->SetType('bars'); + $px4->SetShading(3); + $px4->draw($file,''); } $db->close();