39 require
'../../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
47 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
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';
79 if ($contextpage ==
'poslist') {
83 $lineid =
GETPOST(
'lineid',
'int');
84 $userid =
GETPOST(
'userid',
'int');
86 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
87 $search_type =
GETPOST(
'search_type',
'int');
88 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
89 $search_project =
GETPOST(
'search_project',
'alpha');
90 $search_company =
GETPOST(
'search_company',
'alpha');
91 $search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
92 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
93 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
94 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
95 $search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
96 $search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
97 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
98 $search_login =
GETPOST(
'search_login',
'alpha');
99 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
100 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
101 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
102 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
103 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
104 $search_status =
GETPOST(
'search_status',
'intcomma');
105 $search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
106 $search_paymentterms =
GETPOST(
'search_paymentterms',
'int');
107 $search_module_source =
GETPOST(
'search_module_source',
'alpha');
108 $search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
109 $search_town =
GETPOST(
'search_town',
'alpha');
110 $search_zip =
GETPOST(
'search_zip',
'alpha');
111 $search_state =
GETPOST(
"search_state");
112 $search_country =
GETPOST(
"search_country",
'alpha');
113 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
114 $search_user =
GETPOST(
'search_user',
'int');
115 $search_sale =
GETPOST(
'search_sale',
'int');
116 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
117 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
118 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
119 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
120 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
121 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
122 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
123 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
124 $search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
125 $search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
126 $search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
127 $search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
128 $search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
129 $search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
130 $search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
131 $search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
132 $search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
133 $search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
134 $search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
135 $search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
136 $search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
137 $search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
138 $search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
139 $search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
140 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
141 $search_product_category =
GETPOST(
'search_product_category',
'int');
142 $search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
143 $search_btn =
GETPOST(
'button_search',
'alpha');
144 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
146 $option =
GETPOST(
'search_option');
147 if ($option ==
'late') {
148 $search_status =
'1';
150 $filtre =
GETPOST(
'filtre',
'alpha');
152 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
153 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
154 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
156 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159 $offset = $limit * $page;
160 if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status ==
'1') {
161 $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
167 $sortfield =
'f.datef';
169 $pageprev = $page - 1;
170 $pagenext = $page + 1;
173 $fieldid = (!empty($ref) ?
'ref' :
'rowid');
174 if (!empty($user->socid)) {
175 $socid = $user->socid;
177 $result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
179 $diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
188 $hookmanager->initHooks(array(
'invoicelist'));
192 $extrafields->fetch_name_optionals_label($object->table_element);
194 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
197 $fieldstosearchall = array(
199 'f.ref_client'=>
'RefCustomer',
200 'f.note_public'=>
'NotePublic',
201 's.nom'=>
"ThirdParty",
202 's.name_alias'=>
"AliasNameShort",
205 'pd.description'=>
'Description',
207 if (empty($user->socid)) {
208 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
211 $checkedtypetiers = 0;
212 $arrayfields = array(
213 'f.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
214 'f.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1,
'position'=>10),
215 'f.type'=>array(
'label'=>
"Type",
'checked'=>0,
'position'=>15),
216 'f.datef'=>array(
'label'=>
"DateInvoice",
'checked'=>1,
'position'=>20),
217 'f.date_valid'=>array(
'label'=>
"DateValidation",
'checked'=>0,
'position'=>22),
218 'f.date_lim_reglement'=>array(
'label'=>
"DateDue",
'checked'=>1,
'position'=>25),
219 'f.date_closing'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>30),
220 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>40),
221 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>41),
222 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>50),
223 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>1,
'position'=>51),
224 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
225 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>55),
226 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1,
'position'=>60),
227 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>65),
228 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>70),
229 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>75),
230 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>1,
'position'=>80),
231 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>1,
'position'=>85),
232 'f.module_source'=>array(
'label'=>
"POSModule",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1),
'position'=>90),
233 'f.pos_source'=>array(
'label'=>
"POSTerminal",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1),
'position'=>91),
234 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>95),
235 'f.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>100),
236 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax1_assuj ==
"1"),
'position'=>110),
237 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax2_assuj ==
"1"),
'position'=>120),
238 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>130),
239 'dynamount_payed'=>array(
'label'=>
"Received",
'checked'=>0,
'position'=>140),
240 'rtp'=>array(
'label'=>
"Rest",
'checked'=>0,
'position'=>150),
241 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>280),
242 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>285),
243 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>290),
244 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>291),
245 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>292),
246 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>295),
247 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>296),
248 '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)),
249 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
250 '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)),
251 '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)),
252 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
253 'f.tms' =>array(
'type'=>
'timestamp',
'label'=>
'DateModificationShort',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>502),
254 'u.login'=>array(
'label'=>
"UserAuthor",
'checked'=>1,
'position'=>504),
255 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>506),
260 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>520,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
261 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>521,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
262 'f.fk_fac_rec_source'=>array(
'label'=>
'GeneratedFromTemplate',
'checked'=>0,
'position'=>530,
'enabled'=>
'1'),
263 'f.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
266 if (
getDolGlobalString(
"INVOICE_USE_SITUATION") && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
267 $arrayfields[
'f.retained_warranty'] = array(
'label'=>$langs->trans(
"RetainedWarranty"),
'checked'=>0,
'position'=>86);
270 foreach ($object->fields as $key => $val) {
273 if (!empty($val[
'visible'])) {
274 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
276 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; }
278 $arrayfields[$newkey] = array(
279 'label'=>$val[
'label'],
280 'checked'=>(($visible < 0) ? 0 : 1),
281 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
282 'position'=>$val[
'position'],
283 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
289 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
299 if (
GETPOST(
'cancel',
'alpha')) {
303 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
307 $parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
308 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
313 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
316 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
319 $search_product_category =
'';
321 $search_refcustomer =
'';
323 $search_project_ref =
'';
324 $search_project =
'';
325 $search_company =
'';
326 $search_company_alias =
'';
327 $search_parent_name =
'';
328 $search_montant_ht =
'';
329 $search_montant_vat =
'';
330 $search_montant_localtax1 =
'';
331 $search_montant_localtax2 =
'';
332 $search_montant_ttc =
'';
334 $search_multicurrency_code =
'';
335 $search_multicurrency_tx =
'';
336 $search_multicurrency_montant_ht =
'';
337 $search_multicurrency_montant_vat =
'';
338 $search_multicurrency_montant_ttc =
'';
340 $search_paymentmode =
'';
341 $search_paymentterms =
'';
342 $search_module_source =
'';
343 $search_pos_source =
'';
347 $search_country =
'';
348 $search_type_thirdparty =
'';
349 $search_date_startday =
'';
350 $search_date_startmonth =
'';
351 $search_date_startyear =
'';
352 $search_date_endday =
'';
353 $search_date_endmonth =
'';
354 $search_date_endyear =
'';
355 $search_date_start =
'';
356 $search_date_end =
'';
357 $search_date_valid_startday =
'';
358 $search_date_valid_startmonth =
'';
359 $search_date_valid_startyear =
'';
360 $search_date_valid_endday =
'';
361 $search_date_valid_endmonth =
'';
362 $search_date_valid_endyear =
'';
363 $search_date_valid_start =
'';
364 $search_date_valid_end =
'';
365 $search_datelimit_startday =
'';
366 $search_datelimit_startmonth =
'';
367 $search_datelimit_startyear =
'';
368 $search_datelimit_endday =
'';
369 $search_datelimit_endmonth =
'';
370 $search_datelimit_endyear =
'';
371 $search_datelimit_start =
'';
372 $search_datelimit_end =
'';
373 $search_fac_rec_source_title =
'';
375 $search_array_options = array();
376 $search_categ_cus = 0;
381 if (empty($reshook)) {
382 $objectclass =
'Facture';
383 $objectlabel =
'Invoices';
384 $permissiontoread = $user->hasRight(
"facture",
"lire");
385 $permissiontoadd = $user->hasRight(
"facture",
"creer");
386 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
387 $uploaddir = $conf->facture->dir_output;
388 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
391 if ($action ==
'makepayment_confirm' && !empty($user->rights->facture->paiement)) {
392 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
393 $arrayofselected = is_array($toselect) ? $toselect : array();
394 if (!empty($arrayofselected)) {
395 $bankid =
GETPOST(
'bankid',
'int');
396 $paiementid =
GETPOST(
'paiementid',
'int');
398 if (empty($paiementdate)) {
399 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
401 $action =
'makepayment';
405 foreach ($arrayofselected as $toselectid) {
408 $result = $facture->fetch($toselectid);
417 $paiementAmount = $facture->getSommePaiement();
418 $totalcreditnotes = $facture->getSumCreditNotesUsed();
419 $totaldeposits = $facture->getSumDepositsUsed();
420 $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
421 $remaintopay =
price2num($facture->total_ttc - $totalpay);
422 if ($remaintopay != 0) {
423 $resultBank = $facture->setBankAccount($bankid);
424 if ($resultBank < 0) {
429 $paiement->datepaye = $paiementdate;
430 $paiement->amounts[$facture->id] = $remaintopay;
431 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
432 $paiement->paiementid = $paiementid;
433 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
434 if ($paiement_id < 0) {
435 $langs->load(
"errors");
436 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
439 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
441 $langs->load(
"errors");
442 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
448 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
452 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
457 if (empty($errorpayment)) {
458 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
466 } elseif ($massaction ==
'withdrawrequest') {
467 $langs->load(
"withdrawals");
469 if (!$user->rights->prelevement->bons->creer) {
476 $arrayofselected = is_array($toselect) ? $toselect : array();
477 $listofbills = array();
478 foreach ($arrayofselected as $toselectid) {
480 $result = $objecttmp->fetch($toselectid);
482 $totalpaid = $objecttmp->getSommePaiement();
483 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
484 $totaldeposits = $objecttmp->getSumDepositsUsed();
485 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
488 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
489 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
491 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
492 } elseif ($objecttmp->resteapayer < 0) {
494 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
497 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
498 $rsql .=
" , pfd.date_traite as date_traite";
499 $rsql .=
" , pfd.amount";
500 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
501 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
502 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
503 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
504 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
505 $rsql .=
" AND pfd.traite = 0";
506 $rsql .=
" ORDER BY pfd.date_demande DESC";
508 $result_sql = $db->query($rsql);
510 $numprlv = $db->num_rows($result_sql);
515 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
516 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
518 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
520 $listofbills[] = $objecttmp;
526 if (!empty($listofbills)) {
527 $nbwithdrawrequestok = 0;
528 foreach ($listofbills as $aBill) {
530 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
533 $nbwithdrawrequestok++;
539 if ($nbwithdrawrequestok > 0) {
540 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
559 $bankaccountstatic =
new Account($db);
560 $facturestatic =
new Facture($db);
562 $companystatic =
new Societe($db);
563 $companyparent =
new Societe($db);
564 $company_url_list = array();
566 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
567 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
570 if ($sall || $search_user > 0) {
571 $sql =
'SELECT DISTINCT';
573 $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,';
574 $sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
575 $sql .=
' f.fk_user_author,';
576 $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,';
577 $sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
578 $sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
579 $sql .=
' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
580 $sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
581 $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,';
582 $sql .=
" s.parent as fk_parent,";
583 $sql .=
" s2.nom as name2,";
584 $sql .=
' typent.code as typent_code,';
585 $sql .=
' state.code_departement as state_code, state.nom as state_name,';
586 $sql .=
' country.code as country_code,';
587 $sql .=
' f.fk_fac_rec_source,';
588 $sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
589 $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';
599 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
600 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
601 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
605 $parameters = array();
606 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
607 $sql .= $hookmanager->resPrint;
611 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
612 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
613 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
614 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
615 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
616 $sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
617 if ($sortfield ==
"f.datef") {
618 $sql .= $db->hintindex(
'idx_facture_datef');
620 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
621 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
631 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid=pd.fk_facture';
633 if (!empty($search_fac_rec_source_title)) {
634 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source=facrec.rowid';
636 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
637 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
639 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
640 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
642 if ($search_user > 0) {
643 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
644 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
647 $parameters = array();
648 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
649 $sql .= $hookmanager->resPrint;
651 $sql .=
' WHERE f.fk_soc = s.rowid';
652 $sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
653 if (empty($user->rights->societe->client->voir) && !$socid) {
654 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
657 $sql .=
' AND s.rowid = '.((int) $socid);
661 $sql .=
' AND f.fk_user_author IS NULL';
663 $sql .=
' AND f.fk_user_author = '.((int) $userid);
669 if ($search_refcustomer) {
672 if ($search_type !=
'' && $search_type !=
'-1') {
673 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
675 if ($search_project_ref) {
678 if ($search_project) {
681 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
682 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
684 if ($search_company) {
687 if ($search_company_alias) {
691 if ($search_parent_name) {
703 if (strlen(trim($search_country))) {
705 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
706 foreach ($arrayofcode as $key => $value) {
707 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
708 if ($value != $mysoc->country_code) {
709 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
712 if ($search_country ==
'special_allnotme') {
713 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
714 } elseif ($search_country ==
'special_eec') {
715 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
716 } elseif ($search_country ==
'special_eecnotme') {
717 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
718 } elseif ($search_country ==
'special_noteec') {
719 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
724 if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
725 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
727 if ($search_montant_ht !=
'') {
730 if ($search_montant_vat !=
'') {
733 if ($search_montant_localtax1 !=
'') {
734 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
736 if ($search_montant_localtax2 !=
'') {
737 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
739 if ($search_montant_ttc !=
'') {
742 if ($search_multicurrency_code !=
'') {
743 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
745 if ($search_multicurrency_tx !=
'') {
746 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
748 if ($search_multicurrency_montant_ht !=
'') {
749 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
751 if ($search_multicurrency_montant_vat !=
'') {
752 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
754 if ($search_multicurrency_montant_ttc !=
'') {
755 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
758 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
760 if ($search_status !=
'-1' && $search_status !=
'') {
761 if (is_numeric($search_status) && $search_status >= 0) {
762 if ($search_status ==
'0') {
763 $sql .=
" AND f.fk_statut = 0";
765 if ($search_status ==
'1') {
766 $sql .=
" AND f.fk_statut = 1";
768 if ($search_status ==
'2') {
769 $sql .=
" AND f.fk_statut = 2";
771 if ($search_status ==
'3') {
772 $sql .=
" AND f.fk_statut = 3";
775 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
779 if ($search_paymentmode > 0) {
780 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
782 if ($search_paymentterms > 0) {
783 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
785 if ($search_module_source) {
788 if ($search_pos_source) {
791 if ($search_date_start) {
792 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
794 if ($search_date_end) {
795 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
797 if ($search_date_valid_start) {
798 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
800 if ($search_date_valid_end) {
801 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
803 if ($search_datelimit_start) {
804 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
806 if ($search_datelimit_end) {
807 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
809 if ($option ==
'late') {
810 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
812 if ($search_sale > 0) {
813 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
815 if ($search_user > 0) {
816 $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);
818 if (!empty($search_fac_rec_source_title)) {
819 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
822 $searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
823 $searchCategoryProductOperator = 0;
824 if (!empty($searchCategoryProductList)) {
825 $searchCategoryProductSqlList = array();
826 $listofcategoryid =
'';
827 foreach ($searchCategoryProductList as $searchCategoryProduct) {
828 if (intval($searchCategoryProduct) == -2) {
829 $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)";
830 } elseif (intval($searchCategoryProduct) > 0) {
831 if ($searchCategoryProductOperator == 0) {
832 $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).
")";
834 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
838 if ($listofcategoryid) {
839 $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).
"))";
841 if ($searchCategoryProductOperator == 1) {
842 if (!empty($searchCategoryProductSqlList)) {
843 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
846 if (!empty($searchCategoryProductSqlList)) {
847 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
851 $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();;
852 $searchCategoryCustomerOperator = 0;
854 if (!empty($searchCategoryCustomerList)) {
855 $searchCategoryCustomerSqlList = array();
856 $listofcategoryid =
'';
857 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
858 if (intval($searchCategoryCustomer) == -2) {
859 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
860 } elseif (intval($searchCategoryCustomer) > 0) {
861 if ($searchCategoryCustomerOperator == 0) {
862 $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).
")";
864 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
868 if ($listofcategoryid) {
869 $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).
"))";
871 if ($searchCategoryCustomerOperator == 1) {
872 if (!empty($searchCategoryCustomerSqlList)) {
873 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
876 if (!empty($searchCategoryCustomerSqlList)) {
877 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
882 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
884 $parameters = array();
885 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
886 $sql .= $hookmanager->resPrint;
925 $parameters = array();
926 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
927 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
931 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
933 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
934 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
936 $resql = $db->query($sqlforcount);
938 $objforcount = $db->fetch_object(
$resql);
952 $sql .= $db->order($sortfield, $sortorder);
954 $sql .= $db->plimit($limit + 1, $offset);
957 $resql = $db->query($sql);
960 $num = $db->num_rows(
$resql);
962 $arrayofselected = is_array($toselect) ? $toselect : array();
964 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
965 $obj = $db->fetch_object(
$resql);
968 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$id);
972 llxHeader(
'', $langs->trans(
'CustomersInvoices'),
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
977 if (empty($search_company)) {
978 $search_company = $soc->name;
982 $param =
'&socid='.urlencode($socid);
983 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
984 $param .=
'&contextpage='.urlencode($contextpage);
986 if ($limit > 0 && $limit != $conf->liste_limit) {
987 $param .=
'&limit='.urlencode($limit);
990 $param .=
'&sall='.urlencode($sall);
992 if ($search_date_startday) {
993 $param .=
'&search_date_startday='.urlencode($search_date_startday);
995 if ($search_date_startmonth) {
996 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
998 if ($search_date_startyear) {
999 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
1001 if ($search_date_endday) {
1002 $param .=
'&search_date_endday='.urlencode($search_date_endday);
1004 if ($search_date_endmonth) {
1005 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
1007 if ($search_date_endyear) {
1008 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
1010 if ($search_date_valid_startday) {
1011 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
1013 if ($search_date_valid_startmonth) {
1014 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
1016 if ($search_date_valid_startyear) {
1017 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
1019 if ($search_date_valid_endday) {
1020 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
1022 if ($search_date_valid_endmonth) {
1023 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
1025 if ($search_date_valid_endyear) {
1026 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
1028 if ($search_datelimit_startday) {
1029 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
1031 if ($search_datelimit_startmonth) {
1032 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
1034 if ($search_datelimit_startyear) {
1035 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
1037 if ($search_datelimit_endday) {
1038 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
1040 if ($search_datelimit_endmonth) {
1041 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
1043 if ($search_datelimit_endyear) {
1044 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
1047 $param .=
'&search_ref='.urlencode($search_ref);
1049 if ($search_refcustomer) {
1050 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1052 if ($search_project_ref) {
1053 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1055 if ($search_project) {
1056 $param .=
'&search_project='.urlencode($search_project);
1058 if ($search_type !=
'') {
1059 $param .=
'&search_type='.urlencode($search_type);
1061 if ($search_company) {
1062 $param .=
'&search_company='.urlencode($search_company);
1064 if ($search_company_alias) {
1065 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1067 if ($search_parent_name !=
'') {
1068 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1071 $param .=
'&search_town='.urlencode($search_town);
1074 $param .=
'&search_zip='.urlencode($search_zip);
1076 if ($search_country) {
1077 $param .=
"&search_country=".urlencode($search_country);
1079 if ($search_type_thirdparty !=
'') {
1080 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1082 if ($search_sale > 0) {
1083 $param .=
'&search_sale='.urlencode($search_sale);
1085 if ($search_user > 0) {
1086 $param .=
'&search_user='.urlencode($search_user);
1088 if ($search_login) {
1089 $param .=
'&search_login='.urlencode($search_login);
1091 if ($search_product_category > 0) {
1092 $param .=
'&search_product_category='.urlencode($search_product_category);
1094 if ($search_montant_ht !=
'') {
1095 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1097 if ($search_montant_vat !=
'') {
1098 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1100 if ($search_montant_localtax1 !=
'') {
1101 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1103 if ($search_montant_localtax2 !=
'') {
1104 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1106 if ($search_montant_ttc !=
'') {
1107 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1109 if ($search_multicurrency_code !=
'') {
1110 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1112 if ($search_multicurrency_tx !=
'') {
1113 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1115 if ($search_multicurrency_montant_ht !=
'') {
1116 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1118 if ($search_multicurrency_montant_vat !=
'') {
1119 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1121 if ($search_multicurrency_montant_ttc !=
'') {
1122 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1124 if ($search_status !=
'') {
1125 $param .=
'&search_status='.urlencode($search_status);
1127 if ($search_paymentmode > 0) {
1128 $param .=
'&search_paymentmode='.urlencode($search_paymentmode);
1130 if ($search_paymentterms > 0) {
1131 $param .=
'&search_paymentterms='.urlencode($search_paymentterms);
1133 if ($search_module_source) {
1134 $param .=
'&search_module_source='.urlencode($search_module_source);
1136 if ($search_pos_source) {
1137 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1140 $param .=
'&show_files='.urlencode($show_files);
1143 $param .=
"&search_option=".urlencode($option);
1145 if ($optioncss !=
'') {
1146 $param .=
'&optioncss='.urlencode($optioncss);
1148 if ($search_categ_cus > 0) {
1149 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1151 if (!empty($search_fac_rec_source_title)) {
1152 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1156 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1158 $parameters = array();
1159 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1160 $param .= $hookmanager->resPrint;
1162 $arrayofmassactions = array(
1163 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1164 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1165 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1166 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1169 if (!empty($user->rights->facture->paiement)) {
1170 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1172 if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
1173 $langs->load(
"withdrawals");
1174 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1176 if (!empty($user->rights->facture->supprimer)) {
1177 if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
1178 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1179 } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) {
1180 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1183 if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1184 $arrayofmassactions = array();
1186 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1189 $newcardbutton =
'';
1190 if ($contextpage !=
'poslist') {
1191 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1192 if (!empty($socid)) {
1193 $url .=
'&socid='.$socid;
1195 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1199 print
'<form method="POST" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1201 if ($optioncss !=
'') {
1202 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1204 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1205 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1206 if (!in_array($massaction, array(
'makepayment'))) {
1207 print
'<input type="hidden" name="action" value="list">';
1209 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1210 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1211 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1212 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1213 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1215 print_barre_liste($langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' '.$soc->name :
''), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1217 $topicmail =
"SendBillRef";
1218 $modelmail =
"facture_send";
1219 $objecttmp =
new Facture($db);
1220 $trackid =
'inv'.$object->id;
1221 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1223 if ($massaction ==
'makepayment') {
1225 $formquestion = array(
1229 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1230 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' =>
$form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1231 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value'=>
$form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1234 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1239 foreach ($fieldstosearchall as $key => $val) {
1240 $fieldstosearchall[$key] = $langs->trans($val);
1242 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1246 $moreforfilter =
'';
1247 if ($user->hasRight(
"user",
"user",
"lire")) {
1248 $langs->load(
"commercial");
1249 $moreforfilter .=
'<div class="divsearchfield">';
1250 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1251 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250');
1252 $moreforfilter .=
'</div>';
1255 if ($user->hasRight(
"user",
"user",
"lire")) {
1256 $moreforfilter .=
'<div class="divsearchfield">';
1257 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1258 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
1259 $moreforfilter .=
'</div>';
1262 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1263 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1264 $moreforfilter .=
'<div class="divsearchfield">';
1265 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1266 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1267 $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);
1268 $moreforfilter .=
'</div>';
1270 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1271 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1272 $moreforfilter .=
'<div class="divsearchfield">';
1273 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1274 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1275 $moreforfilter .=
'</div>';
1277 $parameters = array();
1278 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1279 if (empty($reshook)) {
1280 $moreforfilter .= $hookmanager->resPrint;
1282 $moreforfilter = $hookmanager->resPrint;
1285 if ($moreforfilter) {
1286 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1287 print $moreforfilter;
1291 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1292 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1295 if ($massactionbutton && $contextpage !=
'poslist') {
1296 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
1299 print
'<div class="div-table-responsive">';
1300 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1303 print
'<tr class="liste_titre_filter">';
1305 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1307 print
'<td class="liste_titre center actioncolumn">';
1308 $searchpicto =
$form->showFilterButtons(
'left');
1313 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1314 print
'<td class="liste_titre">';
1318 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1319 print
'<td class="liste_titre" align="left">';
1320 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1324 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1325 print
'<td class="liste_titre">';
1326 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1330 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1331 print
'<td class="liste_titre maxwidthonsmartphone">';
1338 if (!empty($conf->global->INVOICE_USE_SITUATION)) {
1342 print
$form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1346 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1347 print
'<td class="liste_titre center">';
1348 print
'<div class="nowrap">';
1349 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1351 print
'<div class="nowrap">';
1352 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1357 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1358 print
'<td class="liste_titre center">';
1359 print
'<div class="nowrap">';
1360 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'));
1362 print
'<div class="nowrap">';
1363 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'));
1368 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1369 print
'<td class="liste_titre center">';
1370 print
'<div class="nowrap">';
1377 print
$form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1378 print
'<br><input type="checkbox" name="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'> '.$langs->trans(
"Alert");
1383 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1384 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1387 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1388 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.
'"></td>';
1391 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1392 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.$search_company.
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1395 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1396 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1399 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1405 if (!empty($arrayfields[
's.town'][
'checked'])) {
1406 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1409 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1410 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1413 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1414 print
'<td class="liste_titre">';
1415 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1419 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1420 print
'<td class="liste_titre" align="center">';
1421 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1425 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1426 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1427 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);
1431 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1432 print
'<td class="liste_titre">';
1433 print
$form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1437 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1438 print
'<td class="liste_titre">';
1439 print
$form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1443 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1444 print
'<td class="liste_titre">';
1445 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1449 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1450 print
'<td class="liste_titre">';
1451 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1454 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1456 print
'<td class="liste_titre right">';
1457 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1460 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1462 print
'<td class="liste_titre right">';
1463 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1466 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1468 print
'<td class="liste_titre right">';
1469 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.$search_montant_localtax1.
'">';
1472 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1474 print
'<td class="liste_titre right">';
1475 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.$search_montant_localtax2.
'">';
1478 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1480 print
'<td class="liste_titre right">';
1481 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1484 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1486 print
'<td class="liste_titre" align="center">';
1487 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1490 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1491 print
'<td class="liste_titre"></td>';
1493 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1494 print
'<td class="liste_titre" align="right">';
1497 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1498 print
'<td class="liste_titre right">';
1501 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1502 print
'<td class="liste_titre right">';
1505 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1507 print
'<td class="liste_titre">';
1508 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1511 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1513 print
'<td class="liste_titre">';
1514 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1517 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1519 print
'<td class="liste_titre right">';
1520 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1523 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1525 print
'<td class="liste_titre right">';
1526 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1529 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1531 print
'<td class="liste_titre right">';
1532 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1535 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1536 print
'<td class="liste_titre">';
1539 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1540 print
'<td class="liste_titre right">';
1543 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1544 print
'<td class="liste_titre right">';
1547 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1548 print
'<td class="liste_titre right">';
1551 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1552 print
'<td class="liste_titre right">';
1555 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1556 print
'<td class="liste_titre right">';
1561 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1564 $parameters = array(
'arrayfields'=>$arrayfields);
1565 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1566 print $hookmanager->resPrint;
1568 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1569 print
'<td class="liste_titre">';
1573 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1574 print
'<td class="liste_titre">';
1578 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1579 print
'<td class="liste_titre">';
1582 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1584 print
'<td class="liste_titre">';
1587 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1589 print
'<td class="liste_titre">';
1592 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1594 print
'<td class="liste_titre maxwidthonsmartphone right">';
1595 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).
'">';
1599 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1600 print
'<td class="liste_titre maxwidthonsmartphone right">';
1601 $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"));
1602 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage', 1);
1606 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1607 print
'<td class="liste_titre center actioncolumn">';
1608 $searchpicto =
$form->showFilterButtons();
1614 print
'<tr class="liste_titre">';
1616 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1617 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1620 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1623 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1624 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1626 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1627 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1629 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1630 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1632 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1633 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'align="center"', $sortfield, $sortorder);
1635 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1636 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'align="center"', $sortfield, $sortorder);
1638 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1639 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'align="center"', $sortfield, $sortorder);
1641 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1642 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1644 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1645 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1647 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1648 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1650 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1651 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1653 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1654 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1656 if (!empty($arrayfields[
's.town'][
'checked'])) {
1657 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1659 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1660 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1662 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1663 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1665 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1666 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'align="center"', $sortfield, $sortorder);
1668 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1669 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'align="center"', $sortfield, $sortorder);
1671 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1672 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1674 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1675 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1677 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1678 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1680 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1681 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1683 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1686 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1687 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1689 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1690 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'class="right"', $sortfield, $sortorder);
1692 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1693 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'class="right"', $sortfield, $sortorder);
1695 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1698 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1701 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1702 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1704 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1705 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'align="right"', $sortfield, $sortorder);
1707 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1708 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1710 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1713 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1714 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1716 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1717 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1719 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1722 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1725 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1728 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1731 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1732 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1734 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1737 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1738 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1740 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1741 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1743 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1747 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1749 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1750 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1751 print $hookmanager->resPrint;
1752 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1755 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1756 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1758 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1761 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1762 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1764 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1767 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1768 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1770 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1771 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'class="right"', $sortfield, $sortorder);
1773 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1774 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1779 $projectstatic =
new Project($db);
1781 $userstatic =
new User($db);
1785 $typenArray = $formcompany->typent_array(1);
1786 $totalarray = array();
1787 $totalarray[
'nbfield'] = 0;
1788 $totalarray[
'val'] = array();
1789 $totalarray[
'val'][
'f.total_tva'] = 0;
1790 $totalarray[
'val'][
'f.total_ht'] = 0;
1791 $totalarray[
'val'][
'f.total_ttc'] = 0;
1793 $with_margin_info =
false;
1795 !empty($arrayfields[
'total_pa'][
'checked'])
1796 || !empty($arrayfields[
'total_margin'][
'checked'])
1797 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1798 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1801 $with_margin_info =
true;
1806 $savnbfield = $totalarray[
'nbfield'];
1807 $totalarray[
'nbfield'] = 0;
1808 $imaxinloop = ($limit ? min($num, $limit) : $num);
1809 while ($i < $imaxinloop) {
1810 $obj = $db->fetch_object(
$resql);
1812 $datelimit = $db->jdate($obj->datelimite);
1814 $facturestatic->id = $obj->id;
1815 $facturestatic->ref = $obj->ref;
1816 $facturestatic->ref_client = $obj->ref_client;
1817 $facturestatic->type = $obj->type;
1818 $facturestatic->total_ht = $obj->total_ht;
1819 $facturestatic->total_tva = $obj->total_tva;
1820 $facturestatic->total_ttc = $obj->total_ttc;
1821 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1822 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1823 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1824 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1825 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1826 $facturestatic->statut = $obj->fk_statut;
1827 $facturestatic->status = $obj->fk_statut;
1828 $facturestatic->close_code = $obj->close_code;
1829 $facturestatic->total_ttc = $obj->total_ttc;
1830 $facturestatic->paye = $obj->paye;
1831 $facturestatic->socid = $obj->fk_soc;
1833 $facturestatic->date = $db->jdate($obj->datef);
1834 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1835 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1837 $facturestatic->note_public = $obj->note_public;
1838 $facturestatic->note_private = $obj->note_private;
1840 if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
1841 $facturestatic->retained_warranty = $obj->retained_warranty;
1842 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1843 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1844 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1845 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1846 $facturestatic->situation_counter = $obj->situation_counter;
1849 $companystatic->id = $obj->socid;
1850 $companystatic->name = $obj->name;
1851 $companystatic->name_alias = $obj->alias;
1852 $companystatic->client = $obj->client;
1853 $companystatic->fournisseur = $obj->fournisseur;
1854 $companystatic->code_client = $obj->code_client;
1855 $companystatic->code_compta_client = $obj->code_compta_client;
1856 $companystatic->code_fournisseur = $obj->code_fournisseur;
1857 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1858 $companystatic->email = $obj->email;
1859 $companystatic->phone = $obj->phone;
1860 $companystatic->fax = $obj->fax;
1861 $companystatic->address = $obj->address;
1862 $companystatic->zip = $obj->zip;
1863 $companystatic->town = $obj->town;
1864 $companystatic->country_code = $obj->country_code;
1866 $projectstatic->id = $obj->project_id;
1867 $projectstatic->ref = $obj->project_ref;
1868 $projectstatic->title = $obj->project_label;
1870 $paiement = $facturestatic->getSommePaiement();
1871 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1872 $totaldeposits = $facturestatic->getSumDepositsUsed();
1874 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1875 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1876 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1878 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1879 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1881 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1882 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1886 $multicurrency_remaintopay = 0;
1889 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
1890 $remaintopay = -$remaincreditnote;
1891 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1892 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1893 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1894 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1897 $facturestatic->alreadypaid = $paiement;
1899 $marginInfo = array();
1900 if ($with_margin_info ===
true) {
1901 $facturestatic->fetch_lines();
1902 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
1903 $total_ht += $obj->total_ht;
1904 $total_margin += $marginInfo[
'total_margin'];
1907 print
'<tr class="oddeven"';
1908 if ($contextpage ==
'poslist') {
1909 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
1910 if (strpos($obj->ref, 'PROV
') !== false) {
1911 //If is a draft invoice, load var to be able to add products
1912 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
1913 print 'parent.place=\
''.$place.
'\'';
1922 print
'<td class="nowrap center">';
1923 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1925 if (in_array($obj->id, $arrayofselected)) {
1928 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1932 $totalarray[
'nbfield']++;
1937 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1938 print
'<td>'.(($offset * $limit) + $i).
'</td>';
1942 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1943 print
'<td class="nowraponall">';
1945 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1947 print
'<td class="nobordernopadding nowraponall">';
1948 if ($contextpage ==
'poslist') {
1951 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
1956 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
1957 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
1964 $totalarray[
'nbfield']++;
1969 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1970 print
'<td class="nowrap tdoverflowmax200">';
1974 $totalarray[
'nbfield']++;
1979 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1980 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
1981 print $facturestatic->getLibType(2);
1984 $totalarray[
'nbfield']++;
1989 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1990 print
'<td align="center" class="nowraponall">';
1994 $totalarray[
'nbfield']++;
1999 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2000 print
'<td align="center" class="nowraponall">';
2004 $totalarray[
'nbfield']++;
2009 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2010 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2011 if ($facturestatic->hasDelay()) {
2012 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2016 $totalarray[
'nbfield']++;
2021 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2022 print
'<td class="nocellnopadd nowraponall">';
2023 if ($obj->project_id > 0) {
2024 print $projectstatic->getNomUrl(1);
2028 $totalarray[
'nbfield']++;
2033 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2034 print
'<td class="nowraponall">';
2035 if ($obj->project_id > 0) {
2040 $totalarray[
'nbfield']++;
2045 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2046 print
'<td class="tdoverflowmax200">';
2047 if ($contextpage ==
'poslist') {
2050 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2054 $totalarray[
'nbfield']++;
2058 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2059 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2063 $totalarray[
'nbfield']++;
2067 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2068 print
'<td class="tdoverflowmax200">';
2069 if ($obj->fk_parent > 0) {
2070 if (!isset($company_url_list[$obj->fk_parent])) {
2071 $companyparent =
new Societe($db);
2072 $res = $companyparent->fetch($obj->fk_parent);
2074 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2077 if (isset($company_url_list[$obj->fk_parent])) {
2078 print $company_url_list[$obj->fk_parent];
2083 $totalarray[
'nbfield']++;
2087 if (!empty($arrayfields[
's.town'][
'checked'])) {
2088 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2092 $totalarray[
'nbfield']++;
2096 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2097 print
'<td class="nowraponall">';
2101 $totalarray[
'nbfield']++;
2105 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2106 print
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
2108 $totalarray[
'nbfield']++;
2112 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2113 print
'<td class="center">';
2114 $tmparray =
getCountry($obj->fk_pays,
'all');
2115 print $tmparray[
'label'];
2118 $totalarray[
'nbfield']++;
2122 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2123 print
'<td class="center">';
2124 if (!is_array($typenArray) || count($typenArray) == 0) {
2125 $typenArray = $formcompany->typent_array(1);
2127 print $typenArray[$obj->typent_code];
2130 $totalarray[
'nbfield']++;
2134 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2135 print
'<td class="center">';
2136 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2137 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2139 print $conf->cache[
'staff'][$obj->staff_code];
2142 $totalarray[
'nbfield']++;
2147 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2148 $s =
$form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2149 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2153 $totalarray[
'nbfield']++;
2158 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2159 $s =
$form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2160 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2164 $totalarray[
'nbfield']++;
2169 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2174 $totalarray[
'nbfield']++;
2179 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2184 $totalarray[
'nbfield']++;
2189 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2190 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2192 $totalarray[
'nbfield']++;
2195 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2197 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2200 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2201 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2203 $totalarray[
'nbfield']++;
2206 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2208 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2211 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2212 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2214 $totalarray[
'nbfield']++;
2217 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2219 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2222 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2223 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2225 $totalarray[
'nbfield']++;
2228 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2230 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2233 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2234 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2236 $totalarray[
'nbfield']++;
2239 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2241 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2244 $userstatic->id = $obj->fk_user_author;
2245 $userstatic->login = $obj->login;
2246 $userstatic->lastname = $obj->lastname;
2247 $userstatic->firstname = $obj->firstname;
2248 $userstatic->email = $obj->user_email;
2249 $userstatic->statut = $obj->user_statut;
2250 $userstatic->entity = $obj->entity;
2251 $userstatic->photo = $obj->photo;
2252 $userstatic->office_phone = $obj->office_phone;
2253 $userstatic->office_fax = $obj->office_fax;
2254 $userstatic->user_mobile = $obj->user_mobile;
2255 $userstatic->job = $obj->job;
2256 $userstatic->gender = $obj->gender;
2259 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2260 print
'<td class="tdoverflowmax200">';
2261 if ($userstatic->id) {
2262 print $userstatic->getNomUrl(-1);
2268 $totalarray[
'nbfield']++;
2272 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2275 if ($obj->socid > 0) {
2276 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2277 if ($listsalesrepresentatives < 0) {
2280 $nbofsalesrepresentative = count($listsalesrepresentatives);
2281 if ($nbofsalesrepresentative > 6) {
2283 print $nbofsalesrepresentative;
2284 } elseif ($nbofsalesrepresentative > 0) {
2286 foreach ($listsalesrepresentatives as $val) {
2287 $userstatic->id = $val[
'id'];
2288 $userstatic->lastname = $val[
'lastname'];
2289 $userstatic->firstname = $val[
'firstname'];
2290 $userstatic->email = $val[
'email'];
2291 $userstatic->statut = $val[
'statut'];
2292 $userstatic->entity = $val[
'entity'];
2293 $userstatic->photo = $val[
'photo'];
2294 $userstatic->login = $val[
'login'];
2295 $userstatic->office_phone = $val[
'office_phone'];
2296 $userstatic->office_fax = $val[
'office_fax'];
2297 $userstatic->user_mobile = $val[
'user_mobile'];
2298 $userstatic->job = $val[
'job'];
2299 $userstatic->gender = $val[
'gender'];
2301 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2303 if ($j < $nbofsalesrepresentative) {
2315 $totalarray[
'nbfield']++;
2319 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2320 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2323 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2324 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2326 $totalarray[
'nbfield']++;
2329 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2331 $totalarray[
'val'][
'totalam'] += $totalpay;
2335 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2336 print
'<td class="right nowraponall amount">';
2337 print (!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2340 $totalarray[
'nbfield']++;
2343 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2345 $totalarray[
'val'][
'rtp'] += $remaintopay;
2350 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2351 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2352 if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) {
2353 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2359 $totalarray[
'nbfield']++;
2364 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2365 print
'<td class="nowraponall">';
2366 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2369 $totalarray[
'nbfield']++;
2373 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2374 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2376 $totalarray[
'nbfield']++;
2380 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2381 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2383 $totalarray[
'nbfield']++;
2387 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2388 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2390 $totalarray[
'nbfield']++;
2393 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2394 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2396 $totalarray[
'nbfield']++;
2401 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2402 print
'<td class="right nowraponall">';
2403 print (!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2406 $totalarray[
'nbfield']++;
2411 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2412 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2414 $totalarray[
'nbfield']++;
2415 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2417 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2420 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2421 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2423 $totalarray[
'nbfield']++;
2424 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2426 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2429 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2430 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2432 $totalarray[
'nbfield']++;
2436 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2437 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2439 $totalarray[
'nbfield']++;
2442 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2444 if ($i >= $imaxinloop - 1) {
2445 if (!empty($total_ht)) {
2446 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2448 $totalarray[
'val'][
'total_mark_rate'] =
'';
2454 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2456 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2457 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2458 print $hookmanager->resPrint;
2460 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2461 print
'<td class="nowraponall center">';
2462 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2465 $totalarray[
'nbfield']++;
2469 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2470 print
'<td class="nowraponall center">';
2471 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2474 $totalarray[
'nbfield']++;
2478 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2479 print
'<td class="nowraponall center">';
2480 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2483 $totalarray[
'nbfield']++;
2487 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2488 print
'<td class="center">';
2492 $totalarray[
'nbfield']++;
2496 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2497 print
'<td class="center">';
2501 $totalarray[
'nbfield']++;
2505 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2506 print
'<td class="center">';
2507 if (!empty($obj->fk_fac_rec_source)) {
2509 $result = $facrec->fetch($obj->fk_fac_rec_source);
2513 print $facrec->getNomUrl();
2518 $totalarray[
'nbfield']++;
2522 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2523 print
'<td class="nowrap right">';
2524 print $facturestatic->getLibStatut(5, $paiement);
2527 $totalarray[
'nbfield']++;
2534 print
'<td class="nowrap" align="center">';
2535 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2537 if (in_array($obj->id, $arrayofselected)) {
2540 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2544 $totalarray[
'nbfield']++;
2553 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2554 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2557 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2563 foreach ($arrayfields as $key => $val) {
2564 if (!empty($val[
'checked'])) {
2568 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2573 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2574 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2575 print $hookmanager->resPrint;
2577 print
'</table>'.
"\n";
2578 print
'</div>'.
"\n";
2580 print
'</form>'.
"\n";
2583 if ($contextpage !=
'poslist') {
2584 $hidegeneratedfilelistifempty = 1;
2585 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2586 $hidegeneratedfilelistifempty = 0;
2590 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2591 $urlsource .= str_replace(
'&',
'&', $param);
2593 $filedir = $diroutputmassaction;
2594 $genallowed = $user->hasRight(
"facture",
"lire");
2595 $delallowed = $user->hasRight(
"facture",
"creer");
2598 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_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.
setEventMessage($mesgs, $style='mesgs')
Set event message 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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$formconfirm
if ($action == 'delbookkeepingyear') {
$nbtotalofrecords
Count total nb of records.
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.