Qual: Uniformize code.
This commit is contained in:
parent
ead04cbddc
commit
74801a2914
@ -659,7 +659,11 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
if (! $propal->fetch($_POST['propalid']) > 0) dolibarr_print_error($db);
|
||||
if (! $propal->fetch($_POST['propalid']) > 0)
|
||||
{
|
||||
dolibarr_print_error($db,$propal->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define info_bits
|
||||
$info_bits=0;
|
||||
@ -671,9 +675,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
||||
|
||||
// On vérifie que le prix minimum est respecté
|
||||
$productid = $_POST['productid'] ;
|
||||
$pruduct = new Product($db) ;
|
||||
$pruduct->fetch($productid) ;
|
||||
if ($pruduct->price_min && ($_POST['productid']!='')&&( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($pruduct->price_min)))
|
||||
if ($productid)
|
||||
{
|
||||
$pruduct = new Product($db) ;
|
||||
$res=$pruduct->fetch($productid) ;
|
||||
}
|
||||
if ($productid && $pruduct->price_min && ( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($pruduct->price_min)))
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($pruduct->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'</div>' ;
|
||||
}
|
||||
@ -1913,18 +1920,24 @@ else
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$propalstatic=new Propal($db);
|
||||
print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php','&socid='.$socid.'&viewstatut='.$viewstatut,$sortfield,$sortorder,'',$num);
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php',$param,$sortfield,$sortorder,'',$num);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.total_ht','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','','&socid='.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print "</tr>\n";
|
||||
// Lignes des champs de filtre
|
||||
@ -1938,12 +1951,11 @@ else
|
||||
print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1" align="right">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="2" maxlength="2" name="month" value="'.$month.'">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
print ' '.$langs->trans('Year').': ';
|
||||
$max_year = date("Y");
|
||||
$syear = $year;
|
||||
if($syear == '')
|
||||
$syear = date("Y");
|
||||
//if($syear == '') $syear = date("Y");
|
||||
$html->select_year($syear,'year',1, '', $max_year);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
@ -2015,7 +2027,7 @@ else
|
||||
// Date fin validite
|
||||
if ($objp->dfv)
|
||||
{
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dfv);
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dfv,'day');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -31,28 +31,46 @@ require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
|
||||
|
||||
$stats = new PropaleStats($db);
|
||||
$year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
$dir=$conf->propal->dir_temp;
|
||||
|
||||
create_exdir($dir);
|
||||
|
||||
$stats = new PropaleStats($db, $socid);
|
||||
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
create_exdir($conf->propal->dir_temp);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename = $conf->propal->dir_temp.'/nbpropale2year-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=nbpropale2year-'.$user->id.'-'.$year.'.png';
|
||||
$filenamenb = $conf->propal->dir_temp.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = $conf->propal->dir_temp.'/nbpropale2year-'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=nbpropale2year-'.$year.'.png';
|
||||
$filenamenb = $conf->propal->dir_temp.'/proposalsnbinyear-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px = new DolGraph();
|
||||
@ -69,6 +87,7 @@ if (! $mesg)
|
||||
}
|
||||
$px->SetLegend($legend);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue(min(0,$px->GetFloorMinValue()));
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetYLabel($langs->trans("NbOfProposals"));
|
||||
@ -76,60 +95,109 @@ if (! $mesg)
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->mode='depth';
|
||||
$px->draw($filename);
|
||||
$px->SetTitle($langs->trans("NbOfProposals"));
|
||||
|
||||
$px->draw($filenamenb);
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) as nb, date_format(p.datep,'%Y') as dm, sum(p.total) as total_ttc";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql.= " GROUP BY dm DESC ";
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
// Build graphic amount of object
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="2">';
|
||||
print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NbOfProposals").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center" valign="top" rowspan="'.($num + 1).'">';
|
||||
|
||||
if ($mesg)
|
||||
{
|
||||
print "$mesg";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$fileurl.'" alt="Nombre de proposition par mois">';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$nbproduct = $obj->nb;
|
||||
$year = $obj->dm;
|
||||
print "<tr>";
|
||||
print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td>';
|
||||
print '<td align="center">'.$nbproduct.'</td>';
|
||||
print '<td align="center">'.price($obj->total_ttc).'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
$db->free($result);
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filenameamount = $conf->propal->dir_temp.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
$filenameamount = $conf->propal->dir_temp.'/proposalsamountinyear-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->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"));
|
||||
|
||||
$px->draw($filenameamount);
|
||||
}
|
||||
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfProposals").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
print $avg;
|
||||
while ($oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
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 height="24">';
|
||||
print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$val['nb'].'</td>';
|
||||
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
|
||||
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
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="'.$fileurlnb.'" title="'.$langs->trans("NbOfProposals").'" alt="'.$langs->trans("NbOfProposals").'">';
|
||||
print "<br>\n";
|
||||
print '<img src="'.$fileurlamount.'" title="'.$langs->trans("AmountTotal").'" alt="'.$langs->trans("AmountTotal").'">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -28,39 +28,48 @@ require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/propal/stats/propalestats.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
||||
|
||||
$GRAPHWIDTH=500;
|
||||
$GRAPHHEIGHT=200;
|
||||
|
||||
llxHeader();
|
||||
// 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->propal->dir_temp;
|
||||
|
||||
$mesg = '<a href="month.php?year='.($year - 1).'">'.img_previous().'</a> ';
|
||||
$mesg.= $langs->trans("Year")." $year";
|
||||
$mesg.= ' <a href="month.php?year='.($year + 1).'">'.img_next().'</a>';
|
||||
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
|
||||
|
||||
$stats = new PropaleStats($db);
|
||||
$data = $stats->getNbByMonth($year);
|
||||
create_exdir($dir);
|
||||
|
||||
create_exdir($conf->propal->dir_temp);
|
||||
$stats = new PropaleStats($db, $socid);
|
||||
|
||||
|
||||
$data = $stats->getNbByMonth($year);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename = $conf->propal->dir_temp.'/propale-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propale-'.$user->id.'-'.$year.'.png';
|
||||
$filename = $dir.'/proposalsnb-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnb-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = $conf->propal->dir_temp.'/propale'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propale'.$year.'.png';
|
||||
$filename = $dir.'/proposalsnb-'.$year.'.png';
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnb-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px = new DolGraph();
|
||||
@ -68,34 +77,29 @@ $mesg = $px->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename);
|
||||
}
|
||||
|
||||
$res = $stats->getAmountByMonth($year);
|
||||
|
||||
$data = array();
|
||||
|
||||
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]);
|
||||
}
|
||||
$data = $stats->getAmountByMonth($year);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename_amount = $conf->propal->dir_temp.'/propaleamount-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleamount-'.$user->id.'-'.$year.'.png';
|
||||
$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 = $conf->propal->dir_temp.'/propaleamount'.$year.'.png';
|
||||
$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleamount'.$year.'.png';
|
||||
$filename_amount = $dir.'/proposalsamount-'.$year.'.png';
|
||||
$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamount-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px = new DolGraph();
|
||||
@ -103,16 +107,18 @@ $mesg = $px->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetYLabel($langs->trans("AmountTotal"));
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename_amount, $data, $year);
|
||||
$px->draw($filename_amount);
|
||||
}
|
||||
|
||||
|
||||
$res = $stats->getAverageByMonth($year);
|
||||
|
||||
$data = array();
|
||||
@ -124,13 +130,13 @@ for ($i = 1 ; $i < 13 ; $i++)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename_avg = $conf->propal->dir_temp.'/propaleaverage-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleaverage-'.$user->id.'-'.$year.'.png';
|
||||
$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 = $conf->propal->dir_temp.'/propaleaverage'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleaverage'.$year.'.png';
|
||||
$filename_avg = $dir.'/proposalsaverage-'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsaverage-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px = new DolGraph();
|
||||
@ -141,8 +147,9 @@ if (! $mesg)
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetYLabel($langs->trans("AmountAverage"));
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
|
||||
@ -15,124 +15,169 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/propal/stats/propalestats.class.php
|
||||
\ingroup propales
|
||||
\brief Fichier de la classe de gestion des stats des propales
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/comm/propal/stats/propalestats.class.php
|
||||
* \ingroup propales
|
||||
* \brief Fichier de la classe de gestion des stats des propales
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . "/stats.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . "/propal.class.php";
|
||||
|
||||
|
||||
/**
|
||||
\class PropaleStats
|
||||
\brief Classe permettant la gestion des stats des propales
|
||||
*/
|
||||
|
||||
* \class PropaleStats
|
||||
* \brief Classe permettant la gestion des stats des propales
|
||||
*/
|
||||
class PropaleStats extends Stats
|
||||
{
|
||||
var $db ;
|
||||
var $db ;
|
||||
|
||||
function PropaleStats($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
}
|
||||
var $socid;
|
||||
var $where;
|
||||
|
||||
var $table_element;
|
||||
var $field;
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de proposition par mois pour une année donnée
|
||||
*
|
||||
*/
|
||||
function getNbByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, count(*)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getNbByMonth($year, $sql);
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param $DB Database handler
|
||||
* @param $socid Id third party
|
||||
* @return PropaleStats
|
||||
*/
|
||||
function PropaleStats($DB, $socid=0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db = $DB;
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de propale par année
|
||||
*
|
||||
*/
|
||||
function getNbByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%Y') as dm, count(*)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
$object=new Propal($this->db);
|
||||
$this->table_element=$object->table_element;
|
||||
$this->field='total';
|
||||
|
||||
$this->socid = $socid;
|
||||
$this->where.= " fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($this->socid)
|
||||
{
|
||||
$this->where .= " AND p.fk_soc = ".$this->socid;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
/**
|
||||
* Renvoie le nombre de propale par mois pour une année donnée
|
||||
*
|
||||
*/
|
||||
function getAmountByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.total_ht)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getAmountByMonth($year, $sql);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.total_ht)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
/**
|
||||
* Renvoie le nombre de proposition par mois pour une année donnée
|
||||
*
|
||||
*/
|
||||
function getNbByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, count(*)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getNbByMonth($year, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de propale par année
|
||||
*
|
||||
*/
|
||||
function getNbByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%Y') as dm, count(*)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
/**
|
||||
* Renvoie le nombre de propale par mois pour une année donnée
|
||||
*
|
||||
*/
|
||||
function getAmountByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.total_ht)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getAmountByMonth($year, $sql);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.total_ht)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE date_format(p.datep,'%Y') = $year AND p.fk_statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return nb, total and average
|
||||
* \return array Array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year DESC";
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -41,6 +41,14 @@ class FactureStats extends Stats
|
||||
var $table_element;
|
||||
var $field;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param $DB Database handler
|
||||
* @param $socid Id third party
|
||||
* @param $mode Option
|
||||
* @return FactureStats
|
||||
*/
|
||||
function FactureStats($DB, $socid=0, $mode)
|
||||
{
|
||||
$this->db = $DB;
|
||||
|
||||
@ -69,14 +69,14 @@ create_exdir($dir);
|
||||
$stats = new FactureStats($db, $socid, $mode);
|
||||
|
||||
|
||||
// Build graphic number of invoices
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$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';
|
||||
$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();
|
||||
@ -101,17 +101,17 @@ if (! $mesg)
|
||||
$px->mode='depth';
|
||||
$px->SetTitle($langs->trans("NumberOfBillsByMonth"));
|
||||
|
||||
$px->draw($filenamenbinvoices);
|
||||
$px->draw($filenamenb);
|
||||
}
|
||||
|
||||
// Build graphic amount of invoices
|
||||
// Build graphic amount of object
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
$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';
|
||||
$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();
|
||||
@ -137,7 +137,7 @@ if (! $mesg)
|
||||
$px->mode='depth';
|
||||
$px->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
|
||||
|
||||
$px->draw($filenameamountinvoices);
|
||||
$px->draw($filenameamount);
|
||||
}
|
||||
|
||||
|
||||
@ -192,9 +192,9 @@ print '<td align="center" valign="top">';
|
||||
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 '<img src="'.$fileurlnb.'" title="'.$langs->trans("NumberOfBills").'" alt="'.$langs->trans("NumberOfBills").'">';
|
||||
print "<br>\n";
|
||||
print '<img src="'.$fileurlamountinvoices.'" title="'.$langs->trans("AmountOfBills").'" alt="'.$langs->trans("AmountOfBills").'">';
|
||||
print '<img src="'.$fileurlamount.'" title="'.$langs->trans("AmountOfBills").'" alt="'.$langs->trans("AmountOfBills").'">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
@ -73,9 +73,9 @@ $stats = new FactureStats($db, $socid, $mode);
|
||||
|
||||
$data = $stats->getNbByMonth($year);
|
||||
|
||||
$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';
|
||||
$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();
|
||||
@ -84,7 +84,6 @@ if (! $mesg)
|
||||
$px->SetData($data);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
@ -109,7 +108,6 @@ if (! $mesg)
|
||||
$px->SetYLabel($langs->trans("AmountTotal"));
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetPrecisionY(0);
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
@ -144,7 +142,7 @@ if (! $mesg)
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(5);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename_avg);
|
||||
|
||||
@ -37,10 +37,9 @@ require_once(DOL_DOCUMENT_ROOT ."/contact.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class Propal
|
||||
\brief Classe permettant la gestion des propales
|
||||
* \class Propal
|
||||
* \brief Classe permettant la gestion des propales
|
||||
*/
|
||||
|
||||
class Propal extends CommonObject
|
||||
{
|
||||
var $db;
|
||||
@ -95,9 +94,9 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB Handler d'acc<EFBFBD>s base
|
||||
* \param socid Id de la soci<EFBFBD>t<EFBFBD>
|
||||
* \param propalid Id de la propal
|
||||
* \param DB Database handler
|
||||
* \param socid Id third party
|
||||
* \param propalid Id proposal
|
||||
*/
|
||||
function Propal($DB, $socid="", $propalid=0)
|
||||
{
|
||||
|
||||
@ -111,6 +111,7 @@ class Stats
|
||||
{
|
||||
$result = array();
|
||||
|
||||
dolibarr_syslog("Stats::_getNbByYear sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -139,6 +140,7 @@ class Stats
|
||||
{
|
||||
$result = array();
|
||||
|
||||
dolibarr_syslog("Stats::_getAllByYear sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -169,8 +171,8 @@ class Stats
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
dolibarr_syslog("Stats::_getNbByMonth sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -248,7 +250,7 @@ class Stats
|
||||
{
|
||||
$result = array();
|
||||
|
||||
dolibarr_syslog("Stats::_getAmountByMonth sql=".$sql);
|
||||
dolibarr_syslog("Stats::_getAverageByMonth sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user