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),
303 unset($arrayfields[
'f.note_private']);
306 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' =>
'0',
'position' => 86);
309$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
310if (empty($subtypearray)) {
311 unset($arrayfields[
'f.subtype']);
315foreach (
$object->fields as $key => $val) {
318 if (!empty($val[
'visible'])) {
319 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
321 if (array_key_exists($key, $arrayfields)) {
323 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
325 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
329 $arrayfields[$newkey] = array(
330 'label' => $val[
'label'],
331 'checked' => (($visible < 0) ?
'0' :
'1'),
332 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
333 'position' => $val[
'position'],
334 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
340include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
342$parameters = array(
'arrayfields' => &$arrayfields);
343$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
344$sql .= $hookmanager->resPrint;
350if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
351 $search_sale = $user->id;
355$fieldid = (!empty($ref) ?
'ref' :
'rowid');
356if (!empty($user->socid)) {
357 $socid = $user->socid;
359if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
360 $search_sale = $user->id;
370if (
GETPOST(
'cancel',
'alpha')) {
374if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
378$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
379$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
384include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
387if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
390 $search_product_category =
'';
391 $searchCategoryInvoiceList = array();
393 $search_refcustomer =
'';
395 $search_subtype =
'';
396 $search_project_ref =
'';
397 $search_project =
'';
398 $search_company =
'';
399 $search_company_alias =
'';
400 $search_parent_name =
'';
401 $search_montant_ht =
'';
402 $search_montant_vat =
'';
403 $search_montant_localtax1 =
'';
404 $search_montant_localtax2 =
'';
405 $search_montant_ttc =
'';
407 $search_multicurrency_code =
'';
408 $search_multicurrency_tx =
'';
409 $search_multicurrency_montant_ht =
'';
410 $search_multicurrency_montant_vat =
'';
411 $search_multicurrency_montant_ttc =
'';
413 $search_paymentmode =
'';
414 $search_paymentterms =
'';
415 $search_fk_input_reason =
'';
416 $search_module_source =
'';
417 $search_pos_source =
'';
421 $search_country =
'';
422 $search_type_thirdparty =
'';
423 $search_customer_code =
'';
424 $search_date_startday =
'';
425 $search_date_startmonth =
'';
426 $search_date_startyear =
'';
427 $search_date_endday =
'';
428 $search_date_endmonth =
'';
429 $search_date_endyear =
'';
430 $search_date_start =
'';
431 $search_date_end =
'';
432 $search_date_valid_startday =
'';
433 $search_date_valid_startmonth =
'';
434 $search_date_valid_startyear =
'';
435 $search_date_valid_endday =
'';
436 $search_date_valid_endmonth =
'';
437 $search_date_valid_endyear =
'';
438 $search_date_valid_start =
'';
439 $search_date_valid_end =
'';
440 $search_datelimit_startday =
'';
441 $search_datelimit_startmonth =
'';
442 $search_datelimit_startyear =
'';
443 $search_datelimit_endday =
'';
444 $search_datelimit_endmonth =
'';
445 $search_datelimit_endyear =
'';
446 $search_datelimit_start =
'';
447 $search_datelimit_end =
'';
449 $search_datec_start =
'';
450 $search_datec_end =
'';
452 $search_datem_start =
'';
453 $search_datem_end =
'';
455 $search_fac_rec_source_title =
'';
457 $search_import_key =
'';
458 $search_categ_cus = 0;
462 $search_array_options = array();
465if (empty($reshook)) {
466 $objectclass =
'Facture';
467 $objectlabel =
'Invoices';
468 $permissiontoread = $user->hasRight(
"facture",
"lire");
469 $permissiontoadd = $user->hasRight(
"facture",
"creer");
470 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
471 $uploaddir =
$conf->invoice->dir_output;
472 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
475if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
476 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
477 $arrayofselected = is_array($toselect) ? $toselect : array();
478 if (!empty($arrayofselected)) {
482 if (empty($paiementdate)) {
483 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
485 $action =
'makepayment';
489 foreach ($arrayofselected as $toselectid) {
492 $result = $facture->fetch($toselectid);
502 $sommePaiement = $facture->getSommePaiement(-1);
503 $paiementAmount = $sommePaiement[
'alreadypaid'];
505 $totalcreditnotes = $facture->getSumCreditNotesUsed();
506 $totaldeposits = $facture->getSumDepositsUsed();
508 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
509 $remaintopay = (float)
price2num($facture->total_ttc - $totalallpayments);
512 $parameters = array(
'remaintopay' => $remaintopay);
513 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
515 if (!empty($remain = (
float) $hookmanager->resArray[
'remaintopay'])) {
516 $remaintopay = $remain;
518 } elseif ($reshook < 0) {
520 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
524 $multicurrency_remaintopay = (float)
price2num($facture->multicurrency_total_ttc - $sommePaiement[
'alreadypaid_multicurrency']);
526 if ($remaintopay != 0) {
527 $resultBank = $facture->setBankAccount($bankid);
528 if ($resultBank < 0) {
533 $paiement->datepaye = $paiementdate;
534 $paiement->amounts[$facture->id] = $remaintopay;
535 $paiement->multicurrency_amounts[$facture->id] = (float) $multicurrency_remaintopay;
536 $paiement->paiementid = $paiementid;
537 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
538 if ($paiement_id < 0) {
539 $langs->load(
"errors");
540 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
543 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
545 $langs->load(
"errors");
546 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
552 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
556 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
561 if (empty($errorpayment)) {
562 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
570} elseif ($massaction ==
'withdrawrequest') {
571 $langs->load(
"withdrawals");
573 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
580 $arrayofselected = is_array($toselect) ? $toselect : array();
581 $listofbills = array();
582 foreach ($arrayofselected as $toselectid) {
584 $result = $objecttmp->fetch($toselectid);
586 $totalpaid = $objecttmp->getSommePaiement();
587 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
588 $totaldeposits = $objecttmp->getSumDepositsUsed();
589 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
592 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
593 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
595 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
596 $objecttmp->resteapayer = $remaintopay;
598 } elseif ($reshook < 0) {
600 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
605 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
606 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
608 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
609 } elseif ($objecttmp->resteapayer < 0) {
611 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
614 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
615 $rsql .=
" , pfd.date_traite as date_traite";
616 $rsql .=
" , pfd.amount";
617 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
618 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
619 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
620 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
621 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
622 $rsql .=
" AND pfd.traite = 0";
623 $rsql .=
" ORDER BY pfd.date_demande DESC";
625 $result_sql = $db->query($rsql);
627 $numprlv = $db->num_rows($result_sql);
634 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
635 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
636 $langs->load(
"errors");
638 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotDirectDebit"), $objecttmp->errors,
'errors');
640 $listofbills[] = $objecttmp;
646 if (!empty($listofbills)) {
647 $nbwithdrawrequestok = 0;
648 foreach ($listofbills as $aBill) {
655 $sql =
"SELECT SUM(pfd.amount) as amount";
656 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
660 $sql .=
" WHERE pfd.fk_facture = ".((int) $aBill->id);
662 $sql .=
" AND pfd.traite = 0";
664 $resql = $db->query($sql);
666 $obj = $db->fetch_object($resql);
668 $pending += (float) $obj->amount;
674 $sqlPending =
"SELECT SUM(pl.amount) as amount";
675 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
676 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
680 $sqlPending .=
" WHERE p.fk_facture = ".((int) $aBill->id);
682 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
683 $resPending = $db->query($sqlPending);
685 if ($objPending = $db->fetch_object($resPending)) {
686 $pending += (float) $objPending->amount;
689 $db->free($resPending);
691 $requestAmount = $aBill->resteapayer - $pending;
694 $result = $aBill->demande_prelevement($user, $requestAmount,
'direct-debit',
'facture');
695 if ($requestAmount > 0) {
698 $nbwithdrawrequestok++;
704 $aBill->error =
'WithdrawRequestErrorNilAmount';
705 $aBill->errors[] = $aBill->error;
709 if ($nbwithdrawrequestok > 0) {
710 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
722$form =
new Form($db);
726$facturestatic =
new Facture($db);
728$companystatic =
new Societe($db);
729$companyparent =
new Societe($db);
731$company_url_list = array();
736 if (empty($search_company)) {
737 $search_company = $soc->name;
743$title = $langs->trans(
'BillsCustomers').
' '.(($socid > 0 && $soc !==
null) ?
' - '.$soc->name :
'');
744$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
746$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
747$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
753 $sql =
'SELECT DISTINCT';
755$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,';
756$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
757$sql .=
' f.fk_user_author,';
758$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,';
759$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite,';
760$sql .=
" f.fk_input_reason,";
761$sql .=
" f.module_source, f.pos_source,";
762$sql .=
' f.paye as paye, f.fk_statut, f.import_key, f.close_code,';
763$sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
764$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
765$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,';
766$sql .=
" s.parent as fk_parent,";
767$sql .=
" s2.nom as name2,";
768$sql .=
' typent.code as typent_code,';
769$sql .=
' state.code_departement as state_code, state.nom as state_name,';
770$sql .=
' country.code as country_code,';
771$sql .=
' f.fk_fac_rec_source,';
772$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
773$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';
783if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
784 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
785 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
789$parameters = array();
790$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
791$sql .= $hookmanager->resPrint;
792$sql = preg_replace(
'/,\s*$/',
'', $sql);
796$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
797$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
798$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
799$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
800$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
801$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
802if ($sortfield ==
"f.datef") {
803 $sql .= $db->hintindex(
'idx_facture_datef');
805if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
806 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
809 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
811if (!empty($search_fac_rec_source_title)) {
812 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
814$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
815$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
817$parameters = array();
818$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
819$sql .= $hookmanager->resPrint;
821$sql .=
' WHERE f.fk_soc = s.rowid';
822$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
824 $sql .=
' AND s.rowid = '.((int) $socid);
828 $sql .=
' AND f.fk_user_author IS NULL';
830 $sql .=
' AND f.fk_user_author = '.((int) $userid);
836if ($search_refcustomer) {
839if ($search_type !=
'' && $search_type !=
'-1') {
840 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
842if ($search_subtype !=
'' && $search_subtype !=
'-1') {
843 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
845if ($search_project_ref) {
848if ($search_project) {
851if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
852 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
854 if ($search_company) {
857 if ($search_company_alias) {
861if ($search_parent_name) {
864if ($search_customer_code) {
876if (strlen(trim($search_country))) {
878 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
879 foreach ($arrayofcode as $key => $value) {
880 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
881 if ($value != $mysoc->country_code) {
882 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
885 if ($search_country ==
'special_allnotme') {
886 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
887 } elseif ($search_country ==
'special_eec') {
888 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
889 } elseif ($search_country ==
'special_eecnotme') {
890 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
891 } elseif ($search_country ==
'special_noteec') {
892 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
897if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
898 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
900if ($search_montant_ht !=
'') {
903if ($search_montant_vat !=
'') {
906if ($search_montant_localtax1 !=
'') {
907 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
909if ($search_montant_localtax2 !=
'') {
910 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
912if ($search_montant_ttc !=
'') {
915if ($search_multicurrency_code !=
'') {
916 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
918if ($search_multicurrency_tx !=
'') {
919 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
921if ($search_multicurrency_montant_ht !=
'') {
922 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
924if ($search_multicurrency_montant_vat !=
'') {
925 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
927if ($search_multicurrency_montant_ttc !=
'') {
928 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
931 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
933if ($search_status !=
'-1' && $search_status !=
'') {
934 if (is_numeric($search_status) && $search_status >= 0) {
935 if ($search_status ==
'0') {
936 $sql .=
" AND f.fk_statut = 0";
938 if ($search_status ==
'1') {
939 $sql .=
" AND f.fk_statut = 1";
941 if ($search_status ==
'2') {
942 $sql .=
" AND f.fk_statut = 2";
944 if ($search_status ==
'3') {
945 $sql .=
" AND f.fk_statut = 3";
948 $sql .=
" AND f.fk_statut IN (".$db->sanitize($search_status).
")";
952if ($search_paymentmode > 0) {
953 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
955if ($search_paymentterms > 0) {
956 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
958if ($search_fk_input_reason > 0) {
959 $sql .=
" AND f.fk_input_reason = ".((int) $search_fk_input_reason);
961if ($search_module_source) {
964if ($search_pos_source) {
967if ($search_date_start) {
968 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
970if ($search_date_end) {
971 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
973if ($search_date_valid_start) {
974 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
976if ($search_date_valid_end) {
977 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
979if ($search_datelimit_start) {
980 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
982if ($search_datelimit_end) {
983 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
985if ($search_datec_start) {
986 $sql .=
" AND f.datec >= '".$db->idate($search_datec_start).
"'";
988if ($search_datec_end) {
989 $sql .=
" AND f.datec <= '".$db->idate($search_datec_end).
"'";
991if ($search_datem_start) {
992 $sql .=
" AND f.tms >= '".$db->idate($search_datem_start).
"'";
994if ($search_datem_end) {
995 $sql .=
" AND f.tms <= '".$db->idate($search_datem_end).
"'";
997if ($search_option ==
'late') {
998 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->invoice->client->warning_delay).
"'";
1003if (!empty($search_fac_rec_source_title)) {
1004 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
1006if ($search_fk_fac_rec_source) {
1007 $sql .=
' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
1009if ($search_import_key) {
1013if ($search_user > 0) {
1014 $sql .=
" AND EXISTS (";
1015 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1016 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1017 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1018 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'facture' AND tc.source = 'internal'";
1019 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1022if ($search_sale && $search_sale !=
'-1') {
1023 if ($search_sale == -2) {
1024 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
1025 } elseif ($search_sale > 0) {
1026 $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).
")";
1031if (!empty($searchCategoryInvoiceList)) {
1032 $searchCategoryInvoiceSqlList = array();
1033 $listofcategoryid =
'';
1034 foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1035 if (intval($searchCategoryInvoice) == -2) {
1036 $searchCategoryInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_invoice FROM ".MAIN_DB_PREFIX.
"categorie_invoice as ck WHERE f.rowid = ck.fk_invoice)";
1037 } elseif (intval($searchCategoryInvoice) > 0) {
1038 if ($searchCategoryInvoiceOperator == 0) {
1039 $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).
")";
1041 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryInvoice);
1045 if ($listofcategoryid) {
1046 $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).
"))";
1048 if ($searchCategoryInvoiceOperator == 1) {
1049 if (!empty($searchCategoryInvoiceSqlList)) {
1050 $sql .=
" AND (".implode(
' OR ', $searchCategoryInvoiceSqlList).
")";
1053 if (!empty($searchCategoryInvoiceSqlList)) {
1054 $sql .=
" AND (".implode(
' AND ', $searchCategoryInvoiceSqlList).
")";
1060$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
1061$searchCategoryProductOperator = 0;
1062if (!empty($searchCategoryProductList)) {
1063 $searchCategoryProductSqlList = array();
1064 $listofcategoryid =
'';
1065 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1066 if (intval($searchCategoryProduct) == -2) {
1067 $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)";
1068 } elseif (intval($searchCategoryProduct) > 0) {
1069 if ($searchCategoryProductOperator == 0) {
1070 $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).
")";
1072 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1076 if ($listofcategoryid) {
1077 $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).
"))";
1079 if ($searchCategoryProductOperator == 1) {
1080 if (!empty($searchCategoryProductSqlList)) {
1081 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1084 if (!empty($searchCategoryProductSqlList)) {
1085 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1089$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
1090$searchCategoryCustomerOperator = 0;
1092if (!empty($searchCategoryCustomerList)) {
1093 $searchCategoryCustomerSqlList = array();
1094 $listofcategoryid =
'';
1095 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1096 if (intval($searchCategoryCustomer) == -2) {
1097 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
1098 } elseif (intval($searchCategoryCustomer) > 0) {
1099 if ($searchCategoryCustomerOperator == 0) {
1100 $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).
")";
1102 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1106 if ($listofcategoryid) {
1107 $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).
"))";
1109 if ($searchCategoryCustomerOperator == 1) {
1110 if (!empty($searchCategoryCustomerSqlList)) {
1111 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1114 if (!empty($searchCategoryCustomerSqlList)) {
1115 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1120include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1122$parameters = array();
1123$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1124$sql .= $hookmanager->resPrint;
1127 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
1131$parameters = array();
1132$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1133$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1136$nbtotalofrecords =
'';
1139 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1140 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1142 $resql = $db->query($sqlforcount);
1144 $objforcount = $db->fetch_object($resql);
1145 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1150 if (($page * $limit) > $nbtotalofrecords) {
1158$sql .= $db->order($sortfield, $sortorder);
1160 $sql .= $db->plimit($limit + 1, $offset);
1163$resql = $db->query($sql);
1169$num = $db->num_rows($resql);
1171$arrayofselected = is_array($toselect) ? $toselect : array();
1173if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1174 $obj = $db->fetch_object($resql);
1177 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$id);
1184llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist'.($contextpage ==
'poslist' ?
' '.$contextpage :
''));
1186if ($search_fk_fac_rec_source) {
1188 $object->fetch((
int) $search_fk_fac_rec_source);
1192 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
1197 $param .=
'&mode='.urlencode($mode);
1199if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1200 $param .=
'&contextpage='.urlencode($contextpage);
1202if ($limit > 0 && $limit !=
$conf->liste_limit) {
1203 $param .=
'&limit='.((int) $limit);
1205if ($optioncss !=
'') {
1206 $param .=
'&optioncss='.urlencode($optioncss);
1209 $param .=
'&show_files='.urlencode((
string) ($show_files));
1212 $param .=
'&search_all='.urlencode($search_all);
1215 $param .=
'&socid='.((int) $socid);
1217if ($search_date_startday) {
1218 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1220if ($search_date_startmonth) {
1221 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1223if ($search_date_startyear) {
1224 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1226if ($search_date_endday) {
1227 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1229if ($search_date_endmonth) {
1230 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1232if ($search_date_endyear) {
1233 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1235if ($search_date_valid_startday) {
1236 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1238if ($search_date_valid_startmonth) {
1239 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1241if ($search_date_valid_startyear) {
1242 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1244if ($search_date_valid_endday) {
1245 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1247if ($search_date_valid_endmonth) {
1248 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1250if ($search_date_valid_endyear) {
1251 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1253if ($search_datelimit_startday) {
1254 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1256if ($search_datelimit_startmonth) {
1257 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1259if ($search_datelimit_startyear) {
1260 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1262if ($search_datelimit_endday) {
1263 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1265if ($search_datelimit_endmonth) {
1266 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1268if ($search_datelimit_endyear) {
1269 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1272 $param .=
'&search_ref='.urlencode($search_ref);
1274if ($search_refcustomer) {
1275 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1277if ($search_project_ref) {
1278 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1280if ($search_project) {
1281 $param .=
'&search_project='.urlencode($search_project);
1283if ($search_type !=
'') {
1284 $param .=
'&search_type='.urlencode($search_type);
1286if ($search_subtype !=
'') {
1287 $param .=
'&search_subtype='.urlencode($search_subtype);
1289if ($search_company) {
1290 $param .=
'&search_company='.urlencode($search_company);
1292if ($search_company_alias) {
1293 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1295if ($search_parent_name !=
'') {
1296 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1299 $param .=
'&search_town='.urlencode($search_town);
1302 $param .=
'&search_zip='.urlencode($search_zip);
1304if ($search_country) {
1305 $param .=
"&search_country=".urlencode($search_country);
1307if ($search_type_thirdparty !=
'') {
1308 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1310if ($search_customer_code) {
1311 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1313if ($search_sale > 0) {
1314 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1316if ($search_user > 0) {
1317 $param .=
'&search_user='.urlencode((
string) $search_user);
1320 $param .=
'&search_login='.urlencode($search_login);
1322if ($searchCategoryInvoiceOperator == 1) {
1323 $param .=
"&search_category_invoice_operator=".urlencode((
string) ($searchCategoryInvoiceOperator));
1325foreach ($searchCategoryInvoiceList as $searchCategoryInvoice) {
1326 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategoryInvoice);
1328if ($search_product_category > 0) {
1329 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1331if ($search_montant_ht !=
'') {
1332 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1334if ($search_montant_vat !=
'') {
1335 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1337if ($search_montant_localtax1 !=
'') {
1338 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1340if ($search_montant_localtax2 !=
'') {
1341 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1343if ($search_montant_ttc !=
'') {
1344 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1346if ($search_multicurrency_code !=
'') {
1347 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1349if ($search_multicurrency_tx !=
'') {
1350 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1352if ($search_multicurrency_montant_ht !=
'') {
1353 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1355if ($search_multicurrency_montant_vat !=
'') {
1356 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1358if ($search_multicurrency_montant_ttc !=
'') {
1359 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1361if ($search_status !=
'') {
1362 $param .=
'&search_status='.urlencode($search_status);
1364if ($search_paymentmode > 0) {
1365 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1367if ($search_paymentterms > 0) {
1368 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1370if ($search_fk_input_reason > 0) {
1371 $param .=
'&search_fk_input_reason='.urlencode((
string) $search_fk_input_reason);
1373if ($search_module_source) {
1374 $param .=
'&search_module_source='.urlencode($search_module_source);
1376if ($search_pos_source) {
1377 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1379if ($search_option) {
1380 $param .=
"&search_option=".urlencode($search_option);
1382if ($search_categ_cus > 0) {
1383 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1385if (!empty($search_fac_rec_source_title)) {
1386 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1388if ($search_fk_fac_rec_source) {
1389 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1391if ($search_import_key !=
'') {
1392 $param .=
'&search_import_key='.urlencode($search_import_key);
1396include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1398$parameters = array(
'param' => &$param);
1399$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1400$param .= $hookmanager->resPrint;
1402$arrayofmassactions = array(
1403 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1404 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1405 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1406 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1409if ($user->hasRight(
'facture',
'paiement')) {
1410 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1412if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1413 $langs->load(
"withdrawals");
1414 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1416if ($user->hasRight(
'facture',
'supprimer')) {
1418 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1420 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1423if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1424 $arrayofmassactions = array();
1426$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1430if ($contextpage !=
'poslist') {
1431 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1433 $url .=
'&socid='.urlencode((
string)
$object->socid);
1436 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1438 $newcardbutton =
'';
1439 $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'));
1440 $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'));
1442 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1447print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1448if ($optioncss !=
'') {
1449 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1451print
'<input type="hidden" name="token" value="'.newToken().
'">';
1452print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1453if (!in_array($massaction, array(
'makepayment'))) {
1454 print
'<input type="hidden" name="action" value="list">';
1456print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1457print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1458print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1459print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1460print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1461print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1463print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1465$topicmail =
"SendBillRef";
1466$modelmail =
"facture_send";
1468$trackid =
'inv'.$object->id;
1469include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1471if ($massaction ==
'makepayment') {
1473 $formquestion = array(
1477 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1478 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1479 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1482 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1487 foreach ($fieldstosearchall as $key => $val) {
1488 $fieldstosearchall[$key] = $langs->trans($val);
1490 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1496if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1498 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_INVOICE, $searchCategoryInvoiceList,
'minwidth300', $searchCategoryInvoiceOperator ? $searchCategoryInvoiceOperator : 0);
1501if ($user->hasRight(
"user",
"user",
"lire")) {
1502 $langs->load(
"commercial");
1503 $moreforfilter .=
'<div class="divsearchfield">';
1504 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1505 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1506 $moreforfilter .=
'</div>';
1509if ($user->hasRight(
"user",
"user",
"lire")) {
1510 $moreforfilter .=
'<div class="divsearchfield">';
1511 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1512 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
1513 $moreforfilter .=
'</div>';
1516if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1517 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1518 $moreforfilter .=
'<div class="divsearchfield">';
1519 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1520 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1521 $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);
1522 $moreforfilter .=
'</div>';
1524if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1525 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1526 $moreforfilter .=
'<div class="divsearchfield">';
1527 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1528 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1529 $moreforfilter .=
'</div>';
1532$moreforfilter .=
'<div class="divsearchfield">';
1533$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1534$moreforfilter .=
'</div>';
1536$parameters = array();
1537$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1538if (empty($reshook)) {
1539 $moreforfilter .= $hookmanager->resPrint;
1541 $moreforfilter = $hookmanager->resPrint;
1544if (!empty($moreforfilter)) {
1545 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1546 print $moreforfilter;
1550$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1551$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1554if ($massactionbutton && $contextpage !=
'poslist') {
1555 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1558print
'<div class="div-table-responsive">';
1559print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1563print
'<tr class="liste_titre_filter">';
1567 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1568 $searchpicto = $form->showFilterButtons(
'left');
1574 print
'<td class="liste_titre">';
1578if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1579 print
'<td class="liste_titre">';
1580 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1584if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1585 print
'<td class="liste_titre">';
1586 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1590if (!empty($arrayfields[
'f.type'][
'checked'])) {
1591 print
'<td class="liste_titre maxwidthonsmartphone">';
1603 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth75');
1607if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1608 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1609 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1613if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1614 print
'<td class="liste_titre center">';
1615 print
'<div class="nowrapfordate">';
1616 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1618 print
'<div class="nowrapfordate">';
1619 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1624if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1625 print
'<td class="liste_titre center">';
1626 print
'<div class="nowrapfordate">';
1627 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'));
1629 print
'<div class="nowrapfordate">';
1630 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'));
1635if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1636 print
'<td class="liste_titre center">';
1637 print
'<div class="nowrapfordate">';
1638 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1640 print
'<div class="nowrapfordate">';
1641 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1646if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1647 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1650if (!empty($arrayfields[
'p.title'][
'checked'])) {
1651 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1654if (!empty($arrayfields[
's.nom'][
'checked'])) {
1655 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>';
1658if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1659 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1662if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1663 print
'<td class="liste_titre">';
1664 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1668if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1669 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1672if (!empty($arrayfields[
's.town'][
'checked'])) {
1673 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1676if (!empty($arrayfields[
's.zip'][
'checked'])) {
1677 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1680if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1681 print
'<td class="liste_titre">';
1682 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1686if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1687 print
'<td class="liste_titre center">';
1688 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1692if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1693 print
'<td class="liste_titre maxwidthonsmartphone center">';
1694 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);
1698if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1699 print
'<td class="liste_titre">';
1700 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1704if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1705 print
'<td class="liste_titre left">';
1706 print $form->getSelectConditionsPaiements((
int) $search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1710if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
1711 print
'<td class="liste_titre">';
1712 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1716if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1717 print
'<td class="liste_titre">';
1718 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1722if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1723 print
'<td class="liste_titre">';
1724 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1727if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1729 print
'<td class="liste_titre right">';
1730 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1733if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1735 print
'<td class="liste_titre right">';
1736 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1739if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1741 print
'<td class="liste_titre right">';
1742 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1745if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1747 print
'<td class="liste_titre right">';
1748 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1751if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1753 print
'<td class="liste_titre right">';
1754 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1757if (!empty($arrayfields[
'u.login'][
'checked'])) {
1759 print
'<td class="liste_titre" align="center">';
1760 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1763if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1764 print
'<td class="liste_titre"></td>';
1766if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1767 print
'<td class="liste_titre" align="right">';
1770if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1771 print
'<td class="liste_titre right">';
1774if (!empty($arrayfields[
'rtp'][
'checked'])) {
1775 print
'<td class="liste_titre">';
1778if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1780 print
'<td class="liste_titre">';
1781 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1784if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1786 print
'<td class="liste_titre">';
1787 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1790if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1792 print
'<td class="liste_titre right">';
1793 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1796if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1798 print
'<td class="liste_titre right">';
1799 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1802if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1804 print
'<td class="liste_titre right">';
1805 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1808if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1809 print
'<td class="liste_titre">';
1812if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1813 print
'<td class="liste_titre right">';
1816if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1817 print
'<td class="liste_titre right">';
1820if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1821 print
'<td class="liste_titre right">';
1824if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1825 print
'<td class="liste_titre right">';
1828if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1829 print
'<td class="liste_titre right">';
1834include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1837$parameters = array(
'arrayfields' => $arrayfields);
1838$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1839print $hookmanager->resPrint;
1841if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1842 print
'<td class="liste_titre center">';
1843 print
'<div class="nowrapfordate">';
1844 print $form->selectDate($search_datec_start ? $search_datec_start : -1,
'search_datec_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1846 print
'<div class="nowrapfordate">';
1847 print $form->selectDate($search_datec_end ? $search_datec_end : -1,
'search_datec_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1852if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1853 print
'<td class="liste_titre center">';
1854 print
'<div class="nowrapfordate">';
1855 print $form->selectDate($search_datem_start ? $search_datem_start : -1,
'search_datem_start', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'),
'tzuserrel');
1857 print
'<div class="nowrapfordate">';
1858 print $form->selectDate($search_datem_end ? $search_datem_end : -1,
'search_datem_end', 1, 1, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'),
'tzuserrel');
1863if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1864 print
'<td class="liste_titre">';
1867if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1869 print
'<td class="liste_titre">';
1872if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1874 print
'<td class="liste_titre">';
1877if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1879 print
'<td class="liste_titre maxwidthonsmartphone right">';
1880 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).
'">';
1884if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
1885 print
'<td class="liste_titre maxwidthonsmartphone center">';
1886 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1890if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1891 print
'<td class="liste_titre center parentonrightofpage">';
1892 $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"));
1894 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1899 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1900 $searchpicto = $form->showFilterButtons();
1911print
'<tr class="liste_titre">';
1913 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1920if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1921 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1924if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1925 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1928if (!empty($arrayfields[
'f.type'][
'checked'])) {
1929 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1932if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1933 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1935if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1939if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1943if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1944 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1947if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1948 $langs->load(
"projects");
1949 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1952if (!empty($arrayfields[
'p.title'][
'checked'])) {
1953 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1956if (!empty($arrayfields[
's.nom'][
'checked'])) {
1957 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1960if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1962 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1965if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1966 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1969if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1970 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1973if (!empty($arrayfields[
's.town'][
'checked'])) {
1974 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1977if (!empty($arrayfields[
's.zip'][
'checked'])) {
1978 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1981if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1982 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1985if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1986 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1989if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1990 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1993if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1994 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1997if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1998 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
2001if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2002 print_liste_field_titre($arrayfields[
'f.fk_input_reason'][
'label'], $_SERVER[
'PHP_SELF'],
'f.fk_input_reason',
'', $param,
'', $sortfield, $sortorder);
2004if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2005 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2008if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2009 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2012if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2013 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2016if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2017 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2020if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2021 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
2024if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2025 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
2028if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2032if (!empty($arrayfields[
'u.login'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
2036if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2040if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2044if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2048if (!empty($arrayfields[
'rtp'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2052if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2053 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2056if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2057 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2060if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2061 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2064if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2065 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2068if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2069 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2072if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2073 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2076if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2077 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2080if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2081 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2084if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2085 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2088if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2089 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2092if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2093 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2097include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2099$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2100$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2101print $hookmanager->resPrint;
2102if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2103 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2106if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2107 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2110if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2111 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
2114if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2115 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2118if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2119 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2122if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2123 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
2127if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2128 print_liste_field_titre($arrayfields[
'f.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"f.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2132if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2133 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
2137 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2143$projectstatic =
new Project($db);
2145$userstatic =
new User($db);
2163 $typenArray = $formcompany->typent_array(1);
2165 $with_margin_info =
false;
2166 if (isModEnabled(
'margin') && (
2167 !empty($arrayfields[
'total_pa'][
'checked'])
2168 || !empty($arrayfields[
'total_margin'][
'checked'])
2169 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2170 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2173 $with_margin_info =
true;
2178 $imaxinloop = ($limit ? min($num, $limit) : $num);
2179 while ($i < $imaxinloop) {
2180 $obj = $db->fetch_object($resql);
2182 $datelimit = $db->jdate($obj->datelimite);
2184 $facturestatic->id = $obj->id;
2185 $facturestatic->ref = $obj->ref;
2186 $facturestatic->ref_client = $obj->ref_client;
2187 $facturestatic->ref_customer = $obj->ref_client;
2188 $facturestatic->type = $obj->type;
2189 $facturestatic->subtype = $obj->subtype;
2190 $facturestatic->total_ht = $obj->total_ht;
2191 $facturestatic->total_tva = $obj->total_tva;
2192 $facturestatic->total_ttc = $obj->total_ttc;
2193 $facturestatic->multicurrency_code = $obj->multicurrency_code;
2194 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
2195 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
2196 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
2197 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
2198 $facturestatic->statut = $obj->fk_statut;
2199 $facturestatic->status = $obj->fk_statut;
2200 $facturestatic->close_code = $obj->close_code;
2201 $facturestatic->total_ttc = $obj->total_ttc;
2202 $facturestatic->paye = $obj->paye;
2203 $facturestatic->socid = $obj->fk_soc;
2205 $facturestatic->date = $db->jdate($obj->datef);
2206 $facturestatic->date_validation = $db->jdate($obj->date_valid);
2207 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
2209 $facturestatic->note_public = $obj->note_public;
2210 $facturestatic->note_private = $obj->note_private;
2213 $facturestatic->retained_warranty = $obj->retained_warranty;
2214 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
2215 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2216 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
2217 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
2218 $facturestatic->situation_counter = $obj->situation_counter;
2221 $companystatic->id = $obj->socid;
2222 $companystatic->name = $obj->name;
2223 $companystatic->name_alias = $obj->alias;
2224 $companystatic->client = $obj->client;
2225 $companystatic->fournisseur = $obj->fournisseur;
2226 $companystatic->code_client = $obj->code_client;
2227 $companystatic->code_compta_client = $obj->code_compta_client;
2228 $companystatic->code_fournisseur = $obj->code_fournisseur;
2229 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
2230 $companystatic->email = $obj->email;
2231 $companystatic->phone = $obj->phone;
2232 $companystatic->fax = $obj->fax;
2233 $companystatic->address = $obj->address;
2234 $companystatic->zip = $obj->zip;
2235 $companystatic->town = $obj->town;
2236 $companystatic->country_code = $obj->country_code;
2238 $projectstatic->id = $obj->project_id;
2239 $projectstatic->ref = $obj->project_ref;
2240 $projectstatic->title = $obj->project_label;
2242 $paiement = $facturestatic->getSommePaiement();
2243 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2244 $totaldeposits = $facturestatic->getSumDepositsUsed();
2245 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2246 $remaintopay = $obj->total_ttc - $totalallpayments;
2248 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2249 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2250 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2252 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
2253 $remaintopay =
price2num($facturestatic->total_ttc - $totalallpayments);
2255 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2256 $multicurrency_remaintopay = (float)
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2260 $multicurrency_remaintopay = 0;
2263 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id);
2264 $remaintopay = -$remaincreditnote;
2265 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
2266 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2267 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2268 $multicurrency_totalpay = (float)
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2271 $facturestatic->alreadypaid = $paiement;
2272 $facturestatic->totalpaid = $paiement;
2273 $facturestatic->totalcreditnotes = $totalcreditnotes;
2274 $facturestatic->totaldeposits = $totaldeposits;
2276 $marginInfo = array();
2277 if ($with_margin_info) {
2278 $facturestatic->fetch_lines();
2279 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2280 $total_ht += $obj->total_ht;
2281 $total_margin += $marginInfo[
'total_margin'];
2286 if ($mode ==
'kanban') {
2288 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2289 print
'<div class="box-flex-container kanban">';
2292 if ($massactionbutton || $massaction) {
2294 if (in_array(
$object->id, $arrayofselected)) {
2299 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2300 print $facturestatic->getKanbanView(
'', $arraydata);
2301 if ($i == ($imaxinloop - 1)) {
2308 print
'<tr data-rowid="'.$object->id.
'" class="oddeven status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'"';
2309 if ($contextpage ==
'poslist') {
2310 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2311 if (strpos($obj->ref, 'PROV
') !== false) {
2312 //If is a draft invoice, load var to be able to add products
2313 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2314 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2322 print
'<td class="nowrap center">';
2323 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2325 if (in_array($obj->id, $arrayofselected)) {
2328 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2338 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2345 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2346 print
'<td class="nowraponall">';
2348 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2350 print
'<td class="nobordernopadding nowraponall">';
2351 if ($contextpage ==
'poslist') {
2354 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2358 $filepath =
$conf->invoice->multidir_output[$obj->entity] ??
$conf->invoice->dir_output;
2359 $filedir = $filepath.
'/'.$filename;
2361 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2362 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2374 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2375 $tdcss = (
getDolGlobalInt(
'MAIN_SHOW_GLOBAL_REF_CUSTOMER_SUPPLIER') ?
'class="minwidth400 maxwidth400"' :
'class="nowrap tdoverflowmax200"');
2376 print
'<td title="'.dolPrintHTMLForAttribute($obj->ref_client).
'" '.$tdcss.
'>';
2385 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2386 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2387 print $facturestatic->getLibType(2);
2395 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2397 if ($facturestatic->subtype > 0) {
2398 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2400 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2409 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2410 print
'<td align="center" class="nowraponall">';
2419 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2420 print
'<td align="center" class="nowraponall">';
2429 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2430 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2431 if ($facturestatic->hasDelay()) {
2432 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2441 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2442 print
'<td class="nocellnopadd nowraponall">';
2443 if ($obj->project_id > 0) {
2444 print $projectstatic->getNomUrl(1);
2453 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2454 print
'<td class="nowraponall">';
2455 if ($obj->project_id > 0) {
2465 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2466 print
'<td class="tdoverflowmax150">';
2467 if ($contextpage ==
'poslist') {
2470 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2478 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2479 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2487 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2488 print
'<td class="tdoverflowmax200">';
2489 if ($obj->fk_parent > 0) {
2490 if (!isset($company_url_list[$obj->fk_parent])) {
2491 $companyparent =
new Societe($db);
2492 $res = $companyparent->fetch($obj->fk_parent);
2494 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2497 if (isset($company_url_list[$obj->fk_parent])) {
2498 print $company_url_list[$obj->fk_parent];
2507 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2508 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2516 if (!empty($arrayfields[
's.town'][
'checked'])) {
2517 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2525 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2526 print
'<td class="nowraponall">';
2534 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2535 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2541 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2542 $tmparray =
getCountry($obj->fk_pays,
'all');
2543 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2551 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2552 if (!is_array($typenArray) || count($typenArray) == 0) {
2553 $typenArray = $formcompany->typent_array(1);
2555 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2556 if (!empty($obj->typent_code)) {
2557 print $typenArray[$obj->typent_code];
2565 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2566 if (!is_array(
$conf->cache[
'staff']) || count(
$conf->cache[
'staff']) == 0) {
2567 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2569 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML(
$conf->cache[
'staff'][$obj->staff_code]).
'">';
2570 print
$conf->cache[
'staff'][$obj->staff_code];
2578 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2579 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2580 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2589 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2590 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2591 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2600 if (!empty($arrayfields[
'f.fk_input_reason'][
'checked'])) {
2602 $form->formInputReason($_SERVER[
'PHP_SELF'], (
string) $obj->fk_input_reason,
'none');
2610 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2619 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2629 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2630 print
'<td class="right nowraponall"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2637 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2640 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2641 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2648 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2651 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2652 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2659 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2662 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2663 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2670 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2673 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2674 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2681 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2684 $userstatic->id = $obj->fk_user_author;
2685 $userstatic->login = $obj->login;
2686 $userstatic->lastname = $obj->lastname;
2687 $userstatic->firstname = $obj->firstname;
2688 $userstatic->email = $obj->user_email;
2689 $userstatic->status = $obj->user_statut;
2690 $userstatic->entity = $obj->entity;
2691 $userstatic->photo = $obj->photo;
2692 $userstatic->office_phone = $obj->office_phone;
2693 $userstatic->office_fax = $obj->office_fax;
2694 $userstatic->user_mobile = $obj->user_mobile;
2695 $userstatic->job = $obj->job;
2696 $userstatic->gender = $obj->gender;
2699 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2700 print
'<td class="tdoverflowmax125">';
2701 if ($userstatic->id) {
2702 print $userstatic->getNomUrl(-1);
2712 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2715 if ($obj->socid > 0) {
2716 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2717 if ($listsalesrepresentatives < 0) {
2720 $nbofsalesrepresentative = count($listsalesrepresentatives);
2721 if ($nbofsalesrepresentative > 6) {
2723 print $nbofsalesrepresentative;
2724 } elseif ($nbofsalesrepresentative > 0) {
2726 foreach ($listsalesrepresentatives as $val) {
2727 $userstatic->id = $val[
'id'];
2728 $userstatic->lastname = $val[
'lastname'];
2729 $userstatic->firstname = $val[
'firstname'];
2730 $userstatic->email = $val[
'email'];
2731 $userstatic->status = $val[
'statut'];
2732 $userstatic->entity = $val[
'entity'];
2733 $userstatic->photo = $val[
'photo'];
2734 $userstatic->login = $val[
'login'];
2735 $userstatic->office_phone = $val[
'office_phone'];
2736 $userstatic->office_fax = $val[
'office_fax'];
2737 $userstatic->user_mobile = $val[
'user_mobile'];
2738 $userstatic->job = $val[
'job'];
2739 $userstatic->gender = $val[
'gender'];
2741 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2743 if ($j < $nbofsalesrepresentative) {
2757 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2758 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2764 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2765 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2772 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2776 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2777 print
'<td class="right nowraponall amount">';
2778 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2791 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2792 if (!
getDolGlobalString(
'MAIN_SHOW_ONLY_CODE_MULTICURRENCY') && !empty($obj->multicurrency_code)) {
2793 $title = $obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2794 $label = $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2796 $title = $obj->multicurrency_code;
2797 $label = $obj->multicurrency_code;
2799 print
'<td class="nowraponall tdoverflowmax125" title="'.dolPrintHTMLForAttribute($title).
'">';
2808 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2809 print
'<td class="nowraponall">';
2810 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->id, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2817 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2818 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2824 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2825 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2831 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2832 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2838 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2839 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2846 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2847 print
'<td class="right nowraponall amount">';
2848 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2856 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2857 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2862 if (empty($totalarray[
'val'][
'total_pa'])) {
2865 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2868 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2869 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2874 if (empty($totalarray[
'val'][
'total_margin'])) {
2877 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2880 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2881 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2887 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2888 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2893 if ($i >= $imaxinloop - 1) {
2894 if (!empty($total_ht)) {
2903 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2905 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2906 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2907 print $hookmanager->resPrint;
2909 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2910 print
'<td class="nowraponall center">';
2911 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
2918 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2919 print
'<td class="nowraponall center">';
2920 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
2927 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2928 print
'<td class="nowraponall center">';
2929 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuserrel');
2936 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2937 print
'<td class="sensiblehtmlcontent center">';
2938 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2945 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2946 print
'<td class="sensiblehtmlcontent center">';
2947 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2954 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2955 print
'<td class="center">';
2956 if (!empty($obj->fk_fac_rec_source)) {
2958 $result = $facrec->fetch($obj->fk_fac_rec_source);
2962 print $facrec->getNomUrl();
2972 if (!empty($arrayfields[
'f.import_key'][
'checked'])) {
2973 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2980 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2981 print
'<td class="nowrap center">';
2982 print $facturestatic->getLibStatut(5, $totalallpayments);
2992 print
'<td class="nowrap center">';
2993 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2995 if (in_array($obj->id, $arrayofselected)) {
2998 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3013 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
3014 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
3017 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3023 foreach ($arrayfields as $key => $val) {
3024 if (!empty($val[
'checked'])) {
3028 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3033$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3034$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3035print $hookmanager->resPrint;
3037print
'</table>'.
"\n";
3040print
'</form>'.
"\n";
3043if ($contextpage !=
'poslist') {
3044 $hidegeneratedfilelistifempty = 1;
3045 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3046 $hidegeneratedfilelistifempty = 0;
3050 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3051 $urlsource .= str_replace(
'&',
'&', $param);
3053 $filedir = $diroutputmassaction;
3054 $genallowed = $user->hasRight(
"facture",
"lire");
3055 $delallowed = $user->hasRight(
"facture",
"creer");
3058 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.