46require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50if (isModEnabled(
'margin')) {
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
64if (isModEnabled(
'order')) {
65 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
78$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
80$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
86$action =
GETPOST(
'action',
'aZ09');
87$massaction =
GETPOST(
'massaction',
'alpha');
89$confirm =
GETPOST(
'confirm',
'alpha');
90$toselect =
GETPOST(
'toselect',
'array');
91$optioncss =
GETPOST(
'optioncss',
'alpha');
92$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
95if ($contextpage ==
'poslist') {
101$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
102$search_type =
GETPOST(
'search_type',
'intcomma');
103$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
104$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
105$search_project =
GETPOST(
'search_project',
'alpha');
106$search_company =
GETPOST(
'search_company',
'alpha');
107$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
108$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
109$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
110$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
111$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
112$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
113$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
114$search_login =
GETPOST(
'search_login',
'alpha');
115$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
116$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
117$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
118$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
119$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
120$search_status =
GETPOST(
'search_status',
'intcomma');
121$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
122$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
123$search_module_source =
GETPOST(
'search_module_source',
'alpha');
124$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
125$search_town =
GETPOST(
'search_town',
'alpha');
126$search_zip =
GETPOST(
'search_zip',
'alpha');
127$search_state =
GETPOST(
"search_state");
128$search_country =
GETPOST(
"search_country",
'aZ09');
129$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
130$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
131$search_user =
GETPOST(
'search_user',
'intcomma');
132$search_sale =
GETPOST(
'search_sale',
'intcomma');
133$search_date_startday =
GETPOSTINT(
'search_date_startday');
134$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
135$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
136$search_date_endday =
GETPOSTINT(
'search_date_endday');
137$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
138$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
139$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
140$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
141$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
142$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
143$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
144$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
145$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
146$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
147$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
148$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
149$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
150$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
151$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
152$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
153$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
154$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
155$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
156$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
157$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
158$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
159$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
160$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
161$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
163$search_option =
GETPOST(
'search_option');
164if ($search_option ==
'late') {
165 $search_status =
'1';
169$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
170$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
172if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
175$offset = $limit * $page;
176if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
183 $sortfield =
'f.datef';
185$pageprev = $page - 1;
186$pagenext = $page + 1;
188$diroutputmassaction =
$conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
195$hookmanager->initHooks(array($contextpage));
199$extrafields->fetch_name_optionals_label(
$object->table_element);
201$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
204$fieldstosearchall = array(
206 'f.ref_client' =>
'RefCustomer',
207 'f.note_public' =>
'NotePublic',
208 's.nom' =>
"ThirdParty",
209 's.code_client' =>
"CustomerCodeShort",
210 's.name_alias' =>
"AliasNameShort",
213 'pd.description' =>
'Description',
215if (empty($user->socid)) {
216 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
219$checkedtypetiers = 0;
221 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
222 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1,
'position' => 10),
223 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
224 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
225 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 20),
226 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' => 0,
'position' => 22),
227 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 25),
228 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 30),
229 'p.ref' => array(
'label' =>
"ProjectRef",
'langfile' =>
'projects',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 40),
230 'p.title' => array(
'label' =>
"ProjectLabel",
'langfile' =>
'projects',
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 41),
231 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 50),
232 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 51),
233 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' => -1,
'position' => 52),
234 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
235 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 55),
236 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 60),
237 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 65),
238 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 70),
239 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
240 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 80),
241 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 85),
242 'f.module_source' => array(
'label' =>
"POSModule",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 90),
243 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 91),
244 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 95),
245 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 100),
246 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
247 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
248 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 130),
249 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' => 0,
'position' => 140),
250 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' => 0,
'position' => 150),
251 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 280),
252 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 285),
253 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 290),
254 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 291),
255 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 292),
256 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 295),
257 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'enabled' => (!isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 296),
258 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
259 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
260 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
261 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
262 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
263 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 502),
264 'u.login' => array(
'label' =>
"UserAuthor",
'checked' => 1,
'visible' => -1,
'position' => 504),
265 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 506),
270 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
271 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
272 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' => 0,
'position' => 530,
'enabled' =>
'1'),
273 'f.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
274 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
278 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' => 0,
'position' => 86);
281$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
282if (empty($subtypearray)) {
283 unset($arrayfields[
'f.subtype']);
287foreach (
$object->fields as $key => $val) {
290 if (!empty($val[
'visible'])) {
291 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
293 if (array_key_exists($key, $arrayfields)) {
295 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
297 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
301 $arrayfields[$newkey] = array(
302 'label' => $val[
'label'],
303 'checked' => (($visible < 0) ? 0 : 1),
304 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
305 'position' => $val[
'position'],
306 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
312include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
317'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
320if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
321 $search_sale = $user->id;
325$fieldid = (!empty($ref) ?
'ref' :
'rowid');
326if (!empty($user->socid)) {
327 $socid = $user->socid;
329if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
330 $search_sale = $user->id;
340if (
GETPOST(
'cancel',
'alpha')) {
344if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
348$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
349$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
354include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
357if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
360 $search_product_category =
'';
362 $search_refcustomer =
'';
364 $search_subtype =
'';
365 $search_project_ref =
'';
366 $search_project =
'';
367 $search_company =
'';
368 $search_company_alias =
'';
369 $search_parent_name =
'';
370 $search_montant_ht =
'';
371 $search_montant_vat =
'';
372 $search_montant_localtax1 =
'';
373 $search_montant_localtax2 =
'';
374 $search_montant_ttc =
'';
376 $search_multicurrency_code =
'';
377 $search_multicurrency_tx =
'';
378 $search_multicurrency_montant_ht =
'';
379 $search_multicurrency_montant_vat =
'';
380 $search_multicurrency_montant_ttc =
'';
382 $search_paymentmode =
'';
383 $search_paymentterms =
'';
384 $search_module_source =
'';
385 $search_pos_source =
'';
389 $search_country =
'';
390 $search_type_thirdparty =
'';
391 $search_customer_code =
'';
392 $search_date_startday =
'';
393 $search_date_startmonth =
'';
394 $search_date_startyear =
'';
395 $search_date_endday =
'';
396 $search_date_endmonth =
'';
397 $search_date_endyear =
'';
398 $search_date_start =
'';
399 $search_date_end =
'';
400 $search_date_valid_startday =
'';
401 $search_date_valid_startmonth =
'';
402 $search_date_valid_startyear =
'';
403 $search_date_valid_endday =
'';
404 $search_date_valid_endmonth =
'';
405 $search_date_valid_endyear =
'';
406 $search_date_valid_start =
'';
407 $search_date_valid_end =
'';
408 $search_datelimit_startday =
'';
409 $search_datelimit_startmonth =
'';
410 $search_datelimit_startyear =
'';
411 $search_datelimit_endday =
'';
412 $search_datelimit_endmonth =
'';
413 $search_datelimit_endyear =
'';
414 $search_datelimit_start =
'';
415 $search_datelimit_end =
'';
416 $search_fac_rec_source_title =
'';
418 $search_import_key =
'';
419 $search_categ_cus = 0;
423 $search_array_options = array();
426if (empty($reshook)) {
427 $objectclass =
'Facture';
428 $objectlabel =
'Invoices';
429 $permissiontoread = $user->hasRight(
"facture",
"lire");
430 $permissiontoadd = $user->hasRight(
"facture",
"creer");
431 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
432 $uploaddir =
$conf->facture->dir_output;
433 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
436if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
437 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
438 $arrayofselected = is_array($toselect) ? $toselect : array();
439 if (!empty($arrayofselected)) {
443 if (empty($paiementdate)) {
444 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
446 $action =
'makepayment';
450 foreach ($arrayofselected as $toselectid) {
453 $result = $facture->fetch($toselectid);
462 $paiementAmount = $facture->getSommePaiement();
463 $totalcreditnotes = $facture->getSumCreditNotesUsed();
464 $totaldeposits = $facture->getSumDepositsUsed();
466 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
467 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
470 $parameters = array(
'remaintopay' => $remaintopay);
471 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
473 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
474 $remaintopay = $remain;
476 } elseif ($reshook < 0) {
478 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
481 if ($remaintopay != 0) {
482 $resultBank = $facture->setBankAccount($bankid);
483 if ($resultBank < 0) {
488 $paiement->datepaye = $paiementdate;
489 $paiement->amounts[$facture->id] = $remaintopay;
490 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
491 $paiement->paiementid = $paiementid;
492 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
493 if ($paiement_id < 0) {
494 $langs->load(
"errors");
495 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
498 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
500 $langs->load(
"errors");
501 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
507 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
511 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
516 if (empty($errorpayment)) {
517 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
525} elseif ($massaction ==
'withdrawrequest') {
526 $langs->load(
"withdrawals");
528 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
535 $arrayofselected = is_array($toselect) ? $toselect : array();
536 $listofbills = array();
537 foreach ($arrayofselected as $toselectid) {
539 $result = $objecttmp->fetch($toselectid);
541 $totalpaid = $objecttmp->getSommePaiement();
542 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
543 $totaldeposits = $objecttmp->getSumDepositsUsed();
544 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
547 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
548 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
550 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
551 $objecttmp->resteapayer = $remaintopay;
553 } elseif ($reshook < 0) {
555 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
560 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
561 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
563 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
564 } elseif ($objecttmp->resteapayer < 0) {
566 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
569 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
570 $rsql .=
" , pfd.date_traite as date_traite";
571 $rsql .=
" , pfd.amount";
572 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
573 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
574 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
575 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
576 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
577 $rsql .=
" AND pfd.traite = 0";
578 $rsql .=
" ORDER BY pfd.date_demande DESC";
580 $result_sql = $db->query($rsql);
582 $numprlv = $db->num_rows($result_sql);
589 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
590 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
591 $langs->load(
"errors");
593 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
595 $listofbills[] = $objecttmp;
601 if (!empty($listofbills)) {
602 $nbwithdrawrequestok = 0;
603 foreach ($listofbills as $aBill) {
605 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
608 $nbwithdrawrequestok++;
614 if ($nbwithdrawrequestok > 0) {
615 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
627$form =
new Form($db);
631if (isModEnabled(
'margin')) {
634$facturestatic =
new Facture($db);
636$companystatic =
new Societe($db);
637$companyparent =
new Societe($db);
639$company_url_list = array();
644 if (empty($search_company)) {
645 $search_company = $soc->name;
651$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
652$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
654$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
655$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
661 $sql =
'SELECT DISTINCT';
663$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,';
664$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
665$sql .=
' f.fk_user_author,';
666$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,';
667$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
668$sql .=
' f.paye as paye, f.fk_statut, f.import_key, f.close_code,';
669$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
670$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
671$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,';
672$sql .=
" s.parent as fk_parent,";
673$sql .=
" s2.nom as name2,";
674$sql .=
' typent.code as typent_code,';
675$sql .=
' state.code_departement as state_code, state.nom as state_name,';
676$sql .=
' country.code as country_code,';
677$sql .=
' f.fk_fac_rec_source,';
678$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
679$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';
689if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
690 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
691 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
695$parameters = array();
696$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
697$sql .= $hookmanager->resPrint;
698$sql = preg_replace(
'/,\s*$/',
'', $sql);
702$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
703$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
704$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
705$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
706$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
707$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
708if ($sortfield ==
"f.datef") {
709 $sql .= $db->hintindex(
'idx_facture_datef');
711if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
712 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
715 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
717if (!empty($search_fac_rec_source_title)) {
718 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
720$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
721$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
723$parameters = array();
724$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
725$sql .= $hookmanager->resPrint;
727$sql .=
' WHERE f.fk_soc = s.rowid';
728$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
730 $sql .=
' AND s.rowid = '.((int) $socid);
734 $sql .=
' AND f.fk_user_author IS NULL';
736 $sql .=
' AND f.fk_user_author = '.((int) $userid);
742if ($search_refcustomer) {
745if ($search_type !=
'' && $search_type !=
'-1') {
746 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
748if ($search_subtype !=
'' && $search_subtype !=
'-1') {
749 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
751if ($search_project_ref) {
754if ($search_project) {
757if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
758 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
760 if ($search_company) {
763 if ($search_company_alias) {
767if ($search_parent_name) {
770if ($search_customer_code) {
782if (strlen(trim($search_country))) {
784 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
785 foreach ($arrayofcode as $key => $value) {
786 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
787 if ($value != $mysoc->country_code) {
788 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
791 if ($search_country ==
'special_allnotme') {
792 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
793 } elseif ($search_country ==
'special_eec') {
794 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
795 } elseif ($search_country ==
'special_eecnotme') {
796 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
797 } elseif ($search_country ==
'special_noteec') {
798 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
803if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
804 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
806if ($search_montant_ht !=
'') {
809if ($search_montant_vat !=
'') {
812if ($search_montant_localtax1 !=
'') {
813 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
815if ($search_montant_localtax2 !=
'') {
816 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
818if ($search_montant_ttc !=
'') {
821if ($search_multicurrency_code !=
'') {
822 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
824if ($search_multicurrency_tx !=
'') {
825 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
827if ($search_multicurrency_montant_ht !=
'') {
828 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
830if ($search_multicurrency_montant_vat !=
'') {
831 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
833if ($search_multicurrency_montant_ttc !=
'') {
834 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
837 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
839if ($search_status !=
'-1' && $search_status !=
'') {
840 if (is_numeric($search_status) && $search_status >= 0) {
841 if ($search_status ==
'0') {
842 $sql .=
" AND f.fk_statut = 0";
844 if ($search_status ==
'1') {
845 $sql .=
" AND f.fk_statut = 1";
847 if ($search_status ==
'2') {
848 $sql .=
" AND f.fk_statut = 2";
850 if ($search_status ==
'3') {
851 $sql .=
" AND f.fk_statut = 3";
854 $sql .=
" AND f.fk_statut IN (".$db->sanitize($search_status).
")";
858if ($search_paymentmode > 0) {
859 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
861if ($search_paymentterms > 0) {
862 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
864if ($search_module_source) {
867if ($search_pos_source) {
870if ($search_date_start) {
871 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
873if ($search_date_end) {
874 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
876if ($search_date_valid_start) {
877 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
879if ($search_date_valid_end) {
880 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
882if ($search_datelimit_start) {
883 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
885if ($search_datelimit_end) {
886 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
888if ($search_option ==
'late') {
889 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->facture->client->warning_delay).
"'";
894if (!empty($search_fac_rec_source_title)) {
895 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
897if ($search_fk_fac_rec_source) {
898 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
900if ($search_import_key) {
904if ($search_user > 0) {
905 $sql .=
" AND EXISTS (";
906 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
907 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
908 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
909 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
910 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
913if ($search_sale && $search_sale !=
'-1') {
914 if ($search_sale == -2) {
915 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
916 } elseif ($search_sale > 0) {
917 $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).
")";
921$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
922$searchCategoryProductOperator = 0;
923if (!empty($searchCategoryProductList)) {
924 $searchCategoryProductSqlList = array();
925 $listofcategoryid =
'';
926 foreach ($searchCategoryProductList as $searchCategoryProduct) {
927 if (intval($searchCategoryProduct) == -2) {
928 $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)";
929 } elseif (intval($searchCategoryProduct) > 0) {
930 if ($searchCategoryProductOperator == 0) {
931 $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).
")";
933 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
937 if ($listofcategoryid) {
938 $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).
"))";
940 if ($searchCategoryProductOperator == 1) {
941 if (!empty($searchCategoryProductSqlList)) {
942 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
945 if (!empty($searchCategoryProductSqlList)) {
946 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
950$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
951$searchCategoryCustomerOperator = 0;
953if (!empty($searchCategoryCustomerList)) {
954 $searchCategoryCustomerSqlList = array();
955 $listofcategoryid =
'';
956 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
957 if (intval($searchCategoryCustomer) == -2) {
958 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
959 } elseif (intval($searchCategoryCustomer) > 0) {
960 if ($searchCategoryCustomerOperator == 0) {
961 $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).
")";
963 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
967 if ($listofcategoryid) {
968 $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).
"))";
970 if ($searchCategoryCustomerOperator == 1) {
971 if (!empty($searchCategoryCustomerSqlList)) {
972 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
975 if (!empty($searchCategoryCustomerSqlList)) {
976 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
981include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
983$parameters = array();
984$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
985$sql .= $hookmanager->resPrint;
988 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
992$parameters = array();
993$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
994$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
997$nbtotalofrecords =
'';
1000 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1001 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1003 $resql = $db->query($sqlforcount);
1005 $objforcount = $db->fetch_object($resql);
1006 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1011 if (($page * $limit) > $nbtotalofrecords) {
1019$sql .= $db->order($sortfield, $sortorder);
1021 $sql .= $db->plimit($limit + 1, $offset);
1024$resql = $db->query($sql);
1030$num = $db->num_rows($resql);
1032$arrayofselected = is_array($toselect) ? $toselect : array();
1034if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1035 $obj = $db->fetch_object($resql);
1038 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1045llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
1047if ($search_fk_fac_rec_source) {
1049 $object->fetch((
int) $search_fk_fac_rec_source);
1053 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1057$param =
'&socid='.urlencode((
string) ($socid));
1059 $param .=
'&mode='.urlencode($mode);
1061if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1062 $param .=
'&contextpage='.urlencode($contextpage);
1064if ($limit > 0 && $limit !=
$conf->liste_limit) {
1065 $param .=
'&limit='.((int) $limit);
1067if ($optioncss !=
'') {
1068 $param .=
'&optioncss='.urlencode($optioncss);
1071 $param .=
'&show_files='.urlencode((
string) ($show_files));
1074 $param .=
'&search_all='.urlencode($search_all);
1076if ($search_date_startday) {
1077 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1079if ($search_date_startmonth) {
1080 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1082if ($search_date_startyear) {
1083 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1085if ($search_date_endday) {
1086 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1088if ($search_date_endmonth) {
1089 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1091if ($search_date_endyear) {
1092 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1094if ($search_date_valid_startday) {
1095 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1097if ($search_date_valid_startmonth) {
1098 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1100if ($search_date_valid_startyear) {
1101 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1103if ($search_date_valid_endday) {
1104 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1106if ($search_date_valid_endmonth) {
1107 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1109if ($search_date_valid_endyear) {
1110 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1112if ($search_datelimit_startday) {
1113 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1115if ($search_datelimit_startmonth) {
1116 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1118if ($search_datelimit_startyear) {
1119 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1121if ($search_datelimit_endday) {
1122 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1124if ($search_datelimit_endmonth) {
1125 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1127if ($search_datelimit_endyear) {
1128 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1131 $param .=
'&search_ref='.urlencode($search_ref);
1133if ($search_refcustomer) {
1134 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1136if ($search_project_ref) {
1137 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1139if ($search_project) {
1140 $param .=
'&search_project='.urlencode($search_project);
1142if ($search_type !=
'') {
1143 $param .=
'&search_type='.urlencode($search_type);
1145if ($search_subtype !=
'') {
1146 $param .=
'&search_subtype='.urlencode($search_subtype);
1148if ($search_company) {
1149 $param .=
'&search_company='.urlencode($search_company);
1151if ($search_company_alias) {
1152 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1154if ($search_parent_name !=
'') {
1155 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1158 $param .=
'&search_town='.urlencode($search_town);
1161 $param .=
'&search_zip='.urlencode($search_zip);
1163if ($search_country) {
1164 $param .=
"&search_country=".urlencode($search_country);
1166if ($search_type_thirdparty !=
'') {
1167 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1169if ($search_customer_code) {
1170 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1172if ($search_sale > 0) {
1173 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1175if ($search_user > 0) {
1176 $param .=
'&search_user='.urlencode((
string) $search_user);
1179 $param .=
'&search_login='.urlencode($search_login);
1181if ($search_product_category > 0) {
1182 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1184if ($search_montant_ht !=
'') {
1185 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1187if ($search_montant_vat !=
'') {
1188 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1190if ($search_montant_localtax1 !=
'') {
1191 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1193if ($search_montant_localtax2 !=
'') {
1194 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1196if ($search_montant_ttc !=
'') {
1197 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1199if ($search_multicurrency_code !=
'') {
1200 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1202if ($search_multicurrency_tx !=
'') {
1203 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1205if ($search_multicurrency_montant_ht !=
'') {
1206 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1208if ($search_multicurrency_montant_vat !=
'') {
1209 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1211if ($search_multicurrency_montant_ttc !=
'') {
1212 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1214if ($search_status !=
'') {
1215 $param .=
'&search_status='.urlencode($search_status);
1217if ($search_paymentmode > 0) {
1218 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1220if ($search_paymentterms > 0) {
1221 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1223if ($search_module_source) {
1224 $param .=
'&search_module_source='.urlencode($search_module_source);
1226if ($search_pos_source) {
1227 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1229if ($search_option) {
1230 $param .=
"&search_option=".urlencode($search_option);
1232if ($search_categ_cus > 0) {
1233 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1235if (!empty($search_fac_rec_source_title)) {
1236 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1238if ($search_fk_fac_rec_source) {
1239 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1241if ($search_import_key !=
'') {
1242 $param .=
'&search_import_key='.urlencode($search_import_key);
1246include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1248$parameters = array(
'param' => &$param);
1249$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1250$param .= $hookmanager->resPrint;
1252$arrayofmassactions = array(
1253 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1254 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1255 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1256 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1259if ($user->hasRight(
'facture',
'paiement')) {
1260 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1262if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1263 $langs->load(
"withdrawals");
1264 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1266if ($user->hasRight(
'facture',
'supprimer')) {
1268 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1270 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1273if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1274 $arrayofmassactions = array();
1276$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1280if ($contextpage !=
'poslist') {
1281 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1283 $url .=
'&socid='.urlencode((
string)
$object->socid);
1286 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1288 $newcardbutton =
'';
1289 $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'));
1290 $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'));
1292 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1296print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1297if ($optioncss !=
'') {
1298 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1300print
'<input type="hidden" name="token" value="'.newToken().
'">';
1301print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1302if (!in_array($massaction, array(
'makepayment'))) {
1303 print
'<input type="hidden" name="action" value="list">';
1305print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1306print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1307print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1308print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1309print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1310print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1312print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1314$topicmail =
"SendBillRef";
1315$modelmail =
"facture_send";
1317$trackid =
'inv'.$object->id;
1318include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1320if ($massaction ==
'makepayment') {
1322 $formquestion = array(
1326 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1327 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1328 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1331 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1336 foreach ($fieldstosearchall as $key => $val) {
1337 $fieldstosearchall[$key] = $langs->trans($val);
1339 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1344if ($user->hasRight(
"user",
"user",
"lire")) {
1345 $langs->load(
"commercial");
1346 $moreforfilter .=
'<div class="divsearchfield">';
1347 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1348 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1349 $moreforfilter .=
'</div>';
1352if ($user->hasRight(
"user",
"user",
"lire")) {
1353 $moreforfilter .=
'<div class="divsearchfield">';
1354 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1355 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1356 $moreforfilter .=
'</div>';
1359if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1360 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1361 $moreforfilter .=
'<div class="divsearchfield">';
1362 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1363 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1364 $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);
1365 $moreforfilter .=
'</div>';
1367if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1368 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1369 $moreforfilter .=
'<div class="divsearchfield">';
1370 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1371 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1372 $moreforfilter .=
'</div>';
1375$moreforfilter .=
'<div class="divsearchfield">';
1376$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1377$moreforfilter .=
'</div>';
1379$parameters = array();
1380$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1381if (empty($reshook)) {
1382 $moreforfilter .= $hookmanager->resPrint;
1384 $moreforfilter = $hookmanager->resPrint;
1387if (!empty($moreforfilter)) {
1388 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1389 print $moreforfilter;
1393$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1394$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1397if ($massactionbutton && $contextpage !=
'poslist') {
1398 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1401print
'<div class="div-table-responsive">';
1402print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1406print
'<tr class="liste_titre_filter">';
1410 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1411 $searchpicto = $form->showFilterButtons(
'left');
1417 print
'<td class="liste_titre">';
1421if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1422 print
'<td class="liste_titre">';
1423 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1427if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1428 print
'<td class="liste_titre">';
1429 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1433if (!empty($arrayfields[
'f.type'][
'checked'])) {
1434 print
'<td class="liste_titre maxwidthonsmartphone">';
1446 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1450if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1451 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1452 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1456if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1457 print
'<td class="liste_titre center">';
1458 print
'<div class="nowrapfordate">';
1459 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1461 print
'<div class="nowrapfordate">';
1462 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1467if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1468 print
'<td class="liste_titre center">';
1469 print
'<div class="nowrapfordate">';
1470 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'));
1472 print
'<div class="nowrapfordate">';
1473 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'));
1478if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1479 print
'<td class="liste_titre center">';
1480 print
'<div class="nowrapfordate">';
1481 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1483 print
'<div class="nowrapfordate">';
1484 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1489if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1490 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1493if (!empty($arrayfields[
'p.title'][
'checked'])) {
1494 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1497if (!empty($arrayfields[
's.nom'][
'checked'])) {
1498 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1501if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1502 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1505if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1506 print
'<td class="liste_titre">';
1507 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1511if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1512 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1515if (!empty($arrayfields[
's.town'][
'checked'])) {
1516 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1519if (!empty($arrayfields[
's.zip'][
'checked'])) {
1520 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1523if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1524 print
'<td class="liste_titre">';
1525 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1529if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1530 print
'<td class="liste_titre center">';
1531 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1535if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1536 print
'<td class="liste_titre maxwidthonsmartphone center">';
1537 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);
1541if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1542 print
'<td class="liste_titre">';
1543 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1547if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1548 print
'<td class="liste_titre left">';
1549 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1553if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1554 print
'<td class="liste_titre">';
1555 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1559if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1560 print
'<td class="liste_titre">';
1561 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1564if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1566 print
'<td class="liste_titre right">';
1567 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1570if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1572 print
'<td class="liste_titre right">';
1573 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1576if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1578 print
'<td class="liste_titre right">';
1579 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1582if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1584 print
'<td class="liste_titre right">';
1585 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1588if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1590 print
'<td class="liste_titre right">';
1591 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1594if (!empty($arrayfields[
'u.login'][
'checked'])) {
1596 print
'<td class="liste_titre" align="center">';
1597 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1600if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1601 print
'<td class="liste_titre"></td>';
1603if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1604 print
'<td class="liste_titre" align="right">';
1607if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1608 print
'<td class="liste_titre right">';
1611if (!empty($arrayfields[
'rtp'][
'checked'])) {
1612 print
'<td class="liste_titre">';
1615if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1617 print
'<td class="liste_titre">';
1618 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1621if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1623 print
'<td class="liste_titre">';
1624 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1627if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1629 print
'<td class="liste_titre right">';
1630 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1633if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1635 print
'<td class="liste_titre right">';
1636 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1639if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1641 print
'<td class="liste_titre right">';
1642 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1645if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1649if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1650 print
'<td class="liste_titre right">';
1653if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1654 print
'<td class="liste_titre right">';
1657if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1658 print
'<td class="liste_titre right">';
1661if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1662 print
'<td class="liste_titre right">';
1665if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1666 print
'<td class="liste_titre right">';
1671include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1674$parameters = array(
'arrayfields' => $arrayfields);
1675$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1676print $hookmanager->resPrint;
1678if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1679 print
'<td class="liste_titre">';
1683if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1684 print
'<td class="liste_titre">';
1688if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1689 print
'<td class="liste_titre">';
1692if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1694 print
'<td class="liste_titre">';
1697if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1699 print
'<td class="liste_titre">';
1702if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1704 print
'<td class="liste_titre maxwidthonsmartphone right">';
1705 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).
'">';
1709if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1710 print
'<td class="liste_titre maxwidthonsmartphone center">';
1711 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1715if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1716 print
'<td class="liste_titre center parentonrightofpage">';
1717 $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"));
1719 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1724 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1725 $searchpicto = $form->showFilterButtons();
1731$totalarray = array();
1732$totalarray[
'nbfield'] = 0;
1736print
'<tr class="liste_titre">';
1738 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1739 $totalarray[
'nbfield']++;
1743 $totalarray[
'nbfield']++;
1745if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1746 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1747 $totalarray[
'nbfield']++;
1749if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1750 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1751 $totalarray[
'nbfield']++;
1753if (!empty($arrayfields[
'f.type'][
'checked'])) {
1754 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1755 $totalarray[
'nbfield']++;
1757if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1758 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1760if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1762 $totalarray[
'nbfield']++;
1764if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1766 $totalarray[
'nbfield']++;
1768if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1770 $totalarray[
'nbfield']++;
1772if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1773 $langs->load(
"projects");
1774 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1775 $totalarray[
'nbfield']++;
1777if (!empty($arrayfields[
'p.title'][
'checked'])) {
1778 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1779 $totalarray[
'nbfield']++;
1781if (!empty($arrayfields[
's.nom'][
'checked'])) {
1782 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1783 $totalarray[
'nbfield']++;
1785if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1787 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1788 $totalarray[
'nbfield']++;
1790if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1791 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1792 $totalarray[
'nbfield']++;
1794if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1795 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1796 $totalarray[
'nbfield']++;
1798if (!empty($arrayfields[
's.town'][
'checked'])) {
1799 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1800 $totalarray[
'nbfield']++;
1802if (!empty($arrayfields[
's.zip'][
'checked'])) {
1803 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1804 $totalarray[
'nbfield']++;
1806if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1807 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1808 $totalarray[
'nbfield']++;
1810if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1811 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1812 $totalarray[
'nbfield']++;
1814if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1815 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1816 $totalarray[
'nbfield']++;
1818if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1819 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1820 $totalarray[
'nbfield']++;
1822if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1824 $totalarray[
'nbfield']++;
1826if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1827 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1828 $totalarray[
'nbfield']++;
1830if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1831 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1832 $totalarray[
'nbfield']++;
1834if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1835 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1836 $totalarray[
'nbfield']++;
1838if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1839 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1840 $totalarray[
'nbfield']++;
1842if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1843 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1844 $totalarray[
'nbfield']++;
1846if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1847 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1848 $totalarray[
'nbfield']++;
1850if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1851 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1852 $totalarray[
'nbfield']++;
1854if (!empty($arrayfields[
'u.login'][
'checked'])) {
1855 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1856 $totalarray[
'nbfield']++;
1858if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1859 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1860 $totalarray[
'nbfield']++;
1862if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1863 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1864 $totalarray[
'nbfield']++;
1866if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1867 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1868 $totalarray[
'nbfield']++;
1870if (!empty($arrayfields[
'rtp'][
'checked'])) {
1871 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1872 $totalarray[
'nbfield']++;
1874if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1875 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1876 $totalarray[
'nbfield']++;
1878if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1879 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1880 $totalarray[
'nbfield']++;
1882if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1883 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1884 $totalarray[
'nbfield']++;
1886if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1887 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1888 $totalarray[
'nbfield']++;
1890if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1891 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1892 $totalarray[
'nbfield']++;
1894if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1895 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1896 $totalarray[
'nbfield']++;
1898if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1899 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1900 $totalarray[
'nbfield']++;
1902if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1903 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1904 $totalarray[
'nbfield']++;
1906if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1907 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1908 $totalarray[
'nbfield']++;
1910if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1911 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1912 $totalarray[
'nbfield']++;
1914if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1915 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1916 $totalarray[
'nbfield']++;
1919include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1921$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1922$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1923print $hookmanager->resPrint;
1924if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1925 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1926 $totalarray[
'nbfield']++;
1928if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1929 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1930 $totalarray[
'nbfield']++;
1932if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1933 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1934 $totalarray[
'nbfield']++;
1936if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1937 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1938 $totalarray[
'nbfield']++;
1940if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1941 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1942 $totalarray[
'nbfield']++;
1944if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1945 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1946 $totalarray[
'nbfield']++;
1949if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1950 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1951 $totalarray[
'nbfield']++;
1954if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1955 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1956 $totalarray[
'nbfield']++;
1959 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1960 $totalarray[
'nbfield']++;
1965$projectstatic =
new Project($db);
1967$userstatic =
new User($db);
1973 $savnbfield = $totalarray[
'nbfield'];
1974 $totalarray = array();
1975 $totalarray[
'nbfield'] = 0;
1976 $totalarray[
'val'] = array();
1977 $totalarray[
'val'][
'f.total_ht'] = 0;
1978 $totalarray[
'val'][
'f.total_tva'] = 0;
1979 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1980 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1981 $totalarray[
'val'][
'f.total_ttc'] = 0;
1982 $totalarray[
'val'][
'dynamount_payed'] = 0;
1983 $totalarray[
'val'][
'rtp'] = 0;
1985 $typenArray = $formcompany->typent_array(1);
1987 $with_margin_info =
false;
1988 if (isModEnabled(
'margin') && (
1989 !empty($arrayfields[
'total_pa'][
'checked'])
1990 || !empty($arrayfields[
'total_margin'][
'checked'])
1991 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1992 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1995 $with_margin_info =
true;
2000 $imaxinloop = ($limit ? min($num, $limit) : $num);
2001 while ($i < $imaxinloop) {
2002 $obj = $db->fetch_object($resql);
2004 $datelimit = $db->jdate($obj->datelimite);
2006 $facturestatic->id = $obj->id;
2007 $facturestatic->ref = $obj->ref;
2008 $facturestatic->ref_client = $obj->ref_client;
2009 $facturestatic->ref_customer = $obj->ref_client;
2010 $facturestatic->type = $obj->type;
2011 $facturestatic->subtype = $obj->subtype;
2012 $facturestatic->total_ht = $obj->total_ht;
2013 $facturestatic->total_tva = $obj->total_tva;
2014 $facturestatic->total_ttc = $obj->total_ttc;
2015 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2016 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2017 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2018 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2019 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2020 $facturestatic->statut = $obj->fk_statut;
2021 $facturestatic->status = $obj->fk_statut;
2022 $facturestatic->close_code = $obj->close_code;
2023 $facturestatic->total_ttc = $obj->total_ttc;
2024 $facturestatic->paye = $obj->paye;
2025 $facturestatic->socid = $obj->fk_soc;
2027 $facturestatic->date = $db->jdate($obj->datef);
2028 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2029 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2031 $facturestatic->note_public = $obj->note_public;
2032 $facturestatic->note_private = $obj->note_private;
2035 $facturestatic->retained_warranty = $obj->retained_warranty;
2036 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2037 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2038 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2039 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2040 $facturestatic->situation_counter = $obj->situation_counter;
2043 $companystatic->id = $obj->socid;
2044 $companystatic->name = $obj->name;
2045 $companystatic->name_alias = $obj->alias;
2046 $companystatic->client = $obj->client;
2047 $companystatic->fournisseur = $obj->fournisseur;
2048 $companystatic->code_client = $obj->code_client;
2049 $companystatic->code_compta_client = $obj->code_compta_client;
2050 $companystatic->code_fournisseur = $obj->code_fournisseur;
2051 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2052 $companystatic->email = $obj->email;
2053 $companystatic->phone = $obj->phone;
2054 $companystatic->fax = $obj->fax;
2055 $companystatic->address = $obj->address;
2056 $companystatic->zip = $obj->zip;
2057 $companystatic->town = $obj->town;
2058 $companystatic->country_code = $obj->country_code;
2060 $projectstatic->id = $obj->project_id;
2061 $projectstatic->ref = $obj->project_ref;
2062 $projectstatic->title = $obj->project_label;
2064 $paiement = $facturestatic->getSommePaiement();
2065 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2066 $totaldeposits = $facturestatic->getSumDepositsUsed();
2067 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2068 $remaintopay = $obj->total_ttc - $totalallpayments;
2070 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2071 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2072 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2074 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2075 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2077 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2078 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2082 $multicurrency_remaintopay = 0;
2085 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2086 $remaintopay = -$remaincreditnote;
2087 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2088 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2089 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2090 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2093 $facturestatic->alreadypaid = $paiement;
2094 $facturestatic->totalpaid = $paiement;
2095 $facturestatic->totalcreditnotes = $totalcreditnotes;
2096 $facturestatic->totaldeposits = $totaldeposits;
2098 $marginInfo = array();
2099 if ($with_margin_info) {
2100 $facturestatic->fetch_lines();
2101 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2102 $total_ht += $obj->total_ht;
2103 $total_margin += $marginInfo[
'total_margin'];
2108 if ($mode ==
'kanban') {
2110 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2111 print
'<div class="box-flex-container kanban">';
2114 if ($massactionbutton || $massaction) {
2116 if (in_array(
$object->id, $arrayofselected)) {
2121 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2122 print $facturestatic->getKanbanView(
'', $arraydata);
2123 if ($i == ($imaxinloop - 1)) {
2130 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2131 if ($contextpage ==
'poslist') {
2132 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2133 if (strpos($obj->ref, 'PROV
') !== false) {
2134 //If is a draft invoice, load var to be able to add products
2135 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2136 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2144 print
'<td class="nowrap center">';
2145 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2147 if (in_array($obj->id, $arrayofselected)) {
2150 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2154 $totalarray[
'nbfield']++;
2160 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2162 $totalarray[
'nbfield']++;
2167 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2168 print
'<td class="nowraponall">';
2170 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2172 print
'<td class="nobordernopadding nowraponall">';
2173 if ($contextpage ==
'poslist') {
2176 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2180 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2181 $filedir = $filepath.
'/'.$filename;
2183 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2184 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2191 $totalarray[
'nbfield']++;
2196 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2197 print
'<td class="nowrap tdoverflowmax200">';
2201 $totalarray[
'nbfield']++;
2206 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2207 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2208 print $facturestatic->getLibType(2);
2211 $totalarray[
'nbfield']++;
2216 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2218 if ($facturestatic->subtype > 0) {
2219 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2221 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2225 $totalarray[
'nbfield']++;
2230 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2231 print
'<td align="center" class="nowraponall">';
2235 $totalarray[
'nbfield']++;
2240 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2241 print
'<td align="center" class="nowraponall">';
2245 $totalarray[
'nbfield']++;
2250 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2251 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2252 if ($facturestatic->hasDelay()) {
2253 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2257 $totalarray[
'nbfield']++;
2262 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2263 print
'<td class="nocellnopadd nowraponall">';
2264 if ($obj->project_id > 0) {
2265 print $projectstatic->getNomUrl(1);
2269 $totalarray[
'nbfield']++;
2274 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2275 print
'<td class="nowraponall">';
2276 if ($obj->project_id > 0) {
2281 $totalarray[
'nbfield']++;
2286 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2287 print
'<td class="tdoverflowmax150">';
2288 if ($contextpage ==
'poslist') {
2291 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2295 $totalarray[
'nbfield']++;
2299 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2300 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2304 $totalarray[
'nbfield']++;
2308 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2309 print
'<td class="tdoverflowmax200">';
2310 if ($obj->fk_parent > 0) {
2311 if (!isset($company_url_list[$obj->fk_parent])) {
2312 $companyparent =
new Societe($db);
2313 $res = $companyparent->fetch($obj->fk_parent);
2315 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2318 if (isset($company_url_list[$obj->fk_parent])) {
2319 print $company_url_list[$obj->fk_parent];
2324 $totalarray[
'nbfield']++;
2328 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2329 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2333 $totalarray[
'nbfield']++;
2337 if (!empty($arrayfields[
's.town'][
'checked'])) {
2338 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2342 $totalarray[
'nbfield']++;
2346 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2347 print
'<td class="nowraponall">';
2351 $totalarray[
'nbfield']++;
2355 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2356 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2358 $totalarray[
'nbfield']++;
2362 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2363 $tmparray =
getCountry($obj->fk_pays,
'all');
2364 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2368 $totalarray[
'nbfield']++;
2372 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2373 if (!is_array($typenArray) || count($typenArray) == 0) {
2374 $typenArray = $formcompany->typent_array(1);
2376 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($typenArray[$obj->typent_code]).
'">';
2377 if (!empty($obj->typent_code)) {
2378 print $typenArray[$obj->typent_code];
2382 $totalarray[
'nbfield']++;
2386 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2387 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2388 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2390 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2391 print
$conf->cache[
'staff'][$obj->staff_code];
2394 $totalarray[
'nbfield']++;
2399 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2400 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2401 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2405 $totalarray[
'nbfield']++;
2410 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2411 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2412 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2416 $totalarray[
'nbfield']++;
2421 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2426 $totalarray[
'nbfield']++;
2431 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2436 $totalarray[
'nbfield']++;
2441 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2442 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2444 $totalarray[
'nbfield']++;
2447 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2449 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2452 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2453 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2455 $totalarray[
'nbfield']++;
2458 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2460 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2463 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2464 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2466 $totalarray[
'nbfield']++;
2469 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2471 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2474 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2475 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2477 $totalarray[
'nbfield']++;
2480 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2482 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2485 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2486 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2488 $totalarray[
'nbfield']++;
2491 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2493 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2496 $userstatic->id = $obj->fk_user_author;
2497 $userstatic->login = $obj->login;
2498 $userstatic->lastname = $obj->lastname;
2499 $userstatic->firstname = $obj->firstname;
2500 $userstatic->email = $obj->user_email;
2501 $userstatic->status = $obj->user_statut;
2502 $userstatic->entity = $obj->entity;
2503 $userstatic->photo = $obj->photo;
2504 $userstatic->office_phone = $obj->office_phone;
2505 $userstatic->office_fax = $obj->office_fax;
2506 $userstatic->user_mobile = $obj->user_mobile;
2507 $userstatic->job = $obj->job;
2508 $userstatic->gender = $obj->gender;
2511 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2512 print
'<td class="tdoverflowmax125">';
2513 if ($userstatic->id) {
2514 print $userstatic->getNomUrl(-1);
2520 $totalarray[
'nbfield']++;
2524 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2527 if ($obj->socid > 0) {
2528 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2529 if ($listsalesrepresentatives < 0) {
2532 $nbofsalesrepresentative = count($listsalesrepresentatives);
2533 if ($nbofsalesrepresentative > 6) {
2535 print $nbofsalesrepresentative;
2536 } elseif ($nbofsalesrepresentative > 0) {
2538 foreach ($listsalesrepresentatives as $val) {
2539 $userstatic->id = $val[
'id'];
2540 $userstatic->lastname = $val[
'lastname'];
2541 $userstatic->firstname = $val[
'firstname'];
2542 $userstatic->email = $val[
'email'];
2543 $userstatic->status = $val[
'statut'];
2544 $userstatic->entity = $val[
'entity'];
2545 $userstatic->photo = $val[
'photo'];
2546 $userstatic->login = $val[
'login'];
2547 $userstatic->office_phone = $val[
'office_phone'];
2548 $userstatic->office_fax = $val[
'office_fax'];
2549 $userstatic->user_mobile = $val[
'user_mobile'];
2550 $userstatic->job = $val[
'job'];
2551 $userstatic->gender = $val[
'gender'];
2553 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2555 if ($j < $nbofsalesrepresentative) {
2565 $totalarray[
'nbfield']++;
2569 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2570 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2572 $totalarray[
'nbfield']++;
2576 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2577 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2579 $totalarray[
'nbfield']++;
2582 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'dynamount_payed';
2584 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2588 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2589 print
'<td class="right nowraponall amount">';
2590 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2593 $totalarray[
'nbfield']++;
2596 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2598 $totalarray[
'val'][
'rtp'] += $remaintopay;
2603 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2604 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2606 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2612 $totalarray[
'nbfield']++;
2617 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2618 print
'<td class="nowraponall">';
2619 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2622 $totalarray[
'nbfield']++;
2626 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2627 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2629 $totalarray[
'nbfield']++;
2633 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2634 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2636 $totalarray[
'nbfield']++;
2640 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2641 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2643 $totalarray[
'nbfield']++;
2647 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2648 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2650 $totalarray[
'nbfield']++;
2655 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2656 print
'<td class="right nowraponall amount">';
2657 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2660 $totalarray[
'nbfield']++;
2665 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2666 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2668 $totalarray[
'nbfield']++;
2669 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2671 if (empty($totalarray[
'val'][
'total_pa'])) {
2672 $totalarray[
'val'][
'total_pa'] = 0;
2674 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2677 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2678 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2680 $totalarray[
'nbfield']++;
2681 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2683 if (empty($totalarray[
'val'][
'total_margin'])) {
2684 $totalarray[
'val'][
'total_margin'] = 0;
2686 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2689 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2690 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2692 $totalarray[
'nbfield']++;
2696 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2697 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2699 $totalarray[
'nbfield']++;
2700 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2702 if ($i >= $imaxinloop - 1) {
2703 if (!empty($total_ht)) {
2704 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2706 $totalarray[
'val'][
'total_mark_rate'] =
'';
2712 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2714 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2715 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2716 print $hookmanager->resPrint;
2718 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2719 print
'<td class="nowraponall center">';
2720 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2723 $totalarray[
'nbfield']++;
2727 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2728 print
'<td class="nowraponall center">';
2729 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2732 $totalarray[
'nbfield']++;
2736 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2737 print
'<td class="nowraponall center">';
2738 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2741 $totalarray[
'nbfield']++;
2745 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2746 print
'<td class="sensiblehtmlcontent center">';
2750 $totalarray[
'nbfield']++;
2754 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2755 print
'<td class="center">';
2759 $totalarray[
'nbfield']++;
2763 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2764 print
'<td class="center">';
2765 if (!empty($obj->fk_fac_rec_source)) {
2767 $result = $facrec->fetch($obj->fk_fac_rec_source);
2771 print $facrec->getNomUrl();
2776 $totalarray[
'nbfield']++;
2781 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2782 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2784 $totalarray[
'nbfield']++;
2789 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2790 print
'<td class="nowrap center">';
2791 print $facturestatic->getLibStatut(5, $totalallpayments);
2794 $totalarray[
'nbfield']++;
2801 print
'<td class="nowrap center">';
2802 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2804 if (in_array($obj->id, $arrayofselected)) {
2807 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2811 $totalarray[
'nbfield']++;
2822 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2823 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2826 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2832 foreach ($arrayfields as $key => $val) {
2833 if (!empty($val[
'checked'])) {
2837 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2842$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2843$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2844print $hookmanager->resPrint;
2846print
'</table>'.
"\n";
2849print
'</form>'.
"\n";
2852if ($contextpage !=
'poslist') {
2853 $hidegeneratedfilelistifempty = 1;
2854 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2855 $hidegeneratedfilelistifempty = 0;
2859 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2860 $urlsource .= str_replace(
'&',
'&', $param);
2862 $filedir = $diroutputmassaction;
2863 $genallowed = $user->hasRight(
"facture",
"lire");
2864 $delallowed = $user->hasRight(
"facture",
"creer");
2867 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
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 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_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.