dolibarr  17.0.4
supplier_turnover.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2020 Maxime Kohlhaas <maxime@atm-consulting.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 // Load Dolibarr environment
24 require '../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
27 
28 // Load translation files required by the page
29 $langs->loadLangs(array('compta', 'bills'));
30 
31 $date_startday = GETPOST('date_startday', 'int');
32 $date_startmonth = GETPOST('date_startmonth', 'int');
33 $date_startyear = GETPOST('date_startyear', 'int');
34 $date_endday = GETPOST('date_endday', 'int');
35 $date_endmonth = GETPOST('date_endmonth', 'int');
36 $date_endyear = GETPOST('date_endyear', 'int');
37 
38 $nbofyear = 4;
39 
40 // Date range
41 $year = GETPOST('year', 'int');
42 if (empty($year)) {
43  $year_current = dol_print_date(dol_now(), "%Y");
44  $month_current = dol_print_date(dol_now(), "%m");
45  $year_start = $year_current - ($nbofyear - 1);
46 } else {
47  $year_current = $year;
48  $month_current = dol_print_date(dol_now(), "%m");
49  $year_start = $year - ($nbofyear - 1);
50 }
51 $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere
52 $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere
53 
54 // We define date_start and date_end
55 if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
56  $q = GETPOST("q") ?GETPOST("q") : 0;
57  if ($q == 0) {
58  // We define date_start and date_end
59  $year_end = $year_start + ($nbofyear - 1);
60  $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
61  if (!GETPOST('month')) {
62  if (!GETPOST("year") && $month_start > $month_current) {
63  $year_start--;
64  $year_end--;
65  }
66  $month_end = $month_start - 1;
67  if ($month_end < 1) {
68  $month_end = 12;
69  } else {
70  $year_end++;
71  }
72  } else {
73  $month_end = $month_start;
74  }
75  $date_start = dol_get_first_day($year_start, $month_start, false);
76  $date_end = dol_get_last_day($year_end, $month_end, false);
77  }
78  if ($q == 1) {
79  $date_start = dol_get_first_day($year_start, 1, false);
80  $date_end = dol_get_last_day($year_start, 3, false);
81  }
82  if ($q == 2) {
83  $date_start = dol_get_first_day($year_start, 4, false);
84  $date_end = dol_get_last_day($year_start, 6, false);
85  }
86  if ($q == 3) {
87  $date_start = dol_get_first_day($year_start, 7, false);
88  $date_end = dol_get_last_day($year_start, 9, false);
89  }
90  if ($q == 4) {
91  $date_start = dol_get_first_day($year_start, 10, false);
92  $date_end = dol_get_last_day($year_start, 12, false);
93  }
94 }
95 
96 $userid = GETPOST('userid', 'int');
97 $socid = GETPOST('socid', 'int');
98 
99 $tmps = dol_getdate($date_start);
100 $year_start = $tmps['year'];
101 $tmpe = dol_getdate($date_end);
102 $year_end = $tmpe['year'];
103 $nbofyear = ($year_end - $year_start) + 1;
104 
105 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
106 $modecompta = $conf->global->ACCOUNTING_MODE;
107 if (isModEnabled('accounting')) {
108  $modecompta = 'BOOKKEEPING';
109 }
110 if (GETPOST("modecompta")) {
111  $modecompta = GETPOST("modecompta", 'alpha');
112 }
113 
114 // Security check
115 if ($user->socid > 0) {
116  $socid = $user->socid;
117 }
118 if (isModEnabled('comptabilite')) {
119  $result = restrictedArea($user, 'compta', '', '', 'resultat');
120 }
121 if (isModEnabled('accounting')) {
122  $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
123 }
124 
125 
126 /*
127  * View
128  */
129 
130 llxHeader();
131 
132 $form = new Form($db);
133 
134 // TODO Report from bookkeeping not yet available, so we switch on report on business events
135 if ($modecompta == "BOOKKEEPING") {
136  $modecompta = "CREANCES-DETTES";
137 }
138 if ($modecompta == "BOOKKEEPINGCOLLECTED") {
139  $modecompta = "RECETTES-DEPENSES";
140 }
141 
142 // Affiche en-tete du rapport
143 if ($modecompta == "CREANCES-DETTES") {
144  $name = $langs->trans("PurchaseTurnover");
145  $calcmode = $langs->trans("CalcModeDebt");
146  if (isModEnabled('accounting')) {
147  $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
148  $calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode);
149  $calcmode = str_replace('{link2}', '</a>', $calcmode);
150  }
151  $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
152  $description = $langs->trans("RulesPurchaseTurnoverDue");
153  //$exportlink=$langs->trans("NotYetAvailable");
154 } elseif ($modecompta == "RECETTES-DEPENSES") {
155  $name = $langs->trans("PurchaseTurnoverCollected");
156  $calcmode = $langs->trans("CalcModeEngagement");
157  $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
158  $description = $langs->trans("RulesPurchaseTurnoverIn");
159  //$exportlink=$langs->trans("NotYetAvailable");
160 } elseif ($modecompta == "BOOKKEEPING") {
161  $name = $langs->trans("PurchaseTurnover");
162  $calcmode = $langs->trans("CalcModeBookkeeping");
163  $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
164  $calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', $calcmode);
165  $calcmode = str_replace('{link2}', '</a>', $calcmode);
166  $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
167  $description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts");
168  //$exportlink=$langs->trans("NotYetAvailable");
169 } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
170  $name = $langs->trans("PurchaseTurnoverCollected");
171  $calcmode = $langs->trans("CalcModeBookkeeping");
172  $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
173  $calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', $calcmode);
174  $calcmode = str_replace('{link2}', '</a>', $calcmode);
175  $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
176  $description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts");
177  //$exportlink=$langs->trans("NotYetAvailable");
178 }
179 
180 $builddate = dol_now();
181 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
182 $period .= ' - ';
183 $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
184 
185 $moreparam = array();
186 if (!empty($modecompta)) {
187  $moreparam['modecompta'] = $modecompta;
188 }
189 
190 $exportlink = '';
191 
192 report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
193 
194 if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
195  print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
196 }
197 
198 
199 if ($modecompta == 'CREANCES-DETTES') {
200  $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
201  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
202  $sql .= " WHERE f.fk_statut in (1,2)";
203  $sql .= " AND f.type IN (0,2)";
204  $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
205  if ($socid) {
206  $sql .= " AND f.fk_soc = ".((int) $socid);
207  }
208 } elseif ($modecompta == "RECETTES-DEPENSES") {
209  $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
210  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
211  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
212  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p";
213  $sql .= " WHERE p.rowid = pf.fk_paiementfourn";
214  $sql .= " AND pf.fk_facturefourn = f.rowid";
215  $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
216  if ($socid) {
217  $sql .= " AND f.fk_soc = ".((int) $socid);
218  }
219 } elseif ($modecompta == "BOOKKEEPING") {
220  $pcgverid = $conf->global->CHARTOFACCOUNTS;
221  $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
222  if (empty($pcgvercode)) {
223  $pcgvercode = $pcgverid;
224  }
225 
226  $sql = "SELECT date_format(b.doc_date, '%Y-%m') as dm, sum(b.debit - b.credit) as amount_ttc";
227  $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b,";
228  $sql .= " ".MAIN_DB_PREFIX."accounting_account as aa";
229  $sql .= " WHERE b.entity = ".$conf->entity; // In module double party accounting, we never share entities
230  $sql .= " AND b.doc_type = 'supplier_invoice'";
231  $sql .= " AND b.numero_compte = aa.account_number";
232  $sql .= " AND aa.entity = ".$conf->entity;
233  $sql .= " AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
234  $sql .= " AND aa.pcg_type = 'EXPENSE'"; // TODO Be able to use a custom group
235 }
236 //print $sql;
237 
238 $sql .= " GROUP BY dm";
239 $sql .= " ORDER BY dm";
240 // TODO Add a filter on $date_start and $date_end to reduce quantity on data
241 //print $sql;
242 
243 $minyearmonth = $maxyearmonth = 0;
244 
245 $result = $db->query($sql);
246 if ($result) {
247  $num = $db->num_rows($result);
248  $i = 0;
249  while ($i < $num) {
250  $obj = $db->fetch_object($result);
251  $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0;
252  $cum[$obj->dm] = $obj->amount_ttc;
253  if ($obj->amount_ttc) {
254  $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm);
255  $maxyearmonth = max($maxyearmonth, $obj->dm);
256  }
257  $i++;
258  }
259  $db->free($result);
260 } else {
261  dol_print_error($db);
262 }
263 
264 $moreforfilter = '';
265 
266 print '<div class="div-table-responsive">';
267 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
268 
269 print '<tr class="liste_titre"><td>&nbsp;</td>';
270 
271 for ($annee = $year_start; $annee <= $year_end; $annee++) {
272  if ($modecompta == 'CREANCES-DETTES') {
273  print '<td align="center" width="10%" colspan="3">';
274  } else {
275  print '<td align="center" width="10%" colspan="2" class="borderrightlight">';
276  }
277  if ($modecompta != 'BOOKKEEPING') {
278  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee.($modecompta ? '&modecompta='.$modecompta : '').'">';
279  }
280  print $annee;
281  if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) {
282  print '-'.($annee + 1);
283  }
284  if ($modecompta != 'BOOKKEEPING') {
285  print '</a>';
286  }
287  print '</td>';
288  if ($annee != $year_end) {
289  print '<td width="15">&nbsp;</td>';
290  }
291 }
292 print '</tr>';
293 
294 print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
295 for ($annee = $year_start; $annee <= $year_end; $annee++) {
296  if ($modecompta == 'CREANCES-DETTES') {
297  print '<td class="liste_titre right">'.$langs->trans("AmountHT").'</td>';
298  }
299  print '<td class="liste_titre right">';
300  if ($modecompta == "BOOKKEEPING") {
301  print $langs->trans("Amount");
302  } else {
303  print $langs->trans("AmountTTC");
304  }
305  print '</td>';
306  print '<td class="liste_titre right borderrightlight">'.$langs->trans("Delta").'</td>';
307  if ($annee != $year_end) {
308  print '<td class="liste_titre" width="15">&nbsp;</td>';
309  }
310 }
311 print '</tr>';
312 
313 $now_show_delta = 0;
314 $minyear = substr($minyearmonth, 0, 4);
315 $maxyear = substr($maxyearmonth, 0, 4);
316 $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
317 $nowyearmonth = strftime("%Y-%m", dol_now());
318 $maxyearmonth = max($maxyearmonth, $nowyearmonth);
319 $now = dol_now();
320 $casenow = dol_print_date($now, "%Y-%m");
321 
322 // Loop on each month
323 $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0;
324 for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
325  $mois_modulo = $mois; // ajout
326  if ($mois > 12) {
327  $mois_modulo = $mois - 12;
328  } // ajout
329 
330  if ($year_start == $year_end) {
331  if ($mois > $date_endmonth && $year_end >= $date_endyear) {
332  break;
333  }
334  }
335 
336  print '<tr class="oddeven">';
337 
338  // Month
339  print "<td>".dol_print_date(dol_mktime(12, 0, 0, $mois_modulo, 1, 2000), "%B")."</td>";
340 
341  for ($annee = $year_start - 1; $annee <= $year_end; $annee++) { // We start one year before to have data to be able to make delta
342  $annee_decalage = $annee;
343  if ($mois > 12) {
344  $annee_decalage = $annee + 1;
345  }
346  $case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
347  $caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m");
348 
349  if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
350  if ($modecompta == 'CREANCES-DETTES') {
351  // Valeur CA du mois w/o VAT
352  print '<td class="right">';
353  if (!empty($cum_ht[$case])) {
354  $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
355  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
356  } else {
357  if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) {
358  print '0';
359  } else {
360  print '&nbsp;';
361  }
362  }
363  print "</td>";
364  }
365 
366  // Valeur CA du mois
367  print '<td class="right">';
368  if (!empty($cum[$case])) {
369  $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
370  if ($modecompta != 'BOOKKEEPING') {
371  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
372  }
373  print price($cum[$case], 1);
374  if ($modecompta != 'BOOKKEEPING') {
375  print '</a>';
376  }
377  } else {
378  if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) {
379  print '0';
380  } else {
381  print '&nbsp;';
382  }
383  }
384  print "</td>";
385 
386  // Pourcentage du mois
387  if ($annee_decalage > $minyear && $case <= $casenow) {
388  if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
389  $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
390  //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
391  print '<td class="borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>';
392  }
393  if (!empty($cum[$caseprev]) && empty($cum[$case])) {
394  print '<td class="borderrightlight right">-100%</td>';
395  }
396  if (empty($cum[$caseprev]) && !empty($cum[$case])) {
397  //print '<td class="right">+Inf%</td>';
398  print '<td class="borderrightlight right">-</td>';
399  }
400  if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
401  print '<td class="borderrightlight right">+0%</td>';
402  }
403  if (!isset($cum[$caseprev]) && empty($cum[$case])) {
404  print '<td class="borderrightlight right">-</td>';
405  }
406  } else {
407  print '<td class="borderrightlight right">';
408  if ($minyearmonth <= $case && $case <= $maxyearmonth) {
409  print '-';
410  } else {
411  print '&nbsp;';
412  }
413  print '</td>';
414  }
415 
416  if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) {
417  print '<td width="15">&nbsp;</td>';
418  }
419  }
420 
421  if (empty($total_ht[$annee])) {
422  $total_ht[$annee] = ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
423  } else {
424  $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
425  }
426  if (empty($total[$annee])) {
427  $total[$annee] = (empty($cum[$case]) ? 0 : $cum[$case]);
428  } else {
429  $total[$annee] += (empty($cum[$case]) ? 0 : $cum[$case]);
430  }
431  }
432 
433  print '</tr>';
434 }
435 
436 // Affiche total
437 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>';
438 for ($annee = $year_start; $annee <= $year_end; $annee++) {
439  if ($modecompta == 'CREANCES-DETTES') {
440  // Montant total HT
441  if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
442  print '<td class="nowrap right">'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."</td>";
443  } else {
444  print '<td>&nbsp;</td>';
445  }
446  }
447 
448  // Montant total
449  if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
450  print '<td class="nowrap right">'.($total[$annee] ?price($total[$annee]) : "0")."</td>";
451  } else {
452  print '<td>&nbsp;</td>';
453  }
454 
455  // Pourcentage total
456  if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
457  if ($total[$annee - 1] && $total[$annee]) {
458  $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
459  print '<td class="nowrap borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>';
460  }
461  if ($total[$annee - 1] && !$total[$annee]) {
462  print '<td class="borderrightlight right">-100%</td>';
463  }
464  if (!$total[$annee - 1] && $total[$annee]) {
465  print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
466  }
467  if (!$total[$annee - 1] && !$total[$annee]) {
468  print '<td class="borderrightlight right">+0%</td>';
469  }
470  } else {
471  print '<td class="borderrightlight right">';
472  if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
473  print '-';
474  } else {
475  print '&nbsp;';
476  }
477  print '</td>';
478  }
479 
480  if ($annee != $year_end) {
481  print '<td width="15">&nbsp;</td>';
482  }
483 }
484 print "</tr>\n";
485 print "</table>";
486 print '</div>';
487 
488 // End of page
489 llxFooter();
490 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:575
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:594
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
img_previous($titlealt='default', $moreatt='')
Show previous logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
img_next($titlealt='default', $moreatt='')
Show next logo.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
Definition: report.lib.php:41
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.