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);
447 $paiementAmount = $facture->getSommePaiement();
448 $totalcreditnotes = $facture->getSumCreditNotesUsed();
449 $totaldeposits = $facture->getSumDepositsUsed();
451 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
452 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
455 $parameters = array(
'remaintopay' => $remaintopay);
456 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
458 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
459 $remaintopay = $remain;
461 } elseif ($reshook < 0) {
463 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
466 if ($remaintopay != 0) {
467 $resultBank = $facture->setBankAccount($bankid);
468 if ($resultBank < 0) {
473 $paiement->datepaye = $paiementdate;
474 $paiement->amounts[$facture->id] = $remaintopay;
475 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
476 $paiement->paiementid = $paiementid;
477 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
478 if ($paiement_id < 0) {
479 $langs->load(
"errors");
480 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
483 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
485 $langs->load(
"errors");
486 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
492 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
496 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
501 if (empty($errorpayment)) {
502 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
510} elseif ($massaction ==
'withdrawrequest') {
511 $langs->load(
"withdrawals");
513 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
520 $arrayofselected = is_array($toselect) ? $toselect : array();
521 $listofbills = array();
522 foreach ($arrayofselected as $toselectid) {
524 $result = $objecttmp->fetch($toselectid);
526 $totalpaid = $objecttmp->getSommePaiement();
527 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
528 $totaldeposits = $objecttmp->getSumDepositsUsed();
529 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
532 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
533 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
535 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
536 $objecttmp->resteapayer = $remaintopay;
538 } elseif ($reshook < 0) {
540 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
545 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
546 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
548 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
549 } elseif ($objecttmp->resteapayer < 0) {
551 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
554 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
555 $rsql .=
" , pfd.date_traite as date_traite";
556 $rsql .=
" , pfd.amount";
557 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
558 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
559 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
560 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
561 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
562 $rsql .=
" AND pfd.traite = 0";
563 $rsql .=
" ORDER BY pfd.date_demande DESC";
565 $result_sql = $db->query($rsql);
567 $numprlv = $db->num_rows($result_sql);
572 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
573 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
574 $langs->load(
"errors");
576 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
578 $listofbills[] = $objecttmp;
584 if (!empty($listofbills)) {
585 $nbwithdrawrequestok = 0;
586 foreach ($listofbills as $aBill) {
588 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
591 $nbwithdrawrequestok++;
597 if ($nbwithdrawrequestok > 0) {
598 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
610$form =
new Form($db);
614if (isModEnabled(
'margin')) {
617$bankaccountstatic =
new Account($db);
618$facturestatic =
new Facture($db);
620$companystatic =
new Societe($db);
621$companyparent =
new Societe($db);
623$company_url_list = array();
628 if (empty($search_company)) {
629 $search_company = $soc->name;
633$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
634$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
636$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
637$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
643 $sql =
'SELECT DISTINCT';
645$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,';
646$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
647$sql .=
' f.fk_user_author,';
648$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,';
649$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
650$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
651$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
652$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
653$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,';
654$sql .=
" s.parent as fk_parent,";
655$sql .=
" s2.nom as name2,";
656$sql .=
' typent.code as typent_code,';
657$sql .=
' state.code_departement as state_code, state.nom as state_name,';
658$sql .=
' country.code as country_code,';
659$sql .=
' f.fk_fac_rec_source,';
660$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
661$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';
671if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
672 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
673 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
677$parameters = array();
678$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
679$sql .= $hookmanager->resPrint;
680$sql = preg_replace(
'/,\s*$/',
'', $sql);
684$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
685$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
686$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
687$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
688$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
689$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
690if ($sortfield ==
"f.datef") {
691 $sql .= $db->hintindex(
'idx_facture_datef');
693if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
694 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
697 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
699if (!empty($search_fac_rec_source_title)) {
700 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
702$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
703$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
705$parameters = array();
706$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
707$sql .= $hookmanager->resPrint;
709$sql .=
' WHERE f.fk_soc = s.rowid';
710$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
712 $sql .=
' AND s.rowid = '.((int) $socid);
716 $sql .=
' AND f.fk_user_author IS NULL';
718 $sql .=
' AND f.fk_user_author = '.((int) $userid);
724if ($search_refcustomer) {
727if ($search_type !=
'' && $search_type !=
'-1') {
728 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
730if ($search_subtype !=
'' && $search_subtype !=
'-1') {
731 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
733if ($search_project_ref) {
736if ($search_project) {
739if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
740 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
742 if ($search_company) {
745 if ($search_company_alias) {
749if ($search_parent_name) {
752if ($search_customer_code) {
764if (strlen(trim($search_country))) {
766 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
767 foreach ($arrayofcode as $key => $value) {
768 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
769 if ($value != $mysoc->country_code) {
770 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
773 if ($search_country ==
'special_allnotme') {
774 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
775 } elseif ($search_country ==
'special_eec') {
776 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
777 } elseif ($search_country ==
'special_eecnotme') {
778 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
779 } elseif ($search_country ==
'special_noteec') {
780 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
785if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
786 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
788if ($search_montant_ht !=
'') {
791if ($search_montant_vat !=
'') {
794if ($search_montant_localtax1 !=
'') {
795 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
797if ($search_montant_localtax2 !=
'') {
798 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
800if ($search_montant_ttc !=
'') {
803if ($search_multicurrency_code !=
'') {
804 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
806if ($search_multicurrency_tx !=
'') {
807 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
809if ($search_multicurrency_montant_ht !=
'') {
810 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
812if ($search_multicurrency_montant_vat !=
'') {
813 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
815if ($search_multicurrency_montant_ttc !=
'') {
816 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
819 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
821if ($search_status !=
'-1' && $search_status !=
'') {
822 if (is_numeric($search_status) && $search_status >= 0) {
823 if ($search_status ==
'0') {
824 $sql .=
" AND f.fk_statut = 0";
826 if ($search_status ==
'1') {
827 $sql .=
" AND f.fk_statut = 1";
829 if ($search_status ==
'2') {
830 $sql .=
" AND f.fk_statut = 2";
832 if ($search_status ==
'3') {
833 $sql .=
" AND f.fk_statut = 3";
836 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
840if ($search_paymentmode > 0) {
841 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
843if ($search_paymentterms > 0) {
844 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
846if ($search_module_source) {
849if ($search_pos_source) {
852if ($search_date_start) {
853 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
855if ($search_date_end) {
856 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
858if ($search_date_valid_start) {
859 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
861if ($search_date_valid_end) {
862 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
864if ($search_datelimit_start) {
865 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
867if ($search_datelimit_end) {
868 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
870if ($search_option ==
'late') {
871 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
876if (!empty($search_fac_rec_source_title)) {
877 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
880if ($search_user > 0) {
881 $sql .=
" AND EXISTS (";
882 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
883 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
884 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
885 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
886 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
889if ($search_sale && $search_sale !=
'-1') {
890 if ($search_sale == -2) {
891 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
892 } elseif ($search_sale > 0) {
893 $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).
")";
897$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
898$searchCategoryProductOperator = 0;
899if (!empty($searchCategoryProductList)) {
900 $searchCategoryProductSqlList = array();
901 $listofcategoryid =
'';
902 foreach ($searchCategoryProductList as $searchCategoryProduct) {
903 if (intval($searchCategoryProduct) == -2) {
904 $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)";
905 } elseif (intval($searchCategoryProduct) > 0) {
906 if ($searchCategoryProductOperator == 0) {
907 $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).
")";
909 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
913 if ($listofcategoryid) {
914 $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).
"))";
916 if ($searchCategoryProductOperator == 1) {
917 if (!empty($searchCategoryProductSqlList)) {
918 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
921 if (!empty($searchCategoryProductSqlList)) {
922 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
926$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
927$searchCategoryCustomerOperator = 0;
929if (!empty($searchCategoryCustomerList)) {
930 $searchCategoryCustomerSqlList = array();
931 $listofcategoryid =
'';
932 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
933 if (intval($searchCategoryCustomer) == -2) {
934 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
935 } elseif (intval($searchCategoryCustomer) > 0) {
936 if ($searchCategoryCustomerOperator == 0) {
937 $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).
")";
939 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
943 if ($listofcategoryid) {
944 $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).
"))";
946 if ($searchCategoryCustomerOperator == 1) {
947 if (!empty($searchCategoryCustomerSqlList)) {
948 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
951 if (!empty($searchCategoryCustomerSqlList)) {
952 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
957include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
959$parameters = array();
960$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
961$sql .= $hookmanager->resPrint;
964 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
968$parameters = array();
969$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
970$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
973$nbtotalofrecords =
'';
976 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
977 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
979 $resql = $db->query($sqlforcount);
981 $objforcount = $db->fetch_object($resql);
982 $nbtotalofrecords = $objforcount->nbtotalofrecords;
987 if (($page * $limit) > $nbtotalofrecords) {
995$sql .= $db->order($sortfield, $sortorder);
997 $sql .= $db->plimit($limit + 1, $offset);
1000$resql = $db->query($sql);
1006$num = $db->num_rows($resql);
1008$arrayofselected = is_array($toselect) ? $toselect : array();
1010if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1011 $obj = $db->fetch_object($resql);
1014 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.$id);
1021llxHeader(
'', $title, $help_url, 0, 0,
'',
'',
'',
'bodyforlist');
1023$param =
'&socid='.urlencode((
string) ($socid));
1025 $param .=
'&mode='.urlencode($mode);
1027if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1028 $param .=
'&contextpage='.urlencode($contextpage);
1030if ($limit > 0 && $limit != $conf->liste_limit) {
1031 $param .=
'&limit='.((int) $limit);
1034 $param .=
'&search_all='.urlencode($search_all);
1036if ($search_date_startday) {
1037 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1039if ($search_date_startmonth) {
1040 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1042if ($search_date_startyear) {
1043 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1045if ($search_date_endday) {
1046 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1048if ($search_date_endmonth) {
1049 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1051if ($search_date_endyear) {
1052 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1054if ($search_date_valid_startday) {
1055 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1057if ($search_date_valid_startmonth) {
1058 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1060if ($search_date_valid_startyear) {
1061 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1063if ($search_date_valid_endday) {
1064 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1066if ($search_date_valid_endmonth) {
1067 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1069if ($search_date_valid_endyear) {
1070 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1072if ($search_datelimit_startday) {
1073 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1075if ($search_datelimit_startmonth) {
1076 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1078if ($search_datelimit_startyear) {
1079 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1081if ($search_datelimit_endday) {
1082 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1084if ($search_datelimit_endmonth) {
1085 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1087if ($search_datelimit_endyear) {
1088 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1091 $param .=
'&search_ref='.urlencode($search_ref);
1093if ($search_refcustomer) {
1094 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1096if ($search_project_ref) {
1097 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1099if ($search_project) {
1100 $param .=
'&search_project='.urlencode($search_project);
1102if ($search_type !=
'') {
1103 $param .=
'&search_type='.urlencode($search_type);
1105if ($search_subtype !=
'') {
1106 $param .=
'&search_subtype='.urlencode($search_subtype);
1108if ($search_company) {
1109 $param .=
'&search_company='.urlencode($search_company);
1111if ($search_company_alias) {
1112 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1114if ($search_parent_name !=
'') {
1115 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1118 $param .=
'&search_town='.urlencode($search_town);
1121 $param .=
'&search_zip='.urlencode($search_zip);
1123if ($search_country) {
1124 $param .=
"&search_country=".urlencode($search_country);
1126if ($search_type_thirdparty !=
'') {
1127 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1129if ($search_customer_code) {
1130 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1132if ($search_sale > 0) {
1133 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1135if ($search_user > 0) {
1136 $param .=
'&search_user='.urlencode((
string) $search_user);
1139 $param .=
'&search_login='.urlencode($search_login);
1141if ($search_product_category > 0) {
1142 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1144if ($search_montant_ht !=
'') {
1145 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1147if ($search_montant_vat !=
'') {
1148 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1150if ($search_montant_localtax1 !=
'') {
1151 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1153if ($search_montant_localtax2 !=
'') {
1154 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1156if ($search_montant_ttc !=
'') {
1157 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1159if ($search_multicurrency_code !=
'') {
1160 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1162if ($search_multicurrency_tx !=
'') {
1163 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1165if ($search_multicurrency_montant_ht !=
'') {
1166 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1168if ($search_multicurrency_montant_vat !=
'') {
1169 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1171if ($search_multicurrency_montant_ttc !=
'') {
1172 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1174if ($search_status !=
'') {
1175 $param .=
'&search_status='.urlencode($search_status);
1177if ($search_paymentmode > 0) {
1178 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1180if ($search_paymentterms > 0) {
1181 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1183if ($search_module_source) {
1184 $param .=
'&search_module_source='.urlencode($search_module_source);
1186if ($search_pos_source) {
1187 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1190 $param .=
'&show_files='.urlencode((
string) ($show_files));
1192if ($search_option) {
1193 $param .=
"&search_option=".urlencode($search_option);
1195if ($optioncss !=
'') {
1196 $param .=
'&optioncss='.urlencode($optioncss);
1198if ($search_categ_cus > 0) {
1199 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1201if (!empty($search_fac_rec_source_title)) {
1202 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1206include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1208$parameters = array(
'param' => &$param);
1209$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1210$param .= $hookmanager->resPrint;
1212$arrayofmassactions = array(
1213 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1214 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1215 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1216 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1219if ($user->hasRight(
'facture',
'paiement')) {
1220 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1222if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1223 $langs->load(
"withdrawals");
1224 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1226if ($user->hasRight(
'facture',
'supprimer')) {
1228 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1230 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1233if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1234 $arrayofmassactions = array();
1236$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1240if ($contextpage !=
'poslist') {
1241 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1242 if (!empty($socid)) {
1243 $url .=
'&socid='.$socid;
1245 $newcardbutton =
'';
1246 $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'));
1247 $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'));
1249 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1253print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1254if ($optioncss !=
'') {
1255 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1257print
'<input type="hidden" name="token" value="'.newToken().
'">';
1258print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1259if (!in_array($massaction, array(
'makepayment'))) {
1260 print
'<input type="hidden" name="action" value="list">';
1262print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1263print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1264print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1265print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1266print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1267print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1269print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1271$topicmail =
"SendBillRef";
1272$modelmail =
"facture_send";
1274$trackid =
'inv'.$object->id;
1275include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1277if ($massaction ==
'makepayment') {
1279 $formquestion = array(
1283 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1284 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1285 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1288 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1293 foreach ($fieldstosearchall as $key => $val) {
1294 $fieldstosearchall[$key] = $langs->trans($val);
1296 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1301if ($user->hasRight(
"user",
"user",
"lire")) {
1302 $langs->load(
"commercial");
1303 $moreforfilter .=
'<div class="divsearchfield">';
1304 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1305 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1306 $moreforfilter .=
'</div>';
1309if ($user->hasRight(
"user",
"user",
"lire")) {
1310 $moreforfilter .=
'<div class="divsearchfield">';
1311 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1312 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1313 $moreforfilter .=
'</div>';
1316if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1317 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1318 $moreforfilter .=
'<div class="divsearchfield">';
1319 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1320 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1321 $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);
1322 $moreforfilter .=
'</div>';
1324if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1325 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1326 $moreforfilter .=
'<div class="divsearchfield">';
1327 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1328 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1329 $moreforfilter .=
'</div>';
1332$moreforfilter .=
'<div class="divsearchfield">';
1333$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1334$moreforfilter .=
'</div>';
1336$parameters = array();
1337$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1338if (empty($reshook)) {
1339 $moreforfilter .= $hookmanager->resPrint;
1341 $moreforfilter = $hookmanager->resPrint;
1344if (!empty($moreforfilter)) {
1345 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1346 print $moreforfilter;
1350$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1351$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1354if ($massactionbutton && $contextpage !=
'poslist') {
1355 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1358print
'<div class="div-table-responsive">';
1359print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1363print
'<tr class="liste_titre_filter">';
1367 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1368 $searchpicto = $form->showFilterButtons(
'left');
1374 print
'<td class="liste_titre">';
1378if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1379 print
'<td class="liste_titre" align="left">';
1380 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1384if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1385 print
'<td class="liste_titre">';
1386 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1390if (!empty($arrayfields[
'f.type'][
'checked'])) {
1391 print
'<td class="liste_titre maxwidthonsmartphone">';
1403 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1407if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1408 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1409 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1413if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1414 print
'<td class="liste_titre center">';
1415 print
'<div class="nowrapfordate">';
1416 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1418 print
'<div class="nowrapfordate">';
1419 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1424if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1425 print
'<td class="liste_titre center">';
1426 print
'<div class="nowrapfordate">';
1427 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'));
1429 print
'<div class="nowrapfordate">';
1430 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'));
1435if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1436 print
'<td class="liste_titre center">';
1437 print
'<div class="nowrapfordate">';
1438 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1440 print
'<div class="nowrapfordate">';
1441 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1446if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1447 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1450if (!empty($arrayfields[
'p.title'][
'checked'])) {
1451 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1454if (!empty($arrayfields[
's.nom'][
'checked'])) {
1455 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1458if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1459 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1462if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1463 print
'<td class="liste_titre">';
1464 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1468if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1469 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1472if (!empty($arrayfields[
's.town'][
'checked'])) {
1473 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1476if (!empty($arrayfields[
's.zip'][
'checked'])) {
1477 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1480if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1481 print
'<td class="liste_titre">';
1482 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1486if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1487 print
'<td class="liste_titre center">';
1488 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1492if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1493 print
'<td class="liste_titre maxwidthonsmartphone center">';
1494 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);
1498if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1499 print
'<td class="liste_titre">';
1500 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1504if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1505 print
'<td class="liste_titre left">';
1506 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1510if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1511 print
'<td class="liste_titre">';
1512 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1516if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1517 print
'<td class="liste_titre">';
1518 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1521if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1523 print
'<td class="liste_titre right">';
1524 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1527if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1529 print
'<td class="liste_titre right">';
1530 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1533if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1535 print
'<td class="liste_titre right">';
1536 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1539if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1541 print
'<td class="liste_titre right">';
1542 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1545if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1547 print
'<td class="liste_titre right">';
1548 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1551if (!empty($arrayfields[
'u.login'][
'checked'])) {
1553 print
'<td class="liste_titre" align="center">';
1554 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1557if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1558 print
'<td class="liste_titre"></td>';
1560if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1561 print
'<td class="liste_titre" align="right">';
1564if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1565 print
'<td class="liste_titre right">';
1568if (!empty($arrayfields[
'rtp'][
'checked'])) {
1569 print
'<td class="liste_titre">';
1572if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1574 print
'<td class="liste_titre">';
1575 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1578if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1580 print
'<td class="liste_titre">';
1581 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1584if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1586 print
'<td class="liste_titre right">';
1587 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1590if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1592 print
'<td class="liste_titre right">';
1593 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1596if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1598 print
'<td class="liste_titre right">';
1599 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1602if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1603 print
'<td class="liste_titre">';
1606if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1607 print
'<td class="liste_titre right">';
1610if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1611 print
'<td class="liste_titre right">';
1614if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1615 print
'<td class="liste_titre right">';
1618if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1619 print
'<td class="liste_titre right">';
1622if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1623 print
'<td class="liste_titre right">';
1628include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1631$parameters = array(
'arrayfields' => $arrayfields);
1632$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1633print $hookmanager->resPrint;
1635if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1636 print
'<td class="liste_titre">';
1640if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1641 print
'<td class="liste_titre">';
1645if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1649if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1651 print
'<td class="liste_titre">';
1654if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1656 print
'<td class="liste_titre">';
1659if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1661 print
'<td class="liste_titre maxwidthonsmartphone right">';
1662 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).
'">';
1666if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1667 print
'<td class="liste_titre center parentonrightofpage">';
1668 $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"));
1670 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1675 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1676 $searchpicto = $form->showFilterButtons();
1682$totalarray = array();
1683$totalarray[
'nbfield'] = 0;
1687print
'<tr class="liste_titre">';
1689 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1690 $totalarray[
'nbfield']++;
1694 $totalarray[
'nbfield']++;
1696if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1697 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1698 $totalarray[
'nbfield']++;
1700if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1702 $totalarray[
'nbfield']++;
1704if (!empty($arrayfields[
'f.type'][
'checked'])) {
1705 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1706 $totalarray[
'nbfield']++;
1708if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1709 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1711if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1713 $totalarray[
'nbfield']++;
1715if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1717 $totalarray[
'nbfield']++;
1719if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1724 $langs->load(
"projects");
1725 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1726 $totalarray[
'nbfield']++;
1728if (!empty($arrayfields[
'p.title'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1730 $totalarray[
'nbfield']++;
1732if (!empty($arrayfields[
's.nom'][
'checked'])) {
1733 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1734 $totalarray[
'nbfield']++;
1736if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1738 $totalarray[
'nbfield']++;
1740if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1741 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1742 $totalarray[
'nbfield']++;
1744if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1745 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1746 $totalarray[
'nbfield']++;
1748if (!empty($arrayfields[
's.town'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1750 $totalarray[
'nbfield']++;
1752if (!empty($arrayfields[
's.zip'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1754 $totalarray[
'nbfield']++;
1756if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1758 $totalarray[
'nbfield']++;
1760if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1762 $totalarray[
'nbfield']++;
1764if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1766 $totalarray[
'nbfield']++;
1768if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1770 $totalarray[
'nbfield']++;
1772if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1774 $totalarray[
'nbfield']++;
1776if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1778 $totalarray[
'nbfield']++;
1780if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1782 $totalarray[
'nbfield']++;
1784if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1786 $totalarray[
'nbfield']++;
1788if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1790 $totalarray[
'nbfield']++;
1792if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1794 $totalarray[
'nbfield']++;
1796if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1798 $totalarray[
'nbfield']++;
1800if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1801 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1802 $totalarray[
'nbfield']++;
1804if (!empty($arrayfields[
'u.login'][
'checked'])) {
1805 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1806 $totalarray[
'nbfield']++;
1808if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1809 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1810 $totalarray[
'nbfield']++;
1812if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1813 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1814 $totalarray[
'nbfield']++;
1816if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1817 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1818 $totalarray[
'nbfield']++;
1820if (!empty($arrayfields[
'rtp'][
'checked'])) {
1821 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1822 $totalarray[
'nbfield']++;
1824if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1826 $totalarray[
'nbfield']++;
1828if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1830 $totalarray[
'nbfield']++;
1832if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1834 $totalarray[
'nbfield']++;
1836if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1838 $totalarray[
'nbfield']++;
1840if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1842 $totalarray[
'nbfield']++;
1844if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1846 $totalarray[
'nbfield']++;
1848if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1849 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1850 $totalarray[
'nbfield']++;
1852if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1854 $totalarray[
'nbfield']++;
1856if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1857 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1858 $totalarray[
'nbfield']++;
1860if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1861 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1862 $totalarray[
'nbfield']++;
1864if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1865 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1866 $totalarray[
'nbfield']++;
1869include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1871$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1872$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1873print $hookmanager->resPrint;
1874if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1875 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1876 $totalarray[
'nbfield']++;
1878if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1879 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1880 $totalarray[
'nbfield']++;
1882if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1883 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1884 $totalarray[
'nbfield']++;
1886if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1887 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1888 $totalarray[
'nbfield']++;
1890if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1891 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1892 $totalarray[
'nbfield']++;
1894if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1895 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1896 $totalarray[
'nbfield']++;
1898if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1899 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1900 $totalarray[
'nbfield']++;
1903 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1904 $totalarray[
'nbfield']++;
1909$projectstatic =
new Project($db);
1911$userstatic =
new User($db);
1917 $savnbfield = $totalarray[
'nbfield'];
1918 $totalarray = array();
1919 $totalarray[
'nbfield'] = 0;
1920 $totalarray[
'val'] = array();
1921 $totalarray[
'val'][
'f.total_ht'] = 0;
1922 $totalarray[
'val'][
'f.total_tva'] = 0;
1923 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1924 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1925 $totalarray[
'val'][
'f.total_ttc'] = 0;
1926 $totalarray[
'val'][
'totalam'] = 0;
1927 $totalarray[
'val'][
'rtp'] = 0;
1929 $typenArray = $formcompany->typent_array(1);
1931 $with_margin_info =
false;
1932 if (isModEnabled(
'margin') && (
1933 !empty($arrayfields[
'total_pa'][
'checked'])
1934 || !empty($arrayfields[
'total_margin'][
'checked'])
1935 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1936 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1939 $with_margin_info =
true;
1944 $imaxinloop = ($limit ? min($num, $limit) : $num);
1945 while ($i < $imaxinloop) {
1946 $obj = $db->fetch_object($resql);
1948 $datelimit = $db->jdate($obj->datelimite);
1950 $facturestatic->id = $obj->id;
1951 $facturestatic->ref = $obj->ref;
1952 $facturestatic->ref_client = $obj->ref_client;
1953 $facturestatic->ref_customer = $obj->ref_client;
1954 $facturestatic->type = $obj->type;
1955 $facturestatic->subtype = $obj->subtype;
1956 $facturestatic->total_ht = $obj->total_ht;
1957 $facturestatic->total_tva = $obj->total_tva;
1958 $facturestatic->total_ttc = $obj->total_ttc;
1959 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1960 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1961 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1962 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1963 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1964 $facturestatic->statut = $obj->fk_statut;
1965 $facturestatic->status = $obj->fk_statut;
1966 $facturestatic->close_code = $obj->close_code;
1967 $facturestatic->total_ttc = $obj->total_ttc;
1968 $facturestatic->paye = $obj->paye;
1969 $facturestatic->socid = $obj->fk_soc;
1971 $facturestatic->date = $db->jdate($obj->datef);
1972 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1973 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1975 $facturestatic->note_public = $obj->note_public;
1976 $facturestatic->note_private = $obj->note_private;
1979 $facturestatic->retained_warranty = $obj->retained_warranty;
1980 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1981 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1982 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1983 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1984 $facturestatic->situation_counter = $obj->situation_counter;
1987 $companystatic->id = $obj->socid;
1988 $companystatic->name = $obj->name;
1989 $companystatic->name_alias = $obj->alias;
1990 $companystatic->client = $obj->client;
1991 $companystatic->fournisseur = $obj->fournisseur;
1992 $companystatic->code_client = $obj->code_client;
1993 $companystatic->code_compta_client = $obj->code_compta_client;
1994 $companystatic->code_fournisseur = $obj->code_fournisseur;
1995 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1996 $companystatic->email = $obj->email;
1997 $companystatic->phone = $obj->phone;
1998 $companystatic->fax = $obj->fax;
1999 $companystatic->address = $obj->address;
2000 $companystatic->zip = $obj->zip;
2001 $companystatic->town = $obj->town;
2002 $companystatic->country_code = $obj->country_code;
2004 $projectstatic->id = $obj->project_id;
2005 $projectstatic->ref = $obj->project_ref;
2006 $projectstatic->title = $obj->project_label;
2008 $paiement = $facturestatic->getSommePaiement();
2009 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2010 $totaldeposits = $facturestatic->getSumDepositsUsed();
2011 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2012 $remaintopay = $obj->total_ttc - $totalpay;
2014 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2015 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2016 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2018 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2019 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
2021 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2022 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2026 $multicurrency_remaintopay = 0;
2029 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
2030 $remaintopay = -$remaincreditnote;
2031 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
2032 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2033 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2034 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2037 $facturestatic->alreadypaid = $paiement;
2038 $facturestatic->totalpaid = $paiement;
2040 $marginInfo = array();
2041 if ($with_margin_info ===
true) {
2042 $facturestatic->fetch_lines();
2043 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2044 $total_ht += $obj->total_ht;
2045 $total_margin += $marginInfo[
'total_margin'];
2050 if ($mode ==
'kanban') {
2052 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2053 print
'<div class="box-flex-container kanban">';
2056 if ($massactionbutton || $massaction) {
2058 if (in_array(
$object->id, $arrayofselected)) {
2063 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2064 print $facturestatic->getKanbanView(
'', $arraydata);
2065 if ($i == ($imaxinloop - 1)) {
2072 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2073 if ($contextpage ==
'poslist') {
2074 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2075 if (strpos($obj->ref, 'PROV
') !== false) {
2076 //If is a draft invoice, load var to be able to add products
2077 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2078 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2086 print
'<td class="nowrap center">';
2087 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2089 if (in_array($obj->id, $arrayofselected)) {
2092 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2096 $totalarray[
'nbfield']++;
2102 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2104 $totalarray[
'nbfield']++;
2109 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2110 print
'<td class="nowraponall">';
2112 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2114 print
'<td class="nobordernopadding nowraponall">';
2115 if ($contextpage ==
'poslist') {
2118 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2122 $filepath = $conf->facture->multidir_output[$obj->entity] ?? $conf->facture->dir_output;
2123 $filedir = $filepath .
'/' . $filename;
2125 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2126 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2133 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2139 print
'<td class="nowrap tdoverflowmax200">';
2143 $totalarray[
'nbfield']++;
2148 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2149 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2150 print $facturestatic->getLibType(2);
2153 $totalarray[
'nbfield']++;
2158 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2160 if ($facturestatic->subtype > 0) {
2161 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2163 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2167 $totalarray[
'nbfield']++;
2172 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2173 print
'<td align="center" class="nowraponall">';
2177 $totalarray[
'nbfield']++;
2182 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2183 print
'<td align="center" class="nowraponall">';
2187 $totalarray[
'nbfield']++;
2192 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2193 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2194 if ($facturestatic->hasDelay()) {
2195 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2199 $totalarray[
'nbfield']++;
2204 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2205 print
'<td class="nocellnopadd nowraponall">';
2206 if ($obj->project_id > 0) {
2207 print $projectstatic->getNomUrl(1);
2211 $totalarray[
'nbfield']++;
2216 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2217 print
'<td class="nowraponall">';
2218 if ($obj->project_id > 0) {
2223 $totalarray[
'nbfield']++;
2228 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2229 print
'<td class="tdoverflowmax150">';
2230 if ($contextpage ==
'poslist') {
2233 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2237 $totalarray[
'nbfield']++;
2241 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2242 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2246 $totalarray[
'nbfield']++;
2250 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2251 print
'<td class="tdoverflowmax200">';
2252 if ($obj->fk_parent > 0) {
2253 if (!isset($company_url_list[$obj->fk_parent])) {
2254 $companyparent =
new Societe($db);
2255 $res = $companyparent->fetch($obj->fk_parent);
2257 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2260 if (isset($company_url_list[$obj->fk_parent])) {
2261 print $company_url_list[$obj->fk_parent];
2266 $totalarray[
'nbfield']++;
2270 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2271 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2275 $totalarray[
'nbfield']++;
2279 if (!empty($arrayfields[
's.town'][
'checked'])) {
2280 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2284 $totalarray[
'nbfield']++;
2288 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2289 print
'<td class="nowraponall">';
2293 $totalarray[
'nbfield']++;
2297 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2298 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2300 $totalarray[
'nbfield']++;
2304 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2305 $tmparray =
getCountry($obj->fk_pays,
'all');
2306 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2310 $totalarray[
'nbfield']++;
2314 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2315 print
'<td class="center">';
2316 if (!is_array($typenArray) || count($typenArray) == 0) {
2317 $typenArray = $formcompany->typent_array(1);
2319 if (!empty($obj->typent_code)) {
2320 print $typenArray[$obj->typent_code];
2324 $totalarray[
'nbfield']++;
2328 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2329 print
'<td class="center">';
2330 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2331 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2333 print $conf->cache[
'staff'][$obj->staff_code];
2336 $totalarray[
'nbfield']++;
2341 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2342 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2343 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2347 $totalarray[
'nbfield']++;
2352 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2353 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2354 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2358 $totalarray[
'nbfield']++;
2363 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2368 $totalarray[
'nbfield']++;
2373 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2378 $totalarray[
'nbfield']++;
2383 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2384 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2386 $totalarray[
'nbfield']++;
2389 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2391 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2394 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2395 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2397 $totalarray[
'nbfield']++;
2400 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2402 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2405 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2406 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2408 $totalarray[
'nbfield']++;
2411 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2413 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2416 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2417 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2419 $totalarray[
'nbfield']++;
2422 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2424 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2427 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2428 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2430 $totalarray[
'nbfield']++;
2433 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2435 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2438 $userstatic->id = $obj->fk_user_author;
2439 $userstatic->login = $obj->login;
2440 $userstatic->lastname = $obj->lastname;
2441 $userstatic->firstname = $obj->firstname;
2442 $userstatic->email = $obj->user_email;
2443 $userstatic->status = $obj->user_statut;
2444 $userstatic->entity = $obj->entity;
2445 $userstatic->photo = $obj->photo;
2446 $userstatic->office_phone = $obj->office_phone;
2447 $userstatic->office_fax = $obj->office_fax;
2448 $userstatic->user_mobile = $obj->user_mobile;
2449 $userstatic->job = $obj->job;
2450 $userstatic->gender = $obj->gender;
2453 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2454 print
'<td class="tdoverflowmax200">';
2455 if ($userstatic->id) {
2456 print $userstatic->getNomUrl(-1);
2462 $totalarray[
'nbfield']++;
2466 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2469 if ($obj->socid > 0) {
2470 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2471 if ($listsalesrepresentatives < 0) {
2474 $nbofsalesrepresentative = count($listsalesrepresentatives);
2475 if ($nbofsalesrepresentative > 6) {
2477 print $nbofsalesrepresentative;
2478 } elseif ($nbofsalesrepresentative > 0) {
2480 foreach ($listsalesrepresentatives as $val) {
2481 $userstatic->id = $val[
'id'];
2482 $userstatic->lastname = $val[
'lastname'];
2483 $userstatic->firstname = $val[
'firstname'];
2484 $userstatic->email = $val[
'email'];
2485 $userstatic->status = $val[
'statut'];
2486 $userstatic->entity = $val[
'entity'];
2487 $userstatic->photo = $val[
'photo'];
2488 $userstatic->login = $val[
'login'];
2489 $userstatic->office_phone = $val[
'office_phone'];
2490 $userstatic->office_fax = $val[
'office_fax'];
2491 $userstatic->user_mobile = $val[
'user_mobile'];
2492 $userstatic->job = $val[
'job'];
2493 $userstatic->gender = $val[
'gender'];
2495 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2497 if ($j < $nbofsalesrepresentative) {
2509 $totalarray[
'nbfield']++;
2513 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2514 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2516 $totalarray[
'nbfield']++;
2520 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2521 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2523 $totalarray[
'nbfield']++;
2526 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2528 $totalarray[
'val'][
'totalam'] += $totalpay;
2532 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2533 print
'<td class="right nowraponall amount">';
2534 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2537 $totalarray[
'nbfield']++;
2540 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2542 $totalarray[
'val'][
'rtp'] += $remaintopay;
2547 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2548 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2550 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2556 $totalarray[
'nbfield']++;
2561 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2562 print
'<td class="nowraponall">';
2563 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2566 $totalarray[
'nbfield']++;
2570 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2571 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2573 $totalarray[
'nbfield']++;
2577 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2578 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2580 $totalarray[
'nbfield']++;
2584 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2585 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2587 $totalarray[
'nbfield']++;
2591 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2592 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2594 $totalarray[
'nbfield']++;
2599 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2600 print
'<td class="right nowraponall">';
2601 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2604 $totalarray[
'nbfield']++;
2609 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2610 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2612 $totalarray[
'nbfield']++;
2613 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2615 if (empty($totalarray[
'val'][
'total_pa'])) {
2616 $totalarray[
'val'][
'total_pa'] = 0;
2618 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2621 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2622 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2624 $totalarray[
'nbfield']++;
2625 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2627 if (empty($totalarray[
'val'][
'total_margin'])) {
2628 $totalarray[
'val'][
'total_margin'] = 0;
2630 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2633 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2634 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2636 $totalarray[
'nbfield']++;
2640 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2641 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2643 $totalarray[
'nbfield']++;
2644 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2646 if ($i >= $imaxinloop - 1) {
2647 if (!empty($total_ht)) {
2648 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2650 $totalarray[
'val'][
'total_mark_rate'] =
'';
2656 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2658 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2659 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2660 print $hookmanager->resPrint;
2662 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2663 print
'<td class="nowraponall center">';
2664 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2667 $totalarray[
'nbfield']++;
2671 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2672 print
'<td class="nowraponall center">';
2673 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2676 $totalarray[
'nbfield']++;
2680 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2681 print
'<td class="nowraponall center">';
2682 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2685 $totalarray[
'nbfield']++;
2689 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2690 print
'<td class="sensiblehtmlcontent center">';
2694 $totalarray[
'nbfield']++;
2698 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2699 print
'<td class="center">';
2703 $totalarray[
'nbfield']++;
2707 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2708 print
'<td class="center">';
2709 if (!empty($obj->fk_fac_rec_source)) {
2711 $result = $facrec->fetch($obj->fk_fac_rec_source);
2715 print $facrec->getNomUrl();
2720 $totalarray[
'nbfield']++;
2724 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2725 print
'<td class="nowrap center">';
2726 print $facturestatic->getLibStatut(5, $paiement);
2729 $totalarray[
'nbfield']++;
2736 print
'<td class="nowrap center">';
2737 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2739 if (in_array($obj->id, $arrayofselected)) {
2742 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2746 $totalarray[
'nbfield']++;
2757 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2758 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2761 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2767 foreach ($arrayfields as $key => $val) {
2768 if (!empty($val[
'checked'])) {
2772 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2777$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2778$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2779print $hookmanager->resPrint;
2781print
'</table>'.
"\n";
2784print
'</form>'.
"\n";
2787if ($contextpage !=
'poslist') {
2788 $hidegeneratedfilelistifempty = 1;
2789 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2790 $hidegeneratedfilelistifempty = 0;
2794 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2795 $urlsource .= str_replace(
'&',
'&', $param);
2797 $filedir = $diroutputmassaction;
2798 $genallowed = $user->hasRight(
"facture",
"lire");
2799 $delallowed = $user->hasRight(
"facture",
"creer");
2802 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.