From d9cd816b3c19ec783362341f5405bc3dcd1d3c20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2012 00:11:49 +0100 Subject: [PATCH] Qual: Merge month.php and index.php page Prepare for adding statistics page into new tabs. --- htdocs/adherents/stats/index.php | 4 +- htdocs/comm/propal/stats/index.php | 101 +++++++++-- htdocs/comm/propal/stats/month.php | 178 -------------------- htdocs/commande/stats/index.php | 100 +++++++++-- htdocs/commande/stats/month.php | 194 ---------------------- htdocs/compta/deplacement/stats/index.php | 100 +++++++++-- htdocs/compta/deplacement/stats/month.php | 160 ------------------ htdocs/compta/facture/stats/index.php | 104 ++++++++++-- htdocs/compta/facture/stats/month.php | 172 ------------------- htdocs/core/menus/init_menu_auguria.sql | 15 +- htdocs/langs/en_US/main.lang | 8 + htdocs/langs/fr_FR/main.lang | 8 + 12 files changed, 385 insertions(+), 759 deletions(-) delete mode 100644 htdocs/comm/propal/stats/month.php delete mode 100644 htdocs/commande/stats/month.php delete mode 100755 htdocs/compta/deplacement/stats/month.php delete mode 100644 htdocs/compta/facture/stats/month.php diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index b5473d1045f..f44f69277df 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -164,6 +164,7 @@ print '

'; // Show array $data = $stats->getAllByYear(); + print ''; print ''; print ''; @@ -224,7 +225,8 @@ print '
'.$langs->trans("Year").'
'; dol_fiche_end(); -$db->close(); llxFooter(); + +$db->close(); ?> diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index bb30cec1f73..8f590c64778 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -39,8 +39,10 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$year = strftime("%Y", time()); -$startyear=$year-2; +$nowyear=strftime("%Y", dol_now()); +$year = GETPOST('year')>0?GETPOST('year'):$nowyear; +//$startyear=$year-2; +$startyear=$year-1; $endyear=$year; @@ -85,7 +87,7 @@ if (! $mesg) { $px1->SetData($data); $px1->SetPrecisionY(0); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -128,7 +130,7 @@ if (! $mesg) { $px2->SetData($data); $px2->SetPrecisionY(0); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -149,28 +151,100 @@ if (! $mesg) $px2->draw($filenameamount,$fileurlamount); } + +$res = $stats->getAverageByMonth($year); +$data = array(); +for ($i = 1 ; $i < 13 ; $i++) +{ + $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); +} + +if (!$user->rights->societe->client->voir || $user->societe_id) +{ + $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; +} + +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); +if (! $mesg) +{ + $px3->SetData($data); + //$i=$startyear;$legend=array(); + $i=$endyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px3->SetLegend($legend); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($WIDTH); + $px3->SetHeight($HEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->mode='depth'; + $px3->SetTitle($langs->trans("AmountAverage")); + + $px3->draw($filename_avg,$fileurl_avg); +} + + +// Show array +$data = $stats->getAllByYear(); +$arrayyears=array(); +foreach($data as $val) { + $arrayyears[$val['year']]=$val['year']; +} +if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; + + +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php'; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +dol_fiche_head($head,'byyear',$langs->trans("Statistics")); + + print ''; print '
'; // Show filter box print '
'; +print ''; print ''; print ''; +// Company print ''; -print ''; +// Year +print ''; print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; $filter='s.client in (1,2,3)'; print $form->select_company($socid,'socid',$filter,1); print '
'.$langs->trans("User").''; +// User +print '
'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; print $form->select_users($userid,'userid',1); print '
'.$langs->trans("Year").''; +print $form->selectarray('year',$arrayyears,$year,0); +print '
'; print '
'; print '

