dolibarr 25.0.0-alpha
byratecountry.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
5 * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27// Load Dolibarr environment
28require '../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
41require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
42require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
43require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
44require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
45require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
46require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
47require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
48require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
49
50// Load translation files required by the page
51$langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin", "accountancy"));
52
53$modecompta = (GETPOST('modecompta', 'alpha') ? GETPOST('modecompta', 'alpha') : getDolGlobalString('ACCOUNTING_MODE'));
54
55// Date range
56$year = GETPOSTINT("year");
57$month = GETPOSTINT("month");
58if (empty($year)) {
59 $year_current = dol_print_date(dol_now(), '%Y');
60 $month_current = dol_print_date(dol_now(), '%m');
61 $year_start = $year_current;
62} else {
63 $year_current = $year;
64 $month_current = dol_print_date(dol_now(), '%m');
65 $year_start = $year;
66}
67$date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere
68$date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere
69
70// Quarter
71$q = '';
72if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
73 $q = GETPOSTINT("q");
74 if (empty($q)) {
75 // We define date_start and date_end
76 $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
77 $year_end = $year_start;
78 $month_end = $month_start;
79 if (!GETPOST("month")) { // If month not forced
80 if (!GETPOST('year') && $month_start > $month_current) {
81 $year_start--;
82 $year_end--;
83 }
84 $month_end = $month_start - 1;
85 if ($month_end < 1) {
86 $month_end = 12;
87 } else {
88 $year_end++;
89 }
90 }
91 $date_start = dol_get_first_day($year_start, $month_start, false);
92 $date_end = dol_get_last_day($year_end, $month_end, false);
93 } else {
94 if ($q == 1) {
95 $date_start = dol_get_first_day($year_start, 1, false);
96 $date_end = dol_get_last_day($year_start, 3, false);
97 }
98 if ($q == 2) {
99 $date_start = dol_get_first_day($year_start, 4, false);
100 $date_end = dol_get_last_day($year_start, 6, false);
101 }
102 if ($q == 3) {
103 $date_start = dol_get_first_day($year_start, 7, false);
104 $date_end = dol_get_last_day($year_start, 9, false);
105 }
106 if ($q == 4) {
107 $date_start = dol_get_first_day($year_start, 10, false);
108 $date_end = dol_get_last_day($year_start, 12, false);
109 }
110 }
111}
112
113// $date_start and $date_end are defined. We force $year_start and $nbofyear
114$tmps = dol_getdate($date_start);
115$year_start = $tmps['year'];
116$tmpe = dol_getdate($date_end);
117$year_end = $tmpe['year'];
118
119$tmp_date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
120if ($tmp_date_end < $date_end || $date_end < $date_start) {
121 $date_end = $tmp_date_end;
122}
123
124$min = price2num(GETPOST("min", "alpha"));
125if (empty($min)) {
126 $min = 0;
127}
128
129// Define modetax (0 or 1)
130// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
131$modetax = !getDolGlobalString('TAX_MODE') ? 0 : $conf->global->TAX_MODE;
132if (GETPOSTISSET("modetax")) {
133 $modetax = GETPOSTINT("modetax");
134}
135if (empty($modetax)) {
136 $modetax = 0;
137}
138
139// Security check
140$socid = GETPOSTINT('socid');
141if ($user->socid) {
142 $socid = $user->socid;
143}
144$result = restrictedArea($user, 'tax', '', '', 'charges');
145
146
147
148/*
149 * View
150 */
151
152$form = new Form($db);
153$company_static = new Societe($db);
154$invoice_customer = new Facture($db);
155$invoice_supplier = new FactureFournisseur($db);
156$expensereport = new ExpenseReport($db);
157$product_static = new Product($db);
158$payment_static = new Paiement($db);
159$paymentfourn_static = new PaiementFourn($db);
160$paymentexpensereport_static = new PaymentExpenseReport($db);
161
162$morequerystring = '';
163$listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday');
164foreach ($listofparams as $param) {
165 if (GETPOST($param) != '') {
166 $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param);
167 }
168}
169
170llxHeader('', $langs->trans("TurnoverReport"), '', '', 0, 0, '', '', $morequerystring);
171
172$exportlink = "";
173$namelink = "";
174//print load_fiche_titre($langs->trans("VAT"),"");
175
176//$fsearch.='<br>';
177$fsearch = '';
178$fsearch .= ' <input type="hidden" name="year" value="'.$year.'">';
179$fsearch .= ' <input type="hidden" name="modetax" value="'.$modetax.'">';
180//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
181//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
182
183
184// Show report header
185$name = $langs->trans("xxx");
186$calcmode = '';
187if ($modetax == 0) {
188 $calcmode = $langs->trans('OptionVATDefault');
189}
190if ($modetax == 1) {
191 $calcmode = $langs->trans('OptionVATDebitOption');
192}
193if ($modetax == 2) {
194 $calcmode = $langs->trans('OptionPaymentForProductAndServices');
195}
196$calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')';
197// Set period
198$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
199$period .= ' - ';
200$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
201$prevyear = $year_start;
202$prevquarter = $q;
203if ($prevquarter > 1) {
204 $prevquarter--;
205} else {
206 $prevquarter = 4;
207 $prevyear--;
208}
209$nextyear = $year_start;
210$nextquarter = $q;
211if ($nextquarter < 4) {
212 $nextquarter++;
213} else {
214 $nextquarter = 1;
215 $nextyear++;
216}
217$description = $fsearch;
218$builddate = dol_now();
219
220if (isModEnabled('comptabilite')) {
221 $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
222}
223if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
224 $description .= '<br>'.$langs->trans("RulesVATDueProducts");
225}
226if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') {
227 $description .= '<br>'.$langs->trans("RulesVATInProducts");
228}
229if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
230 $description .= '<br>'.$langs->trans("RulesVATDueServices");
231}
232if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
233 $description .= '<br>'.$langs->trans("RulesVATInServices");
234}
235if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
236 $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
237}
238if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
239 $description .= $langs->trans("SupplierDepositsAreNotIncluded");
240}
241// Customers invoices
242$elementcust = $langs->trans("CustomersInvoices");
243$productcust = $langs->trans("ProductOrService");
244$amountcust = $langs->trans("AmountHT");
245
246// Suppliers invoices
247$elementsup = $langs->trans("SuppliersInvoices");
248$productsup = $productcust;
249$amountsup = $amountcust;
250
251// TODO Report from bookkeeping not yet available, so we switch on report on business events
252if ($modecompta == "BOOKKEEPING") {
253 $modecompta = "CREANCES-DETTES";
254}
255if ($modecompta == "BOOKKEEPINGCOLLECTED") {
256 $modecompta = "RECETTES-DEPENSES";
257}
258
259// Show report header
260if ($modecompta == "CREANCES-DETTES") {
261 $name = $langs->trans("Turnover").', '.$langs->trans("ByVatRate");
262 $calcmode = $langs->trans("CalcModeDebt");
263 //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
264
265 $description .= '<br>'.$langs->trans("RulesCADue");
266 if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
267 $description .= $langs->trans("DepositsAreNotIncluded");
268 } else {
269 $description .= $langs->trans("DepositsAreIncluded");
270 }
271 if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
272 $description .= $langs->trans("SupplierDepositsAreNotIncluded");
273 }
274
275 $builddate = dol_now();
276} elseif ($modecompta == "RECETTES-DEPENSES") {
277 $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate");
278 $calcmode = $langs->trans("CalcModePayment");
279 //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
280
281 $description .= $langs->trans("RulesCAIn");
282 $description .= $langs->trans("DepositsAreIncluded");
283
284 $builddate = dol_now();
285} //elseif ($modecompta == "BOOKKEEPING") {
286//} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
287//}
288$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0);
289$period .= ' - ';
290$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
291if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
292 $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
293} else {
294 $periodlink = '';
295}
296
297$description .= ' <input type="hidden" name="modecompta" value="'.$modecompta.'">';
298
299report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
300
301if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
302 print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1');
303}
304
305
306if ($modecompta == 'CREANCES-DETTES') {
307 print '<table class="noborder centpercent">';
308 print '<tr class="liste_titre"><td width="6%" class="right">'.$langs->trans("TurnoverbyVatrate").'</td>';
309 print '<td class="left">'.$langs->trans("ProductOrService").'</td>';
310 print '<td class="left">'.$langs->trans("Country").'</td>';
311 $i = 0;
312 while ($i < 12) {
313 $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
314 if ($j > 12) {
315 $j -= 12;
316 }
317 print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).'</td>';
318 $i++;
319 }
320 print '<td width="60" class="right"><b>'.$langs->trans("TotalHT").'</b></td></tr>';
321
322 // Sales invoices
323 $sql = "SELECT fd.tva_tx AS vatrate,";
324 $sql .= " fd.product_type AS product_type,";
325 $sql .= " cc.code, cc.label AS country,";
326 for ($i = 1; $i <= 12; $i++) {
327 $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".((int) $i), "fd.total_ht", "0").") AS month".str_pad((string) ((int) $i), 2, "0", STR_PAD_LEFT).",";
328 }
329 $sql .= " SUM(fd.total_ht) as total";
330 $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
331 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
332 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as soc ON soc.rowid = f.fk_soc";
333 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = soc.fk_pays";
334 $sql .= " WHERE f.datef >= '".$db->idate($date_start)."'";
335 $sql .= " AND f.datef <= '".$db->idate($date_end)."'";
336 $sql .= " AND f.fk_statut in (1,2)";
337 if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
338 $sql .= " AND f.type IN (0,1,2,5)";
339 } else {
340 $sql .= " AND f.type IN (0,1,2,3,5)";
341 }
342 // Add SQL restrictions from hooks (context turnoverreport), e.g. a deposit pivot date restricting deposits by their date
343 $hookmanager->initHooks(array('turnoverreport'));
344 $parameters = array('invoicealias' => 'f', 'issupplier' => 0, 'datefield' => 'datef');
345 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by some hooks
346 $sql .= $hookmanager->resPrint;
347 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")";
348 $sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label, cc.code ";
349 $sql .= " ORDER BY country, product_type, vatrate";
350
351 dol_syslog("htdocs/compta/tva/index.php", LOG_DEBUG);
352 $resql = $db->query($sql);
353 if ($resql) {
354 $num = $db->num_rows($resql);
355 $totalpermonth = array();
356 while ($obj = $db->fetch_object($resql)) {
357 print '<tr class="oddeven"><td class="right">'.vatrate($obj->vatrate).'</td>';
358 if ($obj->product_type == 0) {
359 print '<td class="left">'.$langs->trans("Product").'</td>';
360 } else {
361 print '<td class="left">'.$langs->trans("Service").'</td>';
362 }
363 // Country
364 print '<td>';
365 print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
366 print '</td>';
367 for ($i = 0; $i < 12; $i++) {
368 $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
369 if ($j > 12) {
370 $j -= 12;
371 }
372 $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT);
373 print '<td class="right" width="6%">'.price($obj->$monthj).'</td>';
374 $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj;
375 }
376 print '<td class="right" width="6%"><b>'.price($obj->total).'</b></td>';
377 $totalpermonth['total'] = (empty($totalpermonth['total']) ? 0 : $totalpermonth['total']) + $obj->total;
378 print '</tr>';
379 }
380 $db->free($resql);
381
382 // Total
383 print '<tr class="liste_total"><td class="right"></td>';
384 print '<td class="left"></td>';
385 print '<td></td>';
386 for ($i = 0; $i < 12; $i++) {
387 $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
388 if ($j > 12) {
389 $j -= 12;
390 }
391 $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT);
392 print '<td class="right" width="6%">'.price((empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j])).'</td>';
393 }
394 print '<td class="right" width="6%"><b>'.price((empty($totalpermonth['total']) ? 0 : $totalpermonth['total'])).'</b></td>';
395 print '</tr>';
396 } else {
397 print $db->lasterror(); // Show last sql error
398 }
399
400 print '<tr class="liste_titre"><td width="6%" class="right">'.$langs->trans("PurchasebyVatrate").'</td>';
401 print '<td class="left">'.$langs->trans("ProductOrService").'</td>';
402 print '<td class="left">'.$langs->trans("Country").'</td>';
403 $i = 0;
404 while ($i < 12) {
405 $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
406 if ($j > 12) {
407 $j -= 12;
408 }
409 print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).'</td>';
410 $i++;
411 }
412 print '<td width="60" class="right"><b>'.$langs->trans("TotalHT").'</b></td></tr>';
413
414 // Purchase invoices
415 $sql2 = "SELECT ffd.tva_tx AS vatrate,";
416 $sql2 .= " ffd.product_type AS product_type,";
417 $sql2 .= " cc.code, cc.label AS country,";
418 for ($i = 1; $i <= 12; $i++) {
419 $sql2 .= " SUM(".$db->ifsql("MONTH(ff.datef)=".((int) $i), "ffd.total_ht", "0").") AS month".str_pad((string) ((int) $i), 2, "0", STR_PAD_LEFT).",";
420 }
421 $sql2 .= " SUM(ffd.total_ht) as total";
422 $sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
423 $sql2 .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
424 $sql2 .= " INNER JOIN ".MAIN_DB_PREFIX."societe as soc ON soc.rowid = ff.fk_soc";
425 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = soc.fk_pays";
426 $sql2 .= " WHERE ff.datef >= '".$db->idate($date_start)."'";
427 $sql2 .= " AND ff.datef <= '".$db->idate($date_end)."'";
428 $sql .= " AND ff.fk_statut in (1,2)";
429 if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
430 $sql .= " AND ff.type IN (0,1,2,5)";
431 } else {
432 $sql .= " AND ff.type IN (0,1,2,3,5)";
433 }
434 // Add SQL restrictions from hooks (context turnoverreport), e.g. a deposit pivot date restricting deposits by their date
435 $hookmanager->initHooks(array('turnoverreport'));
436 $parameters = array('invoicealias' => 'ff', 'issupplier' => 1, 'datefield' => 'datef');
437 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by some hooks
438 $sql .= $hookmanager->resPrint;
439 $sql2 .= " AND ff.entity IN (".getEntity("facture_fourn", 0).")";
440 $sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label, cc.code ";
441 $sql2 .= " ORDER BY country, product_type, vatrate";
442
443 //print $sql2;
444 dol_syslog("htdocs/compta/tva/index.php", LOG_DEBUG);
445 $resql2 = $db->query($sql2);
446 if ($resql2) {
447 $num = $db->num_rows($resql2);
448 $totalpermonth = array();
449 while ($obj = $db->fetch_object($resql2)) {
450 print '<tr class="oddeven"><td class="right">'.vatrate($obj->vatrate).'</td>';
451 if ($obj->product_type == 0) {
452 print '<td class="left">'.$langs->trans("Product").'</td>';
453 } else {
454 print '<td class="left">'.$langs->trans("Service").'</td>';
455 }
456 print '<td>';
457 print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
458 print '</td>';
459 for ($i = 0; $i < 12; $i++) {
460 $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
461 if ($j > 12) {
462 $j -= 12;
463 }
464 $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT);
465 print '<td class="right" width="6%">'.price($obj->$monthj).'</td>';
466 $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj;
467 }
468 print '<td class="right" width="6%"><b>'.price($obj->total).'</b></td>';
469 $totalpermonth['total'] = (empty($totalpermonth['total']) ? 0 : $totalpermonth['total']) + $obj->total;
470 print '</tr>';
471 }
472 $db->free($resql2);
473
474 // Total
475 print '<tr class="liste_total"><td class="right"></td>';
476 print '<td class="left"></td>';
477 print '<td></td>';
478 for ($i = 0; $i < 12; $i++) {
479 $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
480 if ($j > 12) {
481 $j -= 12;
482 }
483 $monthj = 'month'.str_pad((string) $j, 2, '0', STR_PAD_LEFT);
484 print '<td class="right" width="6%">'.price(empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]).'</td>';
485 }
486 print '<td class="right" width="6%"><b>'.price(empty($totalpermonth['total']) ? 0 : $totalpermonth['total']).'</b></td>';
487 print '</tr>';
488 } else {
489 print $db->lasterror(); // Show last sql error
490 }
491 print "</table>\n";
492} else {
493 // $modecompta != 'CREANCES-DETTES'
494 // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
495 // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
496 // Because there is no way to know this, this report is not relevant.
497 print '<br>'.$langs->trans("TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant").'<br>';
498}
499
500// End of page
501llxFooter();
502$db->close();
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...)
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition date.lib.php:616
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:126
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:635
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
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...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_previous($titlealt='default', $moreatt='')
Show previous logo.
img_next($titlealt='default', $moreatt='')
Show next logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
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, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.