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