dolibarr  7.0.0-beta
clients.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 Yannick Warnier <ywarnier@beeznest.org>
6  * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
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 <http://www.gnu.org/licenses/>.
20  */
21 
28 require '../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
34 
35 $langs->load("bills");
36 $langs->load("compta");
37 $langs->load("companies");
38 $langs->load("products");
39 $langs->load("other");
40 
41 // Date range
42 $year=GETPOST("year");
43 if (empty($year)) {
44  $year_current = strftime("%Y",dol_now());
45  $year_start = $year_current;
46 } else {
47  $year_current = $year;
48  $year_start = $year;
49 }
50 $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
51 $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
52 // Quarter
53 if (empty($date_start) || empty($date_end)) {// We define date_start and date_end
54  $q=GETPOST("q");
55  if (empty($q)) {
56  if (isset($_REQUEST["month"])) {
57  $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false);
58  $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false);
59  } else {
60  $month_current = strftime("%m",dol_now());
61  if ($month_current >= 10) $q=4;
62  elseif ($month_current >= 7) $q=3;
63  elseif ($month_current >= 4) $q=2;
64  else $q=1;
65  }
66  }
67  if ($q==1) {
68  $date_start=dol_get_first_day($year_start,1,false);
69  $date_end=dol_get_last_day($year_start,3,false);
70  }
71  if ($q==2) {
72  $date_start=dol_get_first_day($year_start,4,false);
73  $date_end=dol_get_last_day($year_start,6,false);
74  }
75  if ($q==3) {
76  $date_start=dol_get_first_day($year_start,7,false);
77  $date_end=dol_get_last_day($year_start,9,false);
78  }
79  if ($q==4) {
80  $date_start=dol_get_first_day($year_start,10,false);
81  $date_end=dol_get_last_day($year_start,12,false);
82  }
83 }
84 
85 $min = price2num(GETPOST("min"));
86 if (empty($min)) $min = 0;
87 
88 // Define modetax (0 or 1)
89 // 0=normal, 1=option vat for services is on debit
90 $modetax = $conf->global->TAX_MODE;
91 if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"];
92 if (empty($modetax)) $modetax=0;
93 
94 // Security check
95 $socid = GETPOST('socid','int');
96 if ($user->societe_id) {
97  $socid=$user->societe_id;
98 }
99 $result = restrictedArea($user, 'tax', '', '', 'charges');
100 
101 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
102 $modecompta = $conf->global->ACCOUNTING_MODE;
103 if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta");
104 
105 
106 
107 /*
108  * View
109  */
110 
111 $form=new Form($db);
112 $company_static=new Societe($db);
113 
114 $morequerystring='';
115 $listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
116 foreach($listofparams as $param) {
117  if (GETPOST($param)!='') {
118  $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
119  }
120 }
121 
122 $special_report = false;
123 if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) {
124  $special_report = true;
125 }
126 
127 llxHeader('',$langs->trans("VATReport"),'','',0,0,'','',$morequerystring);
128 
129 $fsearch.='<br>';
130 $fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
131 $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
132 $fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
133 $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
134 
135 // Affiche en-tete du rapport
136 if ($modetax==1) { // Calculate on invoice for goods and services
137  $name=$langs->trans("VATReportByCustomersInDueDebtMode");
138  $calcmode=$langs->trans("CalcModeVATDebt");
139  $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
140  //$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
141  $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
142  //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
143  $description=$langs->trans("RulesVATDueServices");
144  $description.='<br>';
145  $description.=$langs->trans("RulesVATDueProducts");
146  //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
147  //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
148  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
149  $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
150  } else {
151  $description.='<br>'.$langs->trans("DepositsAreIncluded");
152  }
153  $description.=$fsearch;
154  $description.='<br>'
155  . '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> '
156  . $langs->trans('SimpleReport')
157  . '</input>'
158  . '<br>'
159  . '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> '
160  . $langs->trans('AddExtraReport')
161  . '</input>'
162  . '<br>';
163  $builddate=dol_now();
164  //$exportlink=$langs->trans("NotYetAvailable");
165 
166  $elementcust=$langs->trans("CustomersInvoices");
167  $productcust=$langs->trans("Description");
168  $amountcust=$langs->trans("AmountHT");
169  if ($mysoc->tva_assuj) {
170  $vatcust.=' ('.$langs->trans("ToPay").')';
171  }
172  $elementsup=$langs->trans("SuppliersInvoices");
173  $productsup=$langs->trans("Description");
174  $amountsup=$langs->trans("AmountHT");
175  if ($mysoc->tva_assuj) {
176  $vatsup.=' ('.$langs->trans("ToGetBack").')';
177  }
178 }
179 if ($modetax==0) { // Invoice for goods, payment for services
180  $name=$langs->trans("VATReportByCustomersInInputOutputMode");
181  $calcmode=$langs->trans("CalcModeVATEngagement");
182  $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
183  //$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')';
184  $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
185  //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
186  $description=$langs->trans("RulesVATInServices");
187  $description.=' '.$langs->trans("DepositsAreIncluded");
188  $description.='<br>';
189  $description.=$langs->trans("RulesVATInProducts");
190  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
191  $description .= ' ' . $langs->trans("DepositsAreNotIncluded");
192  } else {
193  $description .= ' ' . $langs->trans("DepositsAreIncluded");
194  }
195  //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
196  //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
197  $description.=$fsearch;
198  $description.='<br>'
199  . '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> '
200  . $langs->trans('SimpleReport')
201  . '</input>'
202  . '<br>'
203  . '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> '
204  . $langs->trans('AddExtraReport')
205  . '</input>'
206  . '<br>';
207  $builddate=dol_now();
208  //$exportlink=$langs->trans("NotYetAvailable");
209 
210  $elementcust=$langs->trans("CustomersInvoices");
211  $productcust=$langs->trans("Description");
212  $amountcust=$langs->trans("AmountHT");
213  if ($mysoc->tva_assuj) {
214  $vatcust.=' ('.$langs->trans("ToPay").')';
215  }
216  $elementsup=$langs->trans("SuppliersInvoices");
217  $productsup=$langs->trans("Description");
218  $amountsup=$langs->trans("AmountHT");
219  if ($mysoc->tva_assuj) {
220  $vatsup.=' ('.$langs->trans("ToGetBack").')';
221  }
222 }
223 report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
224 
225 $vatcust=$langs->trans("VATReceived");
226 $vatsup=$langs->trans("VATPaid");
227 
228 
229 // VAT Received
230 
231 //print "<br>";
232 //print load_fiche_titre($vatcust);
233 
234 print "<table class=\"noborder\" width=\"100%\">";
235 print "<tr class=\"liste_titre\">";
236 print '<td align="left">'.$langs->trans("Num")."</td>";
237 print '<td align="left">'.$langs->trans("Customer")."</td>";
238 print "<td>".$langs->trans("VATIntra")."</td>";
239 print "<td align=\"right\">".$langs->trans("AmountHTVATRealReceived")."</td>";
240 print "<td align=\"right\">".$vatcust."</td>";
241 print "</tr>\n";
242 
243 $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
244 
245 $action = "tvaclient";
246 $object = &$coll_list;
247 $parameters["mode"] = $modetax;
248 $parameters["start"] = $date_start;
249 $parameters["end"] = $date_end;
250 $parameters["direction"] = 'sell';
251 $parameters["type"] = 'vat';
252 
253 // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
254 $hookmanager->initHooks(array('externalbalance'));
255 $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
256 
257 if (is_array($coll_list)) {
258  $var=true;
259  $total = 0; $totalamount = 0;
260  $i = 1;
261  foreach ($coll_list as $coll) {
262  if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
263 
264  $intra = str_replace($find,$replace,$coll->tva_intra);
265  if(empty($intra)) {
266  if($coll->assuj == '1') {
267  $intra = $langs->trans('Unknown');
268  } else {
269  //$intra = $langs->trans('NotRegistered');
270  $intra = '';
271  }
272  }
273  print '<tr class="oddeven">';
274  print '<td class="nowrap">'.$i."</td>";
275  $company_static->id=$coll->socid;
276  $company_static->name=$coll->name;
277  $company_static->client=1;
278  print '<td class="nowrap">'.$company_static->getNomUrl(1,'customer').'</td>';
279  $find = array(' ','.');
280  $replace = array('','');
281  print '<td class="nowrap">'.$intra."</td>";
282  print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
283  print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>";
284  $totalamount = $totalamount + $coll->amount;
285  $total = $total + $coll->tva;
286  print "</tr>\n";
287  $i++;
288  }
289  }
290  $x_coll_sum = $total;
291 
292  print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
293  print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
294  print '<td class="nowrap" align="right">'.price($total).'</td>';
295  print '</tr>';
296 } else {
297  $langs->load("errors");
298  if ($coll_list == -1) {
299  if ($modecompta == 'CREANCES-DETTES')
300  {
301  print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
302  }
303  else
304  {
305  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
306  }
307  } else if ($coll_list == -2) {
308  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
309  } else {
310  print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
311  }
312 }
313 
314 //print '</table>';
315 
316 
317 // VAT Paid
318 
319 //print "<br>";
320 //print load_fiche_titre($vatsup);
321 
322 //print "<table class=\"noborder\" width=\"100%\">";
323 print "<tr class=\"liste_titre liste_titre_topborder\">";
324 print '<td align="left">'.$langs->trans("Num")."</td>";
325 print '<td align="left">'.$langs->trans("Supplier")."</td>";
326 print "<td>".$langs->trans("VATIntra")."</td>";
327 print "<td align=\"right\">".$langs->trans("AmountHTVATRealPaid")."</td>";
328 print "<td align=\"right\">".$vatsup."</td>";
329 print "</tr>\n";
330 
331 $company_static=new Societe($db);
332 
333 $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
334 
335 $parameters["direction"] = 'buy';
336 $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
337 if (is_array($coll_list)) {
338  $var=true;
339  $total = 0; $totalamount = 0;
340  $i = 1;
341  foreach ($coll_list as $coll) {
342  if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
343 
344  $intra = str_replace($find,$replace,$coll->tva_intra);
345  if (empty($intra)) {
346  if ($coll->assuj == '1') {
347  $intra = $langs->trans('Unknown');
348  } else {
349  //$intra = $langs->trans('NotRegistered');
350  $intra = '';
351  }
352  }
353  print '<tr class="oddeven">';
354  print '<td class="nowrap">'.$i."</td>";
355  $company_static->id=$coll->socid;
356  $company_static->name=$coll->name;
357  $company_static->fournisseur=1;
358  print '<td class="nowrap">'.$company_static->getNomUrl(1,'supplier').'</td>';
359  $find = array(' ','.');
360  $replace = array('','');
361  print '<td class="nowrap">'.$intra."</td>";
362  print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
363  print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>";
364  $totalamount = $totalamount + $coll->amount;
365  $total = $total + $coll->tva;
366  print "</tr>\n";
367  $i++;
368  }
369  }
370  $x_paye_sum = $total;
371 
372  print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
373  print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
374  print '<td class="nowrap" align="right">'.price($total).'</td>';
375  print '</tr>';
376 
377  print '</table>';
378 
379  // Total to pay
380  print '<br><br>';
381  print '<table class="noborder" width="100%">';
382  $diff = $x_coll_sum - $x_paye_sum;
383  print '<tr class="liste_total">';
384  print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
385  print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
386  print "</tr>\n";
387 
388 } else {
389  $langs->load("errors");
390  if ($coll_list == -1) {
391  if ($modecompta == 'CREANCES-DETTES')
392  {
393  print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
394  }
395  else
396  {
397  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
398  }
399  } else if ($coll_list == -2) {
400  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
401  } else {
402  print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
403  }
404 }
405 
406 print '</table>';
407 
408 if ($special_report) {
409  // Get country 2-letters code
410  global $mysoc;
411  $country_id = $mysoc->country_id;
412  $country = new Ccountry($db);
413  $country->fetch($country_id);
414 
415  // Print listing of other-country customers as additional report
416  // This matches tax requirements to list all same-country customers (only)
417  print '<h3>'.$langs->trans('OtherCountriesCustomersReport').'</h3>';
418  print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry');
419  $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, 'sell');
420 
421  print "<table class=\"noborder\" width=\"100%\">";
422  print "<tr class=\"liste_titre\">";
423  print '<td align="left">' . $langs->trans("Num") . "</td>";
424  print '<td align="left">' . $langs->trans("Customer") . "</td>";
425  print "<td>" . $langs->trans("VATIntra") . "</td>";
426  print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>";
427  print "<td align=\"right\">" . $vatcust . "</td>";
428  print "</tr>\n";
429 
430  if (is_array($coll_list)) {
431  $var = true;
432  $total = 0;
433  $totalamount = 0;
434  $i = 1;
435  foreach ($coll_list as $coll) {
436  if (substr($coll->tva_intra, 0, 2) == $country->code) {
437  // Only use different-country VAT codes
438  continue;
439  }
440  if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
441  $var = !$var;
442  $intra = str_replace($find, $replace, $coll->tva_intra);
443  if (empty($intra)) {
444  if ($coll->assuj == '1') {
445  $intra = $langs->trans('Unknown');
446  } else {
447  //$intra = $langs->trans('NotRegistered');
448  $intra = '';
449  }
450  }
451  print "<tr " . $bc[$var] . ">";
452  print '<td class="nowrap">' . $i . "</td>";
453  $company_static->id = $coll->socid;
454  $company_static->name = $coll->name;
455  $company_static->client = 1;
456  print '<td class="nowrap">' . $company_static->getNomUrl(1,
457  'customer') . '</td>';
458  $find = array(' ', '.');
459  $replace = array('', '');
460  print '<td class="nowrap">' . $intra . "</td>";
461  print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>";
462  print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>";
463  $totalamount = $totalamount + $coll->amount;
464  $total = $total + $coll->tva;
465  print "</tr>\n";
466  $i++;
467  }
468  }
469  $x_coll_sum = $total;
470 
471  print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>';
472  print '<td class="nowrap" align="right">' . price($totalamount) . '</td>';
473  print '<td class="nowrap" align="right">' . price($total) . '</td>';
474  print '</tr>';
475  } else {
476  $langs->load("errors");
477  if ($coll_list == -1) {
478  if ($modecompta == 'CREANCES-DETTES')
479  {
480  print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
481  }
482  else
483  {
484  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
485  }
486  } else {
487  if ($coll_list == -2) {
488  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
489  } else {
490  print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
491  }
492  }
493  }
494  print '</table>';
495 
496  // Print listing of same-country customers as additional report
497  // This matches tax requirements to list all same-country customers (only)
498  print '<h3>'.$langs->trans('SameCountryCustomersWithVAT').'</h3>';
499  print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry');
500  $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, 'sell');
501 
502  print "<table class=\"noborder\" width=\"100%\">";
503  print "<tr class=\"liste_titre\">";
504  print '<td align="left">' . $langs->trans("Num") . "</td>";
505  print '<td align="left">' . $langs->trans("Customer") . "</td>";
506  print "<td>" . $langs->trans("VATIntra") . "</td>";
507  print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>";
508  print "<td align=\"right\">" . $vatcust . "</td>";
509  print "</tr>\n";
510 
511  if (is_array($coll_list)) {
512  $var = true;
513  $total = 0;
514  $totalamount = 0;
515  $i = 1;
516  foreach ($coll_list as $coll) {
517  if (substr($coll->tva_intra, 0, 2) != $country->code) {
518  // Only use same-country VAT codes
519  continue;
520  }
521  if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
522  $var = !$var;
523  $intra = str_replace($find, $replace, $coll->tva_intra);
524  if (empty($intra)) {
525  if ($coll->assuj == '1') {
526  $intra = $langs->trans('Unknown');
527  } else {
528  //$intra = $langs->trans('NotRegistered');
529  $intra = '';
530  }
531  }
532  print "<tr " . $bc[$var] . ">";
533  print '<td class="nowrap">' . $i . "</td>";
534  $company_static->id = $coll->socid;
535  $company_static->name = $coll->name;
536  $company_static->client = 1;
537  print '<td class="nowrap">' . $company_static->getNomUrl(1, 'customer') . '</td>';
538  $find = array(' ', '.');
539  $replace = array('', '');
540  print '<td class="nowrap">' . $intra . "</td>";
541  print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>";
542  print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>";
543  $totalamount = $totalamount + $coll->amount;
544  $total = $total + $coll->tva;
545  print "</tr>\n";
546  $i++;
547  }
548  }
549  $x_coll_sum = $total;
550 
551  print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>';
552  print '<td class="nowrap" align="right">' . price($totalamount) . '</td>';
553  print '<td class="nowrap" align="right">' . price($total) . '</td>';
554  print '</tr>';
555  } else {
556  $langs->load("errors");
557  if ($coll_list == -1) {
558  if ($modecompta == 'CREANCES-DETTES')
559  {
560  print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
561  }
562  else
563  {
564  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
565  }
566  } else {
567  if ($coll_list == -2) {
568  print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
569  } else {
570  print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
571  }
572  }
573  }
574  print '</table>';
575 }
576 
577 llxFooter();
578 
579 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
if(!GETPOST('transkey')&&!GETPOST('transphrase')) else
View.
Definition: notice.php:43
vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction, $m=0)
Look for collectable VAT clients in the chosen year (and month)
Definition: tax.lib.php:89
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
if(GETPOST('cancel','alpha')) if(!GETPOST('confirmmassaction','alpha')&&$massaction!= 'presend'&&$massaction!= 'confirm_presend')
Draft customers invoices.
Definition: list.php:147
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:445
if(empty($reshook)) $form
View.
Definition: perms.php:103
Class to manage dictionary Countries (used by imports)
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
llxHeader()
Empty header.
Definition: wrapper.php:46
dol_now($mode='gmt')
Return date for now.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:459
print
Draft customers invoices.
Definition: index.php:91
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
Definition: report.lib.php:41
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is '...
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.