41require
'../../main.inc.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
60require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
64$langs->loadLangs(array(
'products',
'bills',
'companies',
'projects',
'banks'));
66$action =
GETPOST(
'action',
'aZ09');
67$massaction =
GETPOST(
'massaction',
'alpha');
69$confirm =
GETPOST(
'confirm',
'alpha');
70$toselect =
GETPOST(
'toselect',
'array:int');
71$optioncss =
GETPOST(
'optioncss',
'alpha');
72$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicelist';
75$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
76$search_label =
GETPOST(
"search_label",
"alpha");
77$search_amount_no_tax =
GETPOST(
"search_amount_no_tax",
"alpha");
78$search_amount_all_tax =
GETPOST(
"search_amount_all_tax",
"alpha");
80$search_refsupplier =
GETPOST(
'search_refsupplier',
'alpha');
81$search_type =
GETPOST(
'search_type',
'intcomma');
82$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
83$search_project =
GETPOST(
'search_project',
'alpha');
84$search_company =
GETPOST(
'search_company',
'alpha');
85$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
86$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
87$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
88$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
89$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
90$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
91$search_login =
GETPOST(
'search_login',
'alpha');
92$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
93$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
94$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
95$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
96$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
97$search_status =
GETPOST(
'search_status',
'array:intcomma');
98if (empty($search_status) && GETPOSTISSET(
'search_status')) {
100 $search_status =
GETPOST(
'search_status',
'intcomma');
101 if ($search_status !==
'' && $search_status !==
'-1') {
102 $search_status = array($search_status);
106} elseif (is_array($search_status) && count($search_status) == 0) {
109$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
110$search_paymentcond =
GETPOST(
'search_paymentcond') ?
GETPOSTINT(
'search_paymentcond') :
'';
111$search_bankaccount =
GETPOST(
'search_bankaccount',
'intcomma');
112$search_vat_reverse_charge =
GETPOST(
'search_vat_reverse_charge',
'alpha');
113$search_town =
GETPOST(
'search_town',
'alpha');
114$search_zip =
GETPOST(
'search_zip',
'alpha');
115$search_state =
GETPOST(
"search_state");
116$search_note_private =
GETPOST(
'search_note_private',
'alpha');
117$search_note_public =
GETPOST(
'search_note_public',
'alpha');
118$search_country =
GETPOST(
"search_country",
'aZ09');
119$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
120$search_user =
GETPOST(
'search_user',
'intcomma');
121$search_sale =
GETPOST(
'search_sale',
'intcomma');
122$search_date_start =
GETPOSTDATE(
'search_date_start',
'',
'tzserver');
123$search_date_end =
GETPOSTDATE(
'search_date_end',
'23:59:59',
'tzserver');
124$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
125$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
126$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
127$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
128$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
129$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
130$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
131$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
132$search_categ_sup =
GETPOST(
"search_categ_sup",
'intcomma');
133$searchCategorySupplierInvoiceList =
GETPOST(
'search_category_supplier_invoice_list',
'array:int');
134$searchCategorySupplierInvoiceOperator = 0;
135if (GETPOSTISSET(
'formfilteraction')) {
136 $searchCategorySupplierInvoiceOperator =
GETPOSTINT(
'search_category_supplier_invoice_operator');
138 $searchCategorySupplierInvoiceOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
140$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
141$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
143$option =
GETPOST(
'search_option');
144if ($option ==
'late') {
145 $search_status =
'1';
147$filter =
GETPOST(
'filtre',
'alpha');
151$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
152$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
154if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
158$offset = $limit * $page;
163 $sortfield =
"f.datef,f.rowid";
165$pageprev = $page - 1;
166$pagenext = $page + 1;
171if ($user->socid > 0) {
173 $socid = $user->socid;
180$hookmanager->initHooks(array(
'supplierinvoicelist'));
182$diroutputmassaction =
getMultidirTemp($object).
'/massgeneration/'.$user->id;
185$extrafields->fetch_name_optionals_label(
$object->table_element);
187$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
190$fieldstosearchall = array(
192 'f.ref_supplier' =>
'RefSupplier',
193 'f.note_public' =>
'NotePublic',
194 's.nom' =>
"ThirdParty",
195 's.code_fournisseur' =>
"SupplierCodeShort",
196 'pd.description' =>
'Description',
198if (empty($user->socid)) {
199 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
202$checkedtypetiers =
'0';
204 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
205 'f.ref_supplier' => array(
'label' =>
"RefSupplier",
'checked' =>
'1',
'position' => 7),
206 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
207 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
208 'f.label' => array(
'label' =>
"Label",
'checked' =>
'0',
'position' => 20),
209 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 25),
210 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 27),
211 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'1',
'position' => 30,
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
212 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 41),
213 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'0',
'position' => 42),
214 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 43),
215 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 44),
216 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
217 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 46),
218 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 48),
219 'f.vat_reverse_charge' => array(
'label' =>
"VATReverseCharge",
'checked' =>
'0',
'position' => 49,
'enabled' => (
getDolGlobalString(
'ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE') ?
'1' :
'0')),
220 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0',
'position' => 52),
221 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0',
'position' => 50),
222 'ba.label' => array(
'label' =>
"BankAccount",
'langfile' =>
'banks',
'checked' =>
'0',
'enabled' => (
string) (int) (
isModEnabled(
'bank')),
'position' => 192),
223 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 105),
224 'f.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 110),
225 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (int) (
$mysoc->localtax1_assuj ==
"1"),
'position' => 95),
226 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (int) (
$mysoc->localtax2_assuj ==
"1"),
'position' => 100),
227 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1',
'position' => 115),
228 'dynamount_payed' => array(
'label' =>
"Paid",
'checked' =>
'0',
'position' => 116),
229 'rtp' => array(
'label' =>
"Rest",
'checked' =>
'0',
'position' => 117),
230 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'position' => 205,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
231 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'position' => 206,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
232 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'position' => 207,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
233 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'position' => 208,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
234 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'position' => 209,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
235 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'position' => 210,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
236 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'position' => 211,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
237 'u.login' => array(
'label' =>
"Author",
'checked' =>
'-1',
'position' => 500),
238 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
239 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 502),
240 'f.nb_docs' => array(
'label' =>
"Documents",
'checked' =>
'-1',
'position' => 510),
241 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES') ?
'0' :
'1')),
242 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES') ?
'0' :
'1')),
243 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
246include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
248$parameters = array(
'arrayfields' => &$arrayfields);
249$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
251$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
252if (empty($subtypearray)) {
253 unset($arrayfields[
'f.subtype']);
262if ((!$user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))
263 || (!$user->hasRight(
"supplier_invoice",
"lire") &&
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))) {
268if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
269 $search_sale = $user->id;
272$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
273$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
274$permissiontodelete = ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer"));
281if (
GETPOST(
'cancel',
'alpha')) {
285if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
289$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
290$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
295if (empty($reshook)) {
297 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
300 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
304 $search_product_category =
'';
305 $searchCategorySupplierInvoiceList = array();
307 $search_refsupplier =
"";
309 $search_subtype =
'';
311 $search_project =
'';
312 $search_company =
"";
313 $search_company_alias =
"";
314 $search_amount_no_tax =
"";
315 $search_amount_all_tax =
"";
316 $search_montant_ht =
'';
317 $search_montant_vat =
'';
318 $search_montant_localtax1 =
'';
319 $search_montant_localtax2 =
'';
320 $search_montant_ttc =
'';
322 $search_multicurrency_code =
'';
323 $search_multicurrency_tx =
'';
324 $search_multicurrency_montant_ht =
'';
325 $search_multicurrency_montant_vat =
'';
326 $search_multicurrency_montant_ttc =
'';
328 $search_paymentmode =
'';
329 $search_paymentcond =
'';
330 $search_bankaccount =
'';
331 $search_vat_reverse_charge =
'';
335 $search_country =
'';
336 $search_type_thirdparty =
'';
337 $search_date_start =
'';
338 $search_date_end =
'';
339 $search_datelimit_startday =
'';
340 $search_datelimit_startmonth =
'';
341 $search_datelimit_startyear =
'';
342 $search_datelimit_endday =
'';
343 $search_datelimit_endmonth =
'';
344 $search_datelimit_endyear =
'';
345 $search_datelimit_start =
'';
346 $search_datelimit_end =
'';
347 $search_note_private =
'';
348 $search_note_public =
'';
350 $search_array_options = array();
351 $search_categ_sup = 0;
357 $objectclass =
'FactureFournisseur';
358 $objectlabel =
'SupplierInvoices';
362 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
364 if ($massaction ==
'banktransfertrequest') {
365 $langs->load(
"withdrawals");
367 if (!$user->hasRight(
"paymentbybanktransfer",
"create")) {
374 $arrayofselected = is_array($toselect) ? $toselect : array();
375 $listofbills = array();
376 foreach ($arrayofselected as $toselectid) {
378 $result = $objecttmp->fetch($toselectid);
380 $totalpaid = $objecttmp->getSommePaiement();
381 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
382 $totaldeposits = $objecttmp->getSumDepositsUsed();
383 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
386 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
387 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
389 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
390 $objecttmp->resteapayer = $remaintopay;
392 } elseif ($reshook < 0) {
394 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
399 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
400 } elseif ($objecttmp->paid || $objecttmp->resteapayer == 0) {
402 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
403 } elseif ($objecttmp->resteapayer < 0) {
405 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
408 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
409 $rsql .=
" , pfd.date_traite as date_traite";
410 $rsql .=
" , pfd.amount";
411 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
412 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
413 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
414 $rsql .=
" WHERE fk_facture_fourn = ".((int) $objecttmp->id);
415 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
416 $rsql .=
" AND pfd.traite = 0";
417 $rsql .=
" ORDER BY pfd.date_demande DESC";
420 $result_sql =
$db->query($rsql);
422 $numprlv =
$db->num_rows($result_sql);
428 $sqlPending1 =
"SELECT SUM(pfd.amount) as amount";
429 $sqlPending1 .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
430 $sqlPending1 .=
" WHERE pfd.fk_facture_fourn = ".((int) $objecttmp->id);
431 $sqlPending1 .=
" AND pfd.traite = 0";
432 $resPending1 =
$db->query($sqlPending1);
434 $objPending1 =
$db->fetch_object($resPending1);
436 $pending += (float) $objPending1->amount;
439 $db->free($resPending1);
441 $sqlPending2 =
"SELECT SUM(pl.amount) as amount";
442 $sqlPending2 .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
443 $sqlPending2 .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
444 $sqlPending2 .=
" WHERE p.fk_facture_fourn = ".((int) $objecttmp->id);
445 $sqlPending2 .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
446 $resPending2 =
$db->query($sqlPending2);
448 if ($objPending2 =
$db->fetch_object($resPending2)) {
449 $pending += (float) $objPending2->amount;
452 $db->free($resPending2);
453 $remaintopaylesspendingdebit = $objecttmp->resteapayer - $pending;
455 if ($remaintopaylesspendingdebit <= 0) {
457 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountRequestedAlreadyReachesTotal"), $objecttmp->errors,
'warnings');
458 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'VIR') {
459 $langs->load(
"errors");
461 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
463 $listofbills[] = $objecttmp;
469 if (!empty($listofbills)) {
470 $nbwithdrawrequestok = 0;
471 foreach ($listofbills as $aBill) {
478 $sql =
"SELECT SUM(pfd.amount) as amount";
479 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
481 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int) $aBill->id);
485 $sql .=
" AND pfd.traite = 0";
487 $resql =
$db->query($sql);
489 $obj =
$db->fetch_object($resql);
491 $pending += (float) $obj->amount;
497 $sqlPending =
"SELECT SUM(pl.amount) as amount";
498 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
499 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
501 $sqlPending .=
" WHERE p.fk_facture_fourn = ".((int) $aBill->id);
505 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
506 $resPending =
$db->query($sqlPending);
508 if ($objPending =
$db->fetch_object($resPending)) {
509 $pending += (float) $objPending->amount;
512 $db->free($resPending);
514 $requestAmount = $aBill->resteapayer - $pending;
515 if ($requestAmount > 0) {
517 $result = $aBill->demande_prelevement($user, $requestAmount,
'bank-transfer',
'supplier_invoice');
520 $nbwithdrawrequestok++;
526 $aBill->error =
'WithdrawRequestErrorNilAmount';
527 $aBill->errors[] = $aBill->error;
531 if ($nbwithdrawrequestok > 0) {
532 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
551$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
558 if (empty($search_company)) {
559 $search_company = $soc->name;
563$title = $langs->trans(
"BillsSuppliers").($socid && ($soc !==
null) ?
' - '.$soc->name :
'');
564$help_url =
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
569$sql .=
" f.rowid as facid, f.ref, f.ref_supplier, f.type, f.subtype, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement, ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number as bnumber, ba.account_number as baccount_number, ba.fk_accountancy_journal as baccountancy_journal, f.vat_reverse_charge,";
570$sql .=
" f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.close_code, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_modification,";
571$sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
572$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,';
573$sql .=
" f.note_public, f.note_private,";
574$sql .=
" f.fk_user_author,";
575$sql .=
" s.rowid as socid, s.nom as name, s.name_alias as alias, 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,";
576$sql .=
" typent.code as typent_code,";
577$sql .=
" state.code_departement as state_code, state.nom as state_name,";
578$sql .=
" country.code as country_code,";
579$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
580$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';
582if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
583 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
584 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
588$parameters = array();
589$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
590$sql .= $hookmanager->resPrint;
591$sql = preg_replace(
'/,\s*$/',
'', $sql);
595$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
596$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
597$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
598$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
599$sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
600if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
601 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
603$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
604$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
605$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON ba.rowid = f.fk_account';
606if ($search_user > 0) {
607 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
608 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
611$parameters = array();
612$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
613$sql .= $hookmanager->resPrint;
614$sql .=
' WHERE f.fk_soc = s.rowid';
615$sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
617 $sql .=
' AND s.rowid = '.((int) $socid);
620 if (is_numeric($search_ref)) {
629if ($search_refsupplier) {
632if ($search_type !=
'' && $search_type >= 0) {
633 if ($search_type ==
'0') {
634 $sql .=
" AND f.type = 0";
636 if ($search_type ==
'1') {
637 $sql .=
" AND f.type = 1";
639 if ($search_type ==
'2') {
640 $sql .=
" AND f.type = 2";
642 if ($search_type ==
'3') {
643 $sql .=
" AND f.type = 3";
648if ($search_subtype !=
'' && $search_subtype !=
'-1') {
649 $sql .=
" AND f.subtype IN (".$db->sanitize(
$db->escape($search_subtype)).
")";
651if ($search_project) {
654if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
655 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
657 if ($search_company) {
660 if ($search_company_alias) {
673if (strlen(trim($search_country))) {
675 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
676 foreach ($arrayofcode as $key => $value) {
677 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
678 if ($value !=
$mysoc->country_code) {
679 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
682 if ($search_country ==
'special_allnotme') {
683 $sql .=
" AND country.code <> '".$db->escape(
$mysoc->country_code).
"'";
684 } elseif ($search_country ==
'special_eec') {
685 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
686 } elseif ($search_country ==
'special_eecnotme') {
687 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
688 } elseif ($search_country ==
'special_noteec') {
689 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
694if ($search_type_thirdparty !=
'' && $search_type_thirdparty >= 0) {
695 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
697if ($search_montant_ht !=
'') {
700if ($search_montant_vat !=
'') {
703if ($search_montant_localtax1 !=
'') {
704 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
706if ($search_montant_localtax2 !=
'') {
707 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
709if ($search_montant_ttc !=
'') {
712if ($search_multicurrency_code !=
'') {
713 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
715if ($search_multicurrency_tx !=
'') {
716 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
718if ($search_multicurrency_montant_ht !=
'') {
719 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
721if ($search_multicurrency_montant_vat !=
'') {
722 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
724if ($search_multicurrency_montant_ttc !=
'') {
725 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
728 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname'), $search_login);
730if (is_array($search_status) && count($search_status) > 0) {
731 $search_statusArray = $search_status;
732 $sql .=
" AND f.fk_statut IN (" .
$db->sanitize(implode(
',', array_map(
'intval', $search_statusArray))) .
")";
734if ($search_paymentmode > 0) {
735 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
737if ($search_paymentcond > 0) {
738 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
740if ($search_bankaccount > 0) {
741 $sql .=
" AND ba.rowid = ".((int) $search_bankaccount);
743if ($search_vat_reverse_charge !==
'' && $search_vat_reverse_charge !==
'-1') {
744 $sql .=
" AND f.vat_reverse_charge = ".((int) $search_vat_reverse_charge);
746if ($search_date_start) {
747 $sql .=
" AND f.datef >= '" .
$db->idate($search_date_start) .
"'";
749if ($search_date_end) {
750 $sql .=
" AND f.datef <= '" .
$db->idate($search_date_end) .
"'";
752if ($search_note_public) {
753 $sql .=
" AND f.note_public LIKE '%".$db->escape(
$db->escapeforlike($search_note_public)).
"%'";
755if ($search_note_private) {
756 $sql .=
" AND f.note_private LIKE '%".$db->escape(
$db->escapeforlike($search_note_private)).
"%'";
758if ($search_datelimit_start) {
759 $sql .=
" AND f.date_lim_reglement >= '" .
$db->idate($search_datelimit_start) .
"'";
761if ($search_datelimit_end) {
762 $sql .=
" AND f.date_lim_reglement <= '" .
$db->idate($search_datelimit_end) .
"'";
764if ($option ==
'late') {
765 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->facture->fournisseur->warning_delay).
"'";
770if ($search_fk_fac_rec_source) {
771 $sql .=
" AND f.fk_fac_rec_source = ".(int) $search_fk_fac_rec_source;
774if ($search_sale && $search_sale !=
'-1') {
775 if ($search_sale == -2) {
776 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
777 } elseif ($search_sale > 0) {
778 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
782if (!empty($searchCategorySupplierInvoiceList)) {
783 $searchCategorySupplierInvoiceSqlList = array();
784 $listofcategoryid =
'';
785 foreach ($searchCategorySupplierInvoiceList as $searchCategorySupplierInvoice) {
786 if (intval($searchCategorySupplierInvoice) == -2) {
787 $searchCategorySupplierInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice)";
788 } elseif (intval($searchCategorySupplierInvoice) > 0) {
789 if ($searchCategorySupplierInvoiceOperator == 0) {
790 $searchCategorySupplierInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice AND ck.fk_categorie = ".((int) $searchCategorySupplierInvoice).
")";
792 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierInvoice);
796 if ($listofcategoryid) {
797 $searchCategorySupplierInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
799 if ($searchCategorySupplierInvoiceOperator == 1) {
800 if (!empty($searchCategorySupplierInvoiceSqlList)) {
801 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierInvoiceSqlList).
")";
804 if (!empty($searchCategorySupplierInvoiceSqlList)) {
805 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierInvoiceSqlList).
")";
809$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
810$searchCategorySupplierOperator = 0;
812if (!empty($searchCategorySupplierList)) {
813 $searchCategorySupplierSqlList = array();
814 $listofcategoryid =
'';
815 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
816 if (intval($searchCategorySupplier) == -2) {
817 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
818 } elseif (intval($searchCategorySupplier) > 0) {
819 if ($searchCategorySupplierOperator == 0) {
820 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).
")";
822 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
826 if ($listofcategoryid) {
827 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
829 if ($searchCategorySupplierOperator == 1) {
830 if (!empty($searchCategorySupplierSqlList)) {
831 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
834 if (!empty($searchCategorySupplierSqlList)) {
835 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
840$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
841$searchCategoryProductOperator = 0;
842if (!empty($searchCategoryProductList)) {
843 $searchCategoryProductSqlList = array();
844 $listofcategoryid =
'';
845 foreach ($searchCategoryProductList as $searchCategoryProduct) {
846 if (intval($searchCategoryProduct) == -2) {
847 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product)";
848 } elseif (intval($searchCategoryProduct) > 0) {
849 if ($searchCategoryProductOperator == 0) {
850 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
852 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
856 if ($listofcategoryid) {
857 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
859 if ($searchCategoryProductOperator == 1) {
860 if (!empty($searchCategoryProductSqlList)) {
861 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
864 if (!empty($searchCategoryProductSqlList)) {
865 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
869if ($filter && $filter != -1) {
870 $aFilter = explode(
',', $filter);
871 foreach ($aFilter as $fil) {
872 $filt = explode(
':', $fil);
873 $sql .=
" AND ".$db->escape(trim($filt[0])).
" = '".
$db->escape(trim($filt[1])).
"'";
878 unset($fieldstosearchall[
'pd.description']);
880 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all, 0, 1);
881 $sql .=
" OR EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture_fourn_det as pd WHERE f.rowid = pd.fk_facture_fourn AND pd.description LIKE '%".
$db->escape(
$db->escapeforlike($search_all)).
"%')";
883 $fieldstosearchall[
'pd.description'] =
'Description';
886if ($search_user > 0) {
887 $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);
890include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
892$parameters = array();
893$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
894if (empty($reshook)) {
895 $sql .= $hookmanager->resPrint;
897 $sql = $hookmanager->resPrint;
901$parameters = array();
902$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
903if (empty($reshook)) {
904 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
906 $sql = $hookmanager->resPrint;
910$nbtotalofrecords =
'';
913 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
915 $resql =
$db->query($sqlforcount);
917 $objforcount =
$db->fetch_object($resql);
918 $nbtotalofrecords = $objforcount->nbtotalofrecords;
923 if (($page * $limit) > (
int) $nbtotalofrecords) {
931$sql .=
$db->order($sortfield, $sortorder);
933 $sql .=
$db->plimit($limit + 1, $offset);
937$resql =
$db->query($sql);
943$num =
$db->num_rows($resql);
946if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
947 $obj =
$db->fetch_object($resql);
949 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$id);
956llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-fourn-facture page-list');
958if ($search_fk_fac_rec_source) {
959 require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
960 require_once DOL_DOCUMENT_ROOT .
'/core/lib/invoice.lib.php';
962 $object->fetch((
int) $search_fk_fac_rec_source);
971 if (empty($search_company)) {
972 $search_company = $soc->name;
973 $search_company_alias = $soc->name_alias;
977$arrayofselected = is_array($toselect) ? $toselect : array();
979$param =
'&socid='.$socid;
981 $param .=
'&mode='.urlencode($mode);
983if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
984 $param .=
'&contextpage='.urlencode($contextpage);
986if ($limit > 0 && $limit !=
$conf->liste_limit) {
987 $param .=
'&limit='.((int) $limit);
989if ($optioncss !=
'') {
990 $param .=
'&optioncss='.urlencode($optioncss);
993 $param .=
'&search_all='.urlencode($search_all);
995if ($search_date_start) {
996 $param .= buildParamDate(
'search_date_start',
null,
'',
'tzserver');
998if ($search_date_end) {
999 $param .= buildParamDate(
'search_date_end',
null,
'',
'tzserver');
1001if ($search_datelimit_startday) {
1002 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1004if ($search_datelimit_startmonth) {
1005 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1007if ($search_datelimit_startyear) {
1008 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1010if ($search_datelimit_endday) {
1011 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1013if ($search_datelimit_endmonth) {
1014 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1016if ($search_datelimit_endyear) {
1017 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1020 $param .=
'&search_ref='.urlencode($search_ref);
1022if ($search_refsupplier) {
1023 $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
1025if ($search_type !=
'') {
1026 $param .=
'&search_type='.urlencode($search_type);
1028if ($search_subtype !=
'') {
1029 $param .=
'&search_subtype='.urlencode($search_subtype);
1032 $param .=
'&search_label='.urlencode($search_label);
1034if ($search_company) {
1035 $param .=
'&search_company='.urlencode($search_company);
1037if ($search_company_alias) {
1038 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1041 $param .=
'&search_login='.urlencode($search_login);
1043if ($searchCategorySupplierInvoiceOperator == 1) {
1044 $param .=
"&search_category_supplier_invoice_operator=".urlencode((
string) ($searchCategorySupplierInvoiceOperator));
1046foreach ($searchCategorySupplierInvoiceList as $searchCategorySupplierInvoice) {
1047 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategorySupplierInvoice);
1049if ($search_montant_ht !=
'') {
1050 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1052if ($search_montant_vat !=
'') {
1053 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1055if ($search_montant_localtax1 !=
'') {
1056 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1058if ($search_montant_localtax2 !=
'') {
1059 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1061if ($search_montant_ttc !=
'') {
1062 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1064if ($search_multicurrency_code !=
'') {
1065 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1067if ($search_multicurrency_tx !=
'') {
1068 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1070if ($search_multicurrency_montant_ht !=
'') {
1071 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1073if ($search_multicurrency_montant_vat !=
'') {
1074 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1076if ($search_multicurrency_montant_ttc !=
'') {
1077 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1079if ($search_amount_no_tax) {
1080 $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
1082if ($search_amount_all_tax) {
1083 $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
1085if ($search_status !=
'') {
1086 if (is_array($search_status)) {
1087 foreach ($search_status as $key => $val) {
1088 $param .=
'&search_status[]='.urlencode($val);
1091 $param .=
'&search_status='.urlencode($search_status);
1094if ($search_paymentmode) {
1095 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1097if ($search_paymentcond) {
1098 $param .=
'&search_paymentcond='.urlencode((
string) ($search_paymentcond));
1100if ($search_bankaccount > 0) {
1101 $param .=
'&search_bankaccount='.urlencode((
string) ($search_bankaccount));
1103if ($search_vat_reverse_charge !==
'' && $search_vat_reverse_charge !==
'-1') {
1104 $param .=
'&search_vat_reverse_charge='.urlencode($search_vat_reverse_charge);
1107 $param .=
'&show_files='.urlencode((
string) ($show_files));
1110 $param .=
"&search_option=".urlencode($option);
1112if ($search_categ_sup > 0) {
1113 $param .=
'&search_categ_sup='.$search_categ_sup;
1115if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1116 $param .=
'&search_type_thirdparty='.$search_type_thirdparty;
1118if ($search_fk_fac_rec_source) {
1119 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1123include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1125$parameters = array(
'param' => &$param);
1126$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1127$param .= $hookmanager->resPrint;
1130$arrayofmassactions = array(
1131 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1132 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1133 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1136if (
isModEnabled(
'category') && $user->hasRight(
"fournisseur",
"facture",
"lire")) {
1137 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1139if (
isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
"paymentbybanktransfer",
"create")) {
1140 $langs->load(
'withdrawals');
1141 $arrayofmassactions[
'banktransfertrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
1143if (!empty($permissiontodelete)) {
1144 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1146if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
1147 $arrayofmassactions = array();
1149$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1151$url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
1153 $url .=
'&socid='.urlencode((
string) (
$object->socid));
1156 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1159print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1160if ($optioncss !=
'') {
1161 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1163print
'<input type="hidden" name="token" value="'.newToken().
'">';
1164print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1165print
'<input type="hidden" name="action" value="list">';
1166print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1167print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1168print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1169print
'<input type="hidden" name="page" value="'.$page.
'">';
1170print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1171print
'<input type="hidden" name="page_y" value="">';
1172print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1175$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
1176$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
1177$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/compta/facture/stats/index.php?mode=supplier'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1178$newcardbutton .= dolGetButtonTitleSeparator();
1179$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', (
int) ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")));
1181print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_invoice', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1184$topicmail =
"SendBillRef";
1185$modelmail =
"invoice_supplier_send";
1187$trackid =
'sinv'.$object->id;
1188include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1192 foreach ($fieldstosearchall as $key => $val) {
1193 $fieldstosearchall[$key] = $langs->trans($val);
1194 $setupstring .= $key.
"=".$val.
";";
1196 print
'<!-- Search done like if SUPPLIER_INVOICE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1197 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1202if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1203 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1205 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_INVOICE, $searchCategorySupplierInvoiceList,
'minwidth300', $searchCategorySupplierInvoiceOperator ? $searchCategorySupplierInvoiceOperator : 0);
1207if ($user->hasRight(
"user",
"user",
"lire")) {
1208 $langs->load(
"commercial");
1209 $moreforfilter .=
'<div class="divsearchfield">';
1210 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1211 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1212 $moreforfilter .=
'</div>';
1215if ($user->hasRight(
"user",
"user",
"lire")) {
1216 $moreforfilter .=
'<div class="divsearchfield">';
1217 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1218 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'', 0, 0,
'', 0,
'',
'maxwidth200');
1219 $moreforfilter .=
'</div>';
1222if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1223 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1224 $moreforfilter .=
'<div class="divsearchfield">';
1225 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1226 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1227 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
1228 $moreforfilter .=
'</div>';
1232 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1233 $moreforfilter .=
'<div class="divsearchfield">';
1234 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1235 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $tmptitle);
1236 $moreforfilter .=
'</div>';
1238$parameters = array();
1239$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1240if (empty($reshook)) {
1241 $moreforfilter .= $hookmanager->resPrint;
1243 $moreforfilter = $hookmanager->resPrint;
1246if (!empty($moreforfilter)) {
1247 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1248 print $moreforfilter;
1252$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1253$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1254$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1255$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1257print
'<div class="div-table-responsive">';
1258print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1262print
'<tr class="liste_titre_filter">';
1264if (
$conf->main_checkbox_left_column) {
1265 print
'<td class="liste_titre center maxwidthsearch">';
1266 $searchpicto = $form->showFilterButtons(
'left');
1271if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1272 print
'<td class="liste_titre left">';
1273 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1277if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1278 print
'<td class="liste_titre">';
1279 print
'<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).
'">';
1283if (!empty($arrayfields[
'f.type'][
'checked'])) {
1284 print
'<td class="liste_titre maxwidthonsmartphone">';
1291 print $form->selectarray(
'search_type', $typearray, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
1295if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1296 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1297 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1301if (!empty($arrayfields[
'f.label'][
'checked'])) {
1302 print
'<td class="liste_titre">';
1303 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
1307if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1308 print
'<td class="liste_titre center">';
1309 print
'<div class="nowrapfordate">';
1310 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1312 print
'<div class="nowrapfordate">';
1313 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1318if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1319 print
'<td class="liste_titre center">';
1320 print
'<div class="">';
1327 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1329 print
'<div class="nowraponall inline-block valignmiddle"><input type="checkbox" class="valignmiddle" name="search_option" id="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'><label for="search_option" class="valignmiddle">'.$langs->trans(
"Alert").
'</label></div>';
1334if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1335 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1338if (!empty($arrayfields[
's.nom'][
'checked'])) {
1339 print
'<td class="liste_titre"><input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1342if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1343 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1346if (!empty($arrayfields[
's.town'][
'checked'])) {
1347 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1350if (!empty($arrayfields[
's.zip'][
'checked'])) {
1351 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1354if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1355 print
'<td class="liste_titre">';
1356 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1360if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1361 print
'<td class="liste_titre center">';
1362 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1366if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1367 print
'<td class="liste_titre maxwidthonsmartphone center">';
1368 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'', 1);
1372if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
1373 print
'<td class="liste_titre center">';
1374 print $form->selectyesno(
'search_vat_reverse_charge', $search_vat_reverse_charge, 1, 0, 1, 1);
1378if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1379 print
'<td class="liste_titre left">';
1380 print $form->getSelectConditionsPaiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
1384if (!empty($arrayfields[
'ba.label'][
'checked'])) {
1385 print
'<td class="liste_titre">';
1386 $form->select_comptes($search_bankaccount,
'search_bankaccount', 0,
'', 1,
'', 0,
'maxwidth125');
1390if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1391 print
'<td class="liste_titre">';
1392 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100', 1);
1395if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1397 print
'<td class="liste_titre right">';
1398 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1401if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1403 print
'<td class="liste_titre right">';
1404 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1407if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1409 print
'<td class="liste_titre right">';
1410 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1413if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1415 print
'<td class="liste_titre right">';
1416 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1419if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1421 print
'<td class="liste_titre right">';
1422 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1425if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1427 print
'<td class="liste_titre" align="center">';
1430if (!empty($arrayfields[
'u.login'][
'checked'])) {
1432 print
'<td class="liste_titre" align="center">';
1433 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1436if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1437 print
'<td class="liste_titre right">';
1440if (!empty($arrayfields[
'rtp'][
'checked'])) {
1441 print
'<td class="liste_titre">';
1444if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1446 print
'<td class="liste_titre">';
1447 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1450if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1452 print
'<td class="liste_titre">';
1453 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1456if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1458 print
'<td class="liste_titre right">';
1459 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1462if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1464 print
'<td class="liste_titre right">';
1465 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1468if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1470 print
'<td class="liste_titre right">';
1471 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1474if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1475 print
'<td class="liste_titre">';
1478if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1479 print
'<td class="liste_titre right">';
1483include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1486$parameters = array(
'arrayfields' => $arrayfields);
1487$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1488print $hookmanager->resPrint;
1490if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1491 print
'<td class="liste_titre">';
1495if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1496 print
'<td class="liste_titre">';
1499if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1501 print
'<td class="liste_titre">';
1502 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1505if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1507 print
'<td class="liste_titre">';
1508 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1512if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1513 print
'<td class="liste_titre center parentonrightofpage">';
1514 $liststatus = array(
'0' => $langs->trans(
"Draft"),
'1' => $langs->trans(
"Unpaid"),
'2' => $langs->trans(
"Paid"));
1516 print $form->multiselectarray(
'search_status', $liststatus, (is_array($search_status) ? $search_status : array()), 0, 0,
'center search_status width125 onrightofpage', 1, 0);
1520if (!
$conf->main_checkbox_left_column) {
1521 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1522 $searchpicto = $form->showFilterButtons();
1534print
'<tr class="liste_titre">';
1536if (
$conf->main_checkbox_left_column) {
1537 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1540if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1541 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
1544if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1545 print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
1548if (!empty($arrayfields[
'f.type'][
'checked'])) {
1549 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1552if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1553 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1555if (!empty($arrayfields[
'f.label'][
'checked'])) {
1556 print_liste_field_titre($arrayfields[
'f.label'][
'label'], $_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
1559if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1563if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1567if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1568 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1571if (!empty($arrayfields[
's.nom'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1575if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1577 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1580if (!empty($arrayfields[
's.town'][
'checked'])) {
1581 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1584if (!empty($arrayfields[
's.zip'][
'checked'])) {
1585 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1588if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1589 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.name_alias",
"", $param,
'', $sortfield, $sortorder);
1592if (!empty($arrayfields[
'state.name_alias'][
'checked'])) {
1593 print_liste_field_titre($arrayfields[
'state.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1596if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1597 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1600if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1601 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1604if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
1605 print_liste_field_titre($arrayfields[
'f.vat_reverse_charge'][
'label'], $_SERVER[
"PHP_SELF"],
"f.vat_reverse_charge",
"", $param,
"", $sortfield, $sortorder,
'center ');
1608if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1609 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1612if (!empty($arrayfields[
'ba.label'][
'checked'])) {
1613 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
1616if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1617 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1620if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1621 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1624if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1625 print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1628if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1629 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1632if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1633 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1636if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1637 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1640if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1641 print_liste_field_titre($arrayfields[
'f.nb_docs'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1644if (!empty($arrayfields[
'u.login'][
'checked'])) {
1645 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1648if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1649 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1652if (!empty($arrayfields[
'rtp'][
'checked'])) {
1653 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1656if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1657 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1660if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1661 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1664if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1665 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'"', $sortfield, $sortorder,
'right ');
1668if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1669 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1672if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1673 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1676if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1677 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1680if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1681 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1685include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1687$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
1688$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1689print $hookmanager->resPrint;
1690if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1691 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1694if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1698if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1702if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1706if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1711if (!
$conf->main_checkbox_left_column) {
1712 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1738$imaxinloop = ($limit ? min($num, $limit) : $num);
1739while ($i < $imaxinloop) {
1740 $obj =
$db->fetch_object($resql);
1745 $datelimit =
$db->jdate($obj->datelimite);
1747 $userstatic->id = $obj->fk_user_author;
1748 $userstatic->login = $obj->login;
1749 $userstatic->lastname = $obj->lastname;
1750 $userstatic->firstname = $obj->firstname;
1751 $userstatic->email = $obj->user_email;
1752 $userstatic->statut = $obj->user_statut;
1753 $userstatic->status = $obj->user_statut;
1754 $userstatic->entity = $obj->entity;
1755 $userstatic->photo = $obj->photo;
1756 $userstatic->office_phone = $obj->office_phone;
1757 $userstatic->office_fax = $obj->office_fax;
1758 $userstatic->user_mobile = $obj->user_mobile;
1759 $userstatic->job = $obj->job;
1760 $userstatic->gender = $obj->gender;
1761 $facturestatic->id = $obj->facid;
1762 $facturestatic->ref = $obj->ref;
1763 $facturestatic->type = $obj->type;
1764 $facturestatic->subtype = $obj->subtype;
1765 $facturestatic->total_ht = $obj->total_ht;
1766 $facturestatic->total_tva = $obj->total_vat;
1767 $facturestatic->total_ttc = $obj->total_ttc;
1768 $facturestatic->close_code = $obj->close_code;
1769 $facturestatic->ref_supplier = $obj->ref_supplier;
1770 $facturestatic->date_echeance =
$db->jdate($obj->datelimite);
1771 $facturestatic->statut = $obj->fk_statut;
1772 $facturestatic->status = $obj->fk_statut;
1773 $facturestatic->note_public = $obj->note_public;
1774 $facturestatic->note_private = $obj->note_private;
1775 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1776 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1777 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1778 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1779 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1780 $thirdparty->id = $obj->socid;
1781 $thirdparty->name = $obj->name;
1782 $thirdparty->name_alias = $obj->alias;
1783 $thirdparty->client = $obj->client;
1784 $thirdparty->fournisseur = $obj->fournisseur;
1785 $thirdparty->code_client = $obj->code_client;
1786 $thirdparty->code_compta_client = $obj->code_compta_client;
1787 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1788 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1789 $thirdparty->email = $obj->email;
1790 $thirdparty->country_code = $obj->country_code;
1792 $paiement = $facturestatic->getSommePaiement();
1793 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1794 $totaldeposits = $facturestatic->getSumDepositsUsed();
1795 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1796 $remaintopay = $obj->total_ttc - $totalpay;
1798 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1799 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1800 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1802 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1803 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1805 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1806 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1810 $multicurrency_remaintopay = 0;
1813 $remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id);
1814 $remaintopay = -$remaincreditnote;
1815 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1816 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1817 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1818 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1821 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1823 $facturestatic->paye = $obj->paye;
1824 $facturestatic->paid = $obj->paye;
1826 $facturestatic->date =
$db->jdate($obj->datef);
1832 if ($facturestatic->isCreditNoteUsed()) {
1833 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1837 if ($mode ==
'kanban') {
1839 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1840 print
'<div class="box-flex-container kanban">';
1843 if ($massactionbutton || $massaction) {
1845 if (in_array(
$object->id, $arrayofselected)) {
1850 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $thirdparty->getNomUrl(1,
'', 12),
'selected' => in_array(
$object->id, $arrayofselected));
1851 print $facturestatic->getKanbanView(
'', $arraydata);
1852 if ($i == ($imaxinloop - 1)) {
1859 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select'.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->fk_statut > 1) ?
' opacitymedium' :
'').
'">';
1862 if (
$conf->main_checkbox_left_column) {
1863 print
'<td class="nowrap center">';
1864 if ($massactionbutton || $massaction) {
1866 if (in_array($obj->facid, $arrayofselected)) {
1869 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1876 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1877 print
'<td class="nowraponall">';
1879 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1881 print
'<td class="nobordernopadding nowraponall">';
1882 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1886 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1887 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1888 print
'</td></tr></table>';
1897 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1898 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1899 print $obj->ref_supplier;
1907 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1908 print
'<td class="nowrap">';
1909 print $facturestatic->getLibType();
1917 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1919 if ($facturestatic->subtype > 0) {
1920 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture_fourn');
1922 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
1931 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1932 print
'<td class="nowrap tdoverflowmax125" title="'.dol_escape_htmltag($obj->label).
'">';
1941 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1942 print
'<td class="center nowrap">';
1951 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1952 print
'<td class="center nowraponall">'.dol_print_date($datelimit,
'day');
1953 if ($facturestatic->hasDelay()) {
1954 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
1963 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1964 print
'<td class="nowrap">';
1965 if ($obj->project_id > 0) {
1966 $projectstatic->id = $obj->project_id;
1967 $projectstatic->ref = $obj->project_ref;
1968 $projectstatic->title = $obj->project_label;
1969 print $projectstatic->getNomUrl(1);
1978 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1979 print
'<td class="tdoverflowmax125">';
1980 print $thirdparty->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1987 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1988 print
'<td class="tdoverflowmax150">';
1996 if (!empty($arrayfields[
's.town'][
'checked'])) {
1997 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2005 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2006 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
2014 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2015 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">';
2023 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2024 print
'<td class="center">';
2025 $tmparray =
getCountry($obj->fk_pays,
'all');
2026 print $tmparray[
'label'];
2033 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2034 print
'<td class="center">';
2035 if (empty($typenArray)) {
2036 $typenArray = $formcompany->typent_array(1);
2038 print $typenArray[$obj->typent_code];
2045 if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
2046 print
'<td class="center">';
2047 print
yn($obj->vat_reverse_charge);
2055 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2056 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 1,
'', -1, -1, 1);
2057 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2065 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
2067 if (!empty($obj->bid)) {
2068 $accountstatic->id = $obj->bid;
2069 $accountstatic->ref = $obj->bref;
2070 $accountstatic->label = $obj->blabel;
2071 $accountstatic->number = $obj->bnumber;
2072 $accountstatic->account_number = $obj->baccount_number;
2073 $accountstatic->accountancy_journal = $obj->baccountancy_journal;
2074 print $accountstatic->getNomUrl(1);
2082 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2083 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2084 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2093 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2094 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2099 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2102 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
2103 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_vat).
"</span></td>\n";
2108 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
2111 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2112 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax1).
"</span></td>\n";
2117 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2120 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2121 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax2).
"</span></td>\n";
2126 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2129 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2130 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2135 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2139 if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
2140 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
2141 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
2142 $upload_dir =
getMultidirOutput($facturestatic).
'/'.
get_exdir($facturestatic->id, 2, 0, 0, $facturestatic,
'invoice_supplier').$facturestatic->ref;
2143 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
2144 $nbLinks =
Link::count(
$db, $facturestatic->element, $facturestatic->id);
2145 $nbTotal = $nbFiles + $nbLinks;
2146 echo
'<td class="center">'.(empty($nbTotal) ?
'' : $nbTotal).
'</td>';
2153 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2154 print
'<td class="tdoverflowmax100">';
2155 if ($userstatic->id) {
2156 print $userstatic->getNomUrl(-1);
2167 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2168 print
'<td class="right nowrap"><span class="amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
'').
'</span></td>';
2177 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2178 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
2187 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2188 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2195 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2196 print
'<td class="nowrap">';
2197 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2204 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2205 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2211 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2212 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2218 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2219 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2225 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2226 print
'<td class="right nowrap"><span class="amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
'').
'</span></td>';
2233 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2234 print
'<td class="right nowrap"><span class="amount">';
2235 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
'');
2236 print
'</span></td>';
2244 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2246 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
2247 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2248 print $hookmanager->resPrint;
2251 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2252 print
'<td class="center nowraponall">';
2260 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2261 print
'<td class="center nowraponall">';
2269 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2270 print
'<td class="sensiblehtmlcontent center">';
2271 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2278 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2279 print
'<td class="sensiblehtmlcontent center">';
2280 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2287 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2288 print
'<td class="center nowrap">';
2289 print $facturestatic->getLibStatut(5, $paiement);
2297 if (!
$conf->main_checkbox_left_column) {
2298 print
'<td class="nowrap center">';
2299 if ($massactionbutton || $massaction) {
2301 if (in_array($obj->facid, $arrayofselected)) {
2304 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2319include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2324 foreach ($arrayfields as $key => $val) {
2325 if (!empty($val[
'checked'])) {
2329 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2334$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2335$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2336print $hookmanager->resPrint;
2338print
'</table>'.
"\n";
2341print
'</form>'.
"\n";
2343if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2344 $hidegeneratedfilelistifempty = 1;
2345 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2346 $hidegeneratedfilelistifempty = 0;
2349 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2353 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2354 $urlsource .= str_replace(
'&',
'&', $param);
2356 $filedir = $diroutputmassaction;
2357 $genallowed = $permissiontoread;
2358 $delallowed = $permissiontoadd;
2361 print $formfile->showdocuments(
'massfilesarea_supplier_invoice',
'', $filedir, $urlsource, 0, (
int) $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage suppliers invoices.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const TYPE_REPLACEMENT
Replacement invoice.
const TYPE_STANDARD
Standard invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage suppliers.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
getMultidirTemp($object, $module='', $forobject=0)
Return the full path of the directory where a module (or an object of a module) stores its temporary ...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
supplier_invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.