dolibarr  7.0.0-beta
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
4  * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
5  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2015 Jean-Fran├žois Ferry <jfefe@aternatik.fr>
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  */
22 
29 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
32 require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
33 
34 // Langs
35 $langs->load("compta");
36 $langs->load("bills");
37 $langs->load("other");
38 $langs->load("main");
39 $langs->load("accountancy");
40 
41 // Security check
42 if (empty($conf->accounting->enabled)) {
44 }
45 if ($user->societe_id > 0)
47 if (! $user->rights->accounting->bind->write)
49 
50 // Filter
51 $year = GETPOST("year",'int');
52 if ($year == 0) {
53  $year_current = strftime("%Y", time());
54  $year_start = $year_current;
55 } else {
56  $year_current = $year;
57  $year_start = $year;
58 }
59 
60 // Validate History
61 $action = GETPOST('action','aZ09');
62 
63 
64 
65 /*
66  * Actions
67  */
68 
69 if ($action == 'validatehistory') {
70 
71  $error = 0;
72  $db->begin();
73 
74  // First clean corrupted data
75  $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
76  $sqlclean .= " SET fk_code_ventilation = 0";
77  $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN ';
78  $sqlclean .= ' (SELECT accnt.rowid ';
79  $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
80  $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
81  $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
82  $resql = $db->query($sqlclean);
83 
84  // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
85  if ($db->type == 'pgsql') {
86  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
87  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
88  $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
89  $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
90  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
91  $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
92  } else {
93  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
94  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
95  $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
96  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
97  $sql1 .= " AND fd.fk_code_ventilation = 0";
98  }
99 
100  dol_syslog('htdocs/accountancy/customer/index.php');
101 
102  $resql1 = $db->query($sql1);
103  if (! $resql1) {
104  $error ++;
105  $db->rollback();
106  setEventMessages($db->lasterror(), null, 'errors');
107  } else {
108  $db->commit();
109  setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
110  }
111 } elseif ($action == 'cleanaccountancycode') {
112  $error = 0;
113  $db->begin();
114 
115  // Now clean
116  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
117  $sql1.= " SET fk_code_ventilation = 0";
118  $sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
119  $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
120  $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
121  $sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
122  $sql1.=")";
123 
124  dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
125 
126  $resql1 = $db->query($sql1);
127  if (! $resql1) {
128  $error ++;
129  $db->rollback();
130  setEventMessage($db->lasterror(), 'errors');
131  } else {
132  $db->commit();
133  setEventMessage($langs->trans('Done'), 'mesgs');
134  }
135 }
136 
137 
138 /*
139  * View
140  */
141 
142 llxHeader('', $langs->trans("CustomersVentilation"));
143 
144 $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
145 $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
146 
147 print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
148 
149 // Clean database
150 $db->begin();
151 $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
152 $sql1 .= " SET fk_code_ventilation = 0";
153 $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
154 $sql1 .= ' (SELECT accnt.rowid ';
155 $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
156 $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
157 $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
158 dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
159 $resql1 = $db->query($sql1);
160 if (! $resql1) {
161  $error ++;
162  $db->rollback();
163  setEventMessage($db->lasterror(), 'errors');
164 } else {
165  $db->commit();
166 }
167 // End clean database
168 
169 print $langs->trans("DescVentilCustomer") . '<br>';
170 print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
171 print '<br>';
172 
173 $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
174 $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
175 $sql .= " WHERE fd.fk_code_ventilation = 0";
176 $sql .= " AND f.rowid = fd.fk_facture";
177 $sql .= " AND f.fk_statut > 0";
178 if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
179  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
180 } else {
181  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
182 }
183 $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
184 
185 dol_syslog('htdocs/accountancy/customer/index.php');
186 $result = $db->query($sql);
187 if ($result) {
188  $row = $db->fetch_row($result);
189  $nbfac = $row[0];
190  $db->free($result);
191 }
192 
193 $y = $year_current;
194 
195 $buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
196 $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
197 
198 
199 print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
200 
201 print '<div class="div-table-responsive-no-min">';
202 print '<table class="noborder" width="100%">';
203 print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
204 print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
205 for($i = 1; $i <= 12; $i ++) {
206  print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
207 }
208 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
209 
210 $sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
211 $sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
212 for($i = 1; $i <= 12; $i ++) {
213  $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
214 }
215 $sql .= " SUM(fd.total_ht) as total";
216 $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
217 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
218 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
219 $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
220 $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
221 $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
222 $sql .= " AND aa.account_number IS NULL";
223 if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
224  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
225 } else {
226  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
227 }
228 $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
229 
230 dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG);
231 $resql = $db->query($sql);
232 if ($resql) {
233  $num = $db->num_rows($resql);
234 
235  while ( $row = $db->fetch_row($resql)) {
236 
237  print '<tr class="oddeven"><td>';
238  if ($row[0] == 'tobind')
239  {
240  print $langs->trans("Unknown");
241  }
242  else print length_accountg($row[0]);
243  print '</td>';
244  print '<td align="left">';
245  if ($row[0] == 'tobind')
246  {
247  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
248  }
249  else print $row[1];
250  print '</td>';
251  for($i = 2; $i <= 12; $i ++) {
252  print '<td align="right">' . price($row[$i]) . '</td>';
253  }
254  print '<td align="right">' . price($row[13]) . '</td>';
255  print '<td align="right"><b>' . price($row[14]) . '</b></td>';
256  print '</tr>';
257  }
258  $db->free($resql);
259 } else {
260  print $db->lasterror(); // Show last sql error
261 }
262 print "</table>\n";
263 print '</div>';
264 
265 print '<br>';
266 
267 
268 print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
269 
270 print '<div class="div-table-responsive-no-min">';
271 print '<table class="noborder" width="100%">';
272 print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
273 print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
274 for($i = 1; $i <= 12; $i ++) {
275  print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
276 }
277 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
278 
279 $sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
280 $sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
281 for($i = 1; $i <= 12; $i ++) {
282  $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
283 }
284 $sql .= " SUM(fd.total_ht) as total";
285 $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
286 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
287 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
288 $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
289 $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
290 $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
291 if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
292  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
293 } else {
294  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
295 }
296 $sql .= " AND aa.account_number IS NOT NULL";
297 $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
298 
299 dol_syslog('htdocs/accountancy/customer/index.php');
300 $resql = $db->query($sql);
301 if ($resql) {
302  $num = $db->num_rows($resql);
303 
304  while ( $row = $db->fetch_row($resql)) {
305 
306  print '<tr class="oddeven"><td>';
307  if ($row[0] == 'tobind')
308  {
309  print $langs->trans("Unknown");
310  }
311  else print length_accountg($row[0]);
312  print '</td>';
313 
314  print '<td align="left">';
315  if ($row[0] == 'tobind')
316  {
317  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
318  }
319  else print $row[1];
320  print '</td>';
321 
322  for($i = 2; $i <= 12; $i ++) {
323  print '<td align="right">' . price($row[$i]) . '</td>';
324  }
325  print '<td align="right">' . price($row[13]) . '</td>';
326  print '<td align="right"><b>' . price($row[14]) . '</b></td>';
327  print '</tr>';
328  }
329  $db->free($resql);
330 } else {
331  print $db->lasterror(); // Show last sql error
332 }
333 print "</table>\n";
334 print '</div>';
335 
336 
337 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 ?
338 {
339  print '<br>';
340  print '<br>';
341 
342  print_fiche_titre($langs->trans("OtherInfo"), '', '');
343 
344  print '<div class="div-table-responsive-no-min">';
345  print '<table class="noborder" width="100%">';
346  print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
347  for($i = 1; $i <= 12; $i ++) {
348  print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
349  }
350  print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
351 
352  $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
353  for($i = 1; $i <= 12; $i ++) {
354  $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
355  }
356  $sql .= " SUM(fd.total_ht) as total";
357  $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
358  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
359  $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
360  $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
361  $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
362  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
363  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
364  } else {
365  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
366  }
367 
368  dol_syslog('htdocs/accountancy/customer/index.php');
369  $resql = $db->query($sql);
370  if ($resql) {
371  $num = $db->num_rows($resql);
372 
373  while ($row = $db->fetch_row($resql)) {
374  print '<tr><td>' . $row[0] . '</td>';
375  for($i = 1; $i <= 12; $i ++) {
376  print '<td align="right">' . price($row[$i]) . '</td>';
377  }
378  print '<td align="right"><b>' . price($row[13]) . '</b></td>';
379  print '</tr>';
380  }
381  $db->free($resql);
382  } else {
383  print $db->lasterror(); // Show last sql error
384  }
385  print "</table>\n";
386  print '</div>';
387 
388 
389  if (! empty($conf->margin->enabled)) {
390  print "<br>\n";
391  print '<div class="div-table-responsive-no-min">';
392  print '<table class="noborder" width="100%">';
393  print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
394  for($i = 1; $i <= 12; $i ++) {
395  print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
396  }
397  print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
398 
399  $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
400  for($i = 1; $i <= 12; $i ++) {
401  $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
402  }
403  $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
404  $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
405  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
406  $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
407  $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
408  $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
409  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
410  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
411  } else {
412  $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
413  }
414 
415  dol_syslog('htdocs/accountancy/customer/index.php');
416  $resql = $db->query($sql);
417  if ($resql) {
418  $num = $db->num_rows($resql);
419 
420  while ($row = $db->fetch_row($resql)) {
421 
422  print '<tr><td>' . $row[0] . '</td>';
423  for($i = 1; $i <= 12; $i ++) {
424  print '<td align="right">' . price(price2num($row[$i])) . '</td>';
425  }
426  print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
427  print '</tr>';
428  }
429  $db->free($resql);
430  } else {
431  print $db->lasterror(); // Show last sql error
432  }
433  print "</table>\n";
434  print '</div>';
435  }
436 }
437 
438 
439 llxFooter();
440 $db->close();
llxFooter()
Footer empty.
Definition: index.php:43
const TYPE_STANDARD
Standard invoice.
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
img_previous($titlealt= 'default', $moreatt='')
Show previous logo.
const TYPE_REPLACEMENT
Replacement invoice.
img_next($titlealt= 'default', $moreatt='')
Show next logo.
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
const TYPE_SITUATION
Situation invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
llxHeader()
Header empty.
Definition: index.php:37
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
getEntity($element, $shared=1, $forceentity=null)
Get list of entity id to use.
print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id='')
Show a title with picto.
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...
const TYPE_DEPOSIT
Deposit invoice.
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
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->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)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is '...