'; -// Show array -$data = $stats->getAllByYear(); - print ''; print ''; print ''; @@ -188,14 +262,14 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -216,12 +290,17 @@ else { print $px1->show(); print "
\n"; print $px2->show(); + print "
\n"; + print $px3->show(); } print '
'.$langs->trans("Year").'
'.$oldyear.''.$oldyear.'000
'.$year.''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; print '
'; -$db->close(); +dol_fiche_end(); + llxFooter(); + +$db->close(); ?> diff --git a/htdocs/comm/propal/stats/month.php b/htdocs/comm/propal/stats/month.php deleted file mode 100644 index b0b6076a94d..00000000000 --- a/htdocs/comm/propal/stats/month.php +++ /dev/null @@ -1,178 +0,0 @@ - - * Copyright (C) 2004-2012 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/comm/propal/stats/month.php - * \ingroup propale - * \brief Page des stats propositions commerciales par mois - */ - -require("../../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propalestats.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); - -$GRAPHWIDTH=500; -$GRAPHHEIGHT=200; - -// Check security access -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = isset($_GET["year"])?$_GET["year"]:date("Y",time()); - - -/* - * View - */ - -llxHeader(); - -$dir=$conf->propale->dir_temp; - -$mesg = ''.img_previous().' '; -$mesg.= $langs->trans("Year")." $year"; -$mesg.= ' '.img_next().''; -print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg); - -create_exdir($dir); - -$stats = new PropaleStats($db, $socid); - - -$data = $stats->getNbByMonth($year); - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename = $dir.'/proposalsnb-'.$user->id.'-'.$year.'.png'; - $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnb-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename = $dir.'/proposalsnb-'.$year.'.png'; - $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnb-'.$year.'.png'; -} - -$px1 = new DolGraph(); -$mesg = $px1->isGraphKo(); -if (! $mesg) -{ - $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); -} - - - -$data = $stats->getAmountByMonth($year); - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename_amount = $dir.'/proposalsamount-'.$user->id.'-'.$year.'.png'; - $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamount-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename_amount = $dir.'/proposalsamount-'.$year.'.png'; - $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamount-'.$year.'.png'; -} - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (! $mesg) -{ - $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); - -$data = array(); - -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename_avg = $dir.'/proposalsaverage-'.$user->id.'-'.$year.'.png'; - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsaverage-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename_avg = $dir.'/proposalsaverage-'.$year.'.png'; - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsaverage-'.$year.'.png'; -} - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (! $mesg) -{ - $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 $px1->show(); } -print '
'.$langs->trans("AmountTotal").''; -if ($mesg) { print $mesg; } -else { print $px2->show(); } -print '
'.$langs->trans("AmountAverage").''; -if ($mesg) { print $mesg; } -else { print $px3->show(); } -print '
'; - - -llxFooter(); - -$db->close(); -?> diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 12d4bafe827..73e14650a8c 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (c) 2004-2011 Laurent Destailleur + * Copyright (c) 2004-2012 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 @@ -43,8 +43,10 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$year = strftime("%Y", time()); -$startyear=$year-2; +$nowyear=strftime("%Y", dol_now()); +$year = GETPOST('year')>0?GETPOST('year'):$nowyear; +//$startyear=$year-2; +$startyear=$year-1; $endyear=$year; $langs->load("orders"); @@ -100,7 +102,7 @@ if (! $mesg) { $px1->SetData($data); $px1->SetPrecisionY(0); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -144,7 +146,7 @@ $mesg = $px2->isGraphKo(); if (! $mesg) { $px2->SetData($data); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -165,29 +167,100 @@ if (! $mesg) $px2->draw($filenameamount,$fileurlamount); } + +$res = $stats->getAverageByMonth($year); +$data = array(); +for ($i = 1 ; $i < 13 ; $i++) +{ + $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); +} + +if (!$user->rights->societe->client->voir || $user->societe_id) +{ + $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; +} + +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); +if (! $mesg) +{ + $px3->SetData($data); + //$i=$startyear;$legend=array(); + $i=$endyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px3->SetLegend($legend); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($WIDTH); + $px3->SetHeight($HEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->mode='depth'; + $px3->SetTitle($langs->trans("AmountAverage")); + + $px3->draw($filename_avg,$fileurl_avg); +} + + + +// Show array +$data = $stats->getAllByYear(); +$arrayyears=array(); +foreach($data as $val) { + $arrayyears[$val['year']]=$val['year']; +} +if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; + +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php'; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +dol_fiche_head($head,'byyear',$langs->trans("Statistics")); + print ''; print '
'; // Show filter box print '
'; +print ''; print ''; print ''; +// Company print ''; -print ''; +// Year +print ''; print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; if ($mode == 'customer') $filter='s.client in (1,2,3)'; if ($mode == 'supplier') $filter='s.fournisseur = 1'; print $form->select_company($socid,'socid',$filter,1); print '
'.$langs->trans("User").''; +// User +print '
'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; print $form->select_users($userid,'userid',1); print '
'.$langs->trans("Year").''; +print $form->selectarray('year',$arrayyears,$year,0); +print '
'; print '
'; print '

