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';
308if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
309 $search_sale = $user->id;
313$fieldid = (!empty($ref) ?
'ref' :
'rowid');
314if (!empty($user->socid)) {
315 $socid = $user->socid;
317if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
318 $search_sale = $user->id;
321$result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
328if (
GETPOST(
'cancel',
'alpha')) {
332if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
336$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
337$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
342include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
345if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
348 $search_product_category =
'';
350 $search_refcustomer =
'';
352 $search_subtype =
'';
353 $search_project_ref =
'';
354 $search_project =
'';
355 $search_company =
'';
356 $search_company_alias =
'';
357 $search_parent_name =
'';
358 $search_montant_ht =
'';
359 $search_montant_vat =
'';
360 $search_montant_localtax1 =
'';
361 $search_montant_localtax2 =
'';
362 $search_montant_ttc =
'';
364 $search_multicurrency_code =
'';
365 $search_multicurrency_tx =
'';
366 $search_multicurrency_montant_ht =
'';
367 $search_multicurrency_montant_vat =
'';
368 $search_multicurrency_montant_ttc =
'';
370 $search_paymentmode =
'';
371 $search_paymentterms =
'';
372 $search_module_source =
'';
373 $search_pos_source =
'';
377 $search_country =
'';
378 $search_type_thirdparty =
'';
379 $search_customer_code =
'';
380 $search_date_startday =
'';
381 $search_date_startmonth =
'';
382 $search_date_startyear =
'';
383 $search_date_endday =
'';
384 $search_date_endmonth =
'';
385 $search_date_endyear =
'';
386 $search_date_start =
'';
387 $search_date_end =
'';
388 $search_date_valid_startday =
'';
389 $search_date_valid_startmonth =
'';
390 $search_date_valid_startyear =
'';
391 $search_date_valid_endday =
'';
392 $search_date_valid_endmonth =
'';
393 $search_date_valid_endyear =
'';
394 $search_date_valid_start =
'';
395 $search_date_valid_end =
'';
396 $search_datelimit_startday =
'';
397 $search_datelimit_startmonth =
'';
398 $search_datelimit_startyear =
'';
399 $search_datelimit_endday =
'';
400 $search_datelimit_endmonth =
'';
401 $search_datelimit_endyear =
'';
402 $search_datelimit_start =
'';
403 $search_datelimit_end =
'';
404 $search_fac_rec_source_title =
'';
406 $search_categ_cus = 0;
408 $search_array_options = array();
411if (empty($reshook)) {
412 $objectclass =
'Facture';
413 $objectlabel =
'Invoices';
414 $permissiontoread = $user->hasRight(
"facture",
"lire");
415 $permissiontoadd = $user->hasRight(
"facture",
"creer");
416 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
417 $uploaddir = $conf->facture->dir_output;
418 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
421if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
422 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
423 $arrayofselected = is_array($toselect) ? $toselect : array();
424 if (!empty($arrayofselected)) {
428 if (empty($paiementdate)) {
429 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
431 $action =
'makepayment';
435 foreach ($arrayofselected as $toselectid) {
438 $result = $facture->fetch($toselectid);
448 $sommePaiement = $facture->getSommePaiement(-1);
449 $paiementAmount = $sommePaiement[
'alreadypaid'];
451 $totalcreditnotes = $facture->getSumCreditNotesUsed();
452 $totaldeposits = $facture->getSumDepositsUsed();
454 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
455 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
458 $parameters = array(
'remaintopay' => $remaintopay);
459 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
461 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
462 $remaintopay = $remain;
464 } elseif ($reshook < 0) {
466 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
470 $multicurrency_remaintopay =
price2num($facture->multicurrency_total_ttc - $sommePaiement[
'alreadypaid_multicurrency']);
472 if ($remaintopay != 0) {
473 $resultBank = $facture->setBankAccount($bankid);
474 if ($resultBank < 0) {
479 $paiement->datepaye = $paiementdate;
480 $paiement->amounts[$facture->id] = $remaintopay;
481 $paiement->multicurrency_amounts[$facture->id] = $multicurrency_remaintopay;
482 $paiement->paiementid = $paiementid;
483 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
484 if ($paiement_id < 0) {
485 $langs->load(
"errors");
486 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
489 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
491 $langs->load(
"errors");
492 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
498 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
502 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
507 if (empty($errorpayment)) {
508 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
516} elseif ($massaction ==
'withdrawrequest') {
517 $langs->load(
"withdrawals");
519 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
526 $arrayofselected = is_array($toselect) ? $toselect : array();
527 $listofbills = array();
528 foreach ($arrayofselected as $toselectid) {
530 $result = $objecttmp->fetch($toselectid);
532 $totalpaid = $objecttmp->getSommePaiement();
533 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
534 $totaldeposits = $objecttmp->getSumDepositsUsed();
535 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
538 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
539 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
541 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
542 $objecttmp->resteapayer = $remaintopay;
544 } elseif ($reshook < 0) {
546 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
551 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
552 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
554 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
555 } elseif ($objecttmp->resteapayer < 0) {
557 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
560 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
561 $rsql .=
" , pfd.date_traite as date_traite";
562 $rsql .=
" , pfd.amount";
563 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
564 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
565 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
566 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
567 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
568 $rsql .=
" AND pfd.traite = 0";
569 $rsql .=
" ORDER BY pfd.date_demande DESC";
571 $result_sql = $db->query($rsql);
573 $numprlv = $db->num_rows($result_sql);
578 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
579 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
580 $langs->load(
"errors");
582 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
584 $listofbills[] = $objecttmp;
590 if (!empty($listofbills)) {
591 $nbwithdrawrequestok = 0;
592 foreach ($listofbills as $aBill) {
594 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
597 $nbwithdrawrequestok++;
603 if ($nbwithdrawrequestok > 0) {
604 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
616$form =
new Form($db);
620if (isModEnabled(
'margin')) {
623$bankaccountstatic =
new Account($db);
624$facturestatic =
new Facture($db);
626$companystatic =
new Societe($db);
627$companyparent =
new Societe($db);
629$company_url_list = array();
634 if (empty($search_company)) {
635 $search_company = $soc->name;
639$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
640$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
642$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
643$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
649 $sql =
'SELECT DISTINCT';
651$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,';
652$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
653$sql .=
' f.fk_user_author,';
654$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,';
655$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
656$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
657$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
658$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
659$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,';
660$sql .=
" s.parent as fk_parent,";
661$sql .=
" s2.nom as name2,";
662$sql .=
' typent.code as typent_code,';
663$sql .=
' state.code_departement as state_code, state.nom as state_name,';
664$sql .=
' country.code as country_code,';
665$sql .=
' f.fk_fac_rec_source,';
666$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
667$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';
677if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
678 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
679 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
683$parameters = array();
684$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
685$sql .= $hookmanager->resPrint;
686$sql = preg_replace(
'/,\s*$/',
'', $sql);
690$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
691$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
692$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
693$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
694$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
695$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
696if ($sortfield ==
"f.datef") {
697 $sql .= $db->hintindex(
'idx_facture_datef');
699if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
700 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
703 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
705if (!empty($search_fac_rec_source_title)) {
706 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
708$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
709$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
711$parameters = array();
712$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
713$sql .= $hookmanager->resPrint;
715$sql .=
' WHERE f.fk_soc = s.rowid';
716$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
718 $sql .=
' AND s.rowid = '.((int) $socid);
722 $sql .=
' AND f.fk_user_author IS NULL';
724 $sql .=
' AND f.fk_user_author = '.((int) $userid);
730if ($search_refcustomer) {
733if ($search_type !=
'' && $search_type !=
'-1') {
734 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
736if ($search_subtype !=
'' && $search_subtype !=
'-1') {
737 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
739if ($search_project_ref) {
742if ($search_project) {
745if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
746 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
748 if ($search_company) {
751 if ($search_company_alias) {
755if ($search_parent_name) {
758if ($search_customer_code) {
770if (strlen(trim($search_country))) {
772 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
773 foreach ($arrayofcode as $key => $value) {
774 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
775 if ($value != $mysoc->country_code) {
776 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
779 if ($search_country ==
'special_allnotme') {
780 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
781 } elseif ($search_country ==
'special_eec') {
782 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
783 } elseif ($search_country ==
'special_eecnotme') {
784 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
785 } elseif ($search_country ==
'special_noteec') {
786 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
791if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
792 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
794if ($search_montant_ht !=
'') {
797if ($search_montant_vat !=
'') {
800if ($search_montant_localtax1 !=
'') {
801 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
803if ($search_montant_localtax2 !=
'') {
804 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
806if ($search_montant_ttc !=
'') {
809if ($search_multicurrency_code !=
'') {
810 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
812if ($search_multicurrency_tx !=
'') {
813 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
815if ($search_multicurrency_montant_ht !=
'') {
816 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
818if ($search_multicurrency_montant_vat !=
'') {
819 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
821if ($search_multicurrency_montant_ttc !=
'') {
822 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
825 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
827if ($search_status !=
'-1' && $search_status !=
'') {
828 if (is_numeric($search_status) && $search_status >= 0) {
829 if ($search_status ==
'0') {
830 $sql .=
" AND f.fk_statut = 0";
832 if ($search_status ==
'1') {
833 $sql .=
" AND f.fk_statut = 1";
835 if ($search_status ==
'2') {
836 $sql .=
" AND f.fk_statut = 2";
838 if ($search_status ==
'3') {
839 $sql .=
" AND f.fk_statut = 3";
842 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
846if ($search_paymentmode > 0) {
847 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
849if ($search_paymentterms > 0) {
850 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
852if ($search_module_source) {
855if ($search_pos_source) {
858if ($search_date_start) {
859 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
861if ($search_date_end) {
862 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
864if ($search_date_valid_start) {
865 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
867if ($search_date_valid_end) {
868 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
870if ($search_datelimit_start) {
871 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
873if ($search_datelimit_end) {
874 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
876if ($search_option ==
'late') {
877 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
882if (!empty($search_fac_rec_source_title)) {
883 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
886if ($search_user > 0) {
887 $sql .=
" AND EXISTS (";
888 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
889 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
890 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
891 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
892 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
895if ($search_sale && $search_sale !=
'-1') {
896 if ($search_sale == -2) {
897 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
898 } elseif ($search_sale > 0) {
899 $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).
")";
903$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
904$searchCategoryProductOperator = 0;
905if (!empty($searchCategoryProductList)) {
906 $searchCategoryProductSqlList = array();
907 $listofcategoryid =
'';
908 foreach ($searchCategoryProductList as $searchCategoryProduct) {
909 if (intval($searchCategoryProduct) == -2) {
910 $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)";
911 } elseif (intval($searchCategoryProduct) > 0) {
912 if ($searchCategoryProductOperator == 0) {
913 $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).
")";
915 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
919 if ($listofcategoryid) {
920 $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).
"))";
922 if ($searchCategoryProductOperator == 1) {
923 if (!empty($searchCategoryProductSqlList)) {
924 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
927 if (!empty($searchCategoryProductSqlList)) {
928 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
932$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
933$searchCategoryCustomerOperator = 0;
935if (!empty($searchCategoryCustomerList)) {
936 $searchCategoryCustomerSqlList = array();
937 $listofcategoryid =
'';
938 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
939 if (intval($searchCategoryCustomer) == -2) {
940 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
941 } elseif (intval($searchCategoryCustomer) > 0) {
942 if ($searchCategoryCustomerOperator == 0) {
943 $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).
")";
945 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
949 if ($listofcategoryid) {
950 $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).
"))";
952 if ($searchCategoryCustomerOperator == 1) {
953 if (!empty($searchCategoryCustomerSqlList)) {
954 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
957 if (!empty($searchCategoryCustomerSqlList)) {
958 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
963include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
965$parameters = array();
966$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
967$sql .= $hookmanager->resPrint;
970 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
974$parameters = array();
975$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
976$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
979$nbtotalofrecords =
'';
982 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
983 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
985 $resql = $db->query($sqlforcount);
987 $objforcount = $db->fetch_object($resql);
988 $nbtotalofrecords = $objforcount->nbtotalofrecords;
993 if (($page * $limit) > $nbtotalofrecords) {
1001$sql .= $db->order($sortfield, $sortorder);
1003 $sql .= $db->plimit($limit + 1, $offset);
1006$resql = $db->query($sql);
1012$num = $db->num_rows($resql);
1014$arrayofselected = is_array($toselect) ? $toselect : array();
1016if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1017 $obj = $db->fetch_object($resql);
1020 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.$id);
1027llxHeader(
'', $title, $help_url, 0, 0,
'',
'',
'',
'bodyforlist');
1029$param =
'&socid='.urlencode((
string) ($socid));
1031 $param .=
'&mode='.urlencode($mode);
1033if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1034 $param .=
'&contextpage='.urlencode($contextpage);
1036if ($limit > 0 && $limit != $conf->liste_limit) {
1037 $param .=
'&limit='.((int) $limit);
1040 $param .=
'&search_all='.urlencode($search_all);
1042if ($search_date_startday) {
1043 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1045if ($search_date_startmonth) {
1046 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1048if ($search_date_startyear) {
1049 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1051if ($search_date_endday) {
1052 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1054if ($search_date_endmonth) {
1055 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1057if ($search_date_endyear) {
1058 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1060if ($search_date_valid_startday) {
1061 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1063if ($search_date_valid_startmonth) {
1064 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1066if ($search_date_valid_startyear) {
1067 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1069if ($search_date_valid_endday) {
1070 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1072if ($search_date_valid_endmonth) {
1073 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1075if ($search_date_valid_endyear) {
1076 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1078if ($search_datelimit_startday) {
1079 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1081if ($search_datelimit_startmonth) {
1082 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1084if ($search_datelimit_startyear) {
1085 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1087if ($search_datelimit_endday) {
1088 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1090if ($search_datelimit_endmonth) {
1091 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1093if ($search_datelimit_endyear) {
1094 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1097 $param .=
'&search_ref='.urlencode($search_ref);
1099if ($search_refcustomer) {
1100 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1102if ($search_project_ref) {
1103 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1105if ($search_project) {
1106 $param .=
'&search_project='.urlencode($search_project);
1108if ($search_type !=
'') {
1109 $param .=
'&search_type='.urlencode($search_type);
1111if ($search_subtype !=
'') {
1112 $param .=
'&search_subtype='.urlencode($search_subtype);
1114if ($search_company) {
1115 $param .=
'&search_company='.urlencode($search_company);
1117if ($search_company_alias) {
1118 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1120if ($search_parent_name !=
'') {
1121 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1124 $param .=
'&search_town='.urlencode($search_town);
1127 $param .=
'&search_zip='.urlencode($search_zip);
1129if ($search_country) {
1130 $param .=
"&search_country=".urlencode($search_country);
1132if ($search_type_thirdparty !=
'') {
1133 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1135if ($search_customer_code) {
1136 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1138if ($search_sale > 0) {
1139 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1141if ($search_user > 0) {
1142 $param .=
'&search_user='.urlencode((
string) $search_user);
1145 $param .=
'&search_login='.urlencode($search_login);
1147if ($search_product_category > 0) {
1148 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1150if ($search_montant_ht !=
'') {
1151 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1153if ($search_montant_vat !=
'') {
1154 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1156if ($search_montant_localtax1 !=
'') {
1157 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1159if ($search_montant_localtax2 !=
'') {
1160 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1162if ($search_montant_ttc !=
'') {
1163 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1165if ($search_multicurrency_code !=
'') {
1166 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1168if ($search_multicurrency_tx !=
'') {
1169 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1171if ($search_multicurrency_montant_ht !=
'') {
1172 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1174if ($search_multicurrency_montant_vat !=
'') {
1175 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1177if ($search_multicurrency_montant_ttc !=
'') {
1178 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1180if ($search_status !=
'') {
1181 $param .=
'&search_status='.urlencode($search_status);
1183if ($search_paymentmode > 0) {
1184 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1186if ($search_paymentterms > 0) {
1187 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1189if ($search_module_source) {
1190 $param .=
'&search_module_source='.urlencode($search_module_source);
1192if ($search_pos_source) {
1193 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1196 $param .=
'&show_files='.urlencode((
string) ($show_files));
1198if ($search_option) {
1199 $param .=
"&search_option=".urlencode($search_option);
1201if ($optioncss !=
'') {
1202 $param .=
'&optioncss='.urlencode($optioncss);
1204if ($search_categ_cus > 0) {
1205 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1207if (!empty($search_fac_rec_source_title)) {
1208 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1212include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1214$parameters = array(
'param' => &$param);
1215$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1216$param .= $hookmanager->resPrint;
1218$arrayofmassactions = array(
1219 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1220 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1221 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1222 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1225if ($user->hasRight(
'facture',
'paiement')) {
1226 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1228if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1229 $langs->load(
"withdrawals");
1230 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1232if ($user->hasRight(
'facture',
'supprimer')) {
1234 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1236 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1239if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1240 $arrayofmassactions = array();
1242$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1246if ($contextpage !=
'poslist') {
1247 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1248 if (!empty($socid)) {
1249 $url .=
'&socid='.$socid;
1251 $newcardbutton =
'';
1252 $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'));
1253 $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'));
1255 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1259print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1260if ($optioncss !=
'') {
1261 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1263print
'<input type="hidden" name="token" value="'.newToken().
'">';
1264print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1265if (!in_array($massaction, array(
'makepayment'))) {
1266 print
'<input type="hidden" name="action" value="list">';
1268print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1269print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1270print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1271print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1272print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1273print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1275print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1277$topicmail =
"SendBillRef";
1278$modelmail =
"facture_send";
1280$trackid =
'inv'.$object->id;
1281include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1283if ($massaction ==
'makepayment') {
1285 $formquestion = array(
1289 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1290 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1291 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1294 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1299 foreach ($fieldstosearchall as $key => $val) {
1300 $fieldstosearchall[$key] = $langs->trans($val);
1302 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1307if ($user->hasRight(
"user",
"user",
"lire")) {
1308 $langs->load(
"commercial");
1309 $moreforfilter .=
'<div class="divsearchfield">';
1310 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1311 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1312 $moreforfilter .=
'</div>';
1315if ($user->hasRight(
"user",
"user",
"lire")) {
1316 $moreforfilter .=
'<div class="divsearchfield">';
1317 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1318 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1319 $moreforfilter .=
'</div>';
1322if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1323 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1324 $moreforfilter .=
'<div class="divsearchfield">';
1325 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1326 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1327 $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);
1328 $moreforfilter .=
'</div>';
1330if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1331 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1332 $moreforfilter .=
'<div class="divsearchfield">';
1333 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1334 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1335 $moreforfilter .=
'</div>';
1338$moreforfilter .=
'<div class="divsearchfield">';
1339$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1340$moreforfilter .=
'</div>';
1342$parameters = array();
1343$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1344if (empty($reshook)) {
1345 $moreforfilter .= $hookmanager->resPrint;
1347 $moreforfilter = $hookmanager->resPrint;
1350if (!empty($moreforfilter)) {
1351 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1352 print $moreforfilter;
1356$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1357$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1360if ($massactionbutton && $contextpage !=
'poslist') {
1361 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1364print
'<div class="div-table-responsive">';
1365print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1369print
'<tr class="liste_titre_filter">';
1373 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1374 $searchpicto = $form->showFilterButtons(
'left');
1380 print
'<td class="liste_titre">';
1384if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1385 print
'<td class="liste_titre" align="left">';
1386 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1390if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1391 print
'<td class="liste_titre">';
1392 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1396if (!empty($arrayfields[
'f.type'][
'checked'])) {
1397 print
'<td class="liste_titre maxwidthonsmartphone">';
1409 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1413if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1414 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1415 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1419if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1420 print
'<td class="liste_titre center">';
1421 print
'<div class="nowrapfordate">';
1422 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1424 print
'<div class="nowrapfordate">';
1425 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1430if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1431 print
'<td class="liste_titre center">';
1432 print
'<div class="nowrapfordate">';
1433 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'));
1435 print
'<div class="nowrapfordate">';
1436 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'));
1441if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1442 print
'<td class="liste_titre center">';
1443 print
'<div class="nowrapfordate">';
1444 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1446 print
'<div class="nowrapfordate">';
1447 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1452if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1453 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1456if (!empty($arrayfields[
'p.title'][
'checked'])) {
1457 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1460if (!empty($arrayfields[
's.nom'][
'checked'])) {
1461 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1464if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1465 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1468if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1469 print
'<td class="liste_titre">';
1470 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1474if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1475 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1478if (!empty($arrayfields[
's.town'][
'checked'])) {
1479 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1482if (!empty($arrayfields[
's.zip'][
'checked'])) {
1483 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1486if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1487 print
'<td class="liste_titre">';
1488 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1492if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1493 print
'<td class="liste_titre center">';
1494 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1498if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1499 print
'<td class="liste_titre maxwidthonsmartphone center">';
1500 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);
1504if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1505 print
'<td class="liste_titre">';
1506 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1510if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1511 print
'<td class="liste_titre left">';
1512 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1516if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1517 print
'<td class="liste_titre">';
1518 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1522if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1523 print
'<td class="liste_titre">';
1524 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1527if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1529 print
'<td class="liste_titre right">';
1530 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1533if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1535 print
'<td class="liste_titre right">';
1536 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1539if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1541 print
'<td class="liste_titre right">';
1542 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1545if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1547 print
'<td class="liste_titre right">';
1548 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1551if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1553 print
'<td class="liste_titre right">';
1554 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1557if (!empty($arrayfields[
'u.login'][
'checked'])) {
1559 print
'<td class="liste_titre" align="center">';
1560 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1563if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1564 print
'<td class="liste_titre"></td>';
1566if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1567 print
'<td class="liste_titre" align="right">';
1570if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1571 print
'<td class="liste_titre right">';
1574if (!empty($arrayfields[
'rtp'][
'checked'])) {
1575 print
'<td class="liste_titre">';
1578if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1580 print
'<td class="liste_titre">';
1581 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1584if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1586 print
'<td class="liste_titre">';
1587 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1590if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1592 print
'<td class="liste_titre right">';
1593 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1596if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1598 print
'<td class="liste_titre right">';
1599 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1602if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1604 print
'<td class="liste_titre right">';
1605 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1608if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1609 print
'<td class="liste_titre">';
1612if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1613 print
'<td class="liste_titre right">';
1616if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1617 print
'<td class="liste_titre right">';
1620if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1621 print
'<td class="liste_titre right">';
1624if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1625 print
'<td class="liste_titre right">';
1628if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1629 print
'<td class="liste_titre right">';
1634include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1637$parameters = array(
'arrayfields' => $arrayfields);
1638$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1639print $hookmanager->resPrint;
1641if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1642 print
'<td class="liste_titre">';
1646if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1647 print
'<td class="liste_titre">';
1651if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1652 print
'<td class="liste_titre">';
1655if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1657 print
'<td class="liste_titre">';
1660if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1662 print
'<td class="liste_titre">';
1665if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1667 print
'<td class="liste_titre maxwidthonsmartphone right">';
1668 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).
'">';
1672if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1673 print
'<td class="liste_titre center parentonrightofpage">';
1674 $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"));
1676 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1681 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1682 $searchpicto = $form->showFilterButtons();
1688$totalarray = array();
1689$totalarray[
'nbfield'] = 0;
1693print
'<tr class="liste_titre">';
1695 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1696 $totalarray[
'nbfield']++;
1700 $totalarray[
'nbfield']++;
1702if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1704 $totalarray[
'nbfield']++;
1706if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
'f.type'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1712 $totalarray[
'nbfield']++;
1714if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1717if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1718 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1719 $totalarray[
'nbfield']++;
1721if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1723 $totalarray[
'nbfield']++;
1725if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1727 $totalarray[
'nbfield']++;
1729if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1730 $langs->load(
"projects");
1731 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1732 $totalarray[
'nbfield']++;
1734if (!empty($arrayfields[
'p.title'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1736 $totalarray[
'nbfield']++;
1738if (!empty($arrayfields[
's.nom'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1740 $totalarray[
'nbfield']++;
1742if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1744 $totalarray[
'nbfield']++;
1746if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1748 $totalarray[
'nbfield']++;
1750if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1752 $totalarray[
'nbfield']++;
1754if (!empty($arrayfields[
's.town'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1756 $totalarray[
'nbfield']++;
1758if (!empty($arrayfields[
's.zip'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1760 $totalarray[
'nbfield']++;
1762if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1764 $totalarray[
'nbfield']++;
1766if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1768 $totalarray[
'nbfield']++;
1770if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1771 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1772 $totalarray[
'nbfield']++;
1774if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1775 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1776 $totalarray[
'nbfield']++;
1778if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1779 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1780 $totalarray[
'nbfield']++;
1782if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1783 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1784 $totalarray[
'nbfield']++;
1786if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1787 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1788 $totalarray[
'nbfield']++;
1790if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1791 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1792 $totalarray[
'nbfield']++;
1794if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1795 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1796 $totalarray[
'nbfield']++;
1798if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1799 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1800 $totalarray[
'nbfield']++;
1802if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1803 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1804 $totalarray[
'nbfield']++;
1806if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1807 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1808 $totalarray[
'nbfield']++;
1810if (!empty($arrayfields[
'u.login'][
'checked'])) {
1811 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1812 $totalarray[
'nbfield']++;
1814if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1815 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1816 $totalarray[
'nbfield']++;
1818if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1819 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1820 $totalarray[
'nbfield']++;
1822if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1824 $totalarray[
'nbfield']++;
1826if (!empty($arrayfields[
'rtp'][
'checked'])) {
1827 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1828 $totalarray[
'nbfield']++;
1830if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1831 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1832 $totalarray[
'nbfield']++;
1834if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1835 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1836 $totalarray[
'nbfield']++;
1838if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1839 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1840 $totalarray[
'nbfield']++;
1842if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1843 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1844 $totalarray[
'nbfield']++;
1846if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1847 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1848 $totalarray[
'nbfield']++;
1850if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1851 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1852 $totalarray[
'nbfield']++;
1854if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1855 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1856 $totalarray[
'nbfield']++;
1858if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1859 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1860 $totalarray[
'nbfield']++;
1862if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1863 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1864 $totalarray[
'nbfield']++;
1866if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1867 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1868 $totalarray[
'nbfield']++;
1870if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1871 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1872 $totalarray[
'nbfield']++;
1875include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1877$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1878$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1879print $hookmanager->resPrint;
1880if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1881 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1882 $totalarray[
'nbfield']++;
1884if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1885 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1886 $totalarray[
'nbfield']++;
1888if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1889 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1890 $totalarray[
'nbfield']++;
1892if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1893 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1894 $totalarray[
'nbfield']++;
1896if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1897 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1898 $totalarray[
'nbfield']++;
1900if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1901 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1902 $totalarray[
'nbfield']++;
1904if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1905 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1906 $totalarray[
'nbfield']++;
1909 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1910 $totalarray[
'nbfield']++;
1915$projectstatic =
new Project($db);
1917$userstatic =
new User($db);
1923 $savnbfield = $totalarray[
'nbfield'];
1924 $totalarray = array();
1925 $totalarray[
'nbfield'] = 0;
1926 $totalarray[
'val'] = array();
1927 $totalarray[
'val'][
'f.total_ht'] = 0;
1928 $totalarray[
'val'][
'f.total_tva'] = 0;
1929 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1930 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1931 $totalarray[
'val'][
'f.total_ttc'] = 0;
1932 $totalarray[
'val'][
'totalam'] = 0;
1933 $totalarray[
'val'][
'rtp'] = 0;
1935 $typenArray = $formcompany->typent_array(1);
1937 $with_margin_info =
false;
1938 if (isModEnabled(
'margin') && (
1939 !empty($arrayfields[
'total_pa'][
'checked'])
1940 || !empty($arrayfields[
'total_margin'][
'checked'])
1941 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1942 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1945 $with_margin_info =
true;
1950 $imaxinloop = ($limit ? min($num, $limit) : $num);
1951 while ($i < $imaxinloop) {
1952 $obj = $db->fetch_object($resql);
1954 $datelimit = $db->jdate($obj->datelimite);
1956 $facturestatic->id = $obj->id;
1957 $facturestatic->ref = $obj->ref;
1958 $facturestatic->ref_client = $obj->ref_client;
1959 $facturestatic->ref_customer = $obj->ref_client;
1960 $facturestatic->type = $obj->type;
1961 $facturestatic->subtype = $obj->subtype;
1962 $facturestatic->total_ht = $obj->total_ht;
1963 $facturestatic->total_tva = $obj->total_tva;
1964 $facturestatic->total_ttc = $obj->total_ttc;
1965 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1966 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1967 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1968 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1969 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1970 $facturestatic->statut = $obj->fk_statut;
1971 $facturestatic->status = $obj->fk_statut;
1972 $facturestatic->close_code = $obj->close_code;
1973 $facturestatic->total_ttc = $obj->total_ttc;
1974 $facturestatic->paye = $obj->paye;
1975 $facturestatic->socid = $obj->fk_soc;
1977 $facturestatic->date = $db->jdate($obj->datef);
1978 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1979 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1981 $facturestatic->note_public = $obj->note_public;
1982 $facturestatic->note_private = $obj->note_private;
1985 $facturestatic->retained_warranty = $obj->retained_warranty;
1986 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1987 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1988 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1989 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1990 $facturestatic->situation_counter = $obj->situation_counter;
1993 $companystatic->id = $obj->socid;
1994 $companystatic->name = $obj->name;
1995 $companystatic->name_alias = $obj->alias;
1996 $companystatic->client = $obj->client;
1997 $companystatic->fournisseur = $obj->fournisseur;
1998 $companystatic->code_client = $obj->code_client;
1999 $companystatic->code_compta_client = $obj->code_compta_client;
2000 $companystatic->code_fournisseur = $obj->code_fournisseur;
2001 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2002 $companystatic->email = $obj->email;
2003 $companystatic->phone = $obj->phone;
2004 $companystatic->fax = $obj->fax;
2005 $companystatic->address = $obj->address;
2006 $companystatic->zip = $obj->zip;
2007 $companystatic->town = $obj->town;
2008 $companystatic->country_code = $obj->country_code;
2010 $projectstatic->id = $obj->project_id;
2011 $projectstatic->ref = $obj->project_ref;
2012 $projectstatic->title = $obj->project_label;
2014 $paiement = $facturestatic->getSommePaiement();
2015 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2016 $totaldeposits = $facturestatic->getSumDepositsUsed();
2017 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2018 $remaintopay = $obj->total_ttc - $totalpay;
2020 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2021 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2022 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2024 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2025 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
2027 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2028 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2032 $multicurrency_remaintopay = 0;
2035 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
2036 $remaintopay = -$remaincreditnote;
2037 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
2038 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2039 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2040 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2043 $facturestatic->alreadypaid = $paiement;
2044 $facturestatic->totalpaid = $paiement;
2046 $marginInfo = array();
2047 if ($with_margin_info ===
true) {
2048 $facturestatic->fetch_lines();
2049 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2050 $total_ht += $obj->total_ht;
2051 $total_margin += $marginInfo[
'total_margin'];
2056 if ($mode ==
'kanban') {
2058 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2059 print
'<div class="box-flex-container kanban">';
2062 if ($massactionbutton || $massaction) {
2064 if (in_array(
$object->id, $arrayofselected)) {
2069 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2070 print $facturestatic->getKanbanView(
'', $arraydata);
2071 if ($i == ($imaxinloop - 1)) {
2078 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2079 if ($contextpage ==
'poslist') {
2080 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2081 if (strpos($obj->ref, 'PROV
') !== false) {
2082 //If is a draft invoice, load var to be able to add products
2083 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2084 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2092 print
'<td class="nowrap center">';
2093 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2095 if (in_array($obj->id, $arrayofselected)) {
2098 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2102 $totalarray[
'nbfield']++;
2108 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2110 $totalarray[
'nbfield']++;
2115 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2116 print
'<td class="nowraponall">';
2118 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2120 print
'<td class="nobordernopadding nowraponall">';
2121 if ($contextpage ==
'poslist') {
2124 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2128 $filepath = $conf->facture->multidir_output[$obj->entity] ?? $conf->facture->dir_output;
2129 $filedir = $filepath .
'/' . $filename;
2131 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2132 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2139 $totalarray[
'nbfield']++;
2144 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2145 print
'<td class="nowrap tdoverflowmax200">';
2149 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2155 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2156 print $facturestatic->getLibType(2);
2159 $totalarray[
'nbfield']++;
2164 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2166 if ($facturestatic->subtype > 0) {
2167 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2169 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2173 $totalarray[
'nbfield']++;
2178 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2179 print
'<td align="center" class="nowraponall">';
2183 $totalarray[
'nbfield']++;
2188 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2189 print
'<td align="center" class="nowraponall">';
2193 $totalarray[
'nbfield']++;
2198 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2199 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2200 if ($facturestatic->hasDelay()) {
2201 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2205 $totalarray[
'nbfield']++;
2210 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2211 print
'<td class="nocellnopadd nowraponall">';
2212 if ($obj->project_id > 0) {
2213 print $projectstatic->getNomUrl(1);
2217 $totalarray[
'nbfield']++;
2222 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2223 print
'<td class="nowraponall">';
2224 if ($obj->project_id > 0) {
2229 $totalarray[
'nbfield']++;
2234 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2235 print
'<td class="tdoverflowmax150">';
2236 if ($contextpage ==
'poslist') {
2239 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2243 $totalarray[
'nbfield']++;
2247 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2248 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2252 $totalarray[
'nbfield']++;
2256 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2257 print
'<td class="tdoverflowmax200">';
2258 if ($obj->fk_parent > 0) {
2259 if (!isset($company_url_list[$obj->fk_parent])) {
2260 $companyparent =
new Societe($db);
2261 $res = $companyparent->fetch($obj->fk_parent);
2263 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2266 if (isset($company_url_list[$obj->fk_parent])) {
2267 print $company_url_list[$obj->fk_parent];
2272 $totalarray[
'nbfield']++;
2276 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2277 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2281 $totalarray[
'nbfield']++;
2285 if (!empty($arrayfields[
's.town'][
'checked'])) {
2286 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2290 $totalarray[
'nbfield']++;
2294 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2295 print
'<td class="nowraponall">';
2299 $totalarray[
'nbfield']++;
2303 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2304 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2306 $totalarray[
'nbfield']++;
2310 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2311 $tmparray =
getCountry($obj->fk_pays,
'all');
2312 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2316 $totalarray[
'nbfield']++;
2320 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2321 print
'<td class="center">';
2322 if (!is_array($typenArray) || count($typenArray) == 0) {
2323 $typenArray = $formcompany->typent_array(1);
2325 if (!empty($obj->typent_code)) {
2326 print $typenArray[$obj->typent_code];
2330 $totalarray[
'nbfield']++;
2334 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2335 print
'<td class="center">';
2336 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2337 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2339 print $conf->cache[
'staff'][$obj->staff_code];
2342 $totalarray[
'nbfield']++;
2347 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2348 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2349 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2353 $totalarray[
'nbfield']++;
2358 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2359 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2360 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2364 $totalarray[
'nbfield']++;
2369 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2374 $totalarray[
'nbfield']++;
2379 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2384 $totalarray[
'nbfield']++;
2389 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2390 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2392 $totalarray[
'nbfield']++;
2395 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2397 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2400 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2401 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2403 $totalarray[
'nbfield']++;
2406 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2408 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2411 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2412 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2414 $totalarray[
'nbfield']++;
2417 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2419 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2422 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2423 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2425 $totalarray[
'nbfield']++;
2428 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2430 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2433 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2434 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2436 $totalarray[
'nbfield']++;
2439 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2441 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2444 $userstatic->id = $obj->fk_user_author;
2445 $userstatic->login = $obj->login;
2446 $userstatic->lastname = $obj->lastname;
2447 $userstatic->firstname = $obj->firstname;
2448 $userstatic->email = $obj->user_email;
2449 $userstatic->status = $obj->user_statut;
2450 $userstatic->entity = $obj->entity;
2451 $userstatic->photo = $obj->photo;
2452 $userstatic->office_phone = $obj->office_phone;
2453 $userstatic->office_fax = $obj->office_fax;
2454 $userstatic->user_mobile = $obj->user_mobile;
2455 $userstatic->job = $obj->job;
2456 $userstatic->gender = $obj->gender;
2459 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2460 print
'<td class="tdoverflowmax200">';
2461 if ($userstatic->id) {
2462 print $userstatic->getNomUrl(-1);
2468 $totalarray[
'nbfield']++;
2472 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2475 if ($obj->socid > 0) {
2476 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2477 if ($listsalesrepresentatives < 0) {
2480 $nbofsalesrepresentative = count($listsalesrepresentatives);
2481 if ($nbofsalesrepresentative > 6) {
2483 print $nbofsalesrepresentative;
2484 } elseif ($nbofsalesrepresentative > 0) {
2486 foreach ($listsalesrepresentatives as $val) {
2487 $userstatic->id = $val[
'id'];
2488 $userstatic->lastname = $val[
'lastname'];
2489 $userstatic->firstname = $val[
'firstname'];
2490 $userstatic->email = $val[
'email'];
2491 $userstatic->status = $val[
'statut'];
2492 $userstatic->entity = $val[
'entity'];
2493 $userstatic->photo = $val[
'photo'];
2494 $userstatic->login = $val[
'login'];
2495 $userstatic->office_phone = $val[
'office_phone'];
2496 $userstatic->office_fax = $val[
'office_fax'];
2497 $userstatic->user_mobile = $val[
'user_mobile'];
2498 $userstatic->job = $val[
'job'];
2499 $userstatic->gender = $val[
'gender'];
2501 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2503 if ($j < $nbofsalesrepresentative) {
2515 $totalarray[
'nbfield']++;
2519 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2520 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2522 $totalarray[
'nbfield']++;
2526 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2527 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2529 $totalarray[
'nbfield']++;
2532 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2534 $totalarray[
'val'][
'totalam'] += $totalpay;
2538 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2539 print
'<td class="right nowraponall amount">';
2540 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2543 $totalarray[
'nbfield']++;
2546 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2548 $totalarray[
'val'][
'rtp'] += $remaintopay;
2553 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2554 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2556 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2562 $totalarray[
'nbfield']++;
2567 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2568 print
'<td class="nowraponall">';
2569 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2572 $totalarray[
'nbfield']++;
2576 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2577 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2579 $totalarray[
'nbfield']++;
2583 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2584 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2586 $totalarray[
'nbfield']++;
2590 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2591 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2593 $totalarray[
'nbfield']++;
2597 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2598 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2600 $totalarray[
'nbfield']++;
2605 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2606 print
'<td class="right nowraponall">';
2607 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2610 $totalarray[
'nbfield']++;
2615 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2616 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2618 $totalarray[
'nbfield']++;
2619 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2621 if (empty($totalarray[
'val'][
'total_pa'])) {
2622 $totalarray[
'val'][
'total_pa'] = 0;
2624 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2627 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2628 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2630 $totalarray[
'nbfield']++;
2631 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2633 if (empty($totalarray[
'val'][
'total_margin'])) {
2634 $totalarray[
'val'][
'total_margin'] = 0;
2636 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2639 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2640 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2642 $totalarray[
'nbfield']++;
2646 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2647 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2649 $totalarray[
'nbfield']++;
2650 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2652 if ($i >= $imaxinloop - 1) {
2653 if (!empty($total_ht)) {
2654 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2656 $totalarray[
'val'][
'total_mark_rate'] =
'';
2662 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2664 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2665 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2666 print $hookmanager->resPrint;
2668 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2669 print
'<td class="nowraponall center">';
2670 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2673 $totalarray[
'nbfield']++;
2677 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2678 print
'<td class="nowraponall center">';
2679 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2682 $totalarray[
'nbfield']++;
2686 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2687 print
'<td class="nowraponall center">';
2688 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2691 $totalarray[
'nbfield']++;
2695 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2696 print
'<td class="sensiblehtmlcontent center">';
2700 $totalarray[
'nbfield']++;
2704 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2705 print
'<td class="center">';
2709 $totalarray[
'nbfield']++;
2713 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2714 print
'<td class="center">';
2715 if (!empty($obj->fk_fac_rec_source)) {
2717 $result = $facrec->fetch($obj->fk_fac_rec_source);
2721 print $facrec->getNomUrl();
2726 $totalarray[
'nbfield']++;
2730 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2731 print
'<td class="nowrap center">';
2732 print $facturestatic->getLibStatut(5, $paiement);
2735 $totalarray[
'nbfield']++;
2742 print
'<td class="nowrap center">';
2743 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2745 if (in_array($obj->id, $arrayofselected)) {
2748 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2752 $totalarray[
'nbfield']++;
2763 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2764 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2767 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2773 foreach ($arrayfields as $key => $val) {
2774 if (!empty($val[
'checked'])) {
2778 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2783$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2784$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2785print $hookmanager->resPrint;
2787print
'</table>'.
"\n";
2790print
'</form>'.
"\n";
2793if ($contextpage !=
'poslist') {
2794 $hidegeneratedfilelistifempty = 1;
2795 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2796 $hidegeneratedfilelistifempty = 0;
2800 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2801 $urlsource .= str_replace(
'&',
'&', $param);
2803 $filedir = $diroutputmassaction;
2804 $genallowed = $user->hasRight(
"facture",
"lire");
2805 $delallowed = $user->hasRight(
"facture",
"creer");
2808 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.