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';
78$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
80$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
86$action =
GETPOST(
'action',
'aZ09');
87$massaction =
GETPOST(
'massaction',
'alpha');
89$confirm =
GETPOST(
'confirm',
'alpha');
90$toselect =
GETPOST(
'toselect',
'array');
91$optioncss =
GETPOST(
'optioncss',
'alpha');
92$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
95if ($contextpage ==
'poslist') {
101$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
102$search_type =
GETPOST(
'search_type',
'intcomma');
103$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
104$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
105$search_project =
GETPOST(
'search_project',
'alpha');
106$search_company =
GETPOST(
'search_company',
'alpha');
107$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
108$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
109$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
110$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
111$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
112$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
113$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
114$search_login =
GETPOST(
'search_login',
'alpha');
115$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
116$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
117$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
118$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
119$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
120$search_status =
GETPOST(
'search_status',
'intcomma');
121$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
122$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
123$search_module_source =
GETPOST(
'search_module_source',
'alpha');
124$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
125$search_town =
GETPOST(
'search_town',
'alpha');
126$search_zip =
GETPOST(
'search_zip',
'alpha');
127$search_state =
GETPOST(
"search_state");
128$search_country =
GETPOST(
"search_country",
'aZ09');
129$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
130$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
131$search_user =
GETPOST(
'search_user',
'intcomma');
132$search_sale =
GETPOST(
'search_sale',
'intcomma');
133$search_date_startday =
GETPOSTINT(
'search_date_startday');
134$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
135$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
136$search_date_endday =
GETPOSTINT(
'search_date_endday');
137$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
138$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
139$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
140$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
141$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
142$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
143$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
144$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
145$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
146$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
147$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
148$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
149$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
150$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
151$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
152$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
153$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
154$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
155$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
156$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
157$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
158$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
159$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
160$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
162$search_option =
GETPOST(
'search_option');
163if ($search_option ==
'late') {
164 $search_status =
'1';
168$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
169$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
171if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
174$offset = $limit * $page;
175if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
182 $sortfield =
'f.datef';
184$pageprev = $page - 1;
185$pagenext = $page + 1;
187$diroutputmassaction =
$conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
194$hookmanager->initHooks(array($contextpage));
198$extrafields->fetch_name_optionals_label(
$object->table_element);
200$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
203$fieldstosearchall = array(
205 'f.ref_client' =>
'RefCustomer',
206 'f.note_public' =>
'NotePublic',
207 's.nom' =>
"ThirdParty",
208 's.code_client' =>
"CustomerCodeShort",
209 's.name_alias' =>
"AliasNameShort",
212 'pd.description' =>
'Description',
214if (empty($user->socid)) {
215 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
218$checkedtypetiers = 0;
220 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
221 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1,
'position' => 10),
222 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
223 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
224 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 20),
225 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' => 0,
'position' => 22),
226 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 25),
227 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 30),
228 'p.ref' => array(
'label' =>
"ProjectRef",
'langs' =>
'projects',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 40),
229 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 41),
230 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 50),
231 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 51),
232 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' => -1,
'position' => 52),
233 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
234 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 55),
235 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 60),
236 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 65),
237 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 70),
238 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
239 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 80),
240 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 85),
241 'f.module_source' => array(
'label' =>
"POSModule",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 90),
242 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 91),
243 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 95),
244 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 100),
245 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
246 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
247 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 130),
248 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' => 0,
'position' => 140),
249 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' => 0,
'position' => 150),
250 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 280),
251 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 285),
252 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 290),
253 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 291),
254 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 292),
255 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 295),
256 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 296),
257 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
258 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
259 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
260 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
261 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
262 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 502),
263 'u.login' => array(
'label' =>
"UserAuthor",
'checked' => 1,
'visible' => -1,
'position' => 504),
264 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 506),
269 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
270 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
271 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' => 0,
'position' => 530,
'enabled' =>
'1'),
272 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
276 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' => 0,
'position' => 86);
279$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
280if (empty($subtypearray)) {
281 unset($arrayfields[
'f.subtype']);
285foreach (
$object->fields as $key => $val) {
288 if (!empty($val[
'visible'])) {
289 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
291 if (array_key_exists($key, $arrayfields)) {
293 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
295 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
299 $arrayfields[$newkey] = array(
300 'label' => $val[
'label'],
301 'checked' => (($visible < 0) ? 0 : 1),
302 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
303 'position' => $val[
'position'],
304 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
310include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
315'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
317if (!$user->hasRight(
'societe',
'client',
'voir')) {
318 $search_sale = $user->id;
322$fieldid = (!empty($ref) ?
'ref' :
'rowid');
323if (!empty($user->socid)) {
324 $socid = $user->socid;
333if (
GETPOST(
'cancel',
'alpha')) {
337if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
341$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
342$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
347include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
350if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
353 $search_product_category =
'';
355 $search_refcustomer =
'';
357 $search_subtype =
'';
358 $search_project_ref =
'';
359 $search_project =
'';
360 $search_company =
'';
361 $search_company_alias =
'';
362 $search_parent_name =
'';
363 $search_montant_ht =
'';
364 $search_montant_vat =
'';
365 $search_montant_localtax1 =
'';
366 $search_montant_localtax2 =
'';
367 $search_montant_ttc =
'';
369 $search_multicurrency_code =
'';
370 $search_multicurrency_tx =
'';
371 $search_multicurrency_montant_ht =
'';
372 $search_multicurrency_montant_vat =
'';
373 $search_multicurrency_montant_ttc =
'';
375 $search_paymentmode =
'';
376 $search_paymentterms =
'';
377 $search_module_source =
'';
378 $search_pos_source =
'';
382 $search_country =
'';
383 $search_type_thirdparty =
'';
384 $search_customer_code =
'';
385 $search_date_startday =
'';
386 $search_date_startmonth =
'';
387 $search_date_startyear =
'';
388 $search_date_endday =
'';
389 $search_date_endmonth =
'';
390 $search_date_endyear =
'';
391 $search_date_start =
'';
392 $search_date_end =
'';
393 $search_date_valid_startday =
'';
394 $search_date_valid_startmonth =
'';
395 $search_date_valid_startyear =
'';
396 $search_date_valid_endday =
'';
397 $search_date_valid_endmonth =
'';
398 $search_date_valid_endyear =
'';
399 $search_date_valid_start =
'';
400 $search_date_valid_end =
'';
401 $search_datelimit_startday =
'';
402 $search_datelimit_startmonth =
'';
403 $search_datelimit_startyear =
'';
404 $search_datelimit_endday =
'';
405 $search_datelimit_endmonth =
'';
406 $search_datelimit_endyear =
'';
407 $search_datelimit_start =
'';
408 $search_datelimit_end =
'';
409 $search_fac_rec_source_title =
'';
411 $search_categ_cus = 0;
413 $search_array_options = array();
416if (empty($reshook)) {
417 $objectclass =
'Facture';
418 $objectlabel =
'Invoices';
419 $permissiontoread = $user->hasRight(
"facture",
"lire");
420 $permissiontoadd = $user->hasRight(
"facture",
"creer");
421 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
422 $uploaddir =
$conf->facture->dir_output;
423 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
426if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
427 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
428 $arrayofselected = is_array($toselect) ? $toselect : array();
429 if (!empty($arrayofselected)) {
433 if (empty($paiementdate)) {
434 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
436 $action =
'makepayment';
440 foreach ($arrayofselected as $toselectid) {
443 $result = $facture->fetch($toselectid);
452 $paiementAmount = $facture->getSommePaiement();
453 $totalcreditnotes = $facture->getSumCreditNotesUsed();
454 $totaldeposits = $facture->getSumDepositsUsed();
456 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
457 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
460 $parameters = array(
'remaintopay' => $remaintopay);
461 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
463 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
464 $remaintopay = $remain;
466 } elseif ($reshook < 0) {
468 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
471 if ($remaintopay != 0) {
472 $resultBank = $facture->setBankAccount($bankid);
473 if ($resultBank < 0) {
478 $paiement->datepaye = $paiementdate;
479 $paiement->amounts[$facture->id] = $remaintopay;
480 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
481 $paiement->paiementid = $paiementid;
482 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
483 if ($paiement_id < 0) {
484 $langs->load(
"errors");
485 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
488 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
490 $langs->load(
"errors");
491 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
497 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
501 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
506 if (empty($errorpayment)) {
507 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
515} elseif ($massaction ==
'withdrawrequest') {
516 $langs->load(
"withdrawals");
518 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
525 $arrayofselected = is_array($toselect) ? $toselect : array();
526 $listofbills = array();
527 foreach ($arrayofselected as $toselectid) {
529 $result = $objecttmp->fetch($toselectid);
531 $totalpaid = $objecttmp->getSommePaiement();
532 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
533 $totaldeposits = $objecttmp->getSumDepositsUsed();
534 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
537 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
538 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
540 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
541 $objecttmp->resteapayer = $remaintopay;
543 } elseif ($reshook < 0) {
545 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
550 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
551 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
553 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
554 } elseif ($objecttmp->resteapayer < 0) {
556 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
559 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
560 $rsql .=
" , pfd.date_traite as date_traite";
561 $rsql .=
" , pfd.amount";
562 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
563 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
564 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
565 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
566 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
567 $rsql .=
" AND pfd.traite = 0";
568 $rsql .=
" ORDER BY pfd.date_demande DESC";
570 $result_sql = $db->query($rsql);
572 $numprlv = $db->num_rows($result_sql);
579 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
580 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
581 $langs->load(
"errors");
583 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
585 $listofbills[] = $objecttmp;
591 if (!empty($listofbills)) {
592 $nbwithdrawrequestok = 0;
593 foreach ($listofbills as $aBill) {
595 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
598 $nbwithdrawrequestok++;
604 if ($nbwithdrawrequestok > 0) {
605 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
617$form =
new Form($db);
621if (isModEnabled(
'margin')) {
624$bankaccountstatic =
new Account($db);
625$facturestatic =
new Facture($db);
627$companystatic =
new Societe($db);
628$companyparent =
new Societe($db);
630$company_url_list = array();
635 if (empty($search_company)) {
636 $search_company = $soc->name;
642$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
643$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
645$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
646$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
652 $sql =
'SELECT DISTINCT';
654$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,';
655$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
656$sql .=
' f.fk_user_author,';
657$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,';
658$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
659$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
660$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
661$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
662$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,';
663$sql .=
" s.parent as fk_parent,";
664$sql .=
" s2.nom as name2,";
665$sql .=
' typent.code as typent_code,';
666$sql .=
' state.code_departement as state_code, state.nom as state_name,';
667$sql .=
' country.code as country_code,';
668$sql .=
' f.fk_fac_rec_source,';
669$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
670$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';
680if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
681 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
682 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
686$parameters = array();
687$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
688$sql .= $hookmanager->resPrint;
689$sql = preg_replace(
'/,\s*$/',
'', $sql);
693$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
694$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
695$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
696$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
697$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
698$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
699if ($sortfield ==
"f.datef") {
700 $sql .= $db->hintindex(
'idx_facture_datef');
702if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
703 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
706 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
708if (!empty($search_fac_rec_source_title)) {
709 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
711$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
712$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
714$parameters = array();
715$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
716$sql .= $hookmanager->resPrint;
718$sql .=
' WHERE f.fk_soc = s.rowid';
719$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
721 $sql .=
' AND s.rowid = '.((int) $socid);
725 $sql .=
' AND f.fk_user_author IS NULL';
727 $sql .=
' AND f.fk_user_author = '.((int) $userid);
733if ($search_refcustomer) {
736if ($search_type !=
'' && $search_type !=
'-1') {
737 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
739if ($search_subtype !=
'' && $search_subtype !=
'-1') {
740 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
742if ($search_project_ref) {
745if ($search_project) {
748if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
749 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
751 if ($search_company) {
754 if ($search_company_alias) {
758if ($search_parent_name) {
761if ($search_customer_code) {
773if (strlen(trim($search_country))) {
775 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
776 foreach ($arrayofcode as $key => $value) {
777 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
778 if ($value != $mysoc->country_code) {
779 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
782 if ($search_country ==
'special_allnotme') {
783 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
784 } elseif ($search_country ==
'special_eec') {
785 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
786 } elseif ($search_country ==
'special_eecnotme') {
787 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
788 } elseif ($search_country ==
'special_noteec') {
789 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
794if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
795 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
797if ($search_montant_ht !=
'') {
800if ($search_montant_vat !=
'') {
803if ($search_montant_localtax1 !=
'') {
804 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
806if ($search_montant_localtax2 !=
'') {
807 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
809if ($search_montant_ttc !=
'') {
812if ($search_multicurrency_code !=
'') {
813 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
815if ($search_multicurrency_tx !=
'') {
816 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
818if ($search_multicurrency_montant_ht !=
'') {
819 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
821if ($search_multicurrency_montant_vat !=
'') {
822 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
824if ($search_multicurrency_montant_ttc !=
'') {
825 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
828 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
830if ($search_status !=
'-1' && $search_status !=
'') {
831 if (is_numeric($search_status) && $search_status >= 0) {
832 if ($search_status ==
'0') {
833 $sql .=
" AND f.fk_statut = 0";
835 if ($search_status ==
'1') {
836 $sql .=
" AND f.fk_statut = 1";
838 if ($search_status ==
'2') {
839 $sql .=
" AND f.fk_statut = 2";
841 if ($search_status ==
'3') {
842 $sql .=
" AND f.fk_statut = 3";
845 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
849if ($search_paymentmode > 0) {
850 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
852if ($search_paymentterms > 0) {
853 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
855if ($search_module_source) {
858if ($search_pos_source) {
861if ($search_date_start) {
862 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
864if ($search_date_end) {
865 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
867if ($search_date_valid_start) {
868 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
870if ($search_date_valid_end) {
871 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
873if ($search_datelimit_start) {
874 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
876if ($search_datelimit_end) {
877 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
879if ($search_option ==
'late') {
880 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->facture->client->warning_delay).
"'";
885if (!empty($search_fac_rec_source_title)) {
886 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
888if ($search_fk_fac_rec_source) {
889 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
892if ($search_user > 0) {
893 $sql .=
" AND EXISTS (";
894 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
895 $sql .=
" FROM llx_element_contact as ec";
896 $sql .=
" INNER JOIN llx_c_type_contact as tc";
897 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
898 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
901if ($search_sale && $search_sale !=
'-1') {
902 if ($search_sale == -2) {
903 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
904 } elseif ($search_sale > 0) {
905 $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).
")";
909$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
910$searchCategoryProductOperator = 0;
911if (!empty($searchCategoryProductList)) {
912 $searchCategoryProductSqlList = array();
913 $listofcategoryid =
'';
914 foreach ($searchCategoryProductList as $searchCategoryProduct) {
915 if (intval($searchCategoryProduct) == -2) {
916 $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)";
917 } elseif (intval($searchCategoryProduct) > 0) {
918 if ($searchCategoryProductOperator == 0) {
919 $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).
")";
921 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
925 if ($listofcategoryid) {
926 $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).
"))";
928 if ($searchCategoryProductOperator == 1) {
929 if (!empty($searchCategoryProductSqlList)) {
930 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
933 if (!empty($searchCategoryProductSqlList)) {
934 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
938$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
939$searchCategoryCustomerOperator = 0;
941if (!empty($searchCategoryCustomerList)) {
942 $searchCategoryCustomerSqlList = array();
943 $listofcategoryid =
'';
944 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
945 if (intval($searchCategoryCustomer) == -2) {
946 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
947 } elseif (intval($searchCategoryCustomer) > 0) {
948 if ($searchCategoryCustomerOperator == 0) {
949 $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).
")";
951 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
955 if ($listofcategoryid) {
956 $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).
"))";
958 if ($searchCategoryCustomerOperator == 1) {
959 if (!empty($searchCategoryCustomerSqlList)) {
960 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
963 if (!empty($searchCategoryCustomerSqlList)) {
964 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
969include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
971$parameters = array();
972$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
973$sql .= $hookmanager->resPrint;
976 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
980$parameters = array();
981$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
982$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
985$nbtotalofrecords =
'';
988 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
989 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
991 $resql = $db->query($sqlforcount);
993 $objforcount = $db->fetch_object($resql);
994 $nbtotalofrecords = $objforcount->nbtotalofrecords;
999 if (($page * $limit) > $nbtotalofrecords) {
1007$sql .= $db->order($sortfield, $sortorder);
1009 $sql .= $db->plimit($limit + 1, $offset);
1012$resql = $db->query($sql);
1018$num = $db->num_rows($resql);
1020$arrayofselected = is_array($toselect) ? $toselect : array();
1022if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1023 $obj = $db->fetch_object($resql);
1026 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1033llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
1035if ($search_fk_fac_rec_source) {
1037 $object->fetch((
int) $search_fk_fac_rec_source);
1041 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1045$param =
'&socid='.urlencode((
string) ($socid));
1047 $param .=
'&mode='.urlencode($mode);
1049if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1050 $param .=
'&contextpage='.urlencode($contextpage);
1052if ($limit > 0 && $limit !=
$conf->liste_limit) {
1053 $param .=
'&limit='.((int) $limit);
1056 $param .=
'&search_all='.urlencode($search_all);
1058if ($search_date_startday) {
1059 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1061if ($search_date_startmonth) {
1062 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1064if ($search_date_startyear) {
1065 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1067if ($search_date_endday) {
1068 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1070if ($search_date_endmonth) {
1071 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1073if ($search_date_endyear) {
1074 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1076if ($search_date_valid_startday) {
1077 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1079if ($search_date_valid_startmonth) {
1080 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1082if ($search_date_valid_startyear) {
1083 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1085if ($search_date_valid_endday) {
1086 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1088if ($search_date_valid_endmonth) {
1089 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1091if ($search_date_valid_endyear) {
1092 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1094if ($search_datelimit_startday) {
1095 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1097if ($search_datelimit_startmonth) {
1098 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1100if ($search_datelimit_startyear) {
1101 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1103if ($search_datelimit_endday) {
1104 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1106if ($search_datelimit_endmonth) {
1107 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1109if ($search_datelimit_endyear) {
1110 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1113 $param .=
'&search_ref='.urlencode($search_ref);
1115if ($search_refcustomer) {
1116 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1118if ($search_project_ref) {
1119 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1121if ($search_project) {
1122 $param .=
'&search_project='.urlencode($search_project);
1124if ($search_type !=
'') {
1125 $param .=
'&search_type='.urlencode($search_type);
1127if ($search_subtype !=
'') {
1128 $param .=
'&search_subtype='.urlencode($search_subtype);
1130if ($search_company) {
1131 $param .=
'&search_company='.urlencode($search_company);
1133if ($search_company_alias) {
1134 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1136if ($search_parent_name !=
'') {
1137 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1140 $param .=
'&search_town='.urlencode($search_town);
1143 $param .=
'&search_zip='.urlencode($search_zip);
1145if ($search_country) {
1146 $param .=
"&search_country=".urlencode($search_country);
1148if ($search_type_thirdparty !=
'') {
1149 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1151if ($search_customer_code) {
1152 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1154if ($search_sale > 0) {
1155 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1157if ($search_user > 0) {
1158 $param .=
'&search_user='.urlencode((
string) $search_user);
1161 $param .=
'&search_login='.urlencode($search_login);
1163if ($search_product_category > 0) {
1164 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1166if ($search_montant_ht !=
'') {
1167 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1169if ($search_montant_vat !=
'') {
1170 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1172if ($search_montant_localtax1 !=
'') {
1173 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1175if ($search_montant_localtax2 !=
'') {
1176 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1178if ($search_montant_ttc !=
'') {
1179 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1181if ($search_multicurrency_code !=
'') {
1182 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1184if ($search_multicurrency_tx !=
'') {
1185 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1187if ($search_multicurrency_montant_ht !=
'') {
1188 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1190if ($search_multicurrency_montant_vat !=
'') {
1191 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1193if ($search_multicurrency_montant_ttc !=
'') {
1194 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1196if ($search_status !=
'') {
1197 $param .=
'&search_status='.urlencode($search_status);
1199if ($search_paymentmode > 0) {
1200 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1202if ($search_paymentterms > 0) {
1203 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1205if ($search_module_source) {
1206 $param .=
'&search_module_source='.urlencode($search_module_source);
1208if ($search_pos_source) {
1209 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1212 $param .=
'&show_files='.urlencode((
string) ($show_files));
1214if ($search_option) {
1215 $param .=
"&search_option=".urlencode($search_option);
1217if ($optioncss !=
'') {
1218 $param .=
'&optioncss='.urlencode($optioncss);
1220if ($search_categ_cus > 0) {
1221 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1223if (!empty($search_fac_rec_source_title)) {
1224 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1226if ($search_fk_fac_rec_source) {
1227 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1231include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1233$parameters = array(
'param' => &$param);
1234$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1235$param .= $hookmanager->resPrint;
1237$arrayofmassactions = array(
1238 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1239 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1240 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1241 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1244if ($user->hasRight(
'facture',
'paiement')) {
1245 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1247if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1248 $langs->load(
"withdrawals");
1249 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1251if ($user->hasRight(
'facture',
'supprimer')) {
1253 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1255 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1258if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1259 $arrayofmassactions = array();
1261$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1265if ($contextpage !=
'poslist') {
1266 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1268 $url .=
'&socid='.urlencode((
string)
$object->socid);
1271 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1273 $newcardbutton =
'';
1274 $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'));
1275 $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'));
1277 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1281print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1282if ($optioncss !=
'') {
1283 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1285print
'<input type="hidden" name="token" value="'.newToken().
'">';
1286print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1287if (!in_array($massaction, array(
'makepayment'))) {
1288 print
'<input type="hidden" name="action" value="list">';
1290print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1291print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1292print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1293print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1294print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1295print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1297print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1299$topicmail =
"SendBillRef";
1300$modelmail =
"facture_send";
1302$trackid =
'inv'.$object->id;
1303include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1305if ($massaction ==
'makepayment') {
1307 $formquestion = array(
1311 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1312 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1313 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1316 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1321 foreach ($fieldstosearchall as $key => $val) {
1322 $fieldstosearchall[$key] = $langs->trans($val);
1324 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1329if ($user->hasRight(
"user",
"user",
"lire")) {
1330 $langs->load(
"commercial");
1331 $moreforfilter .=
'<div class="divsearchfield">';
1332 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1333 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1334 $moreforfilter .=
'</div>';
1337if ($user->hasRight(
"user",
"user",
"lire")) {
1338 $moreforfilter .=
'<div class="divsearchfield">';
1339 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1340 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1341 $moreforfilter .=
'</div>';
1344if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1345 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1346 $moreforfilter .=
'<div class="divsearchfield">';
1347 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1348 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1349 $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);
1350 $moreforfilter .=
'</div>';
1352if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1353 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1354 $moreforfilter .=
'<div class="divsearchfield">';
1355 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1356 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1357 $moreforfilter .=
'</div>';
1360$moreforfilter .=
'<div class="divsearchfield">';
1361$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1362$moreforfilter .=
'</div>';
1364$parameters = array();
1365$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1366if (empty($reshook)) {
1367 $moreforfilter .= $hookmanager->resPrint;
1369 $moreforfilter = $hookmanager->resPrint;
1372if (!empty($moreforfilter)) {
1373 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1374 print $moreforfilter;
1378$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1379$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1382if ($massactionbutton && $contextpage !=
'poslist') {
1383 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1386print
'<div class="div-table-responsive">';
1387print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1391print
'<tr class="liste_titre_filter">';
1395 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1396 $searchpicto = $form->showFilterButtons(
'left');
1402 print
'<td class="liste_titre">';
1406if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1407 print
'<td class="liste_titre" align="left">';
1408 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1412if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1413 print
'<td class="liste_titre">';
1414 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1418if (!empty($arrayfields[
'f.type'][
'checked'])) {
1419 print
'<td class="liste_titre maxwidthonsmartphone">';
1431 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1435if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1436 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1437 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1441if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1442 print
'<td class="liste_titre center">';
1443 print
'<div class="nowrapfordate">';
1444 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1446 print
'<div class="nowrapfordate">';
1447 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1452if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1453 print
'<td class="liste_titre center">';
1454 print
'<div class="nowrapfordate">';
1455 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'));
1457 print
'<div class="nowrapfordate">';
1458 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'));
1463if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1464 print
'<td class="liste_titre center">';
1465 print
'<div class="nowrapfordate">';
1466 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1468 print
'<div class="nowrapfordate">';
1469 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1474if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1475 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1478if (!empty($arrayfields[
'p.title'][
'checked'])) {
1479 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1482if (!empty($arrayfields[
's.nom'][
'checked'])) {
1483 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1486if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1487 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1490if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1491 print
'<td class="liste_titre">';
1492 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1496if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1497 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1500if (!empty($arrayfields[
's.town'][
'checked'])) {
1501 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1504if (!empty($arrayfields[
's.zip'][
'checked'])) {
1505 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1508if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1509 print
'<td class="liste_titre">';
1510 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1514if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1515 print
'<td class="liste_titre center">';
1516 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1520if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1521 print
'<td class="liste_titre maxwidthonsmartphone center">';
1522 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);
1526if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1527 print
'<td class="liste_titre">';
1528 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1532if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1533 print
'<td class="liste_titre left">';
1534 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1538if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1539 print
'<td class="liste_titre">';
1540 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1544if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1545 print
'<td class="liste_titre">';
1546 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1549if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1551 print
'<td class="liste_titre right">';
1552 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1555if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1557 print
'<td class="liste_titre right">';
1558 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1561if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1563 print
'<td class="liste_titre right">';
1564 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1567if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1569 print
'<td class="liste_titre right">';
1570 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1573if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1575 print
'<td class="liste_titre right">';
1576 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1579if (!empty($arrayfields[
'u.login'][
'checked'])) {
1581 print
'<td class="liste_titre" align="center">';
1582 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1585if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1586 print
'<td class="liste_titre"></td>';
1588if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1589 print
'<td class="liste_titre" align="right">';
1592if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1593 print
'<td class="liste_titre right">';
1596if (!empty($arrayfields[
'rtp'][
'checked'])) {
1597 print
'<td class="liste_titre">';
1600if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1602 print
'<td class="liste_titre">';
1603 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1606if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1608 print
'<td class="liste_titre">';
1609 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1612if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1614 print
'<td class="liste_titre right">';
1615 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1618if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1620 print
'<td class="liste_titre right">';
1621 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1624if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1626 print
'<td class="liste_titre right">';
1627 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1630if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1631 print
'<td class="liste_titre">';
1634if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1635 print
'<td class="liste_titre right">';
1638if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1639 print
'<td class="liste_titre right">';
1642if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1643 print
'<td class="liste_titre right">';
1646if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1647 print
'<td class="liste_titre right">';
1650if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1651 print
'<td class="liste_titre right">';
1656include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1659$parameters = array(
'arrayfields' => $arrayfields);
1660$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1661print $hookmanager->resPrint;
1663if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1664 print
'<td class="liste_titre">';
1668if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1669 print
'<td class="liste_titre">';
1673if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1674 print
'<td class="liste_titre">';
1677if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1679 print
'<td class="liste_titre">';
1682if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1684 print
'<td class="liste_titre">';
1687if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1689 print
'<td class="liste_titre maxwidthonsmartphone right">';
1690 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).
'">';
1694if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1695 print
'<td class="liste_titre center parentonrightofpage">';
1696 $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"));
1698 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1703 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1704 $searchpicto = $form->showFilterButtons();
1710$totalarray = array();
1711$totalarray[
'nbfield'] = 0;
1715print
'<tr class="liste_titre">';
1717 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1718 $totalarray[
'nbfield']++;
1722 $totalarray[
'nbfield']++;
1724if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1726 $totalarray[
'nbfield']++;
1728if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1730 $totalarray[
'nbfield']++;
1732if (!empty($arrayfields[
'f.type'][
'checked'])) {
1733 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1734 $totalarray[
'nbfield']++;
1736if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1739if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1752 $langs->load(
"projects");
1753 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1754 $totalarray[
'nbfield']++;
1756if (!empty($arrayfields[
'p.title'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1758 $totalarray[
'nbfield']++;
1760if (!empty($arrayfields[
's.nom'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1762 $totalarray[
'nbfield']++;
1764if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1766 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1767 $totalarray[
'nbfield']++;
1769if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1770 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1771 $totalarray[
'nbfield']++;
1773if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1774 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1775 $totalarray[
'nbfield']++;
1777if (!empty($arrayfields[
's.town'][
'checked'])) {
1778 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1779 $totalarray[
'nbfield']++;
1781if (!empty($arrayfields[
's.zip'][
'checked'])) {
1782 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1783 $totalarray[
'nbfield']++;
1785if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1786 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1787 $totalarray[
'nbfield']++;
1789if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1790 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1791 $totalarray[
'nbfield']++;
1793if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1794 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1795 $totalarray[
'nbfield']++;
1797if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1798 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1799 $totalarray[
'nbfield']++;
1801if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1802 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1803 $totalarray[
'nbfield']++;
1805if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1806 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1807 $totalarray[
'nbfield']++;
1809if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1810 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1811 $totalarray[
'nbfield']++;
1813if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1814 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1815 $totalarray[
'nbfield']++;
1817if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1818 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1819 $totalarray[
'nbfield']++;
1821if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1822 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1823 $totalarray[
'nbfield']++;
1825if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1826 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1827 $totalarray[
'nbfield']++;
1829if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1830 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1831 $totalarray[
'nbfield']++;
1833if (!empty($arrayfields[
'u.login'][
'checked'])) {
1834 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1835 $totalarray[
'nbfield']++;
1837if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1838 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1839 $totalarray[
'nbfield']++;
1841if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1842 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1843 $totalarray[
'nbfield']++;
1845if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1846 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1847 $totalarray[
'nbfield']++;
1849if (!empty($arrayfields[
'rtp'][
'checked'])) {
1850 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1851 $totalarray[
'nbfield']++;
1853if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1854 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1855 $totalarray[
'nbfield']++;
1857if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1858 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1859 $totalarray[
'nbfield']++;
1861if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1862 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1863 $totalarray[
'nbfield']++;
1865if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1866 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1867 $totalarray[
'nbfield']++;
1869if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1870 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1871 $totalarray[
'nbfield']++;
1873if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1874 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1875 $totalarray[
'nbfield']++;
1877if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1878 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1879 $totalarray[
'nbfield']++;
1881if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1882 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1883 $totalarray[
'nbfield']++;
1885if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1886 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1887 $totalarray[
'nbfield']++;
1889if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1890 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1891 $totalarray[
'nbfield']++;
1893if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1894 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1895 $totalarray[
'nbfield']++;
1898include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1900$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1901$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1902print $hookmanager->resPrint;
1903if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1904 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1905 $totalarray[
'nbfield']++;
1907if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1908 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1909 $totalarray[
'nbfield']++;
1911if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1912 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1913 $totalarray[
'nbfield']++;
1915if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1916 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1917 $totalarray[
'nbfield']++;
1919if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1920 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1921 $totalarray[
'nbfield']++;
1923if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1924 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1925 $totalarray[
'nbfield']++;
1927if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1929 $totalarray[
'nbfield']++;
1932 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1933 $totalarray[
'nbfield']++;
1938$projectstatic =
new Project($db);
1940$userstatic =
new User($db);
1946 $savnbfield = $totalarray[
'nbfield'];
1947 $totalarray = array();
1948 $totalarray[
'nbfield'] = 0;
1949 $totalarray[
'val'] = array();
1950 $totalarray[
'val'][
'f.total_ht'] = 0;
1951 $totalarray[
'val'][
'f.total_tva'] = 0;
1952 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1953 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1954 $totalarray[
'val'][
'f.total_ttc'] = 0;
1955 $totalarray[
'val'][
'dynamount_payed'] = 0;
1956 $totalarray[
'val'][
'rtp'] = 0;
1958 $typenArray = $formcompany->typent_array(1);
1960 $with_margin_info =
false;
1961 if (isModEnabled(
'margin') && (
1962 !empty($arrayfields[
'total_pa'][
'checked'])
1963 || !empty($arrayfields[
'total_margin'][
'checked'])
1964 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1965 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1968 $with_margin_info =
true;
1973 $imaxinloop = ($limit ? min($num, $limit) : $num);
1974 while ($i < $imaxinloop) {
1975 $obj = $db->fetch_object($resql);
1977 $datelimit = $db->jdate($obj->datelimite);
1979 $facturestatic->id = $obj->id;
1980 $facturestatic->ref = $obj->ref;
1981 $facturestatic->ref_client = $obj->ref_client;
1982 $facturestatic->ref_customer = $obj->ref_client;
1983 $facturestatic->type = $obj->type;
1984 $facturestatic->subtype = $obj->subtype;
1985 $facturestatic->total_ht = $obj->total_ht;
1986 $facturestatic->total_tva = $obj->total_tva;
1987 $facturestatic->total_ttc = $obj->total_ttc;
1988 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1989 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1990 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1991 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1992 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1993 $facturestatic->statut = $obj->fk_statut;
1994 $facturestatic->status = $obj->fk_statut;
1995 $facturestatic->close_code = $obj->close_code;
1996 $facturestatic->total_ttc = $obj->total_ttc;
1997 $facturestatic->paye = $obj->paye;
1998 $facturestatic->socid = $obj->fk_soc;
2000 $facturestatic->date = $db->jdate($obj->datef);
2001 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2002 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2004 $facturestatic->note_public = $obj->note_public;
2005 $facturestatic->note_private = $obj->note_private;
2008 $facturestatic->retained_warranty = $obj->retained_warranty;
2009 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2010 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2011 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2012 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2013 $facturestatic->situation_counter = $obj->situation_counter;
2016 $companystatic->id = $obj->socid;
2017 $companystatic->name = $obj->name;
2018 $companystatic->name_alias = $obj->alias;
2019 $companystatic->client = $obj->client;
2020 $companystatic->fournisseur = $obj->fournisseur;
2021 $companystatic->code_client = $obj->code_client;
2022 $companystatic->code_compta_client = $obj->code_compta_client;
2023 $companystatic->code_fournisseur = $obj->code_fournisseur;
2024 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2025 $companystatic->email = $obj->email;
2026 $companystatic->phone = $obj->phone;
2027 $companystatic->fax = $obj->fax;
2028 $companystatic->address = $obj->address;
2029 $companystatic->zip = $obj->zip;
2030 $companystatic->town = $obj->town;
2031 $companystatic->country_code = $obj->country_code;
2033 $projectstatic->id = $obj->project_id;
2034 $projectstatic->ref = $obj->project_ref;
2035 $projectstatic->title = $obj->project_label;
2037 $paiement = $facturestatic->getSommePaiement();
2038 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2039 $totaldeposits = $facturestatic->getSumDepositsUsed();
2040 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2041 $remaintopay = $obj->total_ttc - $totalallpayments;
2043 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2044 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2045 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2047 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2048 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2050 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2051 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2055 $multicurrency_remaintopay = 0;
2058 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2059 $remaintopay = -$remaincreditnote;
2060 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2061 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2062 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2063 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2066 $facturestatic->alreadypaid = $paiement;
2067 $facturestatic->totalpaid = $paiement;
2068 $facturestatic->totalcreditnotes = $totalcreditnotes;
2069 $facturestatic->totaldeposits = $totaldeposits;
2071 $marginInfo = array();
2072 if ($with_margin_info) {
2073 $facturestatic->fetch_lines();
2074 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2075 $total_ht += $obj->total_ht;
2076 $total_margin += $marginInfo[
'total_margin'];
2081 if ($mode ==
'kanban') {
2083 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2084 print
'<div class="box-flex-container kanban">';
2087 if ($massactionbutton || $massaction) {
2089 if (in_array(
$object->id, $arrayofselected)) {
2094 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2095 print $facturestatic->getKanbanView(
'', $arraydata);
2096 if ($i == ($imaxinloop - 1)) {
2103 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2104 if ($contextpage ==
'poslist') {
2105 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2106 if (strpos($obj->ref, 'PROV
') !== false) {
2107 //If is a draft invoice, load var to be able to add products
2108 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2109 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2117 print
'<td class="nowrap center">';
2118 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2120 if (in_array($obj->id, $arrayofselected)) {
2123 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2127 $totalarray[
'nbfield']++;
2133 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2135 $totalarray[
'nbfield']++;
2140 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2141 print
'<td class="nowraponall">';
2143 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2145 print
'<td class="nobordernopadding nowraponall">';
2146 if ($contextpage ==
'poslist') {
2149 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2153 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2154 $filedir = $filepath.
'/'.$filename;
2156 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2157 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2164 $totalarray[
'nbfield']++;
2169 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2170 print
'<td class="nowrap tdoverflowmax200">';
2174 $totalarray[
'nbfield']++;
2179 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2180 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2181 print $facturestatic->getLibType(2);
2184 $totalarray[
'nbfield']++;
2189 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2191 if ($facturestatic->subtype > 0) {
2192 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2194 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2198 $totalarray[
'nbfield']++;
2203 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2204 print
'<td align="center" class="nowraponall">';
2208 $totalarray[
'nbfield']++;
2213 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2214 print
'<td align="center" class="nowraponall">';
2218 $totalarray[
'nbfield']++;
2223 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2224 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2225 if ($facturestatic->hasDelay()) {
2226 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2230 $totalarray[
'nbfield']++;
2235 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2236 print
'<td class="nocellnopadd nowraponall">';
2237 if ($obj->project_id > 0) {
2238 print $projectstatic->getNomUrl(1);
2242 $totalarray[
'nbfield']++;
2247 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2248 print
'<td class="nowraponall">';
2249 if ($obj->project_id > 0) {
2254 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2260 print
'<td class="tdoverflowmax150">';
2261 if ($contextpage ==
'poslist') {
2264 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2268 $totalarray[
'nbfield']++;
2272 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2273 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2277 $totalarray[
'nbfield']++;
2281 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2282 print
'<td class="tdoverflowmax200">';
2283 if ($obj->fk_parent > 0) {
2284 if (!isset($company_url_list[$obj->fk_parent])) {
2285 $companyparent =
new Societe($db);
2286 $res = $companyparent->fetch($obj->fk_parent);
2288 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2291 if (isset($company_url_list[$obj->fk_parent])) {
2292 print $company_url_list[$obj->fk_parent];
2297 $totalarray[
'nbfield']++;
2301 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2302 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2306 $totalarray[
'nbfield']++;
2310 if (!empty($arrayfields[
's.town'][
'checked'])) {
2311 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2315 $totalarray[
'nbfield']++;
2319 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2320 print
'<td class="nowraponall">';
2324 $totalarray[
'nbfield']++;
2328 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2329 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2331 $totalarray[
'nbfield']++;
2335 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2336 $tmparray =
getCountry($obj->fk_pays,
'all');
2337 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2341 $totalarray[
'nbfield']++;
2345 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2346 print
'<td class="center">';
2347 if (!is_array($typenArray) || count($typenArray) == 0) {
2348 $typenArray = $formcompany->typent_array(1);
2350 if (!empty($obj->typent_code)) {
2351 print $typenArray[$obj->typent_code];
2355 $totalarray[
'nbfield']++;
2359 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2360 print
'<td class="center">';
2361 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2362 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2364 print
$conf->cache[
'staff'][$obj->staff_code];
2367 $totalarray[
'nbfield']++;
2372 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2373 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2374 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2378 $totalarray[
'nbfield']++;
2383 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2384 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2385 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2389 $totalarray[
'nbfield']++;
2394 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2399 $totalarray[
'nbfield']++;
2404 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2409 $totalarray[
'nbfield']++;
2414 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2415 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2417 $totalarray[
'nbfield']++;
2420 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2422 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2425 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2426 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2428 $totalarray[
'nbfield']++;
2431 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2433 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2436 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2437 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2439 $totalarray[
'nbfield']++;
2442 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2444 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2447 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2448 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2450 $totalarray[
'nbfield']++;
2453 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2455 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2458 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2459 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2461 $totalarray[
'nbfield']++;
2464 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2466 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2469 $userstatic->id = $obj->fk_user_author;
2470 $userstatic->login = $obj->login;
2471 $userstatic->lastname = $obj->lastname;
2472 $userstatic->firstname = $obj->firstname;
2473 $userstatic->email = $obj->user_email;
2474 $userstatic->status = $obj->user_statut;
2475 $userstatic->entity = $obj->entity;
2476 $userstatic->photo = $obj->photo;
2477 $userstatic->office_phone = $obj->office_phone;
2478 $userstatic->office_fax = $obj->office_fax;
2479 $userstatic->user_mobile = $obj->user_mobile;
2480 $userstatic->job = $obj->job;
2481 $userstatic->gender = $obj->gender;
2484 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2485 print
'<td class="tdoverflowmax200">';
2486 if ($userstatic->id) {
2487 print $userstatic->getNomUrl(-1);
2493 $totalarray[
'nbfield']++;
2497 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2500 if ($obj->socid > 0) {
2501 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2502 if ($listsalesrepresentatives < 0) {
2505 $nbofsalesrepresentative = count($listsalesrepresentatives);
2506 if ($nbofsalesrepresentative > 6) {
2508 print $nbofsalesrepresentative;
2509 } elseif ($nbofsalesrepresentative > 0) {
2511 foreach ($listsalesrepresentatives as $val) {
2512 $userstatic->id = $val[
'id'];
2513 $userstatic->lastname = $val[
'lastname'];
2514 $userstatic->firstname = $val[
'firstname'];
2515 $userstatic->email = $val[
'email'];
2516 $userstatic->status = $val[
'statut'];
2517 $userstatic->entity = $val[
'entity'];
2518 $userstatic->photo = $val[
'photo'];
2519 $userstatic->login = $val[
'login'];
2520 $userstatic->office_phone = $val[
'office_phone'];
2521 $userstatic->office_fax = $val[
'office_fax'];
2522 $userstatic->user_mobile = $val[
'user_mobile'];
2523 $userstatic->job = $val[
'job'];
2524 $userstatic->gender = $val[
'gender'];
2526 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2528 if ($j < $nbofsalesrepresentative) {
2540 $totalarray[
'nbfield']++;
2544 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2545 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2547 $totalarray[
'nbfield']++;
2551 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2552 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2554 $totalarray[
'nbfield']++;
2557 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'dynamount_payed';
2559 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2563 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2564 print
'<td class="right nowraponall amount">';
2565 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2568 $totalarray[
'nbfield']++;
2571 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2573 $totalarray[
'val'][
'rtp'] += $remaintopay;
2578 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2579 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2581 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2587 $totalarray[
'nbfield']++;
2592 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2593 print
'<td class="nowraponall">';
2594 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2597 $totalarray[
'nbfield']++;
2601 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2602 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2604 $totalarray[
'nbfield']++;
2608 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2609 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2611 $totalarray[
'nbfield']++;
2615 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2616 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2618 $totalarray[
'nbfield']++;
2622 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2623 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2625 $totalarray[
'nbfield']++;
2630 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2631 print
'<td class="right nowraponall amount">';
2632 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2635 $totalarray[
'nbfield']++;
2640 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2641 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2643 $totalarray[
'nbfield']++;
2644 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2646 if (empty($totalarray[
'val'][
'total_pa'])) {
2647 $totalarray[
'val'][
'total_pa'] = 0;
2649 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2652 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2653 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2655 $totalarray[
'nbfield']++;
2656 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2658 if (empty($totalarray[
'val'][
'total_margin'])) {
2659 $totalarray[
'val'][
'total_margin'] = 0;
2661 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2664 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2665 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2667 $totalarray[
'nbfield']++;
2671 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2672 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2674 $totalarray[
'nbfield']++;
2675 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2677 if ($i >= $imaxinloop - 1) {
2678 if (!empty($total_ht)) {
2679 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2681 $totalarray[
'val'][
'total_mark_rate'] =
'';
2687 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2689 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2690 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2691 print $hookmanager->resPrint;
2693 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2694 print
'<td class="nowraponall center">';
2695 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2698 $totalarray[
'nbfield']++;
2702 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2703 print
'<td class="nowraponall center">';
2704 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2707 $totalarray[
'nbfield']++;
2711 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2712 print
'<td class="nowraponall center">';
2713 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2716 $totalarray[
'nbfield']++;
2720 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2721 print
'<td class="sensiblehtmlcontent center">';
2725 $totalarray[
'nbfield']++;
2729 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2730 print
'<td class="center">';
2734 $totalarray[
'nbfield']++;
2738 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2739 print
'<td class="center">';
2740 if (!empty($obj->fk_fac_rec_source)) {
2742 $result = $facrec->fetch($obj->fk_fac_rec_source);
2746 print $facrec->getNomUrl();
2751 $totalarray[
'nbfield']++;
2755 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2756 print
'<td class="nowrap center">';
2757 print $facturestatic->getLibStatut(5, $totalallpayments);
2760 $totalarray[
'nbfield']++;
2767 print
'<td class="nowrap center">';
2768 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2770 if (in_array($obj->id, $arrayofselected)) {
2773 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2777 $totalarray[
'nbfield']++;
2788 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2789 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2792 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2798 foreach ($arrayfields as $key => $val) {
2799 if (!empty($val[
'checked'])) {
2803 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2808$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2809$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2810print $hookmanager->resPrint;
2812print
'</table>'.
"\n";
2815print
'</form>'.
"\n";
2818if ($contextpage !=
'poslist') {
2819 $hidegeneratedfilelistifempty = 1;
2820 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2821 $hidegeneratedfilelistifempty = 0;
2825 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2826 $urlsource .= str_replace(
'&',
'&', $param);
2828 $filedir = $diroutputmassaction;
2829 $genallowed = $user->hasRight(
"facture",
"lire");
2830 $delallowed = $user->hasRight(
"facture",
"creer");
2833 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage 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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
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...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 a 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...
invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.