46require
'../../main.inc.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
64require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
65require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
66require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
68require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
69require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
75 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
79$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories',
'cashdesk'));
81$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
84$action =
GETPOST(
'action',
'aZ09');
85$massaction =
GETPOST(
'massaction',
'alpha');
87$confirm =
GETPOST(
'confirm',
'alpha');
88$toselect =
GETPOST(
'toselect',
'array:int');
89$optioncss =
GETPOST(
'optioncss',
'alpha');
90$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
93if ($contextpage ==
'poslist') {
103$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
104$search_type =
GETPOST(
'search_type',
'intcomma');
105$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
106$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
107$search_project =
GETPOST(
'search_project',
'alpha');
108$search_company =
GETPOST(
'search_company',
'alpha');
109$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
110$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
111$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
112$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
113$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
114$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
115$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
116$search_login =
GETPOST(
'search_login',
'alpha');
117$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
118$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
119$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
120$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
121$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
122$search_dispute_status =
GETPOST(
'search_dispute_status',
'intcomma');
123$search_status =
GETPOST(
'search_status',
'intcomma');
124$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
125$search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
126$search_fk_input_reason =
GETPOSTINT(
'search_fk_input_reason');
127$search_module_source =
GETPOST(
'search_module_source',
'alpha');
128$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
129$search_town =
GETPOST(
'search_town',
'alpha');
130$search_zip =
GETPOST(
'search_zip',
'alpha');
131$search_state =
GETPOST(
"search_state");
132$search_country =
GETPOST(
"search_country",
'aZ09');
133$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
134$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
135$search_user =
GETPOST(
'search_user',
'intcomma');
136$search_sale =
GETPOST(
'search_sale',
'intcomma');
138$search_date_startday =
GETPOSTINT(
'search_date_startday');
139$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
140$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
141$search_date_endday =
GETPOSTINT(
'search_date_endday');
142$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
143$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
144$search_date_start =
GETPOSTDATE(
'search_date_start',
'getpost');
145$search_date_end =
GETPOSTDATE(
'search_date_end',
'getpostend');
147$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
148$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
149$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
150$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
151$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
152$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
153$search_date_valid_start =
GETPOSTDATE(
'search_date_valid_start',
'getpost');
154$search_date_valid_end =
GETPOSTDATE(
'search_date_valid_end',
'getpostend');
155$search_note_private =
GETPOST(
'search_note_private',
'alpha');
156$search_note_public =
GETPOST(
'search_note_public',
'alpha');
158$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
159$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
160$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
161$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
162$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
163$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
164$search_datelimit_start =
GETPOSTDATE(
'search_datelimit_start',
'getpost');
165$search_datelimit_end =
GETPOSTDATE(
'search_datelimit_end',
'getpostend');
168$search_datec_start =
GETPOSTDATE(
'search_datec_start',
'getpost',
'tzuserrel');
169$search_datec_end =
GETPOSTDATE(
'search_datec_end',
'getpostend',
'tzuserrel');
170$search_datem_start =
GETPOSTDATE(
'search_datem_start',
'getpost',
'tzuserrel');
171$search_datem_end =
GETPOSTDATE(
'search_datem_end',
'getpostend',
'tzuserrel');
173$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
174$searchCategoryInvoiceOperator = 0;
175if (GETPOSTISSET(
'formfilteraction')) {
176 $searchCategoryInvoiceOperator =
GETPOSTINT(
'search_category_invoice_operator');
180$searchCategoryInvoiceList =
GETPOST(
'search_category_invoice_list',
'array:int');
183$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
184$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
185$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
186$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
188$search_option =
GETPOST(
'search_option');
189if ($search_option ==
'late') {
190 $search_status =
'1';
194$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
195$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
197if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
202if ($contextpage ==
'poslist' && !GETPOSTISSET(
'limit')) {
206$offset = $limit * $page;
207if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
214 $sortfield =
'f.datef';
216$pageprev = $page - 1;
217$pagenext = $page + 1;
219$diroutputmassaction = $conf->invoice->dir_output.
'/temp/massgeneration/'.$user->id;
227$hookmanager->initHooks(array($contextpage));
231$extrafields->fetch_name_optionals_label(
$object->table_element);
233$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_') ?: [];
236$fieldstosearchall = array(
238 'f.ref_client' =>
'RefCustomer',
239 'f.note_public' =>
'NotePublic',
240 's.nom' =>
"ThirdParty",
241 's.code_client' =>
"CustomerCodeShort",
242 's.name_alias' =>
"AliasNameShort",
245 'pd.description' =>
'ProductDescription',
247if (empty($user->socid)) {
248 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
254$checkedtypetiers =
'0';
256 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
257 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' =>
'-1',
'position' => 10),
258 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
259 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
260 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 20),
261 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' =>
'0',
'position' => 22),
262 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 25),
263 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 30),
264 'p.ref' => array(
'label' =>
"ProjectRef",
'langfile' =>
'projects',
'checked' =>
'1',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0'),
'position' => 40),
265 'p.title' => array(
'label' =>
"ProjectLabel",
'langfile' =>
'projects',
'checked' =>
'0',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0'),
'position' => 41),
266 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 50),
267 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 51),
268 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' =>
'-1',
'position' => 52),
269 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' =>
'0'),
270 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 55),
271 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 60),
272 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 65),
273 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 70),
274 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
275 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'1',
'position' => 80),
276 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0',
'position' => 85),
277 'f.fk_input_reason' => array(
'label' =>
"Source",
'checked' => 0,
'enabled' => 1,
'position' => 88),
278 'f.module_source' => array(
'label' =>
"POSModule",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 90),
279 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 91),
280 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 95),
281 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 100),
282 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
$mysoc->localtax1_assuj ==
"1"),
'position' => 110),
283 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
$mysoc->localtax2_assuj ==
"1"),
'position' => 120),
284 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 130),
285 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' =>
'0',
'position' => 140),
286 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' =>
'0',
'position' => 150),
287 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 280),
288 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 285),
289 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 290),
290 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 291),
291 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 292),
292 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 295),
293 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 296),
294 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
295 'total_margin' => array(
'label' =>
'Margin',
'langfile' =>
'margins',
'checked' =>
'0',
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
296 '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')),
297 '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')),
298 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
299 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' =>
'1',
'visible' => -1,
'notnull' => 1,
'position' => 502),
300 'u.login' => array(
'label' =>
"UserAuthor",
'checked' =>
'0',
'visible' => -1,
'position' => 504),
301 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 506),
306 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
307 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
308 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' =>
'0',
'position' => 530,
'enabled' =>
'1'),
309 'f.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 990),
310 'f.dispute_status' => array(
'label' =>
"DisputeStatus",
'checked' =>
'-1',
'position' => 999),
311 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
315 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' =>
'0',
'position' => 86);
318$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
319if (empty($subtypearray)) {
320 unset($arrayfields[
'f.subtype']);
324foreach (
$object->fields as $key => $val) {
327 if (!empty($val[
'visible'])) {
328 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
330 if (array_key_exists($key, $arrayfields)) {
332 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
334 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
338 $arrayfields[$newkey] = array(
339 'label' => $val[
'label'],
340 'checked' => (($visible < 0) ?
'0' :
'1'),
341 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
342 'position' => $val[
'position'],
343 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
349include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
351$parameters = array(
'arrayfields' => &$arrayfields);
352$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
355if ($contextpage ==
'poslist') {
356 $arrayfields[
"f.module_source"][
'checked'] = 1;
357 $arrayfields[
"f.pos_source"][
'checked'] = 1;
358 $arrayfields[
"f.date_lim_reglement"][
'checked'] = 0;
359 $arrayfields[
"f.total_ttc"][
'checked'] = 1;
360 $arrayfields[
"f.tms"][
'checked'] = 1;
361 $arrayfields[
"p.ref"][
'checked'] = 0;
369if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
370 $search_sale = $user->id;
374$fieldid = (!empty($ref) ?
'ref' :
'rowid');
375if (!empty($user->socid)) {
376 $socid = $user->socid;
378if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
379 $search_sale = $user->id;
389if (
GETPOST(
'cancel',
'alpha')) {
393if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
397$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
398$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
403include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
406if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
409 $search_product_category =
'';
410 $searchCategoryInvoiceList = array();
412 $search_refcustomer =
'';
414 $search_subtype =
'';
415 $search_project_ref =
'';
416 $search_project =
'';
417 $search_company =
'';
418 $search_company_alias =
'';
419 $search_parent_name =
'';
420 $search_montant_ht =
'';
421 $search_montant_vat =
'';
422 $search_montant_localtax1 =
'';
423 $search_montant_localtax2 =
'';
424 $search_montant_ttc =
'';
426 $search_multicurrency_code =
'';
427 $search_multicurrency_tx =
'';
428 $search_multicurrency_montant_ht =
'';
429 $search_multicurrency_montant_vat =
'';
430 $search_multicurrency_montant_ttc =
'';
431 $search_dispute_status =
'';
433 $search_paymentmode =
'';
434 $search_paymentterms =
'';
435 $search_fk_input_reason =
'';
436 $search_module_source =
'';
437 $search_pos_source =
'';
441 $search_country =
'';
442 $search_type_thirdparty =
'';
443 $search_customer_code =
'';
444 $search_date_startday =
'';
445 $search_date_startmonth =
'';
446 $search_date_startyear =
'';
447 $search_date_endday =
'';
448 $search_date_endmonth =
'';
449 $search_date_endyear =
'';
450 $search_date_start =
'';
451 $search_date_end =
'';
452 $search_date_valid_startday =
'';
453 $search_date_valid_startmonth =
'';
454 $search_date_valid_startyear =
'';
455 $search_date_valid_endday =
'';
456 $search_date_valid_endmonth =
'';
457 $search_date_valid_endyear =
'';
458 $search_date_valid_start =
'';
459 $search_date_valid_end =
'';
460 $search_datelimit_startday =
'';
461 $search_datelimit_startmonth =
'';
462 $search_datelimit_startyear =
'';
463 $search_datelimit_endday =
'';
464 $search_datelimit_endmonth =
'';
465 $search_datelimit_endyear =
'';
466 $search_datelimit_start =
'';
467 $search_datelimit_end =
'';
469 $search_datec_start =
'';
470 $search_datec_end =
'';
472 $search_datem_start =
'';
473 $search_datem_end =
'';
475 $search_fac_rec_source_title =
'';
477 $search_import_key =
'';
478 $search_categ_cus = 0;
482 $search_array_options = array();
485if (empty($reshook)) {
486 $objectclass =
'Facture';
487 $objectlabel =
'Invoices';
488 $permissiontoread = $user->hasRight(
"facture",
"lire");
489 $permissiontoadd = $user->hasRight(
"facture",
"creer");
490 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
491 $uploaddir = $conf->invoice->dir_output;
492 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
495if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
496 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
497 $arrayofselected = is_array($toselect) ? $toselect : array();
498 if (!empty($arrayofselected)) {
502 if (empty($paiementdate)) {
503 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
505 $action =
'makepayment';
509 foreach ($arrayofselected as $toselectid) {
512 $result = $facture->fetch($toselectid);
521 $paiementAmount = $facture->getSommePaiement();
522 $totalcreditnotes = $facture->getSumCreditNotesUsed();
523 $totaldeposits = $facture->getSumDepositsUsed();
525 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
526 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
529 $parameters = array(
'remaintopay' => $remaintopay);
530 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
532 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
533 $remaintopay = $remain;
535 } elseif ($reshook < 0) {
537 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
540 if ($remaintopay != 0) {
541 $resultBank = $facture->setBankAccount($bankid);
542 if ($resultBank < 0) {
547 $paiement->datepaye = $paiementdate;
548 $paiement->amounts[$facture->id] = $remaintopay;
549 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
550 $paiement->paiementid = $paiementid;
551 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
552 if ($paiement_id < 0) {
553 $langs->load(
"errors");
554 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
557 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
559 $langs->load(
"errors");
560 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
566 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
570 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
575 if (empty($errorpayment)) {
576 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
584} elseif ($massaction ==
'withdrawrequest') {
585 $langs->load(
"withdrawals");
587 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
594 $arrayofselected = is_array($toselect) ? $toselect : array();
595 $listofbills = array();
596 foreach ($arrayofselected as $toselectid) {
598 $result = $objecttmp->fetch($toselectid);
600 $totalpaid = $objecttmp->getSommePaiement();
601 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
602 $totaldeposits = $objecttmp->getSumDepositsUsed();
603 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
606 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
607 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
609 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
610 $objecttmp->resteapayer = $remaintopay;
612 } elseif ($reshook < 0) {
614 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
619 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
620 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
622 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
623 } elseif ($objecttmp->resteapayer < 0) {
625 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
628 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
629 $rsql .=
" , pfd.date_traite as date_traite";
630 $rsql .=
" , pfd.amount";
631 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
632 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
633 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
634 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
635 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
636 $rsql .=
" AND pfd.traite = 0";
637 $rsql .=
" ORDER BY pfd.date_demande DESC";
639 $result_sql = $db->query($rsql);
641 $numprlv = $db->num_rows($result_sql);
648 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
649 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
650 $langs->load(
"errors");
652 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
654 $listofbills[] = $objecttmp;
660 if (!empty($listofbills)) {
661 $nbwithdrawrequestok = 0;
662 foreach ($listofbills as $aBill) {
669 $sql =
"SELECT SUM(pfd.amount) as amount";
670 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
674 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
676 $sql .=
" AND pfd.traite = 0";
678 $resql = $db->query($sql);
680 $obj = $db->fetch_object($resql);
682 $pending += (float) $obj->amount;
688 $sqlPending =
"SELECT SUM(pl.amount) as amount";
689 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
690 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
694 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
696 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
697 $resPending = $db->query($sqlPending);
699 if ($objPending = $db->fetch_object($resPending)) {
700 $pending += (float) $objPending->amount;
703 $db->free($resPending);
705 $requestAmount = $aBill->resteapayer - $pending;
708 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
709 if ($requestAmount > 0) {
712 $nbwithdrawrequestok++;
718 $aBill->error =
'WithdrawRequestErrorNilAmount';
719 $aBill->errors[] = $aBill->error;
723 if ($nbwithdrawrequestok > 0) {
724 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
736$form =
new Form($db);
740$facturestatic =
new Facture($db);
742$companystatic =
new Societe($db);
743$companyparent =
new Societe($db);
745$company_url_list = array();
750 if (empty($search_company)) {
751 $search_company = $soc->name;
757$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
758$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
760$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
761$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
766$sql .=
' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, f.subtype, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
767$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
768$sql .=
' f.fk_user_author,';
769$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,';
770$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
771$sql .=
" f.fk_input_reason,";
772$sql .=
" f.module_source, f.pos_source,";
773$sql .=
' f.paye as paye, f.fk_statut as status, f.import_key, f.close_code,';
774$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
775$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
776$sql .=
' f.payment_reference, f.dispute_status,';
777$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,';
778$sql .=
" s.parent as fk_parent,";
779$sql .=
" s2.nom as name2,";
780$sql .=
' typent.code as typent_code,';
781$sql .=
' state.code_departement as state_code, state.nom as state_name,';
782$sql .=
' country.code as country_code,';
783$sql .=
' f.fk_fac_rec_source,';
784$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
785$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';
795if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
796 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
797 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
801$parameters = array();
802$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
803$sql .= $hookmanager->resPrint;
804$sql = preg_replace(
'/,\s*$/',
'', $sql);
808$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
809$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
810$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
811$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
812$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
813$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
815if ($sortfield ==
"f.datef") {
816 $hasAnotherfilter =
false;
817 foreach ($search_array_options as $v) {
818 if ($v !==
'' && (
string) $v !==
'-1') {
819 $hasAnotherfilter =
true;
823 if (!$hasAnotherfilter) {
824 $sql .= $db->hintindex(
'idx_facture_datef');
827if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
828 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
830if (!empty($search_fac_rec_source_title)) {
831 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
833$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
834$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
836$parameters = array();
837$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
838$sql .= $hookmanager->resPrint;
840$sql .=
' WHERE f.fk_soc = s.rowid';
841$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
843 $sql .=
' AND s.rowid = '.((int) $socid);
847 $sql .=
' AND f.fk_user_author IS NULL';
849 $sql .=
' AND f.fk_user_author = '.((int) $userid);
855if ($search_refcustomer) {
858if ($search_type !=
'' && $search_type !=
'-1') {
859 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
861if ($search_subtype !=
'' && $search_subtype !=
'-1') {
862 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
864if ($search_project_ref) {
867if ($search_project) {
870if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
871 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
873 if ($search_company) {
876 if ($search_company_alias) {
880if ($search_parent_name) {
883if ($search_customer_code) {
895if (strlen(trim($search_country))) {
897 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
898 foreach ($arrayofcode as $key => $value) {
899 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
900 if ($value !=
$mysoc->country_code) {
901 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
904 if ($search_country ==
'special_allnotme') {
905 $sql .=
" AND country.code <> '".$db->escape(
$mysoc->country_code).
"'";
906 } elseif ($search_country ==
'special_eec') {
907 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
908 } elseif ($search_country ==
'special_eecnotme') {
909 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
910 } elseif ($search_country ==
'special_noteec') {
911 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
916if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
917 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
919if ($search_montant_ht !=
'') {
922if ($search_montant_vat !=
'') {
925if ($search_montant_localtax1 !=
'') {
926 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
928if ($search_montant_localtax2 !=
'') {
929 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
931if ($search_montant_ttc !=
'') {
934if ($search_multicurrency_code !=
'') {
935 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
937if ($search_multicurrency_tx !=
'') {
938 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
940if ($search_multicurrency_montant_ht !=
'') {
941 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
943if ($search_multicurrency_montant_vat !=
'') {
944 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
946if ($search_multicurrency_montant_ttc !=
'') {
947 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
950 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
952if ($search_dispute_status !=
'-1' && $search_dispute_status !=
'') {
953 if ($search_dispute_status ==
'0') {
954 $sql .=
" AND (f.dispute_status IS NULL OR f.dispute_status = 0)";
956 $sql .=
" AND f.dispute_status IN (".$db->sanitize($search_dispute_status).
")";
959if ($search_status !=
'-1' && $search_status !=
'') {
960 if (is_numeric($search_status) && $search_status >= 0) {
961 if ($search_status ==
'0') {
962 $sql .=
" AND f.fk_statut = 0";
964 if ($search_status ==
'1') {
965 $sql .=
" AND f.fk_statut = 1";
967 if ($search_status ==
'2') {
968 $sql .=
" AND f.fk_statut = 2";
970 if ($search_status ==
'3') {
971 $sql .=
" AND f.fk_statut = 3";
974 $sql .=
" AND f.fk_statut IN (".$db->sanitize($search_status).
")";
978if ($search_paymentmode > 0) {
979 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
981if ($search_paymentterms > 0) {
982 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
984if ($search_fk_input_reason > 0) {
985 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
987if ($search_module_source) {
990if ($search_pos_source) {
993if ($search_date_start) {
994 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
996if ($search_date_end) {
997 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
999if ($search_date_valid_start) {
1000 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
1002if ($search_date_valid_end) {
1003 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
1005if ($search_datelimit_start) {
1006 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
1008if ($search_datelimit_end) {
1009 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
1011if ($search_note_public) {
1012 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
1014if ($search_note_private) {
1015 $sql .=
" AND p.note_private LIKE '%".$db->escape($db->escapeforlike($search_note_private)).
"%'";
1017if ($search_datec_start) {
1018 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
1020if ($search_datec_end) {
1021 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
1023if ($search_datem_start) {
1024 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
1026if ($search_datem_end) {
1027 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
1029if ($search_option ==
'late') {
1030 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->invoice->client->warning_delay).
"'";
1035if (!empty($search_fac_rec_source_title)) {
1036 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
1038if ($search_fk_fac_rec_source) {
1039 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1041if ($search_import_key) {
1045if ($search_user > 0) {
1046 $sql .=
" AND EXISTS (";
1047 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1048 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1049 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1050 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1051 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1054if ($search_sale && $search_sale !=
'-1') {
1055 if ($search_sale == -2) {
1056 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1057 } elseif ($search_sale > 0) {
1058 $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).
")";
1063if (!empty($searchCategoryInvoiceList)) {
1064 $searchCategoryInvoiceSqlList = array();
1065 $listofcategoryid =
'';
1066 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1067 if (intval($searchCategoryInvoice) == -2) {
1068 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1069 } elseif (intval($searchCategoryInvoice) > 0) {
1070 if ($searchCategoryInvoiceOperator == 0) {
1071 $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).
")";
1073 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1077 if ($listofcategoryid) {
1078 $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).
"))";
1080 if ($searchCategoryInvoiceOperator == 1) {
1081 if (!empty($searchCategoryInvoiceSqlList)) {
1082 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1085 if (!empty($searchCategoryInvoiceSqlList)) {
1086 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1092$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1093$searchCategoryProductOperator = 0;
1094if (!empty($searchCategoryProductList)) {
1095 $searchCategoryProductSqlList = array();
1096 $listofcategoryid =
'';
1097 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1098 if (intval($searchCategoryProduct) == -2) {
1099 $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)";
1100 } elseif (intval($searchCategoryProduct) > 0) {
1101 if ($searchCategoryProductOperator == 0) {
1102 $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).
")";
1104 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1108 if ($listofcategoryid) {
1109 $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).
"))";
1111 if ($searchCategoryProductOperator == 1) {
1112 if (!empty($searchCategoryProductSqlList)) {
1113 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1116 if (!empty($searchCategoryProductSqlList)) {
1117 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1121$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1122$searchCategoryCustomerOperator = 0;
1124if (!empty($searchCategoryCustomerList)) {
1125 $searchCategoryCustomerSqlList = array();
1126 $listofcategoryid =
'';
1127 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1128 if (intval($searchCategoryCustomer) == -2) {
1129 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1130 } elseif (intval($searchCategoryCustomer) > 0) {
1131 if ($searchCategoryCustomerOperator == 0) {
1132 $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).
")";
1134 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1138 if ($listofcategoryid) {
1139 $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).
"))";
1141 if ($searchCategoryCustomerOperator == 1) {
1142 if (!empty($searchCategoryCustomerSqlList)) {
1143 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1146 if (!empty($searchCategoryCustomerSqlList)) {
1147 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1152include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1154$parameters = array();
1155$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1156$sql .= $hookmanager->resPrint;
1161 $fieldstosearchallwithoutpd = array();
1162 $fieldstosearchallwithpd = array();
1163 foreach ($fieldstosearchall as $key => $val) {
1164 if (!preg_match(
'/^pd\./', $key)) {
1165 $fieldstosearchallwithoutpd[$key] = $val;
1167 $fieldstosearchallwithpd[$key] = $val;
1171 if (count($fieldstosearchallwithpd) > 0) {
1172 $sqltoadd .=
" OR EXISTS (SELECT pd.rowid FROM ".MAIN_DB_PREFIX.
"facturedet as pd WHERE pd.fk_facture = f.rowid";
1173 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
1177 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
1180$parameters = array();
1181$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1182if (empty($reshook)) {
1183 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1185 $sql = $hookmanager->resPrint;
1189$nbtotalofrecords =
'';
1192 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1193 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1195 $resql = $db->query($sqlforcount);
1197 $objforcount = $db->fetch_object($resql);
1198 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1203 if (($page * $limit) > (
int) $nbtotalofrecords) {
1211$sql .= $db->order($sortfield, $sortorder);
1213 $sql .= $db->plimit($limit + 1, $offset);
1216$resql = $db->query($sql);
1222$num = $db->num_rows($resql);
1224$arrayofselected = is_array($toselect) ? $toselect : array();
1226if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1227 $obj = $db->fetch_object($resql);
1230 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1237llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1239if ($search_fk_fac_rec_source) {
1241 $object->fetch((
int) $search_fk_fac_rec_source);
1250 $param .=
'&mode='.urlencode($mode);
1252if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1253 $param .=
'&contextpage='.urlencode($contextpage);
1255if ($limit > 0 && $limit != $conf->liste_limit) {
1256 $param .=
'&limit='.((int) $limit);
1258if ($optioncss !=
'') {
1259 $param .=
'&optioncss='.urlencode($optioncss);
1262 $param .=
'&show_files='.urlencode((
string) ($show_files));
1265 $param .=
'&search_all='.urlencode($search_all);
1268 $param .=
'&socid='.((int) $socid);
1270if ($search_date_startday) {
1271 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1273if ($search_date_startmonth) {
1274 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1276if ($search_date_startyear) {
1277 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1279if ($search_date_endday) {
1280 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1282if ($search_date_endmonth) {
1283 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1285if ($search_date_endyear) {
1286 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1288if ($search_date_valid_startday) {
1289 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1291if ($search_date_valid_startmonth) {
1292 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1294if ($search_date_valid_startyear) {
1295 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1297if ($search_date_valid_endday) {
1298 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1300if ($search_date_valid_endmonth) {
1301 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1303if ($search_date_valid_endyear) {
1304 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1306if ($search_datelimit_startday) {
1307 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1309if ($search_datelimit_startmonth) {
1310 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1312if ($search_datelimit_startyear) {
1313 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1315if ($search_datelimit_endday) {
1316 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1318if ($search_datelimit_endmonth) {
1319 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1321if ($search_datelimit_endyear) {
1322 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1325 $param .=
'&search_ref='.urlencode($search_ref);
1327if ($search_refcustomer) {
1328 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1330if ($search_project_ref) {
1331 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1333if ($search_project) {
1334 $param .=
'&search_project='.urlencode($search_project);
1336if ($search_type !=
'') {
1337 $param .=
'&search_type='.urlencode($search_type);
1339if ($search_subtype !=
'') {
1340 $param .=
'&search_subtype='.urlencode($search_subtype);
1342if ($search_company) {
1343 $param .=
'&search_company='.urlencode($search_company);
1345if ($search_company_alias) {
1346 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1348if ($search_parent_name !=
'') {
1349 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1352 $param .=
'&search_town='.urlencode($search_town);
1355 $param .=
'&search_zip='.urlencode($search_zip);
1357if ($search_country) {
1358 $param .=
"&search_country=".urlencode($search_country);
1360if ($search_type_thirdparty !=
'') {
1361 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1363if ($search_customer_code) {
1364 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1366if ($search_sale > 0) {
1367 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1369if ($search_user > 0) {
1370 $param .=
'&search_user='.urlencode((
string) $search_user);
1373 $param .=
'&search_login='.urlencode($search_login);
1375if ($searchCategoryInvoiceOperator == 1) {
1376 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1378foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1379 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1381if ($search_product_category > 0) {
1382 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1384if ($search_montant_ht !=
'') {
1385 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1387if ($search_montant_vat !=
'') {
1388 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1390if ($search_montant_localtax1 !=
'') {
1391 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1393if ($search_montant_localtax2 !=
'') {
1394 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1396if ($search_montant_ttc !=
'') {
1397 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1399if ($search_multicurrency_code !=
'') {
1400 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1402if ($search_multicurrency_tx !=
'') {
1403 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1405if ($search_multicurrency_montant_ht !=
'') {
1406 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1408if ($search_multicurrency_montant_vat !=
'') {
1409 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1411if ($search_multicurrency_montant_ttc !=
'') {
1412 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1414if ($search_dispute_status !=
'') {
1415 $param .=
'&search_dispute_status='.urlencode($search_dispute_status);
1417if ($search_status !=
'') {
1418 $param .=
'&search_status='.urlencode($search_status);
1420if ($search_paymentmode > 0) {
1421 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1423if ($search_paymentterms > 0) {
1424 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1426if ($search_fk_input_reason > 0) {
1427 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1429if ($search_module_source) {
1430 $param .=
'&search_module_source='.urlencode($search_module_source);
1432if ($search_pos_source) {
1433 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1435if ($search_option) {
1436 $param .=
"&search_option=".urlencode($search_option);
1438if ($search_categ_cus > 0) {
1439 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1441if (!empty($search_fac_rec_source_title)) {
1442 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1444if ($search_fk_fac_rec_source) {
1445 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1447if ($search_import_key !=
'') {
1448 $param .=
'&search_import_key='.urlencode($search_import_key);
1452include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1454$parameters = array(
'param' => &$param);
1455$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1456$param .= $hookmanager->resPrint;
1458$arrayofmassactions = array(
1459 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1460 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1461 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1462 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1465if (
isModEnabled(
'category') && $user->hasRight(
'facture',
'creer')) {
1466 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1468if ($user->hasRight(
'facture',
'paiement')) {
1469 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1471if (
isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1472 $langs->load(
"withdrawals");
1473 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1475if ($user->hasRight(
'facture',
'supprimer')) {
1477 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1480if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1481 $arrayofmassactions = array();
1483$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1487if ($contextpage !=
'poslist') {
1488 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1490 $url .=
'&socid='.urlencode((
string)
$object->socid);
1493 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1495 $newcardbutton =
'';
1496 $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'));
1497 $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'));
1499 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1504print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1505if ($optioncss !=
'') {
1506 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1508print
'<input type="hidden" name="token" value="'.newToken().
'">';
1509print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1510if (!in_array($massaction, array(
'makepayment'))) {
1511 print
'<input type="hidden" name="action" value="list">';
1513print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1514print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1515print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1516print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1517print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1518print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1520print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1522$topicmail =
"SendBillRef";
1523$modelmail =
"facture_send";
1525$trackid =
'inv'.$object->id;
1526include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1528if ($massaction ==
'makepayment') {
1530 $formquestion = array(
1534 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1535 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1536 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1539 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1544 foreach ($fieldstosearchall as $key => $val) {
1545 $fieldstosearchall[$key] = $langs->trans($val);
1547 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1553if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1555 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1558if ($user->hasRight(
"user",
"user",
"lire")) {
1559 $langs->load(
"commercial");
1560 $moreforfilter .=
'<div class="divsearchfield">';
1561 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1562 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1563 $moreforfilter .=
'</div>';
1566if ($user->hasRight(
"user",
"user",
"lire")) {
1567 $moreforfilter .=
'<div class="divsearchfield">';
1568 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1569 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1570 $moreforfilter .=
'</div>';
1573if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1574 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1575 $moreforfilter .=
'<div class="divsearchfield">';
1576 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1577 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1578 $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);
1579 $moreforfilter .=
'</div>';
1581if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1582 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1583 $moreforfilter .=
'<div class="divsearchfield">';
1584 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1585 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1586 $moreforfilter .=
'</div>';
1589$moreforfilter .=
'<div class="divsearchfield">';
1590$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1591$moreforfilter .=
'</div>';
1593$parameters = array();
1594$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1595if (empty($reshook)) {
1596 $moreforfilter .= $hookmanager->resPrint;
1598 $moreforfilter = $hookmanager->resPrint;
1601if (!empty($moreforfilter)) {
1602 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1603 print $moreforfilter;
1607$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1608$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1611if ($massactionbutton && $contextpage !=
'poslist') {
1612 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1615print
'<div class="div-table-responsive">';
1616print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1620print
'<tr class="liste_titre_filter">';
1624 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1625 $searchpicto = $form->showFilterButtons(
'left');
1631 print
'<td class="liste_titre">';
1635if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1636 print
'<td class="liste_titre">';
1637 print
'<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1641if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1642 print
'<td class="liste_titre">';
1643 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1647if (!empty($arrayfields[
'f.type'][
'checked'])) {
1648 print
'<td class="liste_titre maxwidthonsmartphone">';
1660 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1664if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1665 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1666 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1670if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1671 print
'<td class="liste_titre center">';
1672 print
'<div class="nowrapfordate">';
1673 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1675 print
'<div class="nowrapfordate">';
1676 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1681if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1682 print
'<td class="liste_titre center">';
1683 print
'<div class="nowrapfordate">';
1684 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'));
1686 print
'<div class="nowrapfordate">';
1687 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'));
1692if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1693 print
'<td class="liste_titre center">';
1694 print
'<div class="nowrapfordate">';
1695 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1697 print
'<div class="nowrapfordate">';
1698 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1703if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1704 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1707if (!empty($arrayfields[
'p.title'][
'checked'])) {
1708 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1711if (!empty($arrayfields[
's.nom'][
'checked'])) {
1712 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>';
1715if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1716 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1719if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1720 print
'<td class="liste_titre">';
1721 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1725if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1726 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1729if (!empty($arrayfields[
's.town'][
'checked'])) {
1730 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1733if (!empty($arrayfields[
's.zip'][
'checked'])) {
1734 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1737if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1738 print
'<td class="liste_titre">';
1739 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1743if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1744 print
'<td class="liste_titre center">';
1745 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1749if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1750 print
'<td class="liste_titre maxwidthonsmartphone center">';
1751 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'maxwidth100', 1);
1755if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1756 print
'<td class="liste_titre">';
1757 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1761if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1762 print
'<td class="liste_titre left">';
1763 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1767if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1768 print
'<td class="liste_titre">';
1769 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1773if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1774 print
'<td class="liste_titre">';
1775 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1779if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1780 print
'<td class="liste_titre">';
1781 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1784if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1786 print
'<td class="liste_titre right">';
1787 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1790if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1792 print
'<td class="liste_titre right">';
1793 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1796if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1798 print
'<td class="liste_titre right">';
1799 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1802if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1804 print
'<td class="liste_titre right">';
1805 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1808if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1810 print
'<td class="liste_titre right">';
1811 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1814if (!empty($arrayfields[
'u.login'][
'checked'])) {
1816 print
'<td class="liste_titre" align="center">';
1817 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1820if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1821 print
'<td class="liste_titre"></td>';
1823if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1824 print
'<td class="liste_titre" align="right">';
1827if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1828 print
'<td class="liste_titre right">';
1831if (!empty($arrayfields[
'rtp'][
'checked'])) {
1832 print
'<td class="liste_titre">';
1835if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1837 print
'<td class="liste_titre">';
1838 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1841if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1843 print
'<td class="liste_titre">';
1844 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1847if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1849 print
'<td class="liste_titre right">';
1850 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1853if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1855 print
'<td class="liste_titre right">';
1856 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1859if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1861 print
'<td class="liste_titre right">';
1862 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1865if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1866 print
'<td class="liste_titre">';
1869if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1870 print
'<td class="liste_titre right">';
1873if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1874 print
'<td class="liste_titre right">';
1877if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1878 print
'<td class="liste_titre right">';
1881if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1882 print
'<td class="liste_titre right">';
1885if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1886 print
'<td class="liste_titre right">';
1891include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1894$parameters = array(
'arrayfields' => $arrayfields);
1895$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1896print $hookmanager->resPrint;
1898if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1899 print
'<td class="liste_titre center">';
1900 print
'<div class="nowrapfordate">';
1901 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1903 print
'<div class="nowrapfordate">';
1904 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1909if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1910 print
'<td class="liste_titre center">';
1911 print
'<div class="nowrapfordate">';
1912 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1914 print
'<div class="nowrapfordate">';
1915 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1920if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1921 print
'<td class="liste_titre">';
1924if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1926 print
'<td class="liste_titre">';
1927 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1930if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1932 print
'<td class="liste_titre">';
1933 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1936if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1938 print
'<td class="liste_titre maxwidthonsmartphone right">';
1939 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).
'">';
1943if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1944 print
'<td class="liste_titre maxwidthonsmartphone center">';
1945 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1949if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
1950 print
'<td class="liste_titre center parentonrightofpage">';
1951 $liststatus = array(
'0' =>
"None",
'1' =>
"DisputeOpen",
'8' =>
"DisputeLost",
'9' =>
"DisputeWon");
1953 print $form->selectarray(
'search_dispute_status', $liststatus, $search_dispute_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1957if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1958 print
'<td class="liste_titre center parentonrightofpage">';
1959 $liststatus = array(
'0' => $langs->trans(
"BillShortStatusDraft"),
'0,1' => $langs->trans(
"BillShortStatusDraft").
'+'.$langs->trans(
"BillShortStatusNotPaid"),
'1' => $langs->trans(
"BillShortStatusNotPaid"),
'1,2' => $langs->trans(
"BillShortStatusNotPaid").
'+'.$langs->trans(
"BillShortStatusPaid"),
'2' => $langs->trans(
"BillShortStatusPaid"),
'3' => $langs->trans(
"BillShortStatusCanceled"));
1961 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1966 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1967 $searchpicto = $form->showFilterButtons();
1978print
'<tr class="liste_titre">';
1980 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1987if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1988 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1991if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1992 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1995if (!empty($arrayfields[
'f.type'][
'checked'])) {
1996 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1999if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2000 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
2002if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2003 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
2006if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2007 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
2010if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2011 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
2014if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2015 $langs->load(
"projects");
2016 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
2019if (!empty($arrayfields[
'p.title'][
'checked'])) {
2020 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
2023if (!empty($arrayfields[
's.nom'][
'checked'])) {
2024 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
2027if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
2032if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
2036if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
2040if (!empty($arrayfields[
's.town'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
2044if (!empty($arrayfields[
's.zip'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
2048if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
2052if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2053 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
2056if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2057 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
2060if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2061 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
2064if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2065 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
2068if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2069 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
2071if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2072 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2075if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2076 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2079if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2080 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2083if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2084 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2087if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2088 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2091if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2092 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2095if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2096 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2099if (!empty($arrayfields[
'u.login'][
'checked'])) {
2100 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2103if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2104 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2107if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2108 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2111if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2112 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2115if (!empty($arrayfields[
'rtp'][
'checked'])) {
2116 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2119if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2120 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2123if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2124 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2127if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2128 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2131if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2132 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2135if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2136 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2139if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2140 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2143if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2144 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2147if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2148 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2151if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2152 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2155if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2156 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2159if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2160 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2164include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2166$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2167$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2168print $hookmanager->resPrint;
2169if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2170 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2173if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2174 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2177if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2178 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2181if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2182 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2185if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2186 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2189if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2190 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2194if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2195 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2199if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
2200 print_liste_field_titre($arrayfields[
'f.dispute_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.dispute_status,f.ref",
"", $param,
'', $sortfield, $sortorder,
'center ');
2204if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2205 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2210 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2216$projectstatic =
new Project($db);
2218$userstatic =
new User($db);
2236 $typenArray = $formcompany->typent_array(1);
2238 $with_margin_info =
false;
2240 !empty($arrayfields[
'total_pa'][
'checked'])
2241 || !empty($arrayfields[
'total_margin'][
'checked'])
2242 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2243 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2246 $with_margin_info =
true;
2251 $imaxinloop = ($limit ? min($num, $limit) : $num);
2252 while ($i < $imaxinloop) {
2253 $obj = $db->fetch_object($resql);
2255 $datelimit = $db->jdate($obj->datelimite);
2257 $facturestatic->id = $obj->id;
2258 $facturestatic->ref = $obj->ref;
2259 $facturestatic->ref_client = $obj->ref_client;
2260 $facturestatic->ref_customer = $obj->ref_client;
2261 $facturestatic->type = $obj->type;
2262 $facturestatic->subtype = $obj->subtype;
2263 $facturestatic->total_ht = $obj->total_ht;
2264 $facturestatic->total_tva = $obj->total_tva;
2265 $facturestatic->total_ttc = $obj->total_ttc;
2266 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2267 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2268 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2269 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2270 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2271 $facturestatic->status = $obj->status;
2272 $facturestatic->close_code = $obj->close_code;
2273 $facturestatic->total_ttc = $obj->total_ttc;
2274 $facturestatic->paye = $obj->paye;
2275 $facturestatic->socid = $obj->fk_soc;
2277 $facturestatic->date = $db->jdate($obj->datef);
2278 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2279 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2281 $facturestatic->note_public = $obj->note_public;
2282 $facturestatic->note_private = $obj->note_private;
2285 $facturestatic->retained_warranty = $obj->retained_warranty;
2286 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2287 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2288 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2289 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2290 $facturestatic->situation_counter = $obj->situation_counter;
2293 $facturestatic->payment_reference = $obj->payment_reference;
2294 $facturestatic->dispute_status = $obj->dispute_status;
2296 $companystatic->id = $obj->socid;
2297 $companystatic->name = $obj->name;
2298 $companystatic->name_alias = $obj->alias;
2299 $companystatic->client = $obj->client;
2300 $companystatic->fournisseur = $obj->fournisseur;
2301 $companystatic->code_client = $obj->code_client;
2302 $companystatic->code_compta_client = $obj->code_compta_client;
2303 $companystatic->code_fournisseur = $obj->code_fournisseur;
2304 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2305 $companystatic->email = $obj->email;
2306 $companystatic->phone = $obj->phone;
2307 $companystatic->fax = $obj->fax;
2308 $companystatic->address = $obj->address;
2309 $companystatic->zip = $obj->zip;
2310 $companystatic->town = $obj->town;
2311 $companystatic->country_code = $obj->country_code;
2313 $projectstatic->id = $obj->project_id;
2314 $projectstatic->ref = $obj->project_ref;
2315 $projectstatic->title = $obj->project_label;
2317 $paiement = $facturestatic->getSommePaiement();
2318 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2319 $totaldeposits = $facturestatic->getSumDepositsUsed();
2320 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2321 $remaintopay = $obj->total_ttc - $totalallpayments;
2323 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2324 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2325 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2327 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2328 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2330 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2331 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2335 $multicurrency_remaintopay = 0;
2338 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2339 $remaintopay = -$remaincreditnote;
2340 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2341 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2342 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2343 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2346 $facturestatic->alreadypaid = $paiement;
2347 $facturestatic->totalpaid = $paiement;
2348 $facturestatic->totalcreditnotes = $totalcreditnotes;
2349 $facturestatic->totaldeposits = $totaldeposits;
2351 $marginInfo = array();
2352 if ($with_margin_info) {
2353 $facturestatic->fetch_lines();
2354 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2355 $total_ht += $obj->total_ht;
2356 $total_margin += $marginInfo[
'total_margin'];
2361 if ($mode ==
'kanban') {
2363 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2364 print
'<div class="box-flex-container kanban">';
2367 if ($massactionbutton || $massaction) {
2369 if (in_array(
$object->id, $arrayofselected)) {
2374 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2375 print $facturestatic->getKanbanView(
'', $arraydata);
2376 if ($i == ($imaxinloop - 1)) {
2383 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2384 if ($contextpage ==
'poslist') {
2385 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2386 if (strpos($obj->ref, 'PROV
') !== false) {
2387 //If is a draft invoice, load var to be able to add products
2388 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2389 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2397 print
'<td class="nowrap center">';
2398 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2400 if (in_array($obj->id, $arrayofselected)) {
2403 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2413 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2420 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2421 print
'<td class="nowraponall">';
2423 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2425 print
'<td class="nobordernopadding nowraponall">';
2426 if ($contextpage ==
'poslist') {
2429 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2433 $filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output;
2434 $filedir = $filepath.
'/'.$filename;
2436 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2437 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2449 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2450 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2451 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2460 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2461 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2462 print $facturestatic->getLibType(2);
2470 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2472 if ($facturestatic->subtype > 0) {
2473 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2475 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2484 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2485 print
'<td align="center" class="nowraponall">';
2494 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2495 print
'<td align="center" class="nowraponall">';
2504 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2505 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2506 if ($facturestatic->hasDelay()) {
2507 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2516 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2517 print
'<td class="nocellnopadd nowraponall">';
2518 if ($obj->project_id > 0) {
2519 print $projectstatic->getNomUrl(1);
2528 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2529 print
'<td class="nowraponall">';
2530 if ($obj->project_id > 0) {
2540 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2541 print
'<td class="tdoverflowmax150">';
2542 if ($contextpage ==
'poslist') {
2545 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2553 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2554 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2562 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2563 print
'<td class="tdoverflowmax200">';
2564 if ($obj->fk_parent > 0) {
2565 if (!isset($company_url_list[$obj->fk_parent])) {
2566 $companyparent =
new Societe($db);
2567 $res = $companyparent->fetch($obj->fk_parent);
2569 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2572 if (isset($company_url_list[$obj->fk_parent])) {
2573 print $company_url_list[$obj->fk_parent];
2582 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2583 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2591 if (!empty($arrayfields[
's.town'][
'checked'])) {
2592 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2600 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2601 print
'<td class="nowraponall">';
2609 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2610 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2616 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2617 $tmparray =
getCountry($obj->fk_pays,
'all');
2618 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2626 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2627 if (!is_array($typenArray) || count($typenArray) == 0) {
2628 $typenArray = $formcompany->typent_array(1);
2630 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2631 if (!empty($obj->typent_code)) {
2632 print $typenArray[$obj->typent_code];
2640 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2641 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2642 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2644 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($conf->cache[
'staff'][$obj->staff_code]).
'">';
2645 print $conf->cache[
'staff'][$obj->staff_code];
2653 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2654 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2655 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2664 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2665 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2666 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2675 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2677 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2685 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2694 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2704 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2705 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2712 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2715 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2716 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2723 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2726 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2727 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2734 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2737 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2738 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2745 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2748 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2749 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2756 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2759 $userstatic->id = $obj->fk_user_author;
2760 $userstatic->login = $obj->login;
2761 $userstatic->lastname = $obj->lastname;
2762 $userstatic->firstname = $obj->firstname;
2763 $userstatic->email = $obj->user_email;
2764 $userstatic->status = $obj->user_statut;
2765 $userstatic->entity = $obj->entity;
2766 $userstatic->photo = $obj->photo;
2767 $userstatic->office_phone = $obj->office_phone;
2768 $userstatic->office_fax = $obj->office_fax;
2769 $userstatic->user_mobile = $obj->user_mobile;
2770 $userstatic->job = $obj->job;
2771 $userstatic->gender = $obj->gender;
2774 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2775 print
'<td class="tdoverflowmax100">';
2776 if ($userstatic->id) {
2777 print $userstatic->getNomUrl(-1);
2787 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2790 if ($obj->socid > 0) {
2791 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2792 if ($listsalesrepresentatives < 0) {
2795 $nbofsalesrepresentative = count($listsalesrepresentatives);
2796 if ($nbofsalesrepresentative > 6) {
2798 print $nbofsalesrepresentative;
2799 } elseif ($nbofsalesrepresentative > 0) {
2801 foreach ($listsalesrepresentatives as $val) {
2802 $userstatic->id = $val[
'id'];
2803 $userstatic->lastname = $val[
'lastname'];
2804 $userstatic->firstname = $val[
'firstname'];
2805 $userstatic->email = $val[
'email'];
2806 $userstatic->status = $val[
'statut'];
2807 $userstatic->entity = $val[
'entity'];
2808 $userstatic->photo = $val[
'photo'];
2809 $userstatic->login = $val[
'login'];
2810 $userstatic->office_phone = $val[
'office_phone'];
2811 $userstatic->office_fax = $val[
'office_fax'];
2812 $userstatic->user_mobile = $val[
'user_mobile'];
2813 $userstatic->job = $val[
'job'];
2814 $userstatic->gender = $val[
'gender'];
2816 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2818 if ($j < $nbofsalesrepresentative) {
2832 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2833 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2839 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2840 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2847 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2851 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2852 print
'<td class="right nowraponall amount">';
2853 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2866 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2867 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2868 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2869 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2871 $title = $obj->multicurrency_code;
2872 $label = $obj->multicurrency_code;
2874 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2883 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2884 print
'<td class="nowraponall">';
2885 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2892 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2893 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2899 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2900 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2906 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2907 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2913 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2914 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2921 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2922 print
'<td class="right nowraponall amount">';
2923 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2931 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2932 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2937 if (empty($totalarray[
'val'][
'total_pa'])) {
2940 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2943 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2944 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2949 if (empty($totalarray[
'val'][
'total_margin'])) {
2952 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2955 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2956 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2962 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2963 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2968 if ($i >= $imaxinloop - 1) {
2969 if (!empty($total_ht)) {
2978 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2980 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2981 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2982 print $hookmanager->resPrint;
2984 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2985 print
'<td class="nowraponall center">';
2986 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
2993 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2994 print
'<td class="nowraponall center">';
2995 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
3002 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
3003 print
'<td class="nowraponall center">';
3004 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuserrel');
3011 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
3012 print
'<td class="sensiblehtmlcontent center">';
3013 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
3020 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
3021 print
'<td class="sensiblehtmlcontent center">';
3022 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
3029 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
3030 print
'<td class="center">';
3031 if (!empty($obj->fk_fac_rec_source)) {
3033 $result = $facrec->fetch($obj->fk_fac_rec_source);
3037 print $facrec->getNomUrl();
3047 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
3048 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
3055 if (!empty($arrayfields[
'f.dispute_status'][
'checked'])) {
3056 print
'<td class="nowrap center">';
3057 if ($facturestatic->dispute_status) {
3058 $liststatus = array(
'0' =>
"None",
'1' =>
"DisputeOpen",
'8' =>
"DisputeLost",
'9' =>
"DisputeWon");
3059 print $langs->trans($liststatus[$facturestatic->dispute_status]);
3068 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
3069 print
'<td class="nowrap center">';
3070 print $facturestatic->getLibStatut(5, $totalallpayments);
3080 print
'<td class="nowrap center">';
3081 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
3083 if (in_array($obj->id, $arrayofselected)) {
3086 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3101 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
3102 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
3105 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3111 foreach ($arrayfields as $key => $val) {
3112 if (!empty($val[
'checked'])) {
3116 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3121$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3122$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3123print $hookmanager->resPrint;
3125print
'</table>'.
"\n";
3128print
'</form>'.
"\n";
3131if ($contextpage !=
'poslist') {
3132 $hidegeneratedfilelistifempty = 1;
3133 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3134 $hidegeneratedfilelistifempty = 0;
3138 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3139 $urlsource .= str_replace(
'&',
'&', $param);
3141 $filedir = $diroutputmassaction;
3142 $genallowed = $user->hasRight(
"facture",
"lire");
3143 $delallowed = $user->hasRight(
"facture",
"creer");
3146 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 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.
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.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_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.
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.