36require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
55$langs->loadLangs(array(
'companies',
'bills',
'compta',
'admin',
'other'));
57$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
59$action =
GETPOST(
'action',
'alpha');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
66$optioncss =
GETPOST(
'optioncss',
'aZ');
68$groupby =
GETPOST(
'groupby',
'aZ09');
76 $socid = $user->socid;
78$objecttype =
'facture_rec';
79if ($action ==
"create" || $action ==
"add") {
83$search_ref =
GETPOST(
'search_ref');
84$search_societe =
GETPOST(
'search_societe');
85$search_montant_ht =
GETPOST(
'search_montant_ht');
86$search_montant_vat =
GETPOST(
'search_montant_vat');
87$search_montant_ttc =
GETPOST(
'search_montant_ttc');
88$search_payment_mode =
GETPOST(
'search_payment_mode');
89$search_payment_term =
GETPOST(
'search_payment_term');
90$search_date_startday =
GETPOSTINT(
'search_date_startday');
91$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
92$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
93$search_date_endday =
GETPOSTINT(
'search_date_endday');
94$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
95$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
96$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
97$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
98$search_date_when_startday =
GETPOSTINT(
'search_date_when_startday');
99$search_date_when_startmonth =
GETPOSTINT(
'search_date_when_startmonth');
100$search_date_when_startyear =
GETPOSTINT(
'search_date_when_startyear');
101$search_date_when_endday =
GETPOSTINT(
'search_date_when_endday');
102$search_date_when_endmonth =
GETPOSTINT(
'search_date_when_endmonth');
103$search_date_when_endyear =
GETPOSTINT(
'search_date_when_endyear');
104$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
105$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
106$search_recurring =
GETPOST(
'search_recurring',
'intcomma');
107$search_frequency =
GETPOST(
'search_frequency',
'alpha');
108$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
109$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
110$search_status =
GETPOST(
'search_status',
'intcomma');
113$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
114$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
116if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
120$offset = $limit * $page;
121$pageprev = $page - 1;
122$pagenext = $page + 1;
129$fieldstosearchall = array(
131 's.nom' =>
"ThirdParty",
132 's.code_client' =>
"CustomerCodeShort",
133 'fdc.description' =>
'Description',
136if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
137 $ret =
$object->fetch($id, $ref);
144$hookmanager->initHooks(array(
'invoicereclist'));
147$extrafields->fetch_name_optionals_label(
$object->table_element);
149$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
156 $sortfield =
'f.titre';
160 'f.titre' => array(
'label' =>
"Ref",
'checked' =>
'1'),
161 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
162 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
163 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'-1'),
164 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1'),
165 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
166 'f.fk_cond_reglement' => array(
'label' =>
"PaymentTerm",
'checked' =>
'0'),
167 'recurring' => array(
'label' =>
"RecurringInvoice",
'checked' =>
'1'),
168 'f.frequency' => array(
'label' =>
"Frequency",
'checked' =>
'1'),
169 'f.unit_frequency' => array(
'label' =>
"FrequencyUnit",
'checked' =>
'1'),
170 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' =>
'1'),
171 'f.date_last_gen' => array(
'label' =>
"DateLastGenerationShort",
'checked' =>
'1'),
172 'f.date_when' => array(
'label' =>
"NextDateToExecutionShort",
'checked' =>
'1'),
173 'f.fk_user_author' => array(
'label' =>
"UserCreation",
'checked' =>
'0',
'position' => 500),
174 'f.fk_user_modif' => array(
'label' =>
"UserModification",
'checked' =>
'0',
'position' => 505),
175 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 520),
176 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 525),
177 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
180include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
182$parameters = array(
'arrayfields' => &$arrayfields);
183$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
190 $res = $tmpthirdparty->fetch($socid);
192 $search_societe = $tmpthirdparty->name;
196$objecttype =
'facture_rec';
198$permissiontoread = $user->hasRight(
"facture",
"read");
199$permissionnote = $user->hasRight(
'facture',
'creer');
200$permissiondellink = $user->hasRight(
'facture',
'creer');
201$permissiontoedit = $user->hasRight(
'facture',
'creer');
202$permissiontodelete = $user->hasRight(
"facture",
"delete");
204$uploaddir =
$conf->facture->dir_output;
214if (
GETPOST(
'cancel',
'alpha')) {
218if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
222$parameters = array(
'arrayfields' => &$arrayfields,
'socid' => $socid);
223$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
228if (empty($reshook)) {
234 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
237 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
239 $search_societe =
'';
240 $search_montant_ht =
'';
241 $search_montant_vat =
'';
242 $search_montant_ttc =
'';
243 $search_payment_mode =
'';
244 $search_payment_term =
'';
245 $search_date_startday =
'';
246 $search_date_startmonth =
'';
247 $search_date_startyear =
'';
248 $search_date_endday =
'';
249 $search_date_endmonth =
'';
250 $search_date_endyear =
'';
251 $search_date_start =
'';
252 $search_date_end =
'';
253 $search_date_when_startday =
'';
254 $search_date_when_startmonth =
'';
255 $search_date_when_startyear =
'';
256 $search_date_when_endday =
'';
257 $search_date_when_endmonth =
'';
258 $search_date_when_endyear =
'';
259 $search_date_when_start =
'';
260 $search_date_when_end =
'';
261 $search_recurring =
'';
262 $search_frequency =
'';
263 $search_unit_frequency =
'';
264 $search_nb_gen_done =
'';
268 $search_array_options = array();
270 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
271 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
298$title = $langs->trans(
"RepeatableInvoices");
303$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
308$sql =
"SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.entity, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,";
309$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
310$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
311$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
313if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
314 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
315 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
319$parameters = array();
320$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
321$sql .= $hookmanager->resPrint;
322$sql = preg_replace(
'/,\s*$/',
'', $sql);
326$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
327$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
328if (!$user->hasRight(
'societe',
'client',
'voir')) {
329 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
332$parameters = array();
333$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
334$sql .= $hookmanager->resPrint;
336$sql .=
" WHERE f.fk_soc = s.rowid";
337$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
338if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
339 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
345 $sql .=
' AND s.rowid = '.(int) $socid;
347if ($search_societe) {
350if ($search_montant_ht !=
'') {
353if ($search_montant_vat !=
'') {
356if ($search_montant_ttc !=
'') {
359if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
360 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
362if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
363 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
365if ($search_recurring ==
'1') {
366 $sql .=
' AND f.frequency > 0';
368if ($search_recurring ==
'0') {
369 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
371if ($search_frequency !=
'') {
374if ($search_unit_frequency !=
'') {
375 $sql .=
' AND f.frequency > 0';
376 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
378if ($search_nb_gen_done !=
'') {
381if ($search_status !=
'' && $search_status >= -1) {
382 if ($search_status == 0) {
383 $sql .=
' AND frequency = 0 AND suspended = 0';
385 if ($search_status == 1) {
386 $sql .=
' AND frequency != 0 AND suspended = 0';
388 if ($search_status == -1) {
389 $sql .=
' AND suspended = 1';
392if ($search_date_start) {
393 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
395if ($search_date_end) {
396 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
398if ($search_date_when_start) {
399 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
401if ($search_date_when_end) {
402 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
405include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
408$parameters = array();
409$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
410$sql .= $hookmanager->resPrint;
413 $sql .=
" AND EXISTS (SELECT fdc.rowid FROM ".MAIN_DB_PREFIX.
"facturedet_rec as fdc WHERE f.rowid = fdc.fk_facture ".
natural_search(array_keys($fieldstosearchall), $search_all).
")";
417$nbtotalofrecords =
'';
420 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
421 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
422 $resql =
$db->query($sqlforcount);
424 $objforcount =
$db->fetch_object($resql);
425 $nbtotalofrecords = $objforcount->nbtotalofrecords;
430 if (($page * $limit) > (
int) $nbtotalofrecords) {
437$tmpsortfield = $sortfield;
438if ($tmpsortfield ==
'recurring') {
439 $tmpsortfield =
'f.frequency';
443$sql .=
$db->order($tmpsortfield, $sortorder);
445 $sql .=
$db->plimit($limit + 1, $offset);
448$resql =
$db->query($sql);
454$num =
$db->num_rows($resql);
456if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
457 $obj =
$db->fetch_object($resql);
459 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card-rec.php?facid='.$id);
466llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
468$arrayofselected = is_array($toselect) ? $toselect : array();
472 $param .=
'&mode='.urlencode($mode);
474if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
475 $param .=
'&contextpage='.urlencode($contextpage);
477if ($limit > 0 && $limit !=
$conf->liste_limit) {
478 $param .=
'&limit='.((int) $limit);
480if ($optioncss !=
'') {
481 $param .=
'&optioncss='.urlencode($optioncss);
484 $param .=
'&groupby='.urlencode($groupby);
487 $param .=
'&search_all='.urlencode($search_all);
490 $param .=
'&socid='.urlencode((
string) ($socid));
492if ($search_date_startday) {
493 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
495if ($search_date_startmonth) {
496 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
498if ($search_date_startyear) {
499 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
501if ($search_date_endday) {
502 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
504if ($search_date_endmonth) {
505 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
507if ($search_date_endyear) {
508 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
510if ($search_date_when_startday) {
511 $param .=
'&search_date_when_startday='.urlencode((
string) ($search_date_when_startday));
513if ($search_date_when_startmonth) {
514 $param .=
'&search_date_when_startmonth='.urlencode((
string) ($search_date_when_startmonth));
516if ($search_date_when_startyear) {
517 $param .=
'&search_date_when_startyear='.urlencode((
string) ($search_date_when_startyear));
519if ($search_date_when_endday) {
520 $param .=
'&search_date_when_endday='.urlencode((
string) ($search_date_when_endday));
522if ($search_date_when_endmonth) {
523 $param .=
'&search_date_when_endmonth='.urlencode((
string) ($search_date_when_endmonth));
525if ($search_date_when_endyear) {
526 $param .=
'&search_date_when_endyear='.urlencode((
string) ($search_date_when_endyear));
529 $param .=
'&search_ref='.urlencode($search_ref);
531if ($search_societe) {
532 $param .=
'&search_societe='.urlencode($search_societe);
534if ($search_montant_ht !=
'') {
535 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
537if ($search_montant_vat !=
'') {
538 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
540if ($search_montant_ttc !=
'') {
541 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
543if ($search_payment_mode !=
'') {
544 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
546if ($search_payment_term !=
'') {
547 $param .=
'&search_payment_term='.urlencode($search_payment_term);
549if ($search_recurring !=
'' && $search_recurring !=
'-1') {
550 $param .=
'&search_recurring='.urlencode($search_recurring);
552if ($search_frequency > 0) {
553 $param .=
'&search_frequency='.urlencode($search_frequency);
555if ($search_unit_frequency !=
'') {
556 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
558if ($search_nb_gen_done !=
'') {
559 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
561if ($search_status !=
'') {
562 $param .=
'&search_status='.urlencode($search_status);
565include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
567$parameters = array(
'param' => &$param);
568$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
569$param .= $hookmanager->resPrint;
572$arrayofmassactions = array(
579$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend' => $langs->trans(
"SendByMail"),
'builddoc' => $langs->trans(
"PDFMerge")));
581$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
582$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
583$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
586print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
587if ($optioncss !=
'') {
588 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
590print
'<input type="hidden" name="token" value="'.newToken().
'">';
591print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
592print
'<input type="hidden" name="action" value="list">';
593print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
594print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
595print
'<input type="hidden" name="page" value="'.$page.
'">';
596print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
597print
'<input type="hidden" name="page_y" value="">';
598print
'<input type="hidden" name="mode" value="'.$mode.
'">';
601print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
603print
'<div class="info">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</div>';
606 foreach ($fieldstosearchall as $key => $val) {
607 $fieldstosearchall[$key] = $langs->trans($val);
609 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
616$parameters = array();
617$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
618if (empty($reshook)) {
619 $moreforfilter .= $hookmanager->resPrint;
621 $moreforfilter = $hookmanager->resPrint;
624if (!empty($moreforfilter)) {
625 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
626 print $moreforfilter;
630$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
631$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
632$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
634print
'<div class="div-table-responsive">';
635print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
640print
'<tr class="liste_titre_filter">';
642if (
$conf->main_checkbox_left_column) {
643 print
'<td class="liste_titre center maxwidthsearch">';
644 $searchpicto = $form->showFilterButtons(
'left');
649if (!empty($arrayfields[
'f.titre'][
'checked'])) {
650 print
'<td class="liste_titre left">';
651 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
655if (!empty($arrayfields[
's.nom'][
'checked'])) {
656 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"></td>';
658if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
660 print
'<td class="liste_titre right">';
661 print
'<input class="flat width50" type="text"" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
664if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
666 print
'<td class="liste_titre right">';
667 print
'<input class="flat width50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
670if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
672 print
'<td class="liste_titre right">';
673 print
'<input class="flat width50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
676if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
678 print
'<td class="liste_titre">';
679 print $form->getSelectConditionsPaiements((
int) $search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
682if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
684 print
'<td class="liste_titre">';
685 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
688if (!empty($arrayfields[
'recurring'][
'checked'])) {
690 print
'<td class="liste_titre center">';
691 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
694if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
696 print
'<td class="liste_titre center">';
697 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
700if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
702 print
'<td class="liste_titre center">';
703 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
706if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
708 print
'<td class="liste_titre" align="center">';
709 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
713if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
714 print
'<td class="liste_titre center">';
715 print
'<div class="nowrapfordate">';
716 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
718 print
'<div class="nowrapfordate">';
719 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
724if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
725 print
'<td class="liste_titre center">';
726 print
'<div class="nowrapfordate">';
727 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'));
729 print
'<div class="nowrapfordate">';
730 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'));
735include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
738$parameters = array(
'arrayfields' => $arrayfields);
739$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
740print $hookmanager->resPrint;
742if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
743 print
'<td class="liste_titre">';
747if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
748 print
'<td class="liste_titre">';
752if (!empty($arrayfields[
'f.datec'][
'checked'])) {
753 print
'<td class="liste_titre">';
757if (!empty($arrayfields[
'f.tms'][
'checked'])) {
758 print
'<td class="liste_titre">';
762if (!empty($arrayfields[
'status'][
'checked'])) {
763 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
765 0 => $langs->trans(
"Draft"),
766 1 => $langs->trans(
"Active"),
767 -1 => $langs->trans(
"Disabled"),
770 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
774if (!
$conf->main_checkbox_left_column) {
775 print
'<td class="liste_titre center maxwidthsearch">';
776 $searchpicto = $form->showFilterButtons();
787print
'<tr class="liste_titre">';
789if (
$conf->main_checkbox_left_column) {
790 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
793if (!empty($arrayfields[
'f.titre'][
'checked'])) {
795 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
798if (!empty($arrayfields[
's.nom'][
'checked'])) {
799 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
802if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
803 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
806if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
807 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
810if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
811 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
814if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
815 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
818if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
819 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
822if (!empty($arrayfields[
'recurring'][
'checked'])) {
823 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
826if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
827 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
830if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
831 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
834if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
835 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
838if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
839 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
842if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
843 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
846if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
847 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
850if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
851 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
854if (!empty($arrayfields[
'f.datec'][
'checked'])) {
855 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
858if (!empty($arrayfields[
'f.tms'][
'checked'])) {
859 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
863include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
866$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>$totalarray);
867$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
868print $hookmanager->resPrint;
870if (!empty($arrayfields[
'status'][
'checked'])) {
871 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
875if (!
$conf->main_checkbox_left_column) {
876 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
888$imaxinloop = ($limit ? min($num, $limit) : $num);
889while ($i < $imaxinloop) {
890 $objp =
$db->fetch_object($resql);
895 $companystatic->id = $objp->socid;
896 $companystatic->name = $objp->name;
898 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
899 $invoicerectmp->frequency = $objp->frequency;
900 $invoicerectmp->suspended = $objp->suspended;
901 $invoicerectmp->unit_frequency = $objp->unit_frequency;
902 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
903 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
904 $invoicerectmp->ref = $objp->title;
905 $invoicerectmp->total_ht = $objp->total_ht;
906 $invoicerectmp->total_tva = $objp->total_tva;
907 $invoicerectmp->total_ttc = $objp->total_ttc;
911 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
913 if (
$conf->main_checkbox_left_column) {
914 print
'<td class="center tdoverflowmax125">';
915 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
916 if ($invoicerectmp->isMaxNbGenReached()) {
917 print $langs->trans(
"MaxNumberOfGenerationReached");
918 } elseif (empty($objp->frequency) ||
$db->jdate($objp->date_when) <= $today) {
919 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
920 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="none"');
923 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
931 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
932 print
'<td class="nowrap tdoverflowmax200">';
933 print $invoicerectmp->getNomUrl(1);
939 if (!empty($arrayfields[
's.nom'][
'checked'])) {
940 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
945 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
946 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
953 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
955 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
956 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
963 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
965 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
966 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
973 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
976 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
977 print
'<td class="tdoverflowmax150">';
978 $form->form_conditions_reglement(
'0', $objp->fk_cond_reglement,
'none');
985 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
986 print
'<td class="tdoverflowmax150">';
987 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
994 if (!empty($arrayfields[
'recurring'][
'checked'])) {
995 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>';
1000 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
1001 print
'<td class="center">';
1002 print($objp->frequency > 0 ? $objp->frequency :
'');
1008 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
1009 print
'<td class="center">';
1010 if ($objp->frequency > 1) {
1011 $dur = array(
"i" => $langs->trans(
"Minutes"),
"h" => $langs->trans(
"Hours"),
"d" => $langs->trans(
"Days"),
"w" => $langs->trans(
"Weeks"),
"m" => $langs->trans(
"Months"),
"y" => $langs->trans(
"Years"));
1013 $dur = array(
"i" => $langs->trans(
"Minute"),
"h" => $langs->trans(
"Hour"),
"d" => $langs->trans(
"Day"),
"w" => $langs->trans(
"Week"),
"m" => $langs->trans(
"Month"),
"y" => $langs->trans(
"Year"));
1015 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
1021 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
1022 print
'<td class="center">';
1023 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1030 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
1031 print
'<td class="center">';
1032 print($objp->frequency > 0 ?
dol_print_date(
$db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1039 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
1040 print
'<td class="center">';
1041 print
'<div class="nowraponall">';
1042 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>');
1043 if (!$invoicerectmp->isMaxNbGenReached()) {
1044 if (!$objp->suspended && $objp->frequency > 0 &&
$db->jdate($objp->date_when) &&
$db->jdate($objp->date_when) < $now) {
1048 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1056 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
1057 print
'<td class="center tdoverflowmax150">';
1058 if ($objp->fk_user_author > 0) {
1059 $tmpuser->fetch($objp->fk_user_author);
1060 print $tmpuser->getNomUrl(1);
1067 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1068 print
'<td class="center tdoverflowmax150">';
1069 if ($objp->fk_user_author > 0) {
1070 $tmpuser->fetch($objp->fk_user_author);
1071 print $tmpuser->getNomUrl(1);
1078 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1079 print
'<td class="center nowraponall">';
1086 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1087 print
'<td class="center nowraponall">';
1097 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1099 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1100 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1101 print $hookmanager->resPrint;
1103 if (!empty($arrayfields[
'status'][
'checked'])) {
1104 print
'<td class="center">';
1105 print $invoicerectmp->getLibStatut(5, 0);
1112 if (!
$conf->main_checkbox_left_column) {
1113 print
'<td class="nowrap center tdoverflowmax125">';
1114 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
1115 if ($invoicerectmp->isMaxNbGenReached()) {
1116 print $langs->trans(
"MaxNumberOfGenerationReached");
1117 } elseif (empty($objp->frequency) ||
$db->jdate($objp->date_when) <= $today) {
1118 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1119 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1123 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1138include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1143 foreach ($arrayfields as $key => $val) {
1144 if (!empty($val[
'checked'])) {
1148 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1154$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1155$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1156print $hookmanager->resPrint;
1158print
'</table>'.
"\n";
1161print
'</form>'.
"\n";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoice templates.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_now($mode='gmt')
Return date for now.
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...
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_info($titlealt='default')
Show info logo.
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.