dolibarr  17.0.2
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-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
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 <https://www.gnu.org/licenses/>.
20  *
21  */
22 
29 // Load Dolibarr environment
30 require '../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
36 
37 // Load translation files required by the page
38 $langs->loadLangs(array("compta", "bills", "other", "accountancy"));
39 
40 $validatemonth = GETPOST('validatemonth', 'int');
41 $validateyear = GETPOST('validateyear', 'int');
42 
43 // Security check
44 if (!isModEnabled('accounting')) {
46 }
47 if ($user->socid > 0) {
49 }
50 if (!$user->hasRight('accounting', 'bind', 'write')) {
52 }
53 
54 $accountingAccount = new AccountingAccount($db);
55 
56 $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
57 if (GETPOST("year", 'int')) {
58  $year_start = GETPOST("year", 'int');
59 } else {
60  $year_start = dol_print_date(dol_now(), '%Y');
61  if (dol_print_date(dol_now(), '%m') < $month_start) {
62  $year_start--; // If current month is lower that starting fiscal month, we start last year
63  }
64 }
65 $year_end = $year_start + 1;
66 $month_end = $month_start - 1;
67 if ($month_end < 1) {
68  $month_end = 12;
69  $year_end--;
70 }
71 $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
72 $search_date_end = dol_get_last_day($year_end, $month_end);
73 $year_current = $year_start;
74 
75 // Validate History
76 $action = GETPOST('action', 'aZ09');
77 
78 $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
79 
80 // Security check
81 if (!isModEnabled('accounting')) {
83 }
84 if ($user->socid > 0) {
86 }
87 if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
89 }
90 
91 
92 /*
93  * Actions
94  */
95 
96 if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
97  // Clean database by removing binding done on non existing or no more existing accounts
98  $db->begin();
99  $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
100  $sql1 .= " SET fk_code_ventilation = 0";
101  $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN';
102  $sql1 .= ' (SELECT accnt.rowid ';
103  $sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
104  $sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
105  $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
106  $sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.((int) $conf->entity).')';
107  $sql1 .= ' AND fk_code_ventilation <> 0';
108 
109  dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
110  $resql1 = $db->query($sql1);
111  if (!$resql1) {
112  $error++;
113  $db->rollback();
114  setEventMessages($db->lasterror(), null, 'errors');
115  } else {
116  $db->commit();
117  }
118  // End clean database
119 }
120 
121 if ($action == 'validatehistory') {
122  $error = 0;
123  $nbbinddone = 0;
124  $notpossible = 0;
125 
126  $db->begin();
127 
128  // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
129  /*if ($db->type == 'pgsql') {
130  $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
131  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
132  $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
133  $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
134  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
135  $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
136  } else {
137  $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";
138  $sql1 .= " SET fk_code_ventilation = accnt.rowid";
139  $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
140  $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
141  $sql1 .= " AND fd.fk_code_ventilation = 0";
142  }*/
143 
144  // Customer Invoice lines (must be same request than into page list.php for manual binding)
145  $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
146  $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.situation_percent, l.tva_tx as tva_tx_line, l.vat_src_code,";
147  $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
148  if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
149  $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
150  } else {
151  $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
152  }
153  $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
154  $sql .= " co.code as country_code, co.label as country_label,";
155  $sql .= " s.tva_intra,";
156  if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
157  $sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
158  } else {
159  $sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
160  }
161  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
162  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
163  if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
164  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
165  }
166  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
167  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
168  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
169  if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
170  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
171  }
172  $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
173  $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
174  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
175  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
176  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
177  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
178  $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
179  $sql .= " AND l.product_type <= 2";
180  $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
181  if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
182  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
183  }
184  if ($validatemonth && $validateyear) {
185  $sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
186  }
187 
188  dol_syslog('htdocs/accountancy/customer/index.php');
189 
190  $result = $db->query($sql);
191  if (!$result) {
192  $error++;
193  setEventMessages($db->lasterror(), null, 'errors');
194  } else {
195  $num_lines = $db->num_rows($result);
196 
197  $facture_static = new Facture($db);
198 
199  $isSellerInEEC = isInEEC($mysoc);
200 
201  $thirdpartystatic = new Societe($db);
202  $facture_static = new Facture($db);
203  $facture_static_det = new FactureLigne($db);
204  $product_static = new Product($db);
205 
206  $i = 0;
207  while ($i < min($num_lines, 10000)) { // No more than 10000 at once
208  $objp = $db->fetch_object($result);
209 
210  $thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
211  $thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
212  $thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
213  $thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
214  $thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
215  $thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
216  $thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
217  $thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
218  $thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
219  $thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
220  $thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : "";
221  $thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion)
222 
223  $product_static->ref = $objp->product_ref;
224  $product_static->id = $objp->product_id;
225  $product_static->type = $objp->type;
226  $product_static->label = $objp->product_label;
227  $product_static->status = !empty($objp->status) ? $objp->status : 0;
228  $product_static->status_buy = !empty($objp->status_buy) ? $objp->status_buy : 0;
229  $product_static->accountancy_code_sell = $objp->code_sell;
230  $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
231  $product_static->accountancy_code_sell_export = $objp->code_sell_export;
232  $product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
233  $product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
234  $product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
235  $product_static->tva_tx = $objp->tva_tx_prod;
236 
237  $facture_static->ref = $objp->ref;
238  $facture_static->id = $objp->facid;
239  $facture_static->type = $objp->ftype;
240  $facture_static->date = $db->jdate($objp->datef);
241  $facture_static->fk_facture_source = $objp->fk_facture_source;
242 
243  $facture_static_det->id = $objp->rowid;
244  $facture_static_det->total_ht = $objp->total_ht;
245  $facture_static_det->tva_tx = $objp->tva_tx_line;
246  $facture_static_det->vat_src_code = $objp->vat_src_code;
247  $facture_static_det->product_type = $objp->type_l;
248  $facture_static_det->desc = $objp->description;
249 
250  $accountingAccountArray = array(
251  'dom'=>$objp->aarowid,
252  'intra'=>$objp->aarowid_intra,
253  'export'=>$objp->aarowid_export,
254  'thirdparty' =>$objp->aarowid_thirdparty);
255 
256  $code_sell_p_notset = '';
257  $code_sell_t_notset = '';
258 
259  $suggestedid = 0;
260 
261  $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
262  if (!is_array($return) && $return < 0) {
263  setEventMessage($accountingAccount->error, 'errors');
264  } else {
265  $suggestedid = $return['suggestedid'];
266  $suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
267 
268  if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
269  $suggestedid = $return['suggestedid'];
270  } else {
271  $suggestedid = 0;
272  }
273  }
274 
275  if ($suggestedid > 0) {
276  $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
277  $sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
278  $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
279 
280  $resqlupdate = $db->query($sqlupdate);
281  if (!$resqlupdate) {
282  $error++;
283  setEventMessages($db->lasterror(), null, 'errors');
284  break;
285  } else {
286  $nbbinddone++;
287  }
288  } else {
289  $notpossible++;
290  }
291 
292  $i++;
293  }
294  if ($num_lines > 10000) {
295  $notpossible += ($num_lines - 10000);
296  }
297  }
298 
299  if ($error) {
300  $db->rollback();
301  } else {
302  $db->commit();
303  setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
304  }
305 }
306 
307 
308 /*
309  * View
310  */
311 
312 llxHeader('', $langs->trans("CustomersVentilation"));
313 
314 $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
315 $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
316 
317 
318 print load_fiche_titre($langs->trans("CustomersVentilation")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
319 
320 print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer").'</span><br>';
321 print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'<br>';
322 print '</span><br>';
323 
324 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
325  print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
326  print "<br>";
327 }
328 
329 $y = $year_current;
330 
331 $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
332 
333 print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
334 //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
335 
336 print '<div class="div-table-responsive-no-min">';
337 print '<table class="noborder centpercent">';
338 print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
339 print '<td>'.$langs->trans("Label").'</td>';
340 for ($i = 1; $i <= 12; $i++) {
341  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
342  if ($j > 12) {
343  $j -= 12;
344  }
345  $cursormonth = $j;
346  if ($cursormonth > 12) {
347  $cursormonth -= 12;
348  }
349  $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
350  $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
351 
352  print '<td width="60" class="right">';
353  if (!empty($tmp['mday'])) {
354  $param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
355  $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
356  print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/list.php?'.$param.'">';
357  }
358  print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
359  if (!empty($tmp['mday'])) {
360  print '</a>';
361  }
362  print '</td>';
363 }
364 print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
365 
366 $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
367 $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
368 for ($i = 1; $i <= 12; $i++) {
369  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
370  if ($j > 12) {
371  $j -= 12;
372  }
373  $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
374 }
375 $sql .= " SUM(fd.total_ht) as total";
376 $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
377 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
378 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
379 $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
380 $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
381 // Define begin binding date
382 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
383  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
384 }
385 $sql .= " AND f.fk_statut > 0";
386 $sql .= " AND fd.product_type <= 2";
387 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
388 $sql .= " AND aa.account_number IS NULL";
389 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
390  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
391 } else {
392  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
393 }
394 $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
395 
396 dol_syslog('htdocs/accountancy/customer/index.php', LOG_DEBUG);
397 $resql = $db->query($sql);
398 if ($resql) {
399  $num = $db->num_rows($resql);
400 
401  while ($row = $db->fetch_row($resql)) {
402  // TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
403  //$situation_ratio = 1;
404  //if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
405  //}
406 
407  print '<tr class="oddeven">';
408  print '<td>';
409  if ($row[0] == 'tobind') {
410  print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
411  } else {
412  print length_accountg($row[0]);
413  }
414  print '</td>';
415  print '<td>';
416  if ($row[0] == 'tobind') {
417  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
418  } else {
419  print $row[1];
420  }
421  print '</td>';
422  for ($i = 2; $i <= 13; $i++) {
423  $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
424  if ($cursormonth > 12) {
425  $cursormonth -= 12;
426  }
427  $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
428  $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
429 
430  print '<td class="right nowraponall amount">';
431  print price($row[$i]);
432  print '</td>';
433  }
434  print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
435  print '</tr>';
436  }
437  $db->free($resql);
438 
439  if ($num == 0) {
440  print '<tr class="oddeven"><td colspan="16">';
441  print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
442  print '</td></tr>';
443  }
444 } else {
445  print $db->lasterror(); // Show last sql error
446 }
447 print "</table>\n";
448 print '</div>';
449 
450 
451 print '<br>';
452 
453 
454 print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
455 //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
456 
457 print '<div class="div-table-responsive-no-min">';
458 print '<table class="noborder centpercent">';
459 print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
460 print '<td>'.$langs->trans("Label").'</td>';
461 for ($i = 1; $i <= 12; $i++) {
462  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
463  if ($j > 12) {
464  $j -= 12;
465  }
466  $cursormonth = $j;
467  if ($cursormonth > 12) {
468  $cursormonth -= 12;
469  }
470  $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
471  $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
472 
473  print '<td width="60" class="right">';
474  if (!empty($tmp['mday'])) {
475  $param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
476  $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
477  print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php?'.$param.'">';
478  }
479  print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
480  if (!empty($tmp['mday'])) {
481  print '</a>';
482  }
483  print '</td>';
484 }
485 print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
486 
487 $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
488 $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
489 for ($i = 1; $i <= 12; $i++) {
490  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
491  if ($j > 12) {
492  $j -= 12;
493  }
494  $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
495 }
496 $sql .= " SUM(fd.total_ht) as total";
497 $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
498 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
499 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
500 $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
501 $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
502 // Define begin binding date
503 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
504  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
505 }
506 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
507 $sql .= " AND f.fk_statut > 0";
508 $sql .= " AND fd.product_type <= 2";
509 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
510  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
511 } else {
512  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
513 }
514 $sql .= " AND aa.account_number IS NOT NULL";
515 $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
516 $sql .= ' ORDER BY aa.account_number';
517 
518 dol_syslog('htdocs/accountancy/customer/index.php');
519 $resql = $db->query($sql);
520 if ($resql) {
521  $num = $db->num_rows($resql);
522 
523  while ($row = $db->fetch_row($resql)) {
524  // TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
525  //$situation_ratio = 1;
526  //if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
527  //}
528 
529  print '<tr class="oddeven">';
530  print '<td>';
531  if ($row[0] == 'tobind') {
532  print $langs->trans("Unknown");
533  } else {
534  print length_accountg($row[0]);
535  }
536  print '</td>';
537 
538  print '<td>';
539  if ($row[0] == 'tobind') {
540  print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
541  } else {
542  print $row[1];
543  }
544  print '</td>';
545 
546  for ($i = 2; $i <= 13; $i++) {
547  $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
548  if ($cursormonth > 12) {
549  $cursormonth -= 12;
550  }
551  $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
552  $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
553 
554  print '<td class="right nowraponall amount">';
555  print price($row[$i]);
556  print '</td>';
557  }
558  print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
559  print '</tr>';
560  }
561  $db->free($resql);
562 
563  if ($num == 0) {
564  print '<tr class="oddeven"><td colspan="16">';
565  print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
566  print '</td></tr>';
567  }
568 } else {
569  print $db->lasterror(); // Show last sql error
570 }
571 print "</table>\n";
572 print '</div>';
573 
574 
575 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 ?
576  print '<br>';
577  print '<br>';
578 
579  print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
580  //print load_fiche_titre($langs->trans("OtherInfo"), '', '');
581 
582  print '<div class="div-table-responsive-no-min">';
583  print '<table class="noborder centpercent">';
584  print '<tr class="liste_titre"><td lass="left">'.$langs->trans("TotalVente").'</td>';
585  for ($i = 1; $i <= 12; $i++) {
586  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
587  if ($j > 12) {
588  $j -= 12;
589  }
590  print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
591  }
592  print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
593 
594  $sql = "SELECT '".$db->escape($langs->trans("TotalVente"))."' AS total,";
595  for ($i = 1; $i <= 12; $i++) {
596  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
597  if ($j > 12) {
598  $j -= 12;
599  }
600  $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
601  }
602  $sql .= " SUM(fd.total_ht) as total";
603  $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
604  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
605  $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
606  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
607  // Define begin binding date
608  if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
609  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
610  }
611  $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
612  $sql .= " AND f.fk_statut > 0";
613  $sql .= " AND fd.product_type <= 2";
614  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
615  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
616  } else {
617  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
618  }
619 
620  dol_syslog('htdocs/accountancy/customer/index.php');
621  $resql = $db->query($sql);
622  if ($resql) {
623  $num = $db->num_rows($resql);
624 
625  while ($row = $db->fetch_row($resql)) {
626  print '<tr><td>'.$row[0].'</td>';
627  for ($i = 1; $i <= 12; $i++) {
628  print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
629  }
630  print '<td class="right nowraponall amount"><b>'.price($row[13]).'</b></td>';
631  print '</tr>';
632  }
633  $db->free($resql);
634  } else {
635  print $db->lasterror(); // Show last sql error
636  }
637  print "</table>\n";
638  print '</div>';
639 
640  if (isModEnabled('margin')) {
641  print "<br>\n";
642  print '<div class="div-table-responsive-no-min">';
643  print '<table class="noborder centpercent">';
644  print '<tr class="liste_titre"><td>'.$langs->trans("TotalMarge").'</td>';
645  for ($i = 1; $i <= 12; $i++) {
646  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
647  if ($j > 12) {
648  $j -= 12;
649  }
650  print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
651  }
652  print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
653 
654  if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
655  // With old situation invoice setup
656  $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
657  for ($i = 1; $i <= 12; $i++) {
658  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
659  if ($j > 12) {
660  $j -= 12;
661  }
662  $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
663  " (".$db->ifsql("fd.total_ht < 0",
664  " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
665  " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
666  0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
667  }
668  $sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
669  " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
670  " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
671  } else {
672  $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
673  for ($i = 1; $i <= 12; $i++) {
674  $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
675  if ($j > 12) {
676  $j -= 12;
677  }
678  $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
679  " (".$db->ifsql("fd.total_ht < 0",
680  " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
681  " (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
682  0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
683  }
684  $sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
685  " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
686  " (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
687  }
688  $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
689  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
690  $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
691  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
692  // Define begin binding date
693  if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
694  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
695  }
696  $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
697  $sql .= " AND f.fk_statut > 0";
698  $sql .= " AND fd.product_type <= 2";
699  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
700  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
701  } else {
702  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
703  }
704  dol_syslog('htdocs/accountancy/customer/index.php');
705  $resql = $db->query($sql);
706  if ($resql) {
707  $num = $db->num_rows($resql);
708 
709  while ($row = $db->fetch_row($resql)) {
710  print '<tr><td>'.$row[0].'</td>';
711  for ($i = 1; $i <= 12; $i++) {
712  print '<td class="right nowraponall amount">'.price(price2num($row[$i])).'</td>';
713  }
714  print '<td class="right nowraponall amount"><b>'.price(price2num($row[13])).'</b></td>';
715  print '</tr>';
716  }
717  $db->free($resql);
718  } else {
719  print $db->lasterror(); // Show last sql error
720  }
721  print "</table>\n";
722  print '</div>';
723  }
724 }
725 
726 // End of page
727 llxFooter();
728 $db->close();
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2820
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:49
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5360
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:520
Facture
Class to manage invoices.
Definition: facture.class.php:60
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5823
Facture\TYPE_DEPOSIT
const TYPE_DEPOSIT
Deposit invoice.
Definition: facture.class.php:392
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:2550
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:4024
Facture\TYPE_REPLACEMENT
const TYPE_REPLACEMENT
Replacement invoice.
Definition: facture.class.php:382
llxFooter
llxFooter()
Footer empty.
Definition: index.php:71
FactureLigne
Class to manage invoice lines.
Definition: facture.class.php:5747
img_next
img_next($titlealt='default', $moreatt='')
Show next logo.
Definition: functions.lib.php:4706
dol_getIdFromCode
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
Definition: functions.lib.php:8879
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
length_accountg
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
Definition: accounting.lib.php:94
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1628
setEventMessage
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
Definition: functions.lib.php:8436
print_barre_liste
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.
Definition: functions.lib.php:5413
llxHeader
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
Definition: index.php:63
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:594
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:4949
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11290
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:137
Facture\TYPE_CREDIT_NOTE
const TYPE_CREDIT_NOTE
Credit note invoice.
Definition: facture.class.php:387
AccountingAccount
Class to manage accounting accounts.
Definition: accountingaccount.class.php:36
Product
Class to manage products or services.
Definition: product.class.php:46
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2951
dolSqlDateFilter
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
Definition: date.lib.php:358
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:5697
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8465
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1117
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:2863
img_previous
img_previous($titlealt='default', $moreatt='')
Show previous logo.
Definition: functions.lib.php:4725
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:96
Facture\TYPE_SITUATION
const TYPE_SITUATION
Situation invoice.
Definition: facture.class.php:402
isInEEC
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
Definition: company.lib.php:779