46require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50if (isModEnabled(
'margin')) {
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
64if (isModEnabled(
'order')) {
65 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
69$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
71$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
77$action =
GETPOST(
'action',
'aZ09');
78$massaction =
GETPOST(
'massaction',
'alpha');
80$confirm =
GETPOST(
'confirm',
'alpha');
81$toselect =
GETPOST(
'toselect',
'array');
82$optioncss =
GETPOST(
'optioncss',
'alpha');
83$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
86if ($contextpage ==
'poslist') {
92$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
93$search_type =
GETPOST(
'search_type',
'intcomma');
94$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
95$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
96$search_project =
GETPOST(
'search_project',
'alpha');
97$search_company =
GETPOST(
'search_company',
'alpha');
98$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
99$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
100$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
101$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
102$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
103$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
104$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
105$search_login =
GETPOST(
'search_login',
'alpha');
106$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
107$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
108$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
109$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
110$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
111$search_status =
GETPOST(
'search_status',
'intcomma');
112$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
113$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
114$search_module_source =
GETPOST(
'search_module_source',
'alpha');
115$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
116$search_town =
GETPOST(
'search_town',
'alpha');
117$search_zip =
GETPOST(
'search_zip',
'alpha');
118$search_state =
GETPOST(
"search_state");
119$search_country =
GETPOST(
"search_country",
'aZ09');
120$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
121$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
122$search_user =
GETPOST(
'search_user',
'intcomma');
123$search_sale =
GETPOST(
'search_sale',
'intcomma');
124$search_date_startday =
GETPOSTINT(
'search_date_startday');
125$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
126$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
127$search_date_endday =
GETPOSTINT(
'search_date_endday');
128$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
129$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
130$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
131$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
132$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
133$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
134$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
135$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
136$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
137$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
138$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
139$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
140$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
141$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
142$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
143$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
144$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
145$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
146$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
147$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
148$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
149$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
150$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
152$search_option =
GETPOST(
'search_option');
153if ($search_option ==
'late') {
154 $search_status =
'1';
158$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
159$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
161if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
164$offset = $limit * $page;
165if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
172 $sortfield =
'f.datef';
174$pageprev = $page - 1;
175$pagenext = $page + 1;
177$diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
184$hookmanager->initHooks(array($contextpage));
188$extrafields->fetch_name_optionals_label(
$object->table_element);
190$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
193$fieldstosearchall = array(
195 'f.ref_client' =>
'RefCustomer',
196 'f.note_public' =>
'NotePublic',
197 's.nom' =>
"ThirdParty",
198 's.code_client' =>
"CustomerCodeShort",
199 's.name_alias' =>
"AliasNameShort",
202 'pd.description' =>
'Description',
204if (empty($user->socid)) {
205 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
208$checkedtypetiers = 0;
210 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
211 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1,
'position' => 10),
212 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
213 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
214 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 20),
215 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' => 0,
'position' => 22),
216 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 25),
217 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 30),
218 'p.ref' => array(
'label' =>
"ProjectRef",
'langs' =>
'projects',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 40),
219 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 41),
220 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 50),
221 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 51),
222 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' => -1,
'position' => 52),
223 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
224 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 55),
225 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 60),
226 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 65),
227 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 70),
228 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
229 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 80),
230 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 85),
231 'f.module_source' => array(
'label' =>
"POSModule",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 90),
232 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 91),
233 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 95),
234 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 100),
235 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
236 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
237 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 130),
238 'dynamount_payed' => array(
'label' =>
"Received",
'checked' => 0,
'position' => 140),
239 'rtp' => array(
'label' =>
"Rest",
'checked' => 0,
'position' => 150),
240 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 280),
241 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 285),
242 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 290),
243 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 291),
244 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 292),
245 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 295),
246 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 296),
247 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
248 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
249 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
250 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
251 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
252 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 502),
253 'u.login' => array(
'label' =>
"UserAuthor",
'checked' => 1,
'visible' => -1,
'position' => 504),
254 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 506),
259 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
260 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
261 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' => 0,
'position' => 530,
'enabled' =>
'1'),
262 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
266 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' => 0,
'position' => 86);
269$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
270if (empty($subtypearray)) {
271 unset($arrayfields[
'f.subtype']);
275foreach (
$object->fields as $key => $val) {
278 if (!empty($val[
'visible'])) {
279 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
281 if (array_key_exists($key, $arrayfields)) {
283 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
285 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
289 $arrayfields[$newkey] = array(
290 'label' => $val[
'label'],
291 'checked' => (($visible < 0) ? 0 : 1),
292 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
293 'position' => $val[
'position'],
294 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
300include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
305'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
307if (!$user->hasRight(
'societe',
'client',
'voir')) {
308 $search_sale = $user->id;
312$fieldid = (!empty($ref) ?
'ref' :
'rowid');
313if (!empty($user->socid)) {
314 $socid = $user->socid;
316$result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
323if (
GETPOST(
'cancel',
'alpha')) {
327if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
331$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
332$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
337include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
340if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
343 $search_product_category =
'';
345 $search_refcustomer =
'';
347 $search_subtype =
'';
348 $search_project_ref =
'';
349 $search_project =
'';
350 $search_company =
'';
351 $search_company_alias =
'';
352 $search_parent_name =
'';
353 $search_montant_ht =
'';
354 $search_montant_vat =
'';
355 $search_montant_localtax1 =
'';
356 $search_montant_localtax2 =
'';
357 $search_montant_ttc =
'';
359 $search_multicurrency_code =
'';
360 $search_multicurrency_tx =
'';
361 $search_multicurrency_montant_ht =
'';
362 $search_multicurrency_montant_vat =
'';
363 $search_multicurrency_montant_ttc =
'';
365 $search_paymentmode =
'';
366 $search_paymentterms =
'';
367 $search_module_source =
'';
368 $search_pos_source =
'';
372 $search_country =
'';
373 $search_type_thirdparty =
'';
374 $search_customer_code =
'';
375 $search_date_startday =
'';
376 $search_date_startmonth =
'';
377 $search_date_startyear =
'';
378 $search_date_endday =
'';
379 $search_date_endmonth =
'';
380 $search_date_endyear =
'';
381 $search_date_start =
'';
382 $search_date_end =
'';
383 $search_date_valid_startday =
'';
384 $search_date_valid_startmonth =
'';
385 $search_date_valid_startyear =
'';
386 $search_date_valid_endday =
'';
387 $search_date_valid_endmonth =
'';
388 $search_date_valid_endyear =
'';
389 $search_date_valid_start =
'';
390 $search_date_valid_end =
'';
391 $search_datelimit_startday =
'';
392 $search_datelimit_startmonth =
'';
393 $search_datelimit_startyear =
'';
394 $search_datelimit_endday =
'';
395 $search_datelimit_endmonth =
'';
396 $search_datelimit_endyear =
'';
397 $search_datelimit_start =
'';
398 $search_datelimit_end =
'';
399 $search_fac_rec_source_title =
'';
401 $search_categ_cus = 0;
403 $search_array_options = array();
406if (empty($reshook)) {
407 $objectclass =
'Facture';
408 $objectlabel =
'Invoices';
409 $permissiontoread = $user->hasRight(
"facture",
"lire");
410 $permissiontoadd = $user->hasRight(
"facture",
"creer");
411 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
412 $uploaddir = $conf->facture->dir_output;
413 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
416if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
417 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
418 $arrayofselected = is_array($toselect) ? $toselect : array();
419 if (!empty($arrayofselected)) {
423 if (empty($paiementdate)) {
424 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
426 $action =
'makepayment';
430 foreach ($arrayofselected as $toselectid) {
433 $result = $facture->fetch($toselectid);
442 $paiementAmount = $facture->getSommePaiement();
443 $totalcreditnotes = $facture->getSumCreditNotesUsed();
444 $totaldeposits = $facture->getSumDepositsUsed();
446 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
447 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
450 $parameters = array(
'remaintopay' => $remaintopay);
451 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
453 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
454 $remaintopay = $remain;
456 } elseif ($reshook < 0) {
458 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
461 if ($remaintopay != 0) {
462 $resultBank = $facture->setBankAccount($bankid);
463 if ($resultBank < 0) {
468 $paiement->datepaye = $paiementdate;
469 $paiement->amounts[$facture->id] = $remaintopay;
470 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
471 $paiement->paiementid = $paiementid;
472 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
473 if ($paiement_id < 0) {
474 $langs->load(
"errors");
475 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
478 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
480 $langs->load(
"errors");
481 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
487 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
491 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
496 if (empty($errorpayment)) {
497 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
505} elseif ($massaction ==
'withdrawrequest') {
506 $langs->load(
"withdrawals");
508 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
515 $arrayofselected = is_array($toselect) ? $toselect : array();
516 $listofbills = array();
517 foreach ($arrayofselected as $toselectid) {
519 $result = $objecttmp->fetch($toselectid);
521 $totalpaid = $objecttmp->getSommePaiement();
522 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
523 $totaldeposits = $objecttmp->getSumDepositsUsed();
524 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
527 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
528 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
530 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
531 $objecttmp->resteapayer = $remaintopay;
533 } elseif ($reshook < 0) {
535 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
540 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
541 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
543 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
544 } elseif ($objecttmp->resteapayer < 0) {
546 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
549 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
550 $rsql .=
" , pfd.date_traite as date_traite";
551 $rsql .=
" , pfd.amount";
552 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
553 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
554 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
555 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
556 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
557 $rsql .=
" AND pfd.traite = 0";
558 $rsql .=
" ORDER BY pfd.date_demande DESC";
560 $result_sql = $db->query($rsql);
562 $numprlv = $db->num_rows($result_sql);
567 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
568 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
569 $langs->load(
"errors");
571 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
573 $listofbills[] = $objecttmp;
579 if (!empty($listofbills)) {
580 $nbwithdrawrequestok = 0;
581 foreach ($listofbills as $aBill) {
583 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
586 $nbwithdrawrequestok++;
592 if ($nbwithdrawrequestok > 0) {
593 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
605$form =
new Form($db);
609if (isModEnabled(
'margin')) {
612$bankaccountstatic =
new Account($db);
613$facturestatic =
new Facture($db);
615$companystatic =
new Societe($db);
616$companyparent =
new Societe($db);
618$company_url_list = array();
623 if (empty($search_company)) {
624 $search_company = $soc->name;
628$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
629$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
631$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
632$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
638 $sql =
'SELECT DISTINCT';
640$sql .=
' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, f.subtype, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
641$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
642$sql .=
' f.fk_user_author,';
643$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,';
644$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
645$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
646$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
647$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
648$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, 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,';
649$sql .=
" s.parent as fk_parent,";
650$sql .=
" s2.nom as name2,";
651$sql .=
' typent.code as typent_code,';
652$sql .=
' state.code_departement as state_code, state.nom as state_name,';
653$sql .=
' country.code as country_code,';
654$sql .=
' f.fk_fac_rec_source,';
655$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
656$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';
666if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
667 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
668 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
672$parameters = array();
673$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
674$sql .= $hookmanager->resPrint;
675$sql = preg_replace(
'/,\s*$/',
'', $sql);
679$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
680$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
681$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
682$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
683$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
684$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
685if ($sortfield ==
"f.datef") {
686 $sql .= $db->hintindex(
'idx_facture_datef');
688if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
689 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
692 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
694if (!empty($search_fac_rec_source_title)) {
695 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
697$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
698$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
700$parameters = array();
701$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
702$sql .= $hookmanager->resPrint;
704$sql .=
' WHERE f.fk_soc = s.rowid';
705$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
707 $sql .=
' AND s.rowid = '.((int) $socid);
711 $sql .=
' AND f.fk_user_author IS NULL';
713 $sql .=
' AND f.fk_user_author = '.((int) $userid);
719if ($search_refcustomer) {
722if ($search_type !=
'' && $search_type !=
'-1') {
723 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
725if ($search_subtype !=
'' && $search_subtype !=
'-1') {
726 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
728if ($search_project_ref) {
731if ($search_project) {
734if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
735 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
737 if ($search_company) {
740 if ($search_company_alias) {
744if ($search_parent_name) {
747if ($search_customer_code) {
759if (strlen(trim($search_country))) {
761 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
762 foreach ($arrayofcode as $key => $value) {
763 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
764 if ($value != $mysoc->country_code) {
765 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
768 if ($search_country ==
'special_allnotme') {
769 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
770 } elseif ($search_country ==
'special_eec') {
771 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
772 } elseif ($search_country ==
'special_eecnotme') {
773 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
774 } elseif ($search_country ==
'special_noteec') {
775 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
780if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
781 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
783if ($search_montant_ht !=
'') {
786if ($search_montant_vat !=
'') {
789if ($search_montant_localtax1 !=
'') {
790 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
792if ($search_montant_localtax2 !=
'') {
793 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
795if ($search_montant_ttc !=
'') {
798if ($search_multicurrency_code !=
'') {
799 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
801if ($search_multicurrency_tx !=
'') {
802 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
804if ($search_multicurrency_montant_ht !=
'') {
805 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
807if ($search_multicurrency_montant_vat !=
'') {
808 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
810if ($search_multicurrency_montant_ttc !=
'') {
811 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
814 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
816if ($search_status !=
'-1' && $search_status !=
'') {
817 if (is_numeric($search_status) && $search_status >= 0) {
818 if ($search_status ==
'0') {
819 $sql .=
" AND f.fk_statut = 0";
821 if ($search_status ==
'1') {
822 $sql .=
" AND f.fk_statut = 1";
824 if ($search_status ==
'2') {
825 $sql .=
" AND f.fk_statut = 2";
827 if ($search_status ==
'3') {
828 $sql .=
" AND f.fk_statut = 3";
831 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
835if ($search_paymentmode > 0) {
836 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
838if ($search_paymentterms > 0) {
839 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
841if ($search_module_source) {
844if ($search_pos_source) {
847if ($search_date_start) {
848 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
850if ($search_date_end) {
851 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
853if ($search_date_valid_start) {
854 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
856if ($search_date_valid_end) {
857 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
859if ($search_datelimit_start) {
860 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
862if ($search_datelimit_end) {
863 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
865if ($search_option ==
'late') {
866 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
871if (!empty($search_fac_rec_source_title)) {
872 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
875if ($search_user > 0) {
876 $sql .=
" AND EXISTS (";
877 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
878 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
879 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
880 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
881 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
884if ($search_sale && $search_sale !=
'-1') {
885 if ($search_sale == -2) {
886 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
887 } elseif ($search_sale > 0) {
888 $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).
")";
892$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
893$searchCategoryProductOperator = 0;
894if (!empty($searchCategoryProductList)) {
895 $searchCategoryProductSqlList = array();
896 $listofcategoryid =
'';
897 foreach ($searchCategoryProductList as $searchCategoryProduct) {
898 if (intval($searchCategoryProduct) == -2) {
899 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product)";
900 } elseif (intval($searchCategoryProduct) > 0) {
901 if ($searchCategoryProductOperator == 0) {
902 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
904 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
908 if ($listofcategoryid) {
909 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
911 if ($searchCategoryProductOperator == 1) {
912 if (!empty($searchCategoryProductSqlList)) {
913 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
916 if (!empty($searchCategoryProductSqlList)) {
917 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
921$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
922$searchCategoryCustomerOperator = 0;
924if (!empty($searchCategoryCustomerList)) {
925 $searchCategoryCustomerSqlList = array();
926 $listofcategoryid =
'';
927 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
928 if (intval($searchCategoryCustomer) == -2) {
929 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
930 } elseif (intval($searchCategoryCustomer) > 0) {
931 if ($searchCategoryCustomerOperator == 0) {
932 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).
")";
934 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
938 if ($listofcategoryid) {
939 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
941 if ($searchCategoryCustomerOperator == 1) {
942 if (!empty($searchCategoryCustomerSqlList)) {
943 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
946 if (!empty($searchCategoryCustomerSqlList)) {
947 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
952include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
954$parameters = array();
955$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
956$sql .= $hookmanager->resPrint;
959 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
963$parameters = array();
964$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
965$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
968$nbtotalofrecords =
'';
971 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
972 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
974 $resql = $db->query($sqlforcount);
976 $objforcount = $db->fetch_object($resql);
977 $nbtotalofrecords = $objforcount->nbtotalofrecords;
982 if (($page * $limit) > $nbtotalofrecords) {
990$sql .= $db->order($sortfield, $sortorder);
992 $sql .= $db->plimit($limit + 1, $offset);
995$resql = $db->query($sql);
1001$num = $db->num_rows($resql);
1003$arrayofselected = is_array($toselect) ? $toselect : array();
1005if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1006 $obj = $db->fetch_object($resql);
1009 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.$id);
1016llxHeader(
'', $title, $help_url, 0, 0,
'',
'',
'',
'bodyforlist');
1018$param =
'&socid='.urlencode((
string) ($socid));
1020 $param .=
'&mode='.urlencode($mode);
1022if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1023 $param .=
'&contextpage='.urlencode($contextpage);
1025if ($limit > 0 && $limit != $conf->liste_limit) {
1026 $param .=
'&limit='.((int) $limit);
1029 $param .=
'&search_all='.urlencode($search_all);
1031if ($search_date_startday) {
1032 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1034if ($search_date_startmonth) {
1035 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1037if ($search_date_startyear) {
1038 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1040if ($search_date_endday) {
1041 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1043if ($search_date_endmonth) {
1044 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1046if ($search_date_endyear) {
1047 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1049if ($search_date_valid_startday) {
1050 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1052if ($search_date_valid_startmonth) {
1053 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1055if ($search_date_valid_startyear) {
1056 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1058if ($search_date_valid_endday) {
1059 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1061if ($search_date_valid_endmonth) {
1062 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1064if ($search_date_valid_endyear) {
1065 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1067if ($search_datelimit_startday) {
1068 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1070if ($search_datelimit_startmonth) {
1071 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1073if ($search_datelimit_startyear) {
1074 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1076if ($search_datelimit_endday) {
1077 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1079if ($search_datelimit_endmonth) {
1080 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1082if ($search_datelimit_endyear) {
1083 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1086 $param .=
'&search_ref='.urlencode($search_ref);
1088if ($search_refcustomer) {
1089 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1091if ($search_project_ref) {
1092 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1094if ($search_project) {
1095 $param .=
'&search_project='.urlencode($search_project);
1097if ($search_type !=
'') {
1098 $param .=
'&search_type='.urlencode($search_type);
1100if ($search_subtype !=
'') {
1101 $param .=
'&search_subtype='.urlencode($search_subtype);
1103if ($search_company) {
1104 $param .=
'&search_company='.urlencode($search_company);
1106if ($search_company_alias) {
1107 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1109if ($search_parent_name !=
'') {
1110 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1113 $param .=
'&search_town='.urlencode($search_town);
1116 $param .=
'&search_zip='.urlencode($search_zip);
1118if ($search_country) {
1119 $param .=
"&search_country=".urlencode($search_country);
1121if ($search_type_thirdparty !=
'') {
1122 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1124if ($search_customer_code) {
1125 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1127if ($search_sale > 0) {
1128 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1130if ($search_user > 0) {
1131 $param .=
'&search_user='.urlencode((
string) $search_user);
1134 $param .=
'&search_login='.urlencode($search_login);
1136if ($search_product_category > 0) {
1137 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1139if ($search_montant_ht !=
'') {
1140 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1142if ($search_montant_vat !=
'') {
1143 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1145if ($search_montant_localtax1 !=
'') {
1146 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1148if ($search_montant_localtax2 !=
'') {
1149 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1151if ($search_montant_ttc !=
'') {
1152 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1154if ($search_multicurrency_code !=
'') {
1155 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1157if ($search_multicurrency_tx !=
'') {
1158 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1160if ($search_multicurrency_montant_ht !=
'') {
1161 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1163if ($search_multicurrency_montant_vat !=
'') {
1164 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1166if ($search_multicurrency_montant_ttc !=
'') {
1167 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1169if ($search_status !=
'') {
1170 $param .=
'&search_status='.urlencode($search_status);
1172if ($search_paymentmode > 0) {
1173 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1175if ($search_paymentterms > 0) {
1176 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1178if ($search_module_source) {
1179 $param .=
'&search_module_source='.urlencode($search_module_source);
1181if ($search_pos_source) {
1182 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1185 $param .=
'&show_files='.urlencode((
string) ($show_files));
1187if ($search_option) {
1188 $param .=
"&search_option=".urlencode($search_option);
1190if ($optioncss !=
'') {
1191 $param .=
'&optioncss='.urlencode($optioncss);
1193if ($search_categ_cus > 0) {
1194 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1196if (!empty($search_fac_rec_source_title)) {
1197 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1201include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1203$parameters = array(
'param' => &$param);
1204$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1205$param .= $hookmanager->resPrint;
1207$arrayofmassactions = array(
1208 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1209 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1210 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1211 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1214if ($user->hasRight(
'facture',
'paiement')) {
1215 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1217if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1218 $langs->load(
"withdrawals");
1219 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1221if ($user->hasRight(
'facture',
'supprimer')) {
1223 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1225 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1228if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1229 $arrayofmassactions = array();
1231$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1235if ($contextpage !=
'poslist') {
1236 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1237 if (!empty($socid)) {
1238 $url .=
'&socid='.$socid;
1240 $newcardbutton =
'';
1241 $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'));
1242 $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'));
1244 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1248print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1249if ($optioncss !=
'') {
1250 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1252print
'<input type="hidden" name="token" value="'.newToken().
'">';
1253print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1254if (!in_array($massaction, array(
'makepayment'))) {
1255 print
'<input type="hidden" name="action" value="list">';
1257print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1258print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1259print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1260print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1261print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1262print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1264print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1266$topicmail =
"SendBillRef";
1267$modelmail =
"facture_send";
1269$trackid =
'inv'.$object->id;
1270include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1272if ($massaction ==
'makepayment') {
1274 $formquestion = array(
1278 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1279 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1280 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1283 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1288 foreach ($fieldstosearchall as $key => $val) {
1289 $fieldstosearchall[$key] = $langs->trans($val);
1291 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1296if ($user->hasRight(
"user",
"user",
"lire")) {
1297 $langs->load(
"commercial");
1298 $moreforfilter .=
'<div class="divsearchfield">';
1299 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1300 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1301 $moreforfilter .=
'</div>';
1304if ($user->hasRight(
"user",
"user",
"lire")) {
1305 $moreforfilter .=
'<div class="divsearchfield">';
1306 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1307 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1308 $moreforfilter .=
'</div>';
1311if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1312 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1313 $moreforfilter .=
'<div class="divsearchfield">';
1314 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1315 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1316 $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);
1317 $moreforfilter .=
'</div>';
1319if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1320 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1321 $moreforfilter .=
'<div class="divsearchfield">';
1322 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1323 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1324 $moreforfilter .=
'</div>';
1327$moreforfilter .=
'<div class="divsearchfield">';
1328$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1329$moreforfilter .=
'</div>';
1331$parameters = array();
1332$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1333if (empty($reshook)) {
1334 $moreforfilter .= $hookmanager->resPrint;
1336 $moreforfilter = $hookmanager->resPrint;
1339if (!empty($moreforfilter)) {
1340 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1341 print $moreforfilter;
1345$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1346$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1349if ($massactionbutton && $contextpage !=
'poslist') {
1350 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1353print
'<div class="div-table-responsive">';
1354print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1358print
'<tr class="liste_titre_filter">';
1362 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1363 $searchpicto = $form->showFilterButtons(
'left');
1369 print
'<td class="liste_titre">';
1373if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1374 print
'<td class="liste_titre" align="left">';
1375 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1379if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1380 print
'<td class="liste_titre">';
1381 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1385if (!empty($arrayfields[
'f.type'][
'checked'])) {
1386 print
'<td class="liste_titre maxwidthonsmartphone">';
1398 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1402if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1403 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1404 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1408if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1409 print
'<td class="liste_titre center">';
1410 print
'<div class="nowrapfordate">';
1411 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1413 print
'<div class="nowrapfordate">';
1414 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1419if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1420 print
'<td class="liste_titre center">';
1421 print
'<div class="nowrapfordate">';
1422 print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1,
'search_date_valid_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1424 print
'<div class="nowrapfordate">';
1425 print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1,
'search_date_valid_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1430if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1431 print
'<td class="liste_titre center">';
1432 print
'<div class="nowrapfordate">';
1433 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1435 print
'<div class="nowrapfordate">';
1436 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1441if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1442 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1445if (!empty($arrayfields[
'p.title'][
'checked'])) {
1446 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1449if (!empty($arrayfields[
's.nom'][
'checked'])) {
1450 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1453if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1454 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1457if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1458 print
'<td class="liste_titre">';
1459 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1463if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1464 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1467if (!empty($arrayfields[
's.town'][
'checked'])) {
1468 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1471if (!empty($arrayfields[
's.zip'][
'checked'])) {
1472 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1475if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1476 print
'<td class="liste_titre">';
1477 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1481if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1482 print
'<td class="liste_titre center">';
1483 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1487if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1488 print
'<td class="liste_titre maxwidthonsmartphone center">';
1489 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' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'maxwidth100', 1);
1493if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1494 print
'<td class="liste_titre">';
1495 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1499if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1500 print
'<td class="liste_titre left">';
1501 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1505if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1506 print
'<td class="liste_titre">';
1507 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1511if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1512 print
'<td class="liste_titre">';
1513 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1516if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1518 print
'<td class="liste_titre right">';
1519 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1522if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1524 print
'<td class="liste_titre right">';
1525 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1528if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1530 print
'<td class="liste_titre right">';
1531 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1534if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1536 print
'<td class="liste_titre right">';
1537 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1540if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1542 print
'<td class="liste_titre right">';
1543 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1546if (!empty($arrayfields[
'u.login'][
'checked'])) {
1548 print
'<td class="liste_titre" align="center">';
1549 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1552if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1553 print
'<td class="liste_titre"></td>';
1555if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1556 print
'<td class="liste_titre" align="right">';
1559if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1560 print
'<td class="liste_titre right">';
1563if (!empty($arrayfields[
'rtp'][
'checked'])) {
1564 print
'<td class="liste_titre">';
1567if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1569 print
'<td class="liste_titre">';
1570 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1573if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1575 print
'<td class="liste_titre">';
1576 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1579if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1581 print
'<td class="liste_titre right">';
1582 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1585if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1587 print
'<td class="liste_titre right">';
1588 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1591if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1593 print
'<td class="liste_titre right">';
1594 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1597if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1598 print
'<td class="liste_titre">';
1601if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1602 print
'<td class="liste_titre right">';
1605if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1606 print
'<td class="liste_titre right">';
1609if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1610 print
'<td class="liste_titre right">';
1613if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1614 print
'<td class="liste_titre right">';
1617if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1618 print
'<td class="liste_titre right">';
1623include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1626$parameters = array(
'arrayfields' => $arrayfields);
1627$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1628print $hookmanager->resPrint;
1630if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1631 print
'<td class="liste_titre">';
1635if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1636 print
'<td class="liste_titre">';
1640if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1641 print
'<td class="liste_titre">';
1644if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1649if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1651 print
'<td class="liste_titre">';
1654if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1656 print
'<td class="liste_titre maxwidthonsmartphone right">';
1657 print
'<input class="flat maxwidth50imp" type="text" name="search_fac_rec_source_title" id="search_fac_rec_source_title" value="'.dol_escape_htmltag($search_fac_rec_source_title).
'">';
1661if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1662 print
'<td class="liste_titre center parentonrightofpage">';
1663 $liststatus = array(
'0' => $langs->trans(
"BillShortStatusDraft"),
'0,1' => $langs->trans(
"BillShortStatusDraft").
'+'.$langs->trans(
"BillShortStatusNotPaid"),
'1' => $langs->trans(
"BillShortStatusNotPaid"),
'1,2' => $langs->trans(
"BillShortStatusNotPaid").
'+'.$langs->trans(
"BillShortStatusPaid"),
'2' => $langs->trans(
"BillShortStatusPaid"),
'3' => $langs->trans(
"BillShortStatusCanceled"));
1665 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1670 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1671 $searchpicto = $form->showFilterButtons();
1677$totalarray = array();
1678$totalarray[
'nbfield'] = 0;
1682print
'<tr class="liste_titre">';
1684 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1685 $totalarray[
'nbfield']++;
1689 $totalarray[
'nbfield']++;
1691if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1693 $totalarray[
'nbfield']++;
1695if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1697 $totalarray[
'nbfield']++;
1699if (!empty($arrayfields[
'f.type'][
'checked'])) {
1700 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1701 $totalarray[
'nbfield']++;
1703if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1706if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1712 $totalarray[
'nbfield']++;
1714if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1716 $totalarray[
'nbfield']++;
1718if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1719 $langs->load(
"projects");
1720 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
'p.title'][
'checked'])) {
1724 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1725 $totalarray[
'nbfield']++;
1727if (!empty($arrayfields[
's.nom'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1729 $totalarray[
'nbfield']++;
1731if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1732 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1733 $totalarray[
'nbfield']++;
1735if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1736 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1737 $totalarray[
'nbfield']++;
1739if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
's.town'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
's.zip'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1753 $totalarray[
'nbfield']++;
1755if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1756 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1757 $totalarray[
'nbfield']++;
1759if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1760 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1761 $totalarray[
'nbfield']++;
1763if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1765 $totalarray[
'nbfield']++;
1767if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1768 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1769 $totalarray[
'nbfield']++;
1771if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1772 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1773 $totalarray[
'nbfield']++;
1775if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1776 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1777 $totalarray[
'nbfield']++;
1779if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1780 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1781 $totalarray[
'nbfield']++;
1783if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1784 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1785 $totalarray[
'nbfield']++;
1787if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1788 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1789 $totalarray[
'nbfield']++;
1791if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1792 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1793 $totalarray[
'nbfield']++;
1795if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1796 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1797 $totalarray[
'nbfield']++;
1799if (!empty($arrayfields[
'u.login'][
'checked'])) {
1800 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1801 $totalarray[
'nbfield']++;
1803if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1804 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1805 $totalarray[
'nbfield']++;
1807if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1808 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1809 $totalarray[
'nbfield']++;
1811if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1812 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1813 $totalarray[
'nbfield']++;
1815if (!empty($arrayfields[
'rtp'][
'checked'])) {
1816 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1817 $totalarray[
'nbfield']++;
1819if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1820 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1821 $totalarray[
'nbfield']++;
1823if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1824 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1825 $totalarray[
'nbfield']++;
1827if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1828 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1829 $totalarray[
'nbfield']++;
1831if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1832 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1833 $totalarray[
'nbfield']++;
1835if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1836 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1837 $totalarray[
'nbfield']++;
1839if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1840 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1841 $totalarray[
'nbfield']++;
1843if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1844 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1845 $totalarray[
'nbfield']++;
1847if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1848 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1849 $totalarray[
'nbfield']++;
1851if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1852 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1853 $totalarray[
'nbfield']++;
1855if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1856 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1857 $totalarray[
'nbfield']++;
1859if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1860 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1861 $totalarray[
'nbfield']++;
1864include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1866$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1867$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1868print $hookmanager->resPrint;
1869if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1870 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1871 $totalarray[
'nbfield']++;
1873if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1874 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1875 $totalarray[
'nbfield']++;
1877if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1878 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1879 $totalarray[
'nbfield']++;
1881if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1882 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1883 $totalarray[
'nbfield']++;
1885if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1886 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1887 $totalarray[
'nbfield']++;
1889if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1890 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1891 $totalarray[
'nbfield']++;
1893if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1894 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1895 $totalarray[
'nbfield']++;
1898 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1899 $totalarray[
'nbfield']++;
1904$projectstatic =
new Project($db);
1906$userstatic =
new User($db);
1912 $savnbfield = $totalarray[
'nbfield'];
1913 $totalarray = array();
1914 $totalarray[
'nbfield'] = 0;
1915 $totalarray[
'val'] = array();
1916 $totalarray[
'val'][
'f.total_ht'] = 0;
1917 $totalarray[
'val'][
'f.total_tva'] = 0;
1918 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1919 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1920 $totalarray[
'val'][
'f.total_ttc'] = 0;
1921 $totalarray[
'val'][
'totalam'] = 0;
1922 $totalarray[
'val'][
'rtp'] = 0;
1924 $typenArray = $formcompany->typent_array(1);
1926 $with_margin_info =
false;
1927 if (isModEnabled(
'margin') && (
1928 !empty($arrayfields[
'total_pa'][
'checked'])
1929 || !empty($arrayfields[
'total_margin'][
'checked'])
1930 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1931 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1934 $with_margin_info =
true;
1939 $imaxinloop = ($limit ? min($num, $limit) : $num);
1940 while ($i < $imaxinloop) {
1941 $obj = $db->fetch_object($resql);
1943 $datelimit = $db->jdate($obj->datelimite);
1945 $facturestatic->id = $obj->id;
1946 $facturestatic->ref = $obj->ref;
1947 $facturestatic->ref_client = $obj->ref_client;
1948 $facturestatic->ref_customer = $obj->ref_client;
1949 $facturestatic->type = $obj->type;
1950 $facturestatic->subtype = $obj->subtype;
1951 $facturestatic->total_ht = $obj->total_ht;
1952 $facturestatic->total_tva = $obj->total_tva;
1953 $facturestatic->total_ttc = $obj->total_ttc;
1954 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1955 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1956 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1957 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1958 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1959 $facturestatic->statut = $obj->fk_statut;
1960 $facturestatic->status = $obj->fk_statut;
1961 $facturestatic->close_code = $obj->close_code;
1962 $facturestatic->total_ttc = $obj->total_ttc;
1963 $facturestatic->paye = $obj->paye;
1964 $facturestatic->socid = $obj->fk_soc;
1966 $facturestatic->date = $db->jdate($obj->datef);
1967 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1968 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1970 $facturestatic->note_public = $obj->note_public;
1971 $facturestatic->note_private = $obj->note_private;
1974 $facturestatic->retained_warranty = $obj->retained_warranty;
1975 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1976 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1977 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1978 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1979 $facturestatic->situation_counter = $obj->situation_counter;
1982 $companystatic->id = $obj->socid;
1983 $companystatic->name = $obj->name;
1984 $companystatic->name_alias = $obj->alias;
1985 $companystatic->client = $obj->client;
1986 $companystatic->fournisseur = $obj->fournisseur;
1987 $companystatic->code_client = $obj->code_client;
1988 $companystatic->code_compta_client = $obj->code_compta_client;
1989 $companystatic->code_fournisseur = $obj->code_fournisseur;
1990 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1991 $companystatic->email = $obj->email;
1992 $companystatic->phone = $obj->phone;
1993 $companystatic->fax = $obj->fax;
1994 $companystatic->address = $obj->address;
1995 $companystatic->zip = $obj->zip;
1996 $companystatic->town = $obj->town;
1997 $companystatic->country_code = $obj->country_code;
1999 $projectstatic->id = $obj->project_id;
2000 $projectstatic->ref = $obj->project_ref;
2001 $projectstatic->title = $obj->project_label;
2003 $paiement = $facturestatic->getSommePaiement();
2004 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2005 $totaldeposits = $facturestatic->getSumDepositsUsed();
2006 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2007 $remaintopay = $obj->total_ttc - $totalpay;
2009 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2010 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2011 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2013 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2014 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
2016 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2017 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2021 $multicurrency_remaintopay = 0;
2024 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
2025 $remaintopay = -$remaincreditnote;
2026 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
2027 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2028 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2029 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2032 $facturestatic->alreadypaid = $paiement;
2033 $facturestatic->totalpaid = $paiement;
2035 $marginInfo = array();
2036 if ($with_margin_info ===
true) {
2037 $facturestatic->fetch_lines();
2038 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2039 $total_ht += $obj->total_ht;
2040 $total_margin += $marginInfo[
'total_margin'];
2045 if ($mode ==
'kanban') {
2047 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2048 print
'<div class="box-flex-container kanban">';
2051 if ($massactionbutton || $massaction) {
2053 if (in_array(
$object->id, $arrayofselected)) {
2058 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2059 print $facturestatic->getKanbanView(
'', $arraydata);
2060 if ($i == ($imaxinloop - 1)) {
2067 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2068 if ($contextpage ==
'poslist') {
2069 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2070 if (strpos($obj->ref, 'PROV
') !== false) {
2071 //If is a draft invoice, load var to be able to add products
2072 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2073 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2081 print
'<td class="nowrap center">';
2082 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2084 if (in_array($obj->id, $arrayofselected)) {
2087 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2091 $totalarray[
'nbfield']++;
2097 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2099 $totalarray[
'nbfield']++;
2104 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2105 print
'<td class="nowraponall">';
2107 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2109 print
'<td class="nobordernopadding nowraponall">';
2110 if ($contextpage ==
'poslist') {
2113 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2117 $filepath = $conf->facture->multidir_output[$obj->entity] ?? $conf->facture->dir_output;
2118 $filedir = $filepath .
'/' . $filename;
2120 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2121 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2128 $totalarray[
'nbfield']++;
2133 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2134 print
'<td class="nowrap tdoverflowmax200">';
2138 $totalarray[
'nbfield']++;
2143 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2144 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2145 print $facturestatic->getLibType(2);
2148 $totalarray[
'nbfield']++;
2153 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2155 if ($facturestatic->subtype > 0) {
2156 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2158 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2162 $totalarray[
'nbfield']++;
2167 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2168 print
'<td align="center" class="nowraponall">';
2172 $totalarray[
'nbfield']++;
2177 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2178 print
'<td align="center" class="nowraponall">';
2182 $totalarray[
'nbfield']++;
2187 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2188 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2189 if ($facturestatic->hasDelay()) {
2190 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2194 $totalarray[
'nbfield']++;
2199 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2200 print
'<td class="nocellnopadd nowraponall">';
2201 if ($obj->project_id > 0) {
2202 print $projectstatic->getNomUrl(1);
2206 $totalarray[
'nbfield']++;
2211 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2212 print
'<td class="nowraponall">';
2213 if ($obj->project_id > 0) {
2218 $totalarray[
'nbfield']++;
2223 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2224 print
'<td class="tdoverflowmax150">';
2225 if ($contextpage ==
'poslist') {
2228 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2232 $totalarray[
'nbfield']++;
2236 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2237 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2241 $totalarray[
'nbfield']++;
2245 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2246 print
'<td class="tdoverflowmax200">';
2247 if ($obj->fk_parent > 0) {
2248 if (!isset($company_url_list[$obj->fk_parent])) {
2249 $companyparent =
new Societe($db);
2250 $res = $companyparent->fetch($obj->fk_parent);
2252 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2255 if (isset($company_url_list[$obj->fk_parent])) {
2256 print $company_url_list[$obj->fk_parent];
2261 $totalarray[
'nbfield']++;
2265 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2266 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2270 $totalarray[
'nbfield']++;
2274 if (!empty($arrayfields[
's.town'][
'checked'])) {
2275 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2279 $totalarray[
'nbfield']++;
2283 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2284 print
'<td class="nowraponall">';
2288 $totalarray[
'nbfield']++;
2292 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2293 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2295 $totalarray[
'nbfield']++;
2299 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2300 $tmparray =
getCountry($obj->fk_pays,
'all');
2301 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2305 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2310 print
'<td class="center">';
2311 if (!is_array($typenArray) || count($typenArray) == 0) {
2312 $typenArray = $formcompany->typent_array(1);
2314 if (!empty($obj->typent_code)) {
2315 print $typenArray[$obj->typent_code];
2319 $totalarray[
'nbfield']++;
2323 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2324 print
'<td class="center">';
2325 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2326 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2328 print $conf->cache[
'staff'][$obj->staff_code];
2331 $totalarray[
'nbfield']++;
2336 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2337 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2338 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2342 $totalarray[
'nbfield']++;
2347 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2348 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2349 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2353 $totalarray[
'nbfield']++;
2358 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2363 $totalarray[
'nbfield']++;
2368 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2373 $totalarray[
'nbfield']++;
2378 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2379 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2381 $totalarray[
'nbfield']++;
2384 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2386 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2389 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2390 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2392 $totalarray[
'nbfield']++;
2395 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2397 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2400 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2401 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2403 $totalarray[
'nbfield']++;
2406 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2408 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2411 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2412 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2414 $totalarray[
'nbfield']++;
2417 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2419 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2422 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2423 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2425 $totalarray[
'nbfield']++;
2428 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2430 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2433 $userstatic->id = $obj->fk_user_author;
2434 $userstatic->login = $obj->login;
2435 $userstatic->lastname = $obj->lastname;
2436 $userstatic->firstname = $obj->firstname;
2437 $userstatic->email = $obj->user_email;
2438 $userstatic->status = $obj->user_statut;
2439 $userstatic->entity = $obj->entity;
2440 $userstatic->photo = $obj->photo;
2441 $userstatic->office_phone = $obj->office_phone;
2442 $userstatic->office_fax = $obj->office_fax;
2443 $userstatic->user_mobile = $obj->user_mobile;
2444 $userstatic->job = $obj->job;
2445 $userstatic->gender = $obj->gender;
2448 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2449 print
'<td class="tdoverflowmax200">';
2450 if ($userstatic->id) {
2451 print $userstatic->getNomUrl(-1);
2457 $totalarray[
'nbfield']++;
2461 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2464 if ($obj->socid > 0) {
2465 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2466 if ($listsalesrepresentatives < 0) {
2469 $nbofsalesrepresentative = count($listsalesrepresentatives);
2470 if ($nbofsalesrepresentative > 6) {
2472 print $nbofsalesrepresentative;
2473 } elseif ($nbofsalesrepresentative > 0) {
2475 foreach ($listsalesrepresentatives as $val) {
2476 $userstatic->id = $val[
'id'];
2477 $userstatic->lastname = $val[
'lastname'];
2478 $userstatic->firstname = $val[
'firstname'];
2479 $userstatic->email = $val[
'email'];
2480 $userstatic->status = $val[
'statut'];
2481 $userstatic->entity = $val[
'entity'];
2482 $userstatic->photo = $val[
'photo'];
2483 $userstatic->login = $val[
'login'];
2484 $userstatic->office_phone = $val[
'office_phone'];
2485 $userstatic->office_fax = $val[
'office_fax'];
2486 $userstatic->user_mobile = $val[
'user_mobile'];
2487 $userstatic->job = $val[
'job'];
2488 $userstatic->gender = $val[
'gender'];
2490 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2492 if ($j < $nbofsalesrepresentative) {
2504 $totalarray[
'nbfield']++;
2508 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2509 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2511 $totalarray[
'nbfield']++;
2515 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2516 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2518 $totalarray[
'nbfield']++;
2521 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2523 $totalarray[
'val'][
'totalam'] += $totalpay;
2527 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2528 print
'<td class="right nowraponall amount">';
2529 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2532 $totalarray[
'nbfield']++;
2535 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2537 $totalarray[
'val'][
'rtp'] += $remaintopay;
2542 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2543 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2545 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2551 $totalarray[
'nbfield']++;
2556 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2557 print
'<td class="nowraponall">';
2558 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2561 $totalarray[
'nbfield']++;
2565 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2566 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2568 $totalarray[
'nbfield']++;
2572 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2573 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2575 $totalarray[
'nbfield']++;
2579 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2580 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2582 $totalarray[
'nbfield']++;
2586 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2587 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2589 $totalarray[
'nbfield']++;
2594 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2595 print
'<td class="right nowraponall">';
2596 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2599 $totalarray[
'nbfield']++;
2604 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2605 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2607 $totalarray[
'nbfield']++;
2608 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2610 if (empty($totalarray[
'val'][
'total_pa'])) {
2611 $totalarray[
'val'][
'total_pa'] = 0;
2613 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2616 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2617 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2619 $totalarray[
'nbfield']++;
2620 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2622 if (empty($totalarray[
'val'][
'total_margin'])) {
2623 $totalarray[
'val'][
'total_margin'] = 0;
2625 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2628 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2629 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2631 $totalarray[
'nbfield']++;
2635 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2636 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2638 $totalarray[
'nbfield']++;
2639 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2641 if ($i >= $imaxinloop - 1) {
2642 if (!empty($total_ht)) {
2643 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2645 $totalarray[
'val'][
'total_mark_rate'] =
'';
2651 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2653 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2654 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2655 print $hookmanager->resPrint;
2657 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2658 print
'<td class="nowraponall center">';
2659 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2662 $totalarray[
'nbfield']++;
2666 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2667 print
'<td class="nowraponall center">';
2668 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2671 $totalarray[
'nbfield']++;
2675 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2676 print
'<td class="nowraponall center">';
2677 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2680 $totalarray[
'nbfield']++;
2684 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2685 print
'<td class="sensiblehtmlcontent center">';
2689 $totalarray[
'nbfield']++;
2693 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2694 print
'<td class="center">';
2698 $totalarray[
'nbfield']++;
2702 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2703 print
'<td class="center">';
2704 if (!empty($obj->fk_fac_rec_source)) {
2706 $result = $facrec->fetch($obj->fk_fac_rec_source);
2710 print $facrec->getNomUrl();
2715 $totalarray[
'nbfield']++;
2719 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2720 print
'<td class="nowrap center">';
2721 print $facturestatic->getLibStatut(5, $paiement);
2724 $totalarray[
'nbfield']++;
2731 print
'<td class="nowrap center">';
2732 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2734 if (in_array($obj->id, $arrayofselected)) {
2737 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2741 $totalarray[
'nbfield']++;
2752 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2753 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2756 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2762 foreach ($arrayfields as $key => $val) {
2763 if (!empty($val[
'checked'])) {
2767 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2772$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2773$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2774print $hookmanager->resPrint;
2776print
'</table>'.
"\n";
2779print
'</form>'.
"\n";
2782if ($contextpage !=
'poslist') {
2783 $hidegeneratedfilelistifempty = 1;
2784 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2785 $hidegeneratedfilelistifempty = 0;
2789 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2790 $urlsource .= str_replace(
'&',
'&', $param);
2792 $filedir = $diroutputmassaction;
2793 $genallowed = $user->hasRight(
"facture",
"lire");
2794 $delallowed = $user->hasRight(
"facture",
"creer");
2797 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
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_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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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 dolibarr global constant string value.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.