36require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
56$langs->loadLangs(array(
'companies',
'bills',
'compta',
'admin',
'other'));
58$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
60$action =
GETPOST(
'action',
'alpha');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array:int');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
67$optioncss =
GETPOST(
'optioncss',
'aZ');
69$groupby =
GETPOST(
'groupby',
'aZ09');
77 $socid = $user->socid;
79$objecttype =
'facture_rec';
80if ($action ==
"create" || $action ==
"add") {
84$search_ref =
GETPOST(
'search_ref');
85$search_societe =
GETPOST(
'search_societe');
86$search_montant_ht =
GETPOST(
'search_montant_ht');
87$search_montant_vat =
GETPOST(
'search_montant_vat');
88$search_montant_ttc =
GETPOST(
'search_montant_ttc');
89$search_payment_mode =
GETPOST(
'search_payment_mode');
90$search_payment_term =
GETPOST(
'search_payment_term');
91$search_date_startday =
GETPOSTINT(
'search_date_startday');
92$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
93$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
94$search_date_endday =
GETPOSTINT(
'search_date_endday');
95$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
96$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
97$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
98$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
99$search_date_when_startday =
GETPOSTINT(
'search_date_when_startday');
100$search_date_when_startmonth =
GETPOSTINT(
'search_date_when_startmonth');
101$search_date_when_startyear =
GETPOSTINT(
'search_date_when_startyear');
102$search_date_when_endday =
GETPOSTINT(
'search_date_when_endday');
103$search_date_when_endmonth =
GETPOSTINT(
'search_date_when_endmonth');
104$search_date_when_endyear =
GETPOSTINT(
'search_date_when_endyear');
105$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
106$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
107$search_recurring =
GETPOST(
'search_recurring',
'intcomma');
108$search_frequency =
GETPOST(
'search_frequency',
'alpha');
109$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
110$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
111$search_status =
GETPOST(
'search_status',
'intcomma');
114$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
115$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
117if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
121$offset = $limit * $page;
122$pageprev = $page - 1;
123$pagenext = $page + 1;
130$fieldstosearchall = array(
132 's.nom' =>
"ThirdParty",
133 's.code_client' =>
"CustomerCodeShort",
134 'fdc.description' =>
'Description',
137if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
138 $ret =
$object->fetch($id, $ref);
145$hookmanager->initHooks(array(
'invoicereclist'));
148$extrafields->fetch_name_optionals_label(
$object->table_element);
150$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
157 $sortfield =
'f.titre';
161 'f.titre' => array(
'label' =>
"Ref",
'checked' =>
'1'),
162 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
163 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
164 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'-1'),
165 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1'),
166 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
167 'f.fk_cond_reglement' => array(
'label' =>
"PaymentTerm",
'checked' =>
'0'),
168 'recurring' => array(
'label' =>
"RecurringInvoice",
'checked' =>
'1'),
169 'f.frequency' => array(
'label' =>
"Frequency",
'checked' =>
'1'),
170 'f.unit_frequency' => array(
'label' =>
"FrequencyUnit",
'checked' =>
'1'),
171 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' =>
'1'),
172 'f.date_last_gen' => array(
'label' =>
"DateLastGenerationShort",
'checked' =>
'1'),
173 'f.date_when' => array(
'label' =>
"NextDateToExecutionShort",
'checked' =>
'1'),
174 'f.fk_user_author' => array(
'label' =>
"UserCreation",
'checked' =>
'0',
'position' => 500),
175 'f.fk_user_modif' => array(
'label' =>
"UserModification",
'checked' =>
'0',
'position' => 505),
176 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 520),
177 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 525),
178 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
181include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
187 $tmpthirdparty =
new Societe($db);
188 $res = $tmpthirdparty->fetch($socid);
190 $search_societe = $tmpthirdparty->name;
194$objecttype =
'facture_rec';
196$permissiontoread = $user->hasRight(
"facture",
"read");
197$permissionnote = $user->hasRight(
'facture',
'creer');
198$permissiondellink = $user->hasRight(
'facture',
'creer');
199$permissiontoedit = $user->hasRight(
'facture',
'creer');
200$permissiontodelete = $user->hasRight(
"facture",
"delete");
202$uploaddir = $conf->facture->dir_output;
212if (
GETPOST(
'cancel',
'alpha')) {
216if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
220$parameters = array(
'arrayfields' => &$arrayfields,
'socid' => $socid);
221$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
226if (empty($reshook)) {
232 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
235 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
237 $search_societe =
'';
238 $search_montant_ht =
'';
239 $search_montant_vat =
'';
240 $search_montant_ttc =
'';
241 $search_payment_mode =
'';
242 $search_payment_term =
'';
243 $search_date_startday =
'';
244 $search_date_startmonth =
'';
245 $search_date_startyear =
'';
246 $search_date_endday =
'';
247 $search_date_endmonth =
'';
248 $search_date_endyear =
'';
249 $search_date_start =
'';
250 $search_date_end =
'';
251 $search_date_when_startday =
'';
252 $search_date_when_startmonth =
'';
253 $search_date_when_startyear =
'';
254 $search_date_when_endday =
'';
255 $search_date_when_endmonth =
'';
256 $search_date_when_endyear =
'';
257 $search_date_when_start =
'';
258 $search_date_when_end =
'';
259 $search_recurring =
'';
260 $search_frequency =
'';
261 $search_unit_frequency =
'';
262 $search_nb_gen_done =
'';
266 $search_array_options = array();
268 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
269 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
284$form =
new Form($db);
289$companystatic =
new Societe($db);
291$tmpuser =
new User($db);
296$title = $langs->trans(
"RepeatableInvoices");
301$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
306$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,";
307$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
308$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
309$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
311if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
312 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
313 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
317$parameters = array();
318$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
319$sql .= $hookmanager->resPrint;
320$sql = preg_replace(
'/,\s*$/',
'', $sql);
324$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
325$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
326if (!$user->hasRight(
'societe',
'client',
'voir')) {
327 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
330$parameters = array();
331$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
332$sql .= $hookmanager->resPrint;
334$sql .=
" WHERE f.fk_soc = s.rowid";
335$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
336if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
337 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
343 $sql .=
' AND s.rowid = '.(int) $socid;
345if ($search_societe) {
348if ($search_montant_ht !=
'') {
351if ($search_montant_vat !=
'') {
354if ($search_montant_ttc !=
'') {
357if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
358 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
360if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
361 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
363if ($search_recurring ==
'1') {
364 $sql .=
' AND f.frequency > 0';
366if ($search_recurring ==
'0') {
367 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
369if ($search_frequency !=
'') {
372if ($search_unit_frequency !=
'') {
373 $sql .=
' AND f.frequency > 0';
374 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
376if ($search_nb_gen_done !=
'') {
379if ($search_status !=
'' && $search_status >= -1) {
380 if ($search_status == 0) {
381 $sql .=
' AND frequency = 0 AND suspended = 0';
383 if ($search_status == 1) {
384 $sql .=
' AND frequency != 0 AND suspended = 0';
386 if ($search_status == -1) {
387 $sql .=
' AND suspended = 1';
390if ($search_date_start) {
391 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
393if ($search_date_end) {
394 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
396if ($search_date_when_start) {
397 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
399if ($search_date_when_end) {
400 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
403include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
406$parameters = array();
407$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
408$sql .= $hookmanager->resPrint;
411 $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).
")";
415$nbtotalofrecords =
'';
418 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
419 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
420 $resql = $db->query($sqlforcount);
422 $objforcount = $db->fetch_object($resql);
423 $nbtotalofrecords = $objforcount->nbtotalofrecords;
428 if (($page * $limit) > (
int) $nbtotalofrecords) {
435$tmpsortfield = $sortfield;
436if ($tmpsortfield ==
'recurring') {
437 $tmpsortfield =
'f.frequency';
441$sql .= $db->order($tmpsortfield, $sortorder);
443 $sql .= $db->plimit($limit + 1, $offset);
446$resql = $db->query($sql);
452$num = $db->num_rows($resql);
454if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
455 $obj = $db->fetch_object($resql);
457 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card-rec.php?facid='.$id);
464llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
466$arrayofselected = is_array($toselect) ? $toselect : array();
470 $param .=
'&mode='.urlencode($mode);
472if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
473 $param .=
'&contextpage='.urlencode($contextpage);
475if ($limit > 0 && $limit != $conf->liste_limit) {
476 $param .=
'&limit='.((int) $limit);
478if ($optioncss !=
'') {
479 $param .=
'&optioncss='.urlencode($optioncss);
482 $param .=
'&groupby='.urlencode($groupby);
485 $param .=
'&search_all='.urlencode($search_all);
488 $param .=
'&socid='.urlencode((
string) ($socid));
490if ($search_date_startday) {
491 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
493if ($search_date_startmonth) {
494 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
496if ($search_date_startyear) {
497 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
499if ($search_date_endday) {
500 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
502if ($search_date_endmonth) {
503 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
505if ($search_date_endyear) {
506 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
508if ($search_date_when_startday) {
509 $param .=
'&search_date_when_startday='.urlencode((
string) ($search_date_when_startday));
511if ($search_date_when_startmonth) {
512 $param .=
'&search_date_when_startmonth='.urlencode((
string) ($search_date_when_startmonth));
514if ($search_date_when_startyear) {
515 $param .=
'&search_date_when_startyear='.urlencode((
string) ($search_date_when_startyear));
517if ($search_date_when_endday) {
518 $param .=
'&search_date_when_endday='.urlencode((
string) ($search_date_when_endday));
520if ($search_date_when_endmonth) {
521 $param .=
'&search_date_when_endmonth='.urlencode((
string) ($search_date_when_endmonth));
523if ($search_date_when_endyear) {
524 $param .=
'&search_date_when_endyear='.urlencode((
string) ($search_date_when_endyear));
527 $param .=
'&search_ref='.urlencode($search_ref);
529if ($search_societe) {
530 $param .=
'&search_societe='.urlencode($search_societe);
532if ($search_montant_ht !=
'') {
533 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
535if ($search_montant_vat !=
'') {
536 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
538if ($search_montant_ttc !=
'') {
539 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
541if ($search_payment_mode !=
'') {
542 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
544if ($search_payment_term !=
'') {
545 $param .=
'&search_payment_term='.urlencode($search_payment_term);
547if ($search_recurring !=
'' && $search_recurring !=
'-1') {
548 $param .=
'&search_recurring='.urlencode($search_recurring);
550if ($search_frequency > 0) {
551 $param .=
'&search_frequency='.urlencode($search_frequency);
553if ($search_unit_frequency !=
'') {
554 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
556if ($search_nb_gen_done !=
'') {
557 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
559if ($search_status !=
'') {
560 $param .=
'&search_status='.urlencode($search_status);
563include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
565$parameters = array(
'param' => &$param);
566$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
567$param .= $hookmanager->resPrint;
570$arrayofmassactions = array(
577$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend' => $langs->trans(
"SendByMail"),
'builddoc' => $langs->trans(
"PDFMerge")));
579$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
580$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
581$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
584print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
585if ($optioncss !=
'') {
586 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
588print
'<input type="hidden" name="token" value="'.newToken().
'">';
589print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
590print
'<input type="hidden" name="action" value="list">';
591print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
592print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
593print
'<input type="hidden" name="page" value="'.$page.
'">';
594print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
595print
'<input type="hidden" name="page_y" value="">';
596print
'<input type="hidden" name="mode" value="'.$mode.
'">';
599print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
601print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
604 foreach ($fieldstosearchall as $key => $val) {
605 $fieldstosearchall[$key] = $langs->trans($val);
607 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
614$parameters = array();
615$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
616if (empty($reshook)) {
617 $moreforfilter .= $hookmanager->resPrint;
619 $moreforfilter = $hookmanager->resPrint;
622if (!empty($moreforfilter)) {
623 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
624 print $moreforfilter;
628$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
629$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
630$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
632print
'<div class="div-table-responsive">';
633print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
638print
'<tr class="liste_titre_filter">';
641 print
'<td class="liste_titre center maxwidthsearch">';
642 $searchpicto = $form->showFilterButtons(
'left');
647if (!empty($arrayfields[
'f.titre'][
'checked'])) {
648 print
'<td class="liste_titre left">';
649 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
653if (!empty($arrayfields[
's.nom'][
'checked'])) {
654 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"></td>';
656if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
658 print
'<td class="liste_titre right">';
659 print
'<input class="flat width50" type="text"" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
662if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
664 print
'<td class="liste_titre right">';
665 print
'<input class="flat width50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
668if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
670 print
'<td class="liste_titre right">';
671 print
'<input class="flat width50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
674if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
676 print
'<td class="liste_titre">';
677 print $form->getSelectConditionsPaiements((
int) $search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
680if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
682 print
'<td class="liste_titre">';
683 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
686if (!empty($arrayfields[
'recurring'][
'checked'])) {
688 print
'<td class="liste_titre center">';
689 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
692if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
694 print
'<td class="liste_titre center">';
695 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
698if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
700 print
'<td class="liste_titre center">';
701 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
704if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
706 print
'<td class="liste_titre" align="center">';
707 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
711if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
712 print
'<td class="liste_titre center">';
713 print
'<div class="nowrapfordate">';
714 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
716 print
'<div class="nowrapfordate">';
717 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
722if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
723 print
'<td class="liste_titre center">';
724 print
'<div class="nowrapfordate">';
725 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'));
727 print
'<div class="nowrapfordate">';
728 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'));
733include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
736$parameters = array(
'arrayfields' => $arrayfields);
737$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
738print $hookmanager->resPrint;
740if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
741 print
'<td class="liste_titre">';
745if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
746 print
'<td class="liste_titre">';
750if (!empty($arrayfields[
'f.datec'][
'checked'])) {
751 print
'<td class="liste_titre">';
755if (!empty($arrayfields[
'f.tms'][
'checked'])) {
756 print
'<td class="liste_titre">';
760if (!empty($arrayfields[
'status'][
'checked'])) {
761 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
763 0 => $langs->trans(
"Draft"),
764 1 => $langs->trans(
"Active"),
765 -1 => $langs->trans(
"Disabled"),
768 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
773 print
'<td class="liste_titre center maxwidthsearch">';
774 $searchpicto = $form->showFilterButtons();
785print
'<tr class="liste_titre">';
788 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
791if (!empty($arrayfields[
'f.titre'][
'checked'])) {
793 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
796if (!empty($arrayfields[
's.nom'][
'checked'])) {
797 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
800if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
801 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
804if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
805 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
808if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
809 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
812if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
813 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
816if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
817 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
820if (!empty($arrayfields[
'recurring'][
'checked'])) {
821 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
824if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
825 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
828if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
829 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
832if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
833 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
836if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
837 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
840if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
841 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
844if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
845 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
848if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
849 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
852if (!empty($arrayfields[
'f.datec'][
'checked'])) {
853 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
856if (!empty($arrayfields[
'f.tms'][
'checked'])) {
857 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
861include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
864$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>$totalarray);
865$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
866print $hookmanager->resPrint;
868if (!empty($arrayfields[
'status'][
'checked'])) {
869 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
874 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
886$imaxinloop = ($limit ? min($num, $limit) : $num);
887while ($i < $imaxinloop) {
888 $objp = $db->fetch_object($resql);
893 $companystatic->id = $objp->socid;
894 $companystatic->name = $objp->name;
896 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
897 $invoicerectmp->frequency = $objp->frequency;
898 $invoicerectmp->suspended = $objp->suspended;
899 $invoicerectmp->unit_frequency = $objp->unit_frequency;
900 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
901 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
902 $invoicerectmp->ref = $objp->title;
903 $invoicerectmp->total_ht = $objp->total_ht;
904 $invoicerectmp->total_tva = $objp->total_tva;
905 $invoicerectmp->total_ttc = $objp->total_ttc;
909 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
912 print
'<td class="center tdoverflowmax125">';
913 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
914 if ($invoicerectmp->isMaxNbGenReached()) {
915 print $langs->trans(
"MaxNumberOfGenerationReached");
916 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
917 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
918 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="none"');
921 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
929 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
930 print
'<td class="nowrap tdoverflowmax200">';
931 print $invoicerectmp->getNomUrl(1);
937 if (!empty($arrayfields[
's.nom'][
'checked'])) {
938 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
943 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
944 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
951 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
953 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
954 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
961 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
963 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
964 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
971 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
974 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
975 print
'<td class="tdoverflowmax150">';
976 $form->form_conditions_reglement(
'0', $objp->fk_cond_reglement,
'none');
983 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
984 print
'<td class="tdoverflowmax150">';
985 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
992 if (!empty($arrayfields[
'recurring'][
'checked'])) {
993 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>';
998 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
999 print
'<td class="center">';
1000 print($objp->frequency > 0 ? $objp->frequency :
'');
1006 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
1007 print
'<td class="center">';
1008 if ($objp->frequency > 1) {
1009 $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"));
1011 $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"));
1013 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
1019 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
1020 print
'<td class="center">';
1021 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1028 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
1029 print
'<td class="center">';
1030 print($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1037 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
1038 print
'<td class="center">';
1039 print
'<div class="nowraponall">';
1040 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>');
1041 if (!$invoicerectmp->isMaxNbGenReached()) {
1042 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
1046 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1054 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
1055 print
'<td class="center tdoverflowmax150">';
1056 if ($objp->fk_user_author > 0) {
1057 $tmpuser->fetch($objp->fk_user_author);
1058 print $tmpuser->getNomUrl(1);
1065 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1066 print
'<td class="center tdoverflowmax150">';
1067 if ($objp->fk_user_author > 0) {
1068 $tmpuser->fetch($objp->fk_user_author);
1069 print $tmpuser->getNomUrl(1);
1076 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1077 print
'<td class="center nowraponall">';
1084 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1085 print
'<td class="center nowraponall">';
1095 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1097 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1098 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1099 print $hookmanager->resPrint;
1101 if (!empty($arrayfields[
'status'][
'checked'])) {
1102 print
'<td class="center">';
1103 print $invoicerectmp->getLibStatut(5, 0);
1111 print
'<td class="nowrap center tdoverflowmax125">';
1112 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
1113 if ($invoicerectmp->isMaxNbGenReached()) {
1114 print $langs->trans(
"MaxNumberOfGenerationReached");
1115 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
1116 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1117 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1121 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1136include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1141 foreach ($arrayfields as $key => $val) {
1142 if (!empty($val[
'checked'])) {
1146 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1152$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1153$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1154print $hookmanager->resPrint;
1156print
'</table>'.
"\n";
1159print
'</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...
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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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.