dolibarr  13.0.2
supplier_turnover_by_thirdparty.php
1 <?php
2 /* Copyright (C) 2020 Maxime Kohlhaas <maxime@atm-consulting.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 require '../../main.inc.php';
24 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('companies', 'categories', 'bills', 'compta'));
34 
35 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
36 $modecompta = $conf->global->ACCOUNTING_MODE;
37 if (GETPOST("modecompta")) $modecompta = GETPOST("modecompta");
38 
39 $sortorder = isset($_GET["sortorder"]) ? $_GET["sortorder"] : $_POST["sortorder"];
40 $sortfield = isset($_GET["sortfield"]) ? $_GET["sortfield"] : $_POST["sortfield"];
41 if (!$sortorder) $sortorder = "asc";
42 if (!$sortfield) $sortfield = "nom";
43 
44 $socid = GETPOST('socid', 'int');
45 
46 // Category
47 $selected_cat = (int) GETPOST('search_categ', 'int');
48 $subcat = false;
49 if (GETPOST('subcat', 'alpha') === 'yes') {
50  $subcat = true;
51 }
52 
53 // Hook
54 $hookmanager->initHooks(array('supplierturnoverbythirdpartylist'));
55 
56 // Security check
57 if ($user->socid > 0) $socid = $user->socid;
58 if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
59 if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
60 
61 // Date range
62 $year = GETPOST("year", 'int');
63 $month = GETPOST("month", 'int');
64 $search_societe = GETPOST("search_societe", 'alpha');
65 $search_zip = GETPOST("search_zip", 'alpha');
66 $search_town = GETPOST("search_town", 'alpha');
67 $search_country = GETPOST("search_country", 'alpha');
68 $date_startyear = GETPOST("date_startyear", 'alpha');
69 $date_startmonth = GETPOST("date_startmonth", 'alpha');
70 $date_startday = GETPOST("date_startday", 'alpha');
71 $date_endyear = GETPOST("date_endyear", 'alpha');
72 $date_endmonth = GETPOST("date_endmonth", 'alpha');
73 $date_endday = GETPOST("date_endday", 'alpha');
74 if (empty($year))
75 {
76  $year_current = strftime("%Y", dol_now());
77  $month_current = strftime("%m", dol_now());
78  $year_start = $year_current;
79 } else {
80  $year_current = $year;
81  $month_current = strftime("%m", dol_now());
82  $year_start = $year;
83 }
84 $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
85 $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
86 // Quarter
87 if (empty($date_start) || empty($date_end)) // We define date_start and date_end
88 {
89  $q = GETPOST("q", "int") ?GETPOST("q", "int") : 0;
90  if (empty($q))
91  {
92  // We define date_start and date_end
93  $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
94  $year_end = $year_start;
95  $month_end = $month_start;
96  if (!GETPOST("month")) // If month not forced
97  {
98  if (!GETPOST('year') && $month_start > $month_current)
99  {
100  $year_start--;
101  $year_end--;
102  }
103  $month_end = $month_start - 1;
104  if ($month_end < 1) $month_end = 12;
105  else $year_end++;
106  }
107  $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
108  }
109  if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
110  if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
111  if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
112  if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
113 } else {
114  // TODO We define q
115 }
116 
117 // $date_start and $date_end are defined. We force $year_start and $nbofyear
118 $tmps = dol_getdate($date_start);
119 $year_start = $tmps['year'];
120 $tmpe = dol_getdate($date_end);
121 $year_end = $tmpe['year'];
122 $nbofyear = ($year_end - $year_start) + 1;
123 
124 $commonparams = array();
125 $commonparams['modecompta'] = $modecompta;
126 $commonparams['sortorder'] = $sortorder;
127 $commonparams['sortfield'] = $sortfield;
128 
129 $headerparams = array();
130 $headerparams['date_startyear'] = $date_startyear;
131 $headerparams['date_startmonth'] = $date_startmonth;
132 $headerparams['date_startday'] = $date_startday;
133 $headerparams['date_endyear'] = $date_endyear;
134 $headerparams['date_endmonth'] = $date_endmonth;
135 $headerparams['date_endday'] = $date_endday;
136 $headerparams['q'] = $q;
137 
138 $tableparams = array();
139 $tableparams['search_categ'] = $selected_cat;
140 $tableparams['search_societe'] = $search_societe;
141 $tableparams['search_zip'] = $search_zip;
142 $tableparams['search_town'] = $search_town;
143 $tableparams['search_country'] = $search_country;
144 $tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
145 
146 // Adding common parameters
147 $allparams = array_merge($commonparams, $headerparams, $tableparams);
148 $headerparams = array_merge($commonparams, $headerparams);
149 $tableparams = array_merge($commonparams, $tableparams);
150 
151 foreach ($allparams as $key => $value) {
152  $paramslink .= '&'.$key.'='.$value;
153 }
154 
155 
156 /*
157  * View
158  */
159 
160 llxHeader();
161 
162 $form = new Form($db);
163 $thirdparty_static = new Societe($db);
164 $formother = new FormOther($db);
165 
166 // TODO Report from bookkeeping not yet available, so we switch on report on business events
167 if ($modecompta == "BOOKKEEPING") $modecompta = "CREANCES-DETTES";
168 if ($modecompta == "BOOKKEEPINGCOLLECTED") $modecompta = "RECETTES-DEPENSES";
169 
170 // Show report header
171 if ($modecompta == "CREANCES-DETTES")
172 {
173  $name = $langs->trans("PurchaseTurnover").', '.$langs->trans("ByThirdParties");
174  $calcmode = $langs->trans("CalcModeDebt");
175  //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
176  $description = $langs->trans("RulesPurchaseTurnoverDue");
177  $builddate = dol_now();
178  //$exportlink=$langs->trans("NotYetAvailable");
179 } elseif ($modecompta == "RECETTES-DEPENSES")
180 {
181  $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties");
182  $calcmode = $langs->trans("CalcModeEngagement");
183  //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
184  $description = $langs->trans("RulesPurchaseTurnoverIn");
185  $builddate = dol_now();
186  //$exportlink=$langs->trans("NotYetAvailable");
187 } elseif ($modecompta == "BOOKKEEPING")
188 {
189 } elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
190 {
191 }
192 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
193 if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $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>';
194 else $periodlink = '';
195 
196 report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
197 
198 if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
199 {
200  print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
201 }
202 
203 // Show Array
204 $catotal = 0;
205 $catotal_ht = 0;
206 $name = array();
207 $amount = array();
208 $amount_ht = array();
209 if ($modecompta == 'CREANCES-DETTES') {
210  $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,";
211  $sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
212  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
213  if ($selected_cat === -2) // Without any category
214  {
215  $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
216  } elseif ($selected_cat) // Into a specific category
217  {
218  $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
219  }
220  $sql .= " WHERE f.fk_statut in (1,2)";
221  $sql .= " AND f.type IN (0,2)";
222  $sql .= " AND f.fk_soc = s.rowid";
223  if ($date_start && $date_end) {
224  $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
225  }
226  if ($selected_cat === -2) // Without any category
227  {
228  $sql .= " AND cs.fk_soc is null";
229  } elseif ($selected_cat) { // Into a specific category
230  $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
231  if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
232  $sql .= ")";
233  $sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
234  }
235 } else {
236  $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc";
237  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
238  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
239  $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p";
240  $sql .= ", ".MAIN_DB_PREFIX."societe as s";
241  if ($selected_cat === -2) // Without any category
242  {
243  $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
244  } elseif ($selected_cat) // Into a specific category
245  {
246  $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
247  }
248  $sql .= " WHERE p.rowid = pf.fk_paiementfourn";
249  $sql .= " AND pf.fk_facturefourn = f.rowid";
250  $sql .= " AND f.fk_soc = s.rowid";
251  if ($date_start && $date_end) {
252  $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
253  }
254  if ($selected_cat === -2) // Without any category
255  {
256  $sql .= " AND cs.fk_soc is null";
257  } elseif ($selected_cat) { // Into a specific category
258  $sql .= " AND (c.rowid = ".$selected_cat;
259  if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
260  $sql .= ")";
261  $sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
262  }
263 }
264 if (!empty($search_societe)) $sql .= natural_search('s.nom', $search_societe);
265 if (!empty($search_zip)) $sql .= natural_search('s.zip', $search_zip);
266 if (!empty($search_town)) $sql .= natural_search('s.town', $search_town);
267 if ($search_country > 0) $sql .= ' AND s.fk_pays = '.$search_country.'';
268 $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
269 if ($socid) $sql .= " AND f.fk_soc = ".$socid;
270 $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
271 $sql .= " ORDER BY s.rowid";
272 //echo $sql;
273 
274 dol_syslog("supplier_turnover_by_thirdparty", LOG_DEBUG);
275 $result = $db->query($sql);
276 if ($result) {
277  $num = $db->num_rows($result);
278  $i = 0;
279  while ($i < $num) {
280  $obj = $db->fetch_object($result);
281  $amount_ht[$obj->socid] = $obj->amount;
282  $amount[$obj->socid] = $obj->amount_ttc;
283  $name[$obj->socid] = $obj->name.' '.$obj->firstname;
284  $address_zip[$obj->socid] = $obj->zip;
285  $address_town[$obj->socid] = $obj->town;
286  $address_pays[$obj->socid] = getCountry($obj->fk_pays);
287  $catotal_ht += $obj->amount;
288  $catotal += $obj->amount_ttc;
289  $i++;
290  }
291 } else {
292  dol_print_error($db);
293 }
294 
295 // Show array
296 $i = 0;
297 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
298 print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
299 // Extra parameters management
300 foreach ($headerparams as $key => $value)
301 {
302  print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
303 }
304 
305 $moreforfilter = '';
306 
307 print '<div class="div-table-responsive">';
308 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
309 
310 // Category filter
311 print '<tr class="liste_titre">';
312 print '<td>';
313 print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_SUPPLIER, $selected_cat, 'search_categ', true);
314 print ' ';
315 print $langs->trans("SubCats").'? ';
316 print '<input type="checkbox" name="subcat" value="yes"';
317 if ($subcat) {
318  print ' checked';
319 }
320 print'></td>';
321 print '<td colspan="7" class="right">';
322 print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
323 print '</td>';
324 print '</tr>';
325 
326 print '<tr class="liste_titre">';
327 print '<td class="liste_titre left">';
328 print '<input class="flat" size="6" type="text" name="search_societe" value="'.$search_societe.'">';
329 print '</td>';
330 print '<td class="liste_titre left">';
331 print '<input class="flat" size="6" type="text" name="search_zip" value="'.$search_zip.'">';
332 print '</td>';
333 print '<td class="liste_titre left">';
334 print '<input class="flat" size="6" type="text" name="search_town" value="'.$search_town.'">';
335 print '</td>';
336 print '<td class="liste_titre left">';
337 print $form->select_country($search_country, 'search_country');
338 //print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
339 print '</td>';
340 print '<td class="liste_titre">&nbsp;</td>';
341 print '<td class="liste_titre">&nbsp;</td>';
342 print '<td class="liste_titre">&nbsp;</td>';
343 print '<td class="liste_titre">&nbsp;</td>';
344 print '</tr>';
345 
346 // Array titles
347 print "<tr class='liste_titre'>";
349  $langs->trans("Company"),
350  $_SERVER["PHP_SELF"],
351  "nom",
352  "",
353  $paramslink,
354  "",
355  $sortfield, $sortorder
356  );
358  $langs->trans("Zip"),
359  $_SERVER["PHP_SELF"],
360  "zip",
361  "",
362  $paramslink,
363  "",
364  $sortfield, $sortorder
365  );
367  $langs->trans("Town"),
368  $_SERVER["PHP_SELF"],
369  "town",
370  "",
371  $paramslink,
372  "",
373  $sortfield, $sortorder
374  );
376  $langs->trans("Country"),
377  $_SERVER["PHP_SELF"],
378  "country",
379  "",
380  $paramslink,
381  "",
382  $sortfield, $sortorder
383  );
384 if ($modecompta == 'CREANCES-DETTES') {
386  $langs->trans('AmountHT'),
387  $_SERVER["PHP_SELF"],
388  "amount_ht",
389  "",
390  $paramslink,
391  'class="right"',
392  $sortfield,
393  $sortorder
394  );
395 } else {
397 }
399  $langs->trans("AmountTTC"),
400  $_SERVER["PHP_SELF"],
401  "amount_ttc",
402  "",
403  $paramslink,
404  'class="right"',
405  $sortfield,
406  $sortorder
407 );
409  $langs->trans("Percentage"),
410  $_SERVER["PHP_SELF"],
411  "amount_ttc",
412  "",
413  $paramslink,
414  'class="right"',
415  $sortfield,
416  $sortorder
417 );
419  $langs->trans("OtherStatistics"),
420  $_SERVER["PHP_SELF"],
421  "",
422  "",
423  "",
424  'align="center" width="20%"'
425 );
426 print "</tr>\n";
427 
428 
429 if (count($amount)) {
430  $arrayforsort = $name;
431  // Defining array arrayforsort
432  if ($sortfield == 'nom' && $sortorder == 'asc') {
433  asort($name);
434  $arrayforsort = $name;
435  }
436  if ($sortfield == 'nom' && $sortorder == 'desc') {
437  arsort($name);
438  $arrayforsort = $name;
439  }
440  if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
441  asort($amount_ht);
442  $arrayforsort = $amount_ht;
443  }
444  if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
445  arsort($amount_ht);
446  $arrayforsort = $amount_ht;
447  }
448  if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
449  asort($amount);
450  $arrayforsort = $amount;
451  }
452  if ($sortfield == 'amount_ttc' && $sortorder == 'desc') {
453  arsort($amount);
454  $arrayforsort = $amount;
455  }
456  if ($sortfield == 'zip' && $sortorder == 'asc') {
457  asort($address_zip);
458  $arrayforsort = $address_zip;
459  }
460  if ($sortfield == 'zip' && $sortorder == 'desc') {
461  arsort($address_zip);
462  $arrayforsort = $address_zip;
463  }
464  if ($sortfield == 'town' && $sortorder == 'asc') {
465  asort($address_town);
466  $arrayforsort = $address_town;
467  }
468  if ($sortfield == 'town' && $sortorder == 'desc') {
469  arsort($address_town);
470  $arrayforsort = $address_town;
471  }
472  if ($sortfield == 'country' && $sortorder == 'asc') {
473  asort($address_pays);
474  $arrayforsort = $address_town;
475  }
476  if ($sortfield == 'country' && $sortorder == 'desc') {
477  arsort($address_pays);
478  $arrayforsort = $address_town;
479  }
480 
481  foreach ($arrayforsort as $key=>$value) {
482  print '<tr class="oddeven">';
483 
484  // Third party
485  $fullname = $name[$key];
486  if ($key > 0) {
487  $thirdparty_static->id = $key;
488  $thirdparty_static->name = $fullname;
489  $thirdparty_static->client = 1;
490  $linkname = $thirdparty_static->getNomUrl(1, 'supplier');
491  } else {
492  $linkname = $langs->trans("PaymentsNotLinkedToInvoice");
493  }
494  print "<td>".$linkname."</td>\n";
495 
496  print '<td>';
497  print $address_zip[$key];
498  print '</td>';
499 
500  print '<td>';
501  print $address_town[$key];
502  print '</td>';
503 
504  print '<td>';
505  print $address_pays[$key];
506  print '</td>';
507 
508  // Amount w/o VAT
509  print '<td class="right">';
510  if ($modecompta != 'CREANCES-DETTES') {
511  if ($key > 0) {
512  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement/list.php?socid='.$key.'">';
513  } else {
514  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement/list.php?socid=-1">';
515  }
516  } else {
517  if ($key > 0) {
518  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$key.'">';
519  } else {
520  print '<a href="#">';
521  }
522  print price($amount_ht[$key]);
523  }
524  print '</td>';
525 
526  // Amount with VAT
527  print '<td class="right">';
528  if ($modecompta != 'CREANCES-DETTES') {
529  if ($key > 0) {
530  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement/list.php?socid='.$key.'">';
531  } else {
532  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement/list.php?orphelins=1">';
533  }
534  } else {
535  if ($key > 0) {
536  print '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$key.'">';
537  } else {
538  print '<a href="#">';
539  }
540  }
541  print price($amount[$key]);
542  print '</a>';
543  print '</td>';
544 
545  // Percent;
546  print '<td class="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>';
547 
548  // Other stats
549  print '<td class="center">';
550  if (!empty($conf->supplier_proposal->enabled) && $key > 0) {
551  print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
552  }
553  if (!empty($conf->fournisseur->enabled) && $key > 0) {
554  print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier&socid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
555  }
556  if (!empty($conf->fournisseur->enabled) && $key > 0) {
557  print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
558  }
559  print '</td>';
560  print "</tr>\n";
561  $i++;
562  }
563 
564  // Total
565  print '<tr class="liste_total">';
566  print '<td>'.$langs->trans("Total").'</td>';
567  print '<td>&nbsp;</td>';
568  print '<td>&nbsp;</td>';
569  print '<td>&nbsp;</td>';
570  if ($modecompta != 'CREANCES-DETTES') {
571  print '<td></td>';
572  } else {
573  print '<td class="right">'.price($catotal_ht).'</td>';
574  }
575  print '<td class="right">'.price($catotal).'</td>';
576  print '<td>&nbsp;</td>';
577  print '<td>&nbsp;</td>';
578  print '</tr>';
579 
580  $db->free($result);
581 }
582 
583 print "</table>";
584 print "</div>";
585 
586 print '</form>';
587 
588 // End of page
589 llxFooter();
590 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_now($mode= 'auto')
Return date for now.
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink= '', $moreparam=array(), $calcmode= '', $varlink= '')
Show header of a report.
Definition: report.lib.php:41
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:481
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...
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Classe permettant la generation de composants html autre Only common components are here...
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print $_SERVER["PHP_SELF"]
Edit parameters.
img_next($titlealt= 'default', $moreatt= '')
Show next logo.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:498
print
Draft customers invoices.
Definition: index.php:89
img_previous($titlealt= 'default', $moreatt= '')
Show previous logo.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
llxFooter()
Empty footer.
Definition: wrapper.php:59
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.
Definition: date.lib.php:114
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...