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