46require
'../../main.inc.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
64require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
66require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
68require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
69require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
70require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
75 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
76 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
80$langs->loadLangs(array(
'banks',
'bills',
'companies',
'products',
'categories',
'cashdesk'));
82$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
85$action =
GETPOST(
'action',
'aZ09');
86$massaction =
GETPOST(
'massaction',
'alpha');
88$confirm =
GETPOST(
'confirm',
'alpha');
89$toselect =
GETPOST(
'toselect',
'array:int');
90$optioncss =
GETPOST(
'optioncss',
'alpha');
91$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
94if ($contextpage ==
'poslist') {
104$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
105$search_type =
GETPOST(
'search_type',
'intcomma');
106$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
107$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
108$search_project =
GETPOST(
'search_project',
'alpha');
109$search_company =
GETPOST(
'search_company',
'alpha');
110$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
111$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
112$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
113$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
114$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
115$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
116$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
117$search_login =
GETPOST(
'search_login',
'alpha');
118$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
119$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
120$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
121$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
122$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
123$search_dispute_status =
GETPOST(
'search_dispute_status',
'intcomma');
124$search_status =
GETPOST(
'search_status',
'array:intcomma');
136$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
137$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
138$search_bankaccount =
GETPOST(
'search_bankaccount',
'intcomma');
139$search_fk_input_reason =
GETPOSTINT(
'search_fk_input_reason');
140$search_module_source =
GETPOST(
'search_module_source',
'alpha');
141$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
142$search_town =
GETPOST(
'search_town',
'alpha');
143$search_zip =
GETPOST(
'search_zip',
'alpha');
144$search_state =
GETPOST(
"search_state");
145$search_country =
GETPOST(
"search_country",
'aZ09');
146$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
147$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
148$search_user =
GETPOST(
'search_user',
'intcomma');
149$search_sale =
GETPOST(
'search_sale',
'intcomma');
151$search_date_startday =
GETPOSTINT(
'search_date_startday');
152$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
153$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
154$search_date_endday =
GETPOSTINT(
'search_date_endday');
155$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
156$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
157$search_date_start =
GETPOSTDATE(
'search_date_start',
'getpost');
158$search_date_end =
GETPOSTDATE(
'search_date_end',
'getpostend');
160$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
161$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
162$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
163$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
164$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
165$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
166$search_date_valid_start =
GETPOSTDATE(
'search_date_valid_start',
'getpost');
167$search_date_valid_end =
GETPOSTDATE(
'search_date_valid_end',
'getpostend');
168$search_note_private =
GETPOST(
'search_note_private',
'alpha');
169$search_note_public =
GETPOST(
'search_note_public',
'alpha');
171$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
172$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
173$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
174$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
175$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
176$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
177$search_datelimit_start =
GETPOSTDATE(
'search_datelimit_start',
'getpost');
178$search_datelimit_end =
GETPOSTDATE(
'search_datelimit_end',
'getpostend');
181$search_datec_start =
GETPOSTDATE(
'search_datec_start',
'getpost',
'tzuserrel');
182$search_datec_end =
GETPOSTDATE(
'search_datec_end',
'getpostend',
'tzuserrel');
183$search_datem_start =
GETPOSTDATE(
'search_datem_start',
'getpost',
'tzuserrel');
184$search_datem_end =
GETPOSTDATE(
'search_datem_end',
'getpostend',
'tzuserrel');
186$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
187$searchCategoryInvoiceOperator = 0;
189 $searchCategoryInvoiceOperator =
GETPOSTINT(
'search_category_invoice_operator');
193$searchCategoryInvoiceList =
GETPOST(
'search_category_invoice_list',
'array:int');
196$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
197$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
198$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
199$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
201$search_option =
GETPOST(
'search_option');
202if ($search_option ==
'late') {
203 $search_status = array(
'1');
207$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
208$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
210if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
215if ($contextpage ==
'poslist' && !
GETPOSTISSET(
'limit')) {
219$offset = $limit * $page;
220if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
227 $sortfield =
'f.datef,f.rowid';
229$pageprev = $page - 1;
230$pagenext = $page + 1;
232$diroutputmassaction =
isModEnabled(
'invoice') ?
$conf->invoice->dir_output.
'/temp/massgeneration/'.$user->id :
'';
240$hookmanager->initHooks(array($contextpage));
243$extrafields->fetch_name_optionals_label(
$object->table_element);
245$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_') ?: [];
248$fieldstosearchall = array(
250 'f.ref_client' =>
'RefCustomer',
251 'f.note_public' =>
'NotePublic',
252 's.nom' =>
"ThirdParty",
253 's.code_client' =>
"CustomerCodeShort",
254 's.name_alias' =>
"AliasNameShort",
257 'pd.description' =>
'ProductDescription',
259if (empty($user->socid)) {
260 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
266$checkedtypetiers =
'0';
268 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
269 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' =>
'-1',
'position' => 10),
270 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
271 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
272 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 20),
273 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' =>
'0',
'position' => 22),
274 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 25),
275 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 30),
276 'p.ref' => array(
'label' =>
"ProjectRef",
'langfile' =>
'projects',
'checked' =>
'1',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0'),
'position' => 40),
277 'p.title' => array(
'label' =>
"ProjectLabel",
'langfile' =>
'projects',
'checked' =>
'0',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0'),
'position' => 41),
278 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 50),
279 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 51),
280 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' =>
'-1',
'position' => 52),
281 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' =>
'0'),
282 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 55),
283 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 60),
284 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 65),
285 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 70),
286 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
287 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'1',
'position' => 80),
288 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0',
'position' => 85),
289 'ba.label' => array(
'label' =>
"DefaultBankAccount",
'langfile' =>
'banks',
'checked' =>
'0',
'enabled' => (
isModEnabled(
'bank') ?
'1' :
'0'),
'position' => 192),
290 'f.fk_input_reason' => array(
'label' =>
"Source",
'checked' => 0,
'enabled' => 1,
'position' => 88),
291 'f.module_source' => array(
'label' =>
"POSModule",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 90),
292 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 91),
293 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 95),
294 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 100),
295 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
$mysoc->localtax1_assuj ==
"1"),
'position' => 110),
296 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
$mysoc->localtax2_assuj ==
"1"),
'position' => 120),
297 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 130),
298 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' =>
'0',
'position' => 140),
299 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' =>
'0',
'position' => 150),
300 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 280),
301 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 285),
302 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 290),
303 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 291),
304 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 292),
305 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 295),
306 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 296),
307 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
308 'total_margin' => array(
'label' =>
'Margin',
'langfile' =>
'margins',
'checked' =>
'0',
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
309 'total_margin_rate' => array(
'label' =>
'MarginRate',
'langfile' =>
'margins',
'checked' =>
'0',
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ?
'0' :
'1')),
310 'total_mark_rate' => array(
'label' =>
'MarkRate',
'langfile' =>
'margins',
'checked' =>
'0',
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ?
'0' :
'1')),
311 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
312 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' =>
'1',
'visible' => -1,
'notnull' => 1,
'position' => 502),
313 'u.login' => array(
'label' =>
"UserAuthor",
'checked' =>
'0',
'visible' => -1,
'position' => 504),
314 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 506),
319 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
320 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
321 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' =>
'0',
'position' => 530,
'enabled' =>
'1'),
322 'f.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 990),
323 'f.dispute_status' => array(
'label' =>
"DisputeStatus",
'checked' =>
'-1',
'position' => 999),
324 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
327 unset($arrayfields[
'f.note_private']);
330 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' =>
'0',
'position' => 86);
333$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
334if (empty($subtypearray)) {
335 unset($arrayfields[
'f.subtype']);
339foreach (
$object->fields as $key => $val) {
342 if (!empty($val[
'visible'])) {
343 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
345 if (array_key_exists($key, $arrayfields)) {
347 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
349 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
353 $arrayfields[$newkey] = array(
354 'label' => $val[
'label'],
355 'checked' => (($visible < 0) ?
'0' :
'1'),
356 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
357 'position' => $val[
'position'],
358 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
364include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
366$parameters = array(
'arrayfields' => &$arrayfields);
367$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
370if ($contextpage ==
'poslist') {
371 $arrayfields[
"f.module_source"][
'checked'] = 1;
372 $arrayfields[
"f.pos_source"][
'checked'] = 1;
373 $arrayfields[
"f.date_lim_reglement"][
'checked'] = 0;
374 $arrayfields[
"f.total_ttc"][
'checked'] = 1;
375 $arrayfields[
"f.tms"][
'checked'] = 1;
376 $arrayfields[
"p.ref"][
'checked'] = 0;
384if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
385 $search_sale = $user->id;
389$fieldid = (!empty($ref) ?
'ref' :
'rowid');
390if (!empty($user->socid)) {
391 $socid = $user->socid;
393if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
394 $search_sale = $user->id;
404if (
GETPOST(
'cancel',
'alpha')) {
408if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
413$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
414$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
420include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
423if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
426 $search_product_category =
'';
427 $searchCategoryInvoiceList = array();
429 $search_refcustomer =
'';
431 $search_subtype =
'';
432 $search_project_ref =
'';
433 $search_project =
'';
434 $search_company =
'';
435 $search_company_alias =
'';
436 $search_parent_name =
'';
437 $search_montant_ht =
'';
438 $search_montant_vat =
'';
439 $search_montant_localtax1 =
'';
440 $search_montant_localtax2 =
'';
441 $search_montant_ttc =
'';
443 $search_multicurrency_code =
'';
444 $search_multicurrency_tx =
'';
445 $search_multicurrency_montant_ht =
'';
446 $search_multicurrency_montant_vat =
'';
447 $search_multicurrency_montant_ttc =
'';
448 $search_dispute_status =
'';
450 $search_paymentmode =
'';
451 $search_paymentterms =
'';
452 $search_bankaccount =
'';
453 $search_fk_input_reason =
'';
454 $search_module_source =
'';
455 $search_pos_source =
'';
459 $search_country =
'';
460 $search_type_thirdparty =
'';
461 $search_customer_code =
'';
462 $search_date_startday =
'';
463 $search_date_startmonth =
'';
464 $search_date_startyear =
'';
465 $search_date_endday =
'';
466 $search_date_endmonth =
'';
467 $search_date_endyear =
'';
468 $search_date_start =
'';
469 $search_date_end =
'';
470 $search_date_valid_startday =
'';
471 $search_date_valid_startmonth =
'';
472 $search_date_valid_startyear =
'';
473 $search_date_valid_endday =
'';
474 $search_date_valid_endmonth =
'';
475 $search_date_valid_endyear =
'';
476 $search_date_valid_start =
'';
477 $search_date_valid_end =
'';
478 $search_datelimit_startday =
'';
479 $search_datelimit_startmonth =
'';
480 $search_datelimit_startyear =
'';
481 $search_datelimit_endday =
'';
482 $search_datelimit_endmonth =
'';
483 $search_datelimit_endyear =
'';
484 $search_datelimit_start =
'';
485 $search_datelimit_end =
'';
487 $search_datec_start =
'';
488 $search_datec_end =
'';
490 $search_datem_start =
'';
491 $search_datem_end =
'';
493 $search_fac_rec_source_title =
'';
495 $search_import_key =
'';
496 $search_categ_cus = 0;
500 $search_array_options = array();
503if (empty($reshook)) {
504 $objectclass =
'Facture';
505 $objectlabel =
'Invoices';
506 $permissiontoread = $user->hasRight(
"facture",
"lire");
507 $permissiontoadd = $user->hasRight(
"facture",
"creer");
508 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
509 $uploaddir =
$conf->invoice->dir_output;
510 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
513if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
514 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
515 $arrayofselected = is_array($toselect) ? $toselect : array();
516 if (!empty($arrayofselected)) {
519 $note_private =
GETPOST(
'note_private',
'restricthtml');
521 if (empty($paiementdate)) {
522 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
524 $action =
'makepayment';
528 foreach ($arrayofselected as $toselectid) {
531 $result = $facture->fetch($toselectid);
541 $sommePaiement = $facture->getSommePaiement(-1);
542 $paiementAmount = $sommePaiement[
'alreadypaid'];
544 $totalcreditnotes = $facture->getSumCreditNotesUsed();
545 $totaldeposits = $facture->getSumDepositsUsed();
547 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
548 $remaintopay = (float)
price2num($facture->total_ttc - $totalallpayments);
551 $parameters = array(
'remaintopay' => $remaintopay);
552 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
554 if (!empty($remain = (
float) $hookmanager->resArray[
'remaintopay'])) {
555 $remaintopay = $remain;
557 } elseif ($reshook < 0) {
559 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
563 $multicurrency_remaintopay = (float)
price2num($facture->multicurrency_total_ttc - $sommePaiement[
'alreadypaid_multicurrency']);
565 if ($remaintopay != 0) {
566 $resultBank = $facture->setBankAccount($bankid);
567 if ($resultBank < 0) {
572 $paiement->datepaye = $paiementdate;
573 $paiement->amounts[$facture->id] = $remaintopay;
574 $paiement->multicurrency_amounts[$facture->id] = (float) $multicurrency_remaintopay;
575 $paiement->paiementid = $paiementid;
576 $paiement->note_private = $note_private;
577 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
578 if ($paiement_id < 0) {
579 $langs->load(
"errors");
580 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
583 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
585 $langs->load(
"errors");
586 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
592 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
596 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
601 if (empty($errorpayment)) {
602 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
610} elseif ($massaction ==
'withdrawrequest') {
611 $langs->load(
"withdrawals");
613 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
620 $arrayofselected = is_array($toselect) ? $toselect : array();
621 $listofbills = array();
622 foreach ($arrayofselected as $toselectid) {
624 $result = $objecttmp->fetch($toselectid);
626 $totalpaid = $objecttmp->getSommePaiement();
627 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
628 $totaldeposits = $objecttmp->getSumDepositsUsed();
629 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
632 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
633 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
635 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
636 $objecttmp->resteapayer = $remaintopay;
638 } elseif ($reshook < 0) {
640 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
645 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
646 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
648 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
649 } elseif ($objecttmp->resteapayer < 0) {
651 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
654 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
655 $rsql .=
" , pfd.date_traite as date_traite";
656 $rsql .=
" , pfd.amount";
657 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
658 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
659 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
660 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
661 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
662 $rsql .=
" AND pfd.traite = 0";
663 $rsql .=
" ORDER BY pfd.date_demande DESC";
666 $result_sql =
$db->query($rsql);
668 $numprlv =
$db->num_rows($result_sql);
673 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
674 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
675 $langs->load(
"errors");
677 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
679 $listofbills[] = $objecttmp;
685 if (!empty($listofbills)) {
686 $nbwithdrawrequestok = 0;
687 foreach ($listofbills as $aBill) {
694 $sql =
"SELECT SUM(pfd.amount) as amount";
695 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
699 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
701 $sql .=
" AND pfd.traite = 0";
703 $resql =
$db->query($sql);
705 $obj =
$db->fetch_object($resql);
707 $pending += (float) $obj->amount;
713 $sqlPending =
"SELECT SUM(pl.amount) as amount";
714 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
715 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
719 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
721 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
722 $resPending =
$db->query($sqlPending);
724 if ($objPending =
$db->fetch_object($resPending)) {
725 $pending += (float) $objPending->amount;
728 $db->free($resPending);
730 $requestAmount = $aBill->resteapayer - $pending;
733 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
734 if ($requestAmount > 0) {
737 $nbwithdrawrequestok++;
743 $aBill->error =
'WithdrawRequestErrorNilAmount';
744 $aBill->errors[] = $aBill->error;
748 if ($nbwithdrawrequestok > 0) {
749 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
771$company_url_list = array();
776 if (empty($search_company)) {
777 $search_company = $soc->name;
783$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
784$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
786$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
787$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
792$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, ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number as bnumber, ba.account_number as baccount_number, ba.fk_accountancy_journal as baccountancy_journal, f.total_ht, f.total_tva, f.total_ttc,';
793$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
794$sql .=
' f.fk_user_author,';
795$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,';
796$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
797$sql .=
" f.fk_input_reason,";
798$sql .=
" f.module_source, f.pos_source,";
799$sql .=
' f.paye as paye, f.fk_statut as status, f.import_key, f.close_code,';
800$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
801$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
802$sql .=
' f.payment_reference, f.dispute_status,';
803$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,';
804$sql .=
" s.parent as fk_parent,";
805$sql .=
" s2.nom as name2,";
806$sql .=
' typent.code as typent_code,';
807$sql .=
' state.code_departement as state_code, state.nom as state_name,';
808$sql .=
' country.code as country_code,';
809$sql .=
' f.fk_fac_rec_source,';
810$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
811$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';
821if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
822 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
823 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
827$parameters = array();
828$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
829$sql .= $hookmanager->resPrint;
830$sql = preg_replace(
'/,\s*$/',
'', $sql);
834$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
835$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
836$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
837$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
838$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
839$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
841if ($sortfield ==
"f.datef") {
842 $hasAnotherfilter =
false;
843 foreach ($search_array_options as $v) {
844 if ($v !==
'' && (
string) $v !==
'-1') {
845 $hasAnotherfilter =
true;
849 if (!$hasAnotherfilter) {
850 $sql .=
$db->hintindex(
'idx_facture_datef');
853if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
854 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
856if (!empty($search_fac_rec_source_title)) {
857 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
859$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
860$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
861$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON ba.rowid = f.fk_account';
863$parameters = array();
864$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
865$sql .= $hookmanager->resPrint;
867$sql .=
' WHERE f.fk_soc = s.rowid';
868$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
870 $sql .=
' AND s.rowid = '.((int) $socid);
874 $sql .=
' AND f.fk_user_author IS NULL';
876 $sql .=
' AND f.fk_user_author = '.((int) $userid);
882if ($search_refcustomer) {
885if ($search_type !=
'' && $search_type !=
'-1') {
886 $sql .=
" AND f.type IN (".$db->sanitize(
$db->escape($search_type)).
")";
888if ($search_subtype !=
'' && $search_subtype !=
'-1') {
889 $sql .=
" AND f.subtype IN (".$db->sanitize(
$db->escape($search_subtype)).
")";
891if ($search_project_ref) {
894if ($search_project) {
897if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
898 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
900 if ($search_company) {
903 if ($search_company_alias) {
907if ($search_parent_name) {
910if ($search_customer_code) {
922if (strlen(trim($search_country))) {
924 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
925 foreach ($arrayofcode as $key => $value) {
926 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
927 if ($value !=
$mysoc->country_code) {
928 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
931 if ($search_country ==
'special_allnotme') {
932 $sql .=
" AND country.code <> '".$db->escape(
$mysoc->country_code).
"'";
933 } elseif ($search_country ==
'special_eec') {
934 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
935 } elseif ($search_country ==
'special_eecnotme') {
936 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
937 } elseif ($search_country ==
'special_noteec') {
938 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
943if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
944 $sql .=
" AND s.fk_typent IN (".$db->sanitize(
$db->escape($search_type_thirdparty)).
')';
946if ($search_montant_ht !=
'') {
949if ($search_montant_vat !=
'') {
952if ($search_montant_localtax1 !=
'') {
953 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
955if ($search_montant_localtax2 !=
'') {
956 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
958if ($search_montant_ttc !=
'') {
961if ($search_multicurrency_code !=
'') {
962 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
964if ($search_multicurrency_tx !=
'') {
965 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
967if ($search_multicurrency_montant_ht !=
'') {
968 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
970if ($search_multicurrency_montant_vat !=
'') {
971 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
973if ($search_multicurrency_montant_ttc !=
'') {
974 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
977 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
979if ($search_dispute_status !=
'-1' && $search_dispute_status !=
'') {
980 if ($search_dispute_status ==
'0') {
981 $sql .=
" AND (f.dispute_status IS NULL OR f.dispute_status = 0)";
983 $sql .=
" AND f.dispute_status IN (".$db->sanitize($search_dispute_status).
")";
986if (is_array($search_status) && count($search_status) > 0) {
987 $search_statusArray = $search_status;
988 $sql .=
" AND f.fk_statut IN (" .
$db->sanitize(implode(
',', array_map(
'intval', $search_statusArray))) .
")";
991if ($search_paymentmode > 0) {
992 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
994if ($search_paymentterms > 0) {
995 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
997if ($search_bankaccount > 0) {
998 $sql .=
" AND ba.rowid = ".((int) $search_bankaccount);
1000if ($search_fk_input_reason > 0) {
1001 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
1003if ($search_module_source) {
1004 $sql .=
natural_search(
"f.module_source", $search_module_source);
1006if ($search_pos_source) {
1009if ($search_date_start) {
1010 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
1012if ($search_date_end) {
1013 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
1015if ($search_date_valid_start) {
1016 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
1018if ($search_date_valid_end) {
1019 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
1021if ($search_datelimit_start) {
1022 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
1024if ($search_datelimit_end) {
1025 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
1027if ($search_note_public) {
1028 $sql .=
" AND p.note_public LIKE '%".$db->escape(
$db->escapeforlike($search_note_public)).
"%'";
1030if ($search_note_private) {
1031 $sql .=
" AND p.note_private LIKE '%".$db->escape(
$db->escapeforlike($search_note_private)).
"%'";
1033if ($search_datec_start) {
1034 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
1036if ($search_datec_end) {
1037 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
1039if ($search_datem_start) {
1040 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
1042if ($search_datem_end) {
1043 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
1045if ($search_option ==
'late') {
1046 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->invoice->client->warning_delay).
"'";
1051if (!empty($search_fac_rec_source_title)) {
1052 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
1054if ($search_fk_fac_rec_source) {
1055 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1057if ($search_import_key) {
1061if ($search_user > 0) {
1062 $sql .=
" AND EXISTS (";
1063 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1064 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1065 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1066 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1067 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1070if ($search_sale && $search_sale !=
'-1') {
1071 if ($search_sale == -2) {
1072 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1073 } elseif ($search_sale > 0) {
1074 $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).
")";
1079if (!empty($searchCategoryInvoiceList)) {
1080 $searchCategoryInvoiceSqlList = array();
1081 $listofcategoryid =
'';
1082 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1083 if (intval($searchCategoryInvoice) == -2) {
1084 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1085 } elseif (intval($searchCategoryInvoice) > 0) {
1086 if ($searchCategoryInvoiceOperator == 0) {
1087 $searchCategoryInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice AND ck.fk_categorie = ".((int) $searchCategoryInvoice).
")";
1089 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1093 if ($listofcategoryid) {
1094 $searchCategoryInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
1096 if ($searchCategoryInvoiceOperator == 1) {
1097 if (!empty($searchCategoryInvoiceSqlList)) {
1098 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1101 if (!empty($searchCategoryInvoiceSqlList)) {
1102 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1108$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1109$searchCategoryProductOperator = 0;
1110if (!empty($searchCategoryProductList)) {
1111 $searchCategoryProductSqlList = array();
1112 $listofcategoryid =
'';
1113 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1114 if (intval($searchCategoryProduct) == -2) {
1115 $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)";
1116 } elseif (intval($searchCategoryProduct) > 0) {
1117 if ($searchCategoryProductOperator == 0) {
1118 $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).
")";
1120 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1124 if ($listofcategoryid) {
1125 $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).
"))";
1127 if ($searchCategoryProductOperator == 1) {
1128 if (!empty($searchCategoryProductSqlList)) {
1129 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1132 if (!empty($searchCategoryProductSqlList)) {
1133 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1137$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1138$searchCategoryCustomerOperator = 0;
1140if (!empty($searchCategoryCustomerList)) {
1141 $searchCategoryCustomerSqlList = array();
1142 $listofcategoryid =
'';
1143 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1144 if (intval($searchCategoryCustomer) == -2) {
1145 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1146 } elseif (intval($searchCategoryCustomer) > 0) {
1147 if ($searchCategoryCustomerOperator == 0) {
1148 $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).
")";
1150 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1154 if ($listofcategoryid) {
1155 $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).
"))";
1157 if ($searchCategoryCustomerOperator == 1) {
1158 if (!empty($searchCategoryCustomerSqlList)) {
1159 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1162 if (!empty($searchCategoryCustomerSqlList)) {
1163 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1168include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1170$parameters = array();
1171$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1172$sql .= $hookmanager->resPrint;
1177 $fieldstosearchallwithoutpd = array();
1178 $fieldstosearchallwithpd = array();
1179 foreach ($fieldstosearchall as $key => $val) {
1180 if (!preg_match(
'/^pd\./', $key)) {
1181 $fieldstosearchallwithoutpd[$key] = $val;
1183 $fieldstosearchallwithpd[$key] = $val;
1187 if (count($fieldstosearchallwithpd) > 0) {
1188 $sqltoadd .=
" OR EXISTS (SELECT pd.rowid FROM ".MAIN_DB_PREFIX.
"facturedet as pd WHERE pd.fk_facture = f.rowid";
1189 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
1193 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
1196$parameters = array();
1197$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1198if (empty($reshook)) {
1199 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1201 $sql = $hookmanager->resPrint;
1205$nbtotalofrecords =
'';
1208 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1209 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1211 $resql =
$db->query($sqlforcount);
1213 $objforcount =
$db->fetch_object($resql);
1214 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1219 if (($page * $limit) > (
int) $nbtotalofrecords) {
1227$sql .=
$db->order($sortfield, $sortorder);
1229 $sql .=
$db->plimit($limit + 1, $offset);
1232$resql =
$db->query($sql);
1238$num =
$db->num_rows($resql);
1240$arrayofselected = is_array($toselect) ? $toselect : array();
1242if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1243 $obj =
$db->fetch_object($resql);
1246 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1253llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1256if ($search_fk_fac_rec_source) {
1258 $object->fetch((
int) $search_fk_fac_rec_source);
1267 $param .=
'&mode='.urlencode($mode);
1269if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1270 $param .=
'&contextpage='.urlencode($contextpage);
1272if ($limit > 0 && $limit !=
$conf->liste_limit) {
1273 $param .=
'&limit='.((int) $limit);
1275if ($optioncss !=
'') {
1276 $param .=
'&optioncss='.urlencode($optioncss);
1279 $param .=
'&show_files='.urlencode((
string) ($show_files));
1282 $param .=
'&search_all='.urlencode($search_all);
1285 $param .=
'&socid='.((int) $socid);
1287if ($search_date_startday) {
1288 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1290if ($search_date_startmonth) {
1291 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1293if ($search_date_startyear) {
1294 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1296if ($search_date_endday) {
1297 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1299if ($search_date_endmonth) {
1300 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1302if ($search_date_endyear) {
1303 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1305if ($search_date_valid_startday) {
1306 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1308if ($search_date_valid_startmonth) {
1309 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1311if ($search_date_valid_startyear) {
1312 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1314if ($search_date_valid_endday) {
1315 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1317if ($search_date_valid_endmonth) {
1318 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1320if ($search_date_valid_endyear) {
1321 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1323if ($search_datelimit_startday) {
1324 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1326if ($search_datelimit_startmonth) {
1327 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1329if ($search_datelimit_startyear) {
1330 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1332if ($search_datelimit_endday) {
1333 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1335if ($search_datelimit_endmonth) {
1336 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1338if ($search_datelimit_endyear) {
1339 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1342foreach (array(
'search_datec_start',
'search_datec_end',
'search_datem_start',
'search_datem_end') as $tmpprefix) {
1343 foreach (array(
'day',
'month',
'year',
'hour',
'min') as $tmpsuffix) {
1345 $param .=
'&'.$tmpprefix.$tmpsuffix.
'='.urlencode((
string)
GETPOSTINT($tmpprefix.$tmpsuffix));
1350 $param .=
'&search_ref='.urlencode($search_ref);
1352if ($search_note_private) {
1353 $param .=
'&search_note_private='.urlencode($search_note_private);
1355if ($search_note_public) {
1356 $param .=
'&search_note_public='.urlencode($search_note_public);
1358if ($search_refcustomer) {
1359 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1361if ($search_project_ref) {
1362 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1364if ($search_project) {
1365 $param .=
'&search_project='.urlencode($search_project);
1367if ($search_type !=
'') {
1368 $param .=
'&search_type='.urlencode($search_type);
1370if ($search_subtype !=
'') {
1371 $param .=
'&search_subtype='.urlencode($search_subtype);
1373if ($search_company) {
1374 $param .=
'&search_company='.urlencode($search_company);
1376if ($search_company_alias) {
1377 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1379if ($search_parent_name !=
'') {
1380 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1383 $param .=
'&search_town='.urlencode($search_town);
1386 $param .=
'&search_zip='.urlencode($search_zip);
1389 $param .=
'&search_state='.urlencode($search_state);
1391if ($search_country) {
1392 $param .=
"&search_country=".urlencode($search_country);
1394if ($search_type_thirdparty !=
'') {
1395 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1397if ($search_customer_code) {
1398 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1400if ($search_sale > 0) {
1401 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1403if ($search_user > 0) {
1404 $param .=
'&search_user='.urlencode((
string) $search_user);
1407 $param .=
'&search_login='.urlencode($search_login);
1409if ($searchCategoryInvoiceOperator == 1) {
1410 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1412foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1413 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1415if ($search_product_category > 0) {
1416 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1418if ($search_montant_ht !=
'') {
1419 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1421if ($search_montant_vat !=
'') {
1422 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1424if ($search_montant_localtax1 !=
'') {
1425 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1427if ($search_montant_localtax2 !=
'') {
1428 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1430if ($search_montant_ttc !=
'') {
1431 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1433if ($search_multicurrency_code !=
'') {
1434 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1436if ($search_multicurrency_tx !=
'') {
1437 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1439if ($search_multicurrency_montant_ht !=
'') {
1440 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1442if ($search_multicurrency_montant_vat !=
'') {
1443 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1445if ($search_multicurrency_montant_ttc !=
'') {
1446 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1448if ($search_dispute_status !=
'') {
1449 $param .=
'&search_dispute_status='.urlencode($search_dispute_status);
1451if (count($search_status) > 0) {
1452 foreach ($search_status as $key => $val) {
1453 $param .=
'&search_status[]='.urlencode($val);
1456if ($search_paymentmode > 0) {
1457 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1459if ($search_paymentterms > 0) {
1460 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1462if ($search_bankaccount > 0) {
1463 $param .=
'&search_bankaccount='.urlencode((
string) ($search_bankaccount));
1465if ($search_fk_input_reason > 0) {
1466 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1468if ($search_module_source) {
1469 $param .=
'&search_module_source='.urlencode($search_module_source);
1471if ($search_pos_source) {
1472 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1474if ($search_option) {
1475 $param .=
"&search_option=".urlencode($search_option);
1477if ($search_categ_cus > 0) {
1478 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1480if (!empty($search_fac_rec_source_title)) {
1481 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1483if ($search_fk_fac_rec_source) {
1484 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1486if ($search_import_key !=
'') {
1487 $param .=
'&search_import_key='.urlencode($search_import_key);
1491include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1493$parameters = array(
'param' => &$param);
1494$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1495$param .= $hookmanager->resPrint;
1497$arrayofmassactions = array(
1498 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1499 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1500 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1501 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1504if (
isModEnabled(
'category') && $user->hasRight(
'facture',
'creer')) {
1505 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1507if ($user->hasRight(
'facture',
'paiement')) {
1508 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1510if (
isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1511 $langs->load(
"withdrawals");
1512 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1514if ($user->hasRight(
'facture',
'supprimer')) {
1516 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1519if ($user->hasRight(
"facture",
"creer")) {
1521 $arrayofmassactions[
'precreatecreditnote'] =
img_picto(
'',
'undo',
'class="pictofixedwidth"').$langs->trans(
"cancelByCreditNote");
1524if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1525 $arrayofmassactions = array();
1527$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1532if ($contextpage !=
'poslist') {
1533 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1535 $url .=
'&socid='.urlencode((
string)
$object->socid);
1538 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1540 $newcardbutton =
'';
1541 $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'));
1542 $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'));
1543 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/compta/facture/stats/index.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1545 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1551print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1552if ($optioncss !=
'') {
1553 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1555print
'<input type="hidden" name="token" value="'.newToken().
'">';
1556print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1557if (!in_array($massaction, array(
'makepayment'))) {
1558 print
'<input type="hidden" name="action" value="list">';
1560print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1561print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1563print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1564print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1565print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1567print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1569$topicmail =
"SendBillRef";
1570$modelmail =
"facture_send";
1572$trackid =
'inv'.$object->id;
1573include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1575if ($massaction ==
'makepayment') {
1577 $formquestion = array(
1581 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1582 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1583 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1584 array(
'type' =>
'other',
'name' =>
'note_private',
'label' => $langs->trans(
"Comments"),
'value' =>
'<textarea name="note_private" id="note_private" class="minwidth200" rows="3"></textarea>'),
1587 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1592 foreach ($fieldstosearchall as $key => $val) {
1593 $fieldstosearchall[$key] = $langs->trans($val);
1595 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1601if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1603 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1605if ($user->hasRight(
"user",
"user",
"lire")) {
1606 $langs->load(
"commercial");
1607 $moreforfilter .=
'<div class="divsearchfield">';
1608 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1609 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1610 $moreforfilter .=
'</div>';
1613if ($user->hasRight(
"user",
"user",
"lire")) {
1614 $moreforfilter .=
'<div class="divsearchfield">';
1615 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1616 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1617 $moreforfilter .=
'</div>';
1620if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1621 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1622 $moreforfilter .=
'<div class="divsearchfield">';
1623 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1624 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1625 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
1626 $moreforfilter .=
'</div>';
1628if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1629 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1630 $moreforfilter .=
'<div class="divsearchfield">';
1631 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1632 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1633 $moreforfilter .=
'</div>';
1636$moreforfilter .=
'<div class="divsearchfield">';
1637$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1638$moreforfilter .=
'</div>';
1640$parameters = array();
1641$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1642if (empty($reshook)) {
1643 $moreforfilter .= $hookmanager->resPrint;
1645 $moreforfilter = $hookmanager->resPrint;
1648if (!empty($moreforfilter)) {
1649 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1650 print $moreforfilter;
1655$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1656$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1659if ($massactionbutton && $contextpage !=
'poslist') {
1660 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1663print
'<div class="div-table-responsive">';
1664print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1668print
'<tr class="liste_titre_filter">';
1671if (
$conf->main_checkbox_left_column) {
1672 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1673 $searchpicto = $form->showFilterButtons(
'left');
1679 print
'<td class="liste_titre">';
1683if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1684 print
'<td class="liste_titre">';
1685 print
'<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1689if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1690 print
'<td class="liste_titre">';
1691 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1695if (!empty($arrayfields[
'f.type'][
'checked'])) {
1696 print
'<td class="liste_titre maxwidthonsmartphone">';
1708 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1712if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1713 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1714 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1718if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1719 print
'<td class="liste_titre center">';
1720 print
'<div class="nowrapfordate">';
1721 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1723 print
'<div class="nowrapfordate">';
1724 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1729if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1730 print
'<td class="liste_titre center">';
1731 print
'<div class="nowrapfordate">';
1732 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'));
1734 print
'<div class="nowrapfordate">';
1735 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'));
1740if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1741 print
'<td class="liste_titre center">';
1742 print
'<div class="nowrapfordate">';
1743 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1745 print
'<div class="nowrapfordate">';
1746 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1751if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1752 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1755if (!empty($arrayfields[
'p.title'][
'checked'])) {
1756 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1759if (!empty($arrayfields[
's.nom'][
'checked'])) {
1760 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1763if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1764 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1767if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1768 print
'<td class="liste_titre">';
1769 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1773if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1774 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1777if (!empty($arrayfields[
's.town'][
'checked'])) {
1778 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1781if (!empty($arrayfields[
's.zip'][
'checked'])) {
1782 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1785if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1786 print
'<td class="liste_titre">';
1787 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1791if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1792 print
'<td class="liste_titre center">';
1793 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1797if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1798 print
'<td class="liste_titre maxwidthonsmartphone center">';
1799 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'),
'maxwidth100', 1);
1803if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1804 print
'<td class="liste_titre">';
1805 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1809if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1810 print
'<td class="liste_titre left">';
1811 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1815if (!empty($arrayfields[
'ba.label'][
'checked'])) {
1816 print
'<td class="liste_titre">';
1817 $form->select_comptes($search_bankaccount,
'search_bankaccount', 0,
'', 1,
'', 0,
'maxwidth125');
1821if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1822 print
'<td class="liste_titre">';
1823 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1827if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1828 print
'<td class="liste_titre">';
1829 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1833if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1834 print
'<td class="liste_titre">';
1835 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1838if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1840 print
'<td class="liste_titre right">';
1841 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1844if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1846 print
'<td class="liste_titre right">';
1847 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1850if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1852 print
'<td class="liste_titre right">';
1853 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1856if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1858 print
'<td class="liste_titre right">';
1859 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1862if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1864 print
'<td class="liste_titre right">';
1865 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1868if (!empty($arrayfields[
'u.login'][
'checked'])) {
1870 print
'<td class="liste_titre" align="center">';
1871 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1874if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1875 print
'<td class="liste_titre"></td>';
1877if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1878 print
'<td class="liste_titre" align="right">';
1881if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1882 print
'<td class="liste_titre right">';
1885if (!empty($arrayfields[
'rtp'][
'checked'])) {
1886 print
'<td class="liste_titre">';
1889if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1891 print
'<td class="liste_titre">';
1892 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1895if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1897 print
'<td class="liste_titre">';
1898 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1901if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1903 print
'<td class="liste_titre right">';
1904 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1907if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1909 print
'<td class="liste_titre right">';
1910 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1913if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1915 print
'<td class="liste_titre right">';
1916 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1919if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1920 print
'<td class="liste_titre">';
1923if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1924 print
'<td class="liste_titre right">';
1927if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1928 print
'<td class="liste_titre right">';
1931if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1932 print
'<td class="liste_titre right">';
1935if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1936 print
'<td class="liste_titre right">';
1939if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1940 print
'<td class="liste_titre right">';
1945include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1948$parameters = array(
'arrayfields' => $arrayfields);
1949$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1950print $hookmanager->resPrint;
1952if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1953 print
'<td class="liste_titre center">';
1954 print
'<div class="nowrapfordate">';
1955 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1957 print
'<div class="nowrapfordate">';
1958 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1963if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1964 print
'<td class="liste_titre center">';
1965 print
'<div class="nowrapfordate">';
1966 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1968 print
'<div class="nowrapfordate">';
1969 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1974if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1975 print
'<td class="liste_titre">';
1978if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1980 print
'<td class="liste_titre">';
1981 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1984if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1986 print
'<td class="liste_titre">';
1987 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1990if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1992 print
'<td class="liste_titre maxwidthonsmartphone right">';
1993 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).
'">';
1997if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1998 print
'<td class="liste_titre maxwidthonsmartphone center">';
1999 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
2003if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
2004 print
'<td class="liste_titre center parentonrightofpage">';
2005 $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS;
2007 print $form->selectarray(
'search_dispute_status', $liststatus, $search_dispute_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage', 1);
2011if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2012 print
'<td class="liste_titre center parentonrightofpage">';
2013 $liststatus = array(
2014 '0' => $langs->trans(
"BillShortStatusDraft"),
2015 '1' => $langs->trans(
"BillShortStatusNotPaid"),
2016 '2' => $langs->trans(
"BillShortStatusPaid"),
2017 '3' => $langs->trans(
"BillShortStatusCanceled")
2020 print $form->multiselectarray(
'search_status', $liststatus, $search_status, 0, 0,
'minwidth125', 1, 0);
2024if (!
$conf->main_checkbox_left_column) {
2025 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
2026 $searchpicto = $form->showFilterButtons();
2037print
'<tr class="liste_titre">';
2039if (
$conf->main_checkbox_left_column) {
2040 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
2047if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2048 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
2051if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2052 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
2055if (!empty($arrayfields[
'f.type'][
'checked'])) {
2056 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
2059if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2060 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
2062if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2063 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
2066if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2067 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
2070if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2071 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
2074if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2075 $langs->load(
"projects");
2076 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
2079if (!empty($arrayfields[
'p.title'][
'checked'])) {
2080 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
2083if (!empty($arrayfields[
's.nom'][
'checked'])) {
2084 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
2087if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2089 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
2092if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2093 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
2096if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2097 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
2100if (!empty($arrayfields[
's.town'][
'checked'])) {
2101 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
2104if (!empty($arrayfields[
's.zip'][
'checked'])) {
2105 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
2108if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2109 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
2112if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2113 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
2116if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2117 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
2120if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2121 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
2124if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2125 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
2128if (!empty($arrayfields[
'ba.label'][
'checked'])) {
2129 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
2132if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2133 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
2135if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2136 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2139if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2140 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2143if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2144 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2147if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2148 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2151if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2152 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2155if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2156 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2159if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2160 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2163if (!empty($arrayfields[
'u.login'][
'checked'])) {
2164 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2167if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2168 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2171if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2172 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2175if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2176 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2179if (!empty($arrayfields[
'rtp'][
'checked'])) {
2180 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2183if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2184 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2187if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2188 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2191if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2192 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2195if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2196 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2199if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2200 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2203if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2204 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2207if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2208 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2211if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2212 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2215if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2216 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2219if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2220 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2223if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2224 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2228include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2230$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
2231$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2232print $hookmanager->resPrint;
2233if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2234 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2237if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2238 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2241if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2242 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2245if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2246 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2249if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2250 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2253if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2254 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2258if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2259 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2263if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
2264 print_liste_field_titre($arrayfields[
'f.dispute_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.dispute_status,f.ref",
"", $param,
'', $sortfield, $sortorder,
'center ');
2268if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2269 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2273if (!
$conf->main_checkbox_left_column) {
2274 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2300 $typenArray = $formcompany->typent_array(1);
2302 $with_margin_info =
false;
2304 !empty($arrayfields[
'total_pa'][
'checked'])
2305 || !empty($arrayfields[
'total_margin'][
'checked'])
2306 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2307 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2310 $with_margin_info =
true;
2315 $imaxinloop = ($limit ? min($num, $limit) : $num);
2316 while ($i < $imaxinloop) {
2317 $obj =
$db->fetch_object($resql);
2322 $datelimit =
$db->jdate($obj->datelimite);
2324 $facturestatic->id = $obj->id;
2325 $facturestatic->ref = $obj->ref;
2326 $facturestatic->ref_client = $obj->ref_client;
2327 $facturestatic->ref_customer = $obj->ref_client;
2328 $facturestatic->type = $obj->type;
2329 $facturestatic->subtype = $obj->subtype;
2330 $facturestatic->total_ht = $obj->total_ht;
2331 $facturestatic->total_tva = $obj->total_tva;
2332 $facturestatic->total_ttc = $obj->total_ttc;
2333 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2334 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2335 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2336 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2337 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2338 $facturestatic->status = $obj->status;
2339 $facturestatic->close_code = $obj->close_code;
2340 $facturestatic->total_ttc = $obj->total_ttc;
2341 $facturestatic->paye = $obj->paye;
2342 $facturestatic->socid = $obj->fk_soc;
2344 $facturestatic->date =
$db->jdate($obj->datef);
2345 $facturestatic->date_validation =
$db->jdate($obj->date_valid);
2346 $facturestatic->date_lim_reglement =
$db->jdate($obj->datelimite);
2348 $facturestatic->note_public = $obj->note_public;
2349 $facturestatic->note_private = $obj->note_private;
2352 $facturestatic->retained_warranty = $obj->retained_warranty;
2353 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2354 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2355 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2356 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2357 $facturestatic->situation_counter = $obj->situation_counter;
2360 $facturestatic->payment_reference = $obj->payment_reference;
2361 $facturestatic->dispute_status = $obj->dispute_status;
2363 $companystatic->id = $obj->socid;
2364 $companystatic->name = $obj->name;
2365 $companystatic->name_alias = $obj->alias;
2366 $companystatic->client = $obj->client;
2367 $companystatic->fournisseur = $obj->fournisseur;
2368 $companystatic->code_client = $obj->code_client;
2369 $companystatic->code_compta_client = $obj->code_compta_client;
2370 $companystatic->code_fournisseur = $obj->code_fournisseur;
2371 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2372 $companystatic->email = $obj->email;
2373 $companystatic->phone = $obj->phone;
2374 $companystatic->fax = $obj->fax;
2375 $companystatic->address = $obj->address;
2376 $companystatic->zip = $obj->zip;
2377 $companystatic->town = $obj->town;
2378 $companystatic->country_code = $obj->country_code;
2380 $projectstatic->id = $obj->project_id;
2381 $projectstatic->ref = $obj->project_ref;
2382 $projectstatic->title = $obj->project_label;
2384 $paiement = $facturestatic->getSommePaiement();
2385 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2386 $totaldeposits = $facturestatic->getSumDepositsUsed();
2387 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2388 $remaintopay = $obj->total_ttc - $totalallpayments;
2390 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2391 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2392 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2394 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2395 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2397 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2398 $multicurrency_remaintopay = (float)
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2402 $multicurrency_remaintopay = 0;
2405 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2406 $remaintopay = -$remaincreditnote;
2407 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2408 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2409 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2410 $multicurrency_totalpay = (float)
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2413 $facturestatic->alreadypaid = $paiement;
2414 $facturestatic->totalpaid = $paiement;
2415 $facturestatic->totalcreditnotes = $totalcreditnotes;
2416 $facturestatic->totaldeposits = $totaldeposits;
2418 $marginInfo = array();
2419 if ($with_margin_info) {
2420 $facturestatic->fetch_lines();
2421 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2422 $total_ht += $obj->total_ht;
2423 $total_margin += $marginInfo[
'total_margin'];
2428 if ($mode ==
'kanban') {
2430 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2431 print
'<div class="box-flex-container kanban">';
2434 if ($massactionbutton || $massaction) {
2436 if (in_array(
$object->id, $arrayofselected)) {
2441 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2442 print $facturestatic->getKanbanView(
'', $arraydata);
2443 if ($i == ($imaxinloop - 1)) {
2450 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2451 if ($contextpage ==
'poslist') {
2452 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2453 if (strpos($obj->ref, 'PROV
') !== false) {
2454 //If is a draft invoice, load var to be able to add products
2455 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2456 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2463 if (
$conf->main_checkbox_left_column) {
2464 print
'<td class="nowrap center">';
2465 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2467 if (in_array($obj->id, $arrayofselected)) {
2470 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2480 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2487 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2488 print
'<td class="nowraponall">';
2490 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2492 print
'<td class="nobordernopadding nowraponall">';
2493 if ($contextpage ==
'poslist') {
2496 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2500 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2501 $filedir = $filepath.
'/'.$filename;
2503 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2504 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2516 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2517 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2518 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2527 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2528 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2529 print $facturestatic->getLibType(2);
2537 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2539 if ($facturestatic->subtype > 0) {
2540 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2542 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2551 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2552 print
'<td align="center" class="nowraponall">';
2561 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2562 print
'<td align="center" class="nowraponall">';
2571 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2572 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2573 if ($facturestatic->hasDelay()) {
2574 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2583 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2584 print
'<td class="nocellnopadd nowraponall">';
2585 if ($obj->project_id > 0) {
2586 print $projectstatic->getNomUrl(1);
2595 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2596 print
'<td class="nowraponall">';
2597 if ($obj->project_id > 0) {
2607 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2608 print
'<td class="tdoverflowmax150">';
2609 if ($contextpage ==
'poslist') {
2612 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2620 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2621 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2629 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2630 print
'<td class="tdoverflowmax200">';
2631 if ($obj->fk_parent > 0) {
2632 if (!isset($company_url_list[$obj->fk_parent])) {
2634 $res = $companyparent->fetch($obj->fk_parent);
2636 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2639 if (isset($company_url_list[$obj->fk_parent])) {
2640 print $company_url_list[$obj->fk_parent];
2649 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2650 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2658 if (!empty($arrayfields[
's.town'][
'checked'])) {
2659 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2667 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2668 print
'<td class="nowraponall">';
2676 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2677 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2683 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2684 $tmparray =
getCountry($obj->fk_pays,
'all');
2685 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2693 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2694 if (!is_array($typenArray) || count($typenArray) == 0) {
2695 $typenArray = $formcompany->typent_array(1);
2697 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2698 if (!empty($obj->typent_code)) {
2699 print $typenArray[$obj->typent_code];
2707 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2708 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2709 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2711 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2712 print
$conf->cache[
'staff'][$obj->staff_code];
2720 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2721 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2722 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2731 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2732 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2733 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2742 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
2744 if (!empty($obj->bid)) {
2745 $accountstatic->id = $obj->bid;
2746 $accountstatic->ref = $obj->bref;
2747 $accountstatic->label = $obj->blabel;
2748 $accountstatic->number = $obj->bnumber;
2749 $accountstatic->account_number = $obj->baccount_number;
2750 $accountstatic->accountancy_journal = $obj->baccountancy_journal;
2751 print $accountstatic->getNomUrl(1);
2760 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2762 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2770 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2779 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2789 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2790 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2797 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2800 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2801 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2808 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2811 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2812 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2819 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2822 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2823 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2830 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2833 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2834 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2841 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2844 $userstatic->id = $obj->fk_user_author;
2845 $userstatic->login = $obj->login;
2846 $userstatic->lastname = $obj->lastname;
2847 $userstatic->firstname = $obj->firstname;
2848 $userstatic->email = $obj->user_email;
2849 $userstatic->status = $obj->user_statut;
2850 $userstatic->entity = $obj->entity;
2851 $userstatic->photo = $obj->photo;
2852 $userstatic->office_phone = $obj->office_phone;
2853 $userstatic->office_fax = $obj->office_fax;
2854 $userstatic->user_mobile = $obj->user_mobile;
2855 $userstatic->job = $obj->job;
2856 $userstatic->gender = $obj->gender;
2859 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2860 print
'<td class="tdoverflowmax100">';
2861 if ($userstatic->id) {
2862 print $userstatic->getNomUrl(-1);
2872 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2875 if ($obj->socid > 0) {
2876 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2877 if ($listsalesrepresentatives < 0) {
2880 $nbofsalesrepresentative = count($listsalesrepresentatives);
2881 if ($nbofsalesrepresentative > 6) {
2883 print $nbofsalesrepresentative;
2884 } elseif ($nbofsalesrepresentative > 0) {
2886 foreach ($listsalesrepresentatives as $val) {
2887 $userstatic->id = $val[
'id'];
2888 $userstatic->lastname = $val[
'lastname'];
2889 $userstatic->firstname = $val[
'firstname'];
2890 $userstatic->email = $val[
'email'];
2891 $userstatic->status = $val[
'statut'];
2892 $userstatic->entity = $val[
'entity'];
2893 $userstatic->photo = $val[
'photo'];
2894 $userstatic->login = $val[
'login'];
2895 $userstatic->office_phone = $val[
'office_phone'];
2896 $userstatic->office_fax = $val[
'office_fax'];
2897 $userstatic->user_mobile = $val[
'user_mobile'];
2898 $userstatic->job = $val[
'job'];
2899 $userstatic->gender = $val[
'gender'];
2901 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2903 if ($j < $nbofsalesrepresentative) {
2917 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2918 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2924 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2925 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2932 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2936 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2937 print
'<td class="right nowraponall amount">';
2938 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2951 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2952 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2953 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2954 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2956 $title = $obj->multicurrency_code;
2957 $label = $obj->multicurrency_code;
2959 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2968 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2969 print
'<td class="nowraponall">';
2970 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->id, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2977 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2978 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2984 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2985 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2991 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2992 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2998 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2999 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
3006 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
3007 print
'<td class="right nowraponall amount">';
3008 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
3016 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
3017 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
3025 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
3028 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
3029 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
3037 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
3040 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
3041 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
3047 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
3048 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
3053 if ($i >= $imaxinloop - 1) {
3054 if (!empty($total_ht)) {
3063 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
3065 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
3066 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
3067 print $hookmanager->resPrint;
3069 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
3070 print
'<td class="nowraponall center">';
3078 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
3079 print
'<td class="nowraponall center">';
3080 print
dol_print_date(
$db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
3087 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
3088 print
'<td class="nowraponall center">';
3096 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
3097 print
'<td class="sensiblehtmlcontent center">';
3098 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
3105 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
3106 print
'<td class="sensiblehtmlcontent center">';
3107 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
3114 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
3115 print
'<td class="center">';
3116 if (!empty($obj->fk_fac_rec_source)) {
3118 $result = $facrec->fetch($obj->fk_fac_rec_source);
3122 print $facrec->getNomUrl();
3132 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
3133 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
3140 if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
3141 print
'<td class="nowrap center">';
3142 if ($facturestatic->dispute_status) {
3143 $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS;
3144 print $langs->trans($liststatus[$facturestatic->dispute_status][
'label']);
3153 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
3154 print
'<td class="nowrap center">';
3155 print $facturestatic->getLibStatut(5, $totalallpayments);
3164 if (!
$conf->main_checkbox_left_column) {
3165 print
'<td class="nowrap center">';
3166 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
3168 if (in_array($obj->id, $arrayofselected)) {
3171 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3190 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3196 foreach ($arrayfields as $key => $val) {
3197 if (!empty($val[
'checked'])) {
3201 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3206$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3207$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3208print $hookmanager->resPrint;
3210print
'</table>'.
"\n";
3213print
'</form>'.
"\n";
3216if ($contextpage !=
'poslist') {
3217 $hidegeneratedfilelistifempty = 1;
3218 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3219 $hidegeneratedfilelistifempty = 0;
3223 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3224 $urlsource .= str_replace(
'&',
'&', $param);
3226 $filedir = $diroutputmassaction;
3227 $genallowed = $user->hasRight(
"facture",
"lire");
3228 $delallowed = $user->hasRight(
"facture",
"creer");
3231 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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 bank accounts.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
dol_now($mode='gmt')
Return date for now.
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.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolPrintLabel($s, $escapeonlyhtmltags=0)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.