dolibarr 21.0.0-alpha
thirdpartyMargins.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/company.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// Security check
33$socid = GETPOSTINT('socid');
34if (!empty($user->socid)) {
35 $socid = $user->socid;
36}
37
38$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
39$sortfield = GETPOST('sortfield', 'aZ09comma');
40$sortorder = GETPOST('sortorder', 'aZ09comma');
41$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
42if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
43 // If $page is not defined, or '' or -1 or if we click on clear filters
44 $page = 0;
45}
46$offset = $limit * $page;
47$pageprev = $page - 1;
48$pagenext = $page + 1;
49if (!$sortorder) {
50 $sortorder = "DESC";
51}
52if (!$sortfield) {
53 $sortfield = "f.datef";
54}
55
56$object = new Societe($db);
57if ($socid > 0) {
58 $object->fetch($socid);
59}
60
61// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
62$hookmanager->initHooks(array('thirdpartymargins', 'globalcard'));
63
64$result = restrictedArea($user, 'societe', $object->id, '');
65
66if (!$user->hasRight('margins', 'liretous')) {
68}
69
70
71/*
72 * Actions
73 */
74
75$parameters = array('id' => $socid);
76$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
77if ($reshook < 0) {
78 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
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 * View
126 */
127
128$invoicestatic = new Facture($db);
129$form = new Form($db);
130
131$title = $langs->trans("ThirdParty").' - '.$langs->trans("Margins");
132if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
133 $title = $object->name.' - '.$langs->trans("Files");
134}
135$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
136llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-margin page-tabs_thirdpartymargins');
137
138$param = "&socid=".$socid;
139if ($limit > 0 && $limit != $conf->liste_limit) {
140 $param .= '&limit='.((int) $limit);
141}
142if ($search_invoice_date_start) {
143 $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');
144}
145if ($search_invoice_date_end) {
146 $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');
147}
148
149$totalMargin = 0;
150$marginRate = '';
151$markRate = '';
152
153if ($socid > 0) {
154 $object = new Societe($db);
155 $object->fetch($socid);
156
157 /*
158 * Affichage onglets
159 */
160
161 $head = societe_prepare_head($object);
162
163 print dol_get_fiche_head($head, 'margin', $langs->trans("ThirdParty"), -1, 'company');
164
165 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
166
167 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
168
169 print '<div class="fichecenter">';
170
171 print '<div class="underbanner clearboth"></div>';
172 print '<table class="border tableforfield" width="100%">';
173
174 // Type Prospect/Customer/Supplier
175 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
176 print $object->getTypeUrl(1);
177 print '</td></tr>';
178
179 if ($object->client) {
180 print '<tr><td class="titlefield">';
181 print $langs->trans('CustomerCode').'</td><td colspan="3">';
183 $tmpcheck = $object->check_codeclient();
184 if ($tmpcheck != 0 && $tmpcheck != -5) {
185 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
186 }
187 print '</td></tr>';
188 }
189
190 if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) {
191 print '<tr><td class="titlefield">';
192 print $langs->trans('SupplierCode').'</td><td colspan="3">';
194 $tmpcheck = $object->check_codefournisseur();
195 if ($tmpcheck != 0 && $tmpcheck != -5) {
196 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
197 }
198 print '</td></tr>';
199 }
200
201 // Total Margin
202 print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
203 print '<span id="totalMargin" class="amount"></span>'; // set by jquery (see below)
204 print '</td></tr>';
205
206 // Margin Rate
207 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
208 print '<tr><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
209 print '<span id="marginRate"></span>'; // set by jquery (see below)
210 print '</td></tr>';
211 }
212
213 // Mark Rate
214 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
215 print '<tr><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
216 print '<span id="markRate"></span>'; // set by jquery (see below)
217 print '</td></tr>';
218 }
219
220 print "</table>";
221
222 print '</div>';
223 print '<div class="clearboth"></div>';
224
225 print dol_get_fiche_end();
226
227 print '<br>';
228
229 $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
230 $sql .= " f.rowid as facid, f.ref, f.total_ht,";
231 $sql .= " f.datef, f.paye, f.fk_statut as statut, f.type,";
232 $sql .= " sum(d.total_ht) as selling_price,"; // may be negative or positive
233 $sql .= " sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // always positive
234 $sql .= " sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // always positive
235 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
236 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
237 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
238 $sql .= " WHERE f.fk_soc = s.rowid";
239 $sql .= " AND f.fk_statut > 0";
240 $sql .= " AND f.entity IN (".getEntity('invoice').")";
241 $sql .= " AND d.fk_facture = f.rowid";
242 $sql .= " AND f.fk_soc = $socid";
243 $sql .= " AND d.buy_price_ht IS NOT NULL";
244 // 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.
245 // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredictable.
246 if (getDolGlobalInt('ForceBuyingPriceIfNull') == 2) {
247 $sql .= " AND d.buy_price_ht <> 0";
248 }
249 if (!empty($search_invoice_date_start)) {
250 $sql .= " AND f.datef >= '".$db->idate($search_invoice_date_start)."'";
251 }
252 if (!empty($search_invoice_date_end)) {
253 $sql .= " AND f.datef <= '".$db->idate($search_invoice_date_end)."'";
254 }
255 $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";
256
257 // TODO: calculate total to display then restore pagination
258
259 $sql .= $db->order($sortfield, $sortorder);
260 if ($limit) {
261 $sql .= $db->plimit($limit + 1, $offset);
262 }
263
264 dol_syslog('margin:tabs:thirdpartyMargins.php', LOG_DEBUG);
265 $result = $db->query($sql);
266 if ($result) {
267 $num = $db->num_rows($result);
268
269 print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?socid='.$socid.'" name="search_form">'."\n";
270 print '<input type="hidden" name="token" value="'.newToken().'">';
271 if (!empty($sortfield)) {
272 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
273 }
274 if (!empty($sortorder)) {
275 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
276 }
277
278 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition, PhanPluginSuspiciousParamOrder
279 print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', '');
280
281 $moreforfilter = '';
282
283 $parameters = array();
284 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
285 if (empty($reshook)) {
286 $moreforfilter .= $hookmanager->resPrint;
287 } else {
288 $moreforfilter = $hookmanager->resPrint;
289 }
290
291 if (!empty($moreforfilter)) {
292 print '<div class="liste_titre liste_titre_bydiv centpercent">';
293 print $moreforfilter;
294 print '</div>';
295 }
296
297 $selectedfields = '';
298
299 $i = 0;
300 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
301 print "<table class=\"noborder\" width=\"100%\">";
302
303 // Fields title search
304 // --------------------------------------------------------------------
305 print '<tr class="liste_titre_filter">';
306 // Action column
307 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
308 print '<td class="liste_titre center maxwidthsearch">';
309 $searchpicto = $form->showFilterButtons('left');
310 print $searchpicto;
311 print '</td>';
312 }
313
314 // invoice ref
315 print '<td class="liste_titre">';
316 print '</td>';
317
318 // invoice date
319 print '<td class="liste_titre center">';
320 print '<div class="nowrapfordate">';
321 print $form->selectDate($search_invoice_date_start ?: -1, 'search_invoice_date_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
322 print '</div>';
323 print '<div class="nowrapfordate">';
324 print $form->selectDate($search_invoice_date_end ?: -1, 'search_invoice_date_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
325 print '</div>';
326 print '</td>';
327
328 // selling price
329 print '<td class="liste_titre">';
330 print '</td>';
331
332 // buying price
333 print '<td class="liste_titre">';
334 print '</td>';
335
336 // margin
337 print '<td class="liste_titre">';
338 print '</td>';
339
340 // margin rate
341 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
342 print '<td class="liste_titre">';
343 print '</td>';
344 }
345
346 // mark rate
347 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
348 print '<td class="liste_titre">';
349 print '</td>';
350 }
351
352 // status
353 print '<td class="liste_titre">';
354 print '</td>';
355
356 // Action column
357 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
358 print '<td class="liste_titre center maxwidthsearch">';
359 $searchpicto = $form->showFilterButtons();
360 print $searchpicto;
361 print '</td>';
362 }
363
364 print '</tr>'."\n";
365
366 print '<tr class="liste_titre">';
367 // Action column
368 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
369 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
370 }
371 print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
372 print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center ');
373 print_liste_field_titre("SoldAmount", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right ');
374 print_liste_field_titre("PurchasedAmount", $_SERVER["PHP_SELF"], "buying_price", "", $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
392 if ($num > 0) {
393 $imaxinloop = ($limit ? min($num, $limit) : $num);
394 while ($i < $imaxinloop) {
395 $objp = $db->fetch_object($result);
396
397 $marginRate = ($objp->buying_price != 0) ? (100 * $objp->marge / $objp->buying_price) : '';
398 $markRate = ($objp->selling_price != 0) ? (100 * $objp->marge / $objp->selling_price) : '';
399
400 $sign = '';
401 if ($objp->type == Facture::TYPE_CREDIT_NOTE) {
402 $sign = '-';
403 }
404
405 print '<tr class="oddeven">';
406 // Action column
407 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
408 print '<td class="nowrap center">';
409 print '</td>';
410 }
411
412 print '<td>';
413 $invoicestatic->id = $objp->facid;
414 $invoicestatic->ref = $objp->ref;
415 print $invoicestatic->getNomUrl(1);
416 print "</td>\n";
417 print "<td class=\"center\">";
418 print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
419 print "<td class=\"right amount\">".price(price2num($objp->selling_price, 'MT'))."</td>\n";
420 print "<td class=\"right amount\">".price(price2num(($objp->type == 2 ? -1 : 1) * $objp->buying_price, 'MT'))."</td>\n";
421 print "<td class=\"right amount\">".$sign.price(price2num($objp->marge, 'MT'))."</td>\n";
422 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
423 print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : $sign.price(price2num($marginRate, 'MT'))."%")."</td>\n";
424 }
425 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
426 print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
427 }
428 print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
429
430 // Action column
431 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
432 print '<td class="nowrap center">';
433 print '</td>';
434 }
435 print "</tr>\n";
436 $i++;
437 $cumul_vente += $objp->selling_price;
438 $cumul_achat += ($objp->type == 2 ? -1 : 1) * $objp->buying_price;
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
453 // Total
454 print '<tr class="liste_total">';
455 $colspan = 2;
456 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
457 $colspan++; // add action column
458 }
459 print '<td colspan="'.$colspan.'">'.$langs->trans('TotalMargin')."</td>";
460 print "<td class=\"right\">".price(price2num($cumul_vente, 'MT'))."</td>\n";
461 print "<td class=\"right\">".price(price2num($cumul_achat, 'MT'))."</td>\n";
462 print "<td class=\"right\">".price(price2num($totalMargin, 'MT'))."</td>\n";
463 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
464 print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."</td>\n";
465 }
466 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
467 print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
468 }
469 print '<td class="right">&nbsp;</td>';
470 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
471 // add action column
472 print '<td class="center">';
473 print '</td>';
474 }
475 print "</tr>\n";
476 } else {
477 dol_print_error($db);
478 }
479 print "</table>";
480 print '</div>';
481 print '</form>';
482
483 print '<br>';
484 $db->free($result);
485} else {
486 dol_print_error(null, 'Parameter socid not defined');
487}
488
489
490print '
491 <script type="text/javascript">
492 $(document).ready(function() {
493 $("#totalMargin").html("'. price(price2num($totalMargin, 'MT')).'");
494 $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
495 $("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
496 });
497 </script>
498';
499
500// End of page
501llxFooter();
502$db->close();
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.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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...
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.
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...
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.