33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture-rec.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
45$langs->loadLangs(array(
'bills',
'compta',
'admin',
'other',
'suppliers'));
47$action =
GETPOST(
'action',
'alpha');
48$massaction =
GETPOST(
'massaction',
'alpha');
49$show_files =
GETPOST(
'show_files',
'int');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$cancel =
GETPOST(
'cancel',
'alpha');
52$toselect =
GETPOST(
'toselect',
'array');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicestemplatelist';
54$optioncss =
GETPOST(
'optioncss',
'aZ');
57$socid =
GETPOST(
'socid',
'int');
60$lineid =
GETPOST(
'lineid',
'int');
63 $socid = $user->socid;
65$objecttype =
'facture_fourn_rec';
66if ($action ==
"create" || $action ==
"add") {
70$search_ref =
GETPOST(
'search_ref');
71$search_societe =
GETPOST(
'search_societe');
72$search_montant_ht =
GETPOST(
'search_montant_ht');
73$search_montant_vat =
GETPOST(
'search_montant_vat');
74$search_montant_ttc =
GETPOST(
'search_montant_ttc');
75$search_payment_mode =
GETPOST(
'search_payment_mode');
76$search_payment_term =
GETPOST(
'search_payment_term');
77$search_date_startday =
GETPOST(
'search_date_startday',
'int');
78$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
79$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
80$search_date_endday =
GETPOST(
'search_date_endday',
'int');
81$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
82$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
83$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
84$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
85$search_date_when_startday =
GETPOST(
'search_date_when_startday',
'int');
86$search_date_when_startmonth =
GETPOST(
'search_date_when_startmonth',
'int');
87$search_date_when_startyear =
GETPOST(
'search_date_when_startyear',
'int');
88$search_date_when_endday =
GETPOST(
'search_date_when_endday',
'int');
89$search_date_when_endmonth =
GETPOST(
'search_date_when_endmonth',
'int');
90$search_date_when_endyear =
GETPOST(
'search_date_when_endyear',
'int');
91$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
92$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
93$search_recurring =
GETPOST(
'search_recurring',
'int');
94$search_frequency =
GETPOST(
'search_frequency',
'alpha');
95$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
96$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
97$search_status =
GETPOST(
'search_status',
'int');
99$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
100$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
101$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
102$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
103if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
107$offset = $limit * $page;
108$pageprev = $page - 1;
109$pagenext = $page + 1;
115if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
116 $ret = $object->fetch($id, $ref);
123$hookmanager->initHooks(array(
'supplierinvoicereclist'));
126$extrafields->fetch_name_optionals_label($object->table_element);
128$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
135 $sortfield =
'f.titre';
138 'f.titre'=>array(
'label'=>
'Ref',
'checked'=>1),
139 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
140 'f.total_ht'=>array(
'label'=>
'AmountHT',
'checked'=>1),
141 'f.total_tva'=>array(
'label'=>
'AmountVAT',
'checked'=>1),
142 'f.total_ttc'=>array(
'label'=>
'AmountTTC',
'checked'=>1),
143 'f.fk_mode_reglement'=>array(
'label'=>
'PaymentMode',
'checked'=>0),
144 'f.fk_cond_reglement'=>array(
'label'=>
'PaymentTerm',
'checked'=>0),
145 'recurring'=>array(
'label'=>
'RecurringInvoice',
'checked'=>1),
146 'f.frequency'=>array(
'label'=>
'Frequency',
'checked'=>1),
147 'f.unit_frequency'=>array(
'label'=>
'FrequencyUnit',
'checked'=>1),
148 'f.nb_gen_done'=>array(
'label'=>
'NbOfGenerationDoneShort',
'checked'=>1),
149 'f.date_last_gen'=>array(
'label'=>
'DateLastGenerationShort',
'checked'=>1),
150 'f.date_when'=>array(
'label'=>
'NextDateToExecutionShort',
'checked'=>1),
151 'f.fk_user_author'=>array(
'label'=>
'UserCreation',
'checked'=>0,
'position'=>500),
152 'f.fk_user_modif'=>array(
'label'=>
'UserModification',
'checked'=>0,
'position'=>505),
153 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>520),
154 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>525),
155 'status'=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
158include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
164 $tmpthirdparty =
new Societe($db);
165 $res = $tmpthirdparty->fetch($socid);
167 $search_societe = $tmpthirdparty->name;
170$objecttype =
'facture_fourn_rec';
172$permissionnote = $user->hasRight(
'facture',
'creer');
173$permissiondellink = $user->hasRight(
'facture',
'creer');
174$permissiontoedit = $user->hasRight(
'facture',
'creer');
176$result =
restrictedArea($user,
'supplier_invoicerec', $object->id, $objecttype);
183if (
GETPOST(
'cancel',
'alpha')) {
187if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
191$parameters = array(
'socid' => $socid);
192$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
197if (empty($reshook)) {
203 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
206 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
208 $search_societe =
'';
209 $search_montant_ht =
'';
210 $search_montant_vat =
'';
211 $search_montant_ttc =
'';
212 $search_payment_mode =
'';
213 $search_payment_term =
'';
214 $search_date_startday =
'';
215 $search_date_startmonth =
'';
216 $search_date_startyear =
'';
217 $search_date_endday =
'';
218 $search_date_endmonth =
'';
219 $search_date_endyear =
'';
220 $search_date_start =
'';
221 $search_date_end =
'';
222 $search_date_when_startday =
'';
223 $search_date_when_startmonth =
'';
224 $search_date_when_startyear =
'';
225 $search_date_when_endday =
'';
226 $search_date_when_endmonth =
'';
227 $search_date_when_endyear =
'';
228 $search_date_when_start =
'';
229 $search_date_when_end =
'';
230 $search_recurring =
'';
231 $search_frequency =
'';
232 $search_unit_frequency =
'';
233 $search_nb_gen_done =
'';
236 $search_array_options = array();
238 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
239 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
257$form =
new Form($db);
259if (isModEnabled(
'project')) {
262$companystatic =
new Societe($db);
264$tmpuser =
new User($db);
269$title = $langs->trans(
"RepeatableSupplierInvoices");
274$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
280$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,";
281$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
282$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
283$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
285if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
286 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
287 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
291$parameters = array();
292$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
293$sql .= $hookmanager->resPrint;
294$sql = preg_replace(
'/,\s*$/',
'', $sql);
298$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn_rec as f';
299$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_rec_extrafields as ef ON ef.fk_object = f.rowid';
300if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
301 $sql .=
', '.MAIN_DB_PREFIX.
'societe_commerciaux as sc';
304$parameters = array();
305$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
306$sql .= $hookmanager->resPrint;
308$sql .=
" WHERE f.fk_soc = s.rowid";
309$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
310if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
311 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
317 $sql .=
' AND s.rowid = '.(int) $socid;
319if ($search_societe) {
322if ($search_montant_ht !=
'') {
325if ($search_montant_vat !=
'') {
328if ($search_montant_ttc !=
'') {
331if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
332 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
334if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
335 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
337if ($search_recurring ==
'1') {
338 $sql .=
' AND f.frequency > 0';
340if ($search_recurring ==
'0') {
341 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
343if ($search_frequency !=
'') {
346if ($search_unit_frequency !=
'') {
347 $sql .=
' AND f.frequency > 0';
348 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
350if ($search_nb_gen_done !=
'') {
353if ($search_status !=
'' && $search_status >= -1) {
354 if ($search_status == 0) {
355 $sql .=
' AND frequency = 0 AND suspended = 0';
357 if ($search_status == 1) {
358 $sql .=
' AND frequency != 0 AND suspended = 0';
360 if ($search_status == -1) {
361 $sql .=
' AND suspended = 1';
364if ($search_date_start) {
365 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
367if ($search_date_end) {
368 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
370if ($search_date_when_start) {
371 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
373if ($search_date_when_end) {
374 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
378$nbtotalofrecords =
'';
381 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
382 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
383 $resql = $db->query($sqlforcount);
385 $objforcount = $db->fetch_object($resql);
386 $nbtotalofrecords = $objforcount->nbtotalofrecords;
391 if (($page * $limit) > $nbtotalofrecords) {
398$tmpsortfield = $sortfield;
399if ($tmpsortfield ==
'recurring') {
400 $tmpsortfield =
'f.frequency';
404$sql .= $db->order($tmpsortfield, $sortorder);
406 $sql .= $db->plimit($limit + 1, $offset);
409$resql = $db->query($sql);
415$num = $db->num_rows($resql);
420llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
422$arrayofselected = is_array($toselect) ? $toselect : array();
426 $param .=
'&mode='.urlencode($mode);
428if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
429 $param .=
'&contextpage='.urlencode($contextpage);
431if ($limit > 0 && $limit != $conf->liste_limit) {
432 $param .=
'&limit='.((int) $limit);
435 $param .=
'&socid='.urlencode($socid);
437if ($search_date_startday) {
438 $param .=
'&search_date_startday='.urlencode($search_date_startday);
440if ($search_date_startmonth) {
441 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
443if ($search_date_startyear) {
444 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
446if ($search_date_endday) {
447 $param .=
'&search_date_endday='.urlencode($search_date_endday);
449if ($search_date_endmonth) {
450 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
452if ($search_date_endyear) {
453 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
455if ($search_date_when_startday) {
456 $param .=
'&search_date_when_startday='.urlencode($search_date_when_startday);
458if ($search_date_when_startmonth) {
459 $param .=
'&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
461if ($search_date_when_startyear) {
462 $param .=
'&search_date_when_startyear='.urlencode($search_date_when_startyear);
464if ($search_date_when_endday) {
465 $param .=
'&search_date_when_endday='.urlencode($search_date_when_endday);
467if ($search_date_when_endmonth) {
468 $param .=
'&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
470if ($search_date_when_endyear) {
471 $param .=
'&search_date_when_endyear='.urlencode($search_date_when_endyear);
474 $param .=
'&search_ref='.urlencode($search_ref);
476if ($search_societe) {
477 $param .=
'&search_societe='.urlencode($search_societe);
479if ($search_montant_ht !=
'') {
480 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
482if ($search_montant_vat !=
'') {
483 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
485if ($search_montant_ttc !=
'') {
486 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
488if ($search_payment_mode !=
'') {
489 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
491if ($search_payment_term !=
'') {
492 $param .=
'&search_payment_term='.urlencode($search_payment_term);
494if ($search_recurring !=
'' && $search_recurring !=
'-1') {
495 $param .=
'&search_recurring='.urlencode($search_recurring);
497if ($search_frequency > 0) {
498 $param .=
'&search_frequency='.urlencode($search_frequency);
500if ($search_unit_frequency !=
'') {
501 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
503if ($search_nb_gen_done !=
'') {
504 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
506if ($search_status !=
'') {
507 $param .=
'&search_status='.urlencode($search_status);
509if ($optioncss !=
'') {
510 $param .=
'&optioncss='.urlencode($optioncss);
513include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
515$parameters = array(
'param' => &$param);
516$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
517$param .= $hookmanager->resPrint;
520$arrayofmassactions = array(
527$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend'=>$langs->trans(
"SendByMail"),
'builddoc'=>$langs->trans(
"PDFMerge")));
529$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
530$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
533print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
534if ($optioncss !=
'') {
535 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
537print
'<input type="hidden" name="token" value="'.newToken().
'">';
538print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
539print
'<input type="hidden" name="action" value="list">';
540print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
541print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
542print
'<input type="hidden" name="page" value="'.$page.
'">';
543print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
544print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
545print
'<input type="hidden" name="page_y" value="">';
546print
'<input type="hidden" name="mode" value="'.$mode.
'">';
549print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
551print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedSupplierInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
557$parameters = array();
558$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
559if (empty($reshook)) {
560 $moreforfilter .= $hookmanager->resPrint;
562 $moreforfilter = $hookmanager->resPrint;
565if (!empty($moreforfilter)) {
566 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
567 print $moreforfilter;
571$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
572$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
573$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
575print
'<div class="div-table-responsive">';
576print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
580print
'<tr class="liste_titre_filter">';
583 print
'<td class="liste_titre maxwidthsearch center">';
584 $searchpicto = $form->showFilterButtons(
'left');
589if (!empty($arrayfields[
'f.titre'][
'checked'])) {
590 print
'<td class="liste_titre left">';
591 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
595if (!empty($arrayfields[
's.nom'][
'checked'])) {
596 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
598if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
600 print
'<td class="liste_titre right">';
601 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
604if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
606 print
'<td class="liste_titre right">';
607 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
610if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
612 print
'<td class="liste_titre right">';
613 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
616if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
618 print
'<td class="liste_titre">';
619 print $form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
622if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
624 print
'<td class="liste_titre">';
625 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
628if (!empty($arrayfields[
'recurring'][
'checked'])) {
630 print
'<td class="liste_titre center">';
631 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
634if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
636 print
'<td class="liste_titre center">';
637 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
640if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
642 print
'<td class="liste_titre center">';
643 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
646if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
648 print
'<td class="liste_titre" align="center">';
649 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
653if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
654 print
'<td class="liste_titre center">';
655 print
'<div class="nowrapfordate">';
656 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
658 print
'<div class="nowrapfordate">';
659 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
664if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
665 print
'<td class="liste_titre center">';
666 print
'<div class="nowrapfordate">';
667 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'));
669 print
'<div class="nowrapfordate">';
670 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'));
675include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
678$parameters = array(
'arrayfields'=>$arrayfields);
679$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
680print $hookmanager->resPrint;
682if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
683 print
'<td class="liste_titre">';
687if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
688 print
'<td class="liste_titre">';
692if (!empty($arrayfields[
'f.datec'][
'checked'])) {
693 print
'<td class="liste_titre">';
697if (!empty($arrayfields[
'f.tms'][
'checked'])) {
698 print
'<td class="liste_titre">';
702if (!empty($arrayfields[
'status'][
'checked'])) {
703 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
705 0=>$langs->trans(
"Draft"),
706 1=>$langs->trans(
"Active"),
707 -1=>$langs->trans(
"Disabled"),
709 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
714 print
'<td class="liste_titre maxwidthsearch center">';
715 $searchpicto = $form->showFilterButtons();
721$totalarray = array();
722$totalarray[
'nbfield'] = 0;
726print
'<tr class="liste_titre">';
729 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
730 $totalarray[
'nbfield']++;
732if (!empty($arrayfields[
'f.titre'][
'checked'])) {
733 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
734 $totalarray[
'nbfield']++;
736if (!empty($arrayfields[
's.nom'][
'checked'])) {
737 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
738 $totalarray[
'nbfield']++;
740if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
741 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
742 $totalarray[
'nbfield']++;
744if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
745 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
746 $totalarray[
'nbfield']++;
748if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
749 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
750 $totalarray[
'nbfield']++;
752if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
753 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
754 $totalarray[
'nbfield']++;
756if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
757 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
758 $totalarray[
'nbfield']++;
760if (!empty($arrayfields[
'recurring'][
'checked'])) {
761 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
762 $totalarray[
'nbfield']++;
764if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
765 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
766 $totalarray[
'nbfield']++;
768if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
769 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
770 $totalarray[
'nbfield']++;
772if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
773 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
774 $totalarray[
'nbfield']++;
776if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
777 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
778 $totalarray[
'nbfield']++;
780if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
781 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
782 $totalarray[
'nbfield']++;
784if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
785 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
786 $totalarray[
'nbfield']++;
788if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
789 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
790 $totalarray[
'nbfield']++;
792if (!empty($arrayfields[
'f.datec'][
'checked'])) {
793 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
794 $totalarray[
'nbfield']++;
796if (!empty($arrayfields[
'f.tms'][
'checked'])) {
797 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
798 $totalarray[
'nbfield']++;
801include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
802if (!empty($arrayfields[
'status'][
'checked'])) {
803 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
804 $totalarray[
'nbfield']++;
808 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
809 $totalarray[
'nbfield']++;
814$savnbfield = $totalarray[
'nbfield'];
815$totalarray = array();
816$totalarray[
'nbfield'] = 0;
817$totalarray[
'val'][
'f.total_ht'] = 0;
818$totalarray[
'val'][
'f.total_tva'] = 0;
819$totalarray[
'val'][
'f.total_ttc'] = 0;
820$imaxinloop = ($limit ? min($num, $limit) : $num);
822while ($i < $imaxinloop) {
823 $objp = $db->fetch_object($resql);
828 $companystatic->id = $objp->socid;
829 $companystatic->name = $objp->name;
831 $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
832 $supplierinvoicerectmp->frequency = $objp->frequency;
833 $supplierinvoicerectmp->suspended = $objp->suspended;
834 $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
835 $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
836 $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
837 $supplierinvoicerectmp->ref = $objp->title;
838 $supplierinvoicerectmp->total_ht = $objp->total_ht;
839 $supplierinvoicerectmp->total_tva = $objp->total_tva;
840 $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
844 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
847 print
'<td class="center tdoverflowmax125">';
848 if ($user->hasRight(
'facture',
'creer') && empty($supplierinvoicerectmp->suspended)) {
849 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
850 print $langs->trans(
"MaxNumberOfGenerationReached");
851 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
852 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
853 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
854 print $langs->trans(
"CreateBill").
'</a>';
856 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
861 $totalarray[
'nbfield']++;
865 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
866 print
'<td class="nowrap tdoverflowmax200">';
867 print $supplierinvoicerectmp->getNomUrl(1);
870 $totalarray[
'nbfield']++;
873 if (!empty($arrayfields[
's.nom'][
'checked'])) {
874 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
876 $totalarray[
'nbfield']++;
879 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
880 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
882 $totalarray[
'nbfield']++;
885 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
887 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
889 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
890 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
892 $totalarray[
'nbfield']++;
895 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
897 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
899 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
900 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
902 $totalarray[
'nbfield']++;
905 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
907 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
910 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
911 print
'<td class="tdoverflowmax150">';
912 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
915 $totalarray[
'nbfield']++;
919 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
920 print
'<td class="tdoverflowmax150">';
921 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
924 $totalarray[
'nbfield']++;
928 if (!empty($arrayfields[
'recurring'][
'checked'])) {
929 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>';
931 $totalarray[
'nbfield']++;
934 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
935 print
'<td class="center">';
936 print($objp->frequency > 0 ? $objp->frequency :
'');
939 $totalarray[
'nbfield']++;
942 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
943 print
'<td class="center">';
944 if ($objp->frequency > 1) {
945 $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"));
947 $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"));
949 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
952 $totalarray[
'nbfield']++;
955 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
956 print
'<td class="center">';
957 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
960 $totalarray[
'nbfield']++;
964 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
965 print
'<td class="center">';
966 print($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
969 $totalarray[
'nbfield']++;
973 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
974 print
'<td class="center">';
975 print
'<div class="nowraponall">';
976 print($objp->frequency ? ($supplierinvoicerectmp->isMaxNbGenReached() ?
'<strike>' :
'').
dol_print_date($db->jdate($objp->date_when),
'day').($supplierinvoicerectmp->isMaxNbGenReached() ?
'</strike>' :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
977 if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
978 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
982 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
987 $totalarray[
'nbfield']++;
990 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
991 print
'<td class="center tdoverflowmax150">';
992 if ($objp->fk_user_author > 0) {
993 $tmpuser->fetch($objp->fk_user_author);
994 print $tmpuser->getNomUrl(1);
998 $totalarray[
'nbfield']++;
1001 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1002 print
'<td class="center tdoverflowmax150">';
1003 if ($objp->fk_user_author > 0) {
1004 $tmpuser->fetch($objp->fk_user_author);
1005 print $tmpuser->getNomUrl(1);
1009 $totalarray[
'nbfield']++;
1012 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1013 print
'<td class="center nowraponall">';
1017 $totalarray[
'nbfield']++;
1020 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1021 print
'<td class="center nowraponall">';
1025 $totalarray[
'nbfield']++;
1031 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1033 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1034 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1035 print $hookmanager->resPrint;
1037 if (!empty($arrayfields[
'status'][
'checked'])) {
1038 print
'<td class="center">';
1039 print $supplierinvoicerectmp->getLibStatut(5, 0);
1042 $totalarray[
'nbfield']++;
1047 print
'<td class="nowrap center tdoverflowmax125">';
1048 if ($user->hasRight(
'facture',
'creer') && empty($supplierinvoicerectmp->suspended)) {
1049 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
1050 print $langs->trans(
"MaxNumberOfGenerationReached");
1051 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
1052 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1053 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1054 print $langs->trans(
"CreateBill").
'</a>';
1056 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1061 $totalarray[
'nbfield']++;
1072include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1077 foreach ($arrayfields as $key => $val) {
1078 if (!empty($val[
'checked'])) {
1082 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1088$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1089$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1090print $hookmanager->resPrint;
1092print
'</table>'.
"\n";
1095print
'</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.