dolibarr 21.0.0-alpha
productMargins.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.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
24// Load Dolibarr environment
25require '../../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
27require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
28require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
29
30$langs->loadLangs(array("companies", "bills", "products", "margins"));
31
32$id = GETPOSTINT('id');
33$ref = GETPOST('ref', 'alpha');
34$action = GETPOST('action', 'aZ09');
35$confirm = GETPOST('confirm', 'alpha');
36
37// Security check
38$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
39$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
40if (!empty($user->socid)) {
41 $socid = $user->socid;
42}
43
44$object = new Product($db);
45
46$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
47$sortfield = GETPOST('sortfield', 'aZ09comma');
48$sortorder = GETPOST('sortorder', 'aZ09comma');
49$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
50if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
51 // If $page is not defined, or '' or -1 or if we click on clear filters
52 $page = 0;
53}
54$offset = $limit * $page;
55$pageprev = $page - 1;
56$pagenext = $page + 1;
57if (!$sortorder) {
58 $sortorder = "DESC";
59}
60if (!$sortfield) {
61 $sortfield = "f.datef";
62}
63
64$hookmanager->initHooks(array('tabproductmarginlist'));
65
66$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
67
68if (!$user->hasRight('margins', 'liretous')) {
70}
71
72$search_invoice_date_start = '';
73$search_invoice_date_end = '';
74if (GETPOSTINT('search_invoice_date_start_month')) {
75 $search_invoice_date_start = dol_mktime(0, 0, 0, GETPOSTINT('search_invoice_date_start_month'), GETPOSTINT('search_invoice_date_start_day'), GETPOSTINT('search_invoice_date_start_year'));
76}
77if (GETPOSTINT('search_invoice_date_end_month')) {
78 $search_invoice_date_end = dol_mktime(23, 59, 59, GETPOSTINT('search_invoice_date_end_month'), GETPOSTINT('search_invoice_date_end_day'), GETPOSTINT('search_invoice_date_end_year'));
79}
80
81// Purge search criteria
82if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
83 $search_invoice_date_start = '';
84 $search_invoice_date_end = '';
85}
86
87// set default dates from fiscal year
88if (empty($search_invoice_date_start) && empty($search_invoice_date_end) && !GETPOSTISSET('restore_lastsearch_values')) {
89 $query = "SELECT date_start, date_end";
90 $query .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
91 $query .= " WHERE date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
92 $res = $db->query($query);
93
94 if ($res && $db->num_rows($res) > 0) {
95 $fiscalYear = $db->fetch_object($res);
96 $search_invoice_date_start = strtotime($fiscalYear->date_start);
97 $search_invoice_date_end = strtotime($fiscalYear->date_end);
98 } else {
99 $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
100 $year_start = (int) dol_print_date(dol_now(), '%Y');
101 if (dol_print_date(dol_now(), '%m') < $month_start) {
102 $year_start--; // If current month is lower that starting fiscal month, we start last year
103 }
104 $year_end = $year_start + 1;
105 $month_end = $month_start - 1;
106 if ($month_end < 1) {
107 $month_end = 12;
108 $year_end--;
109 }
110 $search_invoice_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
111 $search_invoice_date_end = dol_get_last_day($year_end, $month_end);
112 }
113}
114
115
116/*
117 * View
118 */
119
120$invoicestatic = new Facture($db);
121
122$form = new Form($db);
123$totalMargin = 0;
124$marginRate = '';
125$markRate = '';
126if ($id > 0 || !empty($ref)) {
127 $result = $object->fetch($id, $ref);
128
129 $title = $langs->trans('ProductServiceCard');
130 $help_url = '';
131 $shortlabel = dol_trunc($object->label, 16);
132 if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
133 $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Card');
134 $help_url = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
135 }
136 if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
137 $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Card');
138 $help_url = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
139 }
140
141 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-margin page-tabs_productmargins');
142
143 $param = "&id=".$object->id;
144 if ($limit > 0 && $limit != $conf->liste_limit) {
145 $param .= '&limit='.((int) $limit);
146 }
147 if ($search_invoice_date_start) {
148 $param .= '&search_invoice_date_start_day='.dol_print_date($search_invoice_date_start, '%d').'&search_invoice_date_start_month='.dol_print_date($search_invoice_date_start, '%m').'&search_invoice_date_start_year='.dol_print_date($search_invoice_date_start, '%Y');
149 }
150 if ($search_invoice_date_end) {
151 $param .= '&search_invoice_date_end_day='.dol_print_date($search_invoice_date_end, '%d').'&search_invoice_date_end_month='.dol_print_date($search_invoice_date_end, '%m').'&search_invoice_date_end_year='.dol_print_date($search_invoice_date_end, '%Y');
152 }
153
154 // View mode
155 if ($result > 0) {
156 $head = product_prepare_head($object);
157 $titre = $langs->trans("CardProduct".$object->type);
158 $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
159 print dol_get_fiche_head($head, 'margin', $titre, -1, $picto);
160
161 $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
162
163 dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref');
164
165
166 print '<div class="fichecenter">';
167
168 print '<div class="underbanner clearboth"></div>';
169 print '<table class="border tableforfield centpercent">';
170
171 // Total Margin
172 print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td>';
173 print '<span id="totalMargin" class="amount"></span>'; // set by jquery (see below)
174 print '</td></tr>';
175
176 // Margin Rate
177 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
178 print '<tr><td>'.$langs->trans("MarginRate").'</td><td>';
179 print '<span id="marginRate"></span>'; // set by jquery (see below)
180 print '</td></tr>';
181 }
182
183 // Mark Rate
184 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
185 print '<tr><td>'.$langs->trans("MarkRate").'</td><td>';
186 print '<span id="markRate"></span>'; // set by jquery (see below)
187 print '</td></tr>';
188 }
189
190 print "</table>";
191
192 print '</div>';
193 print '<div class="clearboth"></div>';
194
195 print dol_get_fiche_end();
196
197
198 if ($user->hasRight("facture", "read")) {
199 $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client,";
200 $sql .= " f.rowid as facid, f.ref, f.total_ht,";
201 $sql .= " f.datef, f.paye, f.fk_statut as statut, f.type,";
202 if (!$user->hasRight('societe', 'client', 'voir')) {
203 $sql .= " sc.fk_soc, sc.fk_user,";
204 }
205 $sql .= " sum(d.total_ht) as selling_price,"; // may be negative or positive
206 $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note
207 $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // not always positive in case of Credit note
208 $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // not always positive in case of Credit note
209 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
210 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
211 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
212 if (!$user->hasRight('societe', 'client', 'voir')) {
213 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
214 }
215 $sql .= " WHERE f.fk_soc = s.rowid";
216 $sql .= " AND f.fk_statut > 0";
217 $sql .= " AND f.entity IN (".getEntity('invoice').")";
218 $sql .= " AND d.fk_facture = f.rowid";
219 $sql .= " AND d.fk_product = ".((int) $object->id);
220 if (!$user->hasRight('societe', 'client', 'voir')) {
221 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
222 }
223 if (!empty($socid)) {
224 $sql .= " AND f.fk_soc = ".((int) $socid);
225 }
226 $sql .= " AND d.buy_price_ht IS NOT NULL";
227 // We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report.
228 // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredictable.
229 if (getDolGlobalInt('ForceBuyingPriceIfNull') == 2) {
230 $sql .= " AND d.buy_price_ht <> 0";
231 }
232 if (!empty($search_invoice_date_start)) {
233 $sql .= " AND f.datef >= '".$db->idate($search_invoice_date_start)."'";
234 }
235 if (!empty($search_invoice_date_end)) {
236 $sql .= " AND f.datef <= '".$db->idate($search_invoice_date_end)."'";
237 }
238 $sql .= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.ref, f.total_ht, f.datef, f.paye, f.fk_statut, f.type";
239 if (!$user->hasRight('societe', 'client', 'voir')) {
240 $sql .= ", sc.fk_soc, sc.fk_user";
241 }
242
243 // TODO: calculate total to display then restore pagination
244
245 $sql .= $db->order($sortfield, $sortorder);
246 if ($limit) {
247 $sql .= $db->plimit($limit + 1, $offset);
248 }
249 dol_syslog('margin:tabs:productMargins.php', LOG_DEBUG);
250 $result = $db->query($sql);
251 if ($result) {
252 $num = $db->num_rows($result);
253
254 print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$id.'" name="search_form">'."\n";
255 print '<input type="hidden" name="token" value="'.newToken().'">';
256 if (!empty($sortfield)) {
257 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
258 }
259 if (!empty($sortorder)) {
260 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
261 }
262
263 print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', '');
264
265 $moreforfilter = '';
266
267 $parameters = array();
268 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
269 if (empty($reshook)) {
270 $moreforfilter .= $hookmanager->resPrint;
271 } else {
272 $moreforfilter = $hookmanager->resPrint;
273 }
274
275 if (!empty($moreforfilter)) {
276 print '<div class="liste_titre liste_titre_bydiv centpercent">';
277 print $moreforfilter;
278 print '</div>';
279 }
280
281 $selectedfields = '';
282
283 $i = 0;
284
285 print '<div class="div-table-responsive">';
286 print '<table class="noborder centpercent">';
287
288 // Fields title search
289 // --------------------------------------------------------------------
290 print '<tr class="liste_titre_filter">';
291 // Action column
292 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
293 print '<td class="liste_titre center maxwidthsearch">';
294 $searchpicto = $form->showFilterButtons('left');
295 print $searchpicto;
296 print '</td>';
297 }
298
299 // invoice ref
300 print '<td class="liste_titre">';
301 print '</td>';
302
303 // company name
304 print '<td class="liste_titre">';
305 print '</td>';
306
307 // customer code
308 print '<td class="liste_titre">';
309 print '</td>';
310
311 // invoice date
312 print '<td class="liste_titre center">';
313 print '<div class="nowrapfordate">';
314 print $form->selectDate($search_invoice_date_start ?: -1, 'search_invoice_date_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
315 print '</div>';
316 print '<div class="nowrapfordate">';
317 print $form->selectDate($search_invoice_date_end ?: -1, 'search_invoice_date_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
318 print '</div>';
319 print '</td>';
320
321 // selling price
322 print '<td class="liste_titre">';
323 print '</td>';
324
325 // buying price
326 print '<td class="liste_titre">';
327 print '</td>';
328
329 // qty
330 print '<td class="liste_titre">';
331 print '</td>';
332
333 // margin
334 print '<td class="liste_titre">';
335 print '</td>';
336
337 // margin rate
338 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
339 print '<td class="liste_titre">';
340 print '</td>';
341 }
342
343 // mark rate
344 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
345 print '<td class="liste_titre">';
346 print '</td>';
347 }
348
349 // status
350 print '<td class="liste_titre">';
351 print '</td>';
352
353 // Action column
354 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
355 print '<td class="liste_titre center maxwidthsearch">';
356 $searchpicto = $form->showFilterButtons();
357 print $searchpicto;
358 print '</td>';
359 }
360
361 print '</tr>'."\n";
362
363 print '<tr class="liste_titre">';
364 // Action column
365 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
366 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
367 }
368 print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
369 print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
370 print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder);
371 print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center ');
372 print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right ');
373 print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right ');
374 print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "qty", "", $param, '', $sortfield, $sortorder, 'right ');
375 print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right ');
376 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
377 print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
378 }
379 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
380 print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
381 }
382 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
383 // Action column
384 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
385 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
386 }
387 print "</tr>\n";
388
389 $cumul_achat = 0;
390 $cumul_vente = 0;
391 $cumul_qty = 0;
392
393 if ($num > 0) {
394 $imaxinloop = ($limit ? min($num, $limit) : $num);
395 while ($i < $imaxinloop) {
396 $objp = $db->fetch_object($result);
397
398 $marginRate = ($objp->buying_price != 0) ? (100 * $objp->marge / $objp->buying_price) : '';
399 $markRate = ($objp->selling_price != 0) ? (100 * $objp->marge / $objp->selling_price) : '';
400
401 print '<tr class="oddeven">';
402 // Action column
403 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
404 print '<td class="nowrap center">';
405 print '</td>';
406 }
407
408 print '<td>';
409 $invoicestatic->id = $objp->facid;
410 $invoicestatic->ref = $objp->ref;
411 print $invoicestatic->getNomUrl(1);
412 print "</td>\n";
413 print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($objp->name, 44).'</a></td>';
414 print "<td>".$objp->code_client."</td>\n";
415 print '<td class="center">';
416 print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
417 print '<td class="right amount">'.price(price2num($objp->selling_price, 'MT'))."</td>\n";
418 print '<td class="right amount">'.price(price2num($objp->buying_price, 'MT'))."</td>\n";
419 print '<td class="right">'.price(price2num($objp->qty, 'MT'))."</td>\n";
420 print '<td class="right amount">'.price(price2num($objp->marge, 'MT'))."</td>\n";
421 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
422 print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."</td>\n";
423 }
424 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
425 print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
426 }
427 print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
428
429 // Action column
430 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
431 print '<td class="nowrap center">';
432 print '</td>';
433 }
434 print "</tr>\n";
435 $i++;
436 $cumul_achat += $objp->buying_price;
437 $cumul_vente += $objp->selling_price;
438 $cumul_qty += $objp->qty;
439 }
440 }
441
442 // affichage totaux marges
443
444 $totalMargin = $cumul_vente - $cumul_achat;
445 if ($totalMargin < 0) {
446 $marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : '';
447 $markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : '';
448 } else {
449 $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
450 $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';
451 }
452 print '<tr class="liste_total">';
453 $colspan = 4;
454 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
455 $colspan++; // add action column
456 }
457 print '<td colspan="'.$colspan.'">'.$langs->trans('TotalMargin')."</td>";
458 print '<td class="right amount">'.price(price2num($cumul_vente, 'MT'))."</td>\n";
459 print '<td class="right amount">'.price(price2num($cumul_achat, 'MT'))."</td>\n";
460 print '<td class="right">'.price(price2num($cumul_qty, 'MT'))."</td>\n";
461 print '<td class="right amount">'.price(price2num($totalMargin, 'MT'))."</td>\n";
462 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
463 print '<td class="right">'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."</td>\n";
464 }
465 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
466 print '<td class="right">'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
467 }
468 print '<td class="right">&nbsp;</td>';
469 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
470 // add action column
471 print '<td class="center">';
472 print '</td>';
473 }
474 print "</tr>\n";
475 print "</table>";
476 print '</div>';
477 print '</form>';
478 } else {
479 dol_print_error($db);
480 }
481 $db->free($result);
482 }
483 }
484} else {
486}
487
488print '
489 <script type="text/javascript">
490 $(document).ready(function() {
491 $("#totalMargin").html("'. price(price2num($totalMargin, 'MT'), 1, $langs, 1, -1, -1, $conf->currency).'");
492 $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
493 $("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
494 });
495 </script>
496';
497
498// End of page
499llxFooter();
500$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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.
Definition wrapper.php:70
Class to manage invoices.
Class to manage generation of HTML components Only common components must be here.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
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
llxFooter()
Footer empty.
Definition document.php:107
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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_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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
product_prepare_head($object)
Prepare array with list of tabs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.