44 require
'../../main.inc.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
52 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
59 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
60 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
61 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
67 $langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
69 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
75 $action =
GETPOST(
'action',
'aZ09');
76 $massaction =
GETPOST(
'massaction',
'alpha');
78 $confirm =
GETPOST(
'confirm',
'alpha');
79 $toselect =
GETPOST(
'toselect',
'array');
80 $optioncss =
GETPOST(
'optioncss',
'alpha');
81 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
84 if ($contextpage ==
'poslist') {
90 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
91 $search_type =
GETPOST(
'search_type',
'intcomma');
92 $search_subtype =
GETPOST(
'search_subtype',
'intcomma');
93 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
94 $search_project =
GETPOST(
'search_project',
'alpha');
95 $search_company =
GETPOST(
'search_company',
'alpha');
96 $search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
97 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
98 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
99 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
100 $search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
101 $search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
102 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
103 $search_login =
GETPOST(
'search_login',
'alpha');
104 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
105 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
106 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
107 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
108 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
109 $search_status =
GETPOST(
'search_status',
'intcomma');
110 $search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
111 $search_paymentterms =
GETPOST(
'search_paymentterms',
'intcomma');
112 $search_module_source =
GETPOST(
'search_module_source',
'alpha');
113 $search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
114 $search_town =
GETPOST(
'search_town',
'alpha');
115 $search_zip =
GETPOST(
'search_zip',
'alpha');
116 $search_state =
GETPOST(
"search_state");
117 $search_country =
GETPOST(
"search_country",
'aZ09');
118 $search_customer_code =
GETPOST(
"search_customer_code",
'alphanohtml');
119 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
120 $search_user =
GETPOST(
'search_user',
'intcomma');
121 $search_sale =
GETPOST(
'search_sale',
'intcomma');
122 $search_date_startday =
GETPOSTINT(
'search_date_startday');
123 $search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
124 $search_date_startyear =
GETPOSTINT(
'search_date_startyear');
125 $search_date_endday =
GETPOSTINT(
'search_date_endday');
126 $search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
127 $search_date_endyear =
GETPOSTINT(
'search_date_endyear');
128 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
129 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
130 $search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
131 $search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
132 $search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
133 $search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
134 $search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
135 $search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
136 $search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
137 $search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
138 $search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
139 $search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
140 $search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
141 $search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
142 $search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
143 $search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
144 $search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
145 $search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
146 $search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
147 $search_product_category =
GETPOST(
'search_product_category',
'intcomma');
148 $search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
150 $search_late =
GETPOST(
'search_late');
151 if ($search_late ==
'late') {
152 $search_status =
'1';
156 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
157 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
159 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
162 $offset = $limit * $page;
163 if (!$sortorder &&
getDolGlobalString(
'INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status ==
'1') {
170 $sortfield =
'f.datef';
172 $pageprev = $page - 1;
173 $pagenext = $page + 1;
175 $diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
182 $hookmanager->initHooks(array($contextpage));
186 $extrafields->fetch_name_optionals_label(
$object->table_element);
188 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
191 $fieldstosearchall = array(
193 'f.ref_client' =>
'RefCustomer',
194 'f.note_public' =>
'NotePublic',
195 's.nom' =>
"ThirdParty",
196 's.code_client' =>
"CustomerCodeShort",
197 's.name_alias' =>
"AliasNameShort",
200 'pd.description' =>
'Description',
202 if (empty($user->socid)) {
203 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
206 $checkedtypetiers = 0;
207 $arrayfields = array(
208 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
209 'f.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1,
'position' => 10),
210 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
211 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
212 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 20),
213 'f.date_valid' => array(
'label' =>
"DateValidation",
'checked' => 0,
'position' => 22),
214 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 25),
215 'f.date_closing' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 30),
216 'p.ref' => array(
'label' =>
"ProjectRef",
'langs' =>
'projects',
'checked' => 1,
'enabled' => (!
isModEnabled(
'project') ? 0 : 1),
'position' => 40),
217 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!
isModEnabled(
'project') ? 0 : 1),
'position' => 41),
218 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 50),
219 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 1,
'position' => 51),
220 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'checked' => -1,
'position' => 52),
221 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
222 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 55),
223 's.zip' => array(
'label' =>
"Zip",
'checked' => 1,
'position' => 60),
224 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 65),
225 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 70),
226 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 75),
227 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 80),
228 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 85),
229 'f.module_source' => array(
'label' =>
"POSModule",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 90),
230 'f.pos_source' => array(
'label' =>
"POSTerminal",
'langs' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ? 1 : 0),
'enabled' =>
"(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))",
'position' => 91),
231 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 95),
232 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 100),
233 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 110),
234 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 120),
235 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 130),
236 'dynamount_payed' => array(
'label' =>
"Received",
'checked' => 0,
'position' => 140),
237 'rtp' => array(
'label' =>
"Rest",
'checked' => 0,
'position' => 150),
238 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 280),
239 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 285),
240 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 290),
241 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 291),
242 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 292),
243 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 295),
244 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'enabled' => (!
isModEnabled(
'multicurrency') ? 0 : 1),
'position' => 296),
245 'total_pa' => array(
'label' => ((
getDolGlobalString(
'MARGIN_TYPE') ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
246 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
247 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
248 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
249 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
250 'f.tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModificationShort',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 502),
251 'u.login' => array(
'label' =>
"UserAuthor",
'checked' => 1,
'position' => 504),
252 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 506),
257 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
258 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
259 'f.fk_fac_rec_source' => array(
'label' =>
'GeneratedFromTemplate',
'checked' => 0,
'position' => 530,
'enabled' =>
'1'),
260 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
264 $arrayfields[
'f.retained_warranty'] = array(
'label' => $langs->trans(
"RetainedWarranty"),
'checked' => 0,
'position' => 86);
267 $subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
268 if (empty($subtypearray)) {
269 unset($arrayfields[
'f.subtype']);
273 foreach (
$object->fields as $key => $val) {
276 if (!empty($val[
'visible'])) {
277 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
279 if (array_key_exists($key, $arrayfields)) {
281 } elseif (array_key_exists(
'f.'.$key, $arrayfields)) {
283 } elseif (array_key_exists(
's.'.$key, $arrayfields)) {
287 $arrayfields[$newkey] = array(
288 'label' => $val[
'label'],
289 'checked' => (($visible < 0) ? 0 : 1),
290 'enabled' => (abs($visible) != 3 && (
int)
dol_eval($val[
'enabled'], 1, 1,
'1')),
291 'position' => $val[
'position'],
292 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
298 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
303 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
305 if (!$user->hasRight(
'societe',
'client',
'voir')) {
306 $search_sale = $user->id;
310 $fieldid = (!empty($ref) ?
'ref' :
'rowid');
311 if (!empty($user->socid)) {
312 $socid = $user->socid;
314 $result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
321 if (
GETPOST(
'cancel',
'alpha')) {
325 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
329 $parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
330 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
335 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
338 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
341 $search_product_category =
'';
343 $search_refcustomer =
'';
345 $search_subtype =
'';
346 $search_project_ref =
'';
347 $search_project =
'';
348 $search_company =
'';
349 $search_company_alias =
'';
350 $search_parent_name =
'';
351 $search_montant_ht =
'';
352 $search_montant_vat =
'';
353 $search_montant_localtax1 =
'';
354 $search_montant_localtax2 =
'';
355 $search_montant_ttc =
'';
357 $search_multicurrency_code =
'';
358 $search_multicurrency_tx =
'';
359 $search_multicurrency_montant_ht =
'';
360 $search_multicurrency_montant_vat =
'';
361 $search_multicurrency_montant_ttc =
'';
363 $search_paymentmode =
'';
364 $search_paymentterms =
'';
365 $search_module_source =
'';
366 $search_pos_source =
'';
370 $search_country =
'';
371 $search_type_thirdparty =
'';
372 $search_customer_code =
'';
373 $search_date_startday =
'';
374 $search_date_startmonth =
'';
375 $search_date_startyear =
'';
376 $search_date_endday =
'';
377 $search_date_endmonth =
'';
378 $search_date_endyear =
'';
379 $search_date_start =
'';
380 $search_date_end =
'';
381 $search_date_valid_startday =
'';
382 $search_date_valid_startmonth =
'';
383 $search_date_valid_startyear =
'';
384 $search_date_valid_endday =
'';
385 $search_date_valid_endmonth =
'';
386 $search_date_valid_endyear =
'';
387 $search_date_valid_start =
'';
388 $search_date_valid_end =
'';
389 $search_datelimit_startday =
'';
390 $search_datelimit_startmonth =
'';
391 $search_datelimit_startyear =
'';
392 $search_datelimit_endday =
'';
393 $search_datelimit_endmonth =
'';
394 $search_datelimit_endyear =
'';
395 $search_datelimit_start =
'';
396 $search_datelimit_end =
'';
397 $search_fac_rec_source_title =
'';
399 $search_array_options = array();
400 $search_categ_cus = 0;
405 if (empty($reshook)) {
406 $objectclass =
'Facture';
407 $objectlabel =
'Invoices';
408 $permissiontoread = $user->hasRight(
"facture",
"lire");
409 $permissiontoadd = $user->hasRight(
"facture",
"creer");
410 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
411 $uploaddir = $conf->facture->dir_output;
412 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
415 if ($action ==
'makepayment_confirm' && $user->hasRight(
'facture',
'paiement')) {
416 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
417 $arrayofselected = is_array($toselect) ? $toselect : array();
418 if (!empty($arrayofselected)) {
422 if (empty($paiementdate)) {
423 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
425 $action =
'makepayment';
429 foreach ($arrayofselected as $toselectid) {
432 $result = $facture->fetch($toselectid);
441 $paiementAmount = $facture->getSommePaiement();
442 $totalcreditnotes = $facture->getSumCreditNotesUsed();
443 $totaldeposits = $facture->getSumDepositsUsed();
444 $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
445 $remaintopay =
price2num($facture->total_ttc - $totalpay);
448 $parameters = array(
'remaintopay' => $remaintopay);
449 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $facture, $action);
451 if (!empty($remain = $hookmanager->resArray[
'remaintopay'])) {
452 $remaintopay = $remain;
454 } elseif ($reshook < 0) {
456 setEventMessages($facture->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
459 if ($remaintopay != 0) {
460 $resultBank = $facture->setBankAccount($bankid);
461 if ($resultBank < 0) {
466 $paiement->datepaye = $paiementdate;
467 $paiement->amounts[$facture->id] = $remaintopay;
468 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
469 $paiement->paiementid = $paiementid;
470 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
471 if ($paiement_id < 0) {
472 $langs->load(
"errors");
473 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
476 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
478 $langs->load(
"errors");
479 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
485 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
489 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
494 if (empty($errorpayment)) {
495 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
503 } elseif ($massaction ==
'withdrawrequest') {
504 $langs->load(
"withdrawals");
506 if (!$user->hasRight(
'prelevement',
'bons',
'creer')) {
513 $arrayofselected = is_array($toselect) ? $toselect : array();
514 $listofbills = array();
515 foreach ($arrayofselected as $toselectid) {
517 $result = $objecttmp->fetch($toselectid);
519 $totalpaid = $objecttmp->getSommePaiement();
520 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
521 $totaldeposits = $objecttmp->getSumDepositsUsed();
522 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
525 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
526 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
528 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
529 $objecttmp->resteapayer = $remaintopay;
531 } elseif ($reshook < 0) {
533 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
538 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
539 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
541 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
542 } elseif ($objecttmp->resteapayer < 0) {
544 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
547 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
548 $rsql .=
" , pfd.date_traite as date_traite";
549 $rsql .=
" , pfd.amount";
550 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
551 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
552 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
553 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
554 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
555 $rsql .=
" AND pfd.traite = 0";
556 $rsql .=
" ORDER BY pfd.date_demande DESC";
558 $result_sql = $db->query($rsql);
560 $numprlv = $db->num_rows($result_sql);
565 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
566 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
568 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
570 $listofbills[] = $objecttmp;
576 if (!empty($listofbills)) {
577 $nbwithdrawrequestok = 0;
578 foreach ($listofbills as $aBill) {
580 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
583 $nbwithdrawrequestok++;
589 if ($nbwithdrawrequestok > 0) {
590 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
602 $form =
new Form($db);
609 $bankaccountstatic =
new Account($db);
610 $facturestatic =
new Facture($db);
612 $companystatic =
new Societe($db);
613 $companyparent =
new Societe($db);
615 $company_url_list = array();
620 if (empty($search_company)) {
621 $search_company = $soc->name;
625 $title = $langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' - '.$soc->name :
'');
626 $help_url =
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
628 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
629 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
635 $sql =
'SELECT DISTINCT';
637 $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,';
638 $sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
639 $sql .=
' f.fk_user_author,';
640 $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,';
641 $sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
642 $sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
643 $sql .=
' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
644 $sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
645 $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,';
646 $sql .=
" s.parent as fk_parent,";
647 $sql .=
" s2.nom as name2,";
648 $sql .=
' typent.code as typent_code,';
649 $sql .=
' state.code_departement as state_code, state.nom as state_name,';
650 $sql .=
' country.code as country_code,';
651 $sql .=
' f.fk_fac_rec_source,';
652 $sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
653 $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';
663 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
664 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
665 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
669 $parameters = array();
670 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
671 $sql .= $hookmanager->resPrint;
672 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
676 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
677 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
678 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
679 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
680 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
681 $sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
682 if ($sortfield ==
"f.datef") {
683 $sql .= $db->hintindex(
'idx_facture_datef');
685 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
686 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
689 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid = pd.fk_facture';
691 if (!empty($search_fac_rec_source_title)) {
692 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid';
694 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
695 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
697 $parameters = array();
698 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
699 $sql .= $hookmanager->resPrint;
701 $sql .=
' WHERE f.fk_soc = s.rowid';
702 $sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
704 $sql .=
' AND s.rowid = '.((int) $socid);
708 $sql .=
' AND f.fk_user_author IS NULL';
710 $sql .=
' AND f.fk_user_author = '.((int) $userid);
716 if ($search_refcustomer) {
719 if ($search_type !=
'' && $search_type !=
'-1') {
720 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
722 if ($search_subtype !=
'' && $search_subtype !=
'-1') {
723 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
725 if ($search_project_ref) {
728 if ($search_project) {
731 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
734 if ($search_company) {
737 if ($search_company_alias) {
741 if ($search_parent_name) {
744 if ($search_customer_code) {
756 if (strlen(trim($search_country))) {
758 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
759 foreach ($arrayofcode as $key => $value) {
760 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
761 if ($value != $mysoc->country_code) {
762 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
765 if ($search_country ==
'special_allnotme') {
766 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
767 } elseif ($search_country ==
'special_eec') {
768 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
769 } elseif ($search_country ==
'special_eecnotme') {
770 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
771 } elseif ($search_country ==
'special_noteec') {
772 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
777 if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
778 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
780 if ($search_montant_ht !=
'') {
783 if ($search_montant_vat !=
'') {
786 if ($search_montant_localtax1 !=
'') {
789 if ($search_montant_localtax2 !=
'') {
792 if ($search_montant_ttc !=
'') {
795 if ($search_multicurrency_code !=
'') {
796 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
798 if ($search_multicurrency_tx !=
'') {
801 if ($search_multicurrency_montant_ht !=
'') {
802 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
804 if ($search_multicurrency_montant_vat !=
'') {
805 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
807 if ($search_multicurrency_montant_ttc !=
'') {
808 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
813 if ($search_status !=
'-1' && $search_status !=
'') {
814 if (is_numeric($search_status) && $search_status >= 0) {
815 if ($search_status ==
'0') {
816 $sql .=
" AND f.fk_statut = 0";
818 if ($search_status ==
'1') {
819 $sql .=
" AND f.fk_statut = 1";
821 if ($search_status ==
'2') {
822 $sql .=
" AND f.fk_statut = 2";
824 if ($search_status ==
'3') {
825 $sql .=
" AND f.fk_statut = 3";
828 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
832 if ($search_paymentmode > 0) {
833 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
835 if ($search_paymentterms > 0) {
836 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
838 if ($search_module_source) {
841 if ($search_pos_source) {
844 if ($search_date_start) {
845 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
847 if ($search_date_end) {
848 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
850 if ($search_date_valid_start) {
851 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
853 if ($search_date_valid_end) {
854 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
856 if ($search_datelimit_start) {
857 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
859 if ($search_datelimit_end) {
860 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
862 if ($search_late ==
'late') {
863 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
868 if (!empty($search_fac_rec_source_title)) {
872 if ($search_user > 0) {
873 $sql .=
" AND EXISTS (";
874 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
875 $sql .=
" FROM llx_element_contact as ec";
876 $sql .=
" INNER JOIN llx_c_type_contact as tc";
877 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal'";
878 $sql .=
" WHERE ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
881 if ($search_sale && $search_sale !=
'-1') {
882 if ($search_sale == -2) {
883 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
884 } elseif ($search_sale > 0) {
885 $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).
")";
889 $searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
890 $searchCategoryProductOperator = 0;
891 if (!empty($searchCategoryProductList)) {
892 $searchCategoryProductSqlList = array();
893 $listofcategoryid =
'';
894 foreach ($searchCategoryProductList as $searchCategoryProduct) {
895 if (intval($searchCategoryProduct) == -2) {
896 $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)";
897 } elseif (intval($searchCategoryProduct) > 0) {
898 if ($searchCategoryProductOperator == 0) {
899 $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).
")";
901 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
905 if ($listofcategoryid) {
906 $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).
"))";
908 if ($searchCategoryProductOperator == 1) {
909 if (!empty($searchCategoryProductSqlList)) {
910 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
913 if (!empty($searchCategoryProductSqlList)) {
914 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
918 $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
919 $searchCategoryCustomerOperator = 0;
921 if (!empty($searchCategoryCustomerList)) {
922 $searchCategoryCustomerSqlList = array();
923 $listofcategoryid =
'';
924 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
925 if (intval($searchCategoryCustomer) == -2) {
926 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
927 } elseif (intval($searchCategoryCustomer) > 0) {
928 if ($searchCategoryCustomerOperator == 0) {
929 $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).
")";
931 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
935 if ($listofcategoryid) {
936 $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).
"))";
938 if ($searchCategoryCustomerOperator == 1) {
939 if (!empty($searchCategoryCustomerSqlList)) {
940 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
943 if (!empty($searchCategoryCustomerSqlList)) {
944 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
949 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
951 $parameters = array();
952 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
953 $sql .= $hookmanager->resPrint;
960 $parameters = array();
961 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters,
$object, $action);
962 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
965 $nbtotalofrecords =
'';
968 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
969 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
971 $resql = $db->query($sqlforcount);
973 $objforcount = $db->fetch_object($resql);
974 $nbtotalofrecords = $objforcount->nbtotalofrecords;
979 if (($page * $limit) > $nbtotalofrecords) {
987 $sql .= $db->order($sortfield, $sortorder);
989 $sql .= $db->plimit($limit + 1, $offset);
992 $resql = $db->query(
$sql);
998 $num = $db->num_rows($resql);
1000 $arrayofselected = is_array($toselect) ? $toselect : array();
1002 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1003 $obj = $db->fetch_object($resql);
1006 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?id='.$id);
1015 $param =
'&socid='.urlencode((
string) ($socid));
1016 if (!empty($mode)) {
1017 $param .=
'&mode='.urlencode($mode);
1019 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1020 $param .=
'&contextpage='.urlencode($contextpage);
1022 if ($limit > 0 && $limit != $conf->liste_limit) {
1023 $param .=
'&limit='.((int) $limit);
1026 $param .=
'&search_all='.urlencode($search_all);
1028 if ($search_date_startday) {
1029 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1031 if ($search_date_startmonth) {
1032 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1034 if ($search_date_startyear) {
1035 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1037 if ($search_date_endday) {
1038 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1040 if ($search_date_endmonth) {
1041 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1043 if ($search_date_endyear) {
1044 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1046 if ($search_date_valid_startday) {
1047 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1049 if ($search_date_valid_startmonth) {
1050 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1052 if ($search_date_valid_startyear) {
1053 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1055 if ($search_date_valid_endday) {
1056 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1058 if ($search_date_valid_endmonth) {
1059 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1061 if ($search_date_valid_endyear) {
1062 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1064 if ($search_datelimit_startday) {
1065 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
1067 if ($search_datelimit_startmonth) {
1068 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
1070 if ($search_datelimit_startyear) {
1071 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
1073 if ($search_datelimit_endday) {
1074 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
1076 if ($search_datelimit_endmonth) {
1077 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
1079 if ($search_datelimit_endyear) {
1080 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
1083 $param .=
'&search_ref='.urlencode($search_ref);
1085 if ($search_refcustomer) {
1086 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1088 if ($search_project_ref) {
1089 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1091 if ($search_project) {
1092 $param .=
'&search_project='.urlencode($search_project);
1094 if ($search_type !=
'') {
1095 $param .=
'&search_type='.urlencode($search_type);
1097 if ($search_subtype !=
'') {
1098 $param .=
'&search_subtype='.urlencode($search_subtype);
1100 if ($search_company) {
1101 $param .=
'&search_company='.urlencode($search_company);
1103 if ($search_company_alias) {
1104 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1106 if ($search_parent_name !=
'') {
1107 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1110 $param .=
'&search_town='.urlencode($search_town);
1113 $param .=
'&search_zip='.urlencode($search_zip);
1115 if ($search_country) {
1116 $param .=
"&search_country=".urlencode($search_country);
1118 if ($search_type_thirdparty !=
'') {
1119 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1121 if ($search_customer_code) {
1122 $param .=
'&search_customer_code='.urlencode($search_customer_code);
1124 if ($search_sale > 0) {
1125 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1127 if ($search_user > 0) {
1128 $param .=
'&search_user='.urlencode((
string) $search_user);
1130 if ($search_login) {
1131 $param .=
'&search_login='.urlencode($search_login);
1133 if ($search_product_category > 0) {
1134 $param .=
'&search_product_category='.urlencode((
string) $search_product_category);
1136 if ($search_montant_ht !=
'') {
1137 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1139 if ($search_montant_vat !=
'') {
1140 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1142 if ($search_montant_localtax1 !=
'') {
1143 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1145 if ($search_montant_localtax2 !=
'') {
1146 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1148 if ($search_montant_ttc !=
'') {
1149 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1151 if ($search_multicurrency_code !=
'') {
1152 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1154 if ($search_multicurrency_tx !=
'') {
1155 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1157 if ($search_multicurrency_montant_ht !=
'') {
1158 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1160 if ($search_multicurrency_montant_vat !=
'') {
1161 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1163 if ($search_multicurrency_montant_ttc !=
'') {
1164 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1166 if ($search_status !=
'') {
1167 $param .=
'&search_status='.urlencode($search_status);
1169 if ($search_paymentmode > 0) {
1170 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1172 if ($search_paymentterms > 0) {
1173 $param .=
'&search_paymentterms='.urlencode((
string) ($search_paymentterms));
1175 if ($search_module_source) {
1176 $param .=
'&search_module_source='.urlencode($search_module_source);
1178 if ($search_pos_source) {
1179 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1182 $param .=
'&show_files='.urlencode((
string) ($show_files));
1185 $param .=
"&search_late=".urlencode($search_late);
1187 if ($optioncss !=
'') {
1188 $param .=
'&optioncss='.urlencode($optioncss);
1190 if ($search_categ_cus > 0) {
1191 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1193 if (!empty($search_fac_rec_source_title)) {
1194 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1198 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1200 $parameters = array(
'param' => &$param);
1201 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
1202 $param .= $hookmanager->resPrint;
1204 $arrayofmassactions = array(
1205 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1206 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1207 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1208 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1211 if ($user->hasRight(
'facture',
'paiement')) {
1212 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1214 if (
isModEnabled(
'prelevement') && $user->hasRight(
'prelevement',
'bons',
'creer')) {
1215 $langs->load(
"withdrawals");
1216 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1218 if ($user->hasRight(
'facture',
'supprimer')) {
1220 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1222 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1225 if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1226 $arrayofmassactions = array();
1228 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1231 $newcardbutton =
'';
1232 if ($contextpage !=
'poslist') {
1233 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1234 if (!empty($socid)) {
1235 $url .=
'&socid='.$socid;
1237 $newcardbutton =
'';
1238 $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'));
1239 $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'));
1241 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1245 print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1246 if ($optioncss !=
'') {
1247 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1249 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1250 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1251 if (!in_array($massaction, array(
'makepayment'))) {
1252 print
'<input type="hidden" name="action" value="list">';
1254 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1255 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1256 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1257 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1258 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1259 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1261 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1263 $topicmail =
"SendBillRef";
1264 $modelmail =
"facture_send";
1265 $objecttmp =
new Facture($db);
1266 $trackid =
'inv'.$object->id;
1267 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1269 if ($massaction ==
'makepayment') {
1271 $formquestion = array(
1275 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1276 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' => $form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1277 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value' => $form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1280 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1285 foreach ($fieldstosearchall as $key => $val) {
1286 $fieldstosearchall[$key] = $langs->trans($val);
1288 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1292 $moreforfilter =
'';
1293 if ($user->hasRight(
"user",
"user",
"lire")) {
1294 $langs->load(
"commercial");
1295 $moreforfilter .=
'<div class="divsearchfield">';
1296 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1297 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1298 $moreforfilter .=
'</div>';
1301 if ($user->hasRight(
"user",
"user",
"lire")) {
1302 $moreforfilter .=
'<div class="divsearchfield">';
1303 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1304 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1305 $moreforfilter .=
'</div>';
1308 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1309 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1310 $moreforfilter .=
'<div class="divsearchfield">';
1311 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1312 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1313 $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);
1314 $moreforfilter .=
'</div>';
1316 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1317 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1318 $moreforfilter .=
'<div class="divsearchfield">';
1319 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1320 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1321 $moreforfilter .=
'</div>';
1324 $moreforfilter .=
'<div class="divsearchfield">';
1325 $moreforfilter .= $langs->trans(
'Alert').
' <input type="checkbox" name="search_late" value="late"'.($search_late ==
'late' ?
' checked' :
'').
'>';
1326 $moreforfilter .=
'</div>';
1328 $parameters = array();
1329 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
1330 if (empty($reshook)) {
1331 $moreforfilter .= $hookmanager->resPrint;
1333 $moreforfilter = $hookmanager->resPrint;
1336 if (!empty($moreforfilter)) {
1337 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1338 print $moreforfilter;
1342 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1343 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1346 if ($massactionbutton && $contextpage !=
'poslist') {
1347 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1350 print
'<div class="div-table-responsive">';
1351 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1355 print
'<tr class="liste_titre_filter">';
1359 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1360 $searchpicto = $form->showFilterButtons(
'left');
1366 print
'<td class="liste_titre">';
1370 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1371 print
'<td class="liste_titre" align="left">';
1372 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1376 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1377 print
'<td class="liste_titre">';
1378 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1382 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1383 print
'<td class="liste_titre maxwidthonsmartphone">';
1395 print $form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1399 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1400 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1401 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1405 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1406 print
'<td class="liste_titre center">';
1407 print
'<div class="nowrapfordate">';
1408 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1410 print
'<div class="nowrapfordate">';
1411 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1416 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1417 print
'<td class="liste_titre center">';
1418 print
'<div class="nowrapfordate">';
1419 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'));
1421 print
'<div class="nowrapfordate">';
1422 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'));
1427 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1428 print
'<td class="liste_titre center">';
1429 print
'<div class="nowrapfordate">';
1430 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1432 print
'<div class="nowrapfordate">';
1433 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1438 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1439 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1442 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1443 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1446 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1447 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1450 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1451 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1454 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1455 print
'<td class="liste_titre">';
1456 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1460 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1461 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'"></td>';
1464 if (!empty($arrayfields[
's.town'][
'checked'])) {
1465 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1468 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1469 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1472 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1473 print
'<td class="liste_titre">';
1474 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1478 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1479 print
'<td class="liste_titre center">';
1480 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1484 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1485 print
'<td class="liste_titre maxwidthonsmartphone center">';
1486 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);
1490 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1491 print
'<td class="liste_titre">';
1492 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1496 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1497 print
'<td class="liste_titre left">';
1498 print $form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1502 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1503 print
'<td class="liste_titre">';
1504 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1508 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1509 print
'<td class="liste_titre">';
1510 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1513 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1515 print
'<td class="liste_titre right">';
1516 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1519 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1521 print
'<td class="liste_titre right">';
1522 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1525 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1527 print
'<td class="liste_titre right">';
1528 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1531 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1533 print
'<td class="liste_titre right">';
1534 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1537 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1539 print
'<td class="liste_titre right">';
1540 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1543 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1545 print
'<td class="liste_titre" align="center">';
1546 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1549 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1550 print
'<td class="liste_titre"></td>';
1552 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1553 print
'<td class="liste_titre" align="right">';
1556 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1557 print
'<td class="liste_titre right">';
1560 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1561 print
'<td class="liste_titre">';
1564 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1566 print
'<td class="liste_titre">';
1567 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1570 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1572 print
'<td class="liste_titre">';
1573 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1576 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1578 print
'<td class="liste_titre right">';
1579 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1582 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1584 print
'<td class="liste_titre right">';
1585 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1588 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1590 print
'<td class="liste_titre right">';
1591 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1594 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1595 print
'<td class="liste_titre">';
1598 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1599 print
'<td class="liste_titre right">';
1602 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1603 print
'<td class="liste_titre right">';
1606 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1607 print
'<td class="liste_titre right">';
1610 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1611 print
'<td class="liste_titre right">';
1614 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1615 print
'<td class="liste_titre right">';
1620 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1623 $parameters = array(
'arrayfields' => $arrayfields);
1624 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
1625 print $hookmanager->resPrint;
1627 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1628 print
'<td class="liste_titre">';
1632 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1633 print
'<td class="liste_titre">';
1637 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1638 print
'<td class="liste_titre">';
1641 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1643 print
'<td class="liste_titre">';
1646 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1648 print
'<td class="liste_titre">';
1651 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1653 print
'<td class="liste_titre maxwidthonsmartphone right">';
1654 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).
'">';
1658 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1659 print
'<td class="liste_titre right parentonrightofpage">';
1660 $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"));
1662 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1667 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1668 $searchpicto = $form->showFilterButtons();
1674 $totalarray = array();
1675 $totalarray[
'nbfield'] = 0;
1679 print
'<tr class="liste_titre">';
1681 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1682 $totalarray[
'nbfield']++;
1686 $totalarray[
'nbfield']++;
1688 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1689 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1690 $totalarray[
'nbfield']++;
1692 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1693 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1694 $totalarray[
'nbfield']++;
1696 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1697 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1698 $totalarray[
'nbfield']++;
1700 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1703 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'', $sortfield, $sortorder,
'center ');
1705 $totalarray[
'nbfield']++;
1707 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1708 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1709 $totalarray[
'nbfield']++;
1711 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1713 $totalarray[
'nbfield']++;
1715 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1716 $langs->load(
"projects");
1717 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1718 $totalarray[
'nbfield']++;
1720 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1721 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1722 $totalarray[
'nbfield']++;
1724 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1726 $totalarray[
'nbfield']++;
1728 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1730 $totalarray[
'nbfield']++;
1732 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1733 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1734 $totalarray[
'nbfield']++;
1736 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
'PHP_SELF'],
's.code_client',
'', $param,
'', $sortfield, $sortorder);
1738 $totalarray[
'nbfield']++;
1740 if (!empty($arrayfields[
's.town'][
'checked'])) {
1741 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1742 $totalarray[
'nbfield']++;
1744 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1745 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1746 $totalarray[
'nbfield']++;
1748 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1750 $totalarray[
'nbfield']++;
1752 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1754 $totalarray[
'nbfield']++;
1756 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1758 $totalarray[
'nbfield']++;
1760 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1762 $totalarray[
'nbfield']++;
1764 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1766 $totalarray[
'nbfield']++;
1768 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1770 $totalarray[
'nbfield']++;
1772 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1774 $totalarray[
'nbfield']++;
1776 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1778 $totalarray[
'nbfield']++;
1780 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1782 $totalarray[
'nbfield']++;
1784 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1786 $totalarray[
'nbfield']++;
1788 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1790 $totalarray[
'nbfield']++;
1792 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1794 $totalarray[
'nbfield']++;
1796 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1798 $totalarray[
'nbfield']++;
1800 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1801 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1802 $totalarray[
'nbfield']++;
1804 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1805 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1806 $totalarray[
'nbfield']++;
1808 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1809 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1810 $totalarray[
'nbfield']++;
1812 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1813 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1814 $totalarray[
'nbfield']++;
1816 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1817 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1818 $totalarray[
'nbfield']++;
1820 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1821 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1822 $totalarray[
'nbfield']++;
1824 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1826 $totalarray[
'nbfield']++;
1828 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1830 $totalarray[
'nbfield']++;
1832 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1834 $totalarray[
'nbfield']++;
1836 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1838 $totalarray[
'nbfield']++;
1840 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1842 $totalarray[
'nbfield']++;
1844 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1846 $totalarray[
'nbfield']++;
1848 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1849 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1850 $totalarray[
'nbfield']++;
1852 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1854 $totalarray[
'nbfield']++;
1856 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1857 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1858 $totalarray[
'nbfield']++;
1861 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1863 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => $totalarray);
1864 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
1865 print $hookmanager->resPrint;
1866 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1867 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1868 $totalarray[
'nbfield']++;
1870 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1871 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1872 $totalarray[
'nbfield']++;
1874 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1875 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center ');
1876 $totalarray[
'nbfield']++;
1878 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1879 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1880 $totalarray[
'nbfield']++;
1882 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1883 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1884 $totalarray[
'nbfield']++;
1886 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1887 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1888 $totalarray[
'nbfield']++;
1890 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1891 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1892 $totalarray[
'nbfield']++;
1895 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1896 $totalarray[
'nbfield']++;
1901 $projectstatic =
new Project($db);
1903 $userstatic =
new User($db);
1909 $savnbfield = $totalarray[
'nbfield'];
1910 $totalarray = array();
1911 $totalarray[
'nbfield'] = 0;
1912 $totalarray[
'val'] = array();
1913 $totalarray[
'val'][
'f.total_ht'] = 0;
1914 $totalarray[
'val'][
'f.total_tva'] = 0;
1915 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1916 $totalarray[
'val'][
'f.total_localtax1'] = 0;
1917 $totalarray[
'val'][
'f.total_ttc'] = 0;
1918 $totalarray[
'val'][
'totalam'] = 0;
1919 $totalarray[
'val'][
'rtp'] = 0;
1921 $typenArray = $formcompany->typent_array(1);
1923 $with_margin_info =
false;
1925 !empty($arrayfields[
'total_pa'][
'checked'])
1926 || !empty($arrayfields[
'total_margin'][
'checked'])
1927 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1928 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1931 $with_margin_info =
true;
1936 $imaxinloop = ($limit ? min($num, $limit) : $num);
1937 while ($i < $imaxinloop) {
1938 $obj = $db->fetch_object($resql);
1940 $datelimit = $db->jdate($obj->datelimite);
1942 $facturestatic->id = $obj->id;
1943 $facturestatic->ref = $obj->ref;
1944 $facturestatic->ref_client = $obj->ref_client;
1945 $facturestatic->ref_customer = $obj->ref_client;
1946 $facturestatic->type = $obj->type;
1947 $facturestatic->subtype = $obj->subtype;
1948 $facturestatic->total_ht = $obj->total_ht;
1949 $facturestatic->total_tva = $obj->total_tva;
1950 $facturestatic->total_ttc = $obj->total_ttc;
1951 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1952 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1953 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1954 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1955 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1956 $facturestatic->statut = $obj->fk_statut;
1957 $facturestatic->status = $obj->fk_statut;
1958 $facturestatic->close_code = $obj->close_code;
1959 $facturestatic->total_ttc = $obj->total_ttc;
1960 $facturestatic->paye = $obj->paye;
1961 $facturestatic->socid = $obj->fk_soc;
1963 $facturestatic->date = $db->jdate($obj->datef);
1964 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1965 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1967 $facturestatic->note_public = $obj->note_public;
1968 $facturestatic->note_private = $obj->note_private;
1971 $facturestatic->retained_warranty = $obj->retained_warranty;
1972 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1973 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1974 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1975 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1976 $facturestatic->situation_counter = $obj->situation_counter;
1979 $companystatic->id = $obj->socid;
1980 $companystatic->name = $obj->name;
1981 $companystatic->name_alias = $obj->alias;
1982 $companystatic->client = $obj->client;
1983 $companystatic->fournisseur = $obj->fournisseur;
1984 $companystatic->code_client = $obj->code_client;
1985 $companystatic->code_compta_client = $obj->code_compta_client;
1986 $companystatic->code_fournisseur = $obj->code_fournisseur;
1987 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1988 $companystatic->email = $obj->email;
1989 $companystatic->phone = $obj->phone;
1990 $companystatic->fax = $obj->fax;
1991 $companystatic->address = $obj->address;
1992 $companystatic->zip = $obj->zip;
1993 $companystatic->town = $obj->town;
1994 $companystatic->country_code = $obj->country_code;
1996 $projectstatic->id = $obj->project_id;
1997 $projectstatic->ref = $obj->project_ref;
1998 $projectstatic->title = $obj->project_label;
2000 $paiement = $facturestatic->getSommePaiement();
2001 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
2002 $totaldeposits = $facturestatic->getSumDepositsUsed();
2003 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2004 $remaintopay = $obj->total_ttc - $totalpay;
2006 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
2007 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
2008 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
2010 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
2011 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
2013 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
2014 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
2018 $multicurrency_remaintopay = 0;
2021 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
2022 $remaintopay = -$remaincreditnote;
2023 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
2024 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
2025 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
2026 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
2029 $facturestatic->alreadypaid = $paiement;
2031 $marginInfo = array();
2032 if ($with_margin_info ===
true) {
2033 $facturestatic->fetch_lines();
2034 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
2035 $total_ht += $obj->total_ht;
2036 $total_margin += $marginInfo[
'total_margin'];
2041 if ($mode ==
'kanban') {
2043 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2044 print
'<div class="box-flex-container kanban">';
2047 if ($massactionbutton || $massaction) {
2049 if (in_array(
$object->id, $arrayofselected)) {
2054 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $companystatic->getNomUrl(1,
'', 12),
'userauthor' => $userstatic->getNomUrl(1),
'selected' => in_array(
$object->id, $arrayofselected));
2055 print $facturestatic->getKanbanView(
'', $arraydata);
2056 if ($i == ($imaxinloop - 1)) {
2063 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
2064 if ($contextpage ==
'poslist') {
2065 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
2066 if (strpos($obj->ref, 'PROV
') !== false) {
2067 //If is a draft invoice, load var to be able to add products
2068 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
2069 print 'parent.place=\
''.dol_escape_js($place).
'\'';
2077 print
'<td class="nowrap center">';
2078 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2080 if (in_array($obj->id, $arrayofselected)) {
2083 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2087 $totalarray[
'nbfield']++;
2093 print
'<td>'.(($offset * $limit) + $i).
'</td>';
2095 $totalarray[
'nbfield']++;
2100 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
2101 print
'<td class="nowraponall">';
2103 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
2105 print
'<td class="nobordernopadding nowraponall">';
2106 if ($contextpage ==
'poslist') {
2109 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
2114 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
2115 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
2122 $totalarray[
'nbfield']++;
2127 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
2128 print
'<td class="nowrap tdoverflowmax200">';
2132 $totalarray[
'nbfield']++;
2137 if (!empty($arrayfields[
'f.type'][
'checked'])) {
2138 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
2139 print $facturestatic->getLibType(2);
2142 $totalarray[
'nbfield']++;
2147 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
2149 if ($facturestatic->subtype > 0) {
2150 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture');
2152 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
2156 $totalarray[
'nbfield']++;
2161 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
2162 print
'<td align="center" class="nowraponall">';
2166 $totalarray[
'nbfield']++;
2171 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
2172 print
'<td align="center" class="nowraponall">';
2176 $totalarray[
'nbfield']++;
2181 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
2182 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
2183 if ($facturestatic->hasDelay()) {
2184 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2188 $totalarray[
'nbfield']++;
2193 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2194 print
'<td class="nocellnopadd nowraponall">';
2195 if ($obj->project_id > 0) {
2196 print $projectstatic->getNomUrl(1);
2200 $totalarray[
'nbfield']++;
2205 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2206 print
'<td class="nowraponall">';
2207 if ($obj->project_id > 0) {
2212 $totalarray[
'nbfield']++;
2217 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2218 print
'<td class="tdoverflowmax200">';
2219 if ($contextpage ==
'poslist') {
2222 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2226 $totalarray[
'nbfield']++;
2230 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2231 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2235 $totalarray[
'nbfield']++;
2239 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2240 print
'<td class="tdoverflowmax200">';
2241 if ($obj->fk_parent > 0) {
2242 if (!isset($company_url_list[$obj->fk_parent])) {
2243 $companyparent =
new Societe($db);
2244 $res = $companyparent->fetch($obj->fk_parent);
2246 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2249 if (isset($company_url_list[$obj->fk_parent])) {
2250 print $company_url_list[$obj->fk_parent];
2255 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
2260 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->code_client).
'">';
2264 $totalarray[
'nbfield']++;
2268 if (!empty($arrayfields[
's.town'][
'checked'])) {
2269 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2273 $totalarray[
'nbfield']++;
2277 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2278 print
'<td class="nowraponall">';
2282 $totalarray[
'nbfield']++;
2286 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2287 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2289 $totalarray[
'nbfield']++;
2293 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2294 $tmparray =
getCountry($obj->fk_pays,
'all');
2295 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
2299 $totalarray[
'nbfield']++;
2303 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2304 print
'<td class="center">';
2305 if (!is_array($typenArray) || count($typenArray) == 0) {
2306 $typenArray = $formcompany->typent_array(1);
2308 if (!empty($obj->typent_code)) {
2309 print $typenArray[$obj->typent_code];
2313 $totalarray[
'nbfield']++;
2317 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2318 print
'<td class="center">';
2319 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2320 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2322 print $conf->cache[
'staff'][$obj->staff_code];
2325 $totalarray[
'nbfield']++;
2330 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2331 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2332 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2336 $totalarray[
'nbfield']++;
2341 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2342 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2343 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2347 $totalarray[
'nbfield']++;
2352 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2357 $totalarray[
'nbfield']++;
2362 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2367 $totalarray[
'nbfield']++;
2372 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2373 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2375 $totalarray[
'nbfield']++;
2378 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2380 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2383 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2384 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2386 $totalarray[
'nbfield']++;
2389 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2391 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2394 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2395 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2397 $totalarray[
'nbfield']++;
2400 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2402 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2405 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2406 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2408 $totalarray[
'nbfield']++;
2411 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2413 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2416 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2417 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2419 $totalarray[
'nbfield']++;
2422 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2424 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2427 $userstatic->id = $obj->fk_user_author;
2428 $userstatic->login = $obj->login;
2429 $userstatic->lastname = $obj->lastname;
2430 $userstatic->firstname = $obj->firstname;
2431 $userstatic->email = $obj->user_email;
2432 $userstatic->status = $obj->user_statut;
2433 $userstatic->entity = $obj->entity;
2434 $userstatic->photo = $obj->photo;
2435 $userstatic->office_phone = $obj->office_phone;
2436 $userstatic->office_fax = $obj->office_fax;
2437 $userstatic->user_mobile = $obj->user_mobile;
2438 $userstatic->job = $obj->job;
2439 $userstatic->gender = $obj->gender;
2442 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2443 print
'<td class="tdoverflowmax200">';
2444 if ($userstatic->id) {
2445 print $userstatic->getNomUrl(-1);
2451 $totalarray[
'nbfield']++;
2455 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2458 if ($obj->socid > 0) {
2459 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2460 if ($listsalesrepresentatives < 0) {
2463 $nbofsalesrepresentative = count($listsalesrepresentatives);
2464 if ($nbofsalesrepresentative > 6) {
2466 print $nbofsalesrepresentative;
2467 } elseif ($nbofsalesrepresentative > 0) {
2469 foreach ($listsalesrepresentatives as $val) {
2470 $userstatic->id = $val[
'id'];
2471 $userstatic->lastname = $val[
'lastname'];
2472 $userstatic->firstname = $val[
'firstname'];
2473 $userstatic->email = $val[
'email'];
2474 $userstatic->status = $val[
'statut'];
2475 $userstatic->entity = $val[
'entity'];
2476 $userstatic->photo = $val[
'photo'];
2477 $userstatic->login = $val[
'login'];
2478 $userstatic->office_phone = $val[
'office_phone'];
2479 $userstatic->office_fax = $val[
'office_fax'];
2480 $userstatic->user_mobile = $val[
'user_mobile'];
2481 $userstatic->job = $val[
'job'];
2482 $userstatic->gender = $val[
'gender'];
2484 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2486 if ($j < $nbofsalesrepresentative) {
2498 $totalarray[
'nbfield']++;
2502 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2503 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2505 $totalarray[
'nbfield']++;
2509 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2510 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2512 $totalarray[
'nbfield']++;
2515 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2517 $totalarray[
'val'][
'totalam'] += $totalpay;
2521 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2522 print
'<td class="right nowraponall amount">';
2523 print(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2526 $totalarray[
'nbfield']++;
2529 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2531 $totalarray[
'val'][
'rtp'] += $remaintopay;
2536 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2537 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2539 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2545 $totalarray[
'nbfield']++;
2550 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2551 print
'<td class="nowraponall">';
2552 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2555 $totalarray[
'nbfield']++;
2559 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2560 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2562 $totalarray[
'nbfield']++;
2566 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2567 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2569 $totalarray[
'nbfield']++;
2573 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2574 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2576 $totalarray[
'nbfield']++;
2580 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2581 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2583 $totalarray[
'nbfield']++;
2588 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2589 print
'<td class="right nowraponall">';
2590 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2593 $totalarray[
'nbfield']++;
2598 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2599 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total'], 0, $langs, 1, -1,
'MT').
'</td>';
2601 $totalarray[
'nbfield']++;
2602 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_pa';
2604 if (empty($totalarray[
'val'][
'total_pa'])) {
2605 $totalarray[
'val'][
'total_pa'] = 0;
2607 $totalarray[
'val'][
'total_pa'] += $marginInfo[
'pa_total'];
2610 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2611 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin'], 0, $langs, 1, -1,
'MT').
'</td>';
2613 $totalarray[
'nbfield']++;
2614 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2616 if (empty($totalarray[
'val'][
'total_margin'])) {
2617 $totalarray[
'val'][
'total_margin'] = 0;
2619 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2622 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2623 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2625 $totalarray[
'nbfield']++;
2629 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2630 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2632 $totalarray[
'nbfield']++;
2633 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2635 if ($i >= $imaxinloop - 1) {
2636 if (!empty($total_ht)) {
2637 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2639 $totalarray[
'val'][
'total_mark_rate'] =
'';
2645 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2647 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2648 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
2649 print $hookmanager->resPrint;
2651 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2652 print
'<td class="nowraponall center">';
2653 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2656 $totalarray[
'nbfield']++;
2660 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2661 print
'<td class="nowraponall center">';
2662 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2665 $totalarray[
'nbfield']++;
2669 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2670 print
'<td class="nowraponall center">';
2671 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2674 $totalarray[
'nbfield']++;
2678 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2679 print
'<td class="sensiblehtmlcontent center">';
2683 $totalarray[
'nbfield']++;
2687 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2688 print
'<td class="center">';
2692 $totalarray[
'nbfield']++;
2696 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2697 print
'<td class="center">';
2698 if (!empty($obj->fk_fac_rec_source)) {
2700 $result = $facrec->fetch($obj->fk_fac_rec_source);
2704 print $facrec->getNomUrl();
2709 $totalarray[
'nbfield']++;
2713 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2714 print
'<td class="nowrap center">';
2715 print $facturestatic->getLibStatut(5, $paiement);
2718 $totalarray[
'nbfield']++;
2725 print
'<td class="nowrap center">';
2726 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2728 if (in_array($obj->id, $arrayofselected)) {
2731 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2735 $totalarray[
'nbfield']++;
2746 $totalarray[
'val'][
'total_pa'] = (isset($totalarray[
'val'][
'total_pa']) ?
price2num($totalarray[
'val'][
'total_pa'],
'MT') : null);
2747 $totalarray[
'val'][
'total_margin'] = (isset($totalarray[
'val'][
'total_margin']) ?
price2num($totalarray[
'val'][
'total_margin'],
'MT') : null);
2750 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2756 foreach ($arrayfields as $key => $val) {
2757 if (!empty($val[
'checked'])) {
2761 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2766 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
2767 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
2768 print $hookmanager->resPrint;
2770 print
'</table>'.
"\n";
2771 print
'</div>'.
"\n";
2773 print
'</form>'.
"\n";
2776 if ($contextpage !=
'poslist') {
2777 $hidegeneratedfilelistifempty = 1;
2778 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2779 $hidegeneratedfilelistifempty = 0;
2783 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2784 $urlsource .= str_replace(
'&',
'&', $param);
2786 $filedir = $diroutputmassaction;
2787 $genallowed = $user->hasRight(
"facture",
"lire");
2788 $delallowed = $user->hasRight(
"facture",
"creer");
2791 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
print_barre_liste($title, $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.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$formconfirm
if ($action == 'delbookkeepingyear') {
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.