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