41require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45if (isModEnabled(
'margin')) {
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
49require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
59if (isModEnabled(
'commande')) {
60 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
64$langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
66$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
67$projectid = (
GETPOST(
'projectid') ?
GETPOST(
'projectid',
'int') : 0);
73$action =
GETPOST(
'action',
'aZ09');
74$massaction =
GETPOST(
'massaction',
'alpha');
75$show_files =
GETPOST(
'show_files',
'int');
76$confirm =
GETPOST(
'confirm',
'alpha');
77$toselect =
GETPOST(
'toselect',
'array');
78$optioncss =
GETPOST(
'optioncss',
'alpha');
79$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
82if ($contextpage ==
'poslist') {
86$userid =
GETPOST(
'userid',
'int');
88$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
89$search_type =
GETPOST(
'search_type',
'int');
90$search_subtype =
GETPOST(
'search_subtype',
'int');
91$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
92$search_project =
GETPOST(
'search_project',
'alpha');
93$search_company =
GETPOST(
'search_company',
'alpha');
94$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
95$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
96$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
97$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
98$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
99$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
100$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
101$search_login =
GETPOST(
'search_login',
'alpha');
102$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
103$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
104$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
105$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
106$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
107$search_status =
GETPOST(
'search_status',
'intcomma');
108$search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
109$search_paymentterms =
GETPOST(
'search_paymentterms',
'int');
110$search_module_source =
GETPOST(
'search_module_source',
'alpha');
111$search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
112$search_town =
GETPOST(
'search_town',
'alpha');
113$search_zip =
GETPOST(
'search_zip',
'alpha');
114$search_state =
GETPOST(
"search_state");
115$search_country =
GETPOST(
"search_country",
'alpha');
116$search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
117$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
118$search_user =
GETPOST(
'search_user',
'int');
119$search_sale =
GETPOST(
'search_sale',
'int');
120$search_date_startday =
GETPOST(
'search_date_startday',
'int');
121$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
122$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
123$search_date_endday =
GETPOST(
'search_date_endday',
'int');
124$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
125$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
126$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
127$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
128$search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
129$search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
130$search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
131$search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
132$search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
133$search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
134$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
135$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
136$search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
137$search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
138$search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
139$search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
140$search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
141$search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
142$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
143$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
144$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
145$search_product_category =
GETPOST(
'search_product_category',
'int');
146$search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
147$search_btn =
GETPOST(
'button_search',
'alpha');
148$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
150$search_option =
GETPOST(
'search_option');
151if ($search_option ==
'late') {
152 $search_status =
'1';
154$filtre =
GETPOST(
'filtre',
'alpha');
156$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
157$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
158$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
159$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
160if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
163$offset = $limit * $page;
164if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
165 $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
171 $sortfield =
'f.datef';
173$pageprev = $page - 1;
174$pagenext = $page + 1;
176$diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
183$hookmanager->initHooks(array($contextpage));
187$extrafields->fetch_name_optionals_label($object->table_element);
189$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
192$fieldstosearchall = array(
194 'f.ref_client'=>
'RefCustomer',
195 'f.note_public'=>
'NotePublic',
196 's.nom'=>
"ThirdParty",
197 's.code_client'=>
"CustomerCodeShort",
198 's.name_alias'=>
"AliasNameShort",
201 'pd.description'=>
'Description',
203if (empty($user->socid)) {
204 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
207$checkedtypetiers = 0;
209 'f.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
210 'f.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1,
'position'=>10),
211 'f.type'=>array(
'label'=>
"Type",
'checked'=>0,
'position'=>15),
212 'f.datef'=>array(
'label'=>
"DateInvoice",
'checked'=>1,
'position'=>20),
213 'f.date_valid'=>array(
'label'=>
"DateValidation",
'checked'=>0,
'position'=>22),
214 'f.subtype'=>array(
'label'=>
"InvoiceSubtype",
'checked'=>0,
'position'=>17),
215 'f.date_lim_reglement'=>array(
'label'=>
"DateDue",
'checked'=>1,
'position'=>25),
216 'f.date_closing'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>30),
217 'p.ref'=>array(
'label'=>
"ProjectRef",
'langs'=>
'projects',
'checked'=>1,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>40),
218 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>41),
219 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>50),
220 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>1,
'position'=>51),
221 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'checked'=>-1,
'position'=>52),
222 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
223 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>55),
224 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1,
'position'=>60),
225 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>65),
226 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>70),
227 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>75),
228 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>1,
'position'=>80),
229 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>1,
'position'=>85),
230 'f.module_source'=>array(
'label'=>
"POSModule",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position'=>90),
231 'f.pos_source'=>array(
'label'=>
"POSTerminal",
'langs'=>
'cashdesk',
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position'=>91),
232 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>95),
233 'f.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>100),
234 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax1_assuj ==
"1"),
'position'=>110),
235 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax2_assuj ==
"1"),
'position'=>120),
236 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>130),
237 'dynamount_payed'=>array(
'label'=>
"Received",
'checked'=>0,
'position'=>140),
238 'rtp'=>array(
'label'=>
"Rest",
'checked'=>0,
'position'=>150),
239 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>280),
240 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>285),
241 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>290),
242 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>291),
243 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>292),
244 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>295),
245 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(!isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>296),
246 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
247 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
248 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
249 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || empty($user->rights->margins->liretous) || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
250 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
251 'f.tms' =>array(
'type'=>
'timestamp',
'label'=>
'DateModificationShort',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>502),
252 'u.login'=>array(
'label'=>
"UserAuthor",
'checked'=>1,
'position'=>504),
253 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>506),
258 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>520,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
259 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>521,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
260 'f.fk_fac_rec_source'=>array(
'label'=>
'GeneratedFromTemplate',
'checked'=>0,
'position'=>530,
'enabled'=>
'1'),
261 'f.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
265 $arrayfields[
'f.retained_warranty'] = array(
'label'=>$langs->trans(
"RetainedWarranty"),
'checked'=>0,
'position'=>86);
268foreach ($object->fields as $key => $val) {
271 if (!empty($val[
'visible'])) {
272 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
274 if (array_key_exists($key, $arrayfields)) {
276 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
278 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
280 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
284 $arrayfields[$newkey] = array(
285 'label'=>$val[
'label'],
286 'checked'=>(($visible < 0) ? 0 : 1),
287 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
288 'position'=>$val[
'position'],
289 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
295include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
300if (!$user->hasRight(
'societe',
'client',
'voir') || $user->socid) {
301 $search_sale = $user->id;
305$fieldid = (!empty($ref) ?
'ref' :
'rowid');
306if (!empty($user->socid)) {
307 $socid = $user->socid;
309$result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
316if (
GETPOST(
'cancel',
'alpha')) {
320if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
324$parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
325$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
330include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
333if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
336 $search_product_category =
'';
338 $search_refcustomer =
'';
340 $search_subtype =
'';
341 $search_project_ref =
'';
342 $search_project =
'';
343 $search_company =
'';
344 $search_company_alias =
'';
345 $search_parent_name =
'';
346 $search_montant_ht =
'';
347 $search_montant_vat =
'';
348 $search_montant_localtax1 =
'';
349 $search_montant_localtax2 =
'';
350 $search_montant_ttc =
'';
352 $search_multicurrency_code =
'';
353 $search_multicurrency_tx =
'';
354 $search_multicurrency_montant_ht =
'';
355 $search_multicurrency_montant_vat =
'';
356 $search_multicurrency_montant_ttc =
'';
358 $search_paymentmode =
'';
359 $search_paymentterms =
'';
360 $search_module_source =
'';
361 $search_pos_source =
'';
365 $search_country =
'';
366 $search_type_thirdparty =
'';
367 $search_customer_code =
'';
368 $search_date_startday =
'';
369 $search_date_startmonth =
'';
370 $search_date_startyear =
'';
371 $search_date_endday =
'';
372 $search_date_endmonth =
'';
373 $search_date_endyear =
'';
374 $search_date_start =
'';
375 $search_date_end =
'';
376 $search_date_valid_startday =
'';
377 $search_date_valid_startmonth =
'';
378 $search_date_valid_startyear =
'';
379 $search_date_valid_endday =
'';
380 $search_date_valid_endmonth =
'';
381 $search_date_valid_endyear =
'';
382 $search_date_valid_start =
'';
383 $search_date_valid_end =
'';
384 $search_datelimit_startday =
'';
385 $search_datelimit_startmonth =
'';
386 $search_datelimit_startyear =
'';
387 $search_datelimit_endday =
'';
388 $search_datelimit_endmonth =
'';
389 $search_datelimit_endyear =
'';
390 $search_datelimit_start =
'';
391 $search_datelimit_end =
'';
392 $search_fac_rec_source_title =
'';
394 $search_array_options = array();
395 $search_categ_cus = 0;
400if (empty($reshook)) {
401 $objectclass =
'Facture';
402 $objectlabel =
'Invoices';
403 $permissiontoread = $user->hasRight(
"facture",
"lire");
404 $permissiontoadd = $user->hasRight(
"facture",
"creer");
405 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
406 $uploaddir = $conf->facture->dir_output;
407 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
410if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
411 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
412 $arrayofselected = is_array($toselect) ? $toselect : array();
413 if (!empty($arrayofselected)) {
414 $bankid =
GETPOST(
'bankid',
'int');
415 $paiementid =
GETPOST(
'paiementid',
'int');
417 if (empty($paiementdate)) {
418 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
420 $action =
'makepayment';
424 foreach ($arrayofselected as $toselectid) {
427 $result = $facture->fetch($toselectid);
436 $paiementAmount = $facture->getSommePaiement();
437 $totalcreditnotes = $facture->getSumCreditNotesUsed();
438 $totaldeposits = $facture->getSumDepositsUsed();
439 $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
440 $remaintopay =
price2num($facture->total_ttc - $totalpay);
441 if ($remaintopay != 0) {
442 $resultBank = $facture->setBankAccount($bankid);
443 if ($resultBank < 0) {
448 $paiement->datepaye = $paiementdate;
449 $paiement->amounts[$facture->id] = $remaintopay;
450 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
451 $paiement->paiementid = $paiementid;
452 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
453 if ($paiement_id < 0) {
454 $langs->load(
"errors");
455 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
458 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
460 $langs->load(
"errors");
461 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
467 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
471 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
476 if (empty($errorpayment)) {
477 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
485} elseif ($massaction ==
'withdrawrequest') {
486 $langs->load(
"withdrawals");
488 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
495 $arrayofselected = is_array($toselect) ? $toselect : array();
496 $listofbills = array();
497 foreach ($arrayofselected as $toselectid) {
499 $result = $objecttmp->fetch($toselectid);
501 $totalpaid = $objecttmp->getSommePaiement();
502 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
503 $totaldeposits = $objecttmp->getSumDepositsUsed();
504 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
507 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
508 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
510 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
511 } elseif ($objecttmp->resteapayer < 0) {
513 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
516 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
517 $rsql .=
" , pfd.date_traite as date_traite";
518 $rsql .=
" , pfd.amount";
519 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
520 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
521 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
522 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
523 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
524 $rsql .=
" AND pfd.traite = 0";
525 $rsql .=
" ORDER BY pfd.date_demande DESC";
527 $result_sql = $db->query($rsql);
529 $numprlv = $db->num_rows($result_sql);
534 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
535 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
537 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
539 $listofbills[] = $objecttmp;
545 if (!empty($listofbills)) {
546 $nbwithdrawrequestok = 0;
547 foreach ($listofbills as $aBill) {
549 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
552 $nbwithdrawrequestok++;
558 if ($nbwithdrawrequestok > 0) {
559 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
571$form =
new Form($db);
575if (isModEnabled(
'margin')) {
578$bankaccountstatic =
new Account($db);
579$facturestatic =
new Facture($db);
581$companystatic =
new Societe($db);
582$companyparent =
new Societe($db);
584$company_url_list = array();
585$subtypearray = $object->getArrayOfInvoiceSubtypes(0);
590 if (empty($search_company)) {
591 $search_company = $soc->name;
595$title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
596$help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
598$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
599$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
604if ($sall || $search_user > 0) {
605 $sql =
'SELECT DISTINCT';
607$sql .=
' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, f.subtype, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
608$sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
609$sql .=
' f.fk_user_author,';
610$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,';
611$sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
612$sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
613$sql .=
' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
614$sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
615$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,';
616$sql .=
" s.parent as fk_parent,";
617$sql .=
" s2.nom as name2,";
618$sql .=
' typent.code as typent_code,';
619$sql .=
' state.code_departement as state_code, state.nom as state_name,';
620$sql .=
' country.code as country_code,';
621$sql .=
' f.fk_fac_rec_source,';
622$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
623$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';
633if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
634 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
635 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
639$parameters = array();
640$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
641$sql .= $hookmanager->resPrint;
642$sql = preg_replace(
'/,\s*$/',
'', $sql);
646$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
647$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
648$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
649$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
650$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
651$sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
652if ($sortfield ==
"f.datef") {
653 $sql .= $db->hintindex(
'idx_facture_datef');
655if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
656 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
659 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
661if (!empty($search_fac_rec_source_title)) {
662 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
664$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
665$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
666if ($search_user > 0) {
667 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
668 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
671$parameters = array();
672$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
673$sql .= $hookmanager->resPrint;
675$sql .=
' WHERE f.fk_soc = s.rowid';
676$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
678 $sql .=
' AND s.rowid = '.((int) $socid);
682 $sql .=
' AND f.fk_user_author IS NULL';
684 $sql .=
' AND f.fk_user_author = '.((int) $userid);
690if ($search_refcustomer) {
693if ($search_type !=
'' && $search_type !=
'-1') {
694 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
696if ($search_subtype !=
'' && $search_subtype !=
'-1') {
697 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
699if ($search_project_ref) {
702if ($search_project) {
705if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
706 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
708 if ($search_company) {
711 if ($search_company_alias) {
715if ($search_parent_name) {
718if ($search_customer_code) {
730if (strlen(trim($search_country))) {
732 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
733 foreach ($arrayofcode as $key => $value) {
734 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
735 if ($value != $mysoc->country_code) {
736 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
739 if ($search_country ==
'special_allnotme') {
740 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
741 } elseif ($search_country ==
'special_eec') {
742 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
743 } elseif ($search_country ==
'special_eecnotme') {
744 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
745 } elseif ($search_country ==
'special_noteec') {
746 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
751if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
752 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
754if ($search_montant_ht !=
'') {
757if ($search_montant_vat !=
'') {
760if ($search_montant_localtax1 !=
'') {
761 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
763if ($search_montant_localtax2 !=
'') {
764 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
766if ($search_montant_ttc !=
'') {
769if ($search_multicurrency_code !=
'') {
770 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
772if ($search_multicurrency_tx !=
'') {
773 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
775if ($search_multicurrency_montant_ht !=
'') {
776 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
778if ($search_multicurrency_montant_vat !=
'') {
779 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
781if ($search_multicurrency_montant_ttc !=
'') {
782 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
785 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
787if ($search_status !=
'-1' && $search_status !=
'') {
788 if (is_numeric($search_status) && $search_status >= 0) {
789 if ($search_status ==
'0') {
790 $sql .=
" AND f.fk_statut = 0";
792 if ($search_status ==
'1') {
793 $sql .=
" AND f.fk_statut = 1";
795 if ($search_status ==
'2') {
796 $sql .=
" AND f.fk_statut = 2";
798 if ($search_status ==
'3') {
799 $sql .=
" AND f.fk_statut = 3";
802 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
806if ($search_paymentmode > 0) {
807 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
809if ($search_paymentterms > 0) {
810 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
812if ($search_module_source) {
815if ($search_pos_source) {
818if ($search_date_start) {
819 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
821if ($search_date_end) {
822 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
824if ($search_date_valid_start) {
825 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
827if ($search_date_valid_end) {
828 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
830if ($search_datelimit_start) {
831 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
833if ($search_datelimit_end) {
834 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
836if ($search_option ==
'late') {
837 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
842if ($search_user > 0) {
843 $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);
845if (!empty($search_fac_rec_source_title)) {
846 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
849if ($search_sale && $search_sale !=
'-1') {
850 if ($search_sale == -2) {
851 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
852 } elseif ($search_sale > 0) {
853 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
857$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
858$searchCategoryProductOperator = 0;
859if (!empty($searchCategoryProductList)) {
860 $searchCategoryProductSqlList = array();
861 $listofcategoryid =
'';
862 foreach ($searchCategoryProductList as $searchCategoryProduct) {
863 if (intval($searchCategoryProduct) == -2) {
864 $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)";
865 } elseif (intval($searchCategoryProduct) > 0) {
866 if ($searchCategoryProductOperator == 0) {
867 $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).
")";
869 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
873 if ($listofcategoryid) {
874 $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).
"))";
876 if ($searchCategoryProductOperator == 1) {
877 if (!empty($searchCategoryProductSqlList)) {
878 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
881 if (!empty($searchCategoryProductSqlList)) {
882 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
886$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
887$searchCategoryCustomerOperator = 0;
889if (!empty($searchCategoryCustomerList)) {
890 $searchCategoryCustomerSqlList = array();
891 $listofcategoryid =
'';
892 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
893 if (intval($searchCategoryCustomer) == -2) {
894 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
895 } elseif (intval($searchCategoryCustomer) > 0) {
896 if ($searchCategoryCustomerOperator == 0) {
897 $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).
")";
899 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
903 if ($listofcategoryid) {
904 $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).
"))";
906 if ($searchCategoryCustomerOperator == 1) {
907 if (!empty($searchCategoryCustomerSqlList)) {
908 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
911 if (!empty($searchCategoryCustomerSqlList)) {
912 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
917include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
919$parameters = array();
920$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
921$sql .= $hookmanager->resPrint;
928$parameters = array();
929$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
930$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
933$nbtotalofrecords =
'';
936 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
937 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
939 $resql = $db->query($sqlforcount);
941 $objforcount = $db->fetch_object($resql);
942 $nbtotalofrecords = $objforcount->nbtotalofrecords;
947 if (($page * $limit) > $nbtotalofrecords) {
955$sql .= $db->order($sortfield, $sortorder);
957 $sql .= $db->plimit($limit + 1, $offset);
960$resql = $db->query($sql);
966$num = $db->num_rows($resql);
968$arrayofselected = is_array($toselect) ? $toselect : array();
971 $obj = $db->fetch_object($resql);
974 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$id);
983$param =
'&socid='.urlencode($socid);
985 $param .=
'&mode='.urlencode($mode);
987if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
988 $param .=
'&contextpage='.urlencode($contextpage);
990if ($limit > 0 && $limit != $conf->liste_limit) {
991 $param .=
'&limit='.((int) $limit);
994 $param .=
'&sall='.urlencode($sall);
996if ($search_date_startday) {
997 $param .=
'&search_date_startday='.urlencode($search_date_startday);
999if ($search_date_startmonth) {
1000 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
1002if ($search_date_startyear) {
1003 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
1005if ($search_date_endday) {
1006 $param .=
'&search_date_endday='.urlencode($search_date_endday);
1008if ($search_date_endmonth) {
1009 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
1011if ($search_date_endyear) {
1012 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
1014if ($search_date_valid_startday) {
1015 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
1017if ($search_date_valid_startmonth) {
1018 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
1020if ($search_date_valid_startyear) {
1021 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
1023if ($search_date_valid_endday) {
1024 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
1026if ($search_date_valid_endmonth) {
1027 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
1029if ($search_date_valid_endyear) {
1030 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
1032if ($search_datelimit_startday) {
1033 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
1035if ($search_datelimit_startmonth) {
1036 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
1038if ($search_datelimit_startyear) {
1039 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
1041if ($search_datelimit_endday) {
1042 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
1044if ($search_datelimit_endmonth) {
1045 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
1047if ($search_datelimit_endyear) {
1048 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
1051 $param .=
'&search_ref='.urlencode($search_ref);
1053if ($search_refcustomer) {
1054 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1056if ($search_project_ref) {
1057 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1059if ($search_project) {
1060 $param .=
'&search_project='.urlencode($search_project);
1062if ($search_type !=
'') {
1063 $param .=
'&search_type='.urlencode($search_type);
1065if ($search_subtype !=
'') {
1066 $param .=
'&search_subtype='.urlencode($search_subtype);
1068if ($search_company) {
1069 $param .=
'&search_company='.urlencode($search_company);
1071if ($search_company_alias) {
1072 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1074if ($search_parent_name !=
'') {
1075 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1078 $param .=
'&search_town='.urlencode($search_town);
1081 $param .=
'&search_zip='.urlencode($search_zip);
1083if ($search_country) {
1084 $param .=
"&search_country=".urlencode($search_country);
1086if ($search_type_thirdparty !=
'') {
1087 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1089if ($search_customer_code) {
1090 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1092if ($search_sale > 0) {
1093 $param .=
'&search_sale='.urlencode($search_sale);
1095if ($search_user > 0) {
1096 $param .=
'&search_user='.urlencode($search_user);
1099 $param .=
'&search_login='.urlencode($search_login);
1101if ($search_product_category > 0) {
1102 $param .=
'&search_product_category='.urlencode($search_product_category);
1104if ($search_montant_ht !=
'') {
1105 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1107if ($search_montant_vat !=
'') {
1108 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1110if ($search_montant_localtax1 !=
'') {
1111 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1113if ($search_montant_localtax2 !=
'') {
1114 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1116if ($search_montant_ttc !=
'') {
1117 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1119if ($search_multicurrency_code !=
'') {
1120 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1122if ($search_multicurrency_tx !=
'') {
1123 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1125if ($search_multicurrency_montant_ht !=
'') {
1126 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1128if ($search_multicurrency_montant_vat !=
'') {
1129 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1131if ($search_multicurrency_montant_ttc !=
'') {
1132 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1134if ($search_status !=
'') {
1135 $param .=
'&search_status='.urlencode($search_status);
1137if ($search_paymentmode > 0) {
1138 $param .=
'&search_paymentmode='.urlencode($search_paymentmode);
1140if ($search_paymentterms > 0) {
1141 $param .=
'&search_paymentterms='.urlencode($search_paymentterms);
1143if ($search_module_source) {
1144 $param .=
'&search_module_source='.urlencode($search_module_source);
1146if ($search_pos_source) {
1147 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1150 $param .=
'&show_files='.urlencode($show_files);
1152if ($search_option) {
1153 $param .=
"&search_option=".urlencode($search_option);
1155if ($optioncss !=
'') {
1156 $param .=
'&optioncss='.urlencode($optioncss);
1158if ($search_categ_cus > 0) {
1159 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1161if (!empty($search_fac_rec_source_title)) {
1162 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1166include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1168$parameters = array(
'param' => &$param);
1169$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1170$param .= $hookmanager->resPrint;
1172$arrayofmassactions = array(
1173 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1174 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1175 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1176 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1179if ($user->hasRight(
'facture',
'paiement')) {
1180 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1182if (isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1183 $langs->load(
"withdrawals");
1184 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1186if ($user->hasRight(
'facture',
'supprimer')) {
1188 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1190 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1193if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1194 $arrayofmassactions = array();
1196$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1200if ($contextpage !=
'poslist') {
1201 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1202 if (!empty($socid)) {
1203 $url .=
'&socid='.$socid;
1205 $newcardbutton =
'';
1206 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
1207 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
1209 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1213print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1214if ($optioncss !=
'') {
1215 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1217print
'<input type="hidden" name="token" value="'.newToken().
'">';
1218print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1219if (!in_array($massaction, array(
'makepayment'))) {
1220 print
'<input type="hidden" name="action" value="list">';
1222print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1223print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1224print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1225print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1226print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1227print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1229print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1231$topicmail =
"SendBillRef";
1232$modelmail =
"facture_send";
1234$trackid =
'inv'.$object->id;
1235include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1237if ($massaction ==
'makepayment') {
1239 $formquestion = array(
1243 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1244 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1245 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value'=>$form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1248 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1253 foreach ($fieldstosearchall as $key => $val) {
1254 $fieldstosearchall[$key] = $langs->trans($val);
1256 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1261if ($user->hasRight(
"user",
"user",
"lire")) {
1262 $langs->load(
"commercial");
1263 $moreforfilter .=
'<div class="divsearchfield">';
1264 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1265 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1266 $moreforfilter .=
'</div>';
1269if ($user->hasRight(
"user",
"user",
"lire")) {
1270 $moreforfilter .=
'<div class="divsearchfield">';
1271 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1272 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1273 $moreforfilter .=
'</div>';
1276if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1277 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1278 $moreforfilter .=
'<div class="divsearchfield">';
1279 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1280 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1281 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
1282 $moreforfilter .=
'</div>';
1284if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1285 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1286 $moreforfilter .=
'<div class="divsearchfield">';
1287 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1288 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1289 $moreforfilter .=
'</div>';
1292$moreforfilter .=
'<div class="divsearchfield">';
1293$moreforfilter .= $langs->trans(
'Alert').
' <input type="checkbox" name="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1294$moreforfilter .=
'</div>';
1296$parameters = array();
1297$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1298if (empty($reshook)) {
1299 $moreforfilter .= $hookmanager->resPrint;
1301 $moreforfilter = $hookmanager->resPrint;
1304if (!empty($moreforfilter)) {
1305 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1306 print $moreforfilter;
1310$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1311$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1314if ($massactionbutton && $contextpage !=
'poslist') {
1315 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1318print
'<div class="div-table-responsive">';
1319print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1323print
'<tr class="liste_titre_filter">';
1327 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1328 $searchpicto = $form->showFilterButtons(
'left');
1334 print
'<td class="liste_titre">';
1338if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1339 print
'<td class="liste_titre" align="left">';
1340 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1344if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1345 print
'<td class="liste_titre">';
1346 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1350if (!empty($arrayfields[
'f.type'][
'checked'])) {
1351 print
'<td class="liste_titre maxwidthonsmartphone">';
1362 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1366if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1367 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1368 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1372if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1373 print
'<td class="liste_titre center">';
1374 print
'<div class="nowrapfordate">';
1375 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1377 print
'<div class="nowrapfordate">';
1378 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1383if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1384 print
'<td class="liste_titre center">';
1385 print
'<div class="nowrapfordate">';
1386 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'));
1388 print
'<div class="nowrapfordate">';
1389 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'));
1394if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1395 print
'<td class="liste_titre center">';
1396 print
'<div class="nowrapfordate">';
1397 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1399 print
'<div class="nowrapfordate">';
1400 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1405if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1406 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1409if (!empty($arrayfields[
'p.title'][
'checked'])) {
1410 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1413if (!empty($arrayfields[
's.nom'][
'checked'])) {
1414 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1417if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1418 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1421if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1422 print
'<td class="liste_titre">';
1423 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1427if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1428 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1431if (!empty($arrayfields[
's.town'][
'checked'])) {
1432 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1435if (!empty($arrayfields[
's.zip'][
'checked'])) {
1436 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1439if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1440 print
'<td class="liste_titre">';
1441 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1445if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1446 print
'<td class="liste_titre center">';
1447 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1451if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1452 print
'<td class="liste_titre maxwidthonsmartphone center">';
1453 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'maxwidth100', 1);
1457if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1458 print
'<td class="liste_titre">';
1459 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1463if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1464 print
'<td class="liste_titre left">';
1465 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1469if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1470 print
'<td class="liste_titre">';
1471 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1475if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1476 print
'<td class="liste_titre">';
1477 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1480if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1482 print
'<td class="liste_titre right">';
1483 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1486if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1488 print
'<td class="liste_titre right">';
1489 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1492if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1494 print
'<td class="liste_titre right">';
1495 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1498if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1500 print
'<td class="liste_titre right">';
1501 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1504if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1506 print
'<td class="liste_titre right">';
1507 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1510if (!empty($arrayfields[
'u.login'][
'checked'])) {
1512 print
'<td class="liste_titre" align="center">';
1513 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1516if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1517 print
'<td class="liste_titre"></td>';
1519if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1520 print
'<td class="liste_titre" align="right">';
1523if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1524 print
'<td class="liste_titre right">';
1527if (!empty($arrayfields[
'rtp'][
'checked'])) {
1528 print
'<td class="liste_titre">';
1531if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1533 print
'<td class="liste_titre">';
1534 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1537if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1539 print
'<td class="liste_titre">';
1540 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1543if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1545 print
'<td class="liste_titre right">';
1546 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1549if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1551 print
'<td class="liste_titre right">';
1552 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1555if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1557 print
'<td class="liste_titre right">';
1558 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1561if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1562 print
'<td class="liste_titre">';
1565if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1566 print
'<td class="liste_titre right">';
1569if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1570 print
'<td class="liste_titre right">';
1573if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1574 print
'<td class="liste_titre right">';
1577if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1578 print
'<td class="liste_titre right">';
1581if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1582 print
'<td class="liste_titre right">';
1587include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1590$parameters = array(
'arrayfields'=>$arrayfields);
1591$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1592print $hookmanager->resPrint;
1594if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1595 print
'<td class="liste_titre">';
1599if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1600 print
'<td class="liste_titre">';
1604if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1605 print
'<td class="liste_titre">';
1608if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1610 print
'<td class="liste_titre">';
1613if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1615 print
'<td class="liste_titre">';
1618if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1620 print
'<td class="liste_titre maxwidthonsmartphone right">';
1621 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).
'">';
1625if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1626 print
'<td class="liste_titre center parentonrightofpage">';
1627 $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"));
1628 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1633 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1634 $searchpicto = $form->showFilterButtons();
1640$totalarray = array();
1641$totalarray[
'nbfield'] = 0;
1645print
'<tr class="liste_titre">';
1647 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1648 $totalarray[
'nbfield']++;
1652 $totalarray[
'nbfield']++;
1654if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1655 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1656 $totalarray[
'nbfield']++;
1658if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1660 $totalarray[
'nbfield']++;
1662if (!empty($arrayfields[
'f.type'][
'checked'])) {
1663 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1664 $totalarray[
'nbfield']++;
1666if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1667 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1669if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1670 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1671 $totalarray[
'nbfield']++;
1673if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1675 $totalarray[
'nbfield']++;
1677if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1678 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1679 $totalarray[
'nbfield']++;
1681if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1682 $langs->load(
"projects");
1683 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1684 $totalarray[
'nbfield']++;
1686if (!empty($arrayfields[
'p.title'][
'checked'])) {
1687 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1688 $totalarray[
'nbfield']++;
1690if (!empty($arrayfields[
's.nom'][
'checked'])) {
1691 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1692 $totalarray[
'nbfield']++;
1694if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1696 $totalarray[
'nbfield']++;
1698if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1700 $totalarray[
'nbfield']++;
1702if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1704 $totalarray[
'nbfield']++;
1706if (!empty($arrayfields[
's.town'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
's.zip'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1712 $totalarray[
'nbfield']++;
1714if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1716 $totalarray[
'nbfield']++;
1718if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1720 $totalarray[
'nbfield']++;
1722if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1724 $totalarray[
'nbfield']++;
1726if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1728 $totalarray[
'nbfield']++;
1730if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1732 $totalarray[
'nbfield']++;
1734if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1736 $totalarray[
'nbfield']++;
1738if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1740 $totalarray[
'nbfield']++;
1742if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1744 $totalarray[
'nbfield']++;
1746if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1748 $totalarray[
'nbfield']++;
1750if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1752 $totalarray[
'nbfield']++;
1754if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1756 $totalarray[
'nbfield']++;
1758if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1760 $totalarray[
'nbfield']++;
1762if (!empty($arrayfields[
'u.login'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1764 $totalarray[
'nbfield']++;
1766if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1768 $totalarray[
'nbfield']++;
1770if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1771 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1772 $totalarray[
'nbfield']++;
1774if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1775 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1776 $totalarray[
'nbfield']++;
1778if (!empty($arrayfields[
'rtp'][
'checked'])) {
1779 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1780 $totalarray[
'nbfield']++;
1782if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1783 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1784 $totalarray[
'nbfield']++;
1786if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1787 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1788 $totalarray[
'nbfield']++;
1790if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1791 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1792 $totalarray[
'nbfield']++;
1794if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1795 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1796 $totalarray[
'nbfield']++;
1798if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1799 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1800 $totalarray[
'nbfield']++;
1802if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1803 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1804 $totalarray[
'nbfield']++;
1806if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1807 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1808 $totalarray[
'nbfield']++;
1810if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1811 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1812 $totalarray[
'nbfield']++;
1814if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1815 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1816 $totalarray[
'nbfield']++;
1818if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1819 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1820 $totalarray[
'nbfield']++;
1822if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1824 $totalarray[
'nbfield']++;
1827include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1829$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>$totalarray);
1830$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1831print $hookmanager->resPrint;
1832if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1834 $totalarray[
'nbfield']++;
1836if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1838 $totalarray[
'nbfield']++;
1840if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1842 $totalarray[
'nbfield']++;
1844if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1846 $totalarray[
'nbfield']++;
1848if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1849 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1850 $totalarray[
'nbfield']++;
1852if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1854 $totalarray[
'nbfield']++;
1856if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1857 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1858 $totalarray[
'nbfield']++;
1861 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1862 $totalarray[
'nbfield']++;
1867$projectstatic =
new Project($db);
1869$userstatic =
new User($db);
1875 $savnbfield = $totalarray[
'nbfield'];
1876 $totalarray = array();
1877 $totalarray[
'nbfield'] = 0;
1878 $totalarray[
'val'] = array();
1879 $totalarray[
'val'][
'f.total_ht'] = 0;
1880 $totalarray[
'val'][
'f.total_tva'] = 0;
1881 $totalarray[
'val'][
'f.total_localtax1']=0;
1882 $totalarray[
'val'][
'f.total_localtax1']=0;
1883 $totalarray[
'val'][
'f.total_ttc'] = 0;
1884 $totalarray[
'val'][
'totalam'] = 0;
1885 $totalarray[
'val'][
'rtp'] = 0;
1887 $typenArray = $formcompany->typent_array(1);
1889 $with_margin_info =
false;
1890 if (isModEnabled(
'margin') && (
1891 !empty($arrayfields[
'total_pa'][
'checked'])
1892 || !empty($arrayfields[
'total_margin'][
'checked'])
1893 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1894 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1897 $with_margin_info =
true;
1902 $imaxinloop = ($limit ? min($num, $limit) : $num);
1903 while ($i < $imaxinloop) {
1904 $obj = $db->fetch_object($resql);
1906 $datelimit = $db->jdate($obj->datelimite);
1908 $facturestatic->id = $obj->id;
1909 $facturestatic->ref = $obj->ref;
1910 $facturestatic->ref_client = $obj->ref_client;
1911 $facturestatic->ref_customer = $obj->ref_client;
1912 $facturestatic->type = $obj->type;
1913 $facturestatic->subtype = $obj->subtype;
1914 $facturestatic->total_ht = $obj->total_ht;
1915 $facturestatic->total_tva = $obj->total_tva;
1916 $facturestatic->total_ttc = $obj->total_ttc;
1917 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1918 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1919 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1920 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1921 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1922 $facturestatic->statut = $obj->fk_statut;
1923 $facturestatic->status = $obj->fk_statut;
1924 $facturestatic->close_code = $obj->close_code;
1925 $facturestatic->total_ttc = $obj->total_ttc;
1926 $facturestatic->paye = $obj->paye;
1927 $facturestatic->socid = $obj->fk_soc;
1929 $facturestatic->date = $db->jdate($obj->datef);
1930 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1931 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1933 $facturestatic->note_public = $obj->note_public;
1934 $facturestatic->note_private = $obj->note_private;
1937 $facturestatic->retained_warranty = $obj->retained_warranty;
1938 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1939 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1940 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1941 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1942 $facturestatic->situation_counter = $obj->situation_counter;
1945 $companystatic->id = $obj->socid;
1946 $companystatic->name = $obj->name;
1947 $companystatic->name_alias = $obj->alias;
1948 $companystatic->client = $obj->client;
1949 $companystatic->fournisseur = $obj->fournisseur;
1950 $companystatic->code_client = $obj->code_client;
1951 $companystatic->code_compta_client = $obj->code_compta_client;
1952 $companystatic->code_fournisseur = $obj->code_fournisseur;
1953 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1954 $companystatic->email = $obj->email;
1955 $companystatic->phone = $obj->phone;
1956 $companystatic->fax = $obj->fax;
1957 $companystatic->address = $obj->address;
1958 $companystatic->zip = $obj->zip;
1959 $companystatic->town = $obj->town;
1960 $companystatic->country_code = $obj->country_code;
1962 $projectstatic->id = $obj->project_id;
1963 $projectstatic->ref = $obj->project_ref;
1964 $projectstatic->title = $obj->project_label;
1966 $paiement = $facturestatic->getSommePaiement();
1967 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1968 $totaldeposits = $facturestatic->getSumDepositsUsed();
1969 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1970 $remaintopay = $obj->total_ttc - $totalpay;
1972 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1973 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1974 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1976 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1977 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1979 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1980 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1984 $multicurrency_remaintopay = 0;
1987 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
1988 $remaintopay = -$remaincreditnote;
1989 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1990 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1991 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1992 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1995 $facturestatic->alreadypaid = $paiement;
1997 $marginInfo = array();
1998 if ($with_margin_info ===
true) {
1999 $facturestatic->fetch_lines();
2000 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2001 $total_ht += $obj->total_ht;
2002 $total_margin += $marginInfo[
'total_margin'];
2005 $object = $facturestatic;
2007 if ($mode ==
'kanban') {
2009 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2010 print
'<div class="box-flex-container kanban">';
2013 if ($massactionbutton || $massaction) {
2015 if (in_array($object->id, $arrayofselected)) {
2020 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor'=>$userstatic->getNomUrl(1),
'selected' => in_array($object->id, $arrayofselected));
2021 print $facturestatic->getKanbanView(
'', $arraydata);
2022 if ($i == ($imaxinloop - 1)) {
2029 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2030 if ($contextpage ==
'poslist') {
2031 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2032 if (strpos($obj->ref, 'PROV
') !== false) {
2033 //If is a draft invoice, load var to be able to add products
2034 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2035 print 'parent.place=\
''.$place.
'\'';
2043 print
'<td class="nowrap center">';
2044 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2046 if (in_array($obj->id, $arrayofselected)) {
2049 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2053 $totalarray[
'nbfield']++;
2059 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2061 $totalarray[
'nbfield']++;
2066 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2067 print
'<td class="nowraponall">';
2069 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2071 print
'<td class="nobordernopadding nowraponall">';
2072 if ($contextpage ==
'poslist') {
2075 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2080 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2081 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2088 $totalarray[
'nbfield']++;
2093 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2094 print
'<td class="nowrap tdoverflowmax200">';
2098 $totalarray[
'nbfield']++;
2103 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2104 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2105 print $facturestatic->getLibType(2);
2108 $totalarray[
'nbfield']++;
2113 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2115 if ($facturestatic->subtype > 0) {
2116 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2118 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2122 $totalarray[
'nbfield']++;
2127 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2128 print
'<td align="center" class="nowraponall">';
2132 $totalarray[
'nbfield']++;
2137 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2138 print
'<td align="center" class="nowraponall">';
2142 $totalarray[
'nbfield']++;
2147 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2148 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2149 if ($facturestatic->hasDelay()) {
2150 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2154 $totalarray[
'nbfield']++;
2159 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2160 print
'<td class="nocellnopadd nowraponall">';
2161 if ($obj->project_id > 0) {
2162 print $projectstatic->getNomUrl(1);
2166 $totalarray[
'nbfield']++;
2171 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2172 print
'<td class="nowraponall">';
2173 if ($obj->project_id > 0) {
2178 $totalarray[
'nbfield']++;
2183 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2184 print
'<td class="tdoverflowmax200">';
2185 if ($contextpage ==
'poslist') {
2188 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2192 $totalarray[
'nbfield']++;
2196 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2197 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2201 $totalarray[
'nbfield']++;
2205 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2206 print
'<td class="tdoverflowmax200">';
2207 if ($obj->fk_parent > 0) {
2208 if (!isset($company_url_list[$obj->fk_parent])) {
2209 $companyparent =
new Societe($db);
2210 $res = $companyparent->fetch($obj->fk_parent);
2212 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2215 if (isset($company_url_list[$obj->fk_parent])) {
2216 print $company_url_list[$obj->fk_parent];
2221 $totalarray[
'nbfield']++;
2225 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2226 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2230 $totalarray[
'nbfield']++;
2234 if (!empty($arrayfields[
's.town'][
'checked'])) {
2235 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2239 $totalarray[
'nbfield']++;
2243 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2244 print
'<td class="nowraponall">';
2248 $totalarray[
'nbfield']++;
2252 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2253 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2255 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2260 $tmparray =
getCountry($obj->fk_pays,
'all');
2261 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2265 $totalarray[
'nbfield']++;
2269 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2270 print
'<td class="center">';
2271 if (!is_array($typenArray) || count($typenArray) == 0) {
2272 $typenArray = $formcompany->typent_array(1);
2274 if (!empty($obj->typent_code)) {
2275 print $typenArray[$obj->typent_code];
2279 $totalarray[
'nbfield']++;
2283 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2284 print
'<td class="center">';
2285 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2286 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2288 print $conf->cache[
'staff'][$obj->staff_code];
2291 $totalarray[
'nbfield']++;
2296 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2297 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2298 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2302 $totalarray[
'nbfield']++;
2307 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2308 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2309 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2313 $totalarray[
'nbfield']++;
2318 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2323 $totalarray[
'nbfield']++;
2328 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2333 $totalarray[
'nbfield']++;
2338 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2339 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2341 $totalarray[
'nbfield']++;
2344 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2346 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2349 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2350 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2352 $totalarray[
'nbfield']++;
2355 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2357 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2360 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2361 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2363 $totalarray[
'nbfield']++;
2366 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2368 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2371 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2372 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2374 $totalarray[
'nbfield']++;
2377 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2379 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2382 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2383 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2385 $totalarray[
'nbfield']++;
2388 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2390 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2393 $userstatic->id = $obj->fk_user_author;
2394 $userstatic->login = $obj->login;
2395 $userstatic->lastname = $obj->lastname;
2396 $userstatic->firstname = $obj->firstname;
2397 $userstatic->email = $obj->user_email;
2398 $userstatic->statut = $obj->user_statut;
2399 $userstatic->status = $obj->user_statut;
2400 $userstatic->entity = $obj->entity;
2401 $userstatic->photo = $obj->photo;
2402 $userstatic->office_phone = $obj->office_phone;
2403 $userstatic->office_fax = $obj->office_fax;
2404 $userstatic->user_mobile = $obj->user_mobile;
2405 $userstatic->job = $obj->job;
2406 $userstatic->gender = $obj->gender;
2409 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2410 print
'<td class="tdoverflowmax200">';
2411 if ($userstatic->id) {
2412 print $userstatic->getNomUrl(-1);
2418 $totalarray[
'nbfield']++;
2422 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2425 if ($obj->socid > 0) {
2426 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2427 if ($listsalesrepresentatives < 0) {
2430 $nbofsalesrepresentative = count($listsalesrepresentatives);
2431 if ($nbofsalesrepresentative > 6) {
2433 print $nbofsalesrepresentative;
2434 } elseif ($nbofsalesrepresentative > 0) {
2436 foreach ($listsalesrepresentatives as $val) {
2437 $userstatic->id = $val[
'id'];
2438 $userstatic->lastname = $val[
'lastname'];
2439 $userstatic->firstname = $val[
'firstname'];
2440 $userstatic->email = $val[
'email'];
2441 $userstatic->statut = $val[
'statut'];
2442 $userstatic->status = $val[
'statut'];
2443 $userstatic->entity = $val[
'entity'];
2444 $userstatic->photo = $val[
'photo'];
2445 $userstatic->login = $val[
'login'];
2446 $userstatic->office_phone = $val[
'office_phone'];
2447 $userstatic->office_fax = $val[
'office_fax'];
2448 $userstatic->user_mobile = $val[
'user_mobile'];
2449 $userstatic->job = $val[
'job'];
2450 $userstatic->gender = $val[
'gender'];
2452 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2454 if ($j < $nbofsalesrepresentative) {
2466 $totalarray[
'nbfield']++;
2470 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2471 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2473 $totalarray[
'nbfield']++;
2477 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2478 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2480 $totalarray[
'nbfield']++;
2483 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2485 $totalarray[
'val'][
'totalam'] += $totalpay;
2489 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2490 print
'<td class="right nowraponall amount">';
2491 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2494 $totalarray[
'nbfield']++;
2497 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2499 $totalarray[
'val'][
'rtp'] += $remaintopay;
2504 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2505 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2507 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2513 $totalarray[
'nbfield']++;
2518 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2519 print
'<td class="nowraponall">';
2520 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2523 $totalarray[
'nbfield']++;
2527 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2528 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2530 $totalarray[
'nbfield']++;
2534 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2535 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2537 $totalarray[
'nbfield']++;
2541 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2542 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2544 $totalarray[
'nbfield']++;
2548 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2549 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2551 $totalarray[
'nbfield']++;
2556 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2557 print
'<td class="right nowraponall">';
2558 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2561 $totalarray[
'nbfield']++;
2566 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2567 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2569 $totalarray[
'nbfield']++;
2570 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2572 if (empty($totalarray[
'val'][
'total_pa'])) {
2573 $totalarray[
'val'][
'total_pa'] = 0;
2575 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2578 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2579 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2581 $totalarray[
'nbfield']++;
2582 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2584 if (empty($totalarray[
'val'][
'total_margin'])) {
2585 $totalarray[
'val'][
'total_margin'] = 0;
2587 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2590 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2591 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2593 $totalarray[
'nbfield']++;
2597 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2598 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2600 $totalarray[
'nbfield']++;
2601 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2603 if ($i >= $imaxinloop - 1) {
2604 if (!empty($total_ht)) {
2605 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2607 $totalarray[
'val'][
'total_mark_rate'] =
'';
2613 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2615 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2616 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2617 print $hookmanager->resPrint;
2619 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2620 print
'<td class="nowraponall center">';
2621 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2624 $totalarray[
'nbfield']++;
2628 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2629 print
'<td class="nowraponall center">';
2630 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2633 $totalarray[
'nbfield']++;
2637 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2638 print
'<td class="nowraponall center">';
2639 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2642 $totalarray[
'nbfield']++;
2646 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2647 print
'<td class="center">';
2651 $totalarray[
'nbfield']++;
2655 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2656 print
'<td class="center">';
2660 $totalarray[
'nbfield']++;
2664 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2665 print
'<td class="center">';
2666 if (!empty($obj->fk_fac_rec_source)) {
2668 $result = $facrec->fetch($obj->fk_fac_rec_source);
2672 print $facrec->getNomUrl();
2677 $totalarray[
'nbfield']++;
2681 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2682 print
'<td class="nowrap center">';
2683 print $facturestatic->getLibStatut(5, $paiement);
2686 $totalarray[
'nbfield']++;
2693 print
'<td class="nowrap center">';
2694 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2696 if (in_array($obj->id, $arrayofselected)) {
2699 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2703 $totalarray[
'nbfield']++;
2714 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2715 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2718 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2724 foreach ($arrayfields as $key => $val) {
2725 if (!empty($val[
'checked'])) {
2729 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2734$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2735$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2736print $hookmanager->resPrint;
2738print
'</table>'.
"\n";
2741print
'</form>'.
"\n";
2744if ($contextpage !=
'poslist') {
2745 $hidegeneratedfilelistifempty = 1;
2746 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2747 $hidegeneratedfilelistifempty = 0;
2751 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2752 $urlsource .= str_replace(
'&',
'&', $param);
2754 $filedir = $diroutputmassaction;
2755 $genallowed = $user->hasRight(
"facture",
"lire");
2756 $delallowed = $user->hasRight(
"facture",
"creer");
2759 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a 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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.