dolibarr  13.0.2
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
4  * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
5  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array("compta", "bills", "other", "main", "accountancy"));
35 
36 // Security check
37 if (empty($conf->accounting->enabled)) {
39 }
40 if ($user->socid > 0)
42 if (!$user->rights->accounting->bind->write)
44 
45 
46 $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
47 if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
48 else {
49  $year_start = dol_print_date(dol_now(), '%Y');
50  if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
51 }
52 $year_end = $year_start + 1;
53 $month_end = $month_start - 1;
54 if ($month_end < 1)
55 {
56  $month_end = 12;
57  $year_end--;
58 }
59 $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
60 $search_date_end = dol_get_last_day($year_end, $month_end);
61 $year_current = $year_start;
62 
63 // Validate History
64 $action = GETPOST('action', 'aZ09');
65 
66 $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
67 
68 
69 /*
70  * Actions
71  */
72 
73 if ($action == 'clean' || $action == 'validatehistory')
74 {
75  // Clean database
76  $db->begin();
77  $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as fd";
78  $sql1 .= " SET fk_code_ventilation = 0";
79  $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN';
80  $sql1 .= ' (SELECT accnt.rowid ';
81  $sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
82  $sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
83  $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
84  $sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
85  $sql1 .= ' AND fk_code_ventilation <> 0';
86  dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
87  $resql1 = $db->query($sql1);
88  if (!$resql1) {
89  $error++;
90  $db->rollback();
91  setEventMessages($db->lasterror(), null, 'errors');
92  } else {
93  $db->commit();
94  }
95  // End clean database
96 }
97 
98 if ($action == 'validatehistory') {
99  $error = 0;
100  $db->begin();
101 
102  // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
103  /*if ($db->type == 'pgsql') {
104  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
105  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
106  $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
107  $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
108  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
109  $sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
110  } else {
111  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
112  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
113  $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
114  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
115  $sql1 .= " AND fd.fk_code_ventilation = 0";
116  }*/
117 
118  // Supplier Invoice Lines (must be same request than into page list.php for manual binding)
119  $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
120  $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
121  $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
122  $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
123  $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
124  $sql .= " co.code as country_code, co.label as country_label,";
125  $sql .= " s.tva_intra";
126  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
127  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
128  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
129  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
130  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
131  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
132  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
133  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
134  $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
135  $sql .= " AND l.product_type <= 2";
136 
137  dol_syslog('htdocs/accountancy/supplier/index.php');
138 
139  $result = $db->query($sql);
140  if (!$result) {
141  $error++;
142  setEventMessages($db->lasterror(), null, 'errors');
143  } else {
144  $num_lines = $db->num_rows($result);
145 
146  $isBuyerInEEC = isInEEC($mysoc);
147 
148  $i = 0;
149  while ($i < min($num_lines, 10000)) { // No more than 10000 at once
150  $objp = $db->fetch_object($result);
151 
152  $isSellerInEEC = isInEEC($objp);
153 
154  // Search suggested account for product/service
155  $suggestedaccountingaccountfor = '';
156  if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
157  $objp->code_buy_p = $objp->code_buy;
158  $objp->aarowid_suggest = $objp->aarowid;
159  $suggestedaccountingaccountfor = '';
160  } else {
161  if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
162  $objp->code_buy_p = $objp->code_buy_intra;
163  $objp->aarowid_suggest = $objp->aarowid_intra;
164  $suggestedaccountingaccountfor = 'eec';
165  } else { // Foreign sale
166  $objp->code_buy_p = $objp->code_buy_export;
167  $objp->aarowid_suggest = $objp->aarowid_export;
168  $suggestedaccountingaccountfor = 'export';
169  }
170  }
171 
172  if ($objp->aarowid_suggest > 0)
173  {
174  $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
175  $sqlupdate .= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
176  $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
177 
178  $resqlupdate = $db->query($sqlupdate);
179  if (!$resqlupdate)
180  {
181  $error++;
182  setEventMessages($db->lasterror(), null, 'errors');
183  break;
184  }
185  }
186 
187  $i++;
188  }
189  }
190 
191  if ($error)
192  {
193  $db->rollback();
194  } else {
195  $db->commit();
196  setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
197  }
198 }
199 
200 
201 /*
202  * View
203  */
204 
205 llxHeader('', $langs->trans("SuppliersVentilation"));
206 
207 $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
208 $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
209 
210 print load_fiche_titre($langs->trans("SuppliersVentilation")." ".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy');
211 
212 print '<span class="opacitymedium">'.$langs->trans("DescVentilSupplier").'</span><br>';
213 print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'<br>';
214 print '</span><br>';
215 
216 $y = $year_current;
217 
218 $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
219 
220 
221 print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
222 //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
223 
224 print '<div class="div-table-responsive-no-min">';
225 print '<table class="noborder centpercent">';
226 print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>';
227 print '<td width="200" class="left">'.$langs->trans("Label").'</td>';
228 for ($i = 1; $i <= 12; $i++) {
229  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
230  if ($j > 12) $j -= 12;
231  print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
232 }
233 print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
234 
235 $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
236 $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
237 for ($i = 1; $i <= 12; $i++) {
238  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
239  if ($j > 12) $j -= 12;
240  $sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
241 }
242 $sql .= " SUM(ffd.total_ht) as total";
243 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
244 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
245 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
246 $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
247 $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
248 // Define begin binding date
249 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
250  $sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
251 }
252 $sql .= " AND ff.fk_statut > 0";
253 $sql .= " AND ffd.product_type <= 2";
254 $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
255 $sql .= " AND aa.account_number IS NULL";
256 $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
257 
258 dol_syslog('htdocs/accountancy/supplier/index.php');
259 $resql = $db->query($sql);
260 if ($resql) {
261  $num = $db->num_rows($resql);
262 
263  while ($row = $db->fetch_row($resql)) {
264  print '<tr class="oddeven"><td>';
265  if ($row[0] == 'tobind')
266  {
267  print $langs->trans("Unknown");
268  } else print length_accountg($row[0]);
269  print '</td>';
270  print '<td class="left">';
271  if ($row[0] == 'tobind')
272  {
273  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
274  } else print $row[1];
275  print '</td>';
276  for ($i = 2; $i <= 12; $i++) {
277  print '<td class="nowrap right">'.price($row[$i]).'</td>';
278  }
279  print '<td class="nowrap right">'.price($row[13]).'</td>';
280  print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
281  print '</tr>';
282  }
283  $db->free($resql);
284 } else {
285  print $db->lasterror(); // Show last sql error
286 }
287 print "</table>\n";
288 print '</div>';
289 
290 
291 print '<br>';
292 
293 
294 print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
295 //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
296 
297 print '<div class="div-table-responsive-no-min">';
298 print '<table class="noborder centpercent">';
299 print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>';
300 print '<td width="200" class="left">'.$langs->trans("Label").'</td>';
301 for ($i = 1; $i <= 12; $i++) {
302  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
303  if ($j > 12) $j -= 12;
304  print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
305 }
306 print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
307 
308 $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
309 $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
310 for ($i = 1; $i <= 12; $i++) {
311  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
312  if ($j > 12) $j -= 12;
313  $sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
314 }
315 $sql .= " SUM(ffd.total_ht) as total";
316 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
317 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
318 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
319 $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
320 $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
321 // Define begin binding date
322 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
323  $sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
324 }
325 $sql .= " AND ff.fk_statut > 0";
326 $sql .= " AND ffd.product_type <= 2";
327 $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
328 $sql .= " AND aa.account_number IS NOT NULL";
329 $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
330 
331 dol_syslog('htdocs/accountancy/supplier/index.php');
332 $resql = $db->query($sql);
333 if ($resql) {
334  $num = $db->num_rows($resql);
335 
336  while ($row = $db->fetch_row($resql)) {
337  print '<tr class="oddeven"><td>';
338  if ($row[0] == 'tobind')
339  {
340  print $langs->trans("Unknown");
341  } else print length_accountg($row[0]);
342  print '</td>';
343  print '<td class="left">';
344  if ($row[0] == 'tobind')
345  {
346  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
347  } else print $row[1];
348  print '</td>';
349  for ($i = 2; $i <= 12; $i++) {
350  print '<td class="nowrap right">'.price($row[$i]).'</td>';
351  }
352  print '<td class="nowrap right">'.price($row[13]).'</td>';
353  print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
354  print '</tr>';
355  }
356  $db->free($resql);
357 } else {
358  print $db->lasterror(); // Show last sql error
359 }
360 print "</table>\n";
361 print '</div>';
362 
363 
364 
365 if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
366 {
367  print '<br>';
368  print '<br>';
369 
370  print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
371  //print load_fiche_titre($langs->trans("OtherInfo"), '', '');
372 
373  print '<div class="div-table-responsive-no-min">';
374  print '<table class="noborder centpercent">';
375  print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>';
376  for ($i = 1; $i <= 12; $i++) {
377  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
378  if ($j > 12) $j -= 12;
379  print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
380  }
381  print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
382 
383  $sql = "SELECT '".$db->escape($langs->trans("CAHTF"))."' AS label,";
384  for ($i = 1; $i <= 12; $i++) {
385  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
386  if ($j > 12) $j -= 12;
387  $sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
388  }
389  $sql .= " SUM(ffd.total_ht) as total";
390  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
391  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
392  $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
393  $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
394  // Define begin binding date
395  if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
396  $sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
397  }
398  $sql .= " AND ff.fk_statut > 0";
399  $sql .= " AND ffd.product_type <= 2";
400  $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
401 
402  dol_syslog('htdocs/accountancy/supplier/index.php');
403  $resql = $db->query($sql);
404  if ($resql) {
405  $num = $db->num_rows($resql);
406 
407  while ($row = $db->fetch_row($resql)) {
408  print '<tr><td>'.$row[0].'</td>';
409  for ($i = 1; $i <= 12; $i++) {
410  print '<td class="nowrap right">'.price($row[$i]).'</td>';
411  }
412  print '<td class="nowrap right"><b>'.price($row[13]).'</b></td>';
413  print '</tr>';
414  }
415  $db->free($resql);
416  } else {
417  print $db->lasterror(); // Show last sql error
418  }
419  print "</table>\n";
420  print '</div>';
421 }
422 
423 // End of page
424 llxFooter();
425 $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.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
img_next($titlealt= 'default', $moreatt= '')
Show next logo.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
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
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_previous($titlealt= 'default', $moreatt= '')
Show previous logo.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...
llxFooter()
Empty footer.
Definition: wrapper.php:59
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)