46require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50if (isModEnabled(
'margin')) {
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
64if (isModEnabled(
'order')) {
65 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
69$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
71$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
77$action =
GETPOST(
'action',
'aZ09');
78$massaction =
GETPOST(
'massaction',
'alpha');
80$confirm =
GETPOST(
'confirm',
'alpha');
81$toselect =
GETPOST(
'toselect',
'array');
82$optioncss =
GETPOST(
'optioncss',
'alpha');
83$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
86if ($contextpage ==
'poslist') {
92$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
93$search_type =
GETPOST(
'search_type',
'intcomma');
94$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
95$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
96$search_project =
GETPOST(
'search_project',
'alpha');
97$search_company =
GETPOST(
'search_company',
'alpha');
98$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
99$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
100$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
101$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
102$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
103$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
104$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
105$search_login =
GETPOST(
'search_login',
'alpha');
106$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
107$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
108$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
109$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
110$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
111$search_status =
GETPOST(
'search_status',
'intcomma');
112$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
113$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
114$search_module_source =
GETPOST(
'search_module_source',
'alpha');
115$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
116$search_town =
GETPOST(
'search_town',
'alpha');
117$search_zip =
GETPOST(
'search_zip',
'alpha');
118$search_state =
GETPOST(
"search_state");
119$search_country =
GETPOST(
"search_country",
'aZ09');
120$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
121$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
122$search_user =
GETPOST(
'search_user',
'intcomma');
123$search_sale =
GETPOST(
'search_sale',
'intcomma');
124$search_date_startday =
GETPOSTINT(
'search_date_startday');
125$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
126$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
127$search_date_endday =
GETPOSTINT(
'search_date_endday');
128$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
129$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
130$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
131$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
132$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
133$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
134$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
135$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
136$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
137$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
138$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
139$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
140$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
141$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
142$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
143$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
144$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
145$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
146$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
147$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
148$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
149$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
150$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
151$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
153$search_option =
GETPOST(
'search_option');
154if ($search_option ==
'late') {
155 $search_status =
'1';
159$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
160$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
162if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
165$offset = $limit * $page;
166if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
173 $sortfield =
'f.datef';
175$pageprev = $page - 1;
176$pagenext = $page + 1;
178$diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
185$hookmanager->initHooks(array($contextpage));
189$extrafields->fetch_name_optionals_label(
$object->table_element);
191$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
194$fieldstosearchall = array(
196 'f.ref_client' =>
'RefCustomer',
197 'f.note_public' =>
'NotePublic',
198 's.nom' =>
"ThirdParty",
199 's.code_client' =>
"CustomerCodeShort",
200 's.name_alias' =>
"AliasNameShort",
203 'pd.description' =>
'Description',
205if (empty($user->socid)) {
206 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
209$checkedtypetiers = 0;
211 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
212 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1,
'position' => 10),
213 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
214 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
215 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 20),
216 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' => 0,
'position' => 22),
217 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 25),
218 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 30),
219 'p.ref' => array(
'label' =>
"ProjectRef",
'langs' =>
'projects',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 40),
220 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 41),
221 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 50),
222 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 51),
223 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' => -1,
'position' => 52),
224 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
225 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 55),
226 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 60),
227 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 65),
228 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 70),
229 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
230 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 80),
231 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 85),
232 'f.module_source' => array(
'label' =>
"POSModule",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 90),
233 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 91),
234 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 95),
235 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 100),
236 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
237 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
238 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 130),
239 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' => 0,
'position' => 140),
240 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' => 0,
'position' => 150),
241 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 280),
242 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 285),
243 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 290),
244 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 291),
245 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 292),
246 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 295),
247 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 296),
248 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
249 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
250 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
251 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
252 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
253 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 502),
254 'u.login' => array(
'label' =>
"UserAuthor",
'checked' => 1,
'visible' => -1,
'position' => 504),
255 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 506),
260 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
261 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
262 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' => 0,
'position' => 530,
'enabled' =>
'1'),
263 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
267 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' => 0,
'position' => 86);
270$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
271if (empty($subtypearray)) {
272 unset($arrayfields[
'f.subtype']);
276foreach (
$object->fields as $key => $val) {
279 if (!empty($val[
'visible'])) {
280 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
282 if (array_key_exists($key, $arrayfields)) {
284 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
286 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
290 $arrayfields[$newkey] = array(
291 'label' => $val[
'label'],
292 'checked' => (($visible < 0) ? 0 : 1),
293 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
294 'position' => $val[
'position'],
295 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
301include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
306'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
308if (!$user->hasRight(
'societe',
'client',
'voir')) {
309 $search_sale = $user->id;
313$fieldid = (!empty($ref) ?
'ref' :
'rowid');
314if (!empty($user->socid)) {
315 $socid = $user->socid;
324if (
GETPOST(
'cancel',
'alpha')) {
328if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
332$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
333$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
338include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
341if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
344 $search_product_category =
'';
346 $search_refcustomer =
'';
348 $search_subtype =
'';
349 $search_project_ref =
'';
350 $search_project =
'';
351 $search_company =
'';
352 $search_company_alias =
'';
353 $search_parent_name =
'';
354 $search_montant_ht =
'';
355 $search_montant_vat =
'';
356 $search_montant_localtax1 =
'';
357 $search_montant_localtax2 =
'';
358 $search_montant_ttc =
'';
360 $search_multicurrency_code =
'';
361 $search_multicurrency_tx =
'';
362 $search_multicurrency_montant_ht =
'';
363 $search_multicurrency_montant_vat =
'';
364 $search_multicurrency_montant_ttc =
'';
366 $search_paymentmode =
'';
367 $search_paymentterms =
'';
368 $search_module_source =
'';
369 $search_pos_source =
'';
373 $search_country =
'';
374 $search_type_thirdparty =
'';
375 $search_customer_code =
'';
376 $search_date_startday =
'';
377 $search_date_startmonth =
'';
378 $search_date_startyear =
'';
379 $search_date_endday =
'';
380 $search_date_endmonth =
'';
381 $search_date_endyear =
'';
382 $search_date_start =
'';
383 $search_date_end =
'';
384 $search_date_valid_startday =
'';
385 $search_date_valid_startmonth =
'';
386 $search_date_valid_startyear =
'';
387 $search_date_valid_endday =
'';
388 $search_date_valid_endmonth =
'';
389 $search_date_valid_endyear =
'';
390 $search_date_valid_start =
'';
391 $search_date_valid_end =
'';
392 $search_datelimit_startday =
'';
393 $search_datelimit_startmonth =
'';
394 $search_datelimit_startyear =
'';
395 $search_datelimit_endday =
'';
396 $search_datelimit_endmonth =
'';
397 $search_datelimit_endyear =
'';
398 $search_datelimit_start =
'';
399 $search_datelimit_end =
'';
400 $search_fac_rec_source_title =
'';
402 $search_categ_cus = 0;
404 $search_array_options = array();
407if (empty($reshook)) {
408 $objectclass =
'Facture';
409 $objectlabel =
'Invoices';
410 $permissiontoread = $user->hasRight(
"facture",
"lire");
411 $permissiontoadd = $user->hasRight(
"facture",
"creer");
412 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
413 $uploaddir = $conf->facture->dir_output;
414 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
417if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
418 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
419 $arrayofselected = is_array($toselect) ? $toselect : array();
420 if (!empty($arrayofselected)) {
424 if (empty($paiementdate)) {
425 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
427 $action =
'makepayment';
431 foreach ($arrayofselected as $toselectid) {
434 $result = $facture->fetch($toselectid);
443 $paiementAmount = $facture->getSommePaiement();
444 $totalcreditnotes = $facture->getSumCreditNotesUsed();
445 $totaldeposits = $facture->getSumDepositsUsed();
447 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
448 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
451 $parameters = array(
'remaintopay' => $remaintopay);
452 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
454 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
455 $remaintopay = $remain;
457 } elseif ($reshook < 0) {
459 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
462 if ($remaintopay != 0) {
463 $resultBank = $facture->setBankAccount($bankid);
464 if ($resultBank < 0) {
469 $paiement->datepaye = $paiementdate;
470 $paiement->amounts[$facture->id] = $remaintopay;
471 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
472 $paiement->paiementid = $paiementid;
473 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
474 if ($paiement_id < 0) {
475 $langs->load(
"errors");
476 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
479 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
481 $langs->load(
"errors");
482 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
488 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
492 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
497 if (empty($errorpayment)) {
498 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
506} elseif ($massaction ==
'withdrawrequest') {
507 $langs->load(
"withdrawals");
509 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
516 $arrayofselected = is_array($toselect) ? $toselect : array();
517 $listofbills = array();
518 foreach ($arrayofselected as $toselectid) {
520 $result = $objecttmp->fetch($toselectid);
522 $totalpaid = $objecttmp->getSommePaiement();
523 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
524 $totaldeposits = $objecttmp->getSumDepositsUsed();
525 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
528 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
529 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
531 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
532 $objecttmp->resteapayer = $remaintopay;
534 } elseif ($reshook < 0) {
536 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
541 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
542 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
544 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
545 } elseif ($objecttmp->resteapayer < 0) {
547 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
550 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
551 $rsql .=
" , pfd.date_traite as date_traite";
552 $rsql .=
" , pfd.amount";
553 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
554 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
555 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
556 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
557 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
558 $rsql .=
" AND pfd.traite = 0";
559 $rsql .=
" ORDER BY pfd.date_demande DESC";
561 $result_sql = $db->query($rsql);
563 $numprlv = $db->num_rows($result_sql);
568 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
569 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
570 $langs->load(
"errors");
572 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
574 $listofbills[] = $objecttmp;
580 if (!empty($listofbills)) {
581 $nbwithdrawrequestok = 0;
582 foreach ($listofbills as $aBill) {
584 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
587 $nbwithdrawrequestok++;
593 if ($nbwithdrawrequestok > 0) {
594 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
606$form =
new Form($db);
610if (isModEnabled(
'margin')) {
613$bankaccountstatic =
new Account($db);
614$facturestatic =
new Facture($db);
616$companystatic =
new Societe($db);
617$companyparent =
new Societe($db);
619$company_url_list = array();
624 if (empty($search_company)) {
625 $search_company = $soc->name;
629$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
630$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
632$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
633$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
639 $sql =
'SELECT DISTINCT';
641$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,';
642$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
643$sql .=
' f.fk_user_author,';
644$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,';
645$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
646$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
647$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
648$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
649$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,';
650$sql .=
" s.parent as fk_parent,";
651$sql .=
" s2.nom as name2,";
652$sql .=
' typent.code as typent_code,';
653$sql .=
' state.code_departement as state_code, state.nom as state_name,';
654$sql .=
' country.code as country_code,';
655$sql .=
' f.fk_fac_rec_source,';
656$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
657$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';
667if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
668 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
669 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
673$parameters = array();
674$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
675$sql .= $hookmanager->resPrint;
676$sql = preg_replace(
'/,\s*$/',
'', $sql);
680$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
681$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
682$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
683$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
684$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
685$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
686if ($sortfield ==
"f.datef") {
687 $sql .= $db->hintindex(
'idx_facture_datef');
689if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
690 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
693 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
695if (!empty($search_fac_rec_source_title)) {
696 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
698$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
699$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
701$parameters = array();
702$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
703$sql .= $hookmanager->resPrint;
705$sql .=
' WHERE f.fk_soc = s.rowid';
706$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
708 $sql .=
' AND s.rowid = '.((int) $socid);
712 $sql .=
' AND f.fk_user_author IS NULL';
714 $sql .=
' AND f.fk_user_author = '.((int) $userid);
720if ($search_refcustomer) {
723if ($search_type !=
'' && $search_type !=
'-1') {
724 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
726if ($search_subtype !=
'' && $search_subtype !=
'-1') {
727 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
729if ($search_project_ref) {
732if ($search_project) {
735if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
736 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
738 if ($search_company) {
741 if ($search_company_alias) {
745if ($search_parent_name) {
748if ($search_customer_code) {
760if (strlen(trim($search_country))) {
762 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
763 foreach ($arrayofcode as $key => $value) {
764 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
765 if ($value != $mysoc->country_code) {
766 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
769 if ($search_country ==
'special_allnotme') {
770 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
771 } elseif ($search_country ==
'special_eec') {
772 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
773 } elseif ($search_country ==
'special_eecnotme') {
774 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
775 } elseif ($search_country ==
'special_noteec') {
776 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
781if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
782 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
784if ($search_montant_ht !=
'') {
787if ($search_montant_vat !=
'') {
790if ($search_montant_localtax1 !=
'') {
791 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
793if ($search_montant_localtax2 !=
'') {
794 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
796if ($search_montant_ttc !=
'') {
799if ($search_multicurrency_code !=
'') {
800 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
802if ($search_multicurrency_tx !=
'') {
803 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
805if ($search_multicurrency_montant_ht !=
'') {
806 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
808if ($search_multicurrency_montant_vat !=
'') {
809 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
811if ($search_multicurrency_montant_ttc !=
'') {
812 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
815 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
817if ($search_status !=
'-1' && $search_status !=
'') {
818 if (is_numeric($search_status) && $search_status >= 0) {
819 if ($search_status ==
'0') {
820 $sql .=
" AND f.fk_statut = 0";
822 if ($search_status ==
'1') {
823 $sql .=
" AND f.fk_statut = 1";
825 if ($search_status ==
'2') {
826 $sql .=
" AND f.fk_statut = 2";
828 if ($search_status ==
'3') {
829 $sql .=
" AND f.fk_statut = 3";
832 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
836if ($search_paymentmode > 0) {
837 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
839if ($search_paymentterms > 0) {
840 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
842if ($search_module_source) {
845if ($search_pos_source) {
848if ($search_date_start) {
849 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
851if ($search_date_end) {
852 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
854if ($search_date_valid_start) {
855 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
857if ($search_date_valid_end) {
858 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
860if ($search_datelimit_start) {
861 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
863if ($search_datelimit_end) {
864 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
866if ($search_option ==
'late') {
867 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
872if (!empty($search_fac_rec_source_title)) {
873 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
875if ($search_fk_fac_rec_source) {
876 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
879if ($search_user > 0) {
880 $sql .=
" AND EXISTS (";
881 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
882 $sql .=
" FROM llx_element_contact as ec";
883 $sql .=
" INNER JOIN llx_c_type_contact as tc";
884 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
885 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
888if ($search_sale && $search_sale !=
'-1') {
889 if ($search_sale == -2) {
890 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
891 } elseif ($search_sale > 0) {
892 $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).
")";
896$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
897$searchCategoryProductOperator = 0;
898if (!empty($searchCategoryProductList)) {
899 $searchCategoryProductSqlList = array();
900 $listofcategoryid =
'';
901 foreach ($searchCategoryProductList as $searchCategoryProduct) {
902 if (intval($searchCategoryProduct) == -2) {
903 $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)";
904 } elseif (intval($searchCategoryProduct) > 0) {
905 if ($searchCategoryProductOperator == 0) {
906 $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).
")";
908 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
912 if ($listofcategoryid) {
913 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
915 if ($searchCategoryProductOperator == 1) {
916 if (!empty($searchCategoryProductSqlList)) {
917 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
920 if (!empty($searchCategoryProductSqlList)) {
921 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
925$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
926$searchCategoryCustomerOperator = 0;
928if (!empty($searchCategoryCustomerList)) {
929 $searchCategoryCustomerSqlList = array();
930 $listofcategoryid =
'';
931 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
932 if (intval($searchCategoryCustomer) == -2) {
933 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
934 } elseif (intval($searchCategoryCustomer) > 0) {
935 if ($searchCategoryCustomerOperator == 0) {
936 $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).
")";
938 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
942 if ($listofcategoryid) {
943 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
945 if ($searchCategoryCustomerOperator == 1) {
946 if (!empty($searchCategoryCustomerSqlList)) {
947 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
950 if (!empty($searchCategoryCustomerSqlList)) {
951 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
956include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
958$parameters = array();
959$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
960$sql .= $hookmanager->resPrint;
963 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
967$parameters = array();
968$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
969$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
972$nbtotalofrecords =
'';
975 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
976 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
978 $resql = $db->query($sqlforcount);
980 $objforcount = $db->fetch_object($resql);
981 $nbtotalofrecords = $objforcount->nbtotalofrecords;
986 if (($page * $limit) > $nbtotalofrecords) {
994$sql .= $db->order($sortfield, $sortorder);
996 $sql .= $db->plimit($limit + 1, $offset);
999$resql = $db->query($sql);
1005$num = $db->num_rows($resql);
1007$arrayofselected = is_array($toselect) ? $toselect : array();
1009if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1010 $obj = $db->fetch_object($resql);
1013 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1020llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
1022if ($search_fk_fac_rec_source) {
1024 $object->fetch((
int) $search_fk_fac_rec_source);
1028 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1032$param =
'&socid='.urlencode((
string) ($socid));
1034 $param .=
'&mode='.urlencode($mode);
1036if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1037 $param .=
'&contextpage='.urlencode($contextpage);
1039if ($limit > 0 && $limit != $conf->liste_limit) {
1040 $param .=
'&limit='.((int) $limit);
1043 $param .=
'&search_all='.urlencode($search_all);
1045if ($search_date_startday) {
1046 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1048if ($search_date_startmonth) {
1049 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1051if ($search_date_startyear) {
1052 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1054if ($search_date_endday) {
1055 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1057if ($search_date_endmonth) {
1058 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1060if ($search_date_endyear) {
1061 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1063if ($search_date_valid_startday) {
1064 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1066if ($search_date_valid_startmonth) {
1067 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1069if ($search_date_valid_startyear) {
1070 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1072if ($search_date_valid_endday) {
1073 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1075if ($search_date_valid_endmonth) {
1076 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1078if ($search_date_valid_endyear) {
1079 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1081if ($search_datelimit_startday) {
1082 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1084if ($search_datelimit_startmonth) {
1085 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1087if ($search_datelimit_startyear) {
1088 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1090if ($search_datelimit_endday) {
1091 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1093if ($search_datelimit_endmonth) {
1094 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1096if ($search_datelimit_endyear) {
1097 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1100 $param .=
'&search_ref='.urlencode($search_ref);
1102if ($search_refcustomer) {
1103 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1105if ($search_project_ref) {
1106 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1108if ($search_project) {
1109 $param .=
'&search_project='.urlencode($search_project);
1111if ($search_type !=
'') {
1112 $param .=
'&search_type='.urlencode($search_type);
1114if ($search_subtype !=
'') {
1115 $param .=
'&search_subtype='.urlencode($search_subtype);
1117if ($search_company) {
1118 $param .=
'&search_company='.urlencode($search_company);
1120if ($search_company_alias) {
1121 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1123if ($search_parent_name !=
'') {
1124 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1127 $param .=
'&search_town='.urlencode($search_town);
1130 $param .=
'&search_zip='.urlencode($search_zip);
1132if ($search_country) {
1133 $param .=
"&search_country=".urlencode($search_country);
1135if ($search_type_thirdparty !=
'') {
1136 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1138if ($search_customer_code) {
1139 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1141if ($search_sale > 0) {
1142 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1144if ($search_user > 0) {
1145 $param .=
'&search_user='.urlencode((
string) $search_user);
1148 $param .=
'&search_login='.urlencode($search_login);
1150if ($search_product_category > 0) {
1151 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1153if ($search_montant_ht !=
'') {
1154 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1156if ($search_montant_vat !=
'') {
1157 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1159if ($search_montant_localtax1 !=
'') {
1160 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1162if ($search_montant_localtax2 !=
'') {
1163 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1165if ($search_montant_ttc !=
'') {
1166 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1168if ($search_multicurrency_code !=
'') {
1169 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1171if ($search_multicurrency_tx !=
'') {
1172 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1174if ($search_multicurrency_montant_ht !=
'') {
1175 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1177if ($search_multicurrency_montant_vat !=
'') {
1178 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1180if ($search_multicurrency_montant_ttc !=
'') {
1181 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1183if ($search_status !=
'') {
1184 $param .=
'&search_status='.urlencode($search_status);
1186if ($search_paymentmode > 0) {
1187 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1189if ($search_paymentterms > 0) {
1190 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1192if ($search_module_source) {
1193 $param .=
'&search_module_source='.urlencode($search_module_source);
1195if ($search_pos_source) {
1196 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1199 $param .=
'&show_files='.urlencode((
string) ($show_files));
1201if ($search_option) {
1202 $param .=
"&search_option=".urlencode($search_option);
1204if ($optioncss !=
'') {
1205 $param .=
'&optioncss='.urlencode($optioncss);
1207if ($search_categ_cus > 0) {
1208 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1210if (!empty($search_fac_rec_source_title)) {
1211 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1213if ($search_fk_fac_rec_source) {
1214 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1218include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1220$parameters = array(
'param' => &$param);
1221$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1222$param .= $hookmanager->resPrint;
1224$arrayofmassactions = array(
1225 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1226 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1227 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1228 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1231if ($user->hasRight(
'facture',
'paiement')) {
1232 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1234if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1235 $langs->load(
"withdrawals");
1236 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1238if ($user->hasRight(
'facture',
'supprimer')) {
1240 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1242 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1245if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1246 $arrayofmassactions = array();
1248$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1252if ($contextpage !=
'poslist') {
1253 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1255 $url .=
'&socid='.urlencode((
string)
$object->socid);
1258 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1260 $newcardbutton =
'';
1261 $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'));
1262 $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'));
1264 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1268print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1269if ($optioncss !=
'') {
1270 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1272print
'<input type="hidden" name="token" value="'.newToken().
'">';
1273print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1274if (!in_array($massaction, array(
'makepayment'))) {
1275 print
'<input type="hidden" name="action" value="list">';
1277print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1278print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1279print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1280print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1281print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1282print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1284print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1286$topicmail =
"SendBillRef";
1287$modelmail =
"facture_send";
1289$trackid =
'inv'.$object->id;
1290include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1292if ($massaction ==
'makepayment') {
1294 $formquestion = array(
1298 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1299 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1300 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1303 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1308 foreach ($fieldstosearchall as $key => $val) {
1309 $fieldstosearchall[$key] = $langs->trans($val);
1311 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1316if ($user->hasRight(
"user",
"user",
"lire")) {
1317 $langs->load(
"commercial");
1318 $moreforfilter .=
'<div class="divsearchfield">';
1319 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1320 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1321 $moreforfilter .=
'</div>';
1324if ($user->hasRight(
"user",
"user",
"lire")) {
1325 $moreforfilter .=
'<div class="divsearchfield">';
1326 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1327 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1328 $moreforfilter .=
'</div>';
1331if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1332 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1333 $moreforfilter .=
'<div class="divsearchfield">';
1334 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1335 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1336 $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);
1337 $moreforfilter .=
'</div>';
1339if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1340 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1341 $moreforfilter .=
'<div class="divsearchfield">';
1342 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1343 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1344 $moreforfilter .=
'</div>';
1347$moreforfilter .=
'<div class="divsearchfield">';
1348$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1349$moreforfilter .=
'</div>';
1351$parameters = array();
1352$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1353if (empty($reshook)) {
1354 $moreforfilter .= $hookmanager->resPrint;
1356 $moreforfilter = $hookmanager->resPrint;
1359if (!empty($moreforfilter)) {
1360 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1361 print $moreforfilter;
1365$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1366$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1369if ($massactionbutton && $contextpage !=
'poslist') {
1370 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1373print
'<div class="div-table-responsive">';
1374print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1378print
'<tr class="liste_titre_filter">';
1382 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1383 $searchpicto = $form->showFilterButtons(
'left');
1389 print
'<td class="liste_titre">';
1393if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1394 print
'<td class="liste_titre" align="left">';
1395 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1399if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1405if (!empty($arrayfields[
'f.type'][
'checked'])) {
1406 print
'<td class="liste_titre maxwidthonsmartphone">';
1418 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1422if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1423 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1424 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1428if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1429 print
'<td class="liste_titre center">';
1430 print
'<div class="nowrapfordate">';
1431 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1433 print
'<div class="nowrapfordate">';
1434 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1439if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1440 print
'<td class="liste_titre center">';
1441 print
'<div class="nowrapfordate">';
1442 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'));
1444 print
'<div class="nowrapfordate">';
1445 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'));
1450if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1451 print
'<td class="liste_titre center">';
1452 print
'<div class="nowrapfordate">';
1453 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1455 print
'<div class="nowrapfordate">';
1456 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1461if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1462 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1465if (!empty($arrayfields[
'p.title'][
'checked'])) {
1466 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1469if (!empty($arrayfields[
's.nom'][
'checked'])) {
1470 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1473if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1474 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1477if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1478 print
'<td class="liste_titre">';
1479 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1483if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1484 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1487if (!empty($arrayfields[
's.town'][
'checked'])) {
1488 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1491if (!empty($arrayfields[
's.zip'][
'checked'])) {
1492 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1495if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1496 print
'<td class="liste_titre">';
1497 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1501if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1502 print
'<td class="liste_titre center">';
1503 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1507if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1508 print
'<td class="liste_titre maxwidthonsmartphone center">';
1509 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);
1513if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1514 print
'<td class="liste_titre">';
1515 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1519if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1520 print
'<td class="liste_titre left">';
1521 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1525if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1526 print
'<td class="liste_titre">';
1527 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1531if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1532 print
'<td class="liste_titre">';
1533 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1536if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1538 print
'<td class="liste_titre right">';
1539 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1542if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1544 print
'<td class="liste_titre right">';
1545 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1548if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1550 print
'<td class="liste_titre right">';
1551 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1554if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1556 print
'<td class="liste_titre right">';
1557 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1560if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1562 print
'<td class="liste_titre right">';
1563 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1566if (!empty($arrayfields[
'u.login'][
'checked'])) {
1568 print
'<td class="liste_titre" align="center">';
1569 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1572if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1573 print
'<td class="liste_titre"></td>';
1575if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1576 print
'<td class="liste_titre" align="right">';
1579if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1580 print
'<td class="liste_titre right">';
1583if (!empty($arrayfields[
'rtp'][
'checked'])) {
1584 print
'<td class="liste_titre">';
1587if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1589 print
'<td class="liste_titre">';
1590 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1593if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1595 print
'<td class="liste_titre">';
1596 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1599if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1601 print
'<td class="liste_titre right">';
1602 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1605if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1607 print
'<td class="liste_titre right">';
1608 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1611if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1613 print
'<td class="liste_titre right">';
1614 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1617if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1618 print
'<td class="liste_titre">';
1621if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1622 print
'<td class="liste_titre right">';
1625if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1626 print
'<td class="liste_titre right">';
1629if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1630 print
'<td class="liste_titre right">';
1633if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1634 print
'<td class="liste_titre right">';
1637if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1638 print
'<td class="liste_titre right">';
1643include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1646$parameters = array(
'arrayfields' => $arrayfields);
1647$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1648print $hookmanager->resPrint;
1650if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1651 print
'<td class="liste_titre">';
1655if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1656 print
'<td class="liste_titre">';
1660if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1661 print
'<td class="liste_titre">';
1664if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1666 print
'<td class="liste_titre">';
1669if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1671 print
'<td class="liste_titre">';
1674if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1676 print
'<td class="liste_titre maxwidthonsmartphone right">';
1677 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).
'">';
1681if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1682 print
'<td class="liste_titre center parentonrightofpage">';
1683 $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"));
1685 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1690 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1691 $searchpicto = $form->showFilterButtons();
1697$totalarray = array();
1698$totalarray[
'nbfield'] = 0;
1702print
'<tr class="liste_titre">';
1704 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1705 $totalarray[
'nbfield']++;
1709 $totalarray[
'nbfield']++;
1711if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1713 $totalarray[
'nbfield']++;
1715if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1717 $totalarray[
'nbfield']++;
1719if (!empty($arrayfields[
'f.type'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1724 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1726if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1728 $totalarray[
'nbfield']++;
1730if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1732 $totalarray[
'nbfield']++;
1734if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1736 $totalarray[
'nbfield']++;
1738if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1739 $langs->load(
"projects");
1740 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
'p.title'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
's.nom'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1754 $totalarray[
'nbfield']++;
1756if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1758 $totalarray[
'nbfield']++;
1760if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1762 $totalarray[
'nbfield']++;
1764if (!empty($arrayfields[
's.town'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1766 $totalarray[
'nbfield']++;
1768if (!empty($arrayfields[
's.zip'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1770 $totalarray[
'nbfield']++;
1772if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1774 $totalarray[
'nbfield']++;
1776if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1778 $totalarray[
'nbfield']++;
1780if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1782 $totalarray[
'nbfield']++;
1784if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1786 $totalarray[
'nbfield']++;
1788if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1790 $totalarray[
'nbfield']++;
1792if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1794 $totalarray[
'nbfield']++;
1796if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1798 $totalarray[
'nbfield']++;
1800if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1801 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1802 $totalarray[
'nbfield']++;
1804if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1805 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1806 $totalarray[
'nbfield']++;
1808if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1809 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1810 $totalarray[
'nbfield']++;
1812if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1813 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1814 $totalarray[
'nbfield']++;
1816if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1817 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1818 $totalarray[
'nbfield']++;
1820if (!empty($arrayfields[
'u.login'][
'checked'])) {
1821 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1822 $totalarray[
'nbfield']++;
1824if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1826 $totalarray[
'nbfield']++;
1828if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1830 $totalarray[
'nbfield']++;
1832if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1834 $totalarray[
'nbfield']++;
1836if (!empty($arrayfields[
'rtp'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1838 $totalarray[
'nbfield']++;
1840if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1842 $totalarray[
'nbfield']++;
1844if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1846 $totalarray[
'nbfield']++;
1848if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1849 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1850 $totalarray[
'nbfield']++;
1852if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1854 $totalarray[
'nbfield']++;
1856if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1857 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1858 $totalarray[
'nbfield']++;
1860if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1861 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1862 $totalarray[
'nbfield']++;
1864if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1865 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1866 $totalarray[
'nbfield']++;
1868if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1869 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1870 $totalarray[
'nbfield']++;
1872if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1873 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1874 $totalarray[
'nbfield']++;
1876if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1877 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1878 $totalarray[
'nbfield']++;
1880if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1881 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1882 $totalarray[
'nbfield']++;
1885include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1887$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1888$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1889print $hookmanager->resPrint;
1890if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1891 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1892 $totalarray[
'nbfield']++;
1894if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1895 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1896 $totalarray[
'nbfield']++;
1898if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1899 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1900 $totalarray[
'nbfield']++;
1902if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1903 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1904 $totalarray[
'nbfield']++;
1906if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1907 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1908 $totalarray[
'nbfield']++;
1910if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1911 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1912 $totalarray[
'nbfield']++;
1914if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1915 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1916 $totalarray[
'nbfield']++;
1919 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1920 $totalarray[
'nbfield']++;
1925$projectstatic =
new Project($db);
1927$userstatic =
new User($db);
1933 $savnbfield = $totalarray[
'nbfield'];
1934 $totalarray = array();
1935 $totalarray[
'nbfield'] = 0;
1936 $totalarray[
'val'] = array();
1937 $totalarray[
'val'][
'f.total_ht'] = 0;
1938 $totalarray[
'val'][
'f.total_tva'] = 0;
1939 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1940 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1941 $totalarray[
'val'][
'f.total_ttc'] = 0;
1942 $totalarray[
'val'][
'dynamount_payed'] = 0;
1943 $totalarray[
'val'][
'rtp'] = 0;
1945 $typenArray = $formcompany->typent_array(1);
1947 $with_margin_info =
false;
1948 if (isModEnabled(
'margin') && (
1949 !empty($arrayfields[
'total_pa'][
'checked'])
1950 || !empty($arrayfields[
'total_margin'][
'checked'])
1951 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1952 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1955 $with_margin_info =
true;
1960 $imaxinloop = ($limit ? min($num, $limit) : $num);
1961 while ($i < $imaxinloop) {
1962 $obj = $db->fetch_object($resql);
1964 $datelimit = $db->jdate($obj->datelimite);
1966 $facturestatic->id = $obj->id;
1967 $facturestatic->ref = $obj->ref;
1968 $facturestatic->ref_client = $obj->ref_client;
1969 $facturestatic->ref_customer = $obj->ref_client;
1970 $facturestatic->type = $obj->type;
1971 $facturestatic->subtype = $obj->subtype;
1972 $facturestatic->total_ht = $obj->total_ht;
1973 $facturestatic->total_tva = $obj->total_tva;
1974 $facturestatic->total_ttc = $obj->total_ttc;
1975 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1976 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1977 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1978 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1979 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1980 $facturestatic->statut = $obj->fk_statut;
1981 $facturestatic->status = $obj->fk_statut;
1982 $facturestatic->close_code = $obj->close_code;
1983 $facturestatic->total_ttc = $obj->total_ttc;
1984 $facturestatic->paye = $obj->paye;
1985 $facturestatic->socid = $obj->fk_soc;
1987 $facturestatic->date = $db->jdate($obj->datef);
1988 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1989 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1991 $facturestatic->note_public = $obj->note_public;
1992 $facturestatic->note_private = $obj->note_private;
1995 $facturestatic->retained_warranty = $obj->retained_warranty;
1996 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1997 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1998 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1999 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2000 $facturestatic->situation_counter = $obj->situation_counter;
2003 $companystatic->id = $obj->socid;
2004 $companystatic->name = $obj->name;
2005 $companystatic->name_alias = $obj->alias;
2006 $companystatic->client = $obj->client;
2007 $companystatic->fournisseur = $obj->fournisseur;
2008 $companystatic->code_client = $obj->code_client;
2009 $companystatic->code_compta_client = $obj->code_compta_client;
2010 $companystatic->code_fournisseur = $obj->code_fournisseur;
2011 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2012 $companystatic->email = $obj->email;
2013 $companystatic->phone = $obj->phone;
2014 $companystatic->fax = $obj->fax;
2015 $companystatic->address = $obj->address;
2016 $companystatic->zip = $obj->zip;
2017 $companystatic->town = $obj->town;
2018 $companystatic->country_code = $obj->country_code;
2020 $projectstatic->id = $obj->project_id;
2021 $projectstatic->ref = $obj->project_ref;
2022 $projectstatic->title = $obj->project_label;
2024 $paiement = $facturestatic->getSommePaiement();
2025 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2026 $totaldeposits = $facturestatic->getSumDepositsUsed();
2027 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2028 $remaintopay = $obj->total_ttc - $totalallpayments;
2030 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2031 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2032 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2034 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2035 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2037 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2038 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2042 $multicurrency_remaintopay = 0;
2045 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
2046 $remaintopay = -$remaincreditnote;
2047 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2048 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2049 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2050 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2053 $facturestatic->alreadypaid = $paiement;
2054 $facturestatic->totalpaid = $paiement;
2055 $facturestatic->totalcreditnotes = $totalcreditnotes;
2056 $facturestatic->totaldeposits = $totaldeposits;
2058 $marginInfo = array();
2059 if ($with_margin_info) {
2060 $facturestatic->fetch_lines();
2061 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2062 $total_ht += $obj->total_ht;
2063 $total_margin += $marginInfo[
'total_margin'];
2068 if ($mode ==
'kanban') {
2070 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2071 print
'<div class="box-flex-container kanban">';
2074 if ($massactionbutton || $massaction) {
2076 if (in_array(
$object->id, $arrayofselected)) {
2081 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2082 print $facturestatic->getKanbanView(
'', $arraydata);
2083 if ($i == ($imaxinloop - 1)) {
2090 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2091 if ($contextpage ==
'poslist') {
2092 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2093 if (strpos($obj->ref, 'PROV
') !== false) {
2094 //If is a draft invoice, load var to be able to add products
2095 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2096 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2104 print
'<td class="nowrap center">';
2105 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2107 if (in_array($obj->id, $arrayofselected)) {
2110 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2114 $totalarray[
'nbfield']++;
2120 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2122 $totalarray[
'nbfield']++;
2127 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2128 print
'<td class="nowraponall">';
2130 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2132 print
'<td class="nobordernopadding nowraponall">';
2133 if ($contextpage ==
'poslist') {
2136 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2141 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2142 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2149 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2155 print
'<td class="nowrap tdoverflowmax200">';
2159 $totalarray[
'nbfield']++;
2164 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2165 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2166 print $facturestatic->getLibType(2);
2169 $totalarray[
'nbfield']++;
2174 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2176 if ($facturestatic->subtype > 0) {
2177 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2179 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2183 $totalarray[
'nbfield']++;
2188 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2189 print
'<td align="center" class="nowraponall">';
2193 $totalarray[
'nbfield']++;
2198 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2199 print
'<td align="center" class="nowraponall">';
2203 $totalarray[
'nbfield']++;
2208 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2209 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2210 if ($facturestatic->hasDelay()) {
2211 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2215 $totalarray[
'nbfield']++;
2220 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2221 print
'<td class="nocellnopadd nowraponall">';
2222 if ($obj->project_id > 0) {
2223 print $projectstatic->getNomUrl(1);
2227 $totalarray[
'nbfield']++;
2232 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2233 print
'<td class="nowraponall">';
2234 if ($obj->project_id > 0) {
2239 $totalarray[
'nbfield']++;
2244 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2245 print
'<td class="tdoverflowmax150">';
2246 if ($contextpage ==
'poslist') {
2249 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2253 $totalarray[
'nbfield']++;
2257 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2258 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2262 $totalarray[
'nbfield']++;
2266 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2267 print
'<td class="tdoverflowmax200">';
2268 if ($obj->fk_parent > 0) {
2269 if (!isset($company_url_list[$obj->fk_parent])) {
2270 $companyparent =
new Societe($db);
2271 $res = $companyparent->fetch($obj->fk_parent);
2273 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2276 if (isset($company_url_list[$obj->fk_parent])) {
2277 print $company_url_list[$obj->fk_parent];
2282 $totalarray[
'nbfield']++;
2286 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2287 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2291 $totalarray[
'nbfield']++;
2295 if (!empty($arrayfields[
's.town'][
'checked'])) {
2296 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2300 $totalarray[
'nbfield']++;
2304 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2305 print
'<td class="nowraponall">';
2309 $totalarray[
'nbfield']++;
2313 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2314 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2316 $totalarray[
'nbfield']++;
2320 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2321 $tmparray =
getCountry($obj->fk_pays,
'all');
2322 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2326 $totalarray[
'nbfield']++;
2330 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2331 print
'<td class="center">';
2332 if (!is_array($typenArray) || count($typenArray) == 0) {
2333 $typenArray = $formcompany->typent_array(1);
2335 if (!empty($obj->typent_code)) {
2336 print $typenArray[$obj->typent_code];
2340 $totalarray[
'nbfield']++;
2344 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2345 print
'<td class="center">';
2346 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2347 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2349 print $conf->cache[
'staff'][$obj->staff_code];
2352 $totalarray[
'nbfield']++;
2357 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2358 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2359 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2363 $totalarray[
'nbfield']++;
2368 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2369 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2370 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2374 $totalarray[
'nbfield']++;
2379 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2384 $totalarray[
'nbfield']++;
2389 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2394 $totalarray[
'nbfield']++;
2399 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2400 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2402 $totalarray[
'nbfield']++;
2405 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2407 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2410 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2411 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2413 $totalarray[
'nbfield']++;
2416 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2418 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2421 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2422 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2424 $totalarray[
'nbfield']++;
2427 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2429 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2432 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2433 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2435 $totalarray[
'nbfield']++;
2438 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2440 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2443 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2444 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2446 $totalarray[
'nbfield']++;
2449 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2451 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2454 $userstatic->id = $obj->fk_user_author;
2455 $userstatic->login = $obj->login;
2456 $userstatic->lastname = $obj->lastname;
2457 $userstatic->firstname = $obj->firstname;
2458 $userstatic->email = $obj->user_email;
2459 $userstatic->status = $obj->user_statut;
2460 $userstatic->entity = $obj->entity;
2461 $userstatic->photo = $obj->photo;
2462 $userstatic->office_phone = $obj->office_phone;
2463 $userstatic->office_fax = $obj->office_fax;
2464 $userstatic->user_mobile = $obj->user_mobile;
2465 $userstatic->job = $obj->job;
2466 $userstatic->gender = $obj->gender;
2469 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2470 print
'<td class="tdoverflowmax200">';
2471 if ($userstatic->id) {
2472 print $userstatic->getNomUrl(-1);
2478 $totalarray[
'nbfield']++;
2482 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2485 if ($obj->socid > 0) {
2486 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2487 if ($listsalesrepresentatives < 0) {
2490 $nbofsalesrepresentative = count($listsalesrepresentatives);
2491 if ($nbofsalesrepresentative > 6) {
2493 print $nbofsalesrepresentative;
2494 } elseif ($nbofsalesrepresentative > 0) {
2496 foreach ($listsalesrepresentatives as $val) {
2497 $userstatic->id = $val[
'id'];
2498 $userstatic->lastname = $val[
'lastname'];
2499 $userstatic->firstname = $val[
'firstname'];
2500 $userstatic->email = $val[
'email'];
2501 $userstatic->status = $val[
'statut'];
2502 $userstatic->entity = $val[
'entity'];
2503 $userstatic->photo = $val[
'photo'];
2504 $userstatic->login = $val[
'login'];
2505 $userstatic->office_phone = $val[
'office_phone'];
2506 $userstatic->office_fax = $val[
'office_fax'];
2507 $userstatic->user_mobile = $val[
'user_mobile'];
2508 $userstatic->job = $val[
'job'];
2509 $userstatic->gender = $val[
'gender'];
2511 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2513 if ($j < $nbofsalesrepresentative) {
2525 $totalarray[
'nbfield']++;
2529 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2530 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2532 $totalarray[
'nbfield']++;
2536 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2537 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2539 $totalarray[
'nbfield']++;
2542 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'dynamount_payed';
2544 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2548 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2549 print
'<td class="right nowraponall amount">';
2550 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2553 $totalarray[
'nbfield']++;
2556 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2558 $totalarray[
'val'][
'rtp'] += $remaintopay;
2563 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2564 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2566 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2572 $totalarray[
'nbfield']++;
2577 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2578 print
'<td class="nowraponall">';
2579 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2582 $totalarray[
'nbfield']++;
2586 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2587 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2589 $totalarray[
'nbfield']++;
2593 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2594 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2596 $totalarray[
'nbfield']++;
2600 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2601 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2603 $totalarray[
'nbfield']++;
2607 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2608 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2610 $totalarray[
'nbfield']++;
2615 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2616 print
'<td class="right nowraponall amount">';
2617 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2620 $totalarray[
'nbfield']++;
2625 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2626 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2628 $totalarray[
'nbfield']++;
2629 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2631 if (empty($totalarray[
'val'][
'total_pa'])) {
2632 $totalarray[
'val'][
'total_pa'] = 0;
2634 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2637 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2638 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2640 $totalarray[
'nbfield']++;
2641 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2643 if (empty($totalarray[
'val'][
'total_margin'])) {
2644 $totalarray[
'val'][
'total_margin'] = 0;
2646 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2649 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2650 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2652 $totalarray[
'nbfield']++;
2656 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2657 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2659 $totalarray[
'nbfield']++;
2660 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2662 if ($i >= $imaxinloop - 1) {
2663 if (!empty($total_ht)) {
2664 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2666 $totalarray[
'val'][
'total_mark_rate'] =
'';
2672 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2674 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2675 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2676 print $hookmanager->resPrint;
2678 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2679 print
'<td class="nowraponall center">';
2680 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2683 $totalarray[
'nbfield']++;
2687 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2688 print
'<td class="nowraponall center">';
2689 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2692 $totalarray[
'nbfield']++;
2696 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2697 print
'<td class="nowraponall center">';
2698 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2701 $totalarray[
'nbfield']++;
2705 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2706 print
'<td class="sensiblehtmlcontent center">';
2710 $totalarray[
'nbfield']++;
2714 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2715 print
'<td class="center">';
2719 $totalarray[
'nbfield']++;
2723 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2724 print
'<td class="center">';
2725 if (!empty($obj->fk_fac_rec_source)) {
2727 $result = $facrec->fetch($obj->fk_fac_rec_source);
2731 print $facrec->getNomUrl();
2736 $totalarray[
'nbfield']++;
2740 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2741 print
'<td class="nowrap center">';
2742 print $facturestatic->getLibStatut(5, $totalallpayments);
2745 $totalarray[
'nbfield']++;
2752 print
'<td class="nowrap center">';
2753 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2755 if (in_array($obj->id, $arrayofselected)) {
2758 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2762 $totalarray[
'nbfield']++;
2773 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2774 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2777 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2783 foreach ($arrayfields as $key => $val) {
2784 if (!empty($val[
'checked'])) {
2788 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2793$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2794$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2795print $hookmanager->resPrint;
2797print
'</table>'.
"\n";
2800print
'</form>'.
"\n";
2803if ($contextpage !=
'poslist') {
2804 $hidegeneratedfilelistifempty = 1;
2805 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2806 $hidegeneratedfilelistifempty = 0;
2810 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2811 $urlsource .= str_replace(
'&',
'&', $param);
2813 $filedir = $diroutputmassaction;
2814 $genallowed = $user->hasRight(
"facture",
"lire");
2815 $delallowed = $user->hasRight(
"facture",
"creer");
2818 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.
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.