dolibarr 24.0.0-beta
quadri_detail.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4 * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2006-2015 Yannick Warnier <ywarnier@beeznest.org>
6 * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
7 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
9 * Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr>
10 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
33// Load Dolibarr environment
34require '../../main.inc.php';
43require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
44require_once DOL_DOCUMENT_ROOT . '/core/lib/tax.lib.php';
45require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
46require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
47require_once DOL_DOCUMENT_ROOT . '/compta/localtax/class/localtax.class.php';
48require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
49require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
50require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
51require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
52require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
53require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
54require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
55
56// Load translation files required by the page
57$langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin"));
58
59$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type'));
60$invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : '';
61$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1;
62
63// Set $date_start_xxx and $date_end_xxx...
64include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php';
76'
77@phan-var-force int $date_start
78@phan-var-force int $date_end
79@phan-var-force int $date_start_month
80@phan-var-force int $date_start_year
81@phan-var-force int $date_start_day
82@phan-var-force int $date_end_month
83@phan-var-force int $date_end_year
84@phan-var-force int $date_end_day
85@phan-var-force int $year_current
86';
87
88$min = price2num(GETPOST("min", "alpha"));
89if (empty($min)) {
90 $min = 0;
91}
92
93// Define modetax (0 or 1)
94// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
95$modetax = getDolGlobalInt('TAX_MODE');
96if (GETPOSTISSET("modetax")) {
97 $modetax = GETPOSTINT("modetax");
98}
99if (empty($modetax)) {
100 $modetax = 0;
101}
102
103$object = new Tva($db);
104
105// Security check
106$socid = GETPOSTINT('socid');
107if ($user->socid) {
108 $socid = $user->socid;
109}
110$result = restrictedArea($user, 'tax', '', 'tva', 'charges');
111
112
113/*
114 * View
115 */
116
117$form = new Form($db);
118$company_static = new Societe($db);
119$invoice_customer = new Facture($db);
120$invoice_supplier = new FactureFournisseur($db);
121$expensereport = new ExpenseReport($db);
122$product_static = new Product($db);
123$payment_static = new Paiement($db);
124$paymentfourn_static = new PaiementFourn($db);
125$paymentexpensereport_static = new PaymentExpenseReport($db);
126
127$morequerystring = '';
128$listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday');
129foreach ($listofparams as $param) {
130 if (GETPOST($param) != '') {
131 $morequerystring .= ($morequerystring ? '&' : '') . $param . '=' . GETPOST($param);
132 }
133}
134
135$title = $langs->trans("VATReport") . " " . dol_print_date($date_start, '', 'tzserver') . " -> " . dol_print_date($date_end, '', 'tzserver');
136llxHeader('', $title, '', '', 0, 0, '', '', $morequerystring);
137
138
139//print load_fiche_titre($langs->trans("VAT"),"");
140
141//$fsearch.='<br>';
142$fsearch = '<!-- hidden fields for form -->';
143$fsearch .= '<input type="hidden" name="token" value="' . newToken() . '">';
144$fsearch .= '<input type="hidden" name="modetax" value="' . $modetax . '">';
145//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
146//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
147
148
149// Show report header
150$name = $langs->trans("VATReportByRates");
151$calcmode = '';
152if ($modetax == 0) {
153 $calcmode = $langs->trans('OptionVATDefault');
154}
155if ($modetax == 1) {
156 $calcmode = $langs->trans('OptionVATDebitOption');
157}
158if ($modetax == 2) {
159 $calcmode = $langs->trans('OptionPaymentForProductAndServices');
160}
161$calcmode .= ' <span class="opacitymedium">(' . $langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT . '/admin/taxes.php') . ')</span>';
162// Set period
163$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
164$period .= ' - ';
165$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
166
167$description = $fsearch;
168$builddate = dol_now();
169
170if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
171 $description .= $langs->trans("RulesVATDueProducts");
172}
173if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') {
174 $description .= $langs->trans("RulesVATInProducts");
175}
176if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
177 $description .= '<br>' . $langs->trans("RulesVATDueServices");
178}
179if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
180 $description .= '<br>' . $langs->trans("RulesVATInServices");
181}
182if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
183 if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice' && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
184 $description .= '<br>' . $langs->trans("DepositsAreNotIncluded");
185 } elseif (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') { // calculate on sale invoice for service only
186 $description .= '<br>' . $langs->trans("DepositsAreNotIncluded").' (for services)';
187 } elseif (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') { // calculate on sale invoice for service only
188 $description .= '<br>' . $langs->trans("DepositsAreNotIncluded").' (for products)';
189 }
190}
191if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
192 if (getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice' && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice') {
193 $description .= '<br>' . $langs->trans("SupplierDepositsAreNotIncluded");
194 } elseif (getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice') { // calculate on supplier invoice for service only
195 $description .= '<br>' . $langs->trans("SupplierDepositsAreNotIncluded").' (for services)';
196 } elseif (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice') { // calculate on supplier invoice for product only
197 $description .= '<br>' . $langs->trans("SupplierDepositsAreNotIncluded").' (for products)';
198 }
199}
200if (isModEnabled('accounting')) {
201 $description .= '<br>' . $langs->trans("ThisIsAnEstimatedValue");
202}
203
204// Customers invoices
205$elementcust = $langs->trans("CustomersInvoices");
206$productcust = $langs->trans("ProductOrService");
207$amountcust = $langs->trans("AmountHT");
208$vatcust = $langs->trans("VATReceived");
209$namecust = $langs->trans("Name");
210if ($mysoc->tva_assuj) {
211 $vatcust .= ' (' . $langs->trans("VATToPay") . ')';
212}
213
214// Suppliers invoices
215$elementsup = $langs->trans("SuppliersInvoices");
216$productsup = $productcust;
217$amountsup = $amountcust;
218$vatsup = $langs->trans("VATPaid");
219$namesup = $namecust;
220if ($mysoc->tva_assuj) {
221 $vatsup .= ' (' . $langs->trans("ToGetBack") . ')';
222}
223
224$optioncss = GETPOST('optioncss', 'alpha');
225$periodlink = '';
226$exportlink = '';
227
228if ($optioncss != "print") {
229 report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
230}
231
232$vatcust = $langs->trans("VATReceived");
233$vatsup = $langs->trans("VATPaid");
234$vatexpensereport = $langs->trans("VATPaid");
235
236print '<div class="right nowrap">';
237
238// built URLs
239$url_params = preg_replace('/&?showall=1/', '', dol_escape_htmltag($_SERVER['QUERY_STRING']));
240$url_collapse = $_SERVER['PHP_SELF'].'?'.$url_params;
241$url_expand = $_SERVER['PHP_SELF'].'?'.$url_params.'&showall=1';
242
243// Link expand all
244print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="'.$url_expand.'">';
245print img_picto($langs->trans("ExpandAll"), 'folder-open', 'class="paddingright"');
246print '<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span>';
247print '</a>';
248
249print ' | ';
250
251// Link undo expand all
252print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="'.$url_collapse.'">';
253print img_picto($langs->trans("UndoExpandAll"), 'folder', 'class="paddingright"');
254print '<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span>';
255print '</a>';
256
257print '</div><br>';
258print '<div class="clearboth"></div>';
259
260// VAT Received and paid
261print '<div class="div-table-responsive">';
262print '<table class="liste noborder centpercent">';
263
264$y = $year_current;
265$i = 0;
266
267$columns = 7;
268$span = $columns;
269if ($modetax != 1) {
270 $span += 2;
271}
272
273// Load arrays of datas
274$x_coll = tax_by_rate('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
275$x_paye = tax_by_rate('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
276
277if (!is_array($x_coll) || !is_array($x_paye)) {
278 $langs->load("errors");
279 if ($x_coll == -1) {
280 print '<tr><td colspan="' . $columns . '">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
281 } elseif ($x_coll == -2) {
282 print '<tr><td colspan="' . $columns . '">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
283 } else {
284 print '<tr><td colspan="' . $columns . '">' . $langs->trans("Error") . '</td></tr>';
285 }
286} else {
287 $x_both = array();
288 //now, from these two arrays, get another array with one rate per line
289 foreach (array_keys($x_coll) as $my_coll_rate) {
290 $x_both[$my_coll_rate] = array(
291 'coll' => array(),
292 'paye' => array(),
293 );
294 $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
295 $x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
296 $x_both[$my_coll_rate]['paye']['totalht'] = 0;
297 $x_both[$my_coll_rate]['paye']['vat'] = 0;
298 $x_both[$my_coll_rate]['coll']['links'] = '';
299 $x_both[$my_coll_rate]['coll']['detail'] = array();
300 foreach ($x_coll[$my_coll_rate]['facid'] as $id => $dummy) {
301 $invoice_customer->id = $x_coll[$my_coll_rate]['facid'][$id];
302 $invoice_customer->ref = $x_coll[$my_coll_rate]['facnum'][$id];
303 $invoice_customer->type = $x_coll[$my_coll_rate]['type'][$id];
304
305 //$company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]);
306 $company_static->id = $x_coll[$my_coll_rate]['company_id'][$id];
307 $company_static->name = $x_coll[$my_coll_rate]['company_name'][$id];
308 $company_static->name_alias = $x_coll[$my_coll_rate]['company_alias'][$id];
309 $company_static->email = $x_coll[$my_coll_rate]['company_email'][$id];
310 $company_static->tva_intra = isset($x_coll[$my_coll_rate]['company_tva_intra'][$id]) ? $x_coll[$my_coll_rate]['company_tva_intra'][$id] : '0';
311 $company_static->client = $x_coll[$my_coll_rate]['company_client'][$id];
312 $company_static->fournisseur = $x_coll[$my_coll_rate]['company_fournisseur'][$id];
313 $company_static->status = $x_coll[$my_coll_rate]['company_status'][$id];
314 $company_static->code_client = $x_coll[$my_coll_rate]['company_customer_code'][$id];
315 $company_static->code_compta_client = $x_coll[$my_coll_rate]['company_customer_accounting_code'][$id];
316 $company_static->code_fournisseur = $x_coll[$my_coll_rate]['company_supplier_code'][$id];
317 $company_static->code_compta_fournisseur = $x_coll[$my_coll_rate]['company_supplier_accounting_code'][$id];
318
319 $x_both[$my_coll_rate]['coll']['detail'][] = array(
320 'id' => $x_coll[$my_coll_rate]['facid'][$id],
321 'descr' => $x_coll[$my_coll_rate]['descr'][$id],
322 'pid' => $x_coll[$my_coll_rate]['pid'][$id],
323 'pref' => $x_coll[$my_coll_rate]['pref'][$id],
324 'ptype' => $x_coll[$my_coll_rate]['ptype'][$id],
325 'payment_id' => $x_coll[$my_coll_rate]['payment_id'][$id],
326 'payment_ref' => $x_coll[$my_coll_rate]['payment_ref'][$id],
327 'payment_amount' => $x_coll[$my_coll_rate]['payment_amount'][$id],
328 'ftotal_ttc' => $x_coll[$my_coll_rate]['ftotal_ttc'][$id],
329 'dtotal_ttc' => $x_coll[$my_coll_rate]['dtotal_ttc'][$id],
330 'dtype' => $x_coll[$my_coll_rate]['dtype'][$id],
331 'datef' => $x_coll[$my_coll_rate]['datef'][$id],
332 'datep' => $x_coll[$my_coll_rate]['datep'][$id],
333
334 'company_link' => $company_static->getNomUrl(1, '', 20),
335
336 'ddate_start' => $x_coll[$my_coll_rate]['ddate_start'][$id],
337 'ddate_end' => $x_coll[$my_coll_rate]['ddate_end'][$id],
338 'totalht' => $x_coll[$my_coll_rate]['totalht_list'][$id],
339 'vat' => $x_coll[$my_coll_rate]['vat_list'][$id],
340 'link' => $invoice_customer->getNomUrl(1, '', 12)
341 );
342 }
343 }
344 // tva paid
345 foreach (array_keys($x_paye) as $my_paye_rate) {
346 $x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht'];
347 $x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat'];
348 if (!isset($x_both[$my_paye_rate]['coll']['totalht'])) {
349 $x_both[$my_paye_rate]['coll']['totalht'] = 0;
350 $x_both[$my_paye_rate]['coll']['vat'] = 0;
351 }
352 $x_both[$my_paye_rate]['paye']['links'] = '';
353 $x_both[$my_paye_rate]['paye']['detail'] = array();
354
355 foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) {
356 // ExpenseReport
357 if ($x_paye[$my_paye_rate]['ptype'][$id] === 'ExpenseReportPayment') {
358 $expensereport->id = $x_paye[$my_paye_rate]['facid'][$id];
359 $expensereport->ref = $x_paye[$my_paye_rate]['facnum'][$id];
360 $expensereport->type = $x_paye[$my_paye_rate]['type'][$id];
361
362 $x_both[$my_paye_rate]['paye']['detail'][] = array(
363 'id' => $x_paye[$my_paye_rate]['facid'][$id],
364 'descr' => $x_paye[$my_paye_rate]['descr'][$id],
365 'pid' => $x_paye[$my_paye_rate]['pid'][$id],
366 'pref' => $x_paye[$my_paye_rate]['pref'][$id],
367 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id],
368 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id],
369 'payment_ref' => $x_paye[$my_paye_rate]['payment_ref'][$id],
370 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id],
371 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
372 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
373 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id],
374 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id],
375 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id],
376 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
377 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id],
378 'link' => $expensereport->getNomUrl(1)
379 );
380 } else {
381 $invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id];
382 $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id];
383 $invoice_supplier->type = $x_paye[$my_paye_rate]['type'][$id];
384
385 $company_static->id = $x_paye[$my_paye_rate]['company_id'][$id];
386 $company_static->name = $x_paye[$my_paye_rate]['company_name'][$id];
387 $company_static->name_alias = $x_paye[$my_paye_rate]['company_alias'][$id];
388 $company_static->email = $x_paye[$my_paye_rate]['company_email'][$id];
389 $company_static->tva_intra = $x_paye[$my_paye_rate]['company_tva_intra'][$id];
390 $company_static->client = $x_paye[$my_paye_rate]['company_client'][$id];
391 $company_static->fournisseur = $x_paye[$my_paye_rate]['company_fournisseur'][$id];
392 $company_static->status = $x_paye[$my_paye_rate]['company_status'][$id];
393 $company_static->code_client = $x_paye[$my_paye_rate]['company_customer_code'][$id];
394 $company_static->code_compta_client = $x_paye[$my_paye_rate]['company_customer_accounting_code'][$id];
395 $company_static->code_fournisseur = $x_paye[$my_paye_rate]['company_supplier_code'][$id];
396 $company_static->code_compta_fournisseur = $x_paye[$my_paye_rate]['company_supplier_accounting_code'][$id];
397
398 $x_both[$my_paye_rate]['paye']['detail'][] = array(
399 'id' => $x_paye[$my_paye_rate]['facid'][$id],
400 'descr' => $x_paye[$my_paye_rate]['descr'][$id],
401 'pid' => $x_paye[$my_paye_rate]['pid'][$id],
402 'pref' => $x_paye[$my_paye_rate]['pref'][$id],
403 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id],
404 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id],
405 'payment_ref' => $x_paye[$my_paye_rate]['payment_ref'][$id],
406 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id],
407 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
408 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
409 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id],
410 'datef' => $x_paye[$my_paye_rate]['datef'][$id],
411 'datep' => $x_paye[$my_paye_rate]['datep'][$id],
412
413 'company_link' => $company_static->getNomUrl(1, '', 20),
414
415 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id],
416 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id],
417 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
418 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id],
419 'link' => $invoice_supplier->getNomUrl(1, '', 12)
420 );
421 }
422 }
423 }
424 //now we have an array (x_both) indexed by rates for coll and paye
425
426
427 //print table headers for this quadri - incomes first
428
429 $x_coll_sum = 0;
430 $x_coll_ht = 0;
431 $x_paye_sum = 0;
432 $x_paye_ht = 0;
433
434 //print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
435
436 // Customers invoices
437 print '<tr class="liste_titre">';
438 print '<td class="left">' . $elementcust . '</td>';
439 print '<td class="left">' . $langs->trans("DateInvoice") . '</td>';
440 if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
441 print '<td class="left">' . $langs->trans("DatePayment") . '</td>';
442 } else {
443 print '<td></td>';
444 }
445 print '<td class="left">' . $namecust . '</td>';
446 print '<td class="left">' . $productcust . '</td>';
447 if ($modetax != 1) {
448 print '<td class="right">' . $amountcust . '</td>';
449 print '<td class="right">' . $langs->trans("Payment") . ' (' . $langs->trans("PercentOfInvoice") . ')</td>';
450 }
451 print '<td class="right">' . $langs->trans("AmountHTVATRealReceived") . '</td>';
452 print '<td class="right">' . $vatcust . '</td>';
453 print '</tr>';
454
455 $action = "tvadetail";
456 $parameters = array();
457 $parameters["mode"] = $modetax;
458 $parameters["start"] = $date_start;
459 $parameters["end"] = $date_end;
460 $parameters["type"] = 'vat';
461
462 $object = array(&$x_coll, &$x_paye, &$x_both);
463 // Initialize a technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
464 $hookmanager->initHooks(array('externalbalance'));
465 $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
466
467 foreach (array_keys($x_coll) as $rate) {
468 $subtot_coll_total_ht = 0;
469 $subtot_coll_vat = 0;
470
471 if (is_array($x_both[$rate]['coll']['detail'])) {
472 // VAT Rate
473 print "<tr>";
474 print '<td class="tax_rate" colspan="' . ($span + 1) . '">';
475 print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
476 print ' - <a class="reposition" href="' . DOL_URL_ROOT . '/compta/tva/quadri_detail.php?invoice_type=customer';
477 if ($invoice_type != 'customer' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
478 print '&amp;vat_rate_show=' . urlencode($rate);
479 }
480 print '&amp;date_startyear=' . ((int) $date_start_year) . '&amp;date_startmonth=' . ((int) $date_start_month) . '&amp;date_startday=' . ((int) $date_start_day) . '&amp;date_endyear=' . ((int) $date_end_year) . '&amp;date_endmonth=' . ((int) $date_end_month) . '&amp;date_endday=' . ((int) $date_end_day) . '">';
481 print img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
482 print '</td>';
483 print '</tr>' . "\n";
484
485 foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
486 // Define type
487 // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
488 $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
489 // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
490 if (!empty($fields['ddate_start'])) {
491 $type = 1;
492 }
493 if (!empty($fields['ddate_end'])) {
494 $type = 1;
495 }
496
497 // Payment
498 $ratiopaymentinvoice = 1;
499 if ($modetax != 1) {
500 if (($type == 0 && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
501 || ($type == 1 && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')) {
502 } else {
503 if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
504 $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
505 }
506 }
507 }
508
509 // Total collected
510 $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
511
512 // VAT
513 $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
514
515 $subtot_coll_total_ht += $temp_ht;
516 $subtot_coll_vat += $temp_vat;
517 $x_coll_sum += $temp_vat;
518 }
519 }
520
521 if (GETPOST('showall', 'int') == 1 || ($invoice_type == 'customer' && $vat_rate_show == $rate)) {
522 if (is_array($x_both[$rate]['coll']['detail'])) {
523 foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
524 /*$company_static->id = $fields['company_id'];
525 $company_static->name = $fields['company_name'];
526 $company_static->name_alias = $fields['company_alias'];
527 $company_static->email = $fields['company_email'];
528 $company_static->tva_intra = $fields['company_tva_intra'];
529 $company_static->client = $fields['company_client'];
530 $company_static->fournisseur = $fields['company_fournisseur'];
531 $company_static->status = $fields['company_status'];
532 $company_static->code_client = $fields['company_client'];
533 $company_static->code_compta_client = $fields['company_customer_code'];
534 $company_static->code_fournisseur = $fields['company_customer_accounting_code'];
535 $company_static->code_compta_fournisseur = $fields['company_supplier_accounting_code'];*/
536
537 // Define type
538 // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
539 $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
540 // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
541 if (!empty($fields['ddate_start'])) {
542 $type = 1;
543 }
544 if (!empty($fields['ddate_end'])) {
545 $type = 1;
546 }
547
548
549 print '<tr class="oddeven">';
550
551 // Ref
552 print '<td class="nowrap left">' . $fields['link'] . '</td>';
553
554 // Invoice date
555 print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
556
557 // Payment date
558 if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
559 print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
560 } else {
561 print '<td></td>';
562 }
563
564 // Company name
565 print '<td class="tdoverflowmax150">';
566 //print $company_static->getNomUrl(1);
567 print $fields['company_link'];
568 print '</td>';
569
570 // Description
571 print '<td class="left">';
572 if ($fields['pid']) {
573 $product_static->id = $fields['pid'];
574 $product_static->ref = $fields['pref'];
575 $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered
576 print $product_static->getNomUrl(1);
577 if (dol_string_nohtmltag($fields['descr'])) {
578 print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
579 }
580 } else {
581 if ($type) {
582 $text = img_object($langs->trans('Service'), 'service');
583 } else {
584 $text = img_object($langs->trans('Product'), 'product');
585 }
586 if (preg_match('/^\‍((.*)\‍)$/', $fields['descr'], $reg)) {
587 if ($reg[1] == 'DEPOSIT') {
588 $fields['descr'] = $langs->transnoentitiesnoconv('Deposit');
589 } elseif ($reg[1] == 'CREDIT_NOTE') {
590 $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote');
591 } else {
592 $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]);
593 }
594 }
595 print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
596
597 // Show range
598 print_date_range($fields['ddate_start'], $fields['ddate_end']);
599 }
600 print '</td>';
601
602 // Total HT
603 if ($modetax != 1) {
604 print '<td class="nowrap right">';
605 print price($fields['totalht']);
606 if (price2num($fields['ftotal_ttc'])) {
607 //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
608 $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']);
609 //print ' ('.round($ratiolineinvoice*100,2).'%)';
610 }
611 print '</td>';
612 }
613
614 // Payment
615 $ratiopaymentinvoice = 1;
616 if ($modetax != 1) {
617 print '<td class="nowrap right">';
618 //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
619 if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
620 $payment_static->id = $fields['payment_id'];
621 $payment_static->ref = $fields['payment_ref'];
622 print $payment_static->getNomUrl(2, '', '', 0) . ' ';
623 }
624 if (($type == 0 && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
625 || ($type == 1 && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')) {
626 print $langs->trans("NA");
627 } else {
628 if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
629 $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
630 }
631 print price(price2num($fields['payment_amount'], 'MT'));
632 if (isset($fields['payment_amount'])) {
633 print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)';
634 }
635 }
636 print '</td>';
637 }
638
639 // Total collected
640 print '<td class="nowrap right">';
641 $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
642 print price(price2num($temp_ht, 'MT'), 1);
643 print '</td>';
644
645 // VAT
646 print '<td class="nowrap right">';
647 $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
648 print price(price2num($temp_vat, 'MT'), 1);
649 //print price($fields['vat']);
650 print '</td>';
651 print '</tr>';
652
653 //$subtot_coll_total_ht += $temp_ht;
654 //$subtot_coll_vat += $temp_vat;
655 //$x_coll_sum += $temp_vat;
656 }
657 }
658 }
659 // Total customers for this vat rate
660 print '<tr class="liste_total">';
661 print '<td colspan="4"></td>';
662 print '<td class="right">' . $langs->trans("Total") . ':</td>';
663 if ($modetax != 1) {
664 print '<td class="nowrap right">&nbsp;</td>';
665 print '<td class="right">&nbsp;</td>';
666 }
667 print '<td class="right"><span class="amount">' . price(price2num($subtot_coll_total_ht, 'MT')) . '</span></td>';
668 print '<td class="nowrap right"><span class="amount">' . price(price2num($subtot_coll_vat, 'MT')) . '</span></td>';
669 print '</tr>';
670 }
671
672 if (count($x_coll) == 0) { // Show a total line if nothing shown
673 print '<tr class="liste_total">';
674 print '<td colspan="4"></td>';
675 print '<td class="right">' . $langs->trans("Total") . ':</td>';
676 if ($modetax != 1) {
677 print '<td class="nowrap right">&nbsp;</td>';
678 print '<td class="right">&nbsp;</td>';
679 }
680 print '<td class="right">' . price(price2num(0, 'MT')) . '</td>';
681 print '<td class="nowrap right">' . price(price2num(0, 'MT')) . '</td>';
682 print '</tr>';
683 }
684
685 // Blank line
686 print '<tr><td colspan="' . ($span + 2) . '">&nbsp;</td></tr>';
687
688 // Print table headers for this quadri - expenses
689 print '<tr class="liste_titre liste_titre_topborder">';
690 print '<td class="left">' . $elementsup . '</td>';
691 print '<td class="left">' . $langs->trans("DateInvoice") . '</td>';
692 if (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'payment') {
693 print '<td class="left">' . $langs->trans("DatePayment") . '</td>';
694 } else {
695 print '<td></td>';
696 }
697 print '<td class="left">' . $namesup . '</td>';
698 print '<td class="left">' . $productsup . '</td>';
699 if ($modetax != 1) {
700 print '<td class="right">' . $amountsup . '</td>';
701 print '<td class="right">' . $langs->trans("Payment") . ' (' . $langs->trans("PercentOfInvoice") . ')</td>';
702 }
703 print '<td class="right">' . $langs->trans("AmountHTVATRealPaid") . '</td>';
704 print '<td class="right">' . $vatsup . '</td>';
705 print '</tr>' . "\n";
706
707 foreach (array_keys($x_paye) as $rate) {
708 $subtot_paye_total_ht = 0;
709 $subtot_paye_vat = 0;
710
711 if (is_array($x_both[$rate]['paye']['detail'])) { // @phpstan-ignore-line
712 print "<tr>";
713 print '<td class="tax_rate" colspan="' . ($span + 1) . '">';
714 print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
715 print ' - <a class="reposition" href="' . DOL_URL_ROOT . '/compta/tva/quadri_detail.php?invoice_type=supplier';
716 if ($invoice_type != 'supplier' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
717 print '&amp;vat_rate_show=' . urlencode($rate);
718 }
719 print '&amp;date_startyear=' . ((int) $date_start_year) . '&amp;date_startmonth=' . ((int) $date_start_month) . '&amp;date_startday=' . ((int) $date_start_day) . '&amp;date_endyear=' . ((int) $date_end_year) . '&amp;date_endmonth=' . ((int) $date_end_month) . '&amp;date_endday=' . ((int) $date_end_day) . '">';
720 print img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
721 print '</td>';
722 print '</tr>' . "\n";
723
724 foreach ($x_both[$rate]['paye']['detail'] as $index => $fields) {
725 // Define type
726 // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
727 $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
728 // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
729 if (!empty($fields['ddate_start'])) {
730 $type = 1;
731 }
732 if (!empty($fields['ddate_end'])) {
733 $type = 1;
734 }
735
736 // Payment
737 $ratiopaymentinvoice = 1;
738 if ($modetax != 1) {
739 if (($type == 0 && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')
740 || ($type == 1 && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
741 } else {
742 if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
743 $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']);
744 }
745 }
746 }
747
748 // VAT paid
749 $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
750
751 // VAT
752 $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
753
754 $subtot_paye_total_ht += $temp_ht;
755 $subtot_paye_vat += $temp_vat;
756 $x_paye_sum += $temp_vat;
757 }
758
759 if (GETPOST('showall', 'int') == 1 || ($invoice_type == 'supplier' && $vat_rate_show == $rate)) {
760 foreach ($x_both[$rate]['paye']['detail'] as $index => $fields) {
761 /*$company_static->id = $fields['company_id'];
762 $company_static->name = $fields['company_name'];
763 $company_static->name_alias = $fields['company_alias'];
764 $company_static->email = $fields['company_email'];
765 $company_static->tva_intra = $fields['company_tva_intra'];
766 $company_static->client = $fields['company_client'];
767 $company_static->fournisseur = $fields['company_fournisseur'];
768 $company_static->status = $fields['company_status'];
769 $company_static->code_client = $fields['company_client'];
770 $company_static->code_compta_client = $fields['company_customer_code'];
771 $company_static->code_fournisseur = $fields['company_customer_accounting_code'];
772 $company_static->code_compta_fournisseur = $fields['company_supplier_accounting_code'];*/
773
774 // Define type
775 // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
776 $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
777 // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
778 if (!empty($fields['ddate_start'])) {
779 $type = 1;
780 }
781 if (!empty($fields['ddate_end'])) {
782 $type = 1;
783 }
784
785 print '<tr class="oddeven">';
786
787 // Ref
788 print '<td class="nowrap left">' . $fields['link'] . '</td>';
789
790 // Invoice date
791 print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
792
793 // Payment date
794 if (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'payment') {
795 print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
796 } else {
797 print '<td></td>';
798 }
799
800 // Company name
801 print '<td class="tdoverflowmax150">';
802 //print $company_static->getNomUrl(1);
803 print $fields['company_link'];
804 print '</td>';
805
806 // Description
807 print '<td class="left">';
808 if ($fields['pid']) {
809 $product_static->id = $fields['pid'];
810 $product_static->ref = $fields['pref'];
811 $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered
812 print $product_static->getNomUrl(1);
813 if (dol_string_nohtmltag($fields['descr'])) {
814 print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
815 }
816 } else {
817 if ($type) {
818 $text = img_object($langs->trans('Service'), 'service');
819 } else {
820 $text = img_object($langs->trans('Product'), 'product');
821 }
822 if (preg_match('/^\‍((.*)\‍)$/', $fields['descr'], $reg)) {
823 if ($reg[1] == 'DEPOSIT') {
824 $fields['descr'] = $langs->transnoentitiesnoconv('Deposit');
825 } elseif ($reg[1] == 'CREDIT_NOTE') {
826 $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote');
827 } else {
828 $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]);
829 }
830 }
831 print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
832
833 // Show range
834 print_date_range($fields['ddate_start'], $fields['ddate_end']);
835 }
836 print '</td>';
837
838 // Total HT
839 if ($modetax != 1) {
840 print '<td class="nowrap right">';
841 print price($fields['totalht']);
842 if (price2num($fields['ftotal_ttc'])) {
843 //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
844 $ratiolineinvoice = ((float) $fields['dtotal_ttc'] / (float) $fields['ftotal_ttc']);
845 //print ' ('.round($ratiolineinvoice*100,2).'%)';
846 }
847 print '</td>';
848 }
849
850 // Payment
851 $ratiopaymentinvoice = 1;
852 if ($modetax != 1) {
853 print '<td class="nowrap right">';
854 if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
855 $paymentfourn_static->id = $fields['payment_id'];
856 $paymentfourn_static->ref = $fields['payment_ref'];
857 print $paymentfourn_static->getNomUrl(2, '', '', 0) . ' ';
858 }
859
860 if (($type == 0 && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')
861 || ($type == 1 && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
862 print $langs->trans("NA");
863 } else {
864 if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
865 $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']);
866 }
867 print price(price2num($fields['payment_amount'], 'MT'));
868 if (isset($fields['payment_amount'])) {
869 print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)';
870 }
871 }
872 print '</td>';
873 }
874
875 // VAT paid
876 print '<td class="nowrap right">';
877 $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
878 print price(price2num($temp_ht, 'MT'), 1);
879 print '</td>';
880
881 // VAT
882 print '<td class="nowrap right">';
883 $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
884 print price(price2num($temp_vat, 'MT'), 1);
885 //print price($fields['vat']);
886 print '</td>';
887 print '</tr>';
888
889 //$subtot_paye_total_ht += $temp_ht;
890 //$subtot_paye_vat += $temp_vat;
891 //$x_paye_sum += $temp_vat;
892 }
893 }
894 }
895
896 // Total suppliers for this vat rate
897 print '<tr class="liste_total">';
898 print '<td colspan="4"></td>';
899 print '<td class="right">' . $langs->trans("Total") . ':</td>';
900 if ($modetax != 1) {
901 print '<td class="nowrap right">&nbsp;</td>';
902 print '<td class="right">&nbsp;</td>';
903 }
904 print '<td class="right"><span class="amount">' . price(price2num($subtot_paye_total_ht, 'MT')) . '</span></td>';
905 print '<td class="nowrap right"><span class="amount">' . price(price2num($subtot_paye_vat, 'MT')) . '</span></td>';
906 print '</tr>';
907 }
908
909 if (count($x_paye) == 0) { // Show a total line if nothing shown
910 print '<tr class="liste_total">';
911 print '<td colspan="4"></td>';
912 print '<td class="right">' . $langs->trans("Total") . ':</td>';
913 if ($modetax != 1) {
914 print '<td class="nowrap right">&nbsp;</td>';
915 print '<td class="right">&nbsp;</td>';
916 }
917 print '<td class="right"><span class="amount">' . price(price2num(0, 'MT')) . '</span></td>';
918 print '<td class="nowrap right"><span class="amount">' . price(price2num(0, 'MT')) . '</span></td>';
919 print '</tr>';
920 }
921
922 print '</table>';
923 print '</div>';
924
925 // Total to pay
926 print '<br><br>';
927 print '<table class="noborder centpercent">';
928 $diff = $x_coll_sum - $x_paye_sum;
929 print '<tr class="liste_total">';
930 print '<td class="liste_total" colspan="' . $span . '">' . $langs->trans("TotalToPay") . '</td>';
931 print '<td class="liste_total nowrap right"><b>' . price(price2num($diff, 'MT')) . "</b></td>\n";
932 print "</tr>\n";
933
934 $i++;
935}
936print '</table>';
937
938llxFooter();
939$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage generation of HTML components Only common components must be here.
Class to manage payments for supplier invoices.
Class to manage payments of customer invoices.
Class to manage payments of expense report.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage VAT - Value-added tax (also known in French as TVA)
Definition tva.class.php:39
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
Gets Tax to collect for the given year (and given quarter or month) The function gets the Tax in spli...
Definition tax.lib.php:669