36 require
'../../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
50 $langs->loadLangs(array(
'products',
'bills',
'companies',
'projects'));
52 $action =
GETPOST(
'action',
'aZ09');
53 $massaction =
GETPOST(
'massaction',
'alpha');
54 $show_files =
GETPOST(
'show_files',
'int');
55 $confirm =
GETPOST(
'confirm',
'alpha');
56 $toselect =
GETPOST(
'toselect',
'array');
57 $optioncss =
GETPOST(
'optioncss',
'alpha');
58 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicelist';
60 $socid =
GETPOST(
'socid',
'int');
67 $socid = $user->socid;
70 $mode =
GETPOST(
"mode",
'aZ09');
72 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
73 $search_label =
GETPOST(
"search_label",
"alpha");
74 $search_amount_no_tax =
GETPOST(
"search_amount_no_tax",
"alpha");
75 $search_amount_all_tax =
GETPOST(
"search_amount_all_tax",
"alpha");
76 $search_product_category =
GETPOST(
'search_product_category',
'int');
78 $search_refsupplier =
GETPOST(
'search_refsupplier',
'alpha');
79 $search_type =
GETPOST(
'search_type',
'int');
80 $search_project =
GETPOST(
'search_project',
'alpha');
81 $search_company =
GETPOST(
'search_company',
'alpha');
82 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
83 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
84 $search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
85 $search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
86 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
87 $search_login =
GETPOST(
'search_login',
'alpha');
88 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
89 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
90 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
91 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
92 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
93 $search_status =
GETPOST(
'search_status',
'int');
94 $search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
95 $search_paymentcond =
GETPOST(
'search_paymentcond',
'int');
96 $search_town =
GETPOST(
'search_town',
'alpha');
97 $search_zip =
GETPOST(
'search_zip',
'alpha');
98 $search_state =
GETPOST(
"search_state");
99 $search_country =
GETPOST(
"search_country",
'int');
100 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
101 $search_user =
GETPOST(
'search_user',
'int');
102 $search_sale =
GETPOST(
'search_sale',
'int');
104 $month =
GETPOST(
'month',
'int');
105 $year =
GETPOST(
'year',
'int');
106 $day_lim =
GETPOST(
'day_lim',
'int');
107 $month_lim =
GETPOST(
'month_lim',
'int');
108 $year_lim =
GETPOST(
'year_lim',
'int');
109 $toselect =
GETPOST(
'toselect',
'array');
110 $search_btn =
GETPOST(
'button_search',
'alpha');
111 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
112 $search_categ_sup = trim(
GETPOST(
"search_categ_sup",
'int'));
115 if ($option ==
'late') {
116 $search_status =
'1';
118 $filter =
GETPOST(
'filtre',
'alpha');
120 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
121 $sortfield =
GETPOST(
"sortfield",
'alpha');
122 $sortorder =
GETPOST(
"sortorder",
'alpha');
124 if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) { $page = 0; }
125 $offset = $limit * $page;
126 $pageprev = $page - 1;
127 $pagenext = $page + 1;
128 if (!$sortorder) $sortorder =
"DESC";
129 if (!$sortfield) $sortfield =
"f.datef,f.rowid";
131 $diroutputmassaction = $conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id;
137 $hookmanager->initHooks(array(
'supplierinvoicelist'));
141 $extrafields->fetch_name_optionals_label($object->table_element);
143 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
146 $fieldstosearchall = array(
148 'f.ref_supplier'=>
'RefSupplier',
149 'pd.description'=>
'Description',
150 's.nom'=>
"ThirdParty",
151 'f.note_public'=>
'NotePublic',
153 if (empty($user->socid)) $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
155 $checkedtypetiers = 0;
156 $arrayfields = array(
157 'f.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
158 'f.ref_supplier'=>array(
'label'=>$langs->trans(
"RefSupplier"),
'checked'=>1),
159 'f.type'=>array(
'label'=>$langs->trans(
"Type"),
'checked'=>0),
160 'f.label'=>array(
'label'=>$langs->trans(
"Label"),
'checked'=>0),
161 'f.datef'=>array(
'label'=>$langs->trans(
"DateInvoice"),
'checked'=>1),
162 'f.date_lim_reglement'=>array(
'label'=>$langs->trans(
"DateDue"),
'checked'=>1),
163 'p.ref'=>array(
'label'=>$langs->trans(
"ProjectRef"),
'checked'=>0),
164 's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1),
165 's.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>1),
166 's.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>1),
167 'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"),
'checked'=>0),
168 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
169 'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"),
'checked'=>$checkedtypetiers),
170 'f.fk_cond_reglement'=>array(
'label'=>$langs->trans(
"PaymentTerm"),
'checked'=>1,
'position'=>50),
171 'f.fk_mode_reglement'=>array(
'label'=>$langs->trans(
"PaymentMode"),
'checked'=>1,
'position'=>52),
172 'f.total_ht'=>array(
'label'=>$langs->trans(
"AmountHT"),
'checked'=>1,
'position'=>105),
173 'f.total_vat'=>array(
'label'=>$langs->trans(
"AmountVAT"),
'checked'=>0,
'position'=>110),
174 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>$mysoc->localtax1_assuj ==
"1",
'position'=>95),
175 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>$mysoc->localtax2_assuj ==
"1",
'position'=>100),
176 'f.total_ttc'=>array(
'label'=>$langs->trans(
"AmountTTC"),
'checked'=>0,
'position'=>115),
177 'u.login'=>array(
'label'=>
"Author",
'checked'=>1),
178 'dynamount_payed'=>array(
'label'=>$langs->trans(
"Payed"),
'checked'=>0),
179 'rtp'=>array(
'label'=>$langs->trans(
"Rest"),
'checked'=>0),
180 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
181 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
182 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
183 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
184 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
185 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
186 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
187 'f.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
188 'f.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
189 'f.fk_statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
192 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
202 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
203 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') { $massaction =
''; }
205 $parameters = array(
'socid'=>$socid);
206 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
207 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
211 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha'))
218 $search_product_category =
'';
220 $search_refsupplier =
"";
223 $search_project =
'';
224 $search_company =
"";
225 $search_amount_no_tax =
"";
226 $search_amount_all_tax =
"";
227 $search_montant_ht =
'';
228 $search_montant_vat =
'';
229 $search_montant_localtax1 =
'';
230 $search_montant_localtax2 =
'';
231 $search_montant_ttc =
'';
233 $search_multicurrency_code =
'';
234 $search_multicurrency_tx =
'';
235 $search_multicurrency_montant_ht =
'';
236 $search_multicurrency_montant_vat =
'';
237 $search_multicurrency_montant_ttc =
'';
239 $search_paymentmode =
'';
240 $search_paymentcond =
'';
245 $search_country =
'';
246 $search_type_thirdparty =
'';
254 $search_array_options = array();
258 $search_categ_sup = 0;
262 $objectclass =
'FactureFournisseur';
263 $objectlabel =
'SupplierInvoices';
264 $permissiontoread = $user->rights->fournisseur->facture->lire;
265 $permissiontoadd = $user->rights->fournisseur->facture->creer;
266 $permissiontodelete = $user->rights->fournisseur->facture->supprimer;
267 $uploaddir = $conf->fournisseur->facture->dir_output;
268 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
270 if ($massaction ==
'banktransfertrequest')
272 $langs->load(
"withdrawals");
274 if (!$user->rights->paymentbybanktransfer->create)
282 $arrayofselected = is_array($toselect) ? $toselect : array();
283 $listofbills = array();
284 foreach ($arrayofselected as $toselectid)
287 $result = $objecttmp->fetch($toselectid);
290 $totalpaye = $objecttmp->getSommePaiement();
291 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
292 $totaldeposits = $objecttmp->getSumDepositsUsed();
293 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,
'MT');
294 if ($objecttmp->paye || $objecttmp->resteapayer == 0) {
296 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
297 } elseif ($objecttmp->resteapayer < 0) {
299 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
303 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
306 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
307 $rsql .=
" , pfd.date_traite as date_traite";
308 $rsql .=
" , pfd.amount";
309 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
310 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_facture_demande as pfd";
311 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
312 $rsql .=
" WHERE fk_facture_fourn = ".$objecttmp->id;
313 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
314 $rsql .=
" AND pfd.traite = 0";
315 $rsql .=
" ORDER BY pfd.date_demande DESC";
317 $result_sql = $db->query($rsql);
320 $numprlv = $db->num_rows($result_sql);
325 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
326 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
328 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
330 $listofbills[] = $objecttmp;
336 if (!empty($listofbills))
338 $nbwithdrawrequestok = 0;
339 foreach ($listofbills as $aBill)
342 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'bank-transfer',
'supplier_invoice');
346 $nbwithdrawrequestok++;
352 if ($nbwithdrawrequestok > 0)
354 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok), null,
'mesgs');
366 $form =
new Form($db);
369 $bankaccountstatic =
new Account($db);
372 $thirdparty =
new Societe($db);
377 if ($search_all || $search_product_category > 0) $sql =
'SELECT DISTINCT';
378 $sql .=
" f.rowid as facid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement,";
379 $sql .=
" f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_update,";
380 $sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
381 $sql .=
' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
382 $sql .=
" f.note_public, f.note_private,";
383 $sql .=
" f.fk_user_author,";
384 $sql .=
" s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
385 $sql .=
" typent.code as typent_code,";
386 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
387 $sql .=
" country.code as country_code,";
388 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
392 if (!$search_all) $sql .=
', SUM(pf.amount) as dynamount_payed';
393 if ($search_categ_sup) $sql .=
", cs.fk_categorie, cs.fk_soc";
395 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
396 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
399 $parameters = array();
400 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
401 $sql .= $hookmanager->resPrint;
402 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
403 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
404 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
405 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
406 if (!empty($search_categ_sup)) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
408 $sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
409 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
410 if (!$search_all) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
411 if ($search_all || $search_product_category > 0) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn';
412 if ($search_product_category > 0) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
413 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
414 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
416 if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
417 if ($search_user > 0)
419 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
420 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
422 $sql .=
' WHERE f.fk_soc = s.rowid';
423 $sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
424 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
425 if ($search_product_category > 0) $sql .=
" AND cp.fk_categorie = ".$search_product_category;
426 if ($socid > 0) $sql .=
' AND s.rowid = '.$socid;
429 if (is_numeric($search_ref)) $sql .=
natural_search(array(
'f.ref'), $search_ref);
433 if ($search_refsupplier) $sql .=
natural_search(
'f.ref_supplier', $search_refsupplier);
434 if ($search_type !=
'' && $search_type >= 0)
436 if ($search_type ==
'0') $sql .=
" AND f.type = 0";
437 if ($search_type ==
'1') $sql .=
" AND f.type = 1";
438 if ($search_type ==
'2') $sql .=
" AND f.type = 2";
439 if ($search_type ==
'3') $sql .=
" AND f.type = 3";
443 if ($search_project) $sql .=
natural_search(
'p.ref', $search_project);
444 if ($search_company) $sql .=
natural_search(
's.nom', $search_company);
447 if ($search_state) $sql .=
natural_search(
"state.nom", $search_state);
448 if ($search_country) $sql .=
" AND s.fk_pays IN (".$search_country.
')';
449 if ($search_type_thirdparty) $sql .=
" AND s.fk_typent IN (".$search_type_thirdparty.
')';
450 if ($search_montant_ht !=
'') $sql .=
natural_search(
'f.total_ht', $search_montant_ht, 1);
451 if ($search_montant_vat !=
'') $sql .=
natural_search(
'f.total_tva', $search_montant_vat, 1);
452 if ($search_montant_localtax1 !=
'') $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
453 if ($search_montant_localtax2 !=
'') $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
454 if ($search_montant_ttc !=
'') $sql .=
natural_search(
'f.total_ttc', $search_montant_ttc, 1);
455 if ($search_multicurrency_code !=
'') $sql .=
' AND f.multicurrency_code = "'.$db->escape($search_multicurrency_code).
'"';
456 if ($search_multicurrency_tx !=
'') $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
457 if ($search_multicurrency_montant_ht !=
'') $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
458 if ($search_multicurrency_montant_vat !=
'') $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
459 if ($search_multicurrency_montant_ttc !=
'') $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
460 if ($search_login) $sql .=
natural_search(
'u.login', $search_login);
461 if ($search_status !=
'' && $search_status >= 0) $sql .=
" AND f.fk_statut = ".$db->escape($search_status);
462 if ($search_paymentmode > 0) $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
463 if ($search_paymentcond > 0) $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
465 $sql .=
dolSqlDateFilter(
"f.date_lim_reglement", $day_lim, $month_lim, $year_lim);
466 if ($option ==
'late') $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->fournisseur->warning_delay).
"'";
467 if ($search_label) $sql .=
natural_search(
'f.libelle', $search_label);
468 if ($search_categ_sup > 0) $sql .=
" AND cs.fk_categorie = ".$db->escape($search_categ_sup);
469 if ($search_categ_sup == -2) $sql .=
" AND cs.fk_categorie IS NULL";
470 if ($search_status !=
'' && $search_status >= 0)
472 $sql .=
" AND f.fk_statut = ".$search_status;
474 if ($filter && $filter != -1)
476 $aFilter = explode(
',', $filter);
477 foreach ($aFilter as $fil)
479 $filt = explode(
':', $fil);
480 $sql .=
' AND '.$db->escape(trim($filt[0])).
' = '.$db->escape(trim($filt[1]));
483 if ($search_sale > 0) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
484 if ($search_user > 0)
486 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
489 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
491 $parameters = array();
492 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
493 $sql .= $hookmanager->resPrint;
497 $sql .=
" GROUP BY f.rowid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement, f.fk_mode_reglement, f.fk_cond_reglement,";
498 $sql .=
" f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,";
499 $sql .=
" f.localtax1, f.localtax2,";
500 $sql .=
' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
501 $sql .=
" f.note_public, f.note_private,";
502 $sql .=
" f.fk_user_author,";
503 $sql .=
' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
504 $sql .=
" typent.code,";
505 $sql .=
" state.code_departement, state.nom,";
506 $sql .=
' country.code,';
507 $sql .=
" p.rowid, p.ref, p.title,";
509 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
510 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
512 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
",ef.".$key :
'');
516 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
519 $sql .= $db->order($sortfield, $sortorder);
521 $nbtotalofrecords =
'';
522 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
524 $result = $db->query($sql);
525 $nbtotalofrecords = $db->num_rows($result);
526 if (($page * $limit) > $nbtotalofrecords)
533 $sql .= $db->plimit($limit + 1, $offset);
536 $resql = $db->query($sql);
539 $num = $db->num_rows(
$resql);
541 $arrayofselected = is_array($toselect) ? $toselect : array();
543 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
545 $obj = $db->fetch_object(
$resql);
548 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$id);
552 llxHeader(
'', $langs->trans(
"SuppliersInvoices"),
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
558 if (empty($search_company)) $search_company = $soc->name;
561 $param =
'&socid='.$socid;
562 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
563 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
564 if ($search_all) $param .=
'&search_all='.urlencode($search_all);
565 if ($day) $param .=
'&day='.urlencode($day);
566 if ($month) $param .=
'&month='.urlencode($month);
567 if ($year) $param .=
'&year='.urlencode($year);
568 if ($day_lim) $param .=
'&day_lim='.urlencode($day_lim);
569 if ($month_lim) $param .=
'&month_lim='.urlencode($month_lim);
570 if ($year_lim) $param .=
'&year_lim='.urlencode($year_lim);
571 if ($search_ref) $param .=
'&search_ref='.urlencode($search_ref);
572 if ($search_refsupplier) $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
573 if ($search_type !=
'') $param .=
'&search_type='.urlencode($search_type);
574 if ($search_label) $param .=
'&search_label='.urlencode($search_label);
575 if ($search_company) $param .=
'&search_company='.urlencode($search_company);
576 if ($search_login) $param .=
'&search_login='.urlencode($search_login);
577 if ($search_montant_ht !=
'') $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
578 if ($search_montant_vat !=
'') $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
579 if ($search_montant_localtax1 !=
'') $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
580 if ($search_montant_localtax2 !=
'') $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
581 if ($search_montant_ttc !=
'') $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
582 if ($search_multicurrency_code !=
'') $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
583 if ($search_multicurrency_tx !=
'') $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
584 if ($search_multicurrency_montant_ht !=
'') $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
585 if ($search_multicurrency_montant_vat !=
'') $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
586 if ($search_multicurrency_montant_ttc !=
'') $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
587 if ($search_amount_no_tax) $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
588 if ($search_amount_all_tax) $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
589 if ($search_status >= 0) $param .=
"&search_status=".urlencode($search_status);
590 if ($show_files) $param .=
'&show_files='.urlencode($show_files);
591 if ($option) $param .=
"&option=".urlencode($option);
592 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
593 if ($search_categ_sup > 0) $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
596 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
599 $arrayofmassactions = array(
600 'validate'=>$langs->trans(
"Validate"),
601 'generate_doc'=>$langs->trans(
"ReGeneratePDF"),
606 if (!empty($conf->paymentbybanktransfer->enabled) && !empty($user->rights->paymentbybanktransfer->create)) {
607 $langs->load(
'withdrawals');
608 $arrayofmassactions[
'banktransfertrequest'] = $langs->trans(
"MakeBankTransferOrder");
610 if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
611 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) $arrayofmassactions = array();
612 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
614 $url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
615 if (!empty($socid)) $url .=
'&socid='.$socid;
616 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->fournisseur->facture->creer);
619 print '<form method="POST" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
620 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
621 print '<input type="hidden" name="token" value="'.newToken().
'">';
622 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
623 print '<input type="hidden" name="action" value="list">';
624 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
625 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
626 print '<input type="hidden" name="socid" value="'.$socid.
'">';
628 print_barre_liste($langs->trans(
"BillsSuppliers").($socid ?
' '.$soc->name :
''), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_invoice', 0, $newcardbutton,
'', $limit, 0, 0, 1);
630 $topicmail =
"SendBillRef";
631 $modelmail =
"invoice_supplier_send";
633 $trackid =
'sinv'.$object->id;
634 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
636 if ($massaction ==
'createbills')
639 print '<input type="hidden" name="massaction" value="confirm_createbills">';
641 print '<table class="border" width="100%" >';
643 print '<td class="titlefieldmiddle">';
644 print $langs->trans(
'DateInvoice');
647 print $form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
652 print $langs->trans(
'CreateOneBillByThird');
655 print $form->selectyesno(
'createbills_onebythird',
'', 1);
660 print $langs->trans(
'ValidateInvoices');
663 print $form->selectyesno(
'validate_invoices', 1, 1);
669 print '<div class="center">';
670 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
671 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
678 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
679 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
684 if ($user->rights->societe->client->voir || $socid)
686 $langs->load(
"commercial");
687 $moreforfilter .=
'<div class="divsearchfield">';
688 $moreforfilter .= $langs->trans(
'ThirdPartiesOfSaleRepresentative').
': ';
689 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, 1,
'maxwidth200');
690 $moreforfilter .=
'</div>';
693 if ($user->rights->societe->client->voir || $socid)
695 $moreforfilter .=
'<div class="divsearchfield">';
696 $moreforfilter .= $langs->trans(
'LinkedToSpecificUsers').
': ';
697 $moreforfilter .= $form->select_dolusers($search_user,
'search_user', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
698 $moreforfilter .=
'</div>';
701 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
703 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
704 $moreforfilter .=
'<div class="divsearchfield">';
705 $moreforfilter .= $langs->trans(
'IncludingProductWithTag').
': ';
706 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null,
'parent', null, null, 1);
707 $moreforfilter .= $form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, 1, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300', 1);
708 $moreforfilter .=
'</div>';
711 if (!empty($conf->categorie->enabled))
713 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
714 $moreforfilter .=
'<div class="divsearchfield">';
715 $moreforfilter .= $langs->trans(
'SuppliersCategoriesShort').
': ';
716 $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1);
717 $moreforfilter .=
'</div>';
719 $parameters = array();
720 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
721 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
722 else $moreforfilter = $hookmanager->resPrint;
726 print '<div class="liste_titre liste_titre_bydiv centpercent">';
727 print $moreforfilter;
731 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
732 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
733 if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
735 print '<div class="div-table-responsive">';
736 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
739 print '<tr class="liste_titre_filter">';
741 if (!empty($arrayfields[
'f.ref'][
'checked']))
743 print
'<td class="liste_titre left">';
744 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.$search_ref.
'">';
748 if (!empty($arrayfields[
'f.ref_supplier'][
'checked']))
750 print
'<td class="liste_titre">';
751 print
'<input class="flat maxwidth50" type="text" name="search_refsupplier" value="'.$search_refsupplier.
'">';
755 if (!empty($arrayfields[
'f.type'][
'checked']))
757 print
'<td class="liste_titre maxwidthonsmartphone">';
771 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
775 if (!empty($arrayfields[
'f.label'][
'checked']))
777 print
'<td class="liste_titre">';
778 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.$search_label.
'">';
782 if (!empty($arrayfields[
'f.datef'][
'checked']))
784 print
'<td class="liste_titre nowraponall center">';
785 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print
'<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).
'">';
786 print
'<input class="flat width25 valignmiddle" type="text" size="1" maxlength="2" name="month" value="'.$month.
'">';
787 $formother->select_year($year ? $year : -1,
'year', 1, 20, 5);
791 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked']))
793 print
'<td class="liste_titre nowraponall center">';
794 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print
'<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).
'">';
795 print
'<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month_lim" value="'.$month_lim.
'">';
796 $formother->select_year($year_lim ? $year_lim : -1,
'year_lim', 1, 20, 5);
797 print
'<br><input type="checkbox" name="option" value="late"'.($option ==
'late' ?
' checked' :
'').
'> '.$langs->trans(
"Late");
801 if (!empty($arrayfields[
'p.ref'][
'checked']))
803 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.$search_project.
'"></td>';
806 if (!empty($arrayfields[
's.nom'][
'checked']))
808 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.$search_company.
'"></td>';
811 if (!empty($arrayfields[
's.town'][
'checked'])) print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
813 if (!empty($arrayfields[
's.zip'][
'checked'])) print
'<td class="liste_titre center"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
815 if (!empty($arrayfields[
'state.nom'][
'checked']))
817 print
'<td class="liste_titre">';
818 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
822 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
824 print
'<td class="liste_titre center">';
825 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
829 if (!empty($arrayfields[
'typent.code'][
'checked']))
831 print
'<td class="liste_titre maxwidthonsmartphone center">';
832 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
836 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked']))
838 print
'<td class="liste_titre left">';
839 $form->select_conditions_paiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
843 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked']))
845 print
'<td class="liste_titre left">';
846 $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100');
849 if (!empty($arrayfields[
'f.total_ht'][
'checked']))
852 print
'<td class="liste_titre right">';
853 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
856 if (!empty($arrayfields[
'f.total_vat'][
'checked']))
859 print
'<td class="liste_titre right">';
860 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
863 if (!empty($arrayfields[
'f.total_localtax1'][
'checked']))
866 print
'<td class="liste_titre right">';
867 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.$search_montant_localtax1.
'">';
870 if (!empty($arrayfields[
'f.total_localtax2'][
'checked']))
873 print
'<td class="liste_titre right">';
874 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.$search_montant_localtax2.
'">';
877 if (!empty($arrayfields[
'f.total_ttc'][
'checked']))
880 print
'<td class="liste_titre right">';
881 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
884 if (!empty($arrayfields[
'u.login'][
'checked']))
887 print
'<td class="liste_titre" align="center">';
888 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
891 if (!empty($arrayfields[
'dynamount_payed'][
'checked']))
893 print
'<td class="liste_titre right">';
896 if (!empty($arrayfields[
'rtp'][
'checked']))
898 print
'<td class="liste_titre">';
901 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked']))
904 print
'<td class="liste_titre">';
905 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
908 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked']))
911 print
'<td class="liste_titre">';
912 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
915 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked']))
918 print
'<td class="liste_titre right">';
919 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
922 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked']))
925 print
'<td class="liste_titre right">';
926 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
929 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked']))
932 print
'<td class="liste_titre right">';
933 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
936 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked']))
938 print
'<td class="liste_titre">';
941 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked']))
943 print
'<td class="liste_titre right">';
947 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
950 $parameters = array(
'arrayfields'=>$arrayfields);
951 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
952 print $hookmanager->resPrint;
954 if (!empty($arrayfields[
'f.datec'][
'checked']))
956 print
'<td class="liste_titre">';
960 if (!empty($arrayfields[
'f.tms'][
'checked']))
962 print
'<td class="liste_titre">';
966 if (!empty($arrayfields[
'f.fk_statut'][
'checked']))
968 print
'<td class="liste_titre maxwidthonsmartphone right">';
969 $liststatus = array(
'0'=>$langs->trans(
"Draft"),
'1'=>$langs->trans(
"Unpaid"),
'2'=>$langs->trans(
"Paid"));
970 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
974 print
'<td class="liste_titre middle">';
975 $searchpicto = $form->showFilterButtons();
981 print
'<tr class="liste_titre">';
982 if (!empty($arrayfields[
'f.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'f.ref'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
983 if (!empty($arrayfields[
'f.ref_supplier'][
'checked']))
print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'],
$_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
984 if (!empty($arrayfields[
'f.type'][
'checked']))
print_liste_field_titre($arrayfields[
'f.type'][
'label'],
$_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
985 if (!empty($arrayfields[
'f.label'][
'checked']))
print_liste_field_titre($arrayfields[
'f.label'][
'label'],
$_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
986 if (!empty($arrayfields[
'f.datef'][
'checked']))
print_liste_field_titre($arrayfields[
'f.datef'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
987 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked']))
print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'],
$_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
988 if (!empty($arrayfields[
'p.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'p.ref'][
'label'],
$_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
989 if (!empty($arrayfields[
's.nom'][
'checked']))
print_liste_field_titre($arrayfields[
's.nom'][
'label'],
$_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
990 if (!empty($arrayfields[
's.town'][
'checked']))
print_liste_field_titre($arrayfields[
's.town'][
'label'],
$_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
991 if (!empty($arrayfields[
's.zip'][
'checked']))
print_liste_field_titre($arrayfields[
's.zip'][
'label'],
$_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder,
'center ');
992 if (!empty($arrayfields[
'state.nom'][
'checked']))
print_liste_field_titre($arrayfields[
'state.nom'][
'label'],
$_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
993 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'],
$_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
994 if (!empty($arrayfields[
'typent.code'][
'checked']))
print_liste_field_titre($arrayfields[
'typent.code'][
'label'],
$_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
995 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked']))
print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'],
$_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
996 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked']))
print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'],
$_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
997 if (!empty($arrayfields[
'f.total_ht'][
'checked']))
print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
998 if (!empty($arrayfields[
'f.total_vat'][
'checked']))
print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
999 if (!empty($arrayfields[
'f.total_localtax1'][
'checked']))
print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1000 if (!empty($arrayfields[
'f.total_localtax2'][
'checked']))
print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1001 if (!empty($arrayfields[
'f.total_ttc'][
'checked']))
print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1002 if (!empty($arrayfields[
'u.login'][
'checked']))
print_liste_field_titre($arrayfields[
'u.login'][
'label'],
$_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1003 if (!empty($arrayfields[
'dynamount_payed'][
'checked']))
print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'],
$_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1004 if (!empty($arrayfields[
'rtp'][
'checked']))
print_liste_field_titre($arrayfields[
'rtp'][
'label'],
$_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1005 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked']))
print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1006 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked']))
print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1007 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked']))
print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1008 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked']))
print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1009 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked']))
print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'],
$_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1010 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked']))
print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'],
$_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1011 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked']))
print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'],
$_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1013 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1015 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1016 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1017 print $hookmanager->resPrint;
1018 if (!empty($arrayfields[
'f.datec'][
'checked']))
print_liste_field_titre($arrayfields[
'f.datec'][
'label'],
$_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1019 if (!empty($arrayfields[
'f.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'f.tms'][
'label'],
$_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1020 if (!empty($arrayfields[
'f.fk_statut'][
'checked']))
print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'],
$_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'right ');
1026 $projectstatic =
new Project($db);
1027 $userstatic =
new User($db);
1032 $totalarray = array();
1033 while ($i < min($num, $limit))
1035 $obj = $db->fetch_object(
$resql);
1037 $datelimit = $db->jdate($obj->datelimite);
1038 $facturestatic->id = $obj->facid;
1039 $facturestatic->ref = $obj->ref;
1040 $facturestatic->type = $obj->type;
1041 $facturestatic->ref_supplier = $obj->ref_supplier;
1042 $facturestatic->date_echeance = $db->jdate($obj->datelimite);
1043 $facturestatic->statut = $obj->fk_statut;
1044 $facturestatic->note_public = $obj->note_public;
1045 $facturestatic->note_private = $obj->note_private;
1046 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1047 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1048 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1049 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1050 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1052 $thirdparty->id = $obj->socid;
1053 $thirdparty->name = $obj->name;
1054 $thirdparty->client = $obj->client;
1055 $thirdparty->fournisseur = $obj->fournisseur;
1056 $thirdparty->code_client = $obj->code_client;
1057 $thirdparty->code_compta_client = $obj->code_compta_client;
1058 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1059 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1060 $thirdparty->email = $obj->email;
1061 $thirdparty->country_code = $obj->country_code;
1063 $paiement = $facturestatic->getSommePaiement();
1064 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1065 $totaldeposits = $facturestatic->getSumDepositsUsed();
1066 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1067 $remaintopay = $obj->total_ttc - $totalpay;
1068 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1069 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1070 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1071 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1072 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1074 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1075 $facturestatic->paye = $obj->paye;
1076 $facturestatic->statut = $obj->fk_statut;
1077 $facturestatic->type = $obj->type;
1082 if ($facturestatic->isCreditNoteUsed()) {
1083 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1087 print
'<tr class="oddeven">';
1088 if (!empty($arrayfields[
'f.ref'][
'checked']))
1090 print
'<td class="nowrap">';
1092 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1094 print
'<td class="nobordernopadding nowrap">';
1095 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1098 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1099 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1100 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1101 print
'</td></tr></table>';
1104 if (!$i) $totalarray[
'nbfield']++;
1108 if (!empty($arrayfields[
'f.ref_supplier'][
'checked']))
1110 print
'<td class="nowrap tdoverflowmax200">';
1111 print $obj->ref_supplier;
1113 if (!$i) $totalarray[
'nbfield']++;
1117 if (!empty($arrayfields[
'f.type'][
'checked']))
1119 print
'<td class="nowrap">';
1120 print $facturestatic->getLibType();
1122 if (!$i) $totalarray[
'nbfield']++;
1126 if (!empty($arrayfields[
'f.label'][
'checked']))
1128 print
'<td class="nowrap">';
1131 if (!$i) $totalarray[
'nbfield']++;
1135 if (!empty($arrayfields[
'f.datef'][
'checked']))
1137 print
'<td class="center nowrap">';
1140 if (!$i) $totalarray[
'nbfield']++;
1144 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked']))
1146 print
'<td class="center nowrap">'.dol_print_date($datelimit,
'day');
1147 if ($facturestatic->hasDelay())
1152 if (!$i) $totalarray[
'nbfield']++;
1156 if (!empty($arrayfields[
'p.ref'][
'checked']))
1158 print
'<td class="nowrap">';
1159 if ($obj->project_id > 0)
1161 $projectstatic->id = $obj->project_id;
1162 $projectstatic->ref = $obj->project_ref;
1163 $projectstatic->title = $obj->project_label;
1164 print $projectstatic->getNomUrl(1);
1167 if (!$i) $totalarray[
'nbfield']++;
1171 if (!empty($arrayfields[
's.nom'][
'checked']))
1173 print
'<td class="tdoverflowmax200">';
1174 print $thirdparty->getNomUrl(1,
'supplier');
1176 if (!$i) $totalarray[
'nbfield']++;
1179 if (!empty($arrayfields[
's.town'][
'checked']))
1181 print
'<td class="nocellnopadd">';
1184 if (!$i) $totalarray[
'nbfield']++;
1187 if (!empty($arrayfields[
's.zip'][
'checked']))
1189 print
'<td class="nocellnopadd center">';
1192 if (!$i) $totalarray[
'nbfield']++;
1195 if (!empty($arrayfields[
'state.nom'][
'checked']))
1197 print
"<td>".$obj->state_name.
"</td>\n";
1198 if (!$i) $totalarray[
'nbfield']++;
1201 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
1203 print
'<td class="center">';
1204 $tmparray =
getCountry($obj->fk_pays,
'all');
1205 print $tmparray[
'label'];
1207 if (!$i) $totalarray[
'nbfield']++;
1210 if (!empty($arrayfields[
'typent.code'][
'checked']))
1212 print
'<td class="center">';
1213 if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
1214 print $typenArray[$obj->typent_code];
1216 if (!$i) $totalarray[
'nbfield']++;
1220 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked']))
1223 $form->form_conditions_reglement(
$_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none',
'', -1);
1225 if (!$i) $totalarray[
'nbfield']++;
1228 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked']))
1231 $form->form_modes_reglement(
$_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1233 if (!$i) $totalarray[
'nbfield']++;
1237 if (!empty($arrayfields[
'f.total_ht'][
'checked']))
1239 print
'<td class="right nowrap">'.price($obj->total_ht).
"</td>\n";
1240 if (!$i) $totalarray[
'nbfield']++;
1241 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
1242 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
1245 if (!empty($arrayfields[
'f.total_vat'][
'checked']))
1247 print
'<td class="right nowrap">'.price($obj->total_vat).
"</td>\n";
1248 if (!$i) $totalarray[
'nbfield']++;
1249 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_vat';
1250 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
1253 if (!empty($arrayfields[
'f.total_localtax1'][
'checked']))
1255 print
'<td class="right nowrap">'.price($obj->total_localtax1).
"</td>\n";
1256 if (!$i) $totalarray[
'nbfield']++;
1257 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
1258 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
1261 if (!empty($arrayfields[
'f.total_localtax2'][
'checked']))
1263 print
'<td class="right nowrap">'.price($obj->total_localtax2).
"</td>\n";
1264 if (!$i) $totalarray[
'nbfield']++;
1265 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
1266 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
1269 if (!empty($arrayfields[
'f.total_ttc'][
'checked']))
1271 print
'<td class="right nowrap">'.price($obj->total_ttc).
"</td>\n";
1272 if (!$i) $totalarray[
'nbfield']++;
1273 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
1274 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
1278 if (!empty($arrayfields[
'u.login'][
'checked']))
1280 $userstatic->id = $obj->fk_user_author;
1281 $userstatic->login = $obj->login;
1282 print
'<td align="center">';
1283 if ($userstatic->id) print $userstatic->getLoginUrl(1);
1284 else print
' ';
1286 if (!$i) $totalarray[
'nbfield']++;
1289 if (!empty($arrayfields[
'dynamount_payed'][
'checked']))
1291 print
'<td class="right nowrap">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
1292 if (!$i) $totalarray[
'nbfield']++;
1293 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
1294 $totalarray[
'val'][
'totalam'] += $totalpay;
1297 if (!empty($arrayfields[
'rtp'][
'checked']))
1299 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
1300 if (!$i) $totalarray[
'nbfield']++;
1301 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
1302 $totalarray[
'val'][
'rtp'] += $remaintopay;
1306 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked']))
1308 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1309 if (!$i) $totalarray[
'nbfield']++;
1313 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked']))
1315 print
'<td class="nowrap">';
1316 $form->form_multicurrency_rate(
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1318 if (!$i) $totalarray[
'nbfield']++;
1321 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked']))
1323 print
'<td class="right nowrap">'.price($obj->multicurrency_total_ht).
"</td>\n";
1324 if (!$i) $totalarray[
'nbfield']++;
1327 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked']))
1329 print
'<td class="right nowrap">'.price($obj->multicurrency_total_vat).
"</td>\n";
1330 if (!$i) $totalarray[
'nbfield']++;
1333 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked']))
1335 print
'<td class="right nowrap">'.price($obj->multicurrency_total_ttc).
"</td>\n";
1336 if (!$i) $totalarray[
'nbfield']++;
1338 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked']))
1340 print
'<td class="right nowrap">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
1341 if (!$i) $totalarray[
'nbfield']++;
1345 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked']))
1347 print
'<td class="right nowrap">';
1348 print (!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
1350 if (!$i) $totalarray[
'nbfield']++;
1355 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1357 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1358 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1359 print $hookmanager->resPrint;
1361 if (!empty($arrayfields[
'f.datec'][
'checked']))
1363 print
'<td class="center nowrap">';
1364 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1366 if (!$i) $totalarray[
'nbfield']++;
1369 if (!empty($arrayfields[
'f.tms'][
'checked']))
1371 print
'<td class="center nowrap">';
1372 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1374 if (!$i) $totalarray[
'nbfield']++;
1377 if (!empty($arrayfields[
'f.fk_statut'][
'checked']))
1379 print
'<td class="right nowrap">';
1380 print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type);
1382 if (!$i) $totalarray[
'nbfield']++;
1386 print
'<td class="nowrap center">';
1387 if ($massactionbutton || $massaction)
1390 if (in_array($obj->facid, $arrayofselected)) $selected = 1;
1391 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1394 if (!$i) $totalarray[
'nbfield']++;
1402 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1407 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1408 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1409 print $hookmanager->resPrint;
1416 $hidegeneratedfilelistifempty = 1;
1417 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
1420 $urlsource =
$_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1421 $urlsource .= str_replace(
'&',
'&', $param);
1423 $filedir = $diroutputmassaction;
1424 $genallowed = $user->rights->facture->lire;
1425 $delallowed = $user->rights->facture->creer;
1428 print $formfile->showdocuments(
'massfilesarea_supplier_invoice',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
const TYPE_STANDARD
Standard invoice.
const TYPE_DEPOSIT
Deposit invoice.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
const TYPE_REPLACEMENT
Replacement invoice.
Class to manage suppliers invoices.
Class to manage bank accounts.
Class to manage suppliers.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
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 ...
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...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
const TYPE_CREDIT_NOTE
Credit note invoice.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.