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',
'readchild') && empty($useridtofilter)) {
122 $useridtofilter = $user->id;
124if (!$user->hasRight(
'salaries',
'readall') && empty($useridtofilter)) {
125 $useridtofilter = $user->getAllChildIds(1);
134$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
137$filenamenb = $dir.
"/salariesnbinyear-".$year.
".png";
138$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesnbinyear-'.$year.
'.png';
141$mesg = $px1->isGraphKo();
143 $px1->SetData($data);
146 while ($i <= $endyear) {
150 $px1->SetLegend($legend);
151 $px1->SetMaxValue($px1->GetCeilMaxValue());
152 $px1->SetWidth($WIDTH);
153 $px1->SetHeight($HEIGHT);
154 $px1->SetYLabel($langs->trans(
"Number"));
156 $px1->SetHorizTickIncrement(1);
157 $px1->mode =
'depth';
158 $px1->SetTitle($langs->trans(
"NumberByMonth"));
160 $px1->draw($filenamenb, $fileurlnb);
164$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
168$filenameamount = $dir.
"/salariesamountinyear-".$year.
".png";
169$fileurlamount = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesamountinyear-'.$year.
'.png';
172$mesg = $px2->isGraphKo();
174 $px2->SetData($data);
177 while ($i <= $endyear) {
181 $px2->SetLegend($legend);
182 $px2->SetMaxValue($px2->GetCeilMaxValue());
183 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
184 $px2->SetWidth($WIDTH);
185 $px2->SetHeight($HEIGHT);
186 $px2->SetYLabel($langs->trans(
"Amount"));
188 $px2->SetHorizTickIncrement(1);
189 $px2->mode =
'depth';
190 $px2->SetTitle($langs->trans(
"AmountTotal"));
192 $px2->draw($filenameamount, $fileurlamount);
196$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
198$filename_avg = $dir.
"/salariesaverageinyear-".$year.
".png";
199$fileurl_avg = DOL_URL_ROOT.
'/viewimage.php?modulepart=salariesstats&file=salariesaverageinyear-'.$year.
'.png';
202$mesg = $px3->isGraphKo();
204 $px3->SetData($data);
207 while ($i <= $endyear) {
211 $px3->SetLegend($legend);
212 $px3->SetYLabel($langs->trans(
"AmountAverage"));
213 $px3->SetMaxValue($px3->GetCeilMaxValue());
214 $px3->SetMinValue((
int) $px3->GetFloorMinValue());
215 $px3->SetWidth($WIDTH);
216 $px3->SetHeight($HEIGHT);
218 $px3->SetHorizTickIncrement(1);
219 $px3->mode =
'depth';
220 $px3->SetTitle($langs->trans(
"AmountAverage"));
222 $px3->draw($filename_avg, $fileurl_avg);
227$data = $stats->getAllByYear();
228$arrayyears = array();
229foreach ($data as $val) {
230 $arrayyears[$val[
'year']] = $val[
'year'];
232if (!count($arrayyears)) {
233 $arrayyears[$nowyear] = $nowyear;
239$head[$h][0] = DOL_URL_ROOT.
'/salaries/stats/index.php';
240$head[$h][1] = $langs->trans(
"ByMonthYear");
241$head[$h][2] =
'byyear';
249print
'<div class="fichecenter"><div class="fichethirdleft">';
253print
'<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
254print
'<input type="hidden" name="token" value="'.newToken().
'">';
255print
'<table class="noborder centpercent">';
256print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
259print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
260if (!$user->hasRight(
'salaries',
'readchild') && empty($useridtofilter)) {
261 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
262 print $form->select_dolusers(($userid ? $userid : -1),
'userid', 1, null, 0, !$user->hasRight(
'salaries',
'readall') ?
'hierarchyme' :
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
264 print $user->getNomUrl(1);
269print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
270if (!in_array($year, $arrayyears)) {
271 $arrayyears[$year] = $year;
274print
img_picto(
'',
'calendar',
'class="pictofixedwidth"');
275print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
277print
'<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
281print
'<div class="div-table-responsive-no-min">';
282print
'<table class="noborder centpercent">';
283print
'<tr class="liste_titre" height="24">';
284print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
285print
'<td class="right">'.$langs->trans(
"Number").
'</td>';
286print
'<td class="right">'.$langs->trans(
"AmountTotal").
'</td>';
287print
'<td class="right">'.$langs->trans(
"AmountAverage").
'</td>';
291foreach ($data as $val) {
292 $year = $val[
'year'];
293 while ($year && $oldyear > (
int) $year + 1) {
297 print
'<tr class="oddeven" height="24">';
298 print
'<td align="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
299 print
'<td class="right">0</td>';
300 print
'<td class="right"><span class="amount">0</span></td>';
301 print
'<td class="right"><span class="amount">0</span></td>';
305 print
'<tr class="oddeven" height="24">';
306 print
'<td align="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a></td>';
307 print
'<td class="right">'.$val[
'nb'].
'</td>';
308 print
'<td class="right"><span class="amount">'.price(
price2num($val[
'total'],
'MT'), 1).
'</span></td>';
309 print
'<td class="right"><span class="amount">'.price(
price2num($val[
'avg'],
'MT'), 1).
'</span></td>';
318print
'</div><div class="fichetwothirdright">';
322print
'<table class="border centpercent"><tr class="pair nohover"><td align="center">';
332print
'</td></tr></table>';
336print
'<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.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage salary statistics.
Class to manage salary payments.
dol_now($mode='gmt')
Return date for now.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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)
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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)
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.