dolibarr  16.0.5
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
4  * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5  * Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
8  * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
29 require '../../main.inc.php';
30 
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
41 
42 // Load translation files required by the page
43 $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
44 
45 $action = GETPOST('action', 'aZ09');
46 $massaction = GETPOST('massaction', 'alpha');
47 $show_files = GETPOST('show_files', 'int');
48 $confirm = GETPOST('confirm', 'alpha');
49 $toselect = GETPOST('toselect', 'array');
50 $optioncss = GETPOST('optioncss', 'alpha');
51 $default_account = GETPOST('default_account', 'int');
52 
53 // Select Box
54 $mesCasesCochees = GETPOST('toselect', 'array');
55 
56 // Search Getpost
57 $search_societe = GETPOST('search_societe', 'alpha');
58 $search_lineid = GETPOST('search_lineid', 'int');
59 $search_ref = GETPOST('search_ref', 'alpha');
60 $search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
61 $search_invoice = GETPOST('search_invoice', 'alpha');
62 $search_label = GETPOST('search_label', 'alpha');
63 $search_desc = GETPOST('search_desc', 'alpha');
64 $search_amount = GETPOST('search_amount', 'alpha');
65 $search_account = GETPOST('search_account', 'alpha');
66 $search_vat = GETPOST('search_vat', 'alpha');
67 $search_date_startday = GETPOST('search_date_startday', 'int');
68 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
69 $search_date_startyear = GETPOST('search_date_startyear', 'int');
70 $search_date_endday = GETPOST('search_date_endday', 'int');
71 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
72 $search_date_endyear = GETPOST('search_date_endyear', 'int');
73 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
74 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
75 $search_country = GETPOST('search_country', 'alpha');
76 $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
77 
78 $btn_ventil = GETPOST('ventil', 'alpha');
79 
80 // Load variable for pagination
81 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
82 $sortfield = GETPOST('sortfield', 'aZ09comma');
83 $sortorder = GETPOST('sortorder', 'aZ09comma');
84 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
85 if (empty($page) || $page < 0) {
86  $page = 0;
87 }
88 $offset = $limit * $page;
89 $pageprev = $page - 1;
90 $pagenext = $page + 1;
91 if (!$sortfield) {
92  $sortfield = "f.datef, f.ref, l.rowid";
93 }
94 if (!$sortorder) {
95  if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
96  $sortorder = "DESC";
97  }
98 }
99 
100 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
101 $hookmanager->initHooks(array('accountancysupplierlist'));
102 
103 $formaccounting = new FormAccounting($db);
104 $accountingAccount = new AccountingAccount($db);
105 
106 $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
107 
108 // Security check
109 if (!isModEnabled('accounting')) {
110  accessforbidden();
111 }
112 if ($user->socid > 0) {
113  accessforbidden();
114 }
115 if (empty($user->rights->accounting->mouvements->lire)) {
116  accessforbidden();
117 }
118 
119 
120 /*
121  * Actions
122  */
123 
124 if (GETPOST('cancel', 'alpha')) {
125  $action = 'list'; $massaction = '';
126 }
127 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
128  $massaction = '';
129 }
130 
131 $parameters = array();
132 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
133 if ($reshook < 0) {
134  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
135 }
136 
137 if (empty($reshook)) {
138  // Purge search criteria
139  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
140  $search_societe = '';
141  $search_lineid = '';
142  $search_ref = '';
143  $search_ref_supplier = '';
144  $search_invoice = '';
145  $search_label = '';
146  $search_desc = '';
147  $search_amount = '';
148  $search_account = '';
149  $search_vat = '';
150  $search_date_startday = '';
151  $search_date_startmonth = '';
152  $search_date_startyear = '';
153  $search_date_endday = '';
154  $search_date_endmonth = '';
155  $search_date_endyear = '';
156  $search_date_start = '';
157  $search_date_end = '';
158  $search_country = '';
159  $search_tvaintra = '';
160  }
161 
162  // Mass actions
163  $objectclass = 'AccountingAccount';
164  $permissiontoread = $user->hasRight('accounting', 'read');
165  $permissiontodelete = $user->hasRight('accounting', 'delete');
166  $uploaddir = $conf->accounting->dir_output;
167  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
168 }
169 
170 
171 if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
172  $msg = '';
173 
174  //print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
175  if (!empty($mesCasesCochees)) {
176  $msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
177  $msg .= '<div class="detail">';
178  $cpt = 0;
179  $ok = 0;
180  $ko = 0;
181 
182  foreach ($mesCasesCochees as $maLigneCochee) {
183  $maLigneCourante = explode("_", $maLigneCochee);
184  $monId = $maLigneCourante[0];
185  $monCompte = GETPOST('codeventil'.$monId);
186 
187  if ($monCompte <= 0) {
188  $msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
189  $ko++;
190  } else {
191  $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
192  $sql .= " SET fk_code_ventilation = ".((int) $monCompte);
193  $sql .= " WHERE rowid = ".((int) $monId);
194 
195  $accountventilated = new AccountingAccount($db);
196  $accountventilated->fetch($monCompte, '', 1);
197 
198  dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
199  if ($db->query($sql)) {
200  $msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
201  $ok++;
202  } else {
203  $msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
204  $ko++;
205  }
206  }
207 
208  $cpt++;
209  }
210  $msg .= '</div>';
211  $msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
212  }
213 }
214 
215 
216 
217 /*
218  * View
219  */
220 
221 $form = new Form($db);
222 $formother = new FormOther($db);
223 
224 llxHeader('', $langs->trans("SuppliersVentilation"));
225 
226 if (empty($chartaccountcode)) {
227  print $langs->trans("ErrorChartOfAccountSystemNotSelected");
228  // End of page
229  llxFooter();
230  $db->close();
231  exit;
232 }
233 
234 // Supplier Invoice Lines
235 $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
236 $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,";
237 $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,";
238 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
239  $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,";
240  $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
241 } else {
242  $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,";
243  $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,";
244 }
245 $sql .= " p.tosell as status, p.tobuy as status_buy,";
246 $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
247 $sql .= " co.code as country_code, co.label as country_label,";
248 $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur,";
249 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
250  $sql .= " spe.accountancy_code_customer as code_compta_client,";
251  $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
252  $sql .= " spe.accountancy_code_buy as company_code_buy";
253 } else {
254  $sql .= " s.code_compta as code_compta_client,";
255  $sql .= " s.code_compta_fournisseur,";
256  $sql .= " s.accountancy_code_buy as company_code_buy";
257 }
258 $parameters = array();
259 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
260 $sql .= $hookmanager->resPrint;
261 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
262 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
263 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
264  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
265 }
266 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
267 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
268 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
269 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
270  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
271 }
272 $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
273 $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
274 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
275 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
276 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
277 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
278 $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
279 $sql .= " AND l.product_type <= 2";
280 // Define begin binding date
281 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
282  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
283 }
284 // Add search filter like
285 if ($search_societe) {
286  $sql .= natural_search('s.nom', $search_societe);
287 }
288 if ($search_lineid) {
289  $sql .= natural_search("l.rowid", $search_lineid, 1);
290 }
291 if (strlen(trim($search_invoice))) {
292  $sql .= natural_search("f.ref", $search_invoice);
293 }
294 if (strlen(trim($search_ref))) {
295  $sql .= natural_search("p.ref", $search_ref);
296 }
297 if (strlen(trim($search_ref_supplier))) {
298  $sql .= natural_search("f.ref_supplier", $search_ref_supplier);
299 }
300 if (strlen(trim($search_label))) {
301  $sql .= natural_search(array("p.label", "f.libelle"), $search_label);
302 }
303 if (strlen(trim($search_desc))) {
304  $sql .= natural_search("l.description", $search_desc);
305 }
306 if (strlen(trim($search_amount))) {
307  $sql .= natural_search("l.total_ht", $search_amount, 1);
308 }
309 if (strlen(trim($search_account))) {
310  $sql .= natural_search("aa.account_number", $search_account);
311 }
312 if (strlen(trim($search_vat))) {
313  $sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
314 }
315 if ($search_date_start) {
316  $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
317 }
318 if ($search_date_end) {
319  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
320 }
321 if (strlen(trim($search_country))) {
322  $arrayofcode = getCountriesInEEC();
323  $country_code_in_EEC = $country_code_in_EEC_without_me = '';
324  foreach ($arrayofcode as $key => $value) {
325  $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
326  if ($value != $mysoc->country_code) {
327  $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
328  }
329  }
330  if ($search_country == 'special_allnotme') {
331  $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
332  } elseif ($search_country == 'special_eec') {
333  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
334  } elseif ($search_country == 'special_eecnotme') {
335  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
336  } elseif ($search_country == 'special_noteec') {
337  $sql .= " AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
338  } else {
339  $sql .= natural_search("co.code", $search_country);
340  }
341 }
342 if (strlen(trim($search_tvaintra))) {
343  $sql .= natural_search("s.tva_intra", $search_tvaintra);
344 }
345 if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
346  $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
347 } else {
348  $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
349 }
350 $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
351 
352 // Add where from hooks
353 $parameters = array();
354 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
355 $sql .= $hookmanager->resPrint;
356 
357 $sql .= $db->order($sortfield, $sortorder);
358 
359 // Count total nb of records
360 $nbtotalofrecords = '';
361 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
362  $result = $db->query($sql);
363  $nbtotalofrecords = $db->num_rows($result);
364  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
365  $page = 0;
366  $offset = 0;
367  }
368 }
369 
370 $sql .= $db->plimit($limit + 1, $offset);
371 
372 dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
373 // MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso)
374 // This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security
375 if ($db->type == 'mysqli') {
376  $db->query("SET SQL_BIG_SELECTS=1");
377 }
378 
379 $result = $db->query($sql);
380 if ($result) {
381  $num_lines = $db->num_rows($result);
382  $i = 0;
383 
384  $arrayofselected = is_array($toselect) ? $toselect : array();
385 
386  $param = '';
387  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
388  $param .= '&contextpage='.urlencode($contextpage);
389  }
390  if ($limit > 0 && $limit != $conf->liste_limit) {
391  $param .= '&limit='.urlencode($limit);
392  }
393  if ($search_societe) {
394  $param .= '&search_societe='.urlencode($search_societe);
395  }
396  if ($search_lineid) {
397  $param .= '&search_lineid='.urlencode($search_lineid);
398  }
399  if ($search_date_startday) {
400  $param .= '&search_date_startday='.urlencode($search_date_startday);
401  }
402  if ($search_date_startmonth) {
403  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
404  }
405  if ($search_date_startyear) {
406  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
407  }
408  if ($search_date_endday) {
409  $param .= '&search_date_endday='.urlencode($search_date_endday);
410  }
411  if ($search_date_endmonth) {
412  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
413  }
414  if ($search_date_endyear) {
415  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
416  }
417  if ($search_invoice) {
418  $param .= '&search_invoice='.urlencode($search_invoice);
419  }
420  if ($search_ref) {
421  $param .= '&search_ref='.urlencode($search_ref);
422  }
423  if ($search_ref_supplier) {
424  $param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
425  }
426  if ($search_label) {
427  $param .= '&search_label='.urlencode($search_label);
428  }
429  if ($search_desc) {
430  $param .= '&search_desc='.urlencode($search_desc);
431  }
432  if ($search_amount) {
433  $param .= '&search_amount='.urlencode($search_amount);
434  }
435  if ($search_vat) {
436  $param .= '&search_vat='.urlencode($search_vat);
437  }
438  if ($search_country) {
439  $param .= "&search_country=".urlencode($search_country);
440  }
441  if ($search_tvaintra) {
442  $param .= "&search_tvaintra=".urlencode($search_tvaintra);
443  }
444 
445  $arrayofmassactions = array(
446  'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
447  ,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
448  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
449  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
450  );
451  //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
452  //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
453  if ($massaction !== 'set_default_account') {
454  $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
455  }
456 
457  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
458  print '<input type="hidden" name="action" value="ventil">';
459  if ($optioncss != '') {
460  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
461  }
462  print '<input type="hidden" name="token" value="'.newToken().'">';
463  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
464  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
465  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
466  print '<input type="hidden" name="page" value="'.$page.'">';
467 
468  print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
469 
470  if ($massaction == 'set_default_account') {
471  $formquestion[]=array('type' => 'other',
472  'name' => 'set_default_account',
473  'label' => $langs->trans("AccountancyCode"),
474  'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
475  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
476  }
477 
478  print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
479 
480  if (!empty($msg)) {
481  print $msg.'<br>';
482  }
483 
484  $moreforfilter = '';
485 
486  print '<div class="div-table-responsive">';
487  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
488 
489  // We add search filter
490  print '<tr class="liste_titre_filter">';
491  print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
492  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
493  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
494  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
495  print '<td class="liste_titre center">';
496  print '<div class="nowrap">';
497  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
498  print '</div>';
499  print '<div class="nowrap">';
500  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
501  print '</div>';
502  print '</td>';
503  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
504  print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
505  print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
506  print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
507  print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
508  print '<td class="liste_titre">';
509  print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
510  //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
511  print '</td>';
512  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
513  print '<td class="liste_titre"></td>';
514  print '<td class="liste_titre"></td>';
515  print '<td class="center liste_titre">';
516  $searchpicto = $form->showFilterButtons();
517  print $searchpicto;
518  print '</td>';
519  print "</tr>\n";
520 
521  print '<tr class="liste_titre">';
522  print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
523  print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
524  print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
525  print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
526  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
527  print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
528  //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
529  print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
530  print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
531  print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
532  print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
533  print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
534  print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
535  print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
536  print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
537  $checkpicto = '';
538  if ($massactionbutton) {
539  $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
540  }
541  print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
542  print "</tr>\n";
543 
544  $thirdpartystatic = new Societe($db);
545  $facturefourn_static = new FactureFournisseur($db);
546  $facturefourn_static_det = new SupplierInvoiceLine($db);
547  $product_static = new Product($db);
548 
549 
550  $accountingaccount_codetotid_cache = array();
551 
552  while ($i < min($num_lines, $limit)) {
553  $objp = $db->fetch_object($result);
554 
555  // product_type: 0 = service, 1 = product
556  // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
557  // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
558  $code_buy_l = '';
559  $code_buy_p = '';
560  $code_buy_t = '';
561 
562  $thirdpartystatic->id = $objp->socid;
563  $thirdpartystatic->name = $objp->name;
564  $thirdpartystatic->client = $objp->client;
565  $thirdpartystatic->fournisseur = $objp->fournisseur;
566  $thirdpartystatic->code_client = $objp->code_client;
567  $thirdpartystatic->code_compta_client = $objp->code_compta_client;
568  $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
569  $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
570  $thirdpartystatic->email = $objp->email;
571  $thirdpartystatic->country_code = $objp->country_code;
572  $thirdpartystatic->tva_intra = $objp->tva_intra;
573  $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
574 
575  $product_static->ref = $objp->product_ref;
576  $product_static->id = $objp->product_id;
577  $product_static->type = $objp->type;
578  $product_static->label = $objp->product_label;
579  $product_static->status = $objp->status;
580  $product_static->status_buy = $objp->status_buy;
581  $product_static->accountancy_code_sell = $objp->code_sell;
582  $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
583  $product_static->accountancy_code_sell_export = $objp->code_sell_export;
584  $product_static->accountancy_code_buy = $objp->code_buy;
585  $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
586  $product_static->accountancy_code_buy_export = $objp->code_buy_export;
587  $product_static->tva_tx = $objp->tva_tx_prod;
588 
589  $facturefourn_static->ref = $objp->ref;
590  $facturefourn_static->id = $objp->facid;
591  $facturefourn_static->type = $objp->ftype;
592  $facturefourn_static->ref_supplier = $objp->ref_supplier;
593  $facturefourn_static->label = $objp->invoice_label;
594  $facturefourn_static->date = $db->jdate($objp->datef);
595 
596  $facturefourn_static_det->id = $objp->rowid;
597  $facturefourn_static_det->total_ht = $objp->total_ht;
598  $facturefourn_static_det->tva_tx = $objp->tva_tx_line;
599  $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
600  $facturefourn_static_det->product_type = $objp->type_l;
601  $facturefourn_static_det->desc = $objp->description;
602 
603  $accountingAccountArray = array(
604  'dom'=>$objp->aarowid,
605  'intra'=>$objp->aarowid_intra,
606  'export'=>$objp->aarowid_export,
607  'thirdparty' =>$objp->aarowid_thirdparty);
608 
609  $code_buy_p_notset = '';
610  $code_buy_t_notset = '';
611 
612  $suggestedid = 0;
613 
614  $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
615  if (!is_array($return) && $return<0) {
616  setEventMessage($accountingAccount->error, 'errors');
617  } else {
618  $suggestedid=$return['suggestedid'];
619  $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
620  $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
621  $code_buy_l=$return['code_l'];
622  $code_buy_p=$return['code_p'];
623  $code_buy_t=$return['code_t'];
624  }
625  //var_dump($return);
626 
627  if (!empty($code_buy_p)) {
628  // Value was defined previously
629  } else {
630  $code_buy_p_notset = 'color:orange';
631  }
632  if (empty($code_buy_l) && empty($code_buy_p)) {
633  $code_buy_p_notset = 'color:red';
634  }
635  /*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
636  $code_sell_p_notset = 'color:orange';
637  }*/
638 
639  // $code_buy_l is now default code of product/service
640  // $code_buy_p is now code of product/service
641  // $code_buy_t is now code of thirdparty
642  //var_dump($code_buy_l.' - '.$code_buy_p.' - '.$code_buy_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
643 
644  print '<tr class="oddeven">';
645 
646  // Line id
647  print '<td>'.$facturefourn_static_det->id.'</td>';
648 
649  // Ref Invoice
650  print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
651 
652  // Ref supplier invoice
653  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
654  print $objp->ref_supplier;
655  print '</td>';
656 
657  // Supplier invoice label
658  print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
659  print $objp->invoice_label;
660  print '</td>';
661 
662  // Date
663  print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
664 
665  // Ref Product
666  print '<td class="tdoverflowmax100">';
667  if ($product_static->id > 0) {
668  print $product_static->getNomUrl(1);
669  }
670  if ($product_static->label) {
671  print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
672  }
673  print '</td>';
674 
675  // Description
676  print '<td class="tdoverflowonsmartphone small">';
677  $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
678  $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
679  print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
680  print '</td>';
681 
682  print '<td class="right nowraponall amount">';
683  print price($objp->total_ht);
684  print '</td>';
685 
686  // Vat rate
687  $code_vat_differ = '';
688  if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
689  $code_vat_differ = 'warning bold';
690  }
691  print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
692  print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
693  print '</td>';
694 
695  // Thirdparty
696  print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'supplier').'</td>';
697 
698  // Country
699  $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label;
700  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelcountry).'">';
701  print dol_escape_htmltag($labelcountry);
702  print '</td>';
703 
704  // VAT Num
705  print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
706 
707  // Found accounts
708  print '<td class="small">';
709  $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
710  $shelp = '';
711  if ($suggestedaccountingaccountbydefaultfor == 'eec') {
712  $shelp .= $langs->trans("SaleEEC");
713  } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
714  $shelp .= $langs->trans("SaleExport");
715  }
716  $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
717  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
718  if ($product_static->id > 0) {
719  print '<br>';
720  $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
721  $shelp = ''; $ttype = 'help';
722  if ($suggestedaccountingaccountfor == 'eec') {
723  $shelp = $langs->trans("SaleEEC");
724  } elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
725  $shelp = $langs->trans("SaleEECWithVAT");
726  } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
727  $shelp = $langs->trans("SaleEECWithoutVATNumber");
728  $ttype = 'warning';
729  } elseif ($suggestedaccountingaccountfor == 'export') {
730  $shelp = $langs->trans("SaleExport");
731  }
732  $s .= (empty($code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_buy_p));
733  print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
734  } else {
735  print '<br>';
736  $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
737  $shelp = '';
738  $s .= $langs->trans("NotDefined");
739  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
740  }
741  if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
742  print '<br>';
743  $s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
744  $shelp = '';
745  $s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
746  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
747  }
748  print '</td>';
749 
750  // Suggested accounting account
751  print '<td>';
752  print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
753  print '</td>';
754 
755  // Column with checkbox
756  print '<td class="center">';
757  $ischecked = 0;
758  if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
759  $ischecked = 1;
760  }
761 
762  if (!empty($toselect)) {
763  $ischecked = 0;
764  if (in_array($objp->rowid."_".$i, $toselect)) {
765  $ischecked=1;
766  }
767  }
768 
769  print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
770  print '</td>';
771 
772  print '</tr>';
773  $i++;
774  }
775 
776  print '</table>';
777  print "</div>";
778 
779  print '</form>';
780 } else {
781  print $db->error();
782 }
783 if ($db->type == 'mysqli') {
784  $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
785 }
786 
787 // Add code to auto check the box when we select an account
788 print '<script type="text/javascript">
789 jQuery(document).ready(function() {
790  jQuery(".codeventil").change(function() {
791  var s=$(this).attr("id").replace("codeventil", "")
792  console.log(s+" "+$(this).val());
793  if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
794  else jQuery(".checkforselect"+s).prop("checked", true);
795  });
796 });
797 </script>';
798 
799 // End of page
800 llxFooter();
801 $db->close();
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
dol_trunc
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
Definition: functions.lib.php:3805
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
FactureFournisseur\TYPE_CREDIT_NOTE
const TYPE_CREDIT_NOTE
Credit note invoice.
Definition: fournisseur.facture.class.php:338
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
FactureFournisseur
Class to manage suppliers invoices.
Definition: fournisseur.facture.class.php:53
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
CommonInvoice\TYPE_SITUATION
const TYPE_SITUATION
Situation invoice.
Definition: commoninvoice.class.php:65
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
FormAccounting
Class to manage generation of HTML components for accounting management.
Definition: html.formaccounting.class.php:33
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
SupplierInvoiceLine
Class to manage line invoices.
Definition: fournisseur.facture.class.php:3239
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
getCountriesInEEC
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
Definition: company.lib.php:716
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:8535
length_accountg
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
Definition: accounting.lib.php:94
dol_string_nohtmltag
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
Definition: functions.lib.php:6694
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
setEventMessage
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
Definition: functions.lib.php:8108
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:5257
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
AccountingAccount
Class to manage accounting accounts.
Definition: accountingaccount.class.php:36
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
FactureFournisseur\TYPE_DEPOSIT
const TYPE_DEPOSIT
Deposit invoice.
Definition: fournisseur.facture.class.php:343
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
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
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
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
dolGetFirstLineOfText
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
Definition: functions.lib.php:6907
accessforbidden
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 ...
Definition: security.lib.php:933
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
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
vatrate
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
Definition: functions.lib.php:5492
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25
FactureFournisseur\TYPE_REPLACEMENT
const TYPE_REPLACEMENT
Replacement invoice.
Definition: fournisseur.facture.class.php:333