39require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43if (isModEnabled(
'margin')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
47require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.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.
'/projet/class/project.class.php';
57if (isModEnabled(
'commande')) {
58 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
62$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
64$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
65$projectid = (
GETPOST(
'projectid') ?
GETPOST(
'projectid',
'int') : 0);
69$socid =
GETPOST(
'socid',
'int');
71$action =
GETPOST(
'action',
'aZ09');
72$massaction =
GETPOST(
'massaction',
'alpha');
73$show_files =
GETPOST(
'show_files',
'int');
74$confirm =
GETPOST(
'confirm',
'alpha');
75$toselect =
GETPOST(
'toselect',
'array');
76$optioncss =
GETPOST(
'optioncss',
'alpha');
77$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
78$mode =
GETPOST(
'mode',
'alpha');
80if ($contextpage ==
'poslist') {
84$lineid =
GETPOST(
'lineid',
'int');
85$userid =
GETPOST(
'userid',
'int');
87$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
88$search_type =
GETPOST(
'search_type',
'int');
89$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
90$search_project =
GETPOST(
'search_project',
'alpha');
91$search_company =
GETPOST(
'search_company',
'alpha');
92$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
93$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
94$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
95$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
96$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
97$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
98$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
99$search_login =
GETPOST(
'search_login',
'alpha');
100$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
101$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
102$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
103$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
104$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
105$search_status =
GETPOST(
'search_status',
'intcomma');
106$search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
107$search_paymentterms =
GETPOST(
'search_paymentterms',
'int');
108$search_module_source =
GETPOST(
'search_module_source',
'alpha');
109$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
110$search_town =
GETPOST(
'search_town',
'alpha');
111$search_zip =
GETPOST(
'search_zip',
'alpha');
112$search_state =
GETPOST(
"search_state");
113$search_country =
GETPOST(
"search_country",
'alpha');
114$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
115$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
116$search_user =
GETPOST(
'search_user',
'int');
117$search_sale =
GETPOST(
'search_sale',
'int');
118$search_date_startday =
GETPOST(
'search_date_startday',
'int');
119$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
120$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
121$search_date_endday =
GETPOST(
'search_date_endday',
'int');
122$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
123$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
124$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
125$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
126$search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
127$search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
128$search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
129$search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
130$search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
131$search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
132$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
133$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
134$search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
135$search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
136$search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
137$search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
138$search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
139$search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
140$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
141$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
142$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
143$search_product_category =
GETPOST(
'search_product_category',
'int');
144$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
145$search_btn =
GETPOST(
'button_search',
'alpha');
146$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
148$option =
GETPOST(
'search_option');
149if ($option ==
'late') {
150 $search_status =
'1';
152$filtre =
GETPOST(
'filtre',
'alpha');
154$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
155$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
156$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
157$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
158if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
161$offset = $limit * $page;
162if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status ==
'1') {
163 $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
169 $sortfield =
'f.datef';
171$pageprev = $page - 1;
172$pagenext = $page + 1;
175$fieldid = (!empty($ref) ?
'ref' :
'rowid');
176if (!empty($user->socid)) {
177 $socid = $user->socid;
179$result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
181$diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
190$hookmanager->initHooks(array($contextpage));
194$extrafields->fetch_name_optionals_label($object->table_element);
196$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
199$fieldstosearchall = array(
201 'f.ref_client'=>
'RefCustomer',
202 'f.note_public'=>
'NotePublic',
203 's.nom'=>
"ThirdParty",
204 's.code_client'=>
"CustomerCodeShort",
205 's.name_alias'=>
"AliasNameShort",
208 'pd.description'=>
'Description',
210if (empty($user->socid)) {
211 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
214$checkedtypetiers = 0;
216 'f.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
217 'f.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1,
'position'=>10),
218 'f.type'=>array(
'label'=>
"Type",
'checked'=>0,
'position'=>15),
219 'f.datef'=>array(
'label'=>
"DateInvoice",
'checked'=>1,
'position'=>20),
220 'f.date_valid'=>array(
'label'=>
"DateValidation",
'checked'=>0,
'position'=>22),
221 'f.date_lim_reglement'=>array(
'label'=>
"DateDue",
'checked'=>1,
'position'=>25),
222 'f.date_closing'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>30),
223 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>40),
224 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>41),
225 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>50),
226 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>1,
'position'=>51),
227 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'checked'=>-1,
'position'=>52),
228 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
229 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>55),
230 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1,
'position'=>60),
231 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>65),
232 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>70),
233 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>75),
234 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>1,
'position'=>80),
235 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>1,
'position'=>85),
236 'f.module_source'=>array(
'label'=>
"POSModule",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position'=>90),
237 'f.pos_source'=>array(
'label'=>
"POSTerminal",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position'=>91),
238 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>95),
239 'f.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>100),
240 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax1_assuj ==
"1"),
'position'=>110),
241 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax2_assuj ==
"1"),
'position'=>120),
242 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>130),
243 'dynamount_payed'=>array(
'label'=>
"Received",
'checked'=>0,
'position'=>140),
244 'rtp'=>array(
'label'=>
"Rest",
'checked'=>0,
'position'=>150),
245 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>280),
246 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>285),
247 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>290),
248 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>291),
249 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>292),
250 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>295),
251 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>296),
252 'total_pa' => array(
'label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
253 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
254 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
255 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
256 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
257 'f.tms' =>array(
'type'=>
'timestamp',
'label'=>
'DateModificationShort',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>502),
258 'u.login'=>array(
'label'=>
"UserAuthor",
'checked'=>1,
'position'=>504),
259 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>506),
264 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>520,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
265 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>521,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
266 'f.fk_fac_rec_source'=>array(
'label'=>
'GeneratedFromTemplate',
'checked'=>0,
'position'=>530,
'enabled'=>
'1'),
267 'f.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
270if (
getDolGlobalString(
"INVOICE_USE_SITUATION") && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
271 $arrayfields[
'f.retained_warranty'] = array(
'label'=>$langs->trans(
"RetainedWarranty"),
'checked'=>0,
'position'=>86);
274foreach ($object->fields as $key => $val) {
277 if (!empty($val[
'visible'])) {
278 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
280 if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists(
'f.'.$key, $arrayfields)) { $newkey =
'f.'.$key; } elseif (array_key_exists(
'f.'.$key, $arrayfields)) { $newkey =
'f.'.$key; } elseif (array_key_exists(
's.'.$key, $arrayfields)) { $newkey =
's.'.$key; }
282 $arrayfields[$newkey] = array(
283 'label'=>$val[
'label'],
284 'checked'=>(($visible < 0) ? 0 : 1),
285 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
286 'position'=>$val[
'position'],
287 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
293include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
303if (
GETPOST(
'cancel',
'alpha')) {
307if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
311$parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
312$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
317include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
320if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
323 $search_product_category =
'';
325 $search_refcustomer =
'';
327 $search_project_ref =
'';
328 $search_project =
'';
329 $search_company =
'';
330 $search_company_alias =
'';
331 $search_parent_name =
'';
332 $search_montant_ht =
'';
333 $search_montant_vat =
'';
334 $search_montant_localtax1 =
'';
335 $search_montant_localtax2 =
'';
336 $search_montant_ttc =
'';
338 $search_multicurrency_code =
'';
339 $search_multicurrency_tx =
'';
340 $search_multicurrency_montant_ht =
'';
341 $search_multicurrency_montant_vat =
'';
342 $search_multicurrency_montant_ttc =
'';
344 $search_paymentmode =
'';
345 $search_paymentterms =
'';
346 $search_module_source =
'';
347 $search_pos_source =
'';
351 $search_country =
'';
352 $search_type_thirdparty =
'';
353 $search_customer_code =
'';
354 $search_date_startday =
'';
355 $search_date_startmonth =
'';
356 $search_date_startyear =
'';
357 $search_date_endday =
'';
358 $search_date_endmonth =
'';
359 $search_date_endyear =
'';
360 $search_date_start =
'';
361 $search_date_end =
'';
362 $search_date_valid_startday =
'';
363 $search_date_valid_startmonth =
'';
364 $search_date_valid_startyear =
'';
365 $search_date_valid_endday =
'';
366 $search_date_valid_endmonth =
'';
367 $search_date_valid_endyear =
'';
368 $search_date_valid_start =
'';
369 $search_date_valid_end =
'';
370 $search_datelimit_startday =
'';
371 $search_datelimit_startmonth =
'';
372 $search_datelimit_startyear =
'';
373 $search_datelimit_endday =
'';
374 $search_datelimit_endmonth =
'';
375 $search_datelimit_endyear =
'';
376 $search_datelimit_start =
'';
377 $search_datelimit_end =
'';
378 $search_fac_rec_source_title =
'';
380 $search_array_options = array();
381 $search_categ_cus = 0;
386if (empty($reshook)) {
387 $objectclass =
'Facture';
388 $objectlabel =
'Invoices';
389 $permissiontoread = $user->hasRight(
"facture",
"lire");
390 $permissiontoadd = $user->hasRight(
"facture",
"creer");
391 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
392 $uploaddir = $conf->facture->dir_output;
393 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
396if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
397 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
398 $arrayofselected = is_array($toselect) ? $toselect : array();
399 if (!empty($arrayofselected)) {
400 $bankid =
GETPOST(
'bankid',
'int');
401 $paiementid =
GETPOST(
'paiementid',
'int');
403 if (empty($paiementdate)) {
404 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
406 $action =
'makepayment';
410 foreach ($arrayofselected as $toselectid) {
413 $result = $facture->fetch($toselectid);
422 $paiementAmount = $facture->getSommePaiement();
423 $totalcreditnotes = $facture->getSumCreditNotesUsed();
424 $totaldeposits = $facture->getSumDepositsUsed();
425 $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
426 $remaintopay =
price2num($facture->total_ttc - $totalallpayments);
427 if ($remaintopay != 0) {
428 $resultBank = $facture->setBankAccount($bankid);
429 if ($resultBank < 0) {
434 $paiement->datepaye = $paiementdate;
435 $paiement->amounts[$facture->id] = $remaintopay;
436 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
437 $paiement->paiementid = $paiementid;
438 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
439 if ($paiement_id < 0) {
440 $langs->load(
"errors");
441 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
444 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
446 $langs->load(
"errors");
447 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
453 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
457 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
462 if (empty($errorpayment)) {
463 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
471} elseif ($massaction ==
'withdrawrequest') {
472 $langs->load(
"withdrawals");
474 if (!$user->rights->prelevement->bons->creer) {
481 $arrayofselected = is_array($toselect) ? $toselect : array();
482 $listofbills = array();
483 foreach ($arrayofselected as $toselectid) {
485 $result = $objecttmp->fetch($toselectid);
487 $totalpaid = $objecttmp->getSommePaiement();
488 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
489 $totaldeposits = $objecttmp->getSumDepositsUsed();
490 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
493 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
494 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
496 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
497 } elseif ($objecttmp->resteapayer < 0) {
499 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
502 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
503 $rsql .=
" , pfd.date_traite as date_traite";
504 $rsql .=
" , pfd.amount";
505 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
506 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
507 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
508 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
509 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
510 $rsql .=
" AND pfd.traite = 0";
511 $rsql .=
" ORDER BY pfd.date_demande DESC";
513 $result_sql = $db->query($rsql);
515 $numprlv = $db->num_rows($result_sql);
520 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
521 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
523 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
525 $listofbills[] = $objecttmp;
531 if (!empty($listofbills)) {
532 $nbwithdrawrequestok = 0;
533 foreach ($listofbills as $aBill) {
535 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
538 $nbwithdrawrequestok++;
544 if ($nbwithdrawrequestok > 0) {
545 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
557$form =
new Form($db);
561if (isModEnabled(
'margin')) {
564$bankaccountstatic =
new Account($db);
565$facturestatic =
new Facture($db);
567$companystatic =
new Societe($db);
568$companyparent =
new Societe($db);
569$company_url_list = array();
571$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' '.$soc->name :
'');
573$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
574$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
577if ($sall || $search_user > 0) {
578 $sql =
'SELECT DISTINCT';
580$sql .=
' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, 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,';
581$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
582$sql .=
' f.fk_user_author,';
583$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,';
584$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
585$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
586$sql .=
' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
587$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
588$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,';
589$sql .=
" s.parent as fk_parent,";
590$sql .=
" s2.nom as name2,";
591$sql .=
' typent.code as typent_code,';
592$sql .=
' state.code_departement as state_code, state.nom as state_name,';
593$sql .=
' country.code as country_code,';
594$sql .=
' f.fk_fac_rec_source,';
595$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
596$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';
606if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
607 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
608 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
612$parameters = array();
613$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
614$sql .= $hookmanager->resPrint;
615$sql = preg_replace(
'/,\s*$/',
'', $sql);
620$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
621$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
624$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
625$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
626if ($sortfield ==
"f.datef") {
627 $sql .= $db->hintindex(
'idx_facture_datef');
629if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
630 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
640 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid=pd.fk_facture';
642if (!empty($search_fac_rec_source_title)) {
643 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source=facrec.rowid';
645$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
646$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
648if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
649 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
651if ($search_user > 0) {
652 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
653 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
656$parameters = array();
657$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
658$sql .= $hookmanager->resPrint;
660$sql .=
' WHERE f.fk_soc = s.rowid';
661$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
662if (empty($user->rights->societe->client->voir) && !$socid) {
663 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
666 $sql .=
' AND s.rowid = '.((int) $socid);
670 $sql .=
' AND f.fk_user_author IS NULL';
672 $sql .=
' AND f.fk_user_author = '.((int) $userid);
678if ($search_refcustomer) {
681if ($search_type !=
'' && $search_type !=
'-1') {
682 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
684if ($search_project_ref) {
687if ($search_project) {
690if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
691 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
693 if ($search_company) {
696 if ($search_company_alias) {
700if ($search_parent_name) {
703if ($search_customer_code) {
715if (strlen(trim($search_country))) {
717 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
718 foreach ($arrayofcode as $key => $value) {
719 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
720 if ($value != $mysoc->country_code) {
721 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
724 if ($search_country ==
'special_allnotme') {
725 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
726 } elseif ($search_country ==
'special_eec') {
727 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
728 } elseif ($search_country ==
'special_eecnotme') {
729 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
730 } elseif ($search_country ==
'special_noteec') {
731 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
736if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
737 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
739if ($search_montant_ht !=
'') {
742if ($search_montant_vat !=
'') {
745if ($search_montant_localtax1 !=
'') {
746 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
748if ($search_montant_localtax2 !=
'') {
749 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
751if ($search_montant_ttc !=
'') {
754if ($search_multicurrency_code !=
'') {
755 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
757if ($search_multicurrency_tx !=
'') {
758 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
760if ($search_multicurrency_montant_ht !=
'') {
761 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
763if ($search_multicurrency_montant_vat !=
'') {
764 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
766if ($search_multicurrency_montant_ttc !=
'') {
767 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
770 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
772if ($search_status !=
'-1' && $search_status !=
'') {
773 if (is_numeric($search_status) && $search_status >= 0) {
774 if ($search_status ==
'0') {
775 $sql .=
" AND f.fk_statut = 0";
777 if ($search_status ==
'1') {
778 $sql .=
" AND f.fk_statut = 1";
780 if ($search_status ==
'2') {
781 $sql .=
" AND f.fk_statut = 2";
783 if ($search_status ==
'3') {
784 $sql .=
" AND f.fk_statut = 3";
787 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
791if ($search_paymentmode > 0) {
792 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
794if ($search_paymentterms > 0) {
795 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
797if ($search_module_source) {
800if ($search_pos_source) {
803if ($search_date_start) {
804 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
806if ($search_date_end) {
807 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
809if ($search_date_valid_start) {
810 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
812if ($search_date_valid_end) {
813 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
815if ($search_datelimit_start) {
816 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
818if ($search_datelimit_end) {
819 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
821if ($option ==
'late') {
822 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
824if ($search_sale > 0) {
825 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
827if ($search_user > 0) {
828 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user);
830if (!empty($search_fac_rec_source_title)) {
831 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
834$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
835$searchCategoryProductOperator = 0;
836if (!empty($searchCategoryProductList)) {
837 $searchCategoryProductSqlList = array();
838 $listofcategoryid =
'';
839 foreach ($searchCategoryProductList as $searchCategoryProduct) {
840 if (intval($searchCategoryProduct) == -2) {
841 $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)";
842 } elseif (intval($searchCategoryProduct) > 0) {
843 if ($searchCategoryProductOperator == 0) {
844 $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).
")";
846 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
850 if ($listofcategoryid) {
851 $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).
"))";
853 if ($searchCategoryProductOperator == 1) {
854 if (!empty($searchCategoryProductSqlList)) {
855 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
858 if (!empty($searchCategoryProductSqlList)) {
859 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
863$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
864$searchCategoryCustomerOperator = 0;
866if (!empty($searchCategoryCustomerList)) {
867 $searchCategoryCustomerSqlList = array();
868 $listofcategoryid =
'';
869 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
870 if (intval($searchCategoryCustomer) == -2) {
871 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
872 } elseif (intval($searchCategoryCustomer) > 0) {
873 if ($searchCategoryCustomerOperator == 0) {
874 $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).
")";
876 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
880 if ($listofcategoryid) {
881 $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).
"))";
883 if ($searchCategoryCustomerOperator == 1) {
884 if (!empty($searchCategoryCustomerSqlList)) {
885 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
888 if (!empty($searchCategoryCustomerSqlList)) {
889 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
894include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
896$parameters = array();
897$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
898$sql .= $hookmanager->resPrint;
937$parameters = array();
938$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
939$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
942$nbtotalofrecords =
'';
945 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
946 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
948 $resql = $db->query($sqlforcount);
950 $objforcount = $db->fetch_object($resql);
951 $nbtotalofrecords = $objforcount->nbtotalofrecords;
956 if (($page * $limit) > $nbtotalofrecords) {
964$sql .= $db->order($sortfield, $sortorder);
966 $sql .= $db->plimit($limit + 1, $offset);
969$resql = $db->query($sql);
972 $num = $db->num_rows($resql);
974 $arrayofselected = is_array($toselect) ? $toselect : array();
976 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
977 $obj = $db->fetch_object($resql);
980 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$id);
987 llxHeader(
'', $title,
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
992 if (empty($search_company)) {
993 $search_company = $soc->name;
997 $param =
'&socid='.urlencode($socid);
999 $param .=
'&mode='.urlencode($mode);
1001 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1002 $param .=
'&contextpage='.urlencode($contextpage);
1004 if ($limit > 0 && $limit != $conf->liste_limit) {
1005 $param .=
'&limit='.((int) $limit);
1008 $param .=
'&sall='.urlencode($sall);
1010 if ($search_date_startday) {
1011 $param .=
'&search_date_startday='.urlencode($search_date_startday);
1013 if ($search_date_startmonth) {
1014 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
1016 if ($search_date_startyear) {
1017 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
1019 if ($search_date_endday) {
1020 $param .=
'&search_date_endday='.urlencode($search_date_endday);
1022 if ($search_date_endmonth) {
1023 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
1025 if ($search_date_endyear) {
1026 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
1028 if ($search_date_valid_startday) {
1029 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
1031 if ($search_date_valid_startmonth) {
1032 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
1034 if ($search_date_valid_startyear) {
1035 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
1037 if ($search_date_valid_endday) {
1038 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
1040 if ($search_date_valid_endmonth) {
1041 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
1043 if ($search_date_valid_endyear) {
1044 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
1046 if ($search_datelimit_startday) {
1047 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
1049 if ($search_datelimit_startmonth) {
1050 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
1052 if ($search_datelimit_startyear) {
1053 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
1055 if ($search_datelimit_endday) {
1056 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
1058 if ($search_datelimit_endmonth) {
1059 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
1061 if ($search_datelimit_endyear) {
1062 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
1065 $param .=
'&search_ref='.urlencode($search_ref);
1067 if ($search_refcustomer) {
1068 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1070 if ($search_project_ref) {
1071 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1073 if ($search_project) {
1074 $param .=
'&search_project='.urlencode($search_project);
1076 if ($search_type !=
'') {
1077 $param .=
'&search_type='.urlencode($search_type);
1079 if ($search_company) {
1080 $param .=
'&search_company='.urlencode($search_company);
1082 if ($search_company_alias) {
1083 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1085 if ($search_parent_name !=
'') {
1086 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1089 $param .=
'&search_town='.urlencode($search_town);
1092 $param .=
'&search_zip='.urlencode($search_zip);
1094 if ($search_country) {
1095 $param .=
"&search_country=".urlencode($search_country);
1097 if ($search_type_thirdparty !=
'') {
1098 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1100 if ($search_customer_code) {
1101 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1103 if ($search_sale > 0) {
1104 $param .=
'&search_sale='.urlencode($search_sale);
1106 if ($search_user > 0) {
1107 $param .=
'&search_user='.urlencode($search_user);
1109 if ($search_login) {
1110 $param .=
'&search_login='.urlencode($search_login);
1112 if ($search_product_category > 0) {
1113 $param .=
'&search_product_category='.urlencode($search_product_category);
1115 if ($search_montant_ht !=
'') {
1116 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1118 if ($search_montant_vat !=
'') {
1119 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1121 if ($search_montant_localtax1 !=
'') {
1122 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1124 if ($search_montant_localtax2 !=
'') {
1125 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1127 if ($search_montant_ttc !=
'') {
1128 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1130 if ($search_multicurrency_code !=
'') {
1131 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1133 if ($search_multicurrency_tx !=
'') {
1134 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1136 if ($search_multicurrency_montant_ht !=
'') {
1137 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1139 if ($search_multicurrency_montant_vat !=
'') {
1140 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1142 if ($search_multicurrency_montant_ttc !=
'') {
1143 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1145 if ($search_status !=
'') {
1146 $param .=
'&search_status='.urlencode($search_status);
1148 if ($search_paymentmode > 0) {
1149 $param .=
'&search_paymentmode='.urlencode($search_paymentmode);
1151 if ($search_paymentterms > 0) {
1152 $param .=
'&search_paymentterms='.urlencode($search_paymentterms);
1154 if ($search_module_source) {
1155 $param .=
'&search_module_source='.urlencode($search_module_source);
1157 if ($search_pos_source) {
1158 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1161 $param .=
'&show_files='.urlencode($show_files);
1164 $param .=
"&search_option=".urlencode($option);
1166 if ($optioncss !=
'') {
1167 $param .=
'&optioncss='.urlencode($optioncss);
1169 if ($search_categ_cus > 0) {
1170 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1172 if (!empty($search_fac_rec_source_title)) {
1173 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1177 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1179 $parameters = array();
1180 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1181 $param .= $hookmanager->resPrint;
1183 $arrayofmassactions = array(
1184 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1185 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1186 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1187 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1190 if ($user->hasRight(
'facture',
'paiement')) {
1191 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1193 if (isModEnabled(
'prelevement') && !empty($user->rights->prelevement->bons->creer)) {
1194 $langs->load(
"withdrawals");
1195 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1197 if (!empty($user->rights->facture->supprimer)) {
1198 if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
1199 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1200 } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) {
1201 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1204 if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1205 $arrayofmassactions = array();
1207 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1210 $newcardbutton =
'';
1211 if ($contextpage !=
'poslist') {
1212 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1213 if (!empty($socid)) {
1214 $url .=
'&socid='.$socid;
1216 $newcardbutton =
'';
1217 $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'));
1218 $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'));
1219 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1223 print
'<form method="POST" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1224 if ($optioncss !=
'') {
1225 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1227 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1228 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1229 if (!in_array($massaction, array(
'makepayment'))) {
1230 print
'<input type="hidden" name="action" value="list">';
1232 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1233 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1234 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1235 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1236 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1237 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1239 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1241 $topicmail =
"SendBillRef";
1242 $modelmail =
"facture_send";
1243 $objecttmp =
new Facture($db);
1244 $trackid =
'inv'.$object->id;
1245 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1247 if ($massaction ==
'makepayment') {
1249 $formquestion = array(
1253 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1254 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1255 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value'=>$form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1258 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1263 foreach ($fieldstosearchall as $key => $val) {
1264 $fieldstosearchall[$key] = $langs->trans($val);
1266 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1270 $moreforfilter =
'';
1271 if ($user->hasRight(
"user",
"user",
"lire")) {
1272 $langs->load(
"commercial");
1273 $moreforfilter .=
'<div class="divsearchfield">';
1274 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1275 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250');
1276 $moreforfilter .=
'</div>';
1279 if ($user->hasRight(
"user",
"user",
"lire")) {
1280 $moreforfilter .=
'<div class="divsearchfield">';
1281 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1282 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
1283 $moreforfilter .=
'</div>';
1286 if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1287 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1288 $moreforfilter .=
'<div class="divsearchfield">';
1289 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1290 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1291 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth250', 1);
1292 $moreforfilter .=
'</div>';
1294 if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1295 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1296 $moreforfilter .=
'<div class="divsearchfield">';
1297 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1298 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1299 $moreforfilter .=
'</div>';
1301 $parameters = array();
1302 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1303 if (empty($reshook)) {
1304 $moreforfilter .= $hookmanager->resPrint;
1306 $moreforfilter = $hookmanager->resPrint;
1309 if ($moreforfilter) {
1310 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1311 print $moreforfilter;
1315 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1316 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1319 if ($massactionbutton && $contextpage !=
'poslist') {
1320 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1323 print
'<div class="div-table-responsive">';
1324 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1328 print
'<tr class="liste_titre_filter">';
1332 print
'<td class="liste_titre center actioncolumn">';
1333 $searchpicto = $form->showFilterButtons(
'left');
1338 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1339 print
'<td class="liste_titre">';
1343 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1344 print
'<td class="liste_titre" align="left">';
1345 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1349 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1350 print
'<td class="liste_titre">';
1351 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1355 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1356 print
'<td class="liste_titre maxwidthonsmartphone">';
1363 if (!empty($conf->global->INVOICE_USE_SITUATION)) {
1367 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1371 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1372 print
'<td class="liste_titre center">';
1373 print
'<div class="nowrap">';
1374 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1376 print
'<div class="nowrap">';
1377 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1382 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1383 print
'<td class="liste_titre center">';
1384 print
'<div class="nowrap">';
1385 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'));
1387 print
'<div class="nowrap">';
1388 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'));
1393 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1394 print
'<td class="liste_titre center">';
1395 print
'<div class="nowrap">';
1402 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1403 print
'<br><input type="checkbox" name="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'> '.$langs->trans(
"Alert");
1408 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1409 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1412 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1413 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1416 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1417 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1420 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1421 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1424 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1425 print
'<td class="liste_titre">';
1426 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1430 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1431 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1434 if (!empty($arrayfields[
's.town'][
'checked'])) {
1435 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1438 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1439 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1442 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1443 print
'<td class="liste_titre">';
1444 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1448 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1449 print
'<td class="liste_titre" align="center">';
1450 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1454 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1455 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1456 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'maxwidth100', 1);
1460 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1461 print
'<td class="liste_titre">';
1462 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1466 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1467 print
'<td class="liste_titre">';
1468 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1472 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1473 print
'<td class="liste_titre">';
1474 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1478 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1479 print
'<td class="liste_titre">';
1480 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1483 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1485 print
'<td class="liste_titre right">';
1486 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1489 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1491 print
'<td class="liste_titre right">';
1492 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1495 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1497 print
'<td class="liste_titre right">';
1498 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1501 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1503 print
'<td class="liste_titre right">';
1504 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1507 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1509 print
'<td class="liste_titre right">';
1510 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1513 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1515 print
'<td class="liste_titre" align="center">';
1516 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1519 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1520 print
'<td class="liste_titre"></td>';
1522 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1523 print
'<td class="liste_titre" align="right">';
1526 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1527 print
'<td class="liste_titre right">';
1530 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1531 print
'<td class="liste_titre right">';
1534 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1536 print
'<td class="liste_titre">';
1537 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1540 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1542 print
'<td class="liste_titre">';
1543 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1546 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1548 print
'<td class="liste_titre right">';
1549 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1552 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1554 print
'<td class="liste_titre right">';
1555 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1558 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1560 print
'<td class="liste_titre right">';
1561 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1564 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1565 print
'<td class="liste_titre">';
1568 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1569 print
'<td class="liste_titre right">';
1572 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1573 print
'<td class="liste_titre right">';
1576 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1577 print
'<td class="liste_titre right">';
1580 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1581 print
'<td class="liste_titre right">';
1584 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1585 print
'<td class="liste_titre right">';
1590 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1593 $parameters = array(
'arrayfields'=>$arrayfields);
1594 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1595 print $hookmanager->resPrint;
1597 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1598 print
'<td class="liste_titre">';
1602 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1603 print
'<td class="liste_titre">';
1607 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1608 print
'<td class="liste_titre">';
1611 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1613 print
'<td class="liste_titre">';
1616 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1618 print
'<td class="liste_titre">';
1621 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1623 print
'<td class="liste_titre maxwidthonsmartphone right">';
1624 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).
'">';
1628 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1629 print
'<td class="liste_titre right parentonrightofpage">';
1630 $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"));
1631 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1635 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1636 print
'<td class="liste_titre center actioncolumn">';
1637 $searchpicto = $form->showFilterButtons();
1643 print
'<tr class="liste_titre">';
1645 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1646 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1649 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1652 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1653 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1655 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1658 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1661 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1662 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'align="center"', $sortfield, $sortorder);
1664 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1665 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'align="center"', $sortfield, $sortorder);
1667 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'align="center"', $sortfield, $sortorder);
1670 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1671 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1673 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1676 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1677 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1679 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1682 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1683 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1685 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1686 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1688 if (!empty($arrayfields[
's.town'][
'checked'])) {
1689 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1691 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1694 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1697 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1698 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'align="center"', $sortfield, $sortorder);
1700 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'align="center"', $sortfield, $sortorder);
1703 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1706 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1709 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1710 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1712 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1713 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1715 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1718 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1721 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'class="right"', $sortfield, $sortorder);
1724 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'class="right"', $sortfield, $sortorder);
1727 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1730 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1733 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1734 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1736 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'align="right"', $sortfield, $sortorder);
1739 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1742 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1745 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1746 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1748 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1751 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1754 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1757 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1758 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1760 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1763 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1766 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1769 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1770 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1772 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1775 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1776 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1779 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1781 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1782 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1783 print $hookmanager->resPrint;
1784 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1787 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1788 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1790 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1791 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1793 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1794 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1796 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1799 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1800 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1802 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1803 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'class="right"', $sortfield, $sortorder);
1805 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1806 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1811 $projectstatic =
new Project($db);
1813 $userstatic =
new User($db);
1817 $typenArray = $formcompany->typent_array(1);
1818 $totalarray = array();
1819 $totalarray[
'nbfield'] = 0;
1820 $totalarray[
'val'] = array();
1821 $totalarray[
'val'][
'f.total_tva'] = 0;
1822 $totalarray[
'val'][
'f.total_ht'] = 0;
1823 $totalarray[
'val'][
'f.total_ttc'] = 0;
1824 $totalarray[
'val'][
'dynamount_payed'] = 0;
1825 $totalarray[
'val'][
'rtp'] = 0;
1828 $with_margin_info =
false;
1829 if (isModEnabled(
'margin') && (
1830 !empty($arrayfields[
'total_pa'][
'checked'])
1831 || !empty($arrayfields[
'total_margin'][
'checked'])
1832 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1833 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1836 $with_margin_info =
true;
1841 $savnbfield = $totalarray[
'nbfield'];
1842 $totalarray[
'nbfield'] = 0;
1843 $imaxinloop = ($limit ? min($num, $limit) : $num);
1844 while ($i < $imaxinloop) {
1845 $obj = $db->fetch_object($resql);
1847 $datelimit = $db->jdate($obj->datelimite);
1849 $facturestatic->id = $obj->id;
1850 $facturestatic->ref = $obj->ref;
1851 $facturestatic->ref_client = $obj->ref_client;
1852 $facturestatic->type = $obj->type;
1853 $facturestatic->total_ht = $obj->total_ht;
1854 $facturestatic->total_tva = $obj->total_tva;
1855 $facturestatic->total_ttc = $obj->total_ttc;
1856 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1857 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1858 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1859 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1860 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1861 $facturestatic->statut = $obj->fk_statut;
1862 $facturestatic->status = $obj->fk_statut;
1863 $facturestatic->close_code = $obj->close_code;
1864 $facturestatic->total_ttc = $obj->total_ttc;
1865 $facturestatic->paye = $obj->paye;
1866 $facturestatic->socid = $obj->fk_soc;
1868 $facturestatic->date = $db->jdate($obj->datef);
1869 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1870 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1872 $facturestatic->note_public = $obj->note_public;
1873 $facturestatic->note_private = $obj->note_private;
1875 if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
1876 $facturestatic->retained_warranty = $obj->retained_warranty;
1877 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1878 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1879 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1880 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1881 $facturestatic->situation_counter = $obj->situation_counter;
1884 $companystatic->id = $obj->socid;
1885 $companystatic->name = $obj->name;
1886 $companystatic->name_alias = $obj->alias;
1887 $companystatic->client = $obj->client;
1888 $companystatic->fournisseur = $obj->fournisseur;
1889 $companystatic->code_client = $obj->code_client;
1890 $companystatic->code_compta_client = $obj->code_compta_client;
1891 $companystatic->code_fournisseur = $obj->code_fournisseur;
1892 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1893 $companystatic->email = $obj->email;
1894 $companystatic->phone = $obj->phone;
1895 $companystatic->fax = $obj->fax;
1896 $companystatic->address = $obj->address;
1897 $companystatic->zip = $obj->zip;
1898 $companystatic->town = $obj->town;
1899 $companystatic->country_code = $obj->country_code;
1901 $projectstatic->id = $obj->project_id;
1902 $projectstatic->ref = $obj->project_ref;
1903 $projectstatic->title = $obj->project_label;
1905 $paiement = $facturestatic->getSommePaiement();
1906 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1907 $totaldeposits = $facturestatic->getSumDepositsUsed();
1909 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1910 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1911 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1913 $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
1914 $remaintopay = $obj->total_ttc - $totalallpayments;
1916 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1917 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1921 $multicurrency_remaintopay = 0;
1924 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
1925 $remaintopay = -$remaincreditnote;
1926 $totalallpayments =
price2num($facturestatic->total_ttc - $remaintopay);
1927 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1928 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1929 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1932 $facturestatic->alreadypaid = $paiement;
1933 $facturestatic->totalpaid = $paiement;
1934 $facturestatic->totalcreditnotes = $totalcreditnotes;
1935 $facturestatic->totaldeposits = $totaldeposits;
1937 $marginInfo = array();
1938 if ($with_margin_info ===
true) {
1939 $facturestatic->fetch_lines();
1940 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
1941 $total_ht += $obj->total_ht;
1942 $total_margin += $marginInfo[
'total_margin'];
1945 if ($mode ==
'kanban') {
1947 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1948 print
'<div class="box-flex-container kanban">';
1951 print $facturestatic->getKanbanView(
'', array(
'thirdparty'=>$companystatic->getNomUrl(1,
'company', 15),
'userauthor'=>$userstatic->getNomUrl(1),
'selected' => in_array($object->id, $arrayofselected)));
1952 if ($i == ($imaxinloop - 1)) {
1957 print
'<tr class="oddeven"';
1958 if ($contextpage ==
'poslist') {
1959 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
1960 if (strpos($obj->ref, 'PROV
') !== false) {
1961 //If is a draft invoice, load var to be able to add products
1962 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
1963 print 'parent.place=\
''.$place.
'\'';
1970 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1971 print
'<td class="nowrap center">';
1972 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1974 if (in_array($obj->id, $arrayofselected)) {
1977 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1981 $totalarray[
'nbfield']++;
1986 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1987 print
'<td>'.(($offset * $limit) + $i).
'</td>';
1989 $totalarray[
'nbfield']++;
1994 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1995 print
'<td class="nowraponall">';
1997 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1999 print
'<td class="nobordernopadding nowraponall">';
2000 if ($contextpage ==
'poslist') {
2003 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2008 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2009 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2016 $totalarray[
'nbfield']++;
2021 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2022 print
'<td class="nowrap tdoverflowmax200">';
2026 $totalarray[
'nbfield']++;
2031 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2032 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2033 print $facturestatic->getLibType(2);
2036 $totalarray[
'nbfield']++;
2041 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2042 print
'<td align="center" class="nowraponall">';
2046 $totalarray[
'nbfield']++;
2051 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2052 print
'<td align="center" class="nowraponall">';
2056 $totalarray[
'nbfield']++;
2061 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2062 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2063 if ($facturestatic->hasDelay()) {
2064 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2068 $totalarray[
'nbfield']++;
2073 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2074 print
'<td class="nocellnopadd nowraponall">';
2075 if ($obj->project_id > 0) {
2076 print $projectstatic->getNomUrl(1);
2080 $totalarray[
'nbfield']++;
2085 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2086 print
'<td class="nowraponall">';
2087 if ($obj->project_id > 0) {
2092 $totalarray[
'nbfield']++;
2097 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2098 print
'<td class="tdoverflowmax200">';
2099 if ($contextpage ==
'poslist') {
2102 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2106 $totalarray[
'nbfield']++;
2110 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2111 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2115 $totalarray[
'nbfield']++;
2119 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2120 print
'<td class="tdoverflowmax200">';
2121 if ($obj->fk_parent > 0) {
2122 if (!isset($company_url_list[$obj->fk_parent])) {
2123 $companyparent =
new Societe($db);
2124 $res = $companyparent->fetch($obj->fk_parent);
2126 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2129 if (isset($company_url_list[$obj->fk_parent])) {
2130 print $company_url_list[$obj->fk_parent];
2135 $totalarray[
'nbfield']++;
2139 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2140 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2144 $totalarray[
'nbfield']++;
2148 if (!empty($arrayfields[
's.town'][
'checked'])) {
2149 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2153 $totalarray[
'nbfield']++;
2157 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2158 print
'<td class="nowraponall">';
2162 $totalarray[
'nbfield']++;
2166 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2167 print
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
2169 $totalarray[
'nbfield']++;
2173 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2174 print
'<td class="center">';
2175 $tmparray =
getCountry($obj->fk_pays,
'all');
2176 print $tmparray[
'label'];
2179 $totalarray[
'nbfield']++;
2183 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2184 print
'<td class="center">';
2185 if (!is_array($typenArray) || count($typenArray) == 0) {
2186 $typenArray = $formcompany->typent_array(1);
2188 print $typenArray[$obj->typent_code];
2191 $totalarray[
'nbfield']++;
2195 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2196 print
'<td class="center">';
2197 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2198 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2200 print $conf->cache[
'staff'][$obj->staff_code];
2203 $totalarray[
'nbfield']++;
2208 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2209 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2210 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2214 $totalarray[
'nbfield']++;
2219 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2220 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2221 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2225 $totalarray[
'nbfield']++;
2230 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2235 $totalarray[
'nbfield']++;
2240 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2245 $totalarray[
'nbfield']++;
2250 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2251 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2253 $totalarray[
'nbfield']++;
2256 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2258 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2261 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2262 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2264 $totalarray[
'nbfield']++;
2267 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2269 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2272 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2273 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2275 $totalarray[
'nbfield']++;
2278 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2280 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2283 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2284 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2286 $totalarray[
'nbfield']++;
2289 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2291 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2294 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2295 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2297 $totalarray[
'nbfield']++;
2300 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2302 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2305 $userstatic->id = $obj->fk_user_author;
2306 $userstatic->login = $obj->login;
2307 $userstatic->lastname = $obj->lastname;
2308 $userstatic->firstname = $obj->firstname;
2309 $userstatic->email = $obj->user_email;
2310 $userstatic->statut = $obj->user_statut;
2311 $userstatic->entity = $obj->entity;
2312 $userstatic->photo = $obj->photo;
2313 $userstatic->office_phone = $obj->office_phone;
2314 $userstatic->office_fax = $obj->office_fax;
2315 $userstatic->user_mobile = $obj->user_mobile;
2316 $userstatic->job = $obj->job;
2317 $userstatic->gender = $obj->gender;
2320 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2321 print
'<td class="tdoverflowmax200">';
2322 if ($userstatic->id) {
2323 print $userstatic->getNomUrl(-1);
2329 $totalarray[
'nbfield']++;
2333 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2336 if ($obj->socid > 0) {
2337 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2338 if ($listsalesrepresentatives < 0) {
2341 $nbofsalesrepresentative = count($listsalesrepresentatives);
2342 if ($nbofsalesrepresentative > 6) {
2344 print $nbofsalesrepresentative;
2345 } elseif ($nbofsalesrepresentative > 0) {
2347 foreach ($listsalesrepresentatives as $val) {
2348 $userstatic->id = $val[
'id'];
2349 $userstatic->lastname = $val[
'lastname'];
2350 $userstatic->firstname = $val[
'firstname'];
2351 $userstatic->email = $val[
'email'];
2352 $userstatic->statut = $val[
'statut'];
2353 $userstatic->entity = $val[
'entity'];
2354 $userstatic->photo = $val[
'photo'];
2355 $userstatic->login = $val[
'login'];
2356 $userstatic->office_phone = $val[
'office_phone'];
2357 $userstatic->office_fax = $val[
'office_fax'];
2358 $userstatic->user_mobile = $val[
'user_mobile'];
2359 $userstatic->job = $val[
'job'];
2360 $userstatic->gender = $val[
'gender'];
2362 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2364 if ($j < $nbofsalesrepresentative) {
2376 $totalarray[
'nbfield']++;
2380 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2381 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2383 $totalarray[
'nbfield']++;
2387 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2388 print
'<td class="right nowraponall amount">'.(!empty($totalallpayments) ?
price($totalallpayments, 0, $langs) :
' ').
'</td>';
2390 $totalarray[
'nbfield']++;
2393 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'dynamount_payed';
2395 $totalarray[
'val'][
'dynamount_payed'] += $totalallpayments;
2399 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2400 print
'<td class="right nowraponall amount">';
2401 print (!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2404 $totalarray[
'nbfield']++;
2407 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2409 $totalarray[
'val'][
'rtp'] += $remaintopay;
2414 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2415 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2416 if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) {
2417 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2423 $totalarray[
'nbfield']++;
2428 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2429 print
'<td class="nowraponall">';
2430 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2433 $totalarray[
'nbfield']++;
2437 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2438 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2440 $totalarray[
'nbfield']++;
2444 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2445 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2447 $totalarray[
'nbfield']++;
2451 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2452 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2454 $totalarray[
'nbfield']++;
2457 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2458 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2460 $totalarray[
'nbfield']++;
2465 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2466 print
'<td class="right nowraponall">';
2467 print (!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2470 $totalarray[
'nbfield']++;
2475 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2476 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2478 $totalarray[
'nbfield']++;
2479 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2481 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2484 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2485 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2487 $totalarray[
'nbfield']++;
2488 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2490 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2493 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2494 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2496 $totalarray[
'nbfield']++;
2500 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2501 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2503 $totalarray[
'nbfield']++;
2504 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2506 if ($i >= $imaxinloop - 1) {
2507 if (!empty($total_ht)) {
2508 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2510 $totalarray[
'val'][
'total_mark_rate'] =
'';
2516 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2518 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2519 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2520 print $hookmanager->resPrint;
2522 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2523 print
'<td class="nowraponall center">';
2524 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2527 $totalarray[
'nbfield']++;
2531 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2532 print
'<td class="nowraponall center">';
2533 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2536 $totalarray[
'nbfield']++;
2540 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2541 print
'<td class="nowraponall center">';
2542 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2545 $totalarray[
'nbfield']++;
2549 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2550 print
'<td class="center">';
2554 $totalarray[
'nbfield']++;
2558 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2559 print
'<td class="center">';
2563 $totalarray[
'nbfield']++;
2567 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2568 print
'<td class="center">';
2569 if (!empty($obj->fk_fac_rec_source)) {
2571 $result = $facrec->fetch($obj->fk_fac_rec_source);
2575 print $facrec->getNomUrl();
2580 $totalarray[
'nbfield']++;
2584 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2585 print
'<td class="nowrap right">';
2586 print $facturestatic->getLibStatut(5, $totalallpayments);
2589 $totalarray[
'nbfield']++;
2595 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2596 print
'<td class="nowrap center">';
2597 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2599 if (in_array($obj->id, $arrayofselected)) {
2602 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2606 $totalarray[
'nbfield']++;
2617 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2618 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2621 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2627 foreach ($arrayfields as $key => $val) {
2628 if (!empty($val[
'checked'])) {
2632 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2637 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2638 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2639 print $hookmanager->resPrint;
2641 print
'</table>'.
"\n";
2642 print
'</div>'.
"\n";
2644 print
'</form>'.
"\n";
2647 if ($contextpage !=
'poslist') {
2648 $hidegeneratedfilelistifempty = 1;
2649 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2650 $hidegeneratedfilelistifempty = 0;
2654 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2655 $urlsource .= str_replace(
'&',
'&', $param);
2657 $filedir = $diroutputmassaction;
2658 $genallowed = $user->hasRight(
"facture",
"lire");
2659 $delallowed = $user->hasRight(
"facture",
"creer");
2662 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return 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...
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.