New: Add statistics report for supplier invoices
This commit is contained in:
parent
e434ffd4f6
commit
e2ec5cb613
@ -24,6 +24,8 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . "/stats.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . "/facture.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . "/fourn/fournisseur.facture.class.php";
|
||||
|
||||
/**
|
||||
* \class FactureStats
|
||||
@ -32,11 +34,37 @@ include_once DOL_DOCUMENT_ROOT . "/stats.class.php";
|
||||
class FactureStats extends Stats
|
||||
{
|
||||
var $db ;
|
||||
|
||||
function FactureStats($DB, $socid=0)
|
||||
|
||||
var $socid;
|
||||
var $where;
|
||||
|
||||
var $table_element;
|
||||
var $field;
|
||||
|
||||
function FactureStats($DB, $socid=0, $mode)
|
||||
{
|
||||
$this->db = $DB;
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Facture($this->db);
|
||||
$this->table_element=$object->table_element;
|
||||
$this->field='total';
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$object=new FactureFournisseur($this->db);
|
||||
$this->table_element=$object->table_element;
|
||||
$this->field='total_ht';
|
||||
}
|
||||
|
||||
$this->socid = $socid;
|
||||
$this->where =" fk_statut > 0";
|
||||
if ($mode == 'customer') $this->where.=" AND (fk_statut != 3 OR close_code != 'replaced')"; // Exclude replaced invoices
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND fk_soc = ".$this->socid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -46,8 +74,10 @@ class FactureStats extends Stats
|
||||
*/
|
||||
function getNbByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(datef,'%Y') as dm, count(*) FROM ".MAIN_DB_PREFIX."facture GROUP BY dm DESC WHERE fk_statut > 0";
|
||||
|
||||
$sql = "SELECT date_format(datef,'%Y') as dm, count(*)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." GROUP BY dm DESC";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
|
||||
@ -59,13 +89,11 @@ class FactureStats extends Stats
|
||||
*/
|
||||
function getNbByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, count(*) FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0";
|
||||
if ($this->socid)
|
||||
{
|
||||
$sql .= " AND fk_soc = ".$this->socid;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, count(*)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE date_format(datef,'%Y') = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql);
|
||||
//var_dump($res);print '<br>';
|
||||
@ -80,13 +108,11 @@ class FactureStats extends Stats
|
||||
*/
|
||||
function getAmountByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, sum(total) FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0";
|
||||
if ($this->socid)
|
||||
{
|
||||
$sql .= " AND fk_soc = ".$this->socid;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, sum(".$this->field.")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE date_format(datef,'%Y') = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql);
|
||||
//var_dump($res);print '<br>';
|
||||
@ -100,16 +126,28 @@ class FactureStats extends Stats
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, avg(total) FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0";
|
||||
if ($this->socid)
|
||||
{
|
||||
$sql .= " AND fk_soc = ".$this->socid;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, avg(".$this->field.")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE date_format(datef,'%Y') = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return nb, total and average
|
||||
* \return array Array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(datef,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year DESC";
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -37,6 +37,13 @@ if ($user->societe_id > 0)
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
|
||||
$mode='customer';
|
||||
if (isset($_GET["mode"])) $mode=$_GET["mode"];
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -44,15 +51,22 @@ if ($user->societe_id > 0)
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("BillsStatistics"), $mesg);
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$title=$langs->trans("BillsStatistics");
|
||||
$dir=$conf->facture->dir_temp;
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$title=$langs->trans("BillsStatisticsSuppliers");
|
||||
$dir=$conf->fournisseur->facture->dir_temp;
|
||||
}
|
||||
|
||||
create_exdir($conf->facture->dir_temp);
|
||||
print_fiche_titre($title, $mesg);
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
create_exdir($dir);
|
||||
|
||||
$stats = new FactureStats($db, $socid);
|
||||
$stats = new FactureStats($db, $socid, $mode);
|
||||
|
||||
|
||||
// Build graphic number of invoices
|
||||
@ -60,8 +74,9 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$filenamenbinvoices = $conf->facture->dir_temp."/invoicesnbinyear-".$year.".png";
|
||||
$fileurlnbinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
|
||||
$filenamenbinvoices = $dir."/invoicesnbinyear-".$year.".png";
|
||||
if ($mode == 'customer') $fileurlnbinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlnbinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnbinyear-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
@ -94,8 +109,9 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$filenameamountinvoices = $conf->facture->dir_temp."/invoicesamountinyear-".$year.".png";
|
||||
$fileurlamountinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
|
||||
$filenameamountinvoices = $dir."/invoicesamountinyear-".$year.".png";
|
||||
if ($mode == 'customer') $fileurlamountinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlamountinvoices = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesamountinyear-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
@ -125,52 +141,66 @@ if (! $mesg)
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show array
|
||||
$sql = "SELECT date_format(datef,'%Y') as dm, count(*) as nb, sum(total) as total FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 ";
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND fk_soc=$socid";
|
||||
}
|
||||
$sql.= " GROUP BY dm DESC;";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24"><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NumberOfBills").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center" valign="top" rowspan="'.($num + 2).'">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
print '<img src="'.$fileurlnbinvoices.'" title="'.$langs->trans("NumberOfBills").'" alt="'.$langs->trans("NumberOfBills").'">';
|
||||
print "<br>\n";
|
||||
print '<img src="'.$fileurlamountinvoices.'" title="'.$langs->trans("AmountOfBills").'" alt="'.$langs->trans("AmountOfBills").'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NumberOfBills").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$nbproduct = $obj->nb;
|
||||
$year = $obj->dm;
|
||||
$total = price($obj->total);
|
||||
$oldyear=0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
$nbproduct = $val['nb'];
|
||||
$total = price($val['total']);
|
||||
$avg = price($val['avg']);
|
||||
while ($oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$nbproduct.'</td>';
|
||||
print '<td align="right">'.$total.'</td></tr>';
|
||||
|
||||
print '<td align="center"><a href="month.php?year='.$oldyear.'&mode='.$mode.'">'.$oldyear.'</a></td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="3"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="month.php?year='.$year.'&mode='.$mode.'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$nbproduct.'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print '<td align="right">'.$avg.'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
print '</td>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show graphs
|
||||
print '<table class="border" width="100%"><tr valign="top"><td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
print '<img src="'.$fileurlnbinvoices.'" title="'.$langs->trans("NumberOfBills").'" alt="'.$langs->trans("NumberOfBills").'">';
|
||||
print "<br>\n";
|
||||
print '<img src="'.$fileurlamountinvoices.'" title="'.$langs->trans("AmountOfBills").'" alt="'.$langs->trans("AmountOfBills").'">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -30,13 +30,19 @@ require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
||||
$GRAPHWIDTH=500;
|
||||
$GRAPHHEIGHT=200;
|
||||
|
||||
// Sécurité accés client
|
||||
// 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
|
||||
@ -44,22 +50,32 @@ if ($user->societe_id > 0)
|
||||
|
||||
llxHeader();
|
||||
|
||||
$year = isset($_GET["year"])?$_GET["year"]:date("Y",time());
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$title=$langs->trans("BillsStatistics");
|
||||
$dir=$conf->facture->dir_temp;
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$title=$langs->trans("BillsStatisticsSuppliers");
|
||||
$dir=$conf->fournisseur->facture->dir_temp;
|
||||
}
|
||||
|
||||
$mesg = '<a href="month.php?year='.($year - 1).'">'.img_previous().'</a> ';
|
||||
$mesg = '<a href="month.php?year='.($year - 1).'&mode='.$mode.'">'.img_previous().'</a> ';
|
||||
$mesg.= $langs->trans("Year")." $year";
|
||||
$mesg.= ' <a href="month.php?year='.($year + 1).'">'.img_next().'</a>';
|
||||
$mesg.= ' <a href="month.php?year='.($year + 1).'&mode='.$mode.'">'.img_next().'</a>';
|
||||
print_fiche_titre($title, $mesg);
|
||||
|
||||
print_fiche_titre($langs->trans("BillsStatistics"), $mesg);
|
||||
create_exdir($dir);
|
||||
|
||||
$stats = new FactureStats($db, $socid);
|
||||
create_exdir($conf->facture->dir_temp);
|
||||
$stats = new FactureStats($db, $socid, $mode);
|
||||
|
||||
|
||||
$data = $stats->getNbByMonth($year);
|
||||
|
||||
$filename = $conf->facture->dir_temp."/facture".$year.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=facture'.$year.'.png';
|
||||
$filename = $dir."/invoices-".$year.".png";
|
||||
if ($mode == 'customer') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoices-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoices-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
@ -81,8 +97,9 @@ if (! $mesg)
|
||||
|
||||
$data = $stats->getAmountByMonth($year);
|
||||
|
||||
$filename_amount = $conf->facture->dir_temp."/factureamount".$year.".png";
|
||||
$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=factureamount'.$year.'.png';
|
||||
$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();
|
||||
@ -112,8 +129,9 @@ for ($i = 1 ; $i < 13 ; $i++)
|
||||
$data[$i-1] = array(ucfirst(substr(strftime("%b",dolibarr_mktime(12,12,12,$i,1,$year)),0,3)), $res[$i]);
|
||||
}
|
||||
|
||||
$filename_avg = $conf->facture->dir_temp."/factureaverage".$year.".png";
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=factureaverage'.$year.'.png';
|
||||
$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();
|
||||
|
||||
@ -395,6 +395,8 @@ class MenuLeft {
|
||||
}
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/fourn/facture/impayees.php", $langs->trans("Unpayed"),2,$user->rights->fournisseur->facture->lire);
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/fourn/facture/paiement.php", $langs->trans("Payments"),2,$user->rights->fournisseur->facture->lire);
|
||||
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),2,$user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -377,6 +377,8 @@ class MenuLeft {
|
||||
}
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/fourn/facture/impayees.php", $langs->trans("Unpayed"),2,$user->rights->fournisseur->facture->lire);
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/fourn/facture/paiement.php", $langs->trans("Payments"),2,$user->rights->fournisseur->facture->lire);
|
||||
|
||||
if ($leftmenu=="suppliers_bills") $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),2,$user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@ BillsCustomersUnpayed=Unpayed customers' invoices
|
||||
BillsCustomersUnpayedForCompany=Unpayed customers' invoices for %s
|
||||
BillsSuppliersUnpayed=Unpayed suppliers' invoices
|
||||
BillsUnpayed=Unpayed
|
||||
BillsStatistics=Invoices statistics
|
||||
BillsStatistics=Customers' invoices statistics
|
||||
BillsStatisticsSuppliers=Suppliers' invoices statistics
|
||||
InvoiceStandard=Standard invoice
|
||||
InvoiceStandardAsk=Standard invoice
|
||||
InvoiceStandardDesc=This kind of invoice is the common invoice.
|
||||
|
||||
@ -8,7 +8,8 @@ BillsCustomersUnpayedForCompany=Factures clients impay
|
||||
BillsSuppliersUnpayed=Factures fournisseurs impayées
|
||||
BillsUnpayed=Impayées
|
||||
BillsLate=Retards de paiement
|
||||
BillsStatistics=Statistiques factures
|
||||
BillsStatistics=Statistiques factures clients
|
||||
BillsStatisticsSuppliers=Statistiques factures fournisseurs
|
||||
InvoiceStandard=Facture standard
|
||||
InvoiceStandardAsk=Facture standard
|
||||
InvoiceStandardDesc=Ce type de facture est la facture traditionnelle. On l'appelle aussi <b>facture de doit</b> (du verbe devoir).
|
||||
|
||||
@ -103,8 +103,9 @@ class Stats
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie le nombre d'element par ann<EFBFBD>e
|
||||
*
|
||||
* \brief Return nb of elements by year
|
||||
* \param sql SQL request
|
||||
* \return array
|
||||
*/
|
||||
function _getNbByYear($sql)
|
||||
{
|
||||
@ -129,6 +130,36 @@ class Stats
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return nb of elements, total amount and avg amount by year
|
||||
* \param sql SQL request
|
||||
* \return array
|
||||
*/
|
||||
function _getAllByYear($sql)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_object($resql);
|
||||
$result[$i]['year'] = $row->year;
|
||||
$result[$i]['nb'] = $row->nb;
|
||||
$result[$i]['total'] = $row->total;
|
||||
$result[$i]['avg'] = $row->avg;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie le nombre de proposition par mois pour une annee donnee
|
||||
@ -203,7 +234,7 @@ class Stats
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(ucfirst(substr(strftime("%b",mktime(12,0,0,$i,1,$year)),0,3)), $res[$i]);
|
||||
$data[$i-1] = array(ucfirst(substr(strftime("%b",dolibarr_mktime(12,0,0,$i,1,$year)),0,3)), $res[$i]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@ -167,7 +167,16 @@ if ($modulepart)
|
||||
}
|
||||
$original_file=$conf->facture->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
elseif ($modulepart == 'billstatssupplier')
|
||||
{
|
||||
$user->getrights('fourn');
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->fournisseur->facture->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'expeditionstats')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user