29require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salariesstats.class.php';
42$langs->loadLangs(array(
"salaries",
"companies",
"bills"));
60 $socid = $user->socid;
71$permissiontoread = $user->hasRight(
'salaries',
'read');
72$permissiontoadd = $user->hasRight(
'salaries',
'write');
73$permissiontodelete = $user->hasRight(
'salaries',
'delete');
91$title = $langs->trans(
"Salaries");
92$dir =
$conf->salaries->dir_temp;
95$url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
97 $url .=
'&socid='.$socid;
103$massactionbutton =
'';
105$nbtotalofrecords = $langs->trans(
"Statistics");
109$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/salaries/list.php?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', 1, array(
'morecss' =>
'reposition'));
110$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', DOL_URL_ROOT.
'/salaries/list.php?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', 1, array(
'morecss' =>
'reposition'));
111$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/salaries/stats/index.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', 2, array(
'morecss' =>
'reposition'));
113$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
115print_barre_liste($title, 0, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
119$useridtofilter = $userid;
121if (!$user->hasRight(
'salaries',
'readall')) {
122 if (!$user->hasRight(
'salaries',
'readchild')) {
123 $useridtofilter = $user->id;
125 $childids = $user->getAllChildIds(1);
126 if (empty($useridtofilter) || !in_array($useridtofilter, $childids)) {
127 $useridtofilter = $childids;
138$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
141$filenamenb = $dir.
"/salariesnbinyear-".$year.
".png";
142$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesnbinyear-'.$year.
'.png';
145$mesg = $px1->isGraphKo();
147 $px1->SetData($data);
150 while ($i <= $endyear) {
154 $px1->SetLegend($legend);
155 $px1->SetMaxValue($px1->GetCeilMaxValue());
156 $px1->SetWidth($WIDTH);
157 $px1->SetHeight($HEIGHT);
158 $px1->SetYLabel($langs->trans(
"Number"));
160 $px1->SetHorizTickIncrement(1);
161 $px1->mode =
'depth';
162 $px1->SetTitle($langs->trans(
"NumberByMonth"));
164 $px1->draw($filenamenb, $fileurlnb);
168$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
172$filenameamount = $dir.
"/salariesamountinyear-".$year.
".png";
173$fileurlamount = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesamountinyear-'.$year.
'.png';
176$mesg = $px2->isGraphKo();
178 $px2->SetData($data);
181 while ($i <= $endyear) {
185 $px2->SetLegend($legend);
186 $px2->SetMaxValue($px2->GetCeilMaxValue());
187 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
188 $px2->SetWidth($WIDTH);
189 $px2->SetHeight($HEIGHT);
190 $px2->SetYLabel($langs->trans(
"Amount"));
192 $px2->SetHorizTickIncrement(1);
193 $px2->mode =
'depth';
194 $px2->SetTitle($langs->trans(
"AmountTotal"));
196 $px2->draw($filenameamount, $fileurlamount);
200$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
202$filename_avg = $dir.
"/salariesaverageinyear-".$year.
".png";
203$fileurl_avg = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesaverageinyear-'.$year.
'.png';
206$mesg = $px3->isGraphKo();
208 $px3->SetData($data);
211 while ($i <= $endyear) {
215 $px3->SetLegend($legend);
216 $px3->SetYLabel($langs->trans(
"AmountAverage"));
217 $px3->SetMaxValue($px3->GetCeilMaxValue());
218 $px3->SetMinValue((
int) $px3->GetFloorMinValue());
219 $px3->SetWidth($WIDTH);
220 $px3->SetHeight($HEIGHT);
222 $px3->SetHorizTickIncrement(1);
223 $px3->mode =
'depth';
224 $px3->SetTitle($langs->trans(
"AmountAverage"));
226 $px3->draw($filename_avg, $fileurl_avg);
231$data = $stats->getAllByYear();
232$arrayyears = array();
233foreach ($data as $val) {
234 $arrayyears[$val[
'year']] = $val[
'year'];
236if (!count($arrayyears)) {
237 $arrayyears[$nowyear] = $nowyear;
243$head[$h][0] = DOL_URL_ROOT.
'/salaries/stats/index.php';
244$head[$h][1] = $langs->trans(
"ByMonthYear");
245$head[$h][2] =
'byyear';
253print
'<div class="fichecenter"><div class="fichethirdleft">';
257print
'<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
258print
'<input type="hidden" name="token" value="'.newToken().
'">';
259print
'<table class="noborder centpercent">';
260print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
263print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
264if ($user->hasRight(
'salaries',
'readall') || $user->hasRight(
'salaries',
'readchild')) {
265 print img_picto(
'',
'user',
'class="pictofixedwidth"');
266 print $form->select_dolusers(($userid ? $userid : -1),
'userid', 1, null, 0, !$user->hasRight(
'salaries',
'readall') ?
'hierarchyme' :
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
268 print $user->getNomUrl(1);
273print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
274if (!in_array($year, $arrayyears)) {
275 $arrayyears[$year] = $year;
278print img_picto(
'',
'calendar',
'class="pictofixedwidth"');
279print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
281print
'<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
285print
'<div class="div-table-responsive-no-min">';
286print
'<table class="noborder centpercent">';
287print
'<tr class="liste_titre" height="24">';
288print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
289print
'<td class="right">'.$langs->trans(
"Number").
'</td>';
290print
'<td class="right">'.$langs->trans(
"AmountTotal").
'</td>';
291print
'<td class="right">'.$langs->trans(
"AmountAverage").
'</td>';
295foreach ($data as $val) {
296 $year = $val[
'year'];
297 while ($year && $oldyear > (
int) $year + 1) {
301 print
'<tr class="oddeven" height="24">';
302 print
'<td align="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
303 print
'<td class="right">0</td>';
304 print
'<td class="right"><span class="amount">0</span></td>';
305 print
'<td class="right"><span class="amount">0</span></td>';
309 print
'<tr class="oddeven" height="24">';
310 print
'<td align="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a></td>';
311 print
'<td class="right">'.$val[
'nb'].
'</td>';
312 print
'<td class="right"><span class="amount">'.price(
price2num($val[
'total'],
'MT'), 1).
'</span></td>';
313 print
'<td class="right"><span class="amount">'.price(
price2num($val[
'avg'],
'MT'), 1).
'</span></td>';
322print
'</div><div class="fichetwothirdright">';
326print
'<table class="border centpercent"><tr class="pair nohover"><td align="center">';
336print
'</td></tr></table>';
340print
'<div class="clearboth"></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage salary statistics.
Class to manage salary payments.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
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)
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.