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$action =
GETPOST(
'action',
'alpha');
59$massaction =
GETPOST(
'massaction',
'alpha');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$cancel =
GETPOST(
'cancel',
'alpha');
63$toselect =
GETPOST(
'toselect',
'array');
64$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
65$optioncss =
GETPOST(
'optioncss',
'aZ');
67$groupby =
GETPOST(
'groupby',
'aZ09');
75 $socid = $user->socid;
77$objecttype =
'facture_rec';
78if ($action ==
"create" || $action ==
"add") {
82$search_ref =
GETPOST(
'search_ref');
83$search_societe =
GETPOST(
'search_societe');
84$search_montant_ht =
GETPOST(
'search_montant_ht');
85$search_montant_vat =
GETPOST(
'search_montant_vat');
86$search_montant_ttc =
GETPOST(
'search_montant_ttc');
87$search_payment_mode =
GETPOST(
'search_payment_mode');
88$search_payment_term =
GETPOST(
'search_payment_term');
89$search_date_startday =
GETPOSTINT(
'search_date_startday');
90$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
91$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
92$search_date_endday =
GETPOSTINT(
'search_date_endday');
93$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
94$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
95$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
96$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
97$search_date_when_startday =
GETPOSTINT(
'search_date_when_startday');
98$search_date_when_startmonth =
GETPOSTINT(
'search_date_when_startmonth');
99$search_date_when_startyear =
GETPOSTINT(
'search_date_when_startyear');
100$search_date_when_endday =
GETPOSTINT(
'search_date_when_endday');
101$search_date_when_endmonth =
GETPOSTINT(
'search_date_when_endmonth');
102$search_date_when_endyear =
GETPOSTINT(
'search_date_when_endyear');
103$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
104$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
105$search_recurring =
GETPOST(
'search_recurring',
'intcomma');
106$search_frequency =
GETPOST(
'search_frequency',
'alpha');
107$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
108$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
109$search_status =
GETPOST(
'search_status',
'intcomma');
112$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
113$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
115if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
119$offset = $limit * $page;
120$pageprev = $page - 1;
121$pagenext = $page + 1;
127if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
128 $ret =
$object->fetch($id, $ref);
135$hookmanager->initHooks(array(
'invoicereclist'));
138$extrafields->fetch_name_optionals_label(
$object->table_element);
140$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
147 $sortfield =
'f.titre';
151 'f.titre' => array(
'label' =>
"Ref",
'checked' =>
'1'),
152 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
153 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
154 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'-1'),
155 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1'),
156 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
157 'f.fk_cond_reglement' => array(
'label' =>
"PaymentTerm",
'checked' =>
'0'),
158 'recurring' => array(
'label' =>
"RecurringInvoice",
'checked' =>
'1'),
159 'f.frequency' => array(
'label' =>
"Frequency",
'checked' =>
'1'),
160 'f.unit_frequency' => array(
'label' =>
"FrequencyUnit",
'checked' =>
'1'),
161 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' =>
'1'),
162 'f.date_last_gen' => array(
'label' =>
"DateLastGenerationShort",
'checked' =>
'1'),
163 'f.date_when' => array(
'label' =>
"NextDateToExecutionShort",
'checked' =>
'1'),
164 'f.fk_user_author' => array(
'label' =>
"UserCreation",
'checked' =>
'0',
'position' => 500),
165 'f.fk_user_modif' => array(
'label' =>
"UserModification",
'checked' =>
'0',
'position' => 505),
166 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 520),
167 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 525),
168 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
171include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
177 $tmpthirdparty =
new Societe($db);
178 $res = $tmpthirdparty->fetch($socid);
180 $search_societe = $tmpthirdparty->name;
184$objecttype =
'facture_rec';
186$permissiontoread = $user->hasRight(
"facture",
"read");
187$permissionnote = $user->hasRight(
'facture',
'creer');
188$permissiondellink = $user->hasRight(
'facture',
'creer');
189$permissiontoedit = $user->hasRight(
'facture',
'creer');
190$permissiontodelete = $user->hasRight(
"facture",
"delete");
192$uploaddir =
$conf->facture->dir_output;
202if (
GETPOST(
'cancel',
'alpha')) {
206if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
210$parameters = array(
'arrayfields' => &$arrayfields,
'socid' => $socid);
211$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
216if (empty($reshook)) {
222 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
225 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
227 $search_societe =
'';
228 $search_montant_ht =
'';
229 $search_montant_vat =
'';
230 $search_montant_ttc =
'';
231 $search_payment_mode =
'';
232 $search_payment_term =
'';
233 $search_date_startday =
'';
234 $search_date_startmonth =
'';
235 $search_date_startyear =
'';
236 $search_date_endday =
'';
237 $search_date_endmonth =
'';
238 $search_date_endyear =
'';
239 $search_date_start =
'';
240 $search_date_end =
'';
241 $search_date_when_startday =
'';
242 $search_date_when_startmonth =
'';
243 $search_date_when_startyear =
'';
244 $search_date_when_endday =
'';
245 $search_date_when_endmonth =
'';
246 $search_date_when_endyear =
'';
247 $search_date_when_start =
'';
248 $search_date_when_end =
'';
249 $search_recurring =
'';
250 $search_frequency =
'';
251 $search_unit_frequency =
'';
252 $search_nb_gen_done =
'';
255 $search_array_options = array();
257 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
258 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
273$form =
new Form($db);
275if (isModEnabled(
'project')) {
278$companystatic =
new Societe($db);
280$tmpuser =
new User($db);
285$title = $langs->trans(
"RepeatableInvoices");
290$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
295$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,";
296$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
297$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
298$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
300if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
301 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
302 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
306$parameters = array();
307$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
308$sql .= $hookmanager->resPrint;
309$sql = preg_replace(
'/,\s*$/',
'', $sql);
313$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
314$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
315if (!$user->hasRight(
'societe',
'client',
'voir')) {
316 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
319$parameters = array();
320$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
321$sql .= $hookmanager->resPrint;
323$sql .=
" WHERE f.fk_soc = s.rowid";
324$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
325if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
326 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
332 $sql .=
' AND s.rowid = '.(int) $socid;
334if ($search_societe) {
337if ($search_montant_ht !=
'') {
340if ($search_montant_vat !=
'') {
343if ($search_montant_ttc !=
'') {
346if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
347 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
349if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
350 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
352if ($search_recurring ==
'1') {
353 $sql .=
' AND f.frequency > 0';
355if ($search_recurring ==
'0') {
356 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
358if ($search_frequency !=
'') {
361if ($search_unit_frequency !=
'') {
362 $sql .=
' AND f.frequency > 0';
363 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
365if ($search_nb_gen_done !=
'') {
368if ($search_status !=
'' && $search_status >= -1) {
369 if ($search_status == 0) {
370 $sql .=
' AND frequency = 0 AND suspended = 0';
372 if ($search_status == 1) {
373 $sql .=
' AND frequency != 0 AND suspended = 0';
375 if ($search_status == -1) {
376 $sql .=
' AND suspended = 1';
379if ($search_date_start) {
380 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
382if ($search_date_end) {
383 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
385if ($search_date_when_start) {
386 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
388if ($search_date_when_end) {
389 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
392include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
395$nbtotalofrecords =
'';
398 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
399 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
400 $resql = $db->query($sqlforcount);
402 $objforcount = $db->fetch_object($resql);
403 $nbtotalofrecords = $objforcount->nbtotalofrecords;
408 if (($page * $limit) > $nbtotalofrecords) {
415$tmpsortfield = $sortfield;
416if ($tmpsortfield ==
'recurring') {
417 $tmpsortfield =
'f.frequency';
421$sql .= $db->order($tmpsortfield, $sortorder);
423 $sql .= $db->plimit($limit + 1, $offset);
426$resql = $db->query($sql);
432$num = $db->num_rows($resql);
438llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
440$arrayofselected = is_array($toselect) ? $toselect : array();
444 $param .=
'&mode='.urlencode($mode);
446if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
447 $param .=
'&contextpage='.urlencode($contextpage);
449if ($limit > 0 && $limit !=
$conf->liste_limit) {
450 $param .=
'&limit='.((int) $limit);
452if ($optioncss !=
'') {
453 $param .=
'&optioncss='.urlencode($optioncss);
456 $param .=
'&groupby='.urlencode($groupby);
459 $param .=
'&socid='.urlencode((
string) ($socid));
461if ($search_date_startday) {
462 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
464if ($search_date_startmonth) {
465 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
467if ($search_date_startyear) {
468 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
470if ($search_date_endday) {
471 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
473if ($search_date_endmonth) {
474 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
476if ($search_date_endyear) {
477 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
479if ($search_date_when_startday) {
480 $param .=
'&search_date_when_startday='.urlencode((
string) ($search_date_when_startday));
482if ($search_date_when_startmonth) {
483 $param .=
'&search_date_when_startmonth='.urlencode((
string) ($search_date_when_startmonth));
485if ($search_date_when_startyear) {
486 $param .=
'&search_date_when_startyear='.urlencode((
string) ($search_date_when_startyear));
488if ($search_date_when_endday) {
489 $param .=
'&search_date_when_endday='.urlencode((
string) ($search_date_when_endday));
491if ($search_date_when_endmonth) {
492 $param .=
'&search_date_when_endmonth='.urlencode((
string) ($search_date_when_endmonth));
494if ($search_date_when_endyear) {
495 $param .=
'&search_date_when_endyear='.urlencode((
string) ($search_date_when_endyear));
498 $param .=
'&search_ref='.urlencode($search_ref);
500if ($search_societe) {
501 $param .=
'&search_societe='.urlencode($search_societe);
503if ($search_montant_ht !=
'') {
504 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
506if ($search_montant_vat !=
'') {
507 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
509if ($search_montant_ttc !=
'') {
510 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
512if ($search_payment_mode !=
'') {
513 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
515if ($search_payment_term !=
'') {
516 $param .=
'&search_payment_term='.urlencode($search_payment_term);
518if ($search_recurring !=
'' && $search_recurring !=
'-1') {
519 $param .=
'&search_recurring='.urlencode($search_recurring);
521if ($search_frequency > 0) {
522 $param .=
'&search_frequency='.urlencode($search_frequency);
524if ($search_unit_frequency !=
'') {
525 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
527if ($search_nb_gen_done !=
'') {
528 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
530if ($search_status !=
'') {
531 $param .=
'&search_status='.urlencode($search_status);
534include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
536$parameters = array(
'param' => &$param);
537$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
538$param .= $hookmanager->resPrint;
541$arrayofmassactions = array(
548$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend' => $langs->trans(
"SendByMail"),
'builddoc' => $langs->trans(
"PDFMerge")));
550$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
551$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
552$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
555print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
556if ($optioncss !=
'') {
557 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
559print
'<input type="hidden" name="token" value="'.newToken().
'">';
560print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
561print
'<input type="hidden" name="action" value="list">';
562print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
563print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
564print
'<input type="hidden" name="page" value="'.$page.
'">';
565print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
566print
'<input type="hidden" name="page_y" value="">';
567print
'<input type="hidden" name="mode" value="'.$mode.
'">';
570print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
572print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
578$parameters = array();
579$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
580if (empty($reshook)) {
581 $moreforfilter .= $hookmanager->resPrint;
583 $moreforfilter = $hookmanager->resPrint;
586if (!empty($moreforfilter)) {
587 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
588 print $moreforfilter;
592$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
593$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
594$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
596print
'<div class="div-table-responsive">';
597print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
602print
'<tr class="liste_titre_filter">';
605 print
'<td class="liste_titre center maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons(
'left');
611if (!empty($arrayfields[
'f.titre'][
'checked'])) {
612 print
'<td class="liste_titre left">';
613 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
617if (!empty($arrayfields[
's.nom'][
'checked'])) {
618 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"></td>';
620if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
622 print
'<td class="liste_titre right">';
623 print
'<input class="flat width50" type="text"" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
626if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
628 print
'<td class="liste_titre right">';
629 print
'<input class="flat width50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
632if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
634 print
'<td class="liste_titre right">';
635 print
'<input class="flat width50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
638if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
640 print
'<td class="liste_titre">';
641 print $form->getSelectConditionsPaiements((
int) $search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
644if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
646 print
'<td class="liste_titre">';
647 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
650if (!empty($arrayfields[
'recurring'][
'checked'])) {
652 print
'<td class="liste_titre center">';
653 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
656if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
658 print
'<td class="liste_titre center">';
659 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
662if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
664 print
'<td class="liste_titre center">';
665 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
668if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
670 print
'<td class="liste_titre" align="center">';
671 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
675if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
676 print
'<td class="liste_titre center">';
677 print
'<div class="nowrapfordate">';
678 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
680 print
'<div class="nowrapfordate">';
681 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
686if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
687 print
'<td class="liste_titre center">';
688 print
'<div class="nowrapfordate">';
689 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'));
691 print
'<div class="nowrapfordate">';
692 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'));
697include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
700$parameters = array(
'arrayfields' => $arrayfields);
701$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
702print $hookmanager->resPrint;
704if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
705 print
'<td class="liste_titre">';
709if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
710 print
'<td class="liste_titre">';
714if (!empty($arrayfields[
'f.datec'][
'checked'])) {
715 print
'<td class="liste_titre">';
719if (!empty($arrayfields[
'f.tms'][
'checked'])) {
720 print
'<td class="liste_titre">';
724if (!empty($arrayfields[
'status'][
'checked'])) {
725 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
727 0 => $langs->trans(
"Draft"),
728 1 => $langs->trans(
"Active"),
729 -1 => $langs->trans(
"Disabled"),
732 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
737 print
'<td class="liste_titre center maxwidthsearch">';
738 $searchpicto = $form->showFilterButtons();
749print
'<tr class="liste_titre">';
752 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
755if (!empty($arrayfields[
'f.titre'][
'checked'])) {
757 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
760if (!empty($arrayfields[
's.nom'][
'checked'])) {
761 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
764if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
765 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
768if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
769 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
772if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
773 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
776if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
777 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
780if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
781 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
784if (!empty($arrayfields[
'recurring'][
'checked'])) {
785 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
788if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
789 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
792if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
793 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
796if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
797 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
800if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
801 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
804if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
805 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
808if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
809 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
812if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
813 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
816if (!empty($arrayfields[
'f.datec'][
'checked'])) {
817 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
820if (!empty($arrayfields[
'f.tms'][
'checked'])) {
821 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
825include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
826if (!empty($arrayfields[
'status'][
'checked'])) {
827 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
832 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
844$imaxinloop = ($limit ? min($num, $limit) : $num);
845while ($i < $imaxinloop) {
846 $objp = $db->fetch_object($resql);
851 $companystatic->id = $objp->socid;
852 $companystatic->name = $objp->name;
854 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
855 $invoicerectmp->frequency = $objp->frequency;
856 $invoicerectmp->suspended = $objp->suspended;
857 $invoicerectmp->unit_frequency = $objp->unit_frequency;
858 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
859 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
860 $invoicerectmp->ref = $objp->title;
861 $invoicerectmp->total_ht = $objp->total_ht;
862 $invoicerectmp->total_tva = $objp->total_tva;
863 $invoicerectmp->total_ttc = $objp->total_ttc;
867 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
870 print
'<td class="center tdoverflowmax125">';
871 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
872 if ($invoicerectmp->isMaxNbGenReached()) {
873 print $langs->trans(
"MaxNumberOfGenerationReached");
874 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
875 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
876 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="none"');
879 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
887 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
888 print
'<td class="nowrap tdoverflowmax200">';
889 print $invoicerectmp->getNomUrl(1);
895 if (!empty($arrayfields[
's.nom'][
'checked'])) {
896 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
901 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
902 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
909 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
911 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
912 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
919 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
921 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
922 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
929 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
932 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
933 print
'<td class="tdoverflowmax150">';
934 $form->form_conditions_reglement(
'0', $objp->fk_cond_reglement,
'none');
941 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
942 print
'<td class="tdoverflowmax150">';
943 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
950 if (!empty($arrayfields[
'recurring'][
'checked'])) {
951 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>';
956 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
957 print
'<td class="center">';
958 print($objp->frequency > 0 ? $objp->frequency :
'');
964 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
965 print
'<td class="center">';
966 if ($objp->frequency > 1) {
967 $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"));
969 $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"));
971 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
977 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
978 print
'<td class="center">';
979 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
986 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
987 print
'<td class="center">';
988 print($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
995 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
996 print
'<td class="center">';
997 print
'<div class="nowraponall">';
998 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>');
999 if (!$invoicerectmp->isMaxNbGenReached()) {
1000 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
1004 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1012 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
1013 print
'<td class="center tdoverflowmax150">';
1014 if ($objp->fk_user_author > 0) {
1015 $tmpuser->fetch($objp->fk_user_author);
1016 print $tmpuser->getNomUrl(1);
1023 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1024 print
'<td class="center tdoverflowmax150">';
1025 if ($objp->fk_user_author > 0) {
1026 $tmpuser->fetch($objp->fk_user_author);
1027 print $tmpuser->getNomUrl(1);
1034 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1035 print
'<td class="center nowraponall">';
1042 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1043 print
'<td class="center nowraponall">';
1053 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1055 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1056 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1057 print $hookmanager->resPrint;
1059 if (!empty($arrayfields[
'status'][
'checked'])) {
1060 print
'<td class="center">';
1061 print $invoicerectmp->getLibStatut(5, 0);
1069 print
'<td class="nowrap center tdoverflowmax125">';
1070 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
1071 if ($invoicerectmp->isMaxNbGenReached()) {
1072 print $langs->trans(
"MaxNumberOfGenerationReached");
1073 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
1074 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1075 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1079 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1094include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1099 foreach ($arrayfields as $key => $val) {
1100 if (!empty($val[
'checked'])) {
1104 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1110$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1111$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1112print $hookmanager->resPrint;
1114print
'</table>'.
"\n";
1117print
'</form>'.
"\n";
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_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)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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_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.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_info($titlealt='default')
Show info logo.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.