dolibarr 20.0.2
supplier_turnover_by_prodserv.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
24require '../../main.inc.php';
25require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
26require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
29require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
30
31// Load translation files required by the page
32$langs->loadLangs(array("products", "categories", "errors", 'accountancy'));
33
34// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
35$modecompta = getDolGlobalString('ACCOUNTING_MODE');
36if (GETPOST("modecompta")) {
37 $modecompta = GETPOST("modecompta");
38}
39
40// Sort Order
41$sortorder = GETPOST("sortorder", 'aZ09comma');
42$sortfield = GETPOST("sortfield", 'aZ09comma');
43if (!$sortorder) {
44 $sortorder = "asc";
45}
46if (!$sortfield) {
47 $sortfield = "ref";
48}
49
50// Category
51$selected_cat = GETPOSTINT('search_categ');
52$selected_soc = GETPOSTINT('search_soc');
53$subcat = false;
54if (GETPOST('subcat', 'alpha') === 'yes') {
55 $subcat = true;
56}
57// product/service
58$selected_type = GETPOST('search_type', "intcomma");
59if ($selected_type == '') {
60 $selected_type = -1;
61}
62
63// Hook
64$hookmanager->initHooks(array('supplierturnoverbyprodservlist'));
65
66$date_startyear = GETPOSTINT("date_startyear");
67$date_startmonth = GETPOSTINT("date_startmonth");
68$date_startday = GETPOSTINT("date_startday");
69$date_endyear = GETPOSTINT("date_endyear");
70$date_endmonth = GETPOSTINT("date_endmonth");
71$date_endday = GETPOSTINT("date_endday");
72
73$nbofyear = 1;
74
75// Date range
76$year = GETPOSTINT("year");
77$month = GETPOSTINT("month");
78if (empty($year)) {
79 $year_current = (int) dol_print_date(dol_now(), "%Y");
80 $month_current = (int) dol_print_date(dol_now(), "%m");
81 $year_start = $year_current - ($nbofyear - 1);
82} else {
83 $year_current = $year;
84 $month_current = (int) dol_print_date(dol_now(), "%m");
85 $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
86}
87$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
88$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
89
90// We define date_start and date_end
91if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
92 $q = GETPOSTINT("q");
93 if (empty($q)) {
94 // We define date_start and date_end
95 $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
96 $month_start = GETPOSTISSET("month") ? GETPOSTINT("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
97 if (!GETPOST("month")) { // If month not forced
98 if (!$year && $month_start > $month_current) {
99 $year_start--;
100 $year_end--;
101 }
102 $month_end = $month_start - 1;
103 if ($month_end < 1) {
104 $month_end = 12;
105 }
106 } else {
107 $month_end = $month_start;
108 }
109 $date_start = dol_get_first_day($year_start, $month_start, false);
110 $date_end = dol_get_last_day($year_end, $month_end, false);
111 }
112 if ($q == 1) {
113 $date_start = dol_get_first_day($year_start, 1, false);
114 $date_end = dol_get_last_day($year_start, 3, false);
115 }
116 if ($q == 2) {
117 $date_start = dol_get_first_day($year_start, 4, false);
118 $date_end = dol_get_last_day($year_start, 6, false);
119 }
120 if ($q == 3) {
121 $date_start = dol_get_first_day($year_start, 7, false);
122 $date_end = dol_get_last_day($year_start, 9, false);
123 }
124 if ($q == 4) {
125 $date_start = dol_get_first_day($year_start, 10, false);
126 $date_end = dol_get_last_day($year_start, 12, false);
127 }
128}
129
130// $date_start and $date_end are defined. We force $year_start and $nbofyear
131$tmps = dol_getdate($date_start);
132$year_start = $tmps['year'];
133$tmpe = dol_getdate($date_end);
134$year_end = $tmpe['year'];
135$nbofyear = ($year_end - $year_start) + 1;
136
137$commonparams = array();
138if (!empty($modecompta)) {
139 $commonparams['modecompta'] = $modecompta;
140}
141if (!empty($sortorder)) {
142 $commonparams['sortorder'] = $sortorder;
143}
144if (!empty($sortfield)) {
145 $commonparams['sortfield'] = $sortfield;
146}
147
148$headerparams = array();
149if (!empty($date_startyear)) {
150 $headerparams['date_startyear'] = $date_startyear;
151}
152if (!empty($date_startmonth)) {
153 $headerparams['date_startmonth'] = $date_startmonth;
154}
155if (!empty($date_startday)) {
156 $headerparams['date_startday'] = $date_startday;
157}
158if (!empty($date_endyear)) {
159 $headerparams['date_endyear'] = $date_endyear;
160}
161if (!empty($date_endmonth)) {
162 $headerparams['date_endmonth'] = $date_endmonth;
163}
164if (!empty($date_endday)) {
165 $headerparams['date_endday'] = $date_endday;
166}
167if (!empty($year)) {
168 $headerparams['year'] = $year;
169}
170if (!empty($month)) {
171 $headerparams['month'] = $month;
172}
173$headerparams['q'] = $q;
174
175$tableparams = array();
176if (!empty($selected_cat)) {
177 $tableparams['search_categ'] = $selected_cat;
178}
179if (!empty($selected_soc)) {
180 $tableparams['search_soc'] = $selected_soc;
181}
182if (!empty($selected_type)) {
183 $tableparams['search_type'] = $selected_type;
184}
185$tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
186
187// Adding common parameters
188$allparams = array_merge($commonparams, $headerparams, $tableparams);
189$headerparams = array_merge($commonparams, $headerparams);
190$tableparams = array_merge($commonparams, $tableparams);
191
192$paramslink = '';
193foreach ($allparams as $key => $value) {
194 $paramslink .= '&'.$key.'='.$value;
195}
196
197// Security pack (data & check)
198$socid = GETPOSTINT('socid');
199
200if ($user->socid > 0) {
201 $socid = $user->socid;
202}
203if (isModEnabled('comptabilite')) {
204 $result = restrictedArea($user, 'compta', '', '', 'resultat');
205}
206if (isModEnabled('accounting')) {
207 $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
208}
209
210
211/*
212 * View
213 */
214
215llxHeader();
216
217$form = new Form($db);
218$formother = new FormOther($db);
219
220// TODO Report from bookkeeping not yet available, so we switch on report on business events
221if ($modecompta == "BOOKKEEPING") {
222 $modecompta = "CREANCES-DETTES";
223}
224if ($modecompta == "BOOKKEEPINGCOLLECTED") {
225 $modecompta = "RECETTES-DEPENSES";
226}
227
228// Show report header
229if ($modecompta == "CREANCES-DETTES") {
230 $name = $langs->trans("PurchaseTurnover").', '.$langs->trans("ByProductsAndServices");
231 $calcmode = $langs->trans("CalcModeDebt");
232 //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
233
234 $description = $langs->trans("RulesPurchaseTurnoverDue");
235} elseif ($modecompta == "RECETTES-DEPENSES") {
236 $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByProductsAndServices");
237 $calcmode = $langs->trans("CalcModePayment");
238 //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
239 $description = $langs->trans("RulesPurchaseTurnoverIn");
240} elseif ($modecompta == "BOOKKEEPING") {
241 // TODO
242} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
243 // TODO
244}
245
246$builddate = dol_now();
247$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
248$period .= ' - ';
249$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
250if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
251 $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
252} else {
253 $periodlink = '';
254}
255
256$exportlink = '';
257
258report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
259
260if (isModEnabled('accounting')) {
261 if ($modecompta != 'BOOKKEEPING') {
262 print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
263 } else {
264 // Test if there is at least one line in bookkeeping
265 $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
266 $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
267 if (empty($pcgvercode)) {
268 $pcgvercode = $pcgverid;
269 }
270
271 $sql = "SELECT b.rowid ";
272 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b,";
273 $sql .= " ".MAIN_DB_PREFIX."accounting_account as aa";
274 $sql .= " WHERE b.entity = ".$conf->entity; // In module double party accounting, we never share entities
275 $sql .= " AND b.numero_compte = aa.account_number";
276 $sql .= " AND aa.entity = ".$conf->entity;
277 $sql .= " AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
278 $sql .= $db->plimit(1);
279
280 $resql = $db->query($sql);
281 $nb = $db->num_rows($resql);
282 if ($nb == 0) {
283 $langs->load("errors");
284 print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1);
285 }
286 }
287}
288
289
290
291$name = array();
292$amount = array();
293$amount_ht = array();
294$qty = array();
295
296// SQL request
297$catotal = 0;
298$catotal_ht = 0;
299$qtytotal = 0;
300
301if ($modecompta == 'CREANCES-DETTES') {
302 $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
303 $sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
304 $sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
305 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
306 if ($selected_soc > 0) {
307 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
308 }
309 $sql .= ",".MAIN_DB_PREFIX."facture_fourn_det as l";
310 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
311 if ($selected_cat === -2) { // Without any category
312 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
313 } elseif ($selected_cat) { // Into a specific category
314 $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
315 }
316 $sql .= " WHERE l.fk_facture_fourn = f.rowid";
317 $sql .= " AND f.fk_statut in (1,2)";
318 $sql .= " AND f.type IN (0,2)";
319
320 if ($date_start && $date_end) {
321 $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
322 }
323 if ($selected_type >= 0) {
324 $sql .= " AND l.product_type = ".((int) $selected_type);
325 }
326 if ($selected_cat === -2) { // Without any category
327 $sql .= " AND cp.fk_product is null";
328 } elseif ($selected_cat) { // Into a specific category
329 $sql .= " AND (c.rowid = ".((int) $selected_cat);
330 if ($subcat) {
331 $sql .= " OR c.fk_parent = ".((int) $selected_cat);
332 }
333 $sql .= ")";
334 $sql .= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
335 }
336 if ($selected_soc > 0) {
337 $sql .= " AND soc.rowid=".((int) $selected_soc);
338 }
339 $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
340 $sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
341 $sql .= $db->order($sortfield, $sortorder);
342
343 dol_syslog("supplier_turnover_by_prodserv", LOG_DEBUG);
344 $resql = $db->query($sql);
345 if ($resql) {
346 $num = $db->num_rows($resql);
347 $i = 0;
348 while ($i < $num) {
349 $obj = $db->fetch_object($resql);
350
351 $amount_ht[$obj->rowid] = $obj->amount;
352 $amount[$obj->rowid] = $obj->amount_ttc;
353 $qty[$obj->rowid] = $obj->qty;
354 $name[$obj->rowid] = $obj->ref.'&nbsp;-&nbsp;'.$obj->label;
355 $type[$obj->rowid] = $obj->product_type;
356
357 $catotal_ht += $obj->amount;
358 $catotal += $obj->amount_ttc;
359 $qtytotal += $obj->qty;
360
361 $i++;
362 }
363 } else {
364 dol_print_error($db);
365 }
366
367 // Show array
368 $i = 0;
369 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
370 print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
371 // Extra parameters management
372 foreach ($headerparams as $key => $value) {
373 print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
374 }
375
376 $moreforfilter = '';
377
378 print '<div class="div-table-responsive">';
379 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
380
381 // Category filter
382 print '<tr class="liste_titre">';
383 print '<td>';
384 print img_picto('', 'category', 'class="paddingrightonly"');
385 print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category"), 'maxwidth300');
386 print ' ';
387 print '<label for="subcat" class="marginleftonly">'.$langs->trans("SubCats").'?</label> ';
388 print '<input type="checkbox" id="subcat" name="subcat" value="yes"';
389 if ($subcat) {
390 print ' checked';
391 }
392 print '>';
393 // type filter (produit/service)
394 print ' &nbsp; ';
395 $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', $langs->trans("Type"), 1, 1);
396
397 //select thirdparty
398 print '<br>';
399 print img_picto('', 'company', 'class="paddingrightonly"');
400 print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"), 0, 0, [], '', 0, 0, 'maxwidth250');
401 print '</td>';
402
403 print '<td colspan="5" class="right">';
404 print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
405 print '</td></tr>';
406
407 // Array header
408 print '<tr class="liste_titre">';
410 $langs->trans("Product"),
411 $_SERVER["PHP_SELF"],
412 "ref",
413 "",
414 $paramslink,
415 "",
416 $sortfield,
417 $sortorder
418 );
420 $langs->trans('Quantity'),
421 $_SERVER["PHP_SELF"],
422 "qty",
423 "",
424 $paramslink,
425 'class="right"',
426 $sortfield,
427 $sortorder
428 );
430 $langs->trans("Percentage"),
431 $_SERVER["PHP_SELF"],
432 "qty",
433 "",
434 $paramslink,
435 'class="right"',
436 $sortfield,
437 $sortorder
438 );
440 $langs->trans('AmountHT'),
441 $_SERVER["PHP_SELF"],
442 "amount",
443 "",
444 $paramslink,
445 'class="right"',
446 $sortfield,
447 $sortorder
448 );
450 $langs->trans("AmountTTC"),
451 $_SERVER["PHP_SELF"],
452 "amount_ttc",
453 "",
454 $paramslink,
455 'class="right"',
456 $sortfield,
457 $sortorder
458 );
460 $langs->trans("Percentage"),
461 $_SERVER["PHP_SELF"],
462 "amount_ttc",
463 "",
464 $paramslink,
465 'class="right"',
466 $sortfield,
467 $sortorder
468 );
469 print "</tr>\n";
470
471 if (count($name)) {
472 foreach ($name as $key => $value) {
473 print '<tr class="oddeven">';
474
475 // Product
476 print "<td>";
477 $fullname = $name[$key];
478 if ($key > 0) {
479 $linkname = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"), $type[$key] == 0 ? 'product' : 'service').' '.$fullname.'</a>';
480 } else {
481 $linkname = $langs->trans("PaymentsNotLinkedToProduct");
482 }
483 print $linkname;
484 print "</td>\n";
485
486 // Quantity
487 print '<td class="right">';
488 print $qty[$key];
489 print '</td>';
490
491 // Percent;
492 print '<td class="right">'.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : '&nbsp;').'</td>';
493
494 // Amount w/o VAT
495 print '<td class="right">';
496 print price($amount_ht[$key]);
497 print '</td>';
498
499 // Amount with VAT
500 print '<td class="right">';
501 print price($amount[$key]);
502 print '</td>';
503
504 // Percent;
505 print '<td class="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>';
506
507 // TODO: statistics?
508
509 print "</tr>\n";
510 $i++;
511 }
512
513 // Total
514 print '<tr class="liste_total">';
515 print '<td>'.$langs->trans("Total").'</td>';
516 print '<td class="right">'.$qtytotal.'</td>';
517 print '<td class="right">100%</td>';
518 print '<td class="right">'.price($catotal_ht).'</td>';
519 print '<td class="right">'.price($catotal).'</td>';
520 print '<td class="right">100%</td>';
521 print '</tr>';
522
523 $db->free($result);
524 } else {
525 print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
526 }
527 print "</table>";
528 print "</div>";
529
530 print '</form>';
531} else {
532 // $modecompta != 'CREANCES-DETTES'
533 // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
534 // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
535 // Because there is no way to know this, this report is not relevant.
536 print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant").'<br>';
537}
538
539// End of page
540llxFooter();
541$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:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition date.lib.php:595
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:614
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a 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.
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).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_next($titlealt='default', $moreatt='')
Show next logo.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
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.