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;
188if (GETPOSTISSET(
'formfilteraction')) {
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 =
$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),
328 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' =>
'0',
'position' => 86);
331$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
332if (empty($subtypearray)) {
333 unset($arrayfields[
'f.subtype']);
337foreach (
$object->fields as $key => $val) {
340 if (!empty($val[
'visible'])) {
341 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
343 if (array_key_exists($key, $arrayfields)) {
345 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
347 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
351 $arrayfields[$newkey] = array(
352 'label' => $val[
'label'],
353 'checked' => (($visible < 0) ?
'0' :
'1'),
354 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
355 'position' => $val[
'position'],
356 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
362include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
364$parameters = array(
'arrayfields' => &$arrayfields);
365$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
368if ($contextpage ==
'poslist') {
369 $arrayfields[
"f.module_source"][
'checked'] = 1;
370 $arrayfields[
"f.pos_source"][
'checked'] = 1;
371 $arrayfields[
"f.date_lim_reglement"][
'checked'] = 0;
372 $arrayfields[
"f.total_ttc"][
'checked'] = 1;
373 $arrayfields[
"f.tms"][
'checked'] = 1;
374 $arrayfields[
"p.ref"][
'checked'] = 0;
382if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
383 $search_sale = $user->id;
387$fieldid = (!empty($ref) ?
'ref' :
'rowid');
388if (!empty($user->socid)) {
389 $socid = $user->socid;
391if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
392 $search_sale = $user->id;
402if (
GETPOST(
'cancel',
'alpha')) {
406if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
411$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
412$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
418include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
421if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
424 $search_product_category =
'';
425 $searchCategoryInvoiceList = array();
427 $search_refcustomer =
'';
429 $search_subtype =
'';
430 $search_project_ref =
'';
431 $search_project =
'';
432 $search_company =
'';
433 $search_company_alias =
'';
434 $search_parent_name =
'';
435 $search_montant_ht =
'';
436 $search_montant_vat =
'';
437 $search_montant_localtax1 =
'';
438 $search_montant_localtax2 =
'';
439 $search_montant_ttc =
'';
441 $search_multicurrency_code =
'';
442 $search_multicurrency_tx =
'';
443 $search_multicurrency_montant_ht =
'';
444 $search_multicurrency_montant_vat =
'';
445 $search_multicurrency_montant_ttc =
'';
446 $search_dispute_status =
'';
448 $search_paymentmode =
'';
449 $search_paymentterms =
'';
450 $search_bankaccount =
'';
451 $search_fk_input_reason =
'';
452 $search_module_source =
'';
453 $search_pos_source =
'';
457 $search_country =
'';
458 $search_type_thirdparty =
'';
459 $search_customer_code =
'';
460 $search_date_startday =
'';
461 $search_date_startmonth =
'';
462 $search_date_startyear =
'';
463 $search_date_endday =
'';
464 $search_date_endmonth =
'';
465 $search_date_endyear =
'';
466 $search_date_start =
'';
467 $search_date_end =
'';
468 $search_date_valid_startday =
'';
469 $search_date_valid_startmonth =
'';
470 $search_date_valid_startyear =
'';
471 $search_date_valid_endday =
'';
472 $search_date_valid_endmonth =
'';
473 $search_date_valid_endyear =
'';
474 $search_date_valid_start =
'';
475 $search_date_valid_end =
'';
476 $search_datelimit_startday =
'';
477 $search_datelimit_startmonth =
'';
478 $search_datelimit_startyear =
'';
479 $search_datelimit_endday =
'';
480 $search_datelimit_endmonth =
'';
481 $search_datelimit_endyear =
'';
482 $search_datelimit_start =
'';
483 $search_datelimit_end =
'';
485 $search_datec_start =
'';
486 $search_datec_end =
'';
488 $search_datem_start =
'';
489 $search_datem_end =
'';
491 $search_fac_rec_source_title =
'';
493 $search_import_key =
'';
494 $search_categ_cus = 0;
498 $search_array_options = array();
501if (empty($reshook)) {
502 $objectclass =
'Facture';
503 $objectlabel =
'Invoices';
504 $permissiontoread = $user->hasRight(
"facture",
"lire");
505 $permissiontoadd = $user->hasRight(
"facture",
"creer");
506 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
507 $uploaddir =
$conf->invoice->dir_output;
508 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
511if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
512 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
513 $arrayofselected = is_array($toselect) ? $toselect : array();
514 if (!empty($arrayofselected)) {
517 $note_private =
GETPOST(
'note_private',
'restricthtml');
519 if (empty($paiementdate)) {
520 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
522 $action =
'makepayment';
526 foreach ($arrayofselected as $toselectid) {
529 $result = $facture->fetch($toselectid);
538 $paiementAmount = $facture->getSommePaiement();
539 $totalcreditnotes = $facture->getSumCreditNotesUsed();
540 $totaldeposits = $facture->getSumDepositsUsed();
542 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
543 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
546 $parameters = array(
'remaintopay' => $remaintopay);
547 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
549 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
550 $remaintopay = $remain;
552 } elseif ($reshook < 0) {
554 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
557 if ($remaintopay != 0) {
558 $resultBank = $facture->setBankAccount($bankid);
559 if ($resultBank < 0) {
564 $paiement->datepaye = $paiementdate;
565 $paiement->amounts[$facture->id] = $remaintopay;
566 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
567 $paiement->paiementid = $paiementid;
568 $paiement->note_private = $note_private;
569 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
570 if ($paiement_id < 0) {
571 $langs->load(
"errors");
572 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
575 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
577 $langs->load(
"errors");
578 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
584 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
588 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
593 if (empty($errorpayment)) {
594 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
602} elseif ($massaction ==
'withdrawrequest') {
603 $langs->load(
"withdrawals");
605 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
612 $arrayofselected = is_array($toselect) ? $toselect : array();
613 $listofbills = array();
614 foreach ($arrayofselected as $toselectid) {
616 $result = $objecttmp->fetch($toselectid);
618 $totalpaid = $objecttmp->getSommePaiement();
619 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
620 $totaldeposits = $objecttmp->getSumDepositsUsed();
621 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
624 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
625 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
627 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
628 $objecttmp->resteapayer = $remaintopay;
630 } elseif ($reshook < 0) {
632 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
637 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
638 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
640 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
641 } elseif ($objecttmp->resteapayer < 0) {
643 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
646 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
647 $rsql .=
" , pfd.date_traite as date_traite";
648 $rsql .=
" , pfd.amount";
649 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
650 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
651 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
652 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
653 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
654 $rsql .=
" AND pfd.traite = 0";
655 $rsql .=
" ORDER BY pfd.date_demande DESC";
658 $result_sql =
$db->query($rsql);
660 $numprlv =
$db->num_rows($result_sql);
665 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
666 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
667 $langs->load(
"errors");
669 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
671 $listofbills[] = $objecttmp;
677 if (!empty($listofbills)) {
678 $nbwithdrawrequestok = 0;
679 foreach ($listofbills as $aBill) {
686 $sql =
"SELECT SUM(pfd.amount) as amount";
687 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
691 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
693 $sql .=
" AND pfd.traite = 0";
695 $resql =
$db->query($sql);
697 $obj =
$db->fetch_object($resql);
699 $pending += (float) $obj->amount;
705 $sqlPending =
"SELECT SUM(pl.amount) as amount";
706 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
707 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
711 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
713 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
714 $resPending =
$db->query($sqlPending);
716 if ($objPending =
$db->fetch_object($resPending)) {
717 $pending += (float) $objPending->amount;
720 $db->free($resPending);
722 $requestAmount = $aBill->resteapayer - $pending;
725 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
726 if ($requestAmount > 0) {
729 $nbwithdrawrequestok++;
735 $aBill->error =
'WithdrawRequestErrorNilAmount';
736 $aBill->errors[] = $aBill->error;
740 if ($nbwithdrawrequestok > 0) {
741 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
763$company_url_list = array();
768 if (empty($search_company)) {
769 $search_company = $soc->name;
775$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
776$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
778$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
779$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
784$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,';
785$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
786$sql .=
' f.fk_user_author,';
787$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,';
788$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
789$sql .=
" f.fk_input_reason,";
790$sql .=
" f.module_source, f.pos_source,";
791$sql .=
' f.paye as paye, f.fk_statut as status, f.import_key, f.close_code,';
792$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
793$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
794$sql .=
' f.payment_reference, f.dispute_status,';
795$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,';
796$sql .=
" s.parent as fk_parent,";
797$sql .=
" s2.nom as name2,";
798$sql .=
' typent.code as typent_code,';
799$sql .=
' state.code_departement as state_code, state.nom as state_name,';
800$sql .=
' country.code as country_code,';
801$sql .=
' f.fk_fac_rec_source,';
802$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
803$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';
813if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
814 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
815 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
819$parameters = array();
820$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
821$sql .= $hookmanager->resPrint;
822$sql = preg_replace(
'/,\s*$/',
'', $sql);
826$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
827$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
828$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
829$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
830$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
831$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
833if ($sortfield ==
"f.datef") {
834 $hasAnotherfilter =
false;
835 foreach ($search_array_options as $v) {
836 if ($v !==
'' && (
string) $v !==
'-1') {
837 $hasAnotherfilter =
true;
841 if (!$hasAnotherfilter) {
842 $sql .=
$db->hintindex(
'idx_facture_datef');
845if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
846 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
848if (!empty($search_fac_rec_source_title)) {
849 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
851$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
852$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
853$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON ba.rowid = f.fk_account';
855$parameters = array();
856$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
857$sql .= $hookmanager->resPrint;
859$sql .=
' WHERE f.fk_soc = s.rowid';
860$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
862 $sql .=
' AND s.rowid = '.((int) $socid);
866 $sql .=
' AND f.fk_user_author IS NULL';
868 $sql .=
' AND f.fk_user_author = '.((int) $userid);
874if ($search_refcustomer) {
877if ($search_type !=
'' && $search_type !=
'-1') {
878 $sql .=
" AND f.type IN (".$db->sanitize(
$db->escape($search_type)).
")";
880if ($search_subtype !=
'' && $search_subtype !=
'-1') {
881 $sql .=
" AND f.subtype IN (".$db->sanitize(
$db->escape($search_subtype)).
")";
883if ($search_project_ref) {
886if ($search_project) {
889if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
890 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
892 if ($search_company) {
895 if ($search_company_alias) {
899if ($search_parent_name) {
902if ($search_customer_code) {
914if (strlen(trim($search_country))) {
916 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
917 foreach ($arrayofcode as $key => $value) {
918 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
919 if ($value !=
$mysoc->country_code) {
920 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
923 if ($search_country ==
'special_allnotme') {
924 $sql .=
" AND country.code <> '".$db->escape(
$mysoc->country_code).
"'";
925 } elseif ($search_country ==
'special_eec') {
926 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
927 } elseif ($search_country ==
'special_eecnotme') {
928 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
929 } elseif ($search_country ==
'special_noteec') {
930 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
935if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
936 $sql .=
" AND s.fk_typent IN (".$db->sanitize(
$db->escape($search_type_thirdparty)).
')';
938if ($search_montant_ht !=
'') {
941if ($search_montant_vat !=
'') {
944if ($search_montant_localtax1 !=
'') {
945 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
947if ($search_montant_localtax2 !=
'') {
948 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
950if ($search_montant_ttc !=
'') {
953if ($search_multicurrency_code !=
'') {
954 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
956if ($search_multicurrency_tx !=
'') {
957 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
959if ($search_multicurrency_montant_ht !=
'') {
960 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
962if ($search_multicurrency_montant_vat !=
'') {
963 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
965if ($search_multicurrency_montant_ttc !=
'') {
966 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
969 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
971if ($search_dispute_status !=
'-1' && $search_dispute_status !=
'') {
972 if ($search_dispute_status ==
'0') {
973 $sql .=
" AND (f.dispute_status IS NULL OR f.dispute_status = 0)";
975 $sql .=
" AND f.dispute_status IN (".$db->sanitize($search_dispute_status).
")";
978if (is_array($search_status) && count($search_status) > 0) {
979 $search_statusArray = $search_status;
980 $sql .=
" AND f.fk_statut IN (" .
$db->sanitize(implode(
',', array_map(
'intval', $search_statusArray))) .
")";
983if ($search_paymentmode > 0) {
984 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
986if ($search_paymentterms > 0) {
987 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
989if ($search_bankaccount > 0) {
990 $sql .=
" AND ba.rowid = ".((int) $search_bankaccount);
992if ($search_fk_input_reason > 0) {
993 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
995if ($search_module_source) {
998if ($search_pos_source) {
1001if ($search_date_start) {
1002 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
1004if ($search_date_end) {
1005 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
1007if ($search_date_valid_start) {
1008 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
1010if ($search_date_valid_end) {
1011 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
1013if ($search_datelimit_start) {
1014 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
1016if ($search_datelimit_end) {
1017 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
1019if ($search_note_public) {
1020 $sql .=
" AND p.note_public LIKE '%".$db->escape(
$db->escapeforlike($search_note_public)).
"%'";
1022if ($search_note_private) {
1023 $sql .=
" AND p.note_private LIKE '%".$db->escape(
$db->escapeforlike($search_note_private)).
"%'";
1025if ($search_datec_start) {
1026 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
1028if ($search_datec_end) {
1029 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
1031if ($search_datem_start) {
1032 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
1034if ($search_datem_end) {
1035 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
1037if ($search_option ==
'late') {
1038 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->invoice->client->warning_delay).
"'";
1043if (!empty($search_fac_rec_source_title)) {
1044 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
1046if ($search_fk_fac_rec_source) {
1047 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1049if ($search_import_key) {
1053if ($search_user > 0) {
1054 $sql .=
" AND EXISTS (";
1055 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1056 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1057 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1058 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1059 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1062if ($search_sale && $search_sale !=
'-1') {
1063 if ($search_sale == -2) {
1064 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1065 } elseif ($search_sale > 0) {
1066 $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).
")";
1071if (!empty($searchCategoryInvoiceList)) {
1072 $searchCategoryInvoiceSqlList = array();
1073 $listofcategoryid =
'';
1074 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1075 if (intval($searchCategoryInvoice) == -2) {
1076 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1077 } elseif (intval($searchCategoryInvoice) > 0) {
1078 if ($searchCategoryInvoiceOperator == 0) {
1079 $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).
")";
1081 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1085 if ($listofcategoryid) {
1086 $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).
"))";
1088 if ($searchCategoryInvoiceOperator == 1) {
1089 if (!empty($searchCategoryInvoiceSqlList)) {
1090 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1093 if (!empty($searchCategoryInvoiceSqlList)) {
1094 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1100$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1101$searchCategoryProductOperator = 0;
1102if (!empty($searchCategoryProductList)) {
1103 $searchCategoryProductSqlList = array();
1104 $listofcategoryid =
'';
1105 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1106 if (intval($searchCategoryProduct) == -2) {
1107 $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)";
1108 } elseif (intval($searchCategoryProduct) > 0) {
1109 if ($searchCategoryProductOperator == 0) {
1110 $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).
")";
1112 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1116 if ($listofcategoryid) {
1117 $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).
"))";
1119 if ($searchCategoryProductOperator == 1) {
1120 if (!empty($searchCategoryProductSqlList)) {
1121 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1124 if (!empty($searchCategoryProductSqlList)) {
1125 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1129$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1130$searchCategoryCustomerOperator = 0;
1132if (!empty($searchCategoryCustomerList)) {
1133 $searchCategoryCustomerSqlList = array();
1134 $listofcategoryid =
'';
1135 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1136 if (intval($searchCategoryCustomer) == -2) {
1137 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1138 } elseif (intval($searchCategoryCustomer) > 0) {
1139 if ($searchCategoryCustomerOperator == 0) {
1140 $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).
")";
1142 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1146 if ($listofcategoryid) {
1147 $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).
"))";
1149 if ($searchCategoryCustomerOperator == 1) {
1150 if (!empty($searchCategoryCustomerSqlList)) {
1151 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1154 if (!empty($searchCategoryCustomerSqlList)) {
1155 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1160include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1162$parameters = array();
1163$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1164$sql .= $hookmanager->resPrint;
1169 $fieldstosearchallwithoutpd = array();
1170 $fieldstosearchallwithpd = array();
1171 foreach ($fieldstosearchall as $key => $val) {
1172 if (!preg_match(
'/^pd\./', $key)) {
1173 $fieldstosearchallwithoutpd[$key] = $val;
1175 $fieldstosearchallwithpd[$key] = $val;
1179 if (count($fieldstosearchallwithpd) > 0) {
1180 $sqltoadd .=
" OR EXISTS (SELECT pd.rowid FROM ".MAIN_DB_PREFIX.
"facturedet as pd WHERE pd.fk_facture = f.rowid";
1181 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
1185 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
1188$parameters = array();
1189$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1190if (empty($reshook)) {
1191 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1193 $sql = $hookmanager->resPrint;
1197$nbtotalofrecords =
'';
1200 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1201 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1203 $resql =
$db->query($sqlforcount);
1205 $objforcount =
$db->fetch_object($resql);
1206 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1211 if (($page * $limit) > (
int) $nbtotalofrecords) {
1219$sql .=
$db->order($sortfield, $sortorder);
1221 $sql .=
$db->plimit($limit + 1, $offset);
1224$resql =
$db->query($sql);
1230$num =
$db->num_rows($resql);
1232$arrayofselected = is_array($toselect) ? $toselect : array();
1234if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1235 $obj =
$db->fetch_object($resql);
1238 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1245llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1248if ($search_fk_fac_rec_source) {
1250 $object->fetch((
int) $search_fk_fac_rec_source);
1259 $param .=
'&mode='.urlencode($mode);
1261if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1262 $param .=
'&contextpage='.urlencode($contextpage);
1264if ($limit > 0 && $limit !=
$conf->liste_limit) {
1265 $param .=
'&limit='.((int) $limit);
1267if ($optioncss !=
'') {
1268 $param .=
'&optioncss='.urlencode($optioncss);
1271 $param .=
'&show_files='.urlencode((
string) ($show_files));
1274 $param .=
'&search_all='.urlencode($search_all);
1277 $param .=
'&socid='.((int) $socid);
1279if ($search_date_startday) {
1280 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1282if ($search_date_startmonth) {
1283 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1285if ($search_date_startyear) {
1286 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1288if ($search_date_endday) {
1289 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1291if ($search_date_endmonth) {
1292 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1294if ($search_date_endyear) {
1295 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1297if ($search_date_valid_startday) {
1298 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1300if ($search_date_valid_startmonth) {
1301 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1303if ($search_date_valid_startyear) {
1304 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1306if ($search_date_valid_endday) {
1307 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1309if ($search_date_valid_endmonth) {
1310 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1312if ($search_date_valid_endyear) {
1313 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1315if ($search_datelimit_startday) {
1316 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1318if ($search_datelimit_startmonth) {
1319 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1321if ($search_datelimit_startyear) {
1322 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1324if ($search_datelimit_endday) {
1325 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1327if ($search_datelimit_endmonth) {
1328 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1330if ($search_datelimit_endyear) {
1331 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1334 $param .=
'&search_ref='.urlencode($search_ref);
1336if ($search_refcustomer) {
1337 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1339if ($search_project_ref) {
1340 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1342if ($search_project) {
1343 $param .=
'&search_project='.urlencode($search_project);
1345if ($search_type !=
'') {
1346 $param .=
'&search_type='.urlencode($search_type);
1348if ($search_subtype !=
'') {
1349 $param .=
'&search_subtype='.urlencode($search_subtype);
1351if ($search_company) {
1352 $param .=
'&search_company='.urlencode($search_company);
1354if ($search_company_alias) {
1355 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1357if ($search_parent_name !=
'') {
1358 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1361 $param .=
'&search_town='.urlencode($search_town);
1364 $param .=
'&search_zip='.urlencode($search_zip);
1366if ($search_country) {
1367 $param .=
"&search_country=".urlencode($search_country);
1369if ($search_type_thirdparty !=
'') {
1370 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1372if ($search_customer_code) {
1373 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1375if ($search_sale > 0) {
1376 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1378if ($search_user > 0) {
1379 $param .=
'&search_user='.urlencode((
string) $search_user);
1382 $param .=
'&search_login='.urlencode($search_login);
1384if ($searchCategoryInvoiceOperator == 1) {
1385 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1387foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1388 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1390if ($search_product_category > 0) {
1391 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1393if ($search_montant_ht !=
'') {
1394 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1396if ($search_montant_vat !=
'') {
1397 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1399if ($search_montant_localtax1 !=
'') {
1400 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1402if ($search_montant_localtax2 !=
'') {
1403 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1405if ($search_montant_ttc !=
'') {
1406 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1408if ($search_multicurrency_code !=
'') {
1409 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1411if ($search_multicurrency_tx !=
'') {
1412 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1414if ($search_multicurrency_montant_ht !=
'') {
1415 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1417if ($search_multicurrency_montant_vat !=
'') {
1418 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1420if ($search_multicurrency_montant_ttc !=
'') {
1421 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1423if ($search_dispute_status !=
'') {
1424 $param .=
'&search_dispute_status='.urlencode($search_dispute_status);
1426if (count($search_status) > 0) {
1427 foreach ($search_status as $key => $val) {
1428 $param .=
'&search_status[]='.urlencode($val);
1431if ($search_paymentmode > 0) {
1432 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1434if ($search_paymentterms > 0) {
1435 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1437if ($search_bankaccount > 0) {
1438 $param .=
'&search_bankaccount='.urlencode((
string) ($search_bankaccount));
1440if ($search_fk_input_reason > 0) {
1441 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1443if ($search_module_source) {
1444 $param .=
'&search_module_source='.urlencode($search_module_source);
1446if ($search_pos_source) {
1447 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1449if ($search_option) {
1450 $param .=
"&search_option=".urlencode($search_option);
1452if ($search_categ_cus > 0) {
1453 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1455if (!empty($search_fac_rec_source_title)) {
1456 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1458if ($search_fk_fac_rec_source) {
1459 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1461if ($search_import_key !=
'') {
1462 $param .=
'&search_import_key='.urlencode($search_import_key);
1466include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1468$parameters = array(
'param' => &$param);
1469$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1470$param .= $hookmanager->resPrint;
1472$arrayofmassactions = array(
1473 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1474 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1475 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1476 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1479if (
isModEnabled(
'category') && $user->hasRight(
'facture',
'creer')) {
1480 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1482if ($user->hasRight(
'facture',
'paiement')) {
1483 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1485if (
isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1486 $langs->load(
"withdrawals");
1487 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1489if ($user->hasRight(
'facture',
'supprimer')) {
1491 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1494if ($user->hasRight(
"facture",
"creer")) {
1496 $arrayofmassactions[
'precreatecreditnote'] =
img_picto(
'',
'undo',
'class="pictofixedwidth"').$langs->trans(
"cancelByCreditNote");
1499if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1500 $arrayofmassactions = array();
1502$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1507if ($contextpage !=
'poslist') {
1508 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1510 $url .=
'&socid='.urlencode((
string)
$object->socid);
1513 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1515 $newcardbutton =
'';
1516 $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'));
1517 $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'));
1518 $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'));
1519 $newcardbutton .= dolGetButtonTitleSeparator();
1520 $newcardbutton .= dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1526print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1527if ($optioncss !=
'') {
1528 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1530print
'<input type="hidden" name="token" value="'.newToken().
'">';
1531print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1532if (!in_array($massaction, array(
'makepayment'))) {
1533 print
'<input type="hidden" name="action" value="list">';
1535print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1536print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1538print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1539print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1540print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1542print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1544$topicmail =
"SendBillRef";
1545$modelmail =
"facture_send";
1547$trackid =
'inv'.$object->id;
1548include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1550if ($massaction ==
'makepayment') {
1552 $formquestion = array(
1556 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1557 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1558 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1559 array(
'type' =>
'other',
'name' =>
'note_private',
'label' => $langs->trans(
"Comments"),
'value' =>
'<textarea name="note_private" id="note_private" class="minwidth200" rows="3"></textarea>'),
1562 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1567 foreach ($fieldstosearchall as $key => $val) {
1568 $fieldstosearchall[$key] = $langs->trans($val);
1570 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1576if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1578 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1580if ($user->hasRight(
"user",
"user",
"lire")) {
1581 $langs->load(
"commercial");
1582 $moreforfilter .=
'<div class="divsearchfield">';
1583 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1584 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1585 $moreforfilter .=
'</div>';
1588if ($user->hasRight(
"user",
"user",
"lire")) {
1589 $moreforfilter .=
'<div class="divsearchfield">';
1590 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1591 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1592 $moreforfilter .=
'</div>';
1595if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1596 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1597 $moreforfilter .=
'<div class="divsearchfield">';
1598 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1599 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1600 $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);
1601 $moreforfilter .=
'</div>';
1603if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1604 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1605 $moreforfilter .=
'<div class="divsearchfield">';
1606 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1607 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1608 $moreforfilter .=
'</div>';
1611$moreforfilter .=
'<div class="divsearchfield">';
1612$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1613$moreforfilter .=
'</div>';
1615$parameters = array();
1616$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1617if (empty($reshook)) {
1618 $moreforfilter .= $hookmanager->resPrint;
1620 $moreforfilter = $hookmanager->resPrint;
1623if (!empty($moreforfilter)) {
1624 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1625 print $moreforfilter;
1630$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1631$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1634if ($massactionbutton && $contextpage !=
'poslist') {
1635 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1638print
'<div class="div-table-responsive">';
1639print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1643print
'<tr class="liste_titre_filter">';
1646if (
$conf->main_checkbox_left_column) {
1647 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1648 $searchpicto = $form->showFilterButtons(
'left');
1654 print
'<td class="liste_titre">';
1658if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1659 print
'<td class="liste_titre">';
1660 print
'<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1664if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1665 print
'<td class="liste_titre">';
1666 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1670if (!empty($arrayfields[
'f.type'][
'checked'])) {
1671 print
'<td class="liste_titre maxwidthonsmartphone">';
1683 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1687if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1688 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1689 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1693if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1694 print
'<td class="liste_titre center">';
1695 print
'<div class="nowrapfordate">';
1696 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1698 print
'<div class="nowrapfordate">';
1699 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1704if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1705 print
'<td class="liste_titre center">';
1706 print
'<div class="nowrapfordate">';
1707 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'));
1709 print
'<div class="nowrapfordate">';
1710 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'));
1715if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1716 print
'<td class="liste_titre center">';
1717 print
'<div class="nowrapfordate">';
1718 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1720 print
'<div class="nowrapfordate">';
1721 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1726if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1727 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1730if (!empty($arrayfields[
'p.title'][
'checked'])) {
1731 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1734if (!empty($arrayfields[
's.nom'][
'checked'])) {
1735 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>';
1738if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1739 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1742if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1743 print
'<td class="liste_titre">';
1744 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1748if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1749 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1752if (!empty($arrayfields[
's.town'][
'checked'])) {
1753 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1756if (!empty($arrayfields[
's.zip'][
'checked'])) {
1757 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1760if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1761 print
'<td class="liste_titre">';
1762 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1766if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1767 print
'<td class="liste_titre center">';
1768 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1772if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1773 print
'<td class="liste_titre maxwidthonsmartphone center">';
1774 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);
1778if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1779 print
'<td class="liste_titre">';
1780 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1784if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1785 print
'<td class="liste_titre left">';
1786 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1790if (!empty($arrayfields[
'ba.label'][
'checked'])) {
1791 print
'<td class="liste_titre">';
1792 $form->select_comptes($search_bankaccount,
'search_bankaccount', 0,
'', 1,
'', 0,
'maxwidth125');
1796if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1797 print
'<td class="liste_titre">';
1798 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1802if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1803 print
'<td class="liste_titre">';
1804 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1808if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1809 print
'<td class="liste_titre">';
1810 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1813if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1815 print
'<td class="liste_titre right">';
1816 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1819if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1821 print
'<td class="liste_titre right">';
1822 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1825if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1827 print
'<td class="liste_titre right">';
1828 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1831if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1833 print
'<td class="liste_titre right">';
1834 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1837if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1839 print
'<td class="liste_titre right">';
1840 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1843if (!empty($arrayfields[
'u.login'][
'checked'])) {
1845 print
'<td class="liste_titre" align="center">';
1846 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1849if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1850 print
'<td class="liste_titre"></td>';
1852if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1853 print
'<td class="liste_titre" align="right">';
1856if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1857 print
'<td class="liste_titre right">';
1860if (!empty($arrayfields[
'rtp'][
'checked'])) {
1861 print
'<td class="liste_titre">';
1864if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1866 print
'<td class="liste_titre">';
1867 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1870if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1872 print
'<td class="liste_titre">';
1873 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1876if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1878 print
'<td class="liste_titre right">';
1879 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1882if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1884 print
'<td class="liste_titre right">';
1885 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1888if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1890 print
'<td class="liste_titre right">';
1891 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1894if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1895 print
'<td class="liste_titre">';
1898if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1899 print
'<td class="liste_titre right">';
1902if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1903 print
'<td class="liste_titre right">';
1906if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1907 print
'<td class="liste_titre right">';
1910if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1911 print
'<td class="liste_titre right">';
1914if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1915 print
'<td class="liste_titre right">';
1920include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1923$parameters = array(
'arrayfields' => $arrayfields);
1924$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1925print $hookmanager->resPrint;
1927if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1928 print
'<td class="liste_titre center">';
1929 print
'<div class="nowrapfordate">';
1930 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1932 print
'<div class="nowrapfordate">';
1933 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1938if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1939 print
'<td class="liste_titre center">';
1940 print
'<div class="nowrapfordate">';
1941 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1943 print
'<div class="nowrapfordate">';
1944 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1949if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1950 print
'<td class="liste_titre">';
1953if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1955 print
'<td class="liste_titre">';
1956 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1959if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1961 print
'<td class="liste_titre">';
1962 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1965if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1967 print
'<td class="liste_titre maxwidthonsmartphone right">';
1968 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).
'">';
1972if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1973 print
'<td class="liste_titre maxwidthonsmartphone center">';
1974 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1978if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
1979 print
'<td class="liste_titre center parentonrightofpage">';
1980 $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS;
1982 print $form->selectarray(
'search_dispute_status', $liststatus, $search_dispute_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1986if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1987 print
'<td class="liste_titre center parentonrightofpage">';
1988 $liststatus = array(
1989 '0' => $langs->trans(
"BillShortStatusDraft"),
1990 '1' => $langs->trans(
"BillShortStatusNotPaid"),
1991 '2' => $langs->trans(
"BillShortStatusPaid"),
1992 '3' => $langs->trans(
"BillShortStatusCanceled")
1995 print $form->multiselectarray(
'search_status', $liststatus, $search_status, 0, 0,
'minwidth125', 1, 0);
1999if (!
$conf->main_checkbox_left_column) {
2000 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
2001 $searchpicto = $form->showFilterButtons();
2012print
'<tr class="liste_titre">';
2014if (
$conf->main_checkbox_left_column) {
2015 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
2022if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2023 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
2026if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2027 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
2030if (!empty($arrayfields[
'f.type'][
'checked'])) {
2031 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
2034if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2035 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
2037if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2038 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
2041if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2042 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
2045if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2046 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
2049if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2050 $langs->load(
"projects");
2051 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
2054if (!empty($arrayfields[
'p.title'][
'checked'])) {
2055 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
2058if (!empty($arrayfields[
's.nom'][
'checked'])) {
2059 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
2062if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2064 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
2067if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2068 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
2071if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2072 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
2075if (!empty($arrayfields[
's.town'][
'checked'])) {
2076 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
2079if (!empty($arrayfields[
's.zip'][
'checked'])) {
2080 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
2083if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2084 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
2087if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2088 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
2091if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2092 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
2095if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2096 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
2099if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2100 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
2103if (!empty($arrayfields[
'ba.label'][
'checked'])) {
2104 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
2107if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2108 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
2110if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2111 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2114if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2115 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2118if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2119 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2122if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2123 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2126if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2127 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2130if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2131 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2134if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2135 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2138if (!empty($arrayfields[
'u.login'][
'checked'])) {
2139 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2142if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2143 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2146if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2147 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2150if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2151 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2154if (!empty($arrayfields[
'rtp'][
'checked'])) {
2155 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2158if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2159 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2162if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2163 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2166if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2167 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2170if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2171 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2174if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2175 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2178if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2179 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2182if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2183 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2186if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2187 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2190if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2191 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2194if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2195 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2198if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2199 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2203include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2205$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
2206$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2207print $hookmanager->resPrint;
2208if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2209 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2212if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2213 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2216if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2217 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2220if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2221 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2224if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2225 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2228if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2229 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2233if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2234 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2238if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
2239 print_liste_field_titre($arrayfields[
'f.dispute_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.dispute_status,f.ref",
"", $param,
'', $sortfield, $sortorder,
'center ');
2243if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2244 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2248if (!
$conf->main_checkbox_left_column) {
2249 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2275 $typenArray = $formcompany->typent_array(1);
2277 $with_margin_info =
false;
2279 !empty($arrayfields[
'total_pa'][
'checked'])
2280 || !empty($arrayfields[
'total_margin'][
'checked'])
2281 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2282 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2285 $with_margin_info =
true;
2290 $imaxinloop = ($limit ? min($num, $limit) : $num);
2291 while ($i < $imaxinloop) {
2292 $obj =
$db->fetch_object($resql);
2297 $datelimit =
$db->jdate($obj->datelimite);
2299 $facturestatic->id = $obj->id;
2300 $facturestatic->ref = $obj->ref;
2301 $facturestatic->ref_client = $obj->ref_client;
2302 $facturestatic->ref_customer = $obj->ref_client;
2303 $facturestatic->type = $obj->type;
2304 $facturestatic->subtype = $obj->subtype;
2305 $facturestatic->total_ht = $obj->total_ht;
2306 $facturestatic->total_tva = $obj->total_tva;
2307 $facturestatic->total_ttc = $obj->total_ttc;
2308 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2309 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2310 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2311 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2312 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2313 $facturestatic->status = $obj->status;
2314 $facturestatic->close_code = $obj->close_code;
2315 $facturestatic->total_ttc = $obj->total_ttc;
2316 $facturestatic->paye = $obj->paye;
2317 $facturestatic->socid = $obj->fk_soc;
2319 $facturestatic->date =
$db->jdate($obj->datef);
2320 $facturestatic->date_validation =
$db->jdate($obj->date_valid);
2321 $facturestatic->date_lim_reglement =
$db->jdate($obj->datelimite);
2323 $facturestatic->note_public = $obj->note_public;
2324 $facturestatic->note_private = $obj->note_private;
2327 $facturestatic->retained_warranty = $obj->retained_warranty;
2328 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2329 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2330 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2331 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2332 $facturestatic->situation_counter = $obj->situation_counter;
2335 $facturestatic->payment_reference = $obj->payment_reference;
2336 $facturestatic->dispute_status = $obj->dispute_status;
2338 $companystatic->id = $obj->socid;
2339 $companystatic->name = $obj->name;
2340 $companystatic->name_alias = $obj->alias;
2341 $companystatic->client = $obj->client;
2342 $companystatic->fournisseur = $obj->fournisseur;
2343 $companystatic->code_client = $obj->code_client;
2344 $companystatic->code_compta_client = $obj->code_compta_client;
2345 $companystatic->code_fournisseur = $obj->code_fournisseur;
2346 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2347 $companystatic->email = $obj->email;
2348 $companystatic->phone = $obj->phone;
2349 $companystatic->fax = $obj->fax;
2350 $companystatic->address = $obj->address;
2351 $companystatic->zip = $obj->zip;
2352 $companystatic->town = $obj->town;
2353 $companystatic->country_code = $obj->country_code;
2355 $projectstatic->id = $obj->project_id;
2356 $projectstatic->ref = $obj->project_ref;
2357 $projectstatic->title = $obj->project_label;
2359 $paiement = $facturestatic->getSommePaiement();
2360 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2361 $totaldeposits = $facturestatic->getSumDepositsUsed();
2362 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2363 $remaintopay = $obj->total_ttc - $totalallpayments;
2365 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2366 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2367 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2369 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2370 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2372 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2373 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2377 $multicurrency_remaintopay = 0;
2380 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2381 $remaintopay = -$remaincreditnote;
2382 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2383 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2384 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2385 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2388 $facturestatic->alreadypaid = $paiement;
2389 $facturestatic->totalpaid = $paiement;
2390 $facturestatic->totalcreditnotes = $totalcreditnotes;
2391 $facturestatic->totaldeposits = $totaldeposits;
2393 $marginInfo = array();
2394 if ($with_margin_info) {
2395 $facturestatic->fetch_lines();
2396 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2397 $total_ht += $obj->total_ht;
2398 $total_margin += $marginInfo[
'total_margin'];
2403 if ($mode ==
'kanban') {
2405 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2406 print
'<div class="box-flex-container kanban">';
2409 if ($massactionbutton || $massaction) {
2411 if (in_array(
$object->id, $arrayofselected)) {
2416 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2417 print $facturestatic->getKanbanView(
'', $arraydata);
2418 if ($i == ($imaxinloop - 1)) {
2425 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2426 if ($contextpage ==
'poslist') {
2427 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2428 if (strpos($obj->ref, 'PROV
') !== false) {
2429 //If is a draft invoice, load var to be able to add products
2430 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2431 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2438 if (
$conf->main_checkbox_left_column) {
2439 print
'<td class="nowrap center">';
2440 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2442 if (in_array($obj->id, $arrayofselected)) {
2445 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2455 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2462 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2463 print
'<td class="nowraponall">';
2465 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2467 print
'<td class="nobordernopadding nowraponall">';
2468 if ($contextpage ==
'poslist') {
2471 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2475 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2476 $filedir = $filepath.
'/'.$filename;
2478 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2479 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2491 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2492 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2493 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2502 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2503 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2504 print $facturestatic->getLibType(2);
2512 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2514 if ($facturestatic->subtype > 0) {
2515 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2517 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2526 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2527 print
'<td align="center" class="nowraponall">';
2536 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2537 print
'<td align="center" class="nowraponall">';
2546 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2547 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2548 if ($facturestatic->hasDelay()) {
2549 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2558 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2559 print
'<td class="nocellnopadd nowraponall">';
2560 if ($obj->project_id > 0) {
2561 print $projectstatic->getNomUrl(1);
2570 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2571 print
'<td class="nowraponall">';
2572 if ($obj->project_id > 0) {
2582 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2583 print
'<td class="tdoverflowmax150">';
2584 if ($contextpage ==
'poslist') {
2587 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2595 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2596 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2604 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2605 print
'<td class="tdoverflowmax200">';
2606 if ($obj->fk_parent > 0) {
2607 if (!isset($company_url_list[$obj->fk_parent])) {
2609 $res = $companyparent->fetch($obj->fk_parent);
2611 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2614 if (isset($company_url_list[$obj->fk_parent])) {
2615 print $company_url_list[$obj->fk_parent];
2624 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2625 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2633 if (!empty($arrayfields[
's.town'][
'checked'])) {
2634 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2642 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2643 print
'<td class="nowraponall">';
2651 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2652 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2658 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2659 $tmparray =
getCountry($obj->fk_pays,
'all');
2660 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2668 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2669 if (!is_array($typenArray) || count($typenArray) == 0) {
2670 $typenArray = $formcompany->typent_array(1);
2672 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2673 if (!empty($obj->typent_code)) {
2674 print $typenArray[$obj->typent_code];
2682 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2683 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2684 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2686 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2687 print
$conf->cache[
'staff'][$obj->staff_code];
2695 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2696 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2697 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2706 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2707 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2708 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2717 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
2719 if (!empty($obj->bid)) {
2720 $accountstatic->id = $obj->bid;
2721 $accountstatic->ref = $obj->bref;
2722 $accountstatic->label = $obj->blabel;
2723 $accountstatic->number = $obj->bnumber;
2724 $accountstatic->account_number = $obj->baccount_number;
2725 $accountstatic->accountancy_journal = $obj->baccountancy_journal;
2726 print $accountstatic->getNomUrl(1);
2735 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2737 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2745 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2754 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2764 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2765 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2772 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2775 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2776 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2783 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2786 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2787 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2794 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2797 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2798 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2805 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2808 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2809 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2816 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2819 $userstatic->id = $obj->fk_user_author;
2820 $userstatic->login = $obj->login;
2821 $userstatic->lastname = $obj->lastname;
2822 $userstatic->firstname = $obj->firstname;
2823 $userstatic->email = $obj->user_email;
2824 $userstatic->status = $obj->user_statut;
2825 $userstatic->entity = $obj->entity;
2826 $userstatic->photo = $obj->photo;
2827 $userstatic->office_phone = $obj->office_phone;
2828 $userstatic->office_fax = $obj->office_fax;
2829 $userstatic->user_mobile = $obj->user_mobile;
2830 $userstatic->job = $obj->job;
2831 $userstatic->gender = $obj->gender;
2834 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2835 print
'<td class="tdoverflowmax100">';
2836 if ($userstatic->id) {
2837 print $userstatic->getNomUrl(-1);
2847 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2850 if ($obj->socid > 0) {
2851 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2852 if ($listsalesrepresentatives < 0) {
2855 $nbofsalesrepresentative = count($listsalesrepresentatives);
2856 if ($nbofsalesrepresentative > 6) {
2858 print $nbofsalesrepresentative;
2859 } elseif ($nbofsalesrepresentative > 0) {
2861 foreach ($listsalesrepresentatives as $val) {
2862 $userstatic->id = $val[
'id'];
2863 $userstatic->lastname = $val[
'lastname'];
2864 $userstatic->firstname = $val[
'firstname'];
2865 $userstatic->email = $val[
'email'];
2866 $userstatic->status = $val[
'statut'];
2867 $userstatic->entity = $val[
'entity'];
2868 $userstatic->photo = $val[
'photo'];
2869 $userstatic->login = $val[
'login'];
2870 $userstatic->office_phone = $val[
'office_phone'];
2871 $userstatic->office_fax = $val[
'office_fax'];
2872 $userstatic->user_mobile = $val[
'user_mobile'];
2873 $userstatic->job = $val[
'job'];
2874 $userstatic->gender = $val[
'gender'];
2876 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2878 if ($j < $nbofsalesrepresentative) {
2892 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2893 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2899 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2900 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2907 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2911 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2912 print
'<td class="right nowraponall amount">';
2913 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2926 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2927 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2928 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2929 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2931 $title = $obj->multicurrency_code;
2932 $label = $obj->multicurrency_code;
2934 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2943 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2944 print
'<td class="nowraponall">';
2945 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2952 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2953 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2959 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2960 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2966 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2967 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2973 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2974 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2981 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2982 print
'<td class="right nowraponall amount">';
2983 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2991 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2992 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
3000 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
3003 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
3004 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
3012 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
3015 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
3016 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
3022 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
3023 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
3028 if ($i >= $imaxinloop - 1) {
3029 if (!empty($total_ht)) {
3038 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
3040 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
3041 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
3042 print $hookmanager->resPrint;
3044 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
3045 print
'<td class="nowraponall center">';
3053 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
3054 print
'<td class="nowraponall center">';
3055 print
dol_print_date(
$db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
3062 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
3063 print
'<td class="nowraponall center">';
3071 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
3072 print
'<td class="sensiblehtmlcontent center">';
3073 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
3080 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
3081 print
'<td class="sensiblehtmlcontent center">';
3082 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
3089 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
3090 print
'<td class="center">';
3091 if (!empty($obj->fk_fac_rec_source)) {
3093 $result = $facrec->fetch($obj->fk_fac_rec_source);
3097 print $facrec->getNomUrl();
3107 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
3108 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
3115 if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
3116 print
'<td class="nowrap center">';
3117 if ($facturestatic->dispute_status) {
3118 $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS;
3119 print $langs->trans($liststatus[$facturestatic->dispute_status][
'label']);
3128 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
3129 print
'<td class="nowrap center">';
3130 print $facturestatic->getLibStatut(5, $totalallpayments);
3139 if (!
$conf->main_checkbox_left_column) {
3140 print
'<td class="nowrap center">';
3141 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
3143 if (in_array($obj->id, $arrayofselected)) {
3146 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3165 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3171 foreach ($arrayfields as $key => $val) {
3172 if (!empty($val[
'checked'])) {
3176 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3181$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3182$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3183print $hookmanager->resPrint;
3185print
'</table>'.
"\n";
3188print
'</form>'.
"\n";
3191if ($contextpage !=
'poslist') {
3192 $hidegeneratedfilelistifempty = 1;
3193 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3194 $hidegeneratedfilelistifempty = 0;
3198 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3199 $urlsource .= str_replace(
'&',
'&', $param);
3201 $filedir = $diroutputmassaction;
3202 $genallowed = $user->hasRight(
"facture",
"lire");
3203 $delallowed = $user->hasRight(
"facture",
"creer");
3206 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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 '.
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...
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
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, $mode=0)
Check permissions of a user to show a page and an object.