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);
499 $paiementAmount = $facture->getSommePaiement();
500 $totalcreditnotes = $facture->getSumCreditNotesUsed();
501 $totaldeposits = $facture->getSumDepositsUsed();
503 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
504 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
507 $parameters = array(
'remaintopay' => $remaintopay);
508 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
510 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
511 $remaintopay = $remain;
513 } elseif ($reshook < 0) {
515 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
518 if ($remaintopay != 0) {
519 $resultBank = $facture->setBankAccount($bankid);
520 if ($resultBank < 0) {
525 $paiement->datepaye = $paiementdate;
526 $paiement->amounts[$facture->id] = $remaintopay;
527 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
528 $paiement->paiementid = $paiementid;
529 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
530 if ($paiement_id < 0) {
531 $langs->load(
"errors");
532 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
535 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
537 $langs->load(
"errors");
538 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
544 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
548 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
553 if (empty($errorpayment)) {
554 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
562} elseif ($massaction ==
'withdrawrequest') {
563 $langs->load(
"withdrawals");
565 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
572 $arrayofselected = is_array($toselect) ? $toselect : array();
573 $listofbills = array();
574 foreach ($arrayofselected as $toselectid) {
576 $result = $objecttmp->fetch($toselectid);
578 $totalpaid = $objecttmp->getSommePaiement();
579 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
580 $totaldeposits = $objecttmp->getSumDepositsUsed();
581 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
584 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
585 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
587 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
588 $objecttmp->resteapayer = $remaintopay;
590 } elseif ($reshook < 0) {
592 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
597 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
598 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
600 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
601 } elseif ($objecttmp->resteapayer < 0) {
603 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
606 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
607 $rsql .=
" , pfd.date_traite as date_traite";
608 $rsql .=
" , pfd.amount";
609 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
610 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
611 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
612 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
613 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
614 $rsql .=
" AND pfd.traite = 0";
615 $rsql .=
" ORDER BY pfd.date_demande DESC";
617 $result_sql = $db->query($rsql);
619 $numprlv = $db->num_rows($result_sql);
626 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
627 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
628 $langs->load(
"errors");
630 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
632 $listofbills[] = $objecttmp;
638 if (!empty($listofbills)) {
639 $nbwithdrawrequestok = 0;
640 foreach ($listofbills as $aBill) {
647 $sql =
"SELECT SUM(pfd.amount) as amount";
648 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
652 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
654 $sql .=
" AND pfd.traite = 0";
656 $resql = $db->query($sql);
658 $obj = $db->fetch_object($resql);
660 $pending += (float) $obj->amount;
666 $sqlPending =
"SELECT SUM(pl.amount) as amount";
667 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
668 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
672 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
674 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
675 $resPending = $db->query($sqlPending);
677 if ($objPending = $db->fetch_object($resPending)) {
678 $pending += (float) $objPending->amount;
681 $db->free($resPending);
683 $requestAmount = $aBill->resteapayer - $pending;
686 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
687 if ($requestAmount > 0) {
690 $nbwithdrawrequestok++;
696 $aBill->error =
'WithdrawRequestErrorNilAmount';
697 $aBill->errors[] = $aBill->error;
701 if ($nbwithdrawrequestok > 0) {
702 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
714$form =
new Form($db);
718$facturestatic =
new Facture($db);
720$companystatic =
new Societe($db);
721$companyparent =
new Societe($db);
723$company_url_list = array();
728 if (empty($search_company)) {
729 $search_company = $soc->name;
735$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
736$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
738$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
739$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
745 $sql =
'SELECT DISTINCT';
747$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,';
748$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
749$sql .=
' f.fk_user_author,';
750$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,';
751$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
752$sql .=
" f.fk_input_reason,";
753$sql .=
" f.module_source, f.pos_source,";
754$sql .=
' f.paye as paye, f.fk_statut, f.import_key, f.close_code,';
755$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
756$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
757$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,';
758$sql .=
" s.parent as fk_parent,";
759$sql .=
" s2.nom as name2,";
760$sql .=
' typent.code as typent_code,';
761$sql .=
' state.code_departement as state_code, state.nom as state_name,';
762$sql .=
' country.code as country_code,';
763$sql .=
' f.fk_fac_rec_source,';
764$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
765$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';
775if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
776 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
777 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
781$parameters = array();
782$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
783$sql .= $hookmanager->resPrint;
784$sql = preg_replace(
'/,\s*$/',
'', $sql);
788$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
789$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
790$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
791$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
792$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
793$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
794if ($sortfield ==
"f.datef") {
795 $sql .= $db->hintindex(
'idx_facture_datef');
797if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
798 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
801 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
803if (!empty($search_fac_rec_source_title)) {
804 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
806$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
807$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
809$parameters = array();
810$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
811$sql .= $hookmanager->resPrint;
813$sql .=
' WHERE f.fk_soc = s.rowid';
814$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
816 $sql .=
' AND s.rowid = '.((int) $socid);
820 $sql .=
' AND f.fk_user_author IS NULL';
822 $sql .=
' AND f.fk_user_author = '.((int) $userid);
828if ($search_refcustomer) {
831if ($search_type !=
'' && $search_type !=
'-1') {
832 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
834if ($search_subtype !=
'' && $search_subtype !=
'-1') {
835 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
837if ($search_project_ref) {
840if ($search_project) {
843if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
844 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
846 if ($search_company) {
849 if ($search_company_alias) {
853if ($search_parent_name) {
856if ($search_customer_code) {
868if (strlen(trim($search_country))) {
870 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
871 foreach ($arrayofcode as $key => $value) {
872 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
873 if ($value != $mysoc->country_code) {
874 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
877 if ($search_country ==
'special_allnotme') {
878 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
879 } elseif ($search_country ==
'special_eec') {
880 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
881 } elseif ($search_country ==
'special_eecnotme') {
882 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
883 } elseif ($search_country ==
'special_noteec') {
884 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
889if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
890 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
892if ($search_montant_ht !=
'') {
895if ($search_montant_vat !=
'') {
898if ($search_montant_localtax1 !=
'') {
899 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
901if ($search_montant_localtax2 !=
'') {
902 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
904if ($search_montant_ttc !=
'') {
907if ($search_multicurrency_code !=
'') {
908 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
910if ($search_multicurrency_tx !=
'') {
911 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
913if ($search_multicurrency_montant_ht !=
'') {
914 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
916if ($search_multicurrency_montant_vat !=
'') {
917 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
919if ($search_multicurrency_montant_ttc !=
'') {
920 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
923 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
925if ($search_status !=
'-1' && $search_status !=
'') {
926 if (is_numeric($search_status) && $search_status >= 0) {
927 if ($search_status ==
'0') {
928 $sql .=
" AND f.fk_statut = 0";
930 if ($search_status ==
'1') {
931 $sql .=
" AND f.fk_statut = 1";
933 if ($search_status ==
'2') {
934 $sql .=
" AND f.fk_statut = 2";
936 if ($search_status ==
'3') {
937 $sql .=
" AND f.fk_statut = 3";
940 $sql .=
" AND f.fk_statut IN (".$db->sanitize($search_status).
")";
944if ($search_paymentmode > 0) {
945 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
947if ($search_paymentterms > 0) {
948 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
950if ($search_fk_input_reason > 0) {
951 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
953if ($search_module_source) {
956if ($search_pos_source) {
959if ($search_date_start) {
960 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
962if ($search_date_end) {
963 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
965if ($search_date_valid_start) {
966 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
968if ($search_date_valid_end) {
969 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
971if ($search_datelimit_start) {
972 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
974if ($search_datelimit_end) {
975 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
977if ($search_datec_start) {
978 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
980if ($search_datec_end) {
981 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
983if ($search_datem_start) {
984 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
986if ($search_datem_end) {
987 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
989if ($search_option ==
'late') {
990 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->invoice->client->warning_delay).
"'";
995if (!empty($search_fac_rec_source_title)) {
996 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
998if ($search_fk_fac_rec_source) {
999 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1001if ($search_import_key) {
1005if ($search_user > 0) {
1006 $sql .=
" AND EXISTS (";
1007 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1008 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1009 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1010 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1011 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1014if ($search_sale && $search_sale !=
'-1') {
1015 if ($search_sale == -2) {
1016 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1017 } elseif ($search_sale > 0) {
1018 $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).
")";
1023if (!empty($searchCategoryInvoiceList)) {
1024 $searchCategoryInvoiceSqlList = array();
1025 $listofcategoryid =
'';
1026 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1027 if (intval($searchCategoryInvoice) == -2) {
1028 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1029 } elseif (intval($searchCategoryInvoice) > 0) {
1030 if ($searchCategoryInvoiceOperator == 0) {
1031 $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).
")";
1033 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1037 if ($listofcategoryid) {
1038 $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).
"))";
1040 if ($searchCategoryInvoiceOperator == 1) {
1041 if (!empty($searchCategoryInvoiceSqlList)) {
1042 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1045 if (!empty($searchCategoryInvoiceSqlList)) {
1046 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1052$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1053$searchCategoryProductOperator = 0;
1054if (!empty($searchCategoryProductList)) {
1055 $searchCategoryProductSqlList = array();
1056 $listofcategoryid =
'';
1057 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1058 if (intval($searchCategoryProduct) == -2) {
1059 $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)";
1060 } elseif (intval($searchCategoryProduct) > 0) {
1061 if ($searchCategoryProductOperator == 0) {
1062 $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).
")";
1064 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1068 if ($listofcategoryid) {
1069 $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).
"))";
1071 if ($searchCategoryProductOperator == 1) {
1072 if (!empty($searchCategoryProductSqlList)) {
1073 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1076 if (!empty($searchCategoryProductSqlList)) {
1077 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1081$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1082$searchCategoryCustomerOperator = 0;
1084if (!empty($searchCategoryCustomerList)) {
1085 $searchCategoryCustomerSqlList = array();
1086 $listofcategoryid =
'';
1087 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1088 if (intval($searchCategoryCustomer) == -2) {
1089 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1090 } elseif (intval($searchCategoryCustomer) > 0) {
1091 if ($searchCategoryCustomerOperator == 0) {
1092 $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).
")";
1094 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1098 if ($listofcategoryid) {
1099 $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).
"))";
1101 if ($searchCategoryCustomerOperator == 1) {
1102 if (!empty($searchCategoryCustomerSqlList)) {
1103 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1106 if (!empty($searchCategoryCustomerSqlList)) {
1107 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1112include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1114$parameters = array();
1115$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1116$sql .= $hookmanager->resPrint;
1119 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
1123$parameters = array();
1124$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1125$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1128$nbtotalofrecords =
'';
1131 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1132 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1134 $resql = $db->query($sqlforcount);
1136 $objforcount = $db->fetch_object($resql);
1137 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1142 if (($page * $limit) > $nbtotalofrecords) {
1150$sql .= $db->order($sortfield, $sortorder);
1152 $sql .= $db->plimit($limit + 1, $offset);
1155$resql = $db->query($sql);
1161$num = $db->num_rows($resql);
1163$arrayofselected = is_array($toselect) ? $toselect : array();
1165if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1166 $obj = $db->fetch_object($resql);
1169 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1176llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1178if ($search_fk_fac_rec_source) {
1180 $object->fetch((
int) $search_fk_fac_rec_source);
1184 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1189 $param .=
'&mode='.urlencode($mode);
1191if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1192 $param .=
'&contextpage='.urlencode($contextpage);
1194if ($limit > 0 && $limit !=
$conf->liste_limit) {
1195 $param .=
'&limit='.((int) $limit);
1197if ($optioncss !=
'') {
1198 $param .=
'&optioncss='.urlencode($optioncss);
1201 $param .=
'&show_files='.urlencode((
string) ($show_files));
1204 $param .=
'&search_all='.urlencode($search_all);
1207 $param .=
'&socid='.((int) $socid);
1209if ($search_date_startday) {
1210 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1212if ($search_date_startmonth) {
1213 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1215if ($search_date_startyear) {
1216 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1218if ($search_date_endday) {
1219 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1221if ($search_date_endmonth) {
1222 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1224if ($search_date_endyear) {
1225 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1227if ($search_date_valid_startday) {
1228 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1230if ($search_date_valid_startmonth) {
1231 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1233if ($search_date_valid_startyear) {
1234 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1236if ($search_date_valid_endday) {
1237 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1239if ($search_date_valid_endmonth) {
1240 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1242if ($search_date_valid_endyear) {
1243 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1245if ($search_datelimit_startday) {
1246 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1248if ($search_datelimit_startmonth) {
1249 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1251if ($search_datelimit_startyear) {
1252 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1254if ($search_datelimit_endday) {
1255 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1257if ($search_datelimit_endmonth) {
1258 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1260if ($search_datelimit_endyear) {
1261 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1264 $param .=
'&search_ref='.urlencode($search_ref);
1266if ($search_refcustomer) {
1267 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1269if ($search_project_ref) {
1270 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1272if ($search_project) {
1273 $param .=
'&search_project='.urlencode($search_project);
1275if ($search_type !=
'') {
1276 $param .=
'&search_type='.urlencode($search_type);
1278if ($search_subtype !=
'') {
1279 $param .=
'&search_subtype='.urlencode($search_subtype);
1281if ($search_company) {
1282 $param .=
'&search_company='.urlencode($search_company);
1284if ($search_company_alias) {
1285 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1287if ($search_parent_name !=
'') {
1288 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1291 $param .=
'&search_town='.urlencode($search_town);
1294 $param .=
'&search_zip='.urlencode($search_zip);
1296if ($search_country) {
1297 $param .=
"&search_country=".urlencode($search_country);
1299if ($search_type_thirdparty !=
'') {
1300 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1302if ($search_customer_code) {
1303 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1305if ($search_sale > 0) {
1306 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1308if ($search_user > 0) {
1309 $param .=
'&search_user='.urlencode((
string) $search_user);
1312 $param .=
'&search_login='.urlencode($search_login);
1314if ($searchCategoryInvoiceOperator == 1) {
1315 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1317foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1318 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1320if ($search_product_category > 0) {
1321 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1323if ($search_montant_ht !=
'') {
1324 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1326if ($search_montant_vat !=
'') {
1327 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1329if ($search_montant_localtax1 !=
'') {
1330 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1332if ($search_montant_localtax2 !=
'') {
1333 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1335if ($search_montant_ttc !=
'') {
1336 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1338if ($search_multicurrency_code !=
'') {
1339 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1341if ($search_multicurrency_tx !=
'') {
1342 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1344if ($search_multicurrency_montant_ht !=
'') {
1345 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1347if ($search_multicurrency_montant_vat !=
'') {
1348 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1350if ($search_multicurrency_montant_ttc !=
'') {
1351 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1353if ($search_status !=
'') {
1354 $param .=
'&search_status='.urlencode($search_status);
1356if ($search_paymentmode > 0) {
1357 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1359if ($search_paymentterms > 0) {
1360 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1362if ($search_fk_input_reason > 0) {
1363 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1365if ($search_module_source) {
1366 $param .=
'&search_module_source='.urlencode($search_module_source);
1368if ($search_pos_source) {
1369 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1371if ($search_option) {
1372 $param .=
"&search_option=".urlencode($search_option);
1374if ($search_categ_cus > 0) {
1375 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1377if (!empty($search_fac_rec_source_title)) {
1378 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1380if ($search_fk_fac_rec_source) {
1381 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1383if ($search_import_key !=
'') {
1384 $param .=
'&search_import_key='.urlencode($search_import_key);
1388include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1390$parameters = array(
'param' => &$param);
1391$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1392$param .= $hookmanager->resPrint;
1394$arrayofmassactions = array(
1395 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1396 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1397 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1398 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1401if ($user->hasRight(
'facture',
'paiement')) {
1402 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1404if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1405 $langs->load(
"withdrawals");
1406 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1408if ($user->hasRight(
'facture',
'supprimer')) {
1410 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1412 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1415if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1416 $arrayofmassactions = array();
1418$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1422if ($contextpage !=
'poslist') {
1423 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1425 $url .=
'&socid='.urlencode((
string)
$object->socid);
1428 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1430 $newcardbutton =
'';
1431 $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'));
1432 $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'));
1434 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1439print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1440if ($optioncss !=
'') {
1441 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1443print
'<input type="hidden" name="token" value="'.newToken().
'">';
1444print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1445if (!in_array($massaction, array(
'makepayment'))) {
1446 print
'<input type="hidden" name="action" value="list">';
1448print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1449print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1450print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1451print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1452print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1453print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1455print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1457$topicmail =
"SendBillRef";
1458$modelmail =
"facture_send";
1460$trackid =
'inv'.$object->id;
1461include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1463if ($massaction ==
'makepayment') {
1465 $formquestion = array(
1469 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1470 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1471 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1474 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1479 foreach ($fieldstosearchall as $key => $val) {
1480 $fieldstosearchall[$key] = $langs->trans($val);
1482 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1488if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1490 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1493if ($user->hasRight(
"user",
"user",
"lire")) {
1494 $langs->load(
"commercial");
1495 $moreforfilter .=
'<div class="divsearchfield">';
1496 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1497 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1498 $moreforfilter .=
'</div>';
1501if ($user->hasRight(
"user",
"user",
"lire")) {
1502 $moreforfilter .=
'<div class="divsearchfield">';
1503 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1504 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1505 $moreforfilter .=
'</div>';
1508if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1509 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1510 $moreforfilter .=
'<div class="divsearchfield">';
1511 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1512 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1513 $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);
1514 $moreforfilter .=
'</div>';
1516if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1517 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1518 $moreforfilter .=
'<div class="divsearchfield">';
1519 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1520 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1521 $moreforfilter .=
'</div>';
1524$moreforfilter .=
'<div class="divsearchfield">';
1525$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1526$moreforfilter .=
'</div>';
1528$parameters = array();
1529$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1530if (empty($reshook)) {
1531 $moreforfilter .= $hookmanager->resPrint;
1533 $moreforfilter = $hookmanager->resPrint;
1536if (!empty($moreforfilter)) {
1537 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1538 print $moreforfilter;
1542$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1543$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1546if ($massactionbutton && $contextpage !=
'poslist') {
1547 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1550print
'<div class="div-table-responsive">';
1551print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1555print
'<tr class="liste_titre_filter">';
1559 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1560 $searchpicto = $form->showFilterButtons(
'left');
1566 print
'<td class="liste_titre">';
1570if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1571 print
'<td class="liste_titre">';
1572 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1576if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1578 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1582if (!empty($arrayfields[
'f.type'][
'checked'])) {
1583 print
'<td class="liste_titre maxwidthonsmartphone">';
1595 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1599if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1600 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1601 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1605if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1606 print
'<td class="liste_titre center">';
1607 print
'<div class="nowrapfordate">';
1608 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1610 print
'<div class="nowrapfordate">';
1611 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1616if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1617 print
'<td class="liste_titre center">';
1618 print
'<div class="nowrapfordate">';
1619 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'));
1621 print
'<div class="nowrapfordate">';
1622 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'));
1627if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1628 print
'<td class="liste_titre center">';
1629 print
'<div class="nowrapfordate">';
1630 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1632 print
'<div class="nowrapfordate">';
1633 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1638if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1639 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1642if (!empty($arrayfields[
'p.title'][
'checked'])) {
1643 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1646if (!empty($arrayfields[
's.nom'][
'checked'])) {
1647 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>';
1650if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1651 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1654if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1655 print
'<td class="liste_titre">';
1656 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1660if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1661 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1664if (!empty($arrayfields[
's.town'][
'checked'])) {
1665 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1668if (!empty($arrayfields[
's.zip'][
'checked'])) {
1669 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1672if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1673 print
'<td class="liste_titre">';
1674 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1678if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1679 print
'<td class="liste_titre center">';
1680 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1684if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1685 print
'<td class="liste_titre maxwidthonsmartphone center">';
1686 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);
1690if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1691 print
'<td class="liste_titre">';
1692 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1696if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1697 print
'<td class="liste_titre left">';
1698 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1702if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1703 print
'<td class="liste_titre">';
1704 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1708if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1709 print
'<td class="liste_titre">';
1710 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1714if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1715 print
'<td class="liste_titre">';
1716 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1719if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1721 print
'<td class="liste_titre right">';
1722 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1725if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1727 print
'<td class="liste_titre right">';
1728 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1731if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1733 print
'<td class="liste_titre right">';
1734 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1737if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1739 print
'<td class="liste_titre right">';
1740 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1743if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1745 print
'<td class="liste_titre right">';
1746 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1749if (!empty($arrayfields[
'u.login'][
'checked'])) {
1751 print
'<td class="liste_titre" align="center">';
1752 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1755if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1756 print
'<td class="liste_titre"></td>';
1758if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1759 print
'<td class="liste_titre" align="right">';
1762if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1763 print
'<td class="liste_titre right">';
1766if (!empty($arrayfields[
'rtp'][
'checked'])) {
1767 print
'<td class="liste_titre">';
1770if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1772 print
'<td class="liste_titre">';
1773 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1776if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1778 print
'<td class="liste_titre">';
1779 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1782if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1784 print
'<td class="liste_titre right">';
1785 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1788if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1790 print
'<td class="liste_titre right">';
1791 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1794if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1796 print
'<td class="liste_titre right">';
1797 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1800if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1801 print
'<td class="liste_titre">';
1804if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1805 print
'<td class="liste_titre right">';
1808if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1809 print
'<td class="liste_titre right">';
1812if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1813 print
'<td class="liste_titre right">';
1816if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1817 print
'<td class="liste_titre right">';
1820if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1821 print
'<td class="liste_titre right">';
1826include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1829$parameters = array(
'arrayfields' => $arrayfields);
1830$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1831print $hookmanager->resPrint;
1833if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1834 print
'<td class="liste_titre center">';
1835 print
'<div class="nowrapfordate">';
1836 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1838 print
'<div class="nowrapfordate">';
1839 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1844if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1845 print
'<td class="liste_titre center">';
1846 print
'<div class="nowrapfordate">';
1847 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1849 print
'<div class="nowrapfordate">';
1850 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1855if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1856 print
'<td class="liste_titre">';
1859if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1861 print
'<td class="liste_titre">';
1864if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1866 print
'<td class="liste_titre">';
1869if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1871 print
'<td class="liste_titre maxwidthonsmartphone right">';
1872 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).
'">';
1876if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1877 print
'<td class="liste_titre maxwidthonsmartphone center">';
1878 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1882if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1883 print
'<td class="liste_titre center parentonrightofpage">';
1884 $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"));
1886 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1891 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1892 $searchpicto = $form->showFilterButtons();
1903print
'<tr class="liste_titre">';
1905 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1912if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1913 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1916if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1917 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1920if (!empty($arrayfields[
'f.type'][
'checked'])) {
1921 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1924if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1925 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1927if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1931if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1932 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1935if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1939if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1940 $langs->load(
"projects");
1941 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1944if (!empty($arrayfields[
'p.title'][
'checked'])) {
1945 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1948if (!empty($arrayfields[
's.nom'][
'checked'])) {
1949 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1952if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1954 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1957if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1958 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1961if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1962 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1965if (!empty($arrayfields[
's.town'][
'checked'])) {
1966 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1969if (!empty($arrayfields[
's.zip'][
'checked'])) {
1970 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1973if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1974 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1977if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1978 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1981if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1982 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1985if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1986 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1989if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1990 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1993if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1994 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
1996if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1997 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2000if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2001 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2004if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2005 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2008if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2009 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2012if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2013 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2016if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2017 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2020if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2021 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2024if (!empty($arrayfields[
'u.login'][
'checked'])) {
2025 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2028if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2032if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2036if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2040if (!empty($arrayfields[
'rtp'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2044if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2048if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2052if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2053 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2056if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2057 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2060if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2061 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2064if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2065 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2068if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2069 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2072if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2073 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2076if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2077 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2080if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2081 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2084if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2085 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2089include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2091$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2092$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2093print $hookmanager->resPrint;
2094if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2095 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2098if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2099 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2102if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2103 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2106if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2107 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2110if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2111 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2114if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2115 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2119if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2120 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2124if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2125 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2129 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2135$projectstatic =
new Project($db);
2137$userstatic =
new User($db);
2155 $typenArray = $formcompany->typent_array(1);
2157 $with_margin_info =
false;
2158 if (isModEnabled(
'margin') && (
2159 !empty($arrayfields[
'total_pa'][
'checked'])
2160 || !empty($arrayfields[
'total_margin'][
'checked'])
2161 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2162 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2165 $with_margin_info =
true;
2170 $imaxinloop = ($limit ? min($num, $limit) : $num);
2171 while ($i < $imaxinloop) {
2172 $obj = $db->fetch_object($resql);
2174 $datelimit = $db->jdate($obj->datelimite);
2176 $facturestatic->id = $obj->id;
2177 $facturestatic->ref = $obj->ref;
2178 $facturestatic->ref_client = $obj->ref_client;
2179 $facturestatic->ref_customer = $obj->ref_client;
2180 $facturestatic->type = $obj->type;
2181 $facturestatic->subtype = $obj->subtype;
2182 $facturestatic->total_ht = $obj->total_ht;
2183 $facturestatic->total_tva = $obj->total_tva;
2184 $facturestatic->total_ttc = $obj->total_ttc;
2185 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2186 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2187 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2188 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2189 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2190 $facturestatic->statut = $obj->fk_statut;
2191 $facturestatic->status = $obj->fk_statut;
2192 $facturestatic->close_code = $obj->close_code;
2193 $facturestatic->total_ttc = $obj->total_ttc;
2194 $facturestatic->paye = $obj->paye;
2195 $facturestatic->socid = $obj->fk_soc;
2197 $facturestatic->date = $db->jdate($obj->datef);
2198 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2199 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2201 $facturestatic->note_public = $obj->note_public;
2202 $facturestatic->note_private = $obj->note_private;
2205 $facturestatic->retained_warranty = $obj->retained_warranty;
2206 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2207 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2208 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2209 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2210 $facturestatic->situation_counter = $obj->situation_counter;
2213 $companystatic->id = $obj->socid;
2214 $companystatic->name = $obj->name;
2215 $companystatic->name_alias = $obj->alias;
2216 $companystatic->client = $obj->client;
2217 $companystatic->fournisseur = $obj->fournisseur;
2218 $companystatic->code_client = $obj->code_client;
2219 $companystatic->code_compta_client = $obj->code_compta_client;
2220 $companystatic->code_fournisseur = $obj->code_fournisseur;
2221 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2222 $companystatic->email = $obj->email;
2223 $companystatic->phone = $obj->phone;
2224 $companystatic->fax = $obj->fax;
2225 $companystatic->address = $obj->address;
2226 $companystatic->zip = $obj->zip;
2227 $companystatic->town = $obj->town;
2228 $companystatic->country_code = $obj->country_code;
2230 $projectstatic->id = $obj->project_id;
2231 $projectstatic->ref = $obj->project_ref;
2232 $projectstatic->title = $obj->project_label;
2234 $paiement = $facturestatic->getSommePaiement();
2235 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2236 $totaldeposits = $facturestatic->getSumDepositsUsed();
2237 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2238 $remaintopay = $obj->total_ttc - $totalallpayments;
2240 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2241 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2242 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2244 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2245 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2247 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2248 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2252 $multicurrency_remaintopay = 0;
2255 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2256 $remaintopay = -$remaincreditnote;
2257 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2258 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2259 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2260 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2263 $facturestatic->alreadypaid = $paiement;
2264 $facturestatic->totalpaid = $paiement;
2265 $facturestatic->totalcreditnotes = $totalcreditnotes;
2266 $facturestatic->totaldeposits = $totaldeposits;
2268 $marginInfo = array();
2269 if ($with_margin_info) {
2270 $facturestatic->fetch_lines();
2271 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2272 $total_ht += $obj->total_ht;
2273 $total_margin += $marginInfo[
'total_margin'];
2278 if ($mode ==
'kanban') {
2280 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2281 print
'<div class="box-flex-container kanban">';
2284 if ($massactionbutton || $massaction) {
2286 if (in_array(
$object->id, $arrayofselected)) {
2291 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2292 print $facturestatic->getKanbanView(
'', $arraydata);
2293 if ($i == ($imaxinloop - 1)) {
2300 print
'<tr data-rowid="'.$object->id.
'" class="oddeven status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2301 if ($contextpage ==
'poslist') {
2302 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2303 if (strpos($obj->ref, 'PROV
') !== false) {
2304 //If is a draft invoice, load var to be able to add products
2305 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2306 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2314 print
'<td class="nowrap center">';
2315 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2317 if (in_array($obj->id, $arrayofselected)) {
2320 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2330 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2337 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2338 print
'<td class="nowraponall">';
2340 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2342 print
'<td class="nobordernopadding nowraponall">';
2343 if ($contextpage ==
'poslist') {
2346 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2350 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2351 $filedir = $filepath.
'/'.$filename;
2353 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2354 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2366 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2367 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2368 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2377 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2378 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2379 print $facturestatic->getLibType(2);
2387 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2389 if ($facturestatic->subtype > 0) {
2390 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2392 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2401 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2402 print
'<td align="center" class="nowraponall">';
2411 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2412 print
'<td align="center" class="nowraponall">';
2421 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2422 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2423 if ($facturestatic->hasDelay()) {
2424 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2433 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2434 print
'<td class="nocellnopadd nowraponall">';
2435 if ($obj->project_id > 0) {
2436 print $projectstatic->getNomUrl(1);
2445 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2446 print
'<td class="nowraponall">';
2447 if ($obj->project_id > 0) {
2457 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2458 print
'<td class="tdoverflowmax150">';
2459 if ($contextpage ==
'poslist') {
2462 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2470 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2471 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2479 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2480 print
'<td class="tdoverflowmax200">';
2481 if ($obj->fk_parent > 0) {
2482 if (!isset($company_url_list[$obj->fk_parent])) {
2483 $companyparent =
new Societe($db);
2484 $res = $companyparent->fetch($obj->fk_parent);
2486 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2489 if (isset($company_url_list[$obj->fk_parent])) {
2490 print $company_url_list[$obj->fk_parent];
2499 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2500 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2508 if (!empty($arrayfields[
's.town'][
'checked'])) {
2509 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2517 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2518 print
'<td class="nowraponall">';
2526 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2527 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2533 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2534 $tmparray =
getCountry($obj->fk_pays,
'all');
2535 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2543 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2544 if (!is_array($typenArray) || count($typenArray) == 0) {
2545 $typenArray = $formcompany->typent_array(1);
2547 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2548 if (!empty($obj->typent_code)) {
2549 print $typenArray[$obj->typent_code];
2557 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2558 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2559 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2561 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2562 print
$conf->cache[
'staff'][$obj->staff_code];
2570 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2571 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2572 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2581 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2582 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2583 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2592 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2594 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2602 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2611 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2621 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2622 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2629 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2632 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2633 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2640 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2643 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2644 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2651 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2654 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2655 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2662 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2665 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2666 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2673 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2676 $userstatic->id = $obj->fk_user_author;
2677 $userstatic->login = $obj->login;
2678 $userstatic->lastname = $obj->lastname;
2679 $userstatic->firstname = $obj->firstname;
2680 $userstatic->email = $obj->user_email;
2681 $userstatic->status = $obj->user_statut;
2682 $userstatic->entity = $obj->entity;
2683 $userstatic->photo = $obj->photo;
2684 $userstatic->office_phone = $obj->office_phone;
2685 $userstatic->office_fax = $obj->office_fax;
2686 $userstatic->user_mobile = $obj->user_mobile;
2687 $userstatic->job = $obj->job;
2688 $userstatic->gender = $obj->gender;
2691 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2692 print
'<td class="tdoverflowmax125">';
2693 if ($userstatic->id) {
2694 print $userstatic->getNomUrl(-1);
2704 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2707 if ($obj->socid > 0) {
2708 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2709 if ($listsalesrepresentatives < 0) {
2712 $nbofsalesrepresentative = count($listsalesrepresentatives);
2713 if ($nbofsalesrepresentative > 6) {
2715 print $nbofsalesrepresentative;
2716 } elseif ($nbofsalesrepresentative > 0) {
2718 foreach ($listsalesrepresentatives as $val) {
2719 $userstatic->id = $val[
'id'];
2720 $userstatic->lastname = $val[
'lastname'];
2721 $userstatic->firstname = $val[
'firstname'];
2722 $userstatic->email = $val[
'email'];
2723 $userstatic->status = $val[
'statut'];
2724 $userstatic->entity = $val[
'entity'];
2725 $userstatic->photo = $val[
'photo'];
2726 $userstatic->login = $val[
'login'];
2727 $userstatic->office_phone = $val[
'office_phone'];
2728 $userstatic->office_fax = $val[
'office_fax'];
2729 $userstatic->user_mobile = $val[
'user_mobile'];
2730 $userstatic->job = $val[
'job'];
2731 $userstatic->gender = $val[
'gender'];
2733 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2735 if ($j < $nbofsalesrepresentative) {
2749 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2750 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2756 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2757 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2764 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2768 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2769 print
'<td class="right nowraponall amount">';
2770 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2783 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2784 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2785 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2786 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2788 $title = $obj->multicurrency_code;
2789 $label = $obj->multicurrency_code;
2791 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2800 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2801 print
'<td class="nowraponall">';
2802 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2809 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2810 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2816 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2817 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2823 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2824 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2830 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2831 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2838 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2839 print
'<td class="right nowraponall amount">';
2840 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2848 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2849 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2854 if (empty($totalarray[
'val'][
'total_pa'])) {
2857 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2860 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2861 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2866 if (empty($totalarray[
'val'][
'total_margin'])) {
2869 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2872 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2873 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2879 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2880 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2885 if ($i >= $imaxinloop - 1) {
2886 if (!empty($total_ht)) {
2895 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2897 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2898 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2899 print $hookmanager->resPrint;
2901 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2902 print
'<td class="nowraponall center">';
2903 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
2910 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2911 print
'<td class="nowraponall center">';
2912 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
2919 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2920 print
'<td class="nowraponall center">';
2921 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuserrel');
2928 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2929 print
'<td class="sensiblehtmlcontent center">';
2930 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2937 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2938 print
'<td class="sensiblehtmlcontent center">';
2939 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2946 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2947 print
'<td class="center">';
2948 if (!empty($obj->fk_fac_rec_source)) {
2950 $result = $facrec->fetch($obj->fk_fac_rec_source);
2954 print $facrec->getNomUrl();
2964 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2965 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2972 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2973 print
'<td class="nowrap center">';
2974 print $facturestatic->getLibStatut(5, $totalallpayments);
2984 print
'<td class="nowrap center">';
2985 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2987 if (in_array($obj->id, $arrayofselected)) {
2990 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3005 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
3006 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
3009 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3015 foreach ($arrayfields as $key => $val) {
3016 if (!empty($val[
'checked'])) {
3020 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3025$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3026$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3027print $hookmanager->resPrint;
3029print
'</table>'.
"\n";
3032print
'</form>'.
"\n";
3035if ($contextpage !=
'poslist') {
3036 $hidegeneratedfilelistifempty = 1;
3037 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3038 $hidegeneratedfilelistifempty = 0;
3042 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3043 $urlsource .= str_replace(
'&',
'&', $param);
3045 $filedir = $diroutputmassaction;
3046 $genallowed = $user->hasRight(
"facture",
"lire");
3047 $delallowed = $user->hasRight(
"facture",
"creer");
3050 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.