37 require
'../../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49 $langs->loadLangs(array(
'products',
'bills',
'companies',
'projects'));
51 $action =
GETPOST(
'action',
'aZ09');
52 $massaction =
GETPOST(
'massaction',
'alpha');
53 $show_files =
GETPOST(
'show_files',
'int');
54 $confirm =
GETPOST(
'confirm',
'alpha');
55 $toselect =
GETPOST(
'toselect',
'array');
56 $optioncss =
GETPOST(
'optioncss',
'alpha');
57 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicelist';
59 $socid =
GETPOST(
'socid',
'int');
62 if ($user->socid > 0) {
65 $socid = $user->socid;
68 $mode =
GETPOST(
"mode",
'aZ09');
70 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
71 $search_label =
GETPOST(
"search_label",
"alpha");
72 $search_amount_no_tax =
GETPOST(
"search_amount_no_tax",
"alpha");
73 $search_amount_all_tax =
GETPOST(
"search_amount_all_tax",
"alpha");
74 $search_product_category =
GETPOST(
'search_product_category',
'int');
76 $search_refsupplier =
GETPOST(
'search_refsupplier',
'alpha');
77 $search_type =
GETPOST(
'search_type',
'int');
78 $search_project =
GETPOST(
'search_project',
'alpha');
79 $search_company =
GETPOST(
'search_company',
'alpha');
80 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
81 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
82 $search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
83 $search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
84 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
85 $search_login =
GETPOST(
'search_login',
'alpha');
86 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
87 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
88 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
89 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
90 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
91 $search_status =
GETPOST(
'search_status',
'int');
92 $search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
93 $search_paymentcond =
GETPOST(
'search_paymentcond',
'int');
94 $search_town =
GETPOST(
'search_town',
'alpha');
95 $search_zip =
GETPOST(
'search_zip',
'alpha');
96 $search_state =
GETPOST(
"search_state");
97 $search_country =
GETPOST(
"search_country",
'int');
98 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
99 $search_user =
GETPOST(
'search_user',
'int');
100 $search_sale =
GETPOST(
'search_sale',
'int');
101 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
102 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
103 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
104 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
105 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
106 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
107 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
108 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
109 $search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
110 $search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
111 $search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
112 $search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
113 $search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
114 $search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
115 $search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
116 $search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
117 $toselect =
GETPOST(
'toselect',
'array');
118 $search_btn =
GETPOST(
'button_search',
'alpha');
119 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
120 $search_categ_sup = trim(
GETPOST(
"search_categ_sup",
'int'));
122 $option =
GETPOST(
'search_option');
123 if ($option ==
'late') {
124 $search_status =
'1';
126 $filter =
GETPOST(
'filtre',
'alpha');
128 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
129 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
130 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
132 if ($page == -1 || $page ==
null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
135 $offset = $limit * $page;
136 $pageprev = $page - 1;
137 $pagenext = $page + 1;
142 $sortfield =
"f.datef,f.rowid";
145 $diroutputmassaction = $conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id;
151 $hookmanager->initHooks(array(
'supplierinvoicelist'));
155 $extrafields->fetch_name_optionals_label($object->table_element);
157 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
160 $fieldstosearchall = array(
162 'f.ref_supplier'=>
'RefSupplier',
163 'pd.description'=>
'Description',
164 's.nom'=>
"ThirdParty",
165 'f.note_public'=>
'NotePublic',
167 if (empty($user->socid)) {
168 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
171 $checkedtypetiers = 0;
172 $arrayfields = array(
173 'f.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
174 'f.ref_supplier'=>array(
'label'=>
"RefSupplier",
'checked'=>1),
175 'f.type'=>array(
'label'=>
"Type",
'checked'=>0),
176 'f.label'=>array(
'label'=>
"Label",
'checked'=>0),
177 'f.datef'=>array(
'label'=>
"DateInvoice",
'checked'=>1),
178 'f.date_lim_reglement'=>array(
'label'=>
"DateDue",
'checked'=>1),
179 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>0),
180 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
181 's.town'=>array(
'label'=>
"Town",
'checked'=>-1),
182 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1),
183 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0),
184 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0),
185 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers),
186 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentTerm",
'checked'=>1,
'position'=>50),
187 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>1,
'position'=>52),
188 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>105),
189 'f.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>110),
190 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>$mysoc->localtax1_assuj ==
"1",
'position'=>95),
191 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>$mysoc->localtax2_assuj ==
"1",
'position'=>100),
192 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>115),
193 'u.login'=>array(
'label'=>
"Author",
'checked'=>1),
194 'dynamount_payed'=>array(
'label'=>
"Paid",
'checked'=>0),
195 'rtp'=>array(
'label'=>
"Rest",
'checked'=>0),
196 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
197 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
198 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
199 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
200 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
201 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
202 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
203 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
204 'f.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
205 'f.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
208 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
213 if ((empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
214 || (empty($conf->supplier_invoice->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
217 if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
218 || (empty($user->rights->supplier_invoice->lire) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
228 if (
GETPOST(
'cancel',
'alpha')) {
229 $action =
'list'; $massaction =
'';
231 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
235 $parameters = array(
'socid'=>$socid);
236 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
241 if (empty($reshook)) {
242 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
244 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
248 $search_product_category =
'';
250 $search_refsupplier =
"";
253 $search_project =
'';
254 $search_company =
"";
255 $search_amount_no_tax =
"";
256 $search_amount_all_tax =
"";
257 $search_montant_ht =
'';
258 $search_montant_vat =
'';
259 $search_montant_localtax1 =
'';
260 $search_montant_localtax2 =
'';
261 $search_montant_ttc =
'';
263 $search_multicurrency_code =
'';
264 $search_multicurrency_tx =
'';
265 $search_multicurrency_montant_ht =
'';
266 $search_multicurrency_montant_vat =
'';
267 $search_multicurrency_montant_ttc =
'';
269 $search_paymentmode =
'';
270 $search_paymentcond =
'';
275 $search_country =
'';
276 $search_type_thirdparty =
'';
277 $search_date_startday =
'';
278 $search_date_startmonth =
'';
279 $search_date_startyear =
'';
280 $search_date_endday =
'';
281 $search_date_endmonth =
'';
282 $search_date_endyear =
'';
283 $search_date_start =
'';
284 $search_date_end =
'';
285 $search_datelimit_startday =
'';
286 $search_datelimit_startmonth =
'';
287 $search_datelimit_startyear =
'';
288 $search_datelimit_endday =
'';
289 $search_datelimit_endmonth =
'';
290 $search_datelimit_endyear =
'';
291 $search_datelimit_start =
'';
292 $search_datelimit_end =
'';
294 $search_array_options = array();
298 $search_categ_sup = 0;
302 $objectclass =
'FactureFournisseur';
303 $objectlabel =
'SupplierInvoices';
304 $permissiontoread = ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire);
305 $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
306 $permissiontodelete = ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer);
307 $uploaddir = $conf->fournisseur->facture->dir_output;
308 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
310 if ($massaction ==
'banktransfertrequest') {
311 $langs->load(
"withdrawals");
313 if (!$user->rights->paymentbybanktransfer->create) {
320 $arrayofselected = is_array($toselect) ? $toselect : array();
321 $listofbills = array();
322 foreach ($arrayofselected as $toselectid) {
324 $result = $objecttmp->fetch($toselectid);
326 $totalpaid = $objecttmp->getSommePaiement();
327 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
328 $totaldeposits = $objecttmp->getSumDepositsUsed();
329 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
332 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
333 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
335 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
336 } elseif ($objecttmp->resteapayer < 0) {
338 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
341 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
342 $rsql .=
" , pfd.date_traite as date_traite";
343 $rsql .=
" , pfd.amount";
344 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
345 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_facture_demande as pfd";
346 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
347 $rsql .=
" WHERE fk_facture_fourn = ".((int) $objecttmp->id);
348 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
349 $rsql .=
" AND pfd.traite = 0";
350 $rsql .=
" ORDER BY pfd.date_demande DESC";
352 $result_sql = $db->query($rsql);
354 $numprlv = $db->num_rows($result_sql);
359 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
360 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'VIR') {
362 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
364 $listofbills[] = $objecttmp;
370 if (!empty($listofbills)) {
371 $nbwithdrawrequestok = 0;
372 foreach ($listofbills as $aBill) {
374 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'bank-transfer',
'supplier_invoice');
377 $nbwithdrawrequestok++;
383 if ($nbwithdrawrequestok > 0) {
384 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
399 $bankaccountstatic =
new Account($db);
402 $thirdparty =
new Societe($db);
407 if ($search_all || $search_product_category > 0) {
408 $sql =
'SELECT DISTINCT';
410 $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,";
411 $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,";
412 $sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
413 $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,';
414 $sql .=
" f.note_public, f.note_private,";
415 $sql .=
" f.fk_user_author,";
416 $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,";
417 $sql .=
" typent.code as typent_code,";
418 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
419 $sql .=
" country.code as country_code,";
420 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
421 $sql .=
' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
422 if ($search_categ_sup && $search_categ_sup !=
'-1') {
423 $sql .=
", cs.fk_categorie, cs.fk_soc";
428 $sql .=
', SUM(pf.amount) as dynamount_payed';
431 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
432 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
433 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
437 $parameters = array();
438 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
439 $sql .= $hookmanager->resPrint;
440 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
441 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
442 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
443 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
444 if (!empty($search_categ_sup) && $search_categ_supplier !=
'-1') {
445 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
448 $sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
449 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
450 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
453 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
455 if ($search_all || $search_product_category > 0) {
456 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn';
458 if ($search_product_category > 0) {
459 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
461 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
462 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
464 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
465 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
467 if ($search_user > 0) {
468 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
469 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
472 $parameters = array();
473 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
474 $sql .= $hookmanager->resPrint;
475 $sql .=
' WHERE f.fk_soc = s.rowid';
476 $sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
477 if (empty($user->rights->societe->client->voir) && !$socid) {
478 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
480 if ($search_product_category > 0) {
481 $sql .=
" AND cp.fk_categorie = ".((int) $search_product_category);
484 $sql .=
' AND s.rowid = '.((int) $socid);
487 if (is_numeric($search_ref)) {
496 if ($search_refsupplier) {
499 if ($search_type !=
'' && $search_type >= 0) {
500 if ($search_type ==
'0') {
501 $sql .=
" AND f.type = 0";
503 if ($search_type ==
'1') {
504 $sql .=
" AND f.type = 1";
506 if ($search_type ==
'2') {
507 $sql .=
" AND f.type = 2";
509 if ($search_type ==
'3') {
510 $sql .=
" AND f.type = 3";
515 if ($search_project) {
518 if ($search_company) {
530 if ($search_country) {
531 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
533 if ($search_type_thirdparty !=
'' && $search_type_thirdparty >= 0) {
534 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
536 if ($search_montant_ht !=
'') {
539 if ($search_montant_vat !=
'') {
542 if ($search_montant_localtax1 !=
'') {
543 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
545 if ($search_montant_localtax2 !=
'') {
546 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
548 if ($search_montant_ttc !=
'') {
551 if ($search_multicurrency_code !=
'') {
552 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
554 if ($search_multicurrency_tx !=
'') {
555 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
557 if ($search_multicurrency_montant_ht !=
'') {
558 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
560 if ($search_multicurrency_montant_vat !=
'') {
561 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
563 if ($search_multicurrency_montant_ttc !=
'') {
564 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
567 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
569 if ($search_status !=
'' && $search_status >= 0) {
570 $sql .=
" AND f.fk_statut = ".((int) $search_status);
572 if ($search_paymentmode > 0) {
573 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
575 if ($search_paymentcond > 0) {
576 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
578 if ($search_date_start) {
579 $sql .=
" AND f.datef >= '" . $db->idate($search_date_start) .
"'";
581 if ($search_date_end) {
582 $sql .=
" AND f.datef <= '" . $db->idate($search_date_end) .
"'";
584 if ($search_datelimit_start) {
585 $sql .=
" AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) .
"'";
587 if ($search_datelimit_end) {
588 $sql .=
" AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) .
"'";
590 if ($option ==
'late') {
591 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->fournisseur->warning_delay).
"'";
596 if ($search_categ_sup > 0) {
597 $sql .=
" AND cs.fk_categorie = ".((int) $search_categ_sup);
599 if ($search_categ_sup == -2) {
600 $sql .=
" AND cs.fk_categorie IS NULL";
602 if ($search_status !=
'' && $search_status >= 0) {
603 $sql .=
" AND f.fk_statut = ".((int) $search_status);
605 if ($filter && $filter != -1) {
606 $aFilter = explode(
',', $filter);
607 foreach ($aFilter as $fil) {
608 $filt = explode(
':', $fil);
609 $sql .=
" AND ".$db->escape(trim($filt[0])).
" = '".$db->escape(trim($filt[1])).
"'";
612 if ($search_sale > 0) {
613 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
615 if ($search_user > 0) {
616 $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 = ".((int) $search_user);
619 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
621 $parameters = array();
622 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
623 $sql .= $hookmanager->resPrint;
626 $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,";
627 $sql .=
" f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,";
628 $sql .=
" f.localtax1, f.localtax2,";
629 $sql .=
' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
630 $sql .=
" f.note_public, f.note_private,";
631 $sql .=
" f.fk_user_author,";
632 $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,';
633 $sql .=
" typent.code,";
634 $sql .=
" state.code_departement, state.nom,";
635 $sql .=
' country.code,';
636 $sql .=
" p.rowid, p.ref, p.title,";
637 $sql .=
" u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
638 if ($search_categ_sup && $search_categ_sup !=
'-1') {
639 $sql .=
", cs.fk_categorie, cs.fk_soc";
641 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
642 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
644 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
",ef.".$key :
'');
648 $parameters = array(
'all' => $all,
'fieldstosearchall' => $fieldstosearchall);
649 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
650 $sql .= $hookmanager->resPrint;
652 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
656 $parameters = array();
657 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
658 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
660 $sql .= $db->order($sortfield, $sortorder);
662 $nbtotalofrecords =
'';
663 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
664 $result = $db->query($sql);
665 $nbtotalofrecords = $db->num_rows($result);
666 if (($page * $limit) > $nbtotalofrecords) {
672 $sql .= $db->plimit($limit + 1, $offset);
675 $resql = $db->query($sql);
677 $num = $db->num_rows(
$resql);
679 $arrayofselected = is_array($toselect) ? $toselect : array();
681 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
682 $obj = $db->fetch_object(
$resql);
685 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$id);
689 llxHeader(
'', $langs->trans(
"SuppliersInvoices"),
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
694 if (empty($search_company)) {
695 $search_company = $soc->name;
699 $param =
'&socid='.$socid;
700 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
701 $param .=
'&contextpage='.urlencode($contextpage);
703 if ($limit > 0 && $limit != $conf->liste_limit) {
704 $param .=
'&limit='.urlencode($limit);
707 $param .=
'&search_all='.urlencode($search_all);
709 if ($search_date_startday) {
710 $param .=
'&search_date_startday='.urlencode($search_date_startday);
712 if ($search_date_startmonth) {
713 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
715 if ($search_date_startyear) {
716 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
718 if ($search_date_endday) {
719 $param .=
'&search_date_endday='.urlencode($search_date_endday);
721 if ($search_date_endmonth) {
722 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
724 if ($search_date_endyear) {
725 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
727 if ($search_datelimit_startday) {
728 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
730 if ($search_datelimit_startmonth) {
731 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
733 if ($search_datelimit_startyear) {
734 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
736 if ($search_datelimit_endday) {
737 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
739 if ($search_datelimit_endmonth) {
740 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
742 if ($search_datelimit_endyear) {
743 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
746 $param .=
'&search_ref='.urlencode($search_ref);
748 if ($search_refsupplier) {
749 $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
751 if ($search_type !=
'') {
752 $param .=
'&search_type='.urlencode($search_type);
755 $param .=
'&search_label='.urlencode($search_label);
757 if ($search_company) {
758 $param .=
'&search_company='.urlencode($search_company);
761 $param .=
'&search_login='.urlencode($search_login);
763 if ($search_montant_ht !=
'') {
764 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
766 if ($search_montant_vat !=
'') {
767 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
769 if ($search_montant_localtax1 !=
'') {
770 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
772 if ($search_montant_localtax2 !=
'') {
773 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
775 if ($search_montant_ttc !=
'') {
776 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
778 if ($search_multicurrency_code !=
'') {
779 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
781 if ($search_multicurrency_tx !=
'') {
782 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
784 if ($search_multicurrency_montant_ht !=
'') {
785 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
787 if ($search_multicurrency_montant_vat !=
'') {
788 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
790 if ($search_multicurrency_montant_ttc !=
'') {
791 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
793 if ($search_amount_no_tax) {
794 $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
796 if ($search_amount_all_tax) {
797 $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
799 if ($search_status >= 0) {
800 $param .=
"&search_status=".urlencode($search_status);
803 $param .=
'&show_files='.urlencode($show_files);
806 $param .=
"&search_option=".urlencode($option);
808 if ($optioncss !=
'') {
809 $param .=
'&optioncss='.urlencode($optioncss);
811 if ($search_categ_sup > 0) {
812 $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
814 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
815 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
819 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
821 $parameters = array();
822 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
823 $param .= $hookmanager->resPrint;
826 $arrayofmassactions = array(
827 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
828 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
833 if (!empty($conf->paymentbybanktransfer->enabled) && !empty($user->rights->paymentbybanktransfer->create)) {
834 $langs->load(
'withdrawals');
835 $arrayofmassactions[
'banktransfertrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
837 if ($user->rights->fournisseur->facture->supprimer) {
838 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
840 if (in_array($massaction, array(
'presend',
'predelete'))) {
841 $arrayofmassactions = array();
843 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
845 $url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
846 if (!empty($socid)) {
847 $url .=
'&socid='.urlencode($socid);
849 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer));
852 print
'<form method="POST" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
853 if ($optioncss !=
'') {
854 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
856 print
'<input type="hidden" name="token" value="'.newToken().
'">';
857 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
858 print
'<input type="hidden" name="action" value="list">';
859 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
860 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
861 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
863 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);
865 $topicmail =
"SendBillRef";
866 $modelmail =
"invoice_supplier_send";
868 $trackid =
'sinv'.$object->id;
869 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
872 foreach ($fieldstosearchall as $key => $val) {
873 $fieldstosearchall[$key] = $langs->trans($val);
875 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
880 if ($user->rights->user->user->lire) {
881 $langs->load(
"commercial");
882 $moreforfilter .=
'<div class="divsearchfield">';
883 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
884 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
885 $moreforfilter .=
'</div>';
888 if ($user->rights->user->user->lire) {
889 $moreforfilter .=
'<div class="divsearchfield">';
890 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
891 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
892 $moreforfilter .=
'</div>';
895 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
896 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
897 $moreforfilter .=
'<div class="divsearchfield">';
898 $tmptitle = $langs->trans(
'IncludingProductWithTag');
899 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
900 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
901 $moreforfilter .=
'</div>';
904 if (!empty($conf->categorie->enabled)) {
905 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
906 $moreforfilter .=
'<div class="divsearchfield">';
907 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
908 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $tmptitle);
909 $moreforfilter .=
'</div>';
911 $parameters = array();
912 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
913 if (empty($reshook)) {
914 $moreforfilter .= $hookmanager->resPrint;
916 $moreforfilter = $hookmanager->resPrint;
919 if ($moreforfilter) {
920 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
921 print $moreforfilter;
925 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
926 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
927 if ($massactionbutton) {
928 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
931 print
'<div class="div-table-responsive">';
932 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
935 print
'<tr class="liste_titre_filter">';
937 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
938 print
'<td class="liste_titre left">';
939 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
943 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
944 print
'<td class="liste_titre">';
945 print
'<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).
'">';
949 if (!empty($arrayfields[
'f.type'][
'checked'])) {
950 print
'<td class="liste_titre maxwidthonsmartphone">';
964 print
$form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
968 if (!empty($arrayfields[
'f.label'][
'checked'])) {
969 print
'<td class="liste_titre">';
970 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
974 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
975 print
'<td class="liste_titre center">';
976 print
'<div class="nowrap">';
977 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
979 print
'<div class="nowrap">';
980 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
985 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
986 print
'<td class="liste_titre center">';
987 print
'<div class="nowrap">';
994 print
$form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
995 print
'<br><input type="checkbox" name="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'> '.$langs->trans(
"Alert");
1000 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1001 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1004 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1005 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1008 if (!empty($arrayfields[
's.town'][
'checked'])) {
1009 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1012 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1013 print
'<td class="liste_titre center"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1016 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1017 print
'<td class="liste_titre">';
1018 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1022 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1023 print
'<td class="liste_titre center">';
1024 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1028 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1029 print
'<td class="liste_titre maxwidthonsmartphone center">';
1030 print
$form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1034 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1035 print
'<td class="liste_titre left">';
1036 $form->select_conditions_paiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
1040 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1041 print
'<td class="liste_titre left">';
1042 $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100');
1045 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1047 print
'<td class="liste_titre right">';
1048 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1051 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1053 print
'<td class="liste_titre right">';
1054 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1057 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1059 print
'<td class="liste_titre right">';
1060 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1063 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1065 print
'<td class="liste_titre right">';
1066 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1069 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1071 print
'<td class="liste_titre right">';
1072 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1075 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1077 print
'<td class="liste_titre" align="center">';
1078 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1081 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1082 print
'<td class="liste_titre right">';
1085 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1086 print
'<td class="liste_titre">';
1089 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1091 print
'<td class="liste_titre">';
1092 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1095 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1097 print
'<td class="liste_titre">';
1098 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1101 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1103 print
'<td class="liste_titre right">';
1104 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1107 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1109 print
'<td class="liste_titre right">';
1110 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1113 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1115 print
'<td class="liste_titre right">';
1116 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1119 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1120 print
'<td class="liste_titre">';
1123 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1124 print
'<td class="liste_titre right">';
1128 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1131 $parameters = array(
'arrayfields'=>$arrayfields);
1132 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1133 print $hookmanager->resPrint;
1135 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1136 print
'<td class="liste_titre">';
1140 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1141 print
'<td class="liste_titre">';
1145 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1146 print
'<td class="liste_titre maxwidthonsmartphone right">';
1147 $liststatus = array(
'0'=>$langs->trans(
"Draft"),
'1'=>$langs->trans(
"Unpaid"),
'2'=>$langs->trans(
"Paid"));
1148 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1152 print
'<td class="liste_titre middle">';
1153 $searchpicto =
$form->showFilterButtons();
1159 print
'<tr class="liste_titre">';
1160 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1161 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
1163 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1164 print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
1166 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1167 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1169 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1170 print_liste_field_titre($arrayfields[
'f.label'][
'label'], $_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
1172 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1173 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1175 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1176 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1178 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1179 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1181 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1182 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1184 if (!empty($arrayfields[
's.town'][
'checked'])) {
1185 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1187 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1188 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder,
'center ');
1190 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1191 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1193 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1194 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1196 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1197 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1199 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1200 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1202 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1203 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1205 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1206 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1208 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1209 print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1211 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1212 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1214 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1215 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1217 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1218 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1220 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1221 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1223 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1224 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1226 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1227 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1229 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1230 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1232 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1233 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1235 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1236 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1238 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1239 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1241 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1242 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1244 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1245 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1247 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1248 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1251 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1253 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1254 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1255 print $hookmanager->resPrint;
1256 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1257 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1259 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1260 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1262 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1263 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'right ');
1265 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1270 $projectstatic =
new Project($db);
1271 $userstatic =
new User($db);
1275 $totalarray = array();
1276 while ($i < min($num, $limit)) {
1277 $obj = $db->fetch_object(
$resql);
1279 $datelimit = $db->jdate($obj->datelimite);
1280 $facturestatic->id = $obj->facid;
1281 $facturestatic->ref = $obj->ref;
1282 $facturestatic->type = $obj->type;
1283 $facturestatic->ref_supplier = $obj->ref_supplier;
1284 $facturestatic->date_echeance = $db->jdate($obj->datelimite);
1285 $facturestatic->statut = $obj->fk_statut;
1286 $facturestatic->note_public = $obj->note_public;
1287 $facturestatic->note_private = $obj->note_private;
1288 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1289 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1290 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1291 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1292 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1294 $thirdparty->id = $obj->socid;
1295 $thirdparty->name = $obj->name;
1296 $thirdparty->client = $obj->client;
1297 $thirdparty->fournisseur = $obj->fournisseur;
1298 $thirdparty->code_client = $obj->code_client;
1299 $thirdparty->code_compta_client = $obj->code_compta_client;
1300 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1301 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1302 $thirdparty->email = $obj->email;
1303 $thirdparty->country_code = $obj->country_code;
1305 $paiement = $facturestatic->getSommePaiement();
1306 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1307 $totaldeposits = $facturestatic->getSumDepositsUsed();
1308 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1309 $remaintopay = $obj->total_ttc - $totalpay;
1310 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1311 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1312 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1313 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1314 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1316 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1317 $facturestatic->paye = $obj->paye;
1318 $facturestatic->statut = $obj->fk_statut;
1319 $facturestatic->type = $obj->type;
1324 if ($facturestatic->isCreditNoteUsed()) {
1325 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1329 print
'<tr class="oddeven">';
1330 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1331 print
'<td class="nowraponall">';
1333 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1335 print
'<td class="nobordernopadding nowraponall">';
1336 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1339 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1340 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1341 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1342 print
'</td></tr></table>';
1346 $totalarray[
'nbfield']++;
1351 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1352 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1353 print $obj->ref_supplier;
1356 $totalarray[
'nbfield']++;
1361 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1362 print
'<td class="nowrap">';
1363 print $facturestatic->getLibType();
1366 $totalarray[
'nbfield']++;
1371 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1372 print
'<td class="nowrap">';
1376 $totalarray[
'nbfield']++;
1381 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1382 print
'<td class="center nowrap">';
1386 $totalarray[
'nbfield']++;
1391 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1392 print
'<td class="center nowraponall">'.dol_print_date($datelimit,
'day');
1393 if ($facturestatic->hasDelay()) {
1394 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
1398 $totalarray[
'nbfield']++;
1403 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1404 print
'<td class="nowrap">';
1405 if ($obj->project_id > 0) {
1406 $projectstatic->id = $obj->project_id;
1407 $projectstatic->ref = $obj->project_ref;
1408 $projectstatic->title = $obj->project_label;
1409 print $projectstatic->getNomUrl(1);
1413 $totalarray[
'nbfield']++;
1418 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1419 print
'<td class="tdoverflowmax200">';
1420 print $thirdparty->getNomUrl(1,
'supplier');
1423 $totalarray[
'nbfield']++;
1427 if (!empty($arrayfields[
's.town'][
'checked'])) {
1428 print
'<td class="nocellnopadd">';
1432 $totalarray[
'nbfield']++;
1436 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1437 print
'<td class="nocellnopadd center tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1441 $totalarray[
'nbfield']++;
1445 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1446 print
"<td>".$obj->state_name.
"</td>\n";
1448 $totalarray[
'nbfield']++;
1452 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1453 print
'<td class="center">';
1454 $tmparray =
getCountry($obj->fk_pays,
'all');
1455 print $tmparray[
'label'];
1458 $totalarray[
'nbfield']++;
1462 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1463 print
'<td class="center">';
1464 if (empty($typenArray)) {
1465 $typenArray = $formcompany->typent_array(1);
1467 print $typenArray[$obj->typent_code];
1470 $totalarray[
'nbfield']++;
1475 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1476 print
'<td class="tdoverflowmax125">';
1477 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 1);
1480 $totalarray[
'nbfield']++;
1484 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1485 print
'<td class="tdoverflowmax125">';
1486 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1489 $totalarray[
'nbfield']++;
1494 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1495 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1497 $totalarray[
'nbfield']++;
1500 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
1502 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
1505 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1506 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_vat).
"</span></td>\n";
1508 $totalarray[
'nbfield']++;
1511 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_vat';
1513 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
1516 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1517 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax1).
"</span></td>\n";
1519 $totalarray[
'nbfield']++;
1522 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
1524 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
1527 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1528 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax2).
"</span></td>\n";
1530 $totalarray[
'nbfield']++;
1533 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
1535 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
1538 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1539 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1541 $totalarray[
'nbfield']++;
1544 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
1546 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
1549 $userstatic->id = $obj->fk_user_author;
1550 $userstatic->login = $obj->login;
1551 $userstatic->lastname = $obj->lastname;
1552 $userstatic->firstname = $obj->firstname;
1553 $userstatic->email = $obj->user_email;
1554 $userstatic->statut = $obj->user_statut;
1555 $userstatic->entity = $obj->entity;
1556 $userstatic->photo = $obj->photo;
1557 $userstatic->office_phone = $obj->office_phone;
1558 $userstatic->office_fax = $obj->office_fax;
1559 $userstatic->user_mobile = $obj->user_mobile;
1560 $userstatic->job = $obj->job;
1561 $userstatic->gender = $obj->gender;
1564 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1565 print
'<td class="tdoverflowmax200">';
1566 if ($userstatic->id) {
1567 print $userstatic->getLoginUrl(-1);
1573 $totalarray[
'nbfield']++;
1577 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1578 print
'<td class="right nowrap"><span class="amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
'').
'</span></td>';
1580 $totalarray[
'nbfield']++;
1583 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
1585 $totalarray[
'val'][
'totalam'] += $totalpay;
1588 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1589 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
1591 $totalarray[
'nbfield']++;
1594 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
1596 $totalarray[
'val'][
'rtp'] += $remaintopay;
1600 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1601 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1603 $totalarray[
'nbfield']++;
1608 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1609 print
'<td class="nowrap">';
1610 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1613 $totalarray[
'nbfield']++;
1617 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1618 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1620 $totalarray[
'nbfield']++;
1624 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1625 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1627 $totalarray[
'nbfield']++;
1631 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1632 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1634 $totalarray[
'nbfield']++;
1637 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1638 print
'<td class="right nowrap"><span class="amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
'').
'</span></td>';
1640 $totalarray[
'nbfield']++;
1645 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1646 print
'<td class="right nowrap"><span class="amount">';
1647 print (!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
'');
1648 print
'</span></td>';
1650 $totalarray[
'nbfield']++;
1656 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1658 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1659 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1660 print $hookmanager->resPrint;
1663 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1664 print
'<td class="center nowrap">';
1665 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1668 $totalarray[
'nbfield']++;
1672 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1673 print
'<td class="center nowrap">';
1674 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1677 $totalarray[
'nbfield']++;
1681 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1682 print
'<td class="right nowrap">';
1683 print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type);
1686 $totalarray[
'nbfield']++;
1691 print
'<td class="nowrap center">';
1692 if ($massactionbutton || $massaction) {
1694 if (in_array($obj->facid, $arrayofselected)) {
1697 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1701 $totalarray[
'nbfield']++;
1710 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1715 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1716 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1717 print $hookmanager->resPrint;
1724 $hidegeneratedfilelistifempty = 1;
1725 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1726 $hidegeneratedfilelistifempty = 0;
1730 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1731 $urlsource .= str_replace(
'&',
'&', $param);
1733 $filedir = $diroutputmassaction;
1734 $genallowed = $user->rights->facture->lire;
1735 $delallowed = $user->rights->facture->creer;
1738 print $formfile->showdocuments(
'massfilesarea_supplier_invoice',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);