33 require
'../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture-rec.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
45 $langs->loadLangs(array(
'bills',
'compta',
'admin',
'other',
'suppliers'));
47 $action =
GETPOST(
'action',
'alpha');
48 $massaction =
GETPOST(
'massaction',
'alpha');
49 $show_files =
GETPOST(
'show_files',
'int');
50 $confirm =
GETPOST(
'confirm',
'alpha');
51 $cancel =
GETPOST(
'cancel',
'alpha');
52 $toselect =
GETPOST(
'toselect',
'array');
53 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
54 $optioncss =
GETPOST(
'optioncss',
'alpha');
56 $socid =
GETPOST(
'socid',
'int');
60 $lineid =
GETPOST(
'lineid',
'int');
63 $socid = $user->socid;
65 $objecttype =
'facture_fourn_rec';
66 if ($action ==
"create" || $action ==
"add") {
71 $search_ref =
GETPOST(
'search_ref');
72 $search_societe =
GETPOST(
'search_societe');
73 $search_montant_ht =
GETPOST(
'search_montant_ht');
74 $search_montant_vat =
GETPOST(
'search_montant_vat');
75 $search_montant_ttc =
GETPOST(
'search_montant_ttc');
76 $search_payment_mode =
GETPOST(
'search_payment_mode');
77 $search_payment_term =
GETPOST(
'search_payment_term');
78 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
79 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
80 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
81 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
82 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
83 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
84 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
85 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
86 $search_date_when_startday =
GETPOST(
'search_date_when_startday',
'int');
87 $search_date_when_startmonth =
GETPOST(
'search_date_when_startmonth',
'int');
88 $search_date_when_startyear =
GETPOST(
'search_date_when_startyear',
'int');
89 $search_date_when_endday =
GETPOST(
'search_date_when_endday',
'int');
90 $search_date_when_endmonth =
GETPOST(
'search_date_when_endmonth',
'int');
91 $search_date_when_endyear =
GETPOST(
'search_date_when_endyear',
'int');
92 $search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
93 $search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
94 $search_recurring =
GETPOST(
'search_recurring',
'int');
95 $search_frequency =
GETPOST(
'search_frequency',
'alpha');
96 $search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
97 $search_status =
GETPOST(
'search_status',
'int');
99 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
100 $sortfield =
GETPOST(
'sortfield',
'alpha');
101 $sortorder =
GETPOST(
'sortorder',
'alpha');
103 if (empty($page) || $page == -1) {
106 $offset = $limit * $page;
111 $sortfield =
'f.titre';
113 $pageprev = $page - 1;
114 $pagenext = $page + 1;
117 if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
118 $ret = $object->fetch($id, $ref);
125 $hookmanager->initHooks(array(
'supplierinvoicereclist'));
129 $extrafields->fetch_name_optionals_label($object->table_element);
131 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
133 $permissionnote = $user->rights->facture->creer;
134 $permissiondellink = $user->rights->facture->creer;
135 $permissiontoedit = $user->rights->facture->creer;
137 $arrayfields = array(
138 'f.titre'=>array(
'label'=>
'Ref',
'checked'=>1),
139 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
140 'f.total_ht'=>array(
'label'=>
'AmountHT',
'checked'=>1),
141 'f.total_tva'=>array(
'label'=>
'AmountVAT',
'checked'=>1),
142 'f.total_ttc'=>array(
'label'=>
'AmountTTC',
'checked'=>1),
143 'f.fk_mode_reglement'=>array(
'label'=>
'PaymentMode',
'checked'=>0),
144 'f.fk_cond_reglement'=>array(
'label'=>
'PaymentTerm',
'checked'=>0),
145 'recurring'=>array(
'label'=>
'RecurringInvoice',
'checked'=>1),
146 'f.frequency'=>array(
'label'=>
'Frequency',
'checked'=>1),
147 'f.unit_frequency'=>array(
'label'=>
'FrequencyUnit',
'checked'=>1),
148 'f.nb_gen_done'=>array(
'label'=>
'NbOfGenerationDoneShort',
'checked'=>1),
149 'f.date_last_gen'=>array(
'label'=>
'DateLastGenerationShort',
'checked'=>1),
150 'f.date_when'=>array(
'label'=>
'NextDateToExecutionShort',
'checked'=>1),
151 'f.fk_user_author'=>array(
'label'=>
'UserCreation',
'checked'=>0,
'position'=>500),
152 'f.fk_user_modif'=>array(
'label'=>
'UserModification',
'checked'=>0,
'position'=>505),
153 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>520),
154 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>525),
155 'suspended '=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
158 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
164 $tmpthirdparty =
new Societe($db);
165 $res = $tmpthirdparty->fetch($socid);
167 $search_societe = $tmpthirdparty->name;
170 $objecttype =
'facture_fourn_rec';
172 $result =
restrictedArea($user,
'facture', $object->id, $objecttype);
179 if (
GETPOST(
'cancel',
'alpha')) {
183 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
187 $parameters = array(
'socid' => $socid);
188 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193 if (empty($reshook)) {
194 if (
GETPOST(
'cancel',
'alpha')) {
199 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
202 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
204 $search_societe =
'';
205 $search_montant_ht =
'';
206 $search_montant_vat =
'';
207 $search_montant_ttc =
'';
208 $search_payment_mode =
'';
209 $search_payment_term =
'';
210 $search_date_startday =
'';
211 $search_date_startmonth =
'';
212 $search_date_startyear =
'';
213 $search_date_endday =
'';
214 $search_date_endmonth =
'';
215 $search_date_endyear =
'';
216 $search_date_start =
'';
217 $search_date_end =
'';
218 $search_date_when_startday =
'';
219 $search_date_when_startmonth =
'';
220 $search_date_when_startyear =
'';
221 $search_date_when_endday =
'';
222 $search_date_when_endmonth =
'';
223 $search_date_when_endyear =
'';
224 $search_date_when_start =
'';
225 $search_date_when_end =
'';
226 $search_recurring =
'';
227 $search_frequency =
'';
228 $search_unit_frequency =
'';
230 $search_array_options = array();
255 $companystatic =
new Societe($db);
257 $tmpuser =
new User($db);
261 $today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
268 $sql =
"SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,";
269 $sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
270 $sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
271 $sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
273 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
274 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
275 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
279 $parameters = array();
280 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
281 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
282 $sql = preg_replace(
'/,\s*$/',
'', $sql);
284 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn_rec as f';
285 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_rec_extrafields as ef ON ef.fk_object = f.rowid';
286 if (empty($user->rights->societe->client->voir) && !$socid) {
287 $sql .=
', '.MAIN_DB_PREFIX.
'societe_commerciaux as sc';
289 $sql .=
' WHERE f.fk_soc = s.rowid';
290 $sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
291 if (empty($user->rights->societe->client->voir) && !$socid) {
292 $sql .=
' AND s.rowid = sc.fk_soc AND sc.fk_user = '. (int) $user->id;
298 $sql .=
' AND s.rowid = '.(int) $socid;
300 if ($search_societe) {
303 if ($search_montant_ht !=
'') {
306 if ($search_montant_vat !=
'') {
309 if ($search_montant_ttc !=
'') {
312 if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
313 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
315 if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
316 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
318 if ($search_recurring ==
'1') {
319 $sql .=
' AND f.frequency > 0';
321 if ($search_recurring ==
'0') {
322 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
324 if ($search_frequency !=
'') {
327 if ($search_unit_frequency !=
'') {
328 $sql .=
' AND f.frequency > 0'.natural_search(
'f.unit_frequency', $search_unit_frequency);
330 if ($search_status !=
'' && $search_status >= -1) {
331 if ($search_status == 0) {
332 $sql .=
' AND frequency = 0 AND suspended = 0';
334 if ($search_status == 1) {
335 $sql .=
' AND frequency != 0 AND suspended = 0';
337 if ($search_status == -1) {
338 $sql .=
' AND suspended = 1';
341 if ($search_date_start) {
342 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
344 if ($search_date_end) {
345 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
347 if ($search_date_when_start) {
348 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
350 if ($search_date_when_end) {
351 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
354 $tmpsortfield = $sortfield;
355 if ($tmpsortfield ==
'recurring') {
356 $tmpsortfield =
'f.frequency';
358 $sql .= $db->order($tmpsortfield, $sortorder);
361 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
362 $result = $db->query($sql);
370 $sql .= $db->plimit($limit + 1, $offset);
372 $resql = $db->query($sql);
374 $num = $db->num_rows(
$resql);
377 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
378 $param .=
'&contextpage='.urlencode($contextpage);
380 if ($limit > 0 && $limit != $conf->liste_limit) {
381 $param .=
'&limit='.urlencode($limit);
384 $param .=
'&socid='.urlencode($socid);
386 if ($search_date_startday) {
387 $param .=
'&search_date_startday='.urlencode($search_date_startday);
389 if ($search_date_startmonth) {
390 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
392 if ($search_date_startyear) {
393 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
395 if ($search_date_endday) {
396 $param .=
'&search_date_endday='.urlencode($search_date_endday);
398 if ($search_date_endmonth) {
399 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
401 if ($search_date_endyear) {
402 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
404 if ($search_date_when_startday) {
405 $param .=
'&search_date_when_startday='.urlencode($search_date_when_startday);
407 if ($search_date_when_startmonth) {
408 $param .=
'&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
410 if ($search_date_when_startyear) {
411 $param .=
'&search_date_when_startyear='.urlencode($search_date_when_startyear);
413 if ($search_date_when_endday) {
414 $param .=
'&search_date_when_endday='.urlencode($search_date_when_endday);
416 if ($search_date_when_endmonth) {
417 $param .=
'&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
419 if ($search_date_when_endyear) {
420 $param .=
'&search_date_when_endyear='.urlencode($search_date_when_endyear);
423 $param .=
'&search_ref='.urlencode($search_ref);
425 if ($search_societe) {
426 $param .=
'&search_societe='.urlencode($search_societe);
428 if ($search_montant_ht !=
'') {
429 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
431 if ($search_montant_vat !=
'') {
432 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
434 if ($search_montant_ttc !=
'') {
435 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
437 if ($search_payment_mode !=
'') {
438 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
440 if ($search_payment_term !=
'') {
441 $param .=
'&search_payment_term='.urlencode($search_payment_term);
443 if ($search_recurring !=
'' && $search_recurring !=
'-1') {
444 $param .=
'&search_recurring='.urlencode($search_recurring);
446 if ($search_frequency > 0) {
447 $param .=
'&search_frequency='.urlencode($search_frequency);
449 if ($search_unit_frequency !=
'') {
450 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
452 if ($search_status !=
'') {
453 $param .=
'&search_status='.urlencode($search_status);
455 if ($optioncss !=
'') {
456 $param .=
'&optioncss='.urlencode($optioncss);
459 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
461 $massactionbutton =
$form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend'=>$langs->trans(
"SendByMail"),
'builddoc'=>$langs->trans(
"PDFMerge")));
463 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
464 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
467 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
468 if ($optioncss !=
'') {
469 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
471 print
'<input type="hidden" name="token" value="'.newToken().
'">';
472 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
473 print
'<input type="hidden" name="action" value="list">';
474 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
475 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
476 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
477 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
479 $title = $langs->trans(
"RepeatableSupplierInvoices");
481 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
483 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedSupplierInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
489 print
'<div class="div-table-responsive">';
490 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
493 print
'<tr class="liste_titre_filter">';
495 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
496 print
'<td class="liste_titre left">';
497 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
501 if (!empty($arrayfields[
's.nom'][
'checked'])) {
502 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
504 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
506 print
'<td class="liste_titre right">';
507 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
510 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
512 print
'<td class="liste_titre right">';
513 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
516 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
518 print
'<td class="liste_titre right">';
519 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
522 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
524 print
'<td class="liste_titre right">';
525 print
$form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
528 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
530 print
'<td class="liste_titre right">';
531 print
$form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
534 if (!empty($arrayfields[
'recurring'][
'checked'])) {
536 print
'<td class="liste_titre center">';
537 print
$form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
540 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
542 print
'<td class="liste_titre center">';
543 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
546 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
548 print
'<td class="liste_titre center">';
549 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
552 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
554 print
'<td class="liste_titre" align="center">';
558 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
559 print
'<td class="liste_titre center">';
560 print
'<div class="nowrap">';
561 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
563 print
'<div class="nowrap">';
564 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
569 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
570 print
'<td class="liste_titre center">';
571 print
'<div class="nowrap">';
572 print
$form->selectDate($search_date_when_start ? $search_date_when_start : -1,
'search_date_when_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
574 print
'<div class="nowrap">';
575 print
$form->selectDate($search_date_when_end ? $search_date_when_end : -1,
'search_date_when_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
580 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
583 $parameters = array(
'arrayfields'=>$arrayfields);
584 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
585 print $hookmanager->resPrint;
587 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
588 print
'<td class="liste_titre">';
592 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
593 print
'<td class="liste_titre">';
597 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
598 print
'<td class="liste_titre">';
602 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
603 print
'<td class="liste_titre">';
607 print
'<td class="liste_titre" align="middle">';
608 $searchpicto =
$form->showFilterButtons();
613 print
'<tr class="liste_titre">';
614 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
615 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
617 if (!empty($arrayfields[
's.nom'][
'checked'])) {
618 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
620 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
621 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'class="right"', $sortfield, $sortorder);
623 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
624 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'class="right"', $sortfield, $sortorder);
626 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
627 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
629 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
630 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
632 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
633 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
635 if (!empty($arrayfields[
'recurring'][
'checked'])) {
636 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'class="center"', $sortfield, $sortorder);
638 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
639 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
641 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
642 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
644 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
645 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'align="center"', $sortfield, $sortorder);
647 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
648 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'align="center"', $sortfield, $sortorder);
650 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
651 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'align="center"', $sortfield, $sortorder);
653 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
654 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'align="center"', $sortfield, $sortorder);
656 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
657 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'align="center"', $sortfield, $sortorder);
659 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
660 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'align="center"', $sortfield, $sortorder);
662 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
663 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'align="center"', $sortfield, $sortorder);
666 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
667 if (!empty($arrayfields[
'status'][
'checked'])) {
668 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
670 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'center maxwidthsearch ');
675 $totalarray = array();
676 $totalarray[
'nbfield'] = 0;
677 $totalarray[
'val'][
'f.total_ht'] = 0;
678 $totalarray[
'val'][
'f.total_tva'] = 0;
679 $totalarray[
'val'][
'f.total_ttc'] = 0;
680 while ($i < min($num, $limit)) {
681 $objp = $db->fetch_object(
$resql);
686 $companystatic->id = $objp->socid;
687 $companystatic->name = $objp->name;
689 $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
690 $supplierinvoicerectmp->frequency = $objp->frequency;
691 $supplierinvoicerectmp->suspended = $objp->suspended;
692 $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
693 $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
694 $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
695 $supplierinvoicerectmp->ref = $objp->title;
696 $supplierinvoicerectmp->total_ht = $objp->total_ht;
697 $supplierinvoicerectmp->total_tva = $objp->total_tva;
698 $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
700 print
'<tr class="oddeven">';
702 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
703 print
'<td class="nowrap tdoverflowmax200">';
704 print $supplierinvoicerectmp->getNomUrl(1);
708 $totalarray[
'nbfield']++;
711 if (!empty($arrayfields[
's.nom'][
'checked'])) {
712 print
'<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
714 $totalarray[
'nbfield']++;
717 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
718 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
720 $totalarray[
'nbfield']++;
723 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
725 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
727 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
728 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
730 $totalarray[
'nbfield']++;
733 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
735 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
737 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
738 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
740 $totalarray[
'nbfield']++;
743 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
745 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
748 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
749 print
'<td class="right">';
750 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
753 $totalarray[
'nbfield']++;
757 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
758 print
'<td class="right">';
759 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
762 $totalarray[
'nbfield']++;
766 if (!empty($arrayfields[
'recurring'][
'checked'])) {
767 print
'<td class="center">'.($objp->frequency ?
img_picto($langs->trans(
"Frequency").
': '.$objp->frequency.
' '.$objp->unit_frequency,
'recurring',
'class="opacitymedium"').
' ' :
'').
yn($objp->frequency ? 1 : 0).
'</td>';
769 $totalarray[
'nbfield']++;
772 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
773 print
'<td class="center">'.($objp->frequency > 0 ? $objp->frequency :
'').
'</td>';
775 $totalarray[
'nbfield']++;
778 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
779 print
'<td class="center">'.($objp->frequency > 0 ? $objp->unit_frequency :
'').
'</td>';
781 $totalarray[
'nbfield']++;
784 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
785 print
'<td class="center">';
786 print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
789 $totalarray[
'nbfield']++;
793 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
794 print
'<td class="center">';
795 print ($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
798 $totalarray[
'nbfield']++;
802 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
803 print
'<td class="center">';
804 print
'<div class="nowraponall">';
805 print ($objp->frequency ? ($supplierinvoicerectmp->isMaxNbGenReached() ?
'<strike>' :
'').dol_print_date($db->jdate($objp->date_when),
'day').($supplierinvoicerectmp->isMaxNbGenReached() ?
'</strike>' :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
806 if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
807 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
811 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
816 $totalarray[
'nbfield']++;
819 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
820 print
'<td class="center tdoverflowmax150">';
821 if ($objp->fk_user_author > 0) {
822 $tmpuser->fetch($objp->fk_user_author);
823 print $tmpuser->getNomUrl(1);
827 $totalarray[
'nbfield']++;
830 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
831 print
'<td class="center tdoverflowmax150">';
832 if ($objp->fk_user_author > 0) {
833 $tmpuser->fetch($objp->fk_user_author);
834 print $tmpuser->getNomUrl(1);
838 $totalarray[
'nbfield']++;
841 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
842 print
'<td class="center">';
846 $totalarray[
'nbfield']++;
849 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
850 print
'<td class="center">';
854 $totalarray[
'nbfield']++;
860 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
862 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$objp,
'i'=>$i,
'totalarray'=>&$totalarray);
863 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
864 print $hookmanager->resPrint;
866 if (!empty($arrayfields[
'status'][
'checked'])) {
867 print
'<td class="center">';
868 print $supplierinvoicerectmp->getLibStatut(3, 0);
871 $totalarray[
'nbfield']++;
875 print
'<td class="center tdoverflowmax125">';
876 if ($user->rights->facture->creer && empty($supplierinvoicerectmp->suspended)) {
877 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
878 print $langs->trans(
"MaxNumberOfGenerationReached");
879 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
880 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
881 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
882 print $langs->trans(
"CreateBill").
'</a>';
884 print
$form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
890 $totalarray[
'nbfield']++;
900 foreach ($arrayfields as $key => $val) {
901 if (!empty($val[
'checked'])) {
905 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
909 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage invoice templates.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_info($titlealt='default')
Show info logo.
$nbtotalofrecords
Count total nb of records.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.