46require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
62if (isModEnabled(
'order')) {
63 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
65if (isModEnabled(
'category')) {
66 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
67 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
80$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
82$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
85$action =
GETPOST(
'action',
'aZ09');
86$massaction =
GETPOST(
'massaction',
'alpha');
88$confirm =
GETPOST(
'confirm',
'alpha');
89$toselect =
GETPOST(
'toselect',
'array');
90$optioncss =
GETPOST(
'optioncss',
'alpha');
91$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
94if ($contextpage ==
'poslist') {
104$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
105$search_type =
GETPOST(
'search_type',
'intcomma');
106$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
107$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
108$search_project =
GETPOST(
'search_project',
'alpha');
109$search_company =
GETPOST(
'search_company',
'alpha');
110$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
111$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
112$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
113$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
114$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
115$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
116$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
117$search_login =
GETPOST(
'search_login',
'alpha');
118$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
119$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
120$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
121$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
122$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
123$search_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');
156$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
157$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
158$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
159$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
160$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
161$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
162$search_datelimit_start =
GETPOSTDATE(
'search_datelimit_start',
'getpost');
163$search_datelimit_end =
GETPOSTDATE(
'search_datelimit_end',
'getpostend');
165$search_datec_start =
GETPOSTDATE(
'search_datec_start',
'getpost',
'tzuserrel');
166$search_datec_end =
GETPOSTDATE(
'search_datec_end',
'getpostend',
'tzuserrel');
167$search_datem_start =
GETPOSTDATE(
'search_datem_start',
'getpost',
'tzuserrel');
168$search_datem_end =
GETPOSTDATE(
'search_datem_end',
'getpostend',
'tzuserrel');
170$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
171$searchCategoryInvoiceOperator = 0;
172if (GETPOSTISSET(
'formfilteraction')) {
173 $searchCategoryInvoiceOperator =
GETPOSTINT(
'search_category_invoice_operator');
177$searchCategoryInvoiceList =
GETPOST(
'search_category_invoice_list',
'array');
178$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
179$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
180$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
181$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
183$search_option =
GETPOST(
'search_option');
184if ($search_option ==
'late') {
185 $search_status =
'1';
189$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
190$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
192if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
196$offset = $limit * $page;
197if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
204 $sortfield =
'f.datef';
206$pageprev = $page - 1;
207$pagenext = $page + 1;
209$diroutputmassaction =
$conf->invoice->dir_output.
'/temp/massgeneration/'.$user->id;
217$hookmanager->initHooks(array($contextpage));
221$extrafields->fetch_name_optionals_label(
$object->table_element);
223$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
226$fieldstosearchall = array(
228 'f.ref_client' =>
'RefCustomer',
229 'f.note_public' =>
'NotePublic',
230 's.nom' =>
"ThirdParty",
231 's.code_client' =>
"CustomerCodeShort",
232 's.name_alias' =>
"AliasNameShort",
235 'pd.description' =>
'Description',
237if (empty($user->socid)) {
238 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
242$showpos = (isModEnabled(
'cashdesk') || isModEnabled(
'takepos') ||
getDolGlobalInt(
'INVOICE_SHOW_POS')) ?
'1' :
'0';
244$checkedtypetiers =
'0';
246 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
247 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' =>
'-1',
'position' => 10),
248 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
249 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
250 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 20),
251 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' =>
'0',
'position' => 22),
252 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 25),
253 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 30),
254 'p.ref' => array(
'label' =>
"ProjectRef",
'langfile' =>
'projects',
'checked' =>
'1',
'enabled' => (!isModEnabled(
'project') ?
'0' :
'1'),
'position' => 40),
255 'p.title' => array(
'label' =>
"ProjectLabel",
'langfile' =>
'projects',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'project') ?
'0' :
'1'),
'position' => 41),
256 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 50),
257 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 51),
258 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' =>
'-1',
'position' => 52),
259 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' =>
'0'),
260 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 55),
261 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 60),
262 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 65),
263 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 70),
264 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
265 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'1',
'position' => 80),
266 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'1',
'position' => 85),
267 'f.fk_input_reason' => array(
'label' =>
"Source",
'checked' => 0,
'enabled' => 1,
'position' => 88),
268 'f.module_source' => array(
'label' =>
"POSModule",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 90),
269 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 91),
270 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 95),
271 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 100),
272 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' =>
'0',
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
273 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' =>
'0',
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
274 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 130),
275 'dynamount_payed' => array(
'label' =>
"AlreadyPaid",
'checked' =>
'0',
'position' => 140),
276 'rtp' => array(
'label' =>
"RemainderToPay",
'checked' =>
'0',
'position' => 150),
277 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 280),
278 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 285),
279 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 290),
280 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 291),
281 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 292),
282 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 295),
283 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'enabled' => (!isModEnabled(
'multicurrency') ?
'0' :
'1'),
'position' => 296),
284 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
285 'total_margin' => array(
'label' =>
'Margin',
'langfile' =>
'margins',
'checked' =>
'0',
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
286 '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')),
287 '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')),
288 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
289 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' =>
'1',
'visible' => -1,
'notnull' => 1,
'position' => 502),
290 'u.login' => array(
'label' =>
"UserAuthor",
'checked' =>
'1',
'visible' => -1,
'position' => 504),
291 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 506),
296 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
297 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
298 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' =>
'0',
'position' => 530,
'enabled' =>
'1'),
299 'f.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
300 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
304 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' =>
'0',
'position' => 86);
307$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
308if (empty($subtypearray)) {
309 unset($arrayfields[
'f.subtype']);
313foreach (
$object->fields as $key => $val) {
316 if (!empty($val[
'visible'])) {
317 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
319 if (array_key_exists($key, $arrayfields)) {
321 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
323 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
327 $arrayfields[$newkey] = array(
328 'label' => $val[
'label'],
329 'checked' => (($visible < 0) ?
'0' :
'1'),
330 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
331 'position' => $val[
'position'],
332 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
338include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
340$parameters = array(
'arrayfields' => &$arrayfields);
341$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
342$sql .= $hookmanager->resPrint;
348if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
349 $search_sale = $user->id;
353$fieldid = (!empty($ref) ?
'ref' :
'rowid');
354if (!empty($user->socid)) {
355 $socid = $user->socid;
357if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
358 $search_sale = $user->id;
368if (
GETPOST(
'cancel',
'alpha')) {
372if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
376$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
377$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
382include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
385if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
388 $search_product_category =
'';
389 $searchCategoryInvoiceList = array();
391 $search_refcustomer =
'';
393 $search_subtype =
'';
394 $search_project_ref =
'';
395 $search_project =
'';
396 $search_company =
'';
397 $search_company_alias =
'';
398 $search_parent_name =
'';
399 $search_montant_ht =
'';
400 $search_montant_vat =
'';
401 $search_montant_localtax1 =
'';
402 $search_montant_localtax2 =
'';
403 $search_montant_ttc =
'';
405 $search_multicurrency_code =
'';
406 $search_multicurrency_tx =
'';
407 $search_multicurrency_montant_ht =
'';
408 $search_multicurrency_montant_vat =
'';
409 $search_multicurrency_montant_ttc =
'';
411 $search_paymentmode =
'';
412 $search_paymentterms =
'';
413 $search_fk_input_reason =
'';
414 $search_module_source =
'';
415 $search_pos_source =
'';
419 $search_country =
'';
420 $search_type_thirdparty =
'';
421 $search_customer_code =
'';
422 $search_date_startday =
'';
423 $search_date_startmonth =
'';
424 $search_date_startyear =
'';
425 $search_date_endday =
'';
426 $search_date_endmonth =
'';
427 $search_date_endyear =
'';
428 $search_date_start =
'';
429 $search_date_end =
'';
430 $search_date_valid_startday =
'';
431 $search_date_valid_startmonth =
'';
432 $search_date_valid_startyear =
'';
433 $search_date_valid_endday =
'';
434 $search_date_valid_endmonth =
'';
435 $search_date_valid_endyear =
'';
436 $search_date_valid_start =
'';
437 $search_date_valid_end =
'';
438 $search_datelimit_startday =
'';
439 $search_datelimit_startmonth =
'';
440 $search_datelimit_startyear =
'';
441 $search_datelimit_endday =
'';
442 $search_datelimit_endmonth =
'';
443 $search_datelimit_endyear =
'';
444 $search_datelimit_start =
'';
445 $search_datelimit_end =
'';
447 $search_datec_start =
'';
448 $search_datec_end =
'';
450 $search_datem_start =
'';
451 $search_datem_end =
'';
453 $search_fac_rec_source_title =
'';
455 $search_import_key =
'';
456 $search_categ_cus = 0;
460 $search_array_options = array();
463if (empty($reshook)) {
464 $objectclass =
'Facture';
465 $objectlabel =
'Invoices';
466 $permissiontoread = $user->hasRight(
"facture",
"lire");
467 $permissiontoadd = $user->hasRight(
"facture",
"creer");
468 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
469 $uploaddir =
$conf->invoice->dir_output;
470 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
473if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
474 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
475 $arrayofselected = is_array($toselect) ? $toselect : array();
476 if (!empty($arrayofselected)) {
480 if (empty($paiementdate)) {
481 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
483 $action =
'makepayment';
487 foreach ($arrayofselected as $toselectid) {
490 $result = $facture->fetch($toselectid);
500 $sommePaiement = $facture->getSommePaiement(-1);
501 $paiementAmount = $sommePaiement[
'alreadypaid'];
503 $totalcreditnotes = $facture->getSumCreditNotesUsed();
504 $totaldeposits = $facture->getSumDepositsUsed();
506 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
507 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
510 $parameters = array(
'remaintopay' => $remaintopay);
511 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
513 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
514 $remaintopay = $remain;
516 } elseif ($reshook < 0) {
518 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
522 $multicurrency_remaintopay =
price2num($facture->multicurrency_total_ttc - $sommePaiement[
'alreadypaid_multicurrency']);
524 if ($remaintopay != 0) {
525 $resultBank = $facture->setBankAccount($bankid);
526 if ($resultBank < 0) {
531 $paiement->datepaye = $paiementdate;
532 $paiement->amounts[$facture->id] = $remaintopay;
533 $paiement->multicurrency_amounts[$facture->id] = $multicurrency_remaintopay;
534 $paiement->paiementid = $paiementid;
535 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
536 if ($paiement_id < 0) {
537 $langs->load(
"errors");
538 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
541 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
543 $langs->load(
"errors");
544 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
550 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
554 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
559 if (empty($errorpayment)) {
560 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
568} elseif ($massaction ==
'withdrawrequest') {
569 $langs->load(
"withdrawals");
571 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
578 $arrayofselected = is_array($toselect) ? $toselect : array();
579 $listofbills = array();
580 foreach ($arrayofselected as $toselectid) {
582 $result = $objecttmp->fetch($toselectid);
584 $totalpaid = $objecttmp->getSommePaiement();
585 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
586 $totaldeposits = $objecttmp->getSumDepositsUsed();
587 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
590 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
591 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
593 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
594 $objecttmp->resteapayer = $remaintopay;
596 } elseif ($reshook < 0) {
598 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
603 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
604 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
606 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
607 } elseif ($objecttmp->resteapayer < 0) {
609 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
612 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
613 $rsql .=
" , pfd.date_traite as date_traite";
614 $rsql .=
" , pfd.amount";
615 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
616 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
617 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
618 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
619 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
620 $rsql .=
" AND pfd.traite = 0";
621 $rsql .=
" ORDER BY pfd.date_demande DESC";
623 $result_sql = $db->query($rsql);
625 $numprlv = $db->num_rows($result_sql);
632 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
633 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
634 $langs->load(
"errors");
636 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
638 $listofbills[] = $objecttmp;
644 if (!empty($listofbills)) {
645 $nbwithdrawrequestok = 0;
646 foreach ($listofbills as $aBill) {
653 $sql =
"SELECT SUM(pfd.amount) as amount";
654 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
658 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
660 $sql .=
" AND pfd.traite = 0";
662 $resql = $db->query($sql);
664 $obj = $db->fetch_object($resql);
666 $pending += (float) $obj->amount;
672 $sqlPending =
"SELECT SUM(pl.amount) as amount";
673 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
674 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
678 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
680 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
681 $resPending = $db->query($sqlPending);
683 if ($objPending = $db->fetch_object($resPending)) {
684 $pending += (float) $objPending->amount;
687 $db->free($resPending);
689 $requestAmount = $aBill->resteapayer - $pending;
692 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
693 if ($requestAmount > 0) {
696 $nbwithdrawrequestok++;
702 $aBill->error =
'WithdrawRequestErrorNilAmount';
703 $aBill->errors[] = $aBill->error;
707 if ($nbwithdrawrequestok > 0) {
708 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
720$form =
new Form($db);
724$facturestatic =
new Facture($db);
726$companystatic =
new Societe($db);
727$companyparent =
new Societe($db);
729$company_url_list = array();
734 if (empty($search_company)) {
735 $search_company = $soc->name;
741$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
742$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
744$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
745$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
751 $sql =
'SELECT DISTINCT';
753$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,';
754$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
755$sql .=
' f.fk_user_author,';
756$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,';
757$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
758$sql .=
" f.fk_input_reason,";
759$sql .=
" f.module_source, f.pos_source,";
760$sql .=
' f.paye as paye, f.fk_statut, f.import_key, f.close_code,';
761$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
762$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
763$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,';
764$sql .=
" s.parent as fk_parent,";
765$sql .=
" s2.nom as name2,";
766$sql .=
' typent.code as typent_code,';
767$sql .=
' state.code_departement as state_code, state.nom as state_name,';
768$sql .=
' country.code as country_code,';
769$sql .=
' f.fk_fac_rec_source,';
770$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
771$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';
781if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
782 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
783 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
787$parameters = array();
788$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
789$sql .= $hookmanager->resPrint;
790$sql = preg_replace(
'/,\s*$/',
'', $sql);
794$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
795$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
796$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
797$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
798$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
799$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
800if ($sortfield ==
"f.datef") {
801 $sql .= $db->hintindex(
'idx_facture_datef');
803if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
804 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
807 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
809if (!empty($search_fac_rec_source_title)) {
810 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
812$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
813$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
815$parameters = array();
816$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
817$sql .= $hookmanager->resPrint;
819$sql .=
' WHERE f.fk_soc = s.rowid';
820$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
822 $sql .=
' AND s.rowid = '.((int) $socid);
826 $sql .=
' AND f.fk_user_author IS NULL';
828 $sql .=
' AND f.fk_user_author = '.((int) $userid);
834if ($search_refcustomer) {
837if ($search_type !=
'' && $search_type !=
'-1') {
838 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
840if ($search_subtype !=
'' && $search_subtype !=
'-1') {
841 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
843if ($search_project_ref) {
846if ($search_project) {
849if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
850 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
852 if ($search_company) {
855 if ($search_company_alias) {
859if ($search_parent_name) {
862if ($search_customer_code) {
874if (strlen(trim($search_country))) {
876 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
877 foreach ($arrayofcode as $key => $value) {
878 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
879 if ($value != $mysoc->country_code) {
880 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
883 if ($search_country ==
'special_allnotme') {
884 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
885 } elseif ($search_country ==
'special_eec') {
886 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
887 } elseif ($search_country ==
'special_eecnotme') {
888 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
889 } elseif ($search_country ==
'special_noteec') {
890 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
895if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
896 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
898if ($search_montant_ht !=
'') {
901if ($search_montant_vat !=
'') {
904if ($search_montant_localtax1 !=
'') {
905 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
907if ($search_montant_localtax2 !=
'') {
908 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
910if ($search_montant_ttc !=
'') {
913if ($search_multicurrency_code !=
'') {
914 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
916if ($search_multicurrency_tx !=
'') {
917 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
919if ($search_multicurrency_montant_ht !=
'') {
920 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
922if ($search_multicurrency_montant_vat !=
'') {
923 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
925if ($search_multicurrency_montant_ttc !=
'') {
926 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
929 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
931if ($search_status !=
'-1' && $search_status !=
'') {
932 if (is_numeric($search_status) && $search_status >= 0) {
933 if ($search_status ==
'0') {
934 $sql .=
" AND f.fk_statut = 0";
936 if ($search_status ==
'1') {
937 $sql .=
" AND f.fk_statut = 1";
939 if ($search_status ==
'2') {
940 $sql .=
" AND f.fk_statut = 2";
942 if ($search_status ==
'3') {
943 $sql .=
" AND f.fk_statut = 3";
946 $sql .=
" AND f.fk_statut IN (".$db->sanitize($search_status).
")";
950if ($search_paymentmode > 0) {
951 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
953if ($search_paymentterms > 0) {
954 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
956if ($search_fk_input_reason > 0) {
957 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
959if ($search_module_source) {
962if ($search_pos_source) {
965if ($search_date_start) {
966 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
968if ($search_date_end) {
969 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
971if ($search_date_valid_start) {
972 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
974if ($search_date_valid_end) {
975 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
977if ($search_datelimit_start) {
978 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
980if ($search_datelimit_end) {
981 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
983if ($search_datec_start) {
984 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
986if ($search_datec_end) {
987 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
989if ($search_datem_start) {
990 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
992if ($search_datem_end) {
993 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
995if ($search_option ==
'late') {
996 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->invoice->client->warning_delay).
"'";
1001if (!empty($search_fac_rec_source_title)) {
1002 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
1004if ($search_fk_fac_rec_source) {
1005 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1007if ($search_import_key) {
1011if ($search_user > 0) {
1012 $sql .=
" AND EXISTS (";
1013 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1014 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1015 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1016 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1017 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1020if ($search_sale && $search_sale !=
'-1') {
1021 if ($search_sale == -2) {
1022 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1023 } elseif ($search_sale > 0) {
1024 $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).
")";
1029if (!empty($searchCategoryInvoiceList)) {
1030 $searchCategoryInvoiceSqlList = array();
1031 $listofcategoryid =
'';
1032 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1033 if (intval($searchCategoryInvoice) == -2) {
1034 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1035 } elseif (intval($searchCategoryInvoice) > 0) {
1036 if ($searchCategoryInvoiceOperator == 0) {
1037 $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).
")";
1039 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1043 if ($listofcategoryid) {
1044 $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).
"))";
1046 if ($searchCategoryInvoiceOperator == 1) {
1047 if (!empty($searchCategoryInvoiceSqlList)) {
1048 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1051 if (!empty($searchCategoryInvoiceSqlList)) {
1052 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1058$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1059$searchCategoryProductOperator = 0;
1060if (!empty($searchCategoryProductList)) {
1061 $searchCategoryProductSqlList = array();
1062 $listofcategoryid =
'';
1063 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1064 if (intval($searchCategoryProduct) == -2) {
1065 $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)";
1066 } elseif (intval($searchCategoryProduct) > 0) {
1067 if ($searchCategoryProductOperator == 0) {
1068 $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).
")";
1070 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1074 if ($listofcategoryid) {
1075 $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).
"))";
1077 if ($searchCategoryProductOperator == 1) {
1078 if (!empty($searchCategoryProductSqlList)) {
1079 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1082 if (!empty($searchCategoryProductSqlList)) {
1083 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1087$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1088$searchCategoryCustomerOperator = 0;
1090if (!empty($searchCategoryCustomerList)) {
1091 $searchCategoryCustomerSqlList = array();
1092 $listofcategoryid =
'';
1093 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1094 if (intval($searchCategoryCustomer) == -2) {
1095 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1096 } elseif (intval($searchCategoryCustomer) > 0) {
1097 if ($searchCategoryCustomerOperator == 0) {
1098 $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).
")";
1100 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1104 if ($listofcategoryid) {
1105 $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).
"))";
1107 if ($searchCategoryCustomerOperator == 1) {
1108 if (!empty($searchCategoryCustomerSqlList)) {
1109 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1112 if (!empty($searchCategoryCustomerSqlList)) {
1113 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1118include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1120$parameters = array();
1121$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1122$sql .= $hookmanager->resPrint;
1125 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
1129$parameters = array();
1130$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1131$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1134$nbtotalofrecords =
'';
1137 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1138 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1140 $resql = $db->query($sqlforcount);
1142 $objforcount = $db->fetch_object($resql);
1143 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1148 if (($page * $limit) > $nbtotalofrecords) {
1156$sql .= $db->order($sortfield, $sortorder);
1158 $sql .= $db->plimit($limit + 1, $offset);
1161$resql = $db->query($sql);
1167$num = $db->num_rows($resql);
1169$arrayofselected = is_array($toselect) ? $toselect : array();
1171if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1172 $obj = $db->fetch_object($resql);
1175 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1182llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1184if ($search_fk_fac_rec_source) {
1186 $object->fetch((
int) $search_fk_fac_rec_source);
1190 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1195 $param .=
'&mode='.urlencode($mode);
1197if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1198 $param .=
'&contextpage='.urlencode($contextpage);
1200if ($limit > 0 && $limit !=
$conf->liste_limit) {
1201 $param .=
'&limit='.((int) $limit);
1203if ($optioncss !=
'') {
1204 $param .=
'&optioncss='.urlencode($optioncss);
1207 $param .=
'&show_files='.urlencode((
string) ($show_files));
1210 $param .=
'&search_all='.urlencode($search_all);
1213 $param .=
'&socid='.((int) $socid);
1215if ($search_date_startday) {
1216 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1218if ($search_date_startmonth) {
1219 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1221if ($search_date_startyear) {
1222 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1224if ($search_date_endday) {
1225 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1227if ($search_date_endmonth) {
1228 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1230if ($search_date_endyear) {
1231 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1233if ($search_date_valid_startday) {
1234 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1236if ($search_date_valid_startmonth) {
1237 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1239if ($search_date_valid_startyear) {
1240 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1242if ($search_date_valid_endday) {
1243 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1245if ($search_date_valid_endmonth) {
1246 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1248if ($search_date_valid_endyear) {
1249 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1251if ($search_datelimit_startday) {
1252 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1254if ($search_datelimit_startmonth) {
1255 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1257if ($search_datelimit_startyear) {
1258 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1260if ($search_datelimit_endday) {
1261 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1263if ($search_datelimit_endmonth) {
1264 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1266if ($search_datelimit_endyear) {
1267 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1270 $param .=
'&search_ref='.urlencode($search_ref);
1272if ($search_refcustomer) {
1273 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1275if ($search_project_ref) {
1276 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1278if ($search_project) {
1279 $param .=
'&search_project='.urlencode($search_project);
1281if ($search_type !=
'') {
1282 $param .=
'&search_type='.urlencode($search_type);
1284if ($search_subtype !=
'') {
1285 $param .=
'&search_subtype='.urlencode($search_subtype);
1287if ($search_company) {
1288 $param .=
'&search_company='.urlencode($search_company);
1290if ($search_company_alias) {
1291 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1293if ($search_parent_name !=
'') {
1294 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1297 $param .=
'&search_town='.urlencode($search_town);
1300 $param .=
'&search_zip='.urlencode($search_zip);
1302if ($search_country) {
1303 $param .=
"&search_country=".urlencode($search_country);
1305if ($search_type_thirdparty !=
'') {
1306 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1308if ($search_customer_code) {
1309 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1311if ($search_sale > 0) {
1312 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1314if ($search_user > 0) {
1315 $param .=
'&search_user='.urlencode((
string) $search_user);
1318 $param .=
'&search_login='.urlencode($search_login);
1320if ($searchCategoryInvoiceOperator == 1) {
1321 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1323foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1324 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1326if ($search_product_category > 0) {
1327 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1329if ($search_montant_ht !=
'') {
1330 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1332if ($search_montant_vat !=
'') {
1333 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1335if ($search_montant_localtax1 !=
'') {
1336 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1338if ($search_montant_localtax2 !=
'') {
1339 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1341if ($search_montant_ttc !=
'') {
1342 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1344if ($search_multicurrency_code !=
'') {
1345 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1347if ($search_multicurrency_tx !=
'') {
1348 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1350if ($search_multicurrency_montant_ht !=
'') {
1351 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1353if ($search_multicurrency_montant_vat !=
'') {
1354 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1356if ($search_multicurrency_montant_ttc !=
'') {
1357 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1359if ($search_status !=
'') {
1360 $param .=
'&search_status='.urlencode($search_status);
1362if ($search_paymentmode > 0) {
1363 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1365if ($search_paymentterms > 0) {
1366 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1368if ($search_fk_input_reason > 0) {
1369 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1371if ($search_module_source) {
1372 $param .=
'&search_module_source='.urlencode($search_module_source);
1374if ($search_pos_source) {
1375 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1377if ($search_option) {
1378 $param .=
"&search_option=".urlencode($search_option);
1380if ($search_categ_cus > 0) {
1381 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1383if (!empty($search_fac_rec_source_title)) {
1384 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1386if ($search_fk_fac_rec_source) {
1387 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1389if ($search_import_key !=
'') {
1390 $param .=
'&search_import_key='.urlencode($search_import_key);
1394include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1396$parameters = array(
'param' => &$param);
1397$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1398$param .= $hookmanager->resPrint;
1400$arrayofmassactions = array(
1401 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1402 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1403 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1404 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1407if ($user->hasRight(
'facture',
'paiement')) {
1408 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1410if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1411 $langs->load(
"withdrawals");
1412 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1414if ($user->hasRight(
'facture',
'supprimer')) {
1416 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1418 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1421if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1422 $arrayofmassactions = array();
1424$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1428if ($contextpage !=
'poslist') {
1429 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1431 $url .=
'&socid='.urlencode((
string)
$object->socid);
1434 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1436 $newcardbutton =
'';
1437 $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'));
1438 $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'));
1440 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1445print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1446if ($optioncss !=
'') {
1447 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1449print
'<input type="hidden" name="token" value="'.newToken().
'">';
1450print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1451if (!in_array($massaction, array(
'makepayment'))) {
1452 print
'<input type="hidden" name="action" value="list">';
1454print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1455print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1456print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1457print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1458print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1459print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1461print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1463$topicmail =
"SendBillRef";
1464$modelmail =
"facture_send";
1466$trackid =
'inv'.$object->id;
1467include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1469if ($massaction ==
'makepayment') {
1471 $formquestion = array(
1475 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1476 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1477 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1480 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1485 foreach ($fieldstosearchall as $key => $val) {
1486 $fieldstosearchall[$key] = $langs->trans($val);
1488 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1494if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1496 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1499if ($user->hasRight(
"user",
"user",
"lire")) {
1500 $langs->load(
"commercial");
1501 $moreforfilter .=
'<div class="divsearchfield">';
1502 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1503 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1504 $moreforfilter .=
'</div>';
1507if ($user->hasRight(
"user",
"user",
"lire")) {
1508 $moreforfilter .=
'<div class="divsearchfield">';
1509 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1510 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1511 $moreforfilter .=
'</div>';
1514if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1515 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1516 $moreforfilter .=
'<div class="divsearchfield">';
1517 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1518 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1519 $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);
1520 $moreforfilter .=
'</div>';
1522if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1523 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1524 $moreforfilter .=
'<div class="divsearchfield">';
1525 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1526 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1527 $moreforfilter .=
'</div>';
1530$moreforfilter .=
'<div class="divsearchfield">';
1531$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1532$moreforfilter .=
'</div>';
1534$parameters = array();
1535$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1536if (empty($reshook)) {
1537 $moreforfilter .= $hookmanager->resPrint;
1539 $moreforfilter = $hookmanager->resPrint;
1542if (!empty($moreforfilter)) {
1543 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1544 print $moreforfilter;
1548$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1549$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1552if ($massactionbutton && $contextpage !=
'poslist') {
1553 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1556print
'<div class="div-table-responsive">';
1557print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1561print
'<tr class="liste_titre_filter">';
1565 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1566 $searchpicto = $form->showFilterButtons(
'left');
1572 print
'<td class="liste_titre">';
1576if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1578 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1582if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1583 print
'<td class="liste_titre">';
1584 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1588if (!empty($arrayfields[
'f.type'][
'checked'])) {
1589 print
'<td class="liste_titre maxwidthonsmartphone">';
1601 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1605if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1606 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1607 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1611if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1612 print
'<td class="liste_titre center">';
1613 print
'<div class="nowrapfordate">';
1614 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1616 print
'<div class="nowrapfordate">';
1617 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1622if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1623 print
'<td class="liste_titre center">';
1624 print
'<div class="nowrapfordate">';
1625 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'));
1627 print
'<div class="nowrapfordate">';
1628 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'));
1633if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1634 print
'<td class="liste_titre center">';
1635 print
'<div class="nowrapfordate">';
1636 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1638 print
'<div class="nowrapfordate">';
1639 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1644if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1645 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1648if (!empty($arrayfields[
'p.title'][
'checked'])) {
1649 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1652if (!empty($arrayfields[
's.nom'][
'checked'])) {
1653 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>';
1656if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1657 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1660if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1661 print
'<td class="liste_titre">';
1662 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1666if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1667 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1670if (!empty($arrayfields[
's.town'][
'checked'])) {
1671 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1674if (!empty($arrayfields[
's.zip'][
'checked'])) {
1675 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1678if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1679 print
'<td class="liste_titre">';
1680 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1684if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1685 print
'<td class="liste_titre center">';
1686 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1690if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1691 print
'<td class="liste_titre maxwidthonsmartphone center">';
1692 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);
1696if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1697 print
'<td class="liste_titre">';
1698 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1702if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1703 print
'<td class="liste_titre left">';
1704 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1708if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1709 print
'<td class="liste_titre">';
1710 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1714if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1715 print
'<td class="liste_titre">';
1716 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1720if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1721 print
'<td class="liste_titre">';
1722 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1725if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1727 print
'<td class="liste_titre right">';
1728 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1731if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1733 print
'<td class="liste_titre right">';
1734 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1737if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1739 print
'<td class="liste_titre right">';
1740 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1743if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1745 print
'<td class="liste_titre right">';
1746 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1749if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1751 print
'<td class="liste_titre right">';
1752 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1755if (!empty($arrayfields[
'u.login'][
'checked'])) {
1757 print
'<td class="liste_titre" align="center">';
1758 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1761if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1762 print
'<td class="liste_titre"></td>';
1764if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1765 print
'<td class="liste_titre" align="right">';
1768if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1769 print
'<td class="liste_titre right">';
1772if (!empty($arrayfields[
'rtp'][
'checked'])) {
1773 print
'<td class="liste_titre">';
1776if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1778 print
'<td class="liste_titre">';
1779 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1782if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1784 print
'<td class="liste_titre">';
1785 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1788if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1790 print
'<td class="liste_titre right">';
1791 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1794if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1796 print
'<td class="liste_titre right">';
1797 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1800if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1802 print
'<td class="liste_titre right">';
1803 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1806if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1807 print
'<td class="liste_titre">';
1810if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1811 print
'<td class="liste_titre right">';
1814if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1815 print
'<td class="liste_titre right">';
1818if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1819 print
'<td class="liste_titre right">';
1822if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1823 print
'<td class="liste_titre right">';
1826if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1827 print
'<td class="liste_titre right">';
1832include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1835$parameters = array(
'arrayfields' => $arrayfields);
1836$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1837print $hookmanager->resPrint;
1839if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1840 print
'<td class="liste_titre center">';
1841 print
'<div class="nowrapfordate">';
1842 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1844 print
'<div class="nowrapfordate">';
1845 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1850if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1851 print
'<td class="liste_titre center">';
1852 print
'<div class="nowrapfordate">';
1853 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1855 print
'<div class="nowrapfordate">';
1856 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1861if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1862 print
'<td class="liste_titre">';
1865if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1867 print
'<td class="liste_titre">';
1870if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1872 print
'<td class="liste_titre">';
1875if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1877 print
'<td class="liste_titre maxwidthonsmartphone right">';
1878 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).
'">';
1882if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1883 print
'<td class="liste_titre maxwidthonsmartphone center">';
1884 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1888if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1889 print
'<td class="liste_titre center parentonrightofpage">';
1890 $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"));
1892 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1897 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1898 $searchpicto = $form->showFilterButtons();
1909print
'<tr class="liste_titre">';
1911 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1918if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1919 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1922if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1923 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1926if (!empty($arrayfields[
'f.type'][
'checked'])) {
1927 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1930if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1931 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1933if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1934 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1937if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1938 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1941if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1942 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1945if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1946 $langs->load(
"projects");
1947 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1950if (!empty($arrayfields[
'p.title'][
'checked'])) {
1951 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1954if (!empty($arrayfields[
's.nom'][
'checked'])) {
1955 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1958if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1960 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1963if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1964 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1967if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1968 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1971if (!empty($arrayfields[
's.town'][
'checked'])) {
1972 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1975if (!empty($arrayfields[
's.zip'][
'checked'])) {
1976 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1979if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1980 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1983if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1984 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1987if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1988 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1991if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1992 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1995if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1996 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1999if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2000 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
2002if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2003 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2006if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2007 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2010if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2011 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2014if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2015 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2018if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2019 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2022if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2023 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2026if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2027 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2030if (!empty($arrayfields[
'u.login'][
'checked'])) {
2031 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2034if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2035 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2038if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2039 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2042if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2043 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2046if (!empty($arrayfields[
'rtp'][
'checked'])) {
2047 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2050if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2051 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2054if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2055 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2058if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2059 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2062if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2063 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2066if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2067 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2070if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2071 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2074if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2075 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2078if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2079 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2082if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2083 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2086if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2087 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2090if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2091 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2095include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2097$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2098$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2099print $hookmanager->resPrint;
2100if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2101 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2104if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2105 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2108if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2109 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2112if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2113 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2116if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2117 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2120if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2121 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2125if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2126 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2130if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2131 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2135 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2141$projectstatic =
new Project($db);
2143$userstatic =
new User($db);
2161 $typenArray = $formcompany->typent_array(1);
2163 $with_margin_info =
false;
2164 if (isModEnabled(
'margin') && (
2165 !empty($arrayfields[
'total_pa'][
'checked'])
2166 || !empty($arrayfields[
'total_margin'][
'checked'])
2167 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2168 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2171 $with_margin_info =
true;
2176 $imaxinloop = ($limit ? min($num, $limit) : $num);
2177 while ($i < $imaxinloop) {
2178 $obj = $db->fetch_object($resql);
2180 $datelimit = $db->jdate($obj->datelimite);
2182 $facturestatic->id = $obj->id;
2183 $facturestatic->ref = $obj->ref;
2184 $facturestatic->ref_client = $obj->ref_client;
2185 $facturestatic->ref_customer = $obj->ref_client;
2186 $facturestatic->type = $obj->type;
2187 $facturestatic->subtype = $obj->subtype;
2188 $facturestatic->total_ht = $obj->total_ht;
2189 $facturestatic->total_tva = $obj->total_tva;
2190 $facturestatic->total_ttc = $obj->total_ttc;
2191 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2192 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2193 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2194 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2195 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2196 $facturestatic->statut = $obj->fk_statut;
2197 $facturestatic->status = $obj->fk_statut;
2198 $facturestatic->close_code = $obj->close_code;
2199 $facturestatic->total_ttc = $obj->total_ttc;
2200 $facturestatic->paye = $obj->paye;
2201 $facturestatic->socid = $obj->fk_soc;
2203 $facturestatic->date = $db->jdate($obj->datef);
2204 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2205 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2207 $facturestatic->note_public = $obj->note_public;
2208 $facturestatic->note_private = $obj->note_private;
2211 $facturestatic->retained_warranty = $obj->retained_warranty;
2212 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2213 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2214 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2215 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2216 $facturestatic->situation_counter = $obj->situation_counter;
2219 $companystatic->id = $obj->socid;
2220 $companystatic->name = $obj->name;
2221 $companystatic->name_alias = $obj->alias;
2222 $companystatic->client = $obj->client;
2223 $companystatic->fournisseur = $obj->fournisseur;
2224 $companystatic->code_client = $obj->code_client;
2225 $companystatic->code_compta_client = $obj->code_compta_client;
2226 $companystatic->code_fournisseur = $obj->code_fournisseur;
2227 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2228 $companystatic->email = $obj->email;
2229 $companystatic->phone = $obj->phone;
2230 $companystatic->fax = $obj->fax;
2231 $companystatic->address = $obj->address;
2232 $companystatic->zip = $obj->zip;
2233 $companystatic->town = $obj->town;
2234 $companystatic->country_code = $obj->country_code;
2236 $projectstatic->id = $obj->project_id;
2237 $projectstatic->ref = $obj->project_ref;
2238 $projectstatic->title = $obj->project_label;
2240 $paiement = $facturestatic->getSommePaiement();
2241 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2242 $totaldeposits = $facturestatic->getSumDepositsUsed();
2243 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2244 $remaintopay = $obj->total_ttc - $totalallpayments;
2246 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2247 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2248 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2250 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2251 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2253 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2254 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2258 $multicurrency_remaintopay = 0;
2261 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2262 $remaintopay = -$remaincreditnote;
2263 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2264 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2265 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2266 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2269 $facturestatic->alreadypaid = $paiement;
2270 $facturestatic->totalpaid = $paiement;
2271 $facturestatic->totalcreditnotes = $totalcreditnotes;
2272 $facturestatic->totaldeposits = $totaldeposits;
2274 $marginInfo = array();
2275 if ($with_margin_info) {
2276 $facturestatic->fetch_lines();
2277 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2278 $total_ht += $obj->total_ht;
2279 $total_margin += $marginInfo[
'total_margin'];
2284 if ($mode ==
'kanban') {
2286 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2287 print
'<div class="box-flex-container kanban">';
2290 if ($massactionbutton || $massaction) {
2292 if (in_array(
$object->id, $arrayofselected)) {
2297 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2298 print $facturestatic->getKanbanView(
'', $arraydata);
2299 if ($i == ($imaxinloop - 1)) {
2306 print
'<tr data-rowid="'.$object->id.
'" class="oddeven status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2307 if ($contextpage ==
'poslist') {
2308 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2309 if (strpos($obj->ref, 'PROV
') !== false) {
2310 //If is a draft invoice, load var to be able to add products
2311 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2312 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2320 print
'<td class="nowrap center">';
2321 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2323 if (in_array($obj->id, $arrayofselected)) {
2326 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2336 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2343 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2344 print
'<td class="nowraponall">';
2346 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2348 print
'<td class="nobordernopadding nowraponall">';
2349 if ($contextpage ==
'poslist') {
2352 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2356 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2357 $filedir = $filepath.
'/'.$filename;
2359 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2360 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2372 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2373 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2374 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2383 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2384 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2385 print $facturestatic->getLibType(2);
2393 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2395 if ($facturestatic->subtype > 0) {
2396 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2398 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2407 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2408 print
'<td align="center" class="nowraponall">';
2417 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2418 print
'<td align="center" class="nowraponall">';
2427 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2428 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2429 if ($facturestatic->hasDelay()) {
2430 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2439 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2440 print
'<td class="nocellnopadd nowraponall">';
2441 if ($obj->project_id > 0) {
2442 print $projectstatic->getNomUrl(1);
2451 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2452 print
'<td class="nowraponall">';
2453 if ($obj->project_id > 0) {
2463 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2464 print
'<td class="tdoverflowmax150">';
2465 if ($contextpage ==
'poslist') {
2468 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2476 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2477 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2485 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2486 print
'<td class="tdoverflowmax200">';
2487 if ($obj->fk_parent > 0) {
2488 if (!isset($company_url_list[$obj->fk_parent])) {
2489 $companyparent =
new Societe($db);
2490 $res = $companyparent->fetch($obj->fk_parent);
2492 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2495 if (isset($company_url_list[$obj->fk_parent])) {
2496 print $company_url_list[$obj->fk_parent];
2505 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2506 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2514 if (!empty($arrayfields[
's.town'][
'checked'])) {
2515 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2523 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2524 print
'<td class="nowraponall">';
2532 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2533 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2539 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2540 $tmparray =
getCountry($obj->fk_pays,
'all');
2541 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2549 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2550 if (!is_array($typenArray) || count($typenArray) == 0) {
2551 $typenArray = $formcompany->typent_array(1);
2553 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2554 if (!empty($obj->typent_code)) {
2555 print $typenArray[$obj->typent_code];
2563 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2564 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2565 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2567 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2568 print
$conf->cache[
'staff'][$obj->staff_code];
2576 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2577 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2578 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2587 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2588 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2589 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2598 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2600 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2608 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2617 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2627 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2628 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2635 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2638 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2639 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2646 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2649 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2650 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2657 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2660 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2661 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2668 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2671 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2672 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2679 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2682 $userstatic->id = $obj->fk_user_author;
2683 $userstatic->login = $obj->login;
2684 $userstatic->lastname = $obj->lastname;
2685 $userstatic->firstname = $obj->firstname;
2686 $userstatic->email = $obj->user_email;
2687 $userstatic->status = $obj->user_statut;
2688 $userstatic->entity = $obj->entity;
2689 $userstatic->photo = $obj->photo;
2690 $userstatic->office_phone = $obj->office_phone;
2691 $userstatic->office_fax = $obj->office_fax;
2692 $userstatic->user_mobile = $obj->user_mobile;
2693 $userstatic->job = $obj->job;
2694 $userstatic->gender = $obj->gender;
2697 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2698 print
'<td class="tdoverflowmax125">';
2699 if ($userstatic->id) {
2700 print $userstatic->getNomUrl(-1);
2710 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2713 if ($obj->socid > 0) {
2714 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2715 if ($listsalesrepresentatives < 0) {
2718 $nbofsalesrepresentative = count($listsalesrepresentatives);
2719 if ($nbofsalesrepresentative > 6) {
2721 print $nbofsalesrepresentative;
2722 } elseif ($nbofsalesrepresentative > 0) {
2724 foreach ($listsalesrepresentatives as $val) {
2725 $userstatic->id = $val[
'id'];
2726 $userstatic->lastname = $val[
'lastname'];
2727 $userstatic->firstname = $val[
'firstname'];
2728 $userstatic->email = $val[
'email'];
2729 $userstatic->status = $val[
'statut'];
2730 $userstatic->entity = $val[
'entity'];
2731 $userstatic->photo = $val[
'photo'];
2732 $userstatic->login = $val[
'login'];
2733 $userstatic->office_phone = $val[
'office_phone'];
2734 $userstatic->office_fax = $val[
'office_fax'];
2735 $userstatic->user_mobile = $val[
'user_mobile'];
2736 $userstatic->job = $val[
'job'];
2737 $userstatic->gender = $val[
'gender'];
2739 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2741 if ($j < $nbofsalesrepresentative) {
2755 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2756 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2762 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2763 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2770 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2774 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2775 print
'<td class="right nowraponall amount">';
2776 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2789 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2790 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2791 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2792 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2794 $title = $obj->multicurrency_code;
2795 $label = $obj->multicurrency_code;
2797 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2806 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2807 print
'<td class="nowraponall">';
2808 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2815 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2816 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2822 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2823 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2829 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2830 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2836 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2837 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2844 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2845 print
'<td class="right nowraponall amount">';
2846 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2854 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2855 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2860 if (empty($totalarray[
'val'][
'total_pa'])) {
2863 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2866 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2867 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2872 if (empty($totalarray[
'val'][
'total_margin'])) {
2875 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2878 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2879 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2885 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2886 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2891 if ($i >= $imaxinloop - 1) {
2892 if (!empty($total_ht)) {
2901 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2903 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2904 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2905 print $hookmanager->resPrint;
2907 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2908 print
'<td class="nowraponall center">';
2909 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
2916 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2917 print
'<td class="nowraponall center">';
2918 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
2925 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2926 print
'<td class="nowraponall center">';
2927 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuserrel');
2934 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2935 print
'<td class="sensiblehtmlcontent center">';
2936 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2943 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2944 print
'<td class="sensiblehtmlcontent center">';
2945 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2952 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2953 print
'<td class="center">';
2954 if (!empty($obj->fk_fac_rec_source)) {
2956 $result = $facrec->fetch($obj->fk_fac_rec_source);
2960 print $facrec->getNomUrl();
2970 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2971 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2978 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2979 print
'<td class="nowrap center">';
2980 print $facturestatic->getLibStatut(5, $totalallpayments);
2990 print
'<td class="nowrap center">';
2991 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2993 if (in_array($obj->id, $arrayofselected)) {
2996 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3011 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
3012 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
3015 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3021 foreach ($arrayfields as $key => $val) {
3022 if (!empty($val[
'checked'])) {
3026 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3031$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3032$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3033print $hookmanager->resPrint;
3035print
'</table>'.
"\n";
3038print
'</form>'.
"\n";
3041if ($contextpage !=
'poslist') {
3042 $hidegeneratedfilelistifempty = 1;
3043 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3044 $hidegeneratedfilelistifempty = 0;
3048 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3049 $urlsource .= str_replace(
'&',
'&', $param);
3051 $filedir = $diroutputmassaction;
3052 $genallowed = $user->hasRight(
"facture",
"lire");
3053 $delallowed = $user->hasRight(
"facture",
"creer");
3056 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( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.