dolibarr  19.0.0-dev
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 + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 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 - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
60  $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
61  if (!GETPOST('month')) {
62  if (!$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  }
70  } else {
71  $month_end = $month_start;
72  }
73  $date_start = dol_get_first_day($year_start, $month_start, false);
74  $date_end = dol_get_last_day($year_end, $month_end, false);
75  }
76  if ($q == 1) {
77  $date_start = dol_get_first_day($year_start, 1, false);
78  $date_end = dol_get_last_day($year_start, 3, false);
79  }
80  if ($q == 2) {
81  $date_start = dol_get_first_day($year_start, 4, false);
82  $date_end = dol_get_last_day($year_start, 6, false);
83  }
84  if ($q == 3) {
85  $date_start = dol_get_first_day($year_start, 7, false);
86  $date_end = dol_get_last_day($year_start, 9, false);
87  }
88  if ($q == 4) {
89  $date_start = dol_get_first_day($year_start, 10, false);
90  $date_end = dol_get_last_day($year_start, 12, false);
91  }
92 }
93 
94 $userid = GETPOST('userid', 'int');
95 $socid = GETPOST('socid', 'int');
96 
97 $tmps = dol_getdate($date_start);
98 $year_start = $tmps['year'];
99 $tmpe = dol_getdate($date_end);
100 $year_end = $tmpe['year'];
101 $nbofyear = ($year_end - $year_start) + 1;
102 
103 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
104 $modecompta = $conf->global->ACCOUNTING_MODE;
105 if (isModEnabled('accounting')) {
106  $modecompta = 'BOOKKEEPING';
107 }
108 if (GETPOST("modecompta", 'alpha')) {
109  $modecompta = GETPOST("modecompta", 'alpha');
110 }
111 
112 // Security check
113 if ($user->socid > 0) {
114  $socid = $user->socid;
115 }
116 if (isModEnabled('comptabilite')) {
117  $result = restrictedArea($user, 'compta', '', '', 'resultat');
118 }
119 if (isModEnabled('accounting')) {
120  $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
121 }
122 
123 
124 /*
125  * View
126  */
127 
128 llxHeader();
129 
130 $form = new Form($db);
131 
132 $exportlink = '';
133 $namelink = '';
134 $builddate = dol_now();
135 
136 // TODO Report from bookkeeping not yet available, so we switch on report on business events
137 /*if ($modecompta == "BOOKKEEPING") {
138  $modecompta = "CREANCES-DETTES";
139 }*/
140 if ($modecompta == "BOOKKEEPINGCOLLECTED") {
141  $modecompta = "RECETTES-DEPENSES";
142 }
143 
144 // Affiche en-tete du rapport
145 if ($modecompta == "CREANCES-DETTES") {
146  $name = $langs->trans("PurchaseTurnover");
147  $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>" : "");
148  $description = $langs->trans("RulesPurchaseTurnoverDue");
149  //$exportlink=$langs->trans("NotYetAvailable");
150 } elseif ($modecompta == "RECETTES-DEPENSES") {
151  $name = $langs->trans("PurchaseTurnoverCollected");
152  $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>" : "");
153  $description = $langs->trans("RulesPurchaseTurnoverIn");
154  //$exportlink=$langs->trans("NotYetAvailable");
155 } elseif ($modecompta == "BOOKKEEPING") {
156  $name = $langs->trans("PurchaseTurnover");
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("RulesPurchaseTurnoverOfExpenseAccounts");
159  //$exportlink=$langs->trans("NotYetAvailable");
160 } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
161  $name = $langs->trans("PurchaseTurnoverCollected");
162  $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>" : "");
163  $description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts");
164  //$exportlink=$langs->trans("NotYetAvailable");
165 }
166 
167 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
168 $period .= ' - ';
169 $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
170 
171 $moreparam = array();
172 if (!empty($modecompta)) {
173  $moreparam['modecompta'] = $modecompta;
174 }
175 
176 // Define $calcmode line
177 $calcmode = '';
178 if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED") {
179  /*if (isModEnabled('accounting')) {
180  $calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
181  $calcmode .= '<br>';
182  }*/
183  $calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
184  if (isModEnabled('accounting')) {
185  $calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
186  }
187  $calcmode .= '</label>';
188 } else {
189  if (isModEnabled('accounting')) {
190  $calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
191  $calcmode .= '<br>';
192  }
193  $calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
194  if (isModEnabled('accounting')) {
195  $calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
196  }
197  $calcmode .= '</label>';
198 }
199 
200 
201 report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
202 
203 if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
204  print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
205 }
206 
207 
208 if ($modecompta == 'CREANCES-DETTES') {
209  $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
210  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
211  $sql .= " WHERE f.fk_statut in (1,2)";
212  $sql .= " AND f.type IN (0,2)";
213  $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
214  if ($socid) {
215  $sql .= " AND f.fk_soc = ".((int) $socid);
216  }
217 } elseif ($modecompta == "RECETTES-DEPENSES") {
218  $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
219  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
220  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
221  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p";
222  $sql .= " WHERE p.rowid = pf.fk_paiementfourn";
223  $sql .= " AND pf.fk_facturefourn = f.rowid";
224  $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
225  if ($socid) {
226  $sql .= " AND f.fk_soc = ".((int) $socid);
227  }
228 } elseif ($modecompta == "BOOKKEEPING") {
229  $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
230  $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
231  if (empty($pcgvercode)) {
232  $pcgvercode = $pcgverid;
233  }
234 
235  $sql = "SELECT date_format(b.doc_date, '%Y-%m') as dm, sum(b.debit - b.credit) as amount_ttc";
236  $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b,";
237  $sql .= " ".MAIN_DB_PREFIX."accounting_account as aa";
238  $sql .= " WHERE b.entity = ".$conf->entity; // In module double party accounting, we never share entities
239  $sql .= " AND b.doc_type = 'supplier_invoice'";
240  $sql .= " AND b.numero_compte = aa.account_number";
241  $sql .= " AND aa.entity = ".$conf->entity;
242  $sql .= " AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
243  $sql .= " AND aa.pcg_type = 'EXPENSE'"; // TODO Be able to use a custom group
244 }
245 //print $sql;
246 
247 $sql .= " GROUP BY dm";
248 $sql .= " ORDER BY dm";
249 // TODO Add a filter on $date_start and $date_end to reduce quantity on data
250 //print $sql;
251 
252 $minyearmonth = $maxyearmonth = 0;
253 
254 $cum = array();
255 $cum_ht = array();
256 $total_ht = array();
257 $total = array();
258 
259 $result = $db->query($sql);
260 if ($result) {
261  $num = $db->num_rows($result);
262  $i = 0;
263  while ($i < $num) {
264  $obj = $db->fetch_object($result);
265  $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount;
266  $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc;
267  if ($obj->amount_ttc) {
268  $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm);
269  $maxyearmonth = max($maxyearmonth, $obj->dm);
270  }
271  $i++;
272  }
273  $db->free($result);
274 } else {
275  dol_print_error($db);
276 }
277 
278 $moreforfilter = '';
279 
280 print '<div class="div-table-responsive">';
281 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
282 
283 print '<tr class="liste_titre"><td>&nbsp;</td>';
284 
285 for ($annee = $year_start; $annee <= $year_end; $annee++) {
286  if ($modecompta == 'CREANCES-DETTES') {
287  print '<td align="center" width="10%" colspan="3">';
288  } else {
289  print '<td align="center" width="10%" colspan="2" class="borderrightlight">';
290  }
291  if ($modecompta != 'BOOKKEEPING') {
292  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee.($modecompta ? '&modecompta='.$modecompta : '').'">';
293  }
294  print $annee;
295  if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) {
296  print '-'.($annee + 1);
297  }
298  if ($modecompta != 'BOOKKEEPING') {
299  print '</a>';
300  }
301  print '</td>';
302  if ($annee != $year_end) {
303  print '<td width="15">&nbsp;</td>';
304  }
305 }
306 print '</tr>';
307 
308 print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
309 for ($annee = $year_start; $annee <= $year_end; $annee++) {
310  if ($modecompta == 'CREANCES-DETTES') {
311  print '<td class="liste_titre right">'.$langs->trans("AmountHT").'</td>';
312  }
313  print '<td class="liste_titre right">';
314  if ($modecompta == "BOOKKEEPING") {
315  print $langs->trans("Amount");
316  } else {
317  print $langs->trans("AmountTTC");
318  }
319  print '</td>';
320  print '<td class="liste_titre right borderrightlight">'.$langs->trans("Delta").'</td>';
321  if ($annee != $year_end) {
322  print '<td class="liste_titre" width="15">&nbsp;</td>';
323  }
324 }
325 print '</tr>';
326 
327 $now_show_delta = 0;
328 $minyear = substr($minyearmonth, 0, 4);
329 $maxyear = substr($maxyearmonth, 0, 4);
330 $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
331 $nowyearmonth = strftime("%Y-%m", dol_now());
332 $maxyearmonth = max($maxyearmonth, $nowyearmonth);
333 $now = dol_now();
334 $casenow = dol_print_date($now, "%Y-%m");
335 
336 // Loop on each month
337 $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0;
338 for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
339  $mois_modulo = $mois; // ajout
340  if ($mois > 12) {
341  $mois_modulo = $mois - 12;
342  } // ajout
343 
344  if ($year_start == $year_end) {
345  if ($mois > $date_endmonth && $year_end >= $date_endyear) {
346  break;
347  }
348  }
349 
350  print '<tr class="oddeven">';
351 
352  // Month
353  print "<td>".dol_print_date(dol_mktime(12, 0, 0, $mois_modulo, 1, 2000), "%B")."</td>";
354 
355  for ($annee = $year_start - 1; $annee <= $year_end; $annee++) { // We start one year before to have data to be able to make delta
356  $annee_decalage = $annee;
357  if ($mois > 12) {
358  $annee_decalage = $annee + 1;
359  }
360  $case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
361  $caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m");
362 
363  if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
364  if ($modecompta == 'CREANCES-DETTES') {
365  // Value turnover of month w/o VAT
366  print '<td class="right">';
367  if (!empty($cum_ht[$case])) {
368  $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
369  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
370  } else {
371  if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) {
372  print '0';
373  } else {
374  print '&nbsp;';
375  }
376  }
377  print "</td>";
378  }
379 
380  // Value turnover of month
381  print '<td class="right">';
382  if (!empty($cum[$case])) {
383  $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
384  if ($modecompta != 'BOOKKEEPING') {
385  print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
386  }
387  print price($cum[$case], 1);
388  if ($modecompta != 'BOOKKEEPING') {
389  print '</a>';
390  }
391  } else {
392  if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) {
393  print '0';
394  } else {
395  print '&nbsp;';
396  }
397  }
398  print "</td>";
399 
400  // Percentage of month
401  if ($annee_decalage > $minyear && $case <= $casenow) {
402  if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
403  $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
404  //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
405  print '<td class="borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>';
406  }
407  if (!empty($cum[$caseprev]) && empty($cum[$case])) {
408  print '<td class="borderrightlight right">-100%</td>';
409  }
410  if (empty($cum[$caseprev]) && !empty($cum[$case])) {
411  //print '<td class="right">+Inf%</td>';
412  print '<td class="borderrightlight right">-</td>';
413  }
414  if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
415  print '<td class="borderrightlight right">+0%</td>';
416  }
417  if (!isset($cum[$caseprev]) && empty($cum[$case])) {
418  print '<td class="borderrightlight right">-</td>';
419  }
420  } else {
421  print '<td class="borderrightlight right">';
422  if ($minyearmonth <= $case && $case <= $maxyearmonth) {
423  print '-';
424  } else {
425  print '&nbsp;';
426  }
427  print '</td>';
428  }
429 
430  if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) {
431  print '<td width="15">&nbsp;</td>';
432  }
433  }
434 
435  if (empty($total_ht[$annee])) {
436  $total_ht[$annee] = ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
437  } else {
438  $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
439  }
440  if (empty($total[$annee])) {
441  $total[$annee] = (empty($cum[$case]) ? 0 : $cum[$case]);
442  } else {
443  $total[$annee] += (empty($cum[$case]) ? 0 : $cum[$case]);
444  }
445  }
446 
447  print '</tr>';
448 }
449 
450 // Affiche total
451 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>';
452 for ($annee = $year_start; $annee <= $year_end; $annee++) {
453  if ($modecompta == 'CREANCES-DETTES') {
454  // Montant total HT
455  if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
456  print '<td class="nowrap right">';
457  print ($total_ht[$annee] ?price($total_ht[$annee]) : "0");
458  print "</td>";
459  } else {
460  print '<td>&nbsp;</td>';
461  }
462  }
463 
464  // Montant total
465  if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
466  print '<td class="nowrap right">'.($total[$annee] ?price($total[$annee]) : "0")."</td>";
467  } else {
468  print '<td>&nbsp;</td>';
469  }
470 
471  // Pourcentage total
472  if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
473  if ($total[$annee - 1] && $total[$annee]) {
474  $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
475  print '<td class="nowrap borderrightlight right">';
476  print ($percent >= 0 ? "+$percent" : "$percent").'%';
477  print '</td>';
478  }
479  if (!empty($total[$annee - 1]) && empty($total[$annee])) {
480  print '<td class="borderrightlight right">-100%</td>';
481  }
482  if (empty($total[$annee - 1]) && !empty($total[$annee])) {
483  print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
484  }
485  if (empty($total[$annee - 1]) && empty($total[$annee])) {
486  print '<td class="borderrightlight right">+0%</td>';
487  }
488  } else {
489  print '<td class="borderrightlight right">';
490  if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
491  print '-';
492  } else {
493  print '&nbsp;';
494  }
495  print '</td>';
496  }
497 
498  if ($annee != $year_end) {
499  print '<td width="15">&nbsp;</td>';
500  }
501 }
502 print "</tr>\n";
503 print "</table>";
504 print '</div>';
505 
506 // End of page
507 llxFooter();
508 $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(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
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:576
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:595
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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.