34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46$langs->loadLangs(array(
'companies',
'bills',
'compta',
'admin',
'other'));
48$action =
GETPOST(
'action',
'alpha');
49$massaction =
GETPOST(
'massaction',
'alpha');
50$show_files =
GETPOST(
'show_files',
'int');
51$confirm =
GETPOST(
'confirm',
'alpha');
52$cancel =
GETPOST(
'cancel',
'alpha');
53$toselect =
GETPOST(
'toselect',
'array');
54$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
55$optioncss =
GETPOST(
'optioncss',
'aZ');
58$socid =
GETPOST(
'socid',
'int');
61$lineid =
GETPOST(
'lineid',
'int');
64 $socid = $user->socid;
66$objecttype =
'facture_rec';
67if ($action ==
"create" || $action ==
"add") {
71$search_ref =
GETPOST(
'search_ref');
72$search_societe =
GETPOST(
'search_societe');
73$search_montant_ht =
GETPOST(
'search_montant_ht');
74$search_montant_vat =
GETPOST(
'search_montant_vat');
75$search_montant_ttc =
GETPOST(
'search_montant_ttc');
76$search_payment_mode =
GETPOST(
'search_payment_mode');
77$search_payment_term =
GETPOST(
'search_payment_term');
78$search_date_startday =
GETPOST(
'search_date_startday',
'int');
79$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
80$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
81$search_date_endday =
GETPOST(
'search_date_endday',
'int');
82$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
83$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
84$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
85$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
86$search_date_when_startday =
GETPOST(
'search_date_when_startday',
'int');
87$search_date_when_startmonth =
GETPOST(
'search_date_when_startmonth',
'int');
88$search_date_when_startyear =
GETPOST(
'search_date_when_startyear',
'int');
89$search_date_when_endday =
GETPOST(
'search_date_when_endday',
'int');
90$search_date_when_endmonth =
GETPOST(
'search_date_when_endmonth',
'int');
91$search_date_when_endyear =
GETPOST(
'search_date_when_endyear',
'int');
92$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
93$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
94$search_recurring =
GETPOST(
'search_recurring',
'int');
95$search_frequency =
GETPOST(
'search_frequency',
'alpha');
96$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
97$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
98$search_status =
GETPOST(
'search_status',
'int');
100$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
101$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
102$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
103$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
104if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
108$offset = $limit * $page;
109$pageprev = $page - 1;
110$pagenext = $page + 1;
116if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
117 $ret = $object->fetch($id, $ref);
124$hookmanager->initHooks(array(
'invoicereclist'));
127$extrafields->fetch_name_optionals_label($object->table_element);
129$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
136 $sortfield =
'f.titre';
140 'f.titre'=>array(
'label'=>
"Ref",
'checked'=>1),
141 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
142 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1),
143 'f.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>-1),
144 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>1),
145 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>0),
146 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentTerm",
'checked'=>0),
147 'recurring'=>array(
'label'=>
"RecurringInvoice",
'checked'=>1),
148 'f.frequency'=>array(
'label'=>
"Frequency",
'checked'=>1),
149 'f.unit_frequency'=>array(
'label'=>
"FrequencyUnit",
'checked'=>1),
150 'f.nb_gen_done'=>array(
'label'=>
"NbOfGenerationDoneShort",
'checked'=>1),
151 'f.date_last_gen'=>array(
'label'=>
"DateLastGenerationShort",
'checked'=>1),
152 'f.date_when'=>array(
'label'=>
"NextDateToExecutionShort",
'checked'=>1),
153 'f.fk_user_author'=>array(
'label'=>
"UserCreation",
'checked'=>0,
'position'=>500),
154 'f.fk_user_modif'=>array(
'label'=>
"UserModification",
'checked'=>0,
'position'=>505),
155 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>520),
156 'f.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>525),
157 'status'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
160include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
166 $tmpthirdparty =
new Societe($db);
167 $res = $tmpthirdparty->fetch($socid);
169 $search_societe = $tmpthirdparty->name;
173$objecttype =
'facture_rec';
175$permissionnote = $user->hasRight(
'facture',
'creer');
176$permissiondellink = $user->hasRight(
'facture',
'creer');
177$permissiontoedit = $user->hasRight(
'facture',
'creer');
180$result =
restrictedArea($user,
'facture', $object->id, $objecttype);
187if (
GETPOST(
'cancel',
'alpha')) {
191if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
195$parameters = array(
'socid' => $socid);
196$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
201if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
212 $search_societe =
'';
213 $search_montant_ht =
'';
214 $search_montant_vat =
'';
215 $search_montant_ttc =
'';
216 $search_payment_mode =
'';
217 $search_payment_term =
'';
218 $search_date_startday =
'';
219 $search_date_startmonth =
'';
220 $search_date_startyear =
'';
221 $search_date_endday =
'';
222 $search_date_endmonth =
'';
223 $search_date_endyear =
'';
224 $search_date_start =
'';
225 $search_date_end =
'';
226 $search_date_when_startday =
'';
227 $search_date_when_startmonth =
'';
228 $search_date_when_startyear =
'';
229 $search_date_when_endday =
'';
230 $search_date_when_endmonth =
'';
231 $search_date_when_endyear =
'';
232 $search_date_when_start =
'';
233 $search_date_when_end =
'';
234 $search_recurring =
'';
235 $search_frequency =
'';
236 $search_unit_frequency =
'';
237 $search_nb_gen_done =
'';
240 $search_array_options = array();
242 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
243 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
261$form =
new Form($db);
263if (isModEnabled(
'project')) {
266$companystatic =
new Societe($db);
268$tmpuser =
new User($db);
273$title = $langs->trans(
"RepeatableInvoices");
278$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
283$sql =
"SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,";
284$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
285$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
286$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
288if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
289 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
290 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
294$parameters = array();
295$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
296$sql .= $hookmanager->resPrint;
297$sql = preg_replace(
'/,\s*$/',
'', $sql);
301$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
302$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
303if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
304 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
307$parameters = array();
308$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
309$sql .= $hookmanager->resPrint;
311$sql .=
" WHERE f.fk_soc = s.rowid";
312$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
313if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
314 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
320 $sql .=
' AND s.rowid = '.(int) $socid;
322if ($search_societe) {
325if ($search_montant_ht !=
'') {
328if ($search_montant_vat !=
'') {
331if ($search_montant_ttc !=
'') {
334if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
335 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
337if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
338 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
340if ($search_recurring ==
'1') {
341 $sql .=
' AND f.frequency > 0';
343if ($search_recurring ==
'0') {
344 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
346if ($search_frequency !=
'') {
349if ($search_unit_frequency !=
'') {
350 $sql .=
' AND f.frequency > 0';
351 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
353if ($search_nb_gen_done !=
'') {
356if ($search_status !=
'' && $search_status >= -1) {
357 if ($search_status == 0) {
358 $sql .=
' AND frequency = 0 AND suspended = 0';
360 if ($search_status == 1) {
361 $sql .=
' AND frequency != 0 AND suspended = 0';
363 if ($search_status == -1) {
364 $sql .=
' AND suspended = 1';
367if ($search_date_start) {
368 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
370if ($search_date_end) {
371 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
373if ($search_date_when_start) {
374 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
376if ($search_date_when_end) {
377 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
380include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
383$nbtotalofrecords =
'';
386 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
387 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
388 $resql = $db->query($sqlforcount);
390 $objforcount = $db->fetch_object($resql);
391 $nbtotalofrecords = $objforcount->nbtotalofrecords;
396 if (($page * $limit) > $nbtotalofrecords) {
403$tmpsortfield = $sortfield;
404if ($tmpsortfield ==
'recurring') {
405 $tmpsortfield =
'f.frequency';
409$sql .= $db->order($tmpsortfield, $sortorder);
411 $sql .= $db->plimit($limit + 1, $offset);
414$resql = $db->query($sql);
420$num = $db->num_rows($resql);
426llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
428$arrayofselected = is_array($toselect) ? $toselect : array();
432 $param .=
'&mode='.urlencode($mode);
434if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
435 $param .=
'&contextpage='.urlencode($contextpage);
437if ($limit > 0 && $limit != $conf->liste_limit) {
438 $param .=
'&limit='.((int) $limit);
441 $param .=
'&socid='.urlencode($socid);
443if ($search_date_startday) {
444 $param .=
'&search_date_startday='.urlencode($search_date_startday);
446if ($search_date_startmonth) {
447 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
449if ($search_date_startyear) {
450 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
452if ($search_date_endday) {
453 $param .=
'&search_date_endday='.urlencode($search_date_endday);
455if ($search_date_endmonth) {
456 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
458if ($search_date_endyear) {
459 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
461if ($search_date_when_startday) {
462 $param .=
'&search_date_when_startday='.urlencode($search_date_when_startday);
464if ($search_date_when_startmonth) {
465 $param .=
'&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
467if ($search_date_when_startyear) {
468 $param .=
'&search_date_when_startyear='.urlencode($search_date_when_startyear);
470if ($search_date_when_endday) {
471 $param .=
'&search_date_when_endday='.urlencode($search_date_when_endday);
473if ($search_date_when_endmonth) {
474 $param .=
'&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
476if ($search_date_when_endyear) {
477 $param .=
'&search_date_when_endyear='.urlencode($search_date_when_endyear);
480 $param .=
'&search_ref='.urlencode($search_ref);
482if ($search_societe) {
483 $param .=
'&search_societe='.urlencode($search_societe);
485if ($search_montant_ht !=
'') {
486 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
488if ($search_montant_vat !=
'') {
489 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
491if ($search_montant_ttc !=
'') {
492 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
494if ($search_payment_mode !=
'') {
495 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
497if ($search_payment_term !=
'') {
498 $param .=
'&search_payment_term='.urlencode($search_payment_term);
500if ($search_recurring !=
'' && $search_recurring !=
'-1') {
501 $param .=
'&search_recurring='.urlencode($search_recurring);
503if ($search_frequency > 0) {
504 $param .=
'&search_frequency='.urlencode($search_frequency);
506if ($search_unit_frequency !=
'') {
507 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
509if ($search_nb_gen_done !=
'') {
510 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
512if ($search_status !=
'') {
513 $param .=
'&search_status='.urlencode($search_status);
515if ($optioncss !=
'') {
516 $param .=
'&optioncss='.urlencode($optioncss);
519include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
521$parameters = array(
'param' => &$param);
522$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
523$param .= $hookmanager->resPrint;
526$arrayofmassactions = array(
533$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend'=>$langs->trans(
"SendByMail"),
'builddoc'=>$langs->trans(
"PDFMerge")));
535$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
536$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
539print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
540if ($optioncss !=
'') {
541 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
543print
'<input type="hidden" name="token" value="'.newToken().
'">';
544print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
545print
'<input type="hidden" name="action" value="list">';
546print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
547print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
548print
'<input type="hidden" name="page" value="'.$page.
'">';
549print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
550print
'<input type="hidden" name="page_y" value="">';
551print
'<input type="hidden" name="mode" value="'.$mode.
'">';
554print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
556print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
562$parameters = array();
563$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
564if (empty($reshook)) {
565 $moreforfilter .= $hookmanager->resPrint;
567 $moreforfilter = $hookmanager->resPrint;
570if (!empty($moreforfilter)) {
571 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
572 print $moreforfilter;
576$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
577$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
578$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
580print
'<div class="div-table-responsive">';
581print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
586print
'<tr class="liste_titre_filter">';
589 print
'<td class="liste_titre maxwidthsearch center">';
590 $searchpicto = $form->showFilterButtons(
'left');
595if (!empty($arrayfields[
'f.titre'][
'checked'])) {
596 print
'<td class="liste_titre left">';
597 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
601if (!empty($arrayfields[
's.nom'][
'checked'])) {
602 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
604if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
606 print
'<td class="liste_titre right">';
607 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
610if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
612 print
'<td class="liste_titre right">';
613 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
616if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
618 print
'<td class="liste_titre right">';
619 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
622if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
624 print
'<td class="liste_titre">';
625 print $form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
628if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
630 print
'<td class="liste_titre">';
631 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
634if (!empty($arrayfields[
'recurring'][
'checked'])) {
636 print
'<td class="liste_titre center">';
637 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
640if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
642 print
'<td class="liste_titre center">';
643 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
646if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
648 print
'<td class="liste_titre center">';
649 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
652if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
654 print
'<td class="liste_titre" align="center">';
655 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
659if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
660 print
'<td class="liste_titre center">';
661 print
'<div class="nowrapfordate">';
662 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
664 print
'<div class="nowrapfordate">';
665 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
670if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
671 print
'<td class="liste_titre center">';
672 print
'<div class="nowrapfordate">';
673 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'));
675 print
'<div class="nowrapfordate">';
676 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'));
681include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
684$parameters = array(
'arrayfields'=>$arrayfields);
685$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
686print $hookmanager->resPrint;
688if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
689 print
'<td class="liste_titre">';
693if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
694 print
'<td class="liste_titre">';
698if (!empty($arrayfields[
'f.datec'][
'checked'])) {
699 print
'<td class="liste_titre">';
703if (!empty($arrayfields[
'f.tms'][
'checked'])) {
704 print
'<td class="liste_titre">';
708if (!empty($arrayfields[
'status'][
'checked'])) {
709 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
711 0=>$langs->trans(
"Draft"),
712 1=>$langs->trans(
"Active"),
713 -1=>$langs->trans(
"Disabled"),
715 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
720 print
'<td class="liste_titre maxwidthsearch center">';
721 $searchpicto = $form->showFilterButtons();
727$totalarray = array();
728$totalarray[
'nbfield'] = 0;
732print
'<tr class="liste_titre">';
735 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
736 $totalarray[
'nbfield']++;
738if (!empty($arrayfields[
'f.titre'][
'checked'])) {
739 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
740 $totalarray[
'nbfield']++;
742if (!empty($arrayfields[
's.nom'][
'checked'])) {
743 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
744 $totalarray[
'nbfield']++;
746if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
747 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
748 $totalarray[
'nbfield']++;
750if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
751 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
752 $totalarray[
'nbfield']++;
754if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
755 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
756 $totalarray[
'nbfield']++;
758if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
759 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
760 $totalarray[
'nbfield']++;
762if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
763 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
764 $totalarray[
'nbfield']++;
766if (!empty($arrayfields[
'recurring'][
'checked'])) {
767 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
768 $totalarray[
'nbfield']++;
770if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
771 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
772 $totalarray[
'nbfield']++;
774if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
775 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
776 $totalarray[
'nbfield']++;
778if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
779 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
780 $totalarray[
'nbfield']++;
782if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
783 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
784 $totalarray[
'nbfield']++;
786if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
787 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
788 $totalarray[
'nbfield']++;
790if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
791 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
792 $totalarray[
'nbfield']++;
794if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
795 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
796 $totalarray[
'nbfield']++;
798if (!empty($arrayfields[
'f.datec'][
'checked'])) {
799 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
800 $totalarray[
'nbfield']++;
802if (!empty($arrayfields[
'f.tms'][
'checked'])) {
803 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
804 $totalarray[
'nbfield']++;
807include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
808if (!empty($arrayfields[
'status'][
'checked'])) {
809 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
810 $totalarray[
'nbfield']++;
814 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
815 $totalarray[
'nbfield']++;
820$savnbfield = $totalarray[
'nbfield'];
821$totalarray = array();
822$totalarray[
'nbfield'] = 0;
823$totalarray[
'val'][
'f.total_ht'] = 0;
824$totalarray[
'val'][
'f.total_tva'] = 0;
825$totalarray[
'val'][
'f.total_ttc'] = 0;
826$imaxinloop = ($limit ? min($num, $limit) : $num);
827while ($i < $imaxinloop) {
828 $objp = $db->fetch_object($resql);
833 $companystatic->id = $objp->socid;
834 $companystatic->name = $objp->name;
836 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
837 $invoicerectmp->frequency = $objp->frequency;
838 $invoicerectmp->suspended = $objp->suspended;
839 $invoicerectmp->unit_frequency = $objp->unit_frequency;
840 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
841 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
842 $invoicerectmp->ref = $objp->title;
843 $invoicerectmp->total_ht = $objp->total_ht;
844 $invoicerectmp->total_tva = $objp->total_tva;
845 $invoicerectmp->total_ttc = $objp->total_ttc;
849 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
852 print
'<td class="center tdoverflowmax125">';
853 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
854 if ($invoicerectmp->isMaxNbGenReached()) {
855 print $langs->trans(
"MaxNumberOfGenerationReached");
856 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
857 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
858 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
859 print $langs->trans(
"CreateBill").
'</a>';
861 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
866 $totalarray[
'nbfield']++;
869 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
870 print
'<td class="nowrap tdoverflowmax200">';
871 print $invoicerectmp->getNomUrl(1);
874 $totalarray[
'nbfield']++;
877 if (!empty($arrayfields[
's.nom'][
'checked'])) {
878 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
880 $totalarray[
'nbfield']++;
883 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
884 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
886 $totalarray[
'nbfield']++;
889 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
891 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
893 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
894 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
896 $totalarray[
'nbfield']++;
899 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
901 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
903 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
904 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
906 $totalarray[
'nbfield']++;
909 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
911 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
914 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
915 print
'<td class="tdoverflowmax150">';
916 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
919 $totalarray[
'nbfield']++;
923 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
924 print
'<td class="tdoverflowmax150">';
925 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
928 $totalarray[
'nbfield']++;
932 if (!empty($arrayfields[
'recurring'][
'checked'])) {
933 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>';
935 $totalarray[
'nbfield']++;
938 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
939 print
'<td class="center">';
940 print($objp->frequency > 0 ? $objp->frequency :
'');
943 $totalarray[
'nbfield']++;
946 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
947 print
'<td class="center">';
948 if ($objp->frequency > 1) {
949 $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"));
951 $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"));
953 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
956 $totalarray[
'nbfield']++;
959 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
960 print
'<td class="center">';
961 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
964 $totalarray[
'nbfield']++;
968 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
969 print
'<td class="center">';
970 print($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
973 $totalarray[
'nbfield']++;
977 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
978 print
'<td class="center">';
979 print
'<div class="nowraponall">';
980 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>');
981 if (!$invoicerectmp->isMaxNbGenReached()) {
982 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
986 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
991 $totalarray[
'nbfield']++;
994 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
995 print
'<td class="center tdoverflowmax150">';
996 if ($objp->fk_user_author > 0) {
997 $tmpuser->fetch($objp->fk_user_author);
998 print $tmpuser->getNomUrl(1);
1002 $totalarray[
'nbfield']++;
1005 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1006 print
'<td class="center tdoverflowmax150">';
1007 if ($objp->fk_user_author > 0) {
1008 $tmpuser->fetch($objp->fk_user_author);
1009 print $tmpuser->getNomUrl(1);
1013 $totalarray[
'nbfield']++;
1016 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1017 print
'<td class="center nowraponall">';
1021 $totalarray[
'nbfield']++;
1024 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1025 print
'<td class="center nowraponall">';
1029 $totalarray[
'nbfield']++;
1035 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1037 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1038 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1039 print $hookmanager->resPrint;
1041 if (!empty($arrayfields[
'status'][
'checked'])) {
1042 print
'<td class="center">';
1043 print $invoicerectmp->getLibStatut(5, 0);
1046 $totalarray[
'nbfield']++;
1051 print
'<td class="nowrap center tdoverflowmax125">';
1052 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
1053 if ($invoicerectmp->isMaxNbGenReached()) {
1054 print $langs->trans(
"MaxNumberOfGenerationReached");
1055 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
1056 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1057 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1058 print $langs->trans(
"CreateBill").
'</a>';
1060 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1065 $totalarray[
'nbfield']++;
1075include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1080 foreach ($arrayfields as $key => $val) {
1081 if (!empty($val[
'checked'])) {
1085 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1091$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1092$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1093print $hookmanager->resPrint;
1095print
'</table>'.
"\n";
1098print
'</form>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage invoice templates.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
getDolGlobalString($key, $default='')
Return 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.
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.