29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expeditionstats.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
48if ($user->socid > 0) {
50 $socid = $user->socid;
59$langs->loadLangs(array(
'sendings',
'other',
'companies'));
63 $socid = $user->socid;
74llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-expedition page-stats_index');
78$dir = (!empty(
$conf->expedition->multidir_temp[
$conf->entity]) ?
$conf->expedition->multidir_temp[
$conf->entity] :
$conf->service->multidir_temp[
$conf->entity]);
81$stats =
new ExpeditionStats($db, $socid,
'', ($userid > 0 ? $userid : 0));
84$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
89if (!$user->hasRight(
'societe',
'client',
'voir')) {
90 $filenamenb = $dir.
'/shipmentsnbinyear-'.$user->id.
'-'.$year.
'.png';
92 $filenamenb = $dir.
'/shipmentsnbinyear-'.$year.
'.png';
96$mesg = $px1->isGraphKo();
102 while ($i <= $endyear) {
106 $px1->SetLegend($legend);
107 $px1->SetMaxValue($px1->GetCeilMaxValue());
108 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
109 $px1->SetWidth($WIDTH);
110 $px1->SetHeight($HEIGHT);
111 $px1->SetYLabel($langs->trans(
"NbOfSendings"));
113 $px1->SetHorizTickIncrement(1);
114 $px1->mode =
'depth';
115 $px1->SetTitle($langs->trans(
"NumberOfShipmentsByMonth"));
117 $px1->draw($filenamenb, $fileurlnb);
201$data = $stats->getAllByYear();
202$arrayyears = array();
203foreach ($data as $val) {
204 if (!empty($val[
'year'])) {
205 $arrayyears[$val[
'year']] = $val[
'year'];
208if (!count($arrayyears)) {
209 $arrayyears[$nowyear] = $nowyear;
214$head[$h][0] = DOL_URL_ROOT.
'/expedition/stats/index.php';
215$head[$h][1] = $langs->trans(
"ByMonthYear");
216$head[$h][2] =
'byyear';
219$type =
'shipment_stats';
226print
'<div class="fichecenter"><div class="fichethirdleft">';
230print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
231print
'<input type="hidden" name="token" value="'.newToken().
'">';
233print
'<table class="noborder centpercent">';
234print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
236print
'<tr><td class="left">'.$langs->trans(
"ThirdParty").
'</td><td class="left">';
237print
img_picto(
'',
'company',
'class="pictofixedwidth"');
238print $form->select_company($socid,
'socid',
'', 1, 0, 0, array(), 0,
'widthcentpercentminusx maxwidth300',
'');
241print
'<tr><td class="left">'.$langs->trans(
"CreatedBy").
'</td><td class="left">';
242print
img_picto(
'',
'user',
'class="pictofixedwidth"');
243print $form->select_dolusers($userid,
'userid', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
246print
'<tr><td class="left">'.$langs->trans(
"Year").
'</td><td class="left">';
247if (!in_array($year, $arrayyears)) {
248 $arrayyears[$year] = $year;
250if (!in_array($nowyear, $arrayyears)) {
251 $arrayyears[$nowyear] = $nowyear;
254print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
256print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
262print
'<div class="div-table-responsive-no-min">';
263print
'<table class="noborder centpercent">';
264print
'<tr class="liste_titre" height="24">';
265print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
266print
'<td class="right">'.$langs->trans(
"NbOfSendings").
'</td>';
272foreach ($data as $val) {
273 $year = $val[
'year'];
274 while (!empty($year) && $oldyear > (
int) $year + 1) {
278 print
'<tr class="oddeven" height="24">';
279 print
'<td class="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
281 print
'<td class="right">0</td>';
287 print
'<tr class="oddeven" height="24">';
288 print
'<td class="center">';
290 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a>';
293 print
'Error: validation date of shipment is not defined. This looks strange because shipment is validated. Try to run /install/repair.php?standard=confirmed';
296 print
'<td class="right">'.$val[
'nb'].
'</td>';
307print
'</div><div class="fichetwothirdright">';
311print
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
321print
'</td></tr></table>';
325print
'<div class="clearboth"></div>';
364print
'<i class="opacitymedium">'.$langs->trans(
"StatsOnShipmentsOnlyValidated").
'</i>';
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 shipment statistics.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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)
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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).
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.