dolibarr 21.0.0-beta
thirdpartyMargins.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/company.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// Security check
42$socid = GETPOSTINT('socid');
43if (!empty($user->socid)) {
44 $socid = $user->socid;
45}
46
47$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
48$sortfield = GETPOST('sortfield', 'aZ09comma');
49$sortorder = GETPOST('sortorder', 'aZ09comma');
50$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
51if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
52 // If $page is not defined, or '' or -1 or if we click on clear filters
53 $page = 0;
54}
55$offset = $limit * $page;
56$pageprev = $page - 1;
57$pagenext = $page + 1;
58if (!$sortorder) {
59 $sortorder = "DESC";
60}
61if (!$sortfield) {
62 $sortfield = "f.datef";
63}
64
65$object = new Societe($db);
66if ($socid > 0) {
67 $object->fetch($socid);
68}
69
70// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
71$hookmanager->initHooks(array('thirdpartymargins', 'globalcard'));
72
73$result = restrictedArea($user, 'societe', $object->id, '');
74
75if (!$user->hasRight('margins', 'liretous')) {
77}
78
79
80/*
81 * Actions
82 */
83
84$parameters = array('id' => $socid);
85$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
86if ($reshook < 0) {
87 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
88}
89
90$search_invoice_date_start = '';
91$search_invoice_date_end = '';
92if (GETPOSTINT('search_invoice_date_start_month')) {
93 $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'));
94}
95if (GETPOSTINT('search_invoice_date_end_month')) {
96 $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'));
97}
98
99// Purge search criteria
100if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
101 $search_invoice_date_start = '';
102 $search_invoice_date_end = '';
103}
104
105// set default dates from fiscal year
106if (empty($search_invoice_date_start) && empty($search_invoice_date_end) && !GETPOSTISSET('restore_lastsearch_values')) {
107 $query = "SELECT date_start, date_end";
108 $query .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
109 $query .= " WHERE date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
110 $res = $db->query($query);
111
112 if ($res && $db->num_rows($res) > 0) {
113 $fiscalYear = $db->fetch_object($res);
114 $search_invoice_date_start = strtotime($fiscalYear->date_start);
115 $search_invoice_date_end = strtotime($fiscalYear->date_end);
116 } else {
117 $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
118 $year_start = (int) dol_print_date(dol_now(), '%Y');
119 if (dol_print_date(dol_now(), '%m') < $month_start) {
120 $year_start--; // If current month is lower that starting fiscal month, we start last year
121 }
122 $year_end = $year_start + 1;
123 $month_end = $month_start - 1;
124 if ($month_end < 1) {
125 $month_end = 12;
126 $year_end--;
127 }
128 $search_invoice_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
129 $search_invoice_date_end = dol_get_last_day($year_end, $month_end);
130 }
131}
132
133/*
134 * View
135 */
136
137$invoicestatic = new Facture($db);
138$form = new Form($db);
139
140$title = $langs->trans("ThirdParty").' - '.$langs->trans("Margins");
141if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
142 $title = $object->name.' - '.$langs->trans("Files");
143}
144$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
145llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-margin page-tabs_thirdpartymargins');
146
147$param = "&socid=".$socid;
148if ($limit > 0 && $limit != $conf->liste_limit) {
149 $param .= '&limit='.((int) $limit);
150}
151if ($search_invoice_date_start) {
152 $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');
153}
154if ($search_invoice_date_end) {
155 $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');
156}
157
158$totalMargin = 0;
159$marginRate = '';
160$markRate = '';
161
162if ($socid > 0) {
163 $object = new Societe($db);
164 $object->fetch($socid);
165
166 // Show tabs
167
168 $head = societe_prepare_head($object);
169
170 print dol_get_fiche_head($head, 'margin', $langs->trans("ThirdParty"), -1, 'company');
171
172 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
173
174 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
175
176 print '<div class="fichecenter">';
177
178 print '<div class="underbanner clearboth"></div>';
179 print '<table class="border tableforfield centpercent">';
180
181 // Type Prospect/Customer/Supplier
182 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
183 print $object->getTypeUrl(1);
184 print '</td></tr>';
185
186 if ($object->client) {
187 print '<tr><td class="titlefield">';
188 print $langs->trans('CustomerCode').'</td><td colspan="3">';
190 $tmpcheck = $object->check_codeclient();
191 if ($tmpcheck != 0 && $tmpcheck != -5) {
192 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
193 }
194 print '</td></tr>';
195 }
196
197 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) {
198 print '<tr><td class="titlefield">';
199 print $langs->trans('SupplierCode').'</td><td colspan="3">';
201 $tmpcheck = $object->check_codefournisseur();
202 if ($tmpcheck != 0 && $tmpcheck != -5) {
203 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
204 }
205 print '</td></tr>';
206 }
207
208 // Total Margin
209 print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
210 print '<span id="totalMargin" class="amount"></span>'; // set by jquery (see below)
211 print '</td></tr>';
212
213 // Margin Rate
214 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
215 print '<tr><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
216 print '<span id="marginRate"></span>'; // set by jquery (see below)
217 print '</td></tr>';
218 }
219
220 // Mark Rate
221 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
222 print '<tr><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
223 print '<span id="markRate"></span>'; // set by jquery (see below)
224 print '</td></tr>';
225 }
226
227 print "</table>";
228
229 print '</div>';
230 print '<div class="clearboth"></div>';
231
232 print dol_get_fiche_end();
233
234 print '<br>';
235
236 $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
237 $sql .= " f.rowid as facid, f.ref, f.total_ht,";
238 $sql .= " f.datef, f.paye, f.fk_statut as statut, f.type,";
239 $sql .= " sum(d.total_ht) as selling_price,"; // may be negative or positive
240 $sql .= " sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // always positive
241 $sql .= " sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // always positive
242 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
243 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
244 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
245 $sql .= " WHERE f.fk_soc = s.rowid";
246 $sql .= " AND f.fk_statut > 0";
247 $sql .= " AND f.entity IN (".getEntity('invoice').")";
248 $sql .= " AND d.fk_facture = f.rowid";
249 $sql .= " AND f.fk_soc = $socid";
250 $sql .= " AND d.buy_price_ht IS NOT NULL";
251 // 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.
252 // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredictable.
253 if (getDolGlobalInt('ForceBuyingPriceIfNull') == 2) {
254 $sql .= " AND d.buy_price_ht <> 0";
255 }
256 if (!empty($search_invoice_date_start)) {
257 $sql .= " AND f.datef >= '".$db->idate($search_invoice_date_start)."'";
258 }
259 if (!empty($search_invoice_date_end)) {
260 $sql .= " AND f.datef <= '".$db->idate($search_invoice_date_end)."'";
261 }
262 $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";
263
264 // TODO: calculate total to display then restore pagination
265
266 $sql .= $db->order($sortfield, $sortorder);
267 if ($limit) {
268 $sql .= $db->plimit($limit + 1, $offset);
269 }
270
271 dol_syslog('margin:tabs:thirdpartyMargins.php', LOG_DEBUG);
272 $result = $db->query($sql);
273 if ($result) {
274 $num = $db->num_rows($result);
275
276 print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?socid='.$socid.'" name="search_form">'."\n";
277 print '<input type="hidden" name="token" value="'.newToken().'">';
278 if (!empty($sortfield)) {
279 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
280 }
281 if (!empty($sortorder)) {
282 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
283 }
284
285 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition, PhanPluginSuspiciousParamOrder
286 print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', '');
287
288 $moreforfilter = '';
289
290 $parameters = array();
291 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
292 if (empty($reshook)) {
293 $moreforfilter .= $hookmanager->resPrint;
294 } else {
295 $moreforfilter = $hookmanager->resPrint;
296 }
297
298 if (!empty($moreforfilter)) {
299 print '<div class="liste_titre liste_titre_bydiv centpercent">';
300 print $moreforfilter;
301 print '</div>';
302 }
303
304 $selectedfields = '';
305
306 $i = 0;
307 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
308 print '<table class="noborder centpercent">';
309
310 // Fields title search
311 // --------------------------------------------------------------------
312 print '<tr class="liste_titre liste_titre_filter">';
313 // Action column
314 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
315 print '<th class="liste_titre center maxwidthsearch">';
316 $searchpicto = $form->showFilterButtons('left');
317 print $searchpicto;
318 print '</th>';
319 }
320
321 // invoice ref
322 print '<th class="liste_titre">';
323 print '</th>';
324
325 // invoice date
326 print '<th class="liste_titre center">';
327 print '<div class="nowrapfordate">';
328 print $form->selectDate($search_invoice_date_start ?: -1, 'search_invoice_date_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
329 print '</div>';
330 print '<div class="nowrapfordate">';
331 print $form->selectDate($search_invoice_date_end ?: -1, 'search_invoice_date_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
332 print '</div>';
333 print '</th>';
334
335 // selling price
336 print '<th class="liste_titre">';
337 print '</th>';
338
339 // buying price
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("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center ');
380 print_liste_field_titre("SoldAmount", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right ');
381 print_liste_field_titre("PurchasedAmount", $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right ');
382 print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right ');
383 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
384 print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
385 }
386 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
387 print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
388 }
389 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
390 // Action column
391 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
392 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
393 }
394 print "</tr>\n";
395
396 $cumul_achat = 0;
397 $cumul_vente = 0;
398
399 if ($num > 0) {
400 $imaxinloop = ($limit ? min($num, $limit) : $num);
401 while ($i < $imaxinloop) {
402 $objp = $db->fetch_object($result);
403
404 $marginRate = ($objp->buying_price != 0) ? (100 * $objp->marge / $objp->buying_price) : '';
405 $markRate = ($objp->selling_price != 0) ? (100 * $objp->marge / $objp->selling_price) : '';
406
407 $sign = '';
408 if ($objp->type == Facture::TYPE_CREDIT_NOTE) {
409 $sign = '-';
410 }
411
412 print '<tr class="oddeven">';
413 // Action column
414 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
415 print '<td class="nowrap center">';
416 print '</td>';
417 }
418
419 print '<td>';
420 $invoicestatic->id = $objp->facid;
421 $invoicestatic->ref = $objp->ref;
422 print $invoicestatic->getNomUrl(1);
423 print "</td>\n";
424 print "<td class=\"center\">";
425 print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
426 print "<td class=\"right amount\">".price(price2num($objp->selling_price, 'MT'))."</td>\n";
427 print "<td class=\"right amount\">".price(price2num(($objp->type == 2 ? -1 : 1) * $objp->buying_price, 'MT'))."</td>\n";
428 print "<td class=\"right amount\">".$sign.price(price2num($objp->marge, 'MT'))."</td>\n";
429 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
430 print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : $sign.price(price2num($marginRate, 'MT'))."%")."</td>\n";
431 }
432 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
433 print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
434 }
435 print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
436
437 // Action column
438 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
439 print '<td class="nowrap center">';
440 print '</td>';
441 }
442 print "</tr>\n";
443 $i++;
444 $cumul_vente += $objp->selling_price;
445 $cumul_achat += ($objp->type == 2 ? -1 : 1) * $objp->buying_price;
446 }
447 }
448
449 // affichage totaux marges
450
451 $totalMargin = $cumul_vente - $cumul_achat;
452 if ($totalMargin < 0) {
453 $marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : '';
454 $markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : '';
455 } else {
456 $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
457 $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';
458 }
459
460 // Total
461 print '<tr class="liste_total">';
462 $colspan = 2;
463 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
464 $colspan++; // add action column
465 }
466 print '<td colspan="'.$colspan.'">'.$langs->trans('TotalMargin')."</td>";
467 print "<td class=\"right\">".price(price2num($cumul_vente, 'MT'))."</td>\n";
468 print "<td class=\"right\">".price(price2num($cumul_achat, 'MT'))."</td>\n";
469 print "<td class=\"right\">".price(price2num($totalMargin, 'MT'))."</td>\n";
470 if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
471 print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."</td>\n";
472 }
473 if (getDolGlobalString('DISPLAY_MARK_RATES')) {
474 print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
475 }
476 print '<td class="right">&nbsp;</td>';
477 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
478 // add action column
479 print '<td class="center">';
480 print '</td>';
481 }
482 print "</tr>\n";
483 } else {
484 dol_print_error($db);
485 }
486 print "</table>";
487 print '</div>';
488 print '</form>';
489
490 print '<br>';
491 $db->free($result);
492} else {
493 dol_print_error(null, 'Parameter socid not defined');
494}
495
496
497print '
498 <script type="text/javascript">
499 $(document).ready(function() {
500 $("#totalMargin").html("'. price(price2num($totalMargin, 'MT')).'");
501 $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
502 $("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
503 });
504 </script>
505';
506
507// End of page
508llxFooter();
509$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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.
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:619
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.
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.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.