'; -// Show array -$data = $stats->getAllByYear(); - print ''; print ''; print ''; @@ -204,14 +277,14 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -232,11 +305,16 @@ else { print $px1->show(); print "
\n"; print $px2->show(); + print "
\n"; + print $px3->show(); } print '
'.$langs->trans("Year").'
'.$oldyear.''.$oldyear.'000
'.$year.''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; print '
'; +dol_fiche_end(); + + llxFooter(); $db->close(); diff --git a/htdocs/commande/stats/month.php b/htdocs/commande/stats/month.php deleted file mode 100644 index 402bb54d6db..00000000000 --- a/htdocs/commande/stats/month.php +++ /dev/null @@ -1,194 +0,0 @@ - - * Copyright (c) 2004-2008 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/commande/stats/month.php - * \ingroup commande - * \brief Page des stats commandes par mois - */ -require("../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); -require_once(DOL_DOCUMENT_ROOT."/commande/class/commandestats.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); - -$GRAPHWIDTH=500; -$GRAPHHEIGHT=200; - -// Check security access -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = isset($_GET["year"])?$_GET["year"]:date("Y",time()); - -$mode='customer'; -if (isset($_GET["mode"])) $mode=$_GET["mode"]; - - - -/* - * View - */ - -llxHeader(); - -if ($mode == 'customer') -{ - $title=$langs->trans("OrdersStatistics"); - $dir=$conf->commande->dir_temp; -} -if ($mode == 'supplier') -{ - $title=$langs->trans("OrdersStatisticsSuppliers"); - $dir=$conf->fournisseur->dir_output.'/commande/temp'; -} - -$mesg = ''.img_previous().' '; -$mesg.= $langs->trans("Year")." $year"; -$mesg.= ' '.img_next().''; -print_fiche_titre($title, $mesg); - -create_exdir($dir); - -$stats = new CommandeStats($db, $socid, $mode); - - -$data = $stats->getNbByMonth($year); - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename = $dir.'/ordersnb-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnb-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnb-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename = $dir.'/ordersnb-'.$year.'.png'; - if ($mode == 'customer') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnb-'.$year.'.png'; - if ($mode == 'supplier') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnb-'.$year.'.png'; -} - -$px1 = new DolGraph(); -$mesg = $px1->isGraphKo(); -if (! $mesg) -{ - $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); -} - - -$data = $stats->getAmountByMonth($year); - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename_amount = $dir.'/ordersamount-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamount-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamount-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename_amount = $dir.'/ordersamount-'.$year.'.png'; - if ($mode == 'customer') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamount-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamount-'.$year.'.png'; -} - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (! $mesg) -{ - $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); - -$data = array(); - -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} - -if (!$user->rights->societe->client->voir || $user->societe_id) -{ - $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; -} - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (! $mesg) -{ - $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 $px1->show(); } -print '
'.$langs->trans("AmountTotal").''; -if ($mesg) { print $mesg; } -else { print $px2->show(); } -print '
'.$langs->trans("AmountAverage").''; -if ($mesg) { print $mesg; } -else { print $px3->show(); } -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index bb9108ea738..54604b5c400 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (c) 2004-2011 Laurent Destailleur + * Copyright (c) 2004-2012 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 @@ -40,8 +40,10 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$year = strftime("%Y", time()); -$startyear=$year-2; +$nowyear=strftime("%Y", dol_now()); +$year = GETPOST('year')>0?GETPOST('year'):$nowyear; +//$startyear=$year-2; +$startyear=$year-1; $endyear=$year; $mode=GETPOST("mode")?GETPOST("mode"):'customer'; @@ -80,7 +82,7 @@ if (! $mesg) { $px1->SetData($data); $px1->SetPrecisionY(0); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -113,7 +115,7 @@ $mesg = $px2->isGraphKo(); if (! $mesg) { $px2->SetData($data); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -135,29 +137,98 @@ if (! $mesg) } +$res = $stats->getAverageByMonth($year); +$data = array(); +for ($i = 1 ; $i < 13 ; $i++) +{ + $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); +} + +if (!$user->rights->societe->client->voir || $user->societe_id) +{ + $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; +} + +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); +if (! $mesg) +{ + $px3->SetData($data); + //$i=$startyear;$legend=array(); + $i=$endyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px3->SetLegend($legend); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($WIDTH); + $px3->SetHeight($HEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->mode='depth'; + $px3->SetTitle($langs->trans("AmountAverage")); + + $px3->draw($filename_avg,$fileurl_avg); +} + + +// Show array +$data = $stats->getAllByYear(); +$arrayyears=array(); +foreach($data as $val) { + $arrayyears[$val['year']]=$val['year']; +} +if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; + + +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php'; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +dol_fiche_head($head,'byyear',$langs->trans("Statistics")); print ''; print '
'; // Show filter box print '
'; +print ''; print ''; print ''; +// Company print ''; -print ''; +// Year +print ''; print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; $filter=''; print $form->select_company($socid,'socid',$filter,1,1); print '
'.$langs->trans("User").''; +// User +print '
'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; print $form->select_users($userid,'userid',1); print '
'.$langs->trans("Year").''; +print $form->selectarray('year',$arrayyears,$year,0); +print '
'; print '
'; print '

