33 require
'../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/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'));
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_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',
'aZ09comma');
101 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
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(
'invoicereclist'));
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 'status'=>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;
173 $tmpthirdparty =
new Societe($db);
174 $res = $tmpthirdparty->fetch($socid);
176 $search_societe = $tmpthirdparty->name;
180 $objecttype =
'facture_rec';
182 $result =
restrictedArea($user,
'facture', $object->id, $objecttype);
189 if (
GETPOST(
'cancel',
'alpha')) {
193 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
197 $parameters = array(
'socid' => $socid);
198 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
203 if (empty($reshook)) {
204 if (
GETPOST(
'cancel',
'alpha')) {
209 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
212 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
214 $search_societe =
'';
215 $search_montant_ht =
'';
216 $search_montant_vat =
'';
217 $search_montant_ttc =
'';
218 $search_payment_mode =
'';
219 $search_payment_term =
'';
220 $search_date_startday =
'';
221 $search_date_startmonth =
'';
222 $search_date_startyear =
'';
223 $search_date_endday =
'';
224 $search_date_endmonth =
'';
225 $search_date_endyear =
'';
226 $search_date_start =
'';
227 $search_date_end =
'';
228 $search_date_when_startday =
'';
229 $search_date_when_startmonth =
'';
230 $search_date_when_startyear =
'';
231 $search_date_when_endday =
'';
232 $search_date_when_endmonth =
'';
233 $search_date_when_endyear =
'';
234 $search_date_when_start =
'';
235 $search_date_when_end =
'';
236 $search_recurring =
'';
237 $search_frequency =
'';
238 $search_unit_frequency =
'';
240 $search_array_options = array();
257 llxHeader(
'', $langs->trans(
"RepeatableInvoices"),
'ch-facture.html#s-fac-facture-rec');
264 $companystatic =
new Societe($db);
266 $tmpuser =
new User($db);
270 $today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
277 $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,";
278 $sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
279 $sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
280 $sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
282 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
283 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
284 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
288 $parameters = array();
289 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
290 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
291 $sql = preg_replace(
'/,\s*$/',
'', $sql);
293 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
294 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
295 if (empty($user->rights->societe->client->voir) && !$socid) {
296 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
298 $sql .=
" WHERE f.fk_soc = s.rowid";
299 $sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
300 if (empty($user->rights->societe->client->voir) && !$socid) {
301 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
307 $sql .=
' AND s.rowid = '.(int) $socid;
309 if ($search_societe) {
312 if ($search_montant_ht !=
'') {
315 if ($search_montant_vat !=
'') {
318 if ($search_montant_ttc !=
'') {
321 if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
322 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
324 if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
325 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
327 if ($search_recurring ==
'1') {
328 $sql .=
' AND f.frequency > 0';
330 if ($search_recurring ==
'0') {
331 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
333 if ($search_frequency !=
'') {
336 if ($search_unit_frequency !=
'') {
337 $sql .=
' AND f.frequency > 0'.natural_search(
'f.unit_frequency', $search_unit_frequency);
339 if ($search_status !=
'' && $search_status >= -1) {
340 if ($search_status == 0) {
341 $sql .=
' AND frequency = 0 AND suspended = 0';
343 if ($search_status == 1) {
344 $sql .=
' AND frequency != 0 AND suspended = 0';
346 if ($search_status == -1) {
347 $sql .=
' AND suspended = 1';
350 if ($search_date_start) {
351 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
353 if ($search_date_end) {
354 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
356 if ($search_date_when_start) {
357 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
359 if ($search_date_when_end) {
360 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
363 $tmpsortfield = $sortfield;
364 if ($tmpsortfield ==
'recurring') {
365 $tmpsortfield =
'f.frequency';
367 $sql .= $db->order($tmpsortfield, $sortorder);
370 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
371 $result = $db->query($sql);
379 $sql .= $db->plimit($limit + 1, $offset);
381 $resql = $db->query($sql);
383 $num = $db->num_rows(
$resql);
386 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
387 $param .=
'&contextpage='.urlencode($contextpage);
389 if ($limit > 0 && $limit != $conf->liste_limit) {
390 $param .=
'&limit='.urlencode($limit);
393 $param .=
'&socid='.urlencode($socid);
395 if ($search_date_startday) {
396 $param .=
'&search_date_startday='.urlencode($search_date_startday);
398 if ($search_date_startmonth) {
399 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
401 if ($search_date_startyear) {
402 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
404 if ($search_date_endday) {
405 $param .=
'&search_date_endday='.urlencode($search_date_endday);
407 if ($search_date_endmonth) {
408 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
410 if ($search_date_endyear) {
411 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
413 if ($search_date_when_startday) {
414 $param .=
'&search_date_when_startday='.urlencode($search_date_when_startday);
416 if ($search_date_when_startmonth) {
417 $param .=
'&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
419 if ($search_date_when_startyear) {
420 $param .=
'&search_date_when_startyear='.urlencode($search_date_when_startyear);
422 if ($search_date_when_endday) {
423 $param .=
'&search_date_when_endday='.urlencode($search_date_when_endday);
425 if ($search_date_when_endmonth) {
426 $param .=
'&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
428 if ($search_date_when_endyear) {
429 $param .=
'&search_date_when_endyear='.urlencode($search_date_when_endyear);
432 $param .=
'&search_ref='.urlencode($search_ref);
434 if ($search_societe) {
435 $param .=
'&search_societe='.urlencode($search_societe);
437 if ($search_montant_ht !=
'') {
438 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
440 if ($search_montant_vat !=
'') {
441 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
443 if ($search_montant_ttc !=
'') {
444 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
446 if ($search_payment_mode !=
'') {
447 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
449 if ($search_payment_term !=
'') {
450 $param .=
'&search_payment_term='.urlencode($search_payment_term);
452 if ($search_recurring !=
'' && $search_recurring !=
'-1') {
453 $param .=
'&search_recurring='.urlencode($search_recurring);
455 if ($search_frequency > 0) {
456 $param .=
'&search_frequency='.urlencode($search_frequency);
458 if ($search_unit_frequency !=
'') {
459 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
461 if ($search_status !=
'') {
462 $param .=
'&search_status='.urlencode($search_status);
464 if ($optioncss !=
'') {
465 $param .=
'&optioncss='.urlencode($optioncss);
468 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
470 $massactionbutton =
$form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend'=>$langs->trans(
"SendByMail"),
'builddoc'=>$langs->trans(
"PDFMerge")));
472 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
473 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
476 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
477 if ($optioncss !=
'') {
478 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
480 print
'<input type="hidden" name="token" value="'.newToken().
'">';
481 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
482 print
'<input type="hidden" name="action" value="list">';
483 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
484 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
485 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
486 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
488 $title = $langs->trans(
"RepeatableInvoices");
490 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
492 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
498 print
'<div class="div-table-responsive">';
499 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
502 print
'<tr class="liste_titre_filter">';
504 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
505 print
'<td class="liste_titre left">';
506 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
510 if (!empty($arrayfields[
's.nom'][
'checked'])) {
511 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
513 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
515 print
'<td class="liste_titre right">';
516 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
519 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
521 print
'<td class="liste_titre right">';
522 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
525 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
527 print
'<td class="liste_titre right">';
528 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
531 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
533 print
'<td class="liste_titre right">';
534 print
$form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
537 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
539 print
'<td class="liste_titre right">';
540 print
$form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
543 if (!empty($arrayfields[
'recurring'][
'checked'])) {
545 print
'<td class="liste_titre center">';
546 print
$form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
549 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
551 print
'<td class="liste_titre center">';
552 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
555 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
557 print
'<td class="liste_titre center">';
558 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
561 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
563 print
'<td class="liste_titre" align="center">';
567 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
568 print
'<td class="liste_titre center">';
569 print
'<div class="nowrap">';
570 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
572 print
'<div class="nowrap">';
573 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
578 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
579 print
'<td class="liste_titre center">';
580 print
'<div class="nowrap">';
581 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'));
583 print
'<div class="nowrap">';
584 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'));
589 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
592 $parameters = array(
'arrayfields'=>$arrayfields);
593 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
594 print $hookmanager->resPrint;
596 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
597 print
'<td class="liste_titre">';
601 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
602 print
'<td class="liste_titre">';
606 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
607 print
'<td class="liste_titre">';
611 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
612 print
'<td class="liste_titre">';
616 if (!empty($arrayfields[
'status'][
'checked'])) {
617 print
'<td class="liste_titre center">';
619 0=>$langs->trans(
"Draft"),
620 1=>$langs->trans(
"Active"),
621 -1=>$langs->trans(
"Disabled"),
623 print
$form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
627 print
'<td class="liste_titre" align="middle">';
628 $searchpicto =
$form->showFilterButtons();
633 print
'<tr class="liste_titre">';
634 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
635 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
637 if (!empty($arrayfields[
's.nom'][
'checked'])) {
638 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
640 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
641 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'class="right"', $sortfield, $sortorder);
643 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
644 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'class="right"', $sortfield, $sortorder);
646 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
647 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
649 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
650 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
652 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
653 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
655 if (!empty($arrayfields[
'recurring'][
'checked'])) {
656 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'class="center"', $sortfield, $sortorder);
658 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
659 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
661 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
662 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
664 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
665 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'align="center"', $sortfield, $sortorder);
667 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
668 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'align="center"', $sortfield, $sortorder);
670 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
671 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'align="center"', $sortfield, $sortorder);
673 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
674 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'align="center"', $sortfield, $sortorder);
676 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
677 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'align="center"', $sortfield, $sortorder);
679 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
680 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'align="center"', $sortfield, $sortorder);
682 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
683 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'align="center"', $sortfield, $sortorder);
686 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
687 if (!empty($arrayfields[
'status'][
'checked'])) {
688 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
690 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'center maxwidthsearch ');
695 $totalarray = array();
696 $totalarray[
'nbfield'] = 0;
697 $totalarray[
'val'][
'f.total_ht'] = 0;
698 $totalarray[
'val'][
'f.total_tva'] = 0;
699 $totalarray[
'val'][
'f.total_ttc'] = 0;
700 while ($i < min($num, $limit)) {
701 $objp = $db->fetch_object(
$resql);
706 $companystatic->id = $objp->socid;
707 $companystatic->name = $objp->name;
709 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
710 $invoicerectmp->frequency = $objp->frequency;
711 $invoicerectmp->suspended = $objp->suspended;
712 $invoicerectmp->unit_frequency = $objp->unit_frequency;
713 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
714 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
715 $invoicerectmp->ref = $objp->title;
716 $invoicerectmp->total_ht = $objp->total_ht;
717 $invoicerectmp->total_tva = $objp->total_tva;
718 $invoicerectmp->total_ttc = $objp->total_ttc;
720 print
'<tr class="oddeven">';
722 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
723 print
'<td class="nowrap tdoverflowmax200">';
724 print $invoicerectmp->getNomUrl(1);
727 $totalarray[
'nbfield']++;
730 if (!empty($arrayfields[
's.nom'][
'checked'])) {
731 print
'<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
733 $totalarray[
'nbfield']++;
736 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
737 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
739 $totalarray[
'nbfield']++;
742 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
744 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
746 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
747 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
749 $totalarray[
'nbfield']++;
752 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
754 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
756 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
757 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
759 $totalarray[
'nbfield']++;
762 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
764 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
767 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
768 print
'<td class="tdoverflowmax150">';
769 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
772 $totalarray[
'nbfield']++;
776 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
777 print
'<td class="tdoverflowmax150">';
778 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
781 $totalarray[
'nbfield']++;
785 if (!empty($arrayfields[
'recurring'][
'checked'])) {
786 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>';
788 $totalarray[
'nbfield']++;
791 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
792 print
'<td class="center">'.($objp->frequency > 0 ? $objp->frequency :
'').
'</td>';
794 $totalarray[
'nbfield']++;
797 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
798 print
'<td class="center">'.($objp->frequency > 0 ? $objp->unit_frequency :
'').
'</td>';
800 $totalarray[
'nbfield']++;
803 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
804 print
'<td class="center">';
805 print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
808 $totalarray[
'nbfield']++;
812 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
813 print
'<td class="center">';
814 print ($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
817 $totalarray[
'nbfield']++;
821 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
822 print
'<td class="center">';
823 print
'<div class="nowraponall">';
824 print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ?
'<strike>' :
'').dol_print_date($db->jdate($objp->date_when),
'day').($invoicerectmp->isMaxNbGenReached() ?
'</strike>' :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
825 if (!$invoicerectmp->isMaxNbGenReached()) {
826 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
830 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
835 $totalarray[
'nbfield']++;
838 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
839 print
'<td class="center tdoverflowmax150">';
840 if ($objp->fk_user_author > 0) {
841 $tmpuser->fetch($objp->fk_user_author);
842 print $tmpuser->getNomUrl(1);
846 $totalarray[
'nbfield']++;
849 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
850 print
'<td class="center tdoverflowmax150">';
851 if ($objp->fk_user_author > 0) {
852 $tmpuser->fetch($objp->fk_user_author);
853 print $tmpuser->getNomUrl(1);
857 $totalarray[
'nbfield']++;
860 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
861 print
'<td class="center nowraponall">';
865 $totalarray[
'nbfield']++;
868 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
869 print
'<td class="center nowraponall">';
873 $totalarray[
'nbfield']++;
879 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
881 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$objp,
'i'=>$i,
'totalarray'=>&$totalarray);
882 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
883 print $hookmanager->resPrint;
885 if (!empty($arrayfields[
'status'][
'checked'])) {
886 print
'<td class="center">';
887 print $invoicerectmp->getLibStatut(3, 0);
890 $totalarray[
'nbfield']++;
894 print
'<td class="center tdoverflowmax125">';
895 if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) {
896 if ($invoicerectmp->isMaxNbGenReached()) {
897 print $langs->trans(
"MaxNumberOfGenerationReached");
898 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
899 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
900 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
901 print $langs->trans(
"CreateBill").
'</a>';
903 print
$form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
909 $totalarray[
'nbfield']++;
919 foreach ($arrayfields as $key => $val) {
920 if (!empty($val[
'checked'])) {
924 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
928 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
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.