30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/reception/class/receptionstats.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
46$hookmanager->initHooks(array(
'receptionstats',
'globalcard'));
52$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
62$langs->loadLangs(array(
"receptions",
"other",
"companies"));
66 $socid = $user->socid;
77llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-reception page-stats_index');
79print
load_fiche_titre($langs->trans(
"StatisticsOfReceptions"),
'',
'dollyrevert');
81$dir = (!empty(
$conf->reception->multidir_temp[
$conf->entity]) ?
$conf->reception->multidir_temp[
$conf->entity] :
$conf->service->multidir_temp[
$conf->entity]);
84$stats =
new ReceptionStats($db, $socid,
'', ($userid > 0 ? $userid : 0));
87$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
92if (!$user->hasRight(
'societe',
'client',
'voir')) {
93 $filenamenb = $dir.
'/receptionsnbinyear-'.$user->id.
'-'.$year.
'.png';
95 $filenamenb = $dir.
'/receptionsnbinyear-'.$year.
'.png';
99$mesg = $px1->isGraphKo();
102 $px1->SetData($data);
105 while ($i <= $endyear) {
109 $px1->SetLegend($legend);
110 $px1->SetMaxValue($px1->GetCeilMaxValue());
111 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
112 $px1->SetWidth($WIDTH);
113 $px1->SetHeight($HEIGHT);
114 $px1->SetYLabel($langs->trans(
"NbOfReceptions"));
116 $px1->SetHorizTickIncrement(1);
117 $px1->mode =
'depth';
118 $px1->SetTitle($langs->trans(
"NumberOfReceptionsByMonth"));
120 $px1->draw($filenamenb, $fileurlnb);
204$data = $stats->getAllByYear();
205$arrayyears = array();
206foreach ($data as $val) {
207 if (!empty($val[
'year'])) {
208 $arrayyears[$val[
'year']] = $val[
'year'];
211if (!count($arrayyears)) {
212 $arrayyears[$nowyear] = $nowyear;
217$head[$h][0] = DOL_URL_ROOT.
'/reception/stats/index.php';
218$head[$h][1] = $langs->trans(
"ByMonthYear");
219$head[$h][2] =
'byyear';
222$type =
'reception_stats';
229print
'<div class="fichecenter"><div class="fichethirdleft">';
233print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
234print
'<input type="hidden" name="token" value="'.newToken().
'">';
236print
'<table class="noborder centpercent">';
237print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
239print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td>';
240print
img_picto(
'',
'company',
'class="pictofixedwidth"');
241print $form->select_company($socid,
'socid',
'', 1, 0, 0, array(), 0,
'widthcentpercentminusx maxwidth300',
'');
244print
'<tr><td>'.$langs->trans(
"CreatedBy").
'</td><td>';
245print
img_picto(
'',
'user',
'class="pictofixedwidth"');
246print $form->select_dolusers($userid,
'userid', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
249print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
250if (!in_array($year, $arrayyears)) {
251 $arrayyears[$year] = $year;
253if (!in_array($nowyear, $arrayyears)) {
254 $arrayyears[$nowyear] = $nowyear;
257print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
259print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
264print
'<div class="div-table-responsive-no-min">';
265print
'<table class="noborder centpercent">';
266print
'<tr class="liste_titre" height="24">';
267print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
268print
'<td class="right">'.$langs->trans(
"NbOfReceptions").
'</td>';
274foreach ($data as $val) {
275 $year = $val[
'year'];
276 while (!empty($year) && $oldyear > (
int) $year + 1) {
280 print
'<tr class="oddeven" height="24">';
281 print
'<td class="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
283 print
'<td class="right">0</td>';
289 print
'<tr class="oddeven" height="24">';
290 print
'<td class="center">';
292 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a>';
294 print $langs->trans(
"ValidationDateNotDefinedEvenIfReceptionValidated");
297 print
'<td class="right">'.$val[
'nb'].
'</td>';
307print
'</div></div><div class="fichetwothirdright">';
311print
'<table class="border centpercent"><tr valign="top"><td class="center">';
321print
'</td></tr></table>';
325print
'<div class="clearboth"></div>';
364print
'<i class="opacitymedium">'.$langs->trans(
"StatsOnReceptionsOnlyValidated").
'</i>';
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage reception statistics.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.