'; -// Show array -$data = $stats->getAllByYear(); - print ''; print ''; print ''; @@ -174,14 +245,14 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -202,12 +273,17 @@ else { print $px1->show(); print "
\n"; print $px2->show(); + print "
\n"; + print $px3->show(); } print '
'.$langs->trans("Year").'
'.$oldyear.''.$oldyear.'000
'.$year.''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; print '
'; -$db->close(); +dol_fiche_end(); + llxFooter(); + +$db->close(); ?> diff --git a/htdocs/compta/deplacement/stats/month.php b/htdocs/compta/deplacement/stats/month.php deleted file mode 100755 index e7b15624bb8..00000000000 --- a/htdocs/compta/deplacement/stats/month.php +++ /dev/null @@ -1,160 +0,0 @@ - - * Copyright (c) 2004-2010 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/compta/deplacement/stats/month.php - * \ingroup facture - * \brief Page des stats notes de frais par mois - */ - -require("../../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); -require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacementstats.class.php"); - -$langs->load("trips"); - -$GRAPHWIDTH=500; -$GRAPHHEIGHT=200; - -// Check security access -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = isset($_GET["year"])?$_GET["year"]:date("Y",time()); - -$mode='customer'; -if (isset($_GET["mode"])) $mode=$_GET["mode"]; - - - -/* - * View - */ - -llxHeader(); - -$title=$langs->trans("TripsAndExpensesStatistics"); -$dir=$conf->deplacement->dir_temp; - -$mesg = ''.img_previous().' '; -$mesg.= $langs->trans("Year")." $year"; -$mesg.= ' '.img_next().''; -print_fiche_titre($title, $mesg); - -create_exdir($dir); - -$stats = new DeplacementStats($db, $socid); - - -$data = $stats->getNbByMonth($year); - -$filename = $dir."/tripsexpensesnb-".$year.".png"; -$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnb-'.$year.'.png'; - -$px1 = new DolGraph(); -$mesg = $px1->isGraphKo(); -if (! $mesg) -{ - $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); -} - - - -$data = $stats->getAmountByMonth($year); - -$filename_amount = $dir."/tripsexpensesamount-".$year.".png"; -$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamount-'.$year.'.png'; - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (! $mesg) -{ - $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); - -$data = array(); - -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} - -$filename_avg = $dir."/tripsexpensesaverage-".$year.".png"; -$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesaverage-'.$year.'.png'; - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (! $mesg) -{ - $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 $px1->show(); } -print '
'.$langs->trans("AmountTotal").''; -if ($mesg) { print $mesg; } -else { print $px2->show(); } -print '
'.$langs->trans("AmountAverage").''; -if ($mesg) { print $mesg; } -else { print $px3->show(); } -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 0a0a072220c..8ad50193924 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (c) 2004-2010 Laurent Destailleur + * Copyright (c) 2004-2012 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 @@ -29,6 +29,10 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facturestats.class.php"); $WIDTH=500; $HEIGHT=200; +$mode=GETPOST("mode")?GETPOST("mode"):'customer'; +if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden(); +if ($mode == 'supplier' && ! $user->rights->fournisseur->facture->lire) accessforbidden(); + $userid=GETPOST('userid'); if ($userid < 0) $userid=0; $socid=GETPOST('socid'); if ($socid < 0) $socid=0; // Security check @@ -38,12 +42,12 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$year = strftime("%Y", time()); -$startyear=$year-2; +$nowyear=strftime("%Y", dol_now()); +$year = GETPOST('year')>0?GETPOST('year'):$nowyear; +//$startyear=$year-2; +$startyear=$year-1; $endyear=$year; -$mode=GETPOST("mode")?GETPOST("mode"):'customer'; - /* * View @@ -88,7 +92,7 @@ if (! $mesg) { $px1->SetData($data); $px1->SetPrecisionY(0); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -122,7 +126,7 @@ $mesg = $px2->isGraphKo(); if (! $mesg) { $px2->SetData($data); - $i=$startyear; + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; @@ -144,30 +148,99 @@ if (! $mesg) } +$res = $stats->getAverageByMonth($year); +$data = array(); +for ($i = 1 ; $i < 13 ; $i++) +{ + $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); +} + +if (!$user->rights->societe->client->voir || $user->societe_id) +{ + $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; + if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; + if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; +} + +$px3 = new DolGraph(); +$mesg = $px3->isGraphKo(); +if (! $mesg) +{ + $px3->SetData($data); + //$i=$startyear;$legend=array(); + $i=$endyear;$legend=array(); + while ($i <= $endyear) + { + $legend[]=$i; + $i++; + } + $px3->SetLegend($legend); + $px3->SetYLabel($langs->trans("AmountAverage")); + $px3->SetMaxValue($px3->GetCeilMaxValue()); + $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetWidth($WIDTH); + $px3->SetHeight($HEIGHT); + $px3->SetShading(3); + $px3->SetHorizTickIncrement(1); + $px3->SetPrecisionY(0); + $px3->mode='depth'; + $px3->SetTitle($langs->trans("AmountAverage")); + + $px3->draw($filename_avg,$fileurl_avg); +} + + +// Show array +$data = $stats->getAllByYear(); +$arrayyears=array(); +foreach($data as $val) { + $arrayyears[$val['year']]=$val['year']; +} +if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; + + +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php'; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +dol_fiche_head($head,'byyear',$langs->trans("Statistics")); print ''; print '
'; // Show filter box print '
'; +print ''; print ''; print ''; +// Company print ''; -print ''; +// Year +print ''; print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; if ($mode == 'customer') $filter='s.client in (1,2,3)'; if ($mode == 'supplier') $filter='s.fournisseur = 1'; print $form->select_company($socid,'socid',$filter,1); print '
'.$langs->trans("User").''; +// User +print '
'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; print $form->select_users($userid,'userid',1); print '
'.$langs->trans("Year").''; +print $form->selectarray('year',$arrayyears,$year,0); +print '
'; print '
'; print '

'; -// Show array -$data = $stats->getAllByYear(); - print ''; print ''; print ''; @@ -184,14 +257,14 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -212,11 +285,16 @@ else { print $px1->show(); print "
\n"; print $px2->show(); + print "
\n"; + print $px3->show(); } print '
'.$langs->trans("Year").'
'.$oldyear.''.$oldyear.'000
'.$year.''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; print '
'; +dol_fiche_end(); + + llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/stats/month.php b/htdocs/compta/facture/stats/month.php deleted file mode 100644 index 1281152c002..00000000000 --- a/htdocs/compta/facture/stats/month.php +++ /dev/null @@ -1,172 +0,0 @@ - - * Copyright (c) 2004-2010 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/compta/facture/stats/month.php - * \ingroup facture - * \brief Page des stats factures par mois - */ - -require("../../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php"); -require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facturestats.class.php"); - -$GRAPHWIDTH=500; -$GRAPHHEIGHT=200; - -// Check security access -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = isset($_GET["year"])?$_GET["year"]:date("Y",time()); - -$mode='customer'; -if (isset($_GET["mode"])) $mode=$_GET["mode"]; - - - -/* - * View - */ - -$langs->load("bills"); - -llxHeader(); - -if ($mode == 'customer') -{ - $title=$langs->trans("BillsStatistics"); - $dir=$conf->facture->dir_temp; -} -if ($mode == 'supplier') -{ - $title=$langs->trans("BillsStatisticsSuppliers"); - $dir=$conf->fournisseur->dir_output.'/facture/temp'; -} - -$mesg = ''.img_previous().' '; -$mesg.= $langs->trans("Year")." $year"; -$mesg.= ' '.img_next().''; -print_fiche_titre($title, $mesg); - -create_exdir($dir); - -$stats = new FactureStats($db, $socid, $mode); - - -$data = $stats->getNbByMonth($year); - -$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'; - -$px1 = new DolGraph(); -$mesg = $px1->isGraphKo(); -if (! $mesg) -{ - $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); -} - - - -$data = $stats->getAmountByMonth($year); - -$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'; - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (! $mesg) -{ - $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); - -$data = array(); - -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} - -$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'; - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (! $mesg) -{ - $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 $px1->show(); } -print '
'.$langs->trans("AmountTotal").''; -if ($mesg) { print $mesg; } -else { print $px2->show(); } -print '
'.$langs->trans("AmountAverage").''; -if ($mesg) { print $mesg; } -else { print $px3->show(); } -print '
'; - -llxFooter(); - -$db->close(); -?> diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 4eefeb7512d..721b3dd4549 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -153,14 +153,15 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/fiche.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/impayees.php?leftmenu=suppliers_bills', 'Unpaid', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); -- Accountancy - Customer invoice -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/clients.php?action=facturer&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'Repeatable', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills', 'Unpaid', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/liste.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/clients.php?action=facturer&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'Repeatable', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills', 'Unpaid', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/liste.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Accountancy - Orders to bill insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); -- Donations diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 960e5ee8519..c78a083e148 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -606,6 +606,14 @@ SetLinkToThirdParty=Link to another third party CreateDraft=Create draft ClickToEdit=Click to edit ObjectDeleted=Object %s deleted +ByCountry=By country +ByTown=By town +ByDate=By date +ByMonthYear=By month/year +ByYear=By year +ByMonth=by month +ByDay=By day +BySalesRepresentative=By sales representative # Week day Monday=Monday diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 8c1af9231d6..35214bb2bfe 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -608,6 +608,14 @@ SetLinkToThirdParty=Lier vers un autre tiers CreateDraft=Créer brouillon ClickToEdit=Cliquer ici pour éditer ObjectDeleted=Objet %s supprimé +ByCountry=Par pays +ByTown=Par ville +ByDate=Par date +ByMonthYear=Par mois/année +ByYear=Par année +ByMonth=Par mois +ByDay=Par jour +BySalesRepresentative=Par commerciaux # Week day Monday=Lundi