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') :
'invoicetemplatelist';
54$optioncss =
GETPOST(
'optioncss',
'alpha');
56$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_status =
GETPOST(
'search_status',
'int');
98$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
99$sortfield =
GETPOST(
'sortfield',
'alpha');
100$sortorder =
GETPOST(
'sortorder',
'alpha');
101$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
'page',
'int');
102if (empty($page) || $page == -1) {
105$offset = $limit * $page;
110 $sortfield =
'f.titre';
112$pageprev = $page - 1;
113$pagenext = $page + 1;
116if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
117 $ret = $object->fetch($id, $ref);
124$hookmanager->initHooks(array(
'supplierinvoicereclist'));
128$extrafields->fetch_name_optionals_label($object->table_element);
130$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
132$permissionnote = $user->hasRight(
'facture',
'creer');
133$permissiondellink = $user->hasRight(
'facture',
'creer');
134$permissiontoedit = $user->hasRight(
'facture',
'creer');
137 'f.titre'=>array(
'label'=>
'Ref',
'checked'=>1),
138 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
139 'f.total_ht'=>array(
'label'=>
'AmountHT',
'checked'=>1),
140 'f.total_tva'=>array(
'label'=>
'AmountVAT',
'checked'=>1),
141 'f.total_ttc'=>array(
'label'=>
'AmountTTC',
'checked'=>1),
142 'f.fk_mode_reglement'=>array(
'label'=>
'PaymentMode',
'checked'=>0),
143 'f.fk_cond_reglement'=>array(
'label'=>
'PaymentTerm',
'checked'=>0),
144 'recurring'=>array(
'label'=>
'RecurringInvoice',
'checked'=>1),
145 'f.frequency'=>array(
'label'=>
'Frequency',
'checked'=>1),
146 'f.unit_frequency'=>array(
'label'=>
'FrequencyUnit',
'checked'=>1),
147 'f.nb_gen_done'=>array(
'label'=>
'NbOfGenerationDoneShort',
'checked'=>1),
148 'f.date_last_gen'=>array(
'label'=>
'DateLastGenerationShort',
'checked'=>1),
149 'f.date_when'=>array(
'label'=>
'NextDateToExecutionShort',
'checked'=>1),
150 'f.fk_user_author'=>array(
'label'=>
'UserCreation',
'checked'=>0,
'position'=>500),
151 'f.fk_user_modif'=>array(
'label'=>
'UserModification',
'checked'=>0,
'position'=>505),
152 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>520),
153 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>525),
154 'suspended '=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
157include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
163 $tmpthirdparty =
new Societe($db);
164 $res = $tmpthirdparty->fetch($socid);
166 $search_societe = $tmpthirdparty->name;
169$objecttype =
'facture_fourn_rec';
171$result =
restrictedArea($user,
'supplier_invoicerec', $object->id, $objecttype);
178if (
GETPOST(
'cancel',
'alpha')) {
182if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
186$parameters = array(
'socid' => $socid);
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
192if (empty($reshook)) {
193 if (
GETPOST(
'cancel',
'alpha')) {
198 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
201 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
203 $search_societe =
'';
204 $search_montant_ht =
'';
205 $search_montant_vat =
'';
206 $search_montant_ttc =
'';
207 $search_payment_mode =
'';
208 $search_payment_term =
'';
209 $search_date_startday =
'';
210 $search_date_startmonth =
'';
211 $search_date_startyear =
'';
212 $search_date_endday =
'';
213 $search_date_endmonth =
'';
214 $search_date_endyear =
'';
215 $search_date_start =
'';
216 $search_date_end =
'';
217 $search_date_when_startday =
'';
218 $search_date_when_startmonth =
'';
219 $search_date_when_startyear =
'';
220 $search_date_when_endday =
'';
221 $search_date_when_endmonth =
'';
222 $search_date_when_endyear =
'';
223 $search_date_when_start =
'';
224 $search_date_when_end =
'';
225 $search_recurring =
'';
226 $search_frequency =
'';
227 $search_unit_frequency =
'';
229 $search_array_options = array();
247llxHeader(
'', $langs->trans(
"RepeatableSupplierInvoices"), $help_url);
249$form =
new Form($db);
251if (isModEnabled(
'project')) {
254$companystatic =
new Societe($db);
256$tmpuser =
new User($db);
260$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
267$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,";
268$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
269$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
270$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
272if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
273 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
274 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
278$parameters = array();
279$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
280$sql .= $hookmanager->resPrint;
281$sql = preg_replace(
'/,\s*$/',
'', $sql);
283$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn_rec as f';
284$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_rec_extrafields as ef ON ef.fk_object = f.rowid';
285if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
286 $sql .=
', '.MAIN_DB_PREFIX.
'societe_commerciaux as sc';
288$sql .=
' WHERE f.fk_soc = s.rowid';
289$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
290if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
291 $sql .=
' AND s.rowid = sc.fk_soc AND sc.fk_user = '. (int) $user->id;
297 $sql .=
' AND s.rowid = '.(int) $socid;
299if ($search_societe) {
302if ($search_montant_ht !=
'') {
305if ($search_montant_vat !=
'') {
308if ($search_montant_ttc !=
'') {
311if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
312 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
314if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
315 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
317if ($search_recurring ==
'1') {
318 $sql .=
' AND f.frequency > 0';
320if ($search_recurring ==
'0') {
321 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
323if ($search_frequency !=
'') {
326if ($search_unit_frequency !=
'') {
327 $sql .=
' AND f.frequency > 0'.natural_search(
'f.unit_frequency', $search_unit_frequency);
329if ($search_status !=
'' && $search_status >= -1) {
330 if ($search_status == 0) {
331 $sql .=
' AND frequency = 0 AND suspended = 0';
333 if ($search_status == 1) {
334 $sql .=
' AND frequency != 0 AND suspended = 0';
336 if ($search_status == -1) {
337 $sql .=
' AND suspended = 1';
340if ($search_date_start) {
341 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
343if ($search_date_end) {
344 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
346if ($search_date_when_start) {
347 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
349if ($search_date_when_end) {
350 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
353$tmpsortfield = $sortfield;
354if ($tmpsortfield ==
'recurring') {
355 $tmpsortfield =
'f.frequency';
357$sql .= $db->order($tmpsortfield, $sortorder);
359$nbtotalofrecords =
'';
361 $result = $db->query($sql);
362 $nbtotalofrecords = $db->num_rows($result);
363 if (($page * $limit) > $nbtotalofrecords) {
369$sql .= $db->plimit($limit + 1, $offset);
371$resql = $db->query($sql);
373 $num = $db->num_rows($resql);
376 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
377 $param .=
'&contextpage='.urlencode($contextpage);
379 if ($limit > 0 && $limit != $conf->liste_limit) {
380 $param .=
'&limit='.((int) $limit);
383 $param .=
'&socid='.urlencode($socid);
385 if ($search_date_startday) {
386 $param .=
'&search_date_startday='.urlencode($search_date_startday);
388 if ($search_date_startmonth) {
389 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
391 if ($search_date_startyear) {
392 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
394 if ($search_date_endday) {
395 $param .=
'&search_date_endday='.urlencode($search_date_endday);
397 if ($search_date_endmonth) {
398 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
400 if ($search_date_endyear) {
401 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
403 if ($search_date_when_startday) {
404 $param .=
'&search_date_when_startday='.urlencode($search_date_when_startday);
406 if ($search_date_when_startmonth) {
407 $param .=
'&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
409 if ($search_date_when_startyear) {
410 $param .=
'&search_date_when_startyear='.urlencode($search_date_when_startyear);
412 if ($search_date_when_endday) {
413 $param .=
'&search_date_when_endday='.urlencode($search_date_when_endday);
415 if ($search_date_when_endmonth) {
416 $param .=
'&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
418 if ($search_date_when_endyear) {
419 $param .=
'&search_date_when_endyear='.urlencode($search_date_when_endyear);
422 $param .=
'&search_ref='.urlencode($search_ref);
424 if ($search_societe) {
425 $param .=
'&search_societe='.urlencode($search_societe);
427 if ($search_montant_ht !=
'') {
428 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
430 if ($search_montant_vat !=
'') {
431 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
433 if ($search_montant_ttc !=
'') {
434 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
436 if ($search_payment_mode !=
'') {
437 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
439 if ($search_payment_term !=
'') {
440 $param .=
'&search_payment_term='.urlencode($search_payment_term);
442 if ($search_recurring !=
'' && $search_recurring !=
'-1') {
443 $param .=
'&search_recurring='.urlencode($search_recurring);
445 if ($search_frequency > 0) {
446 $param .=
'&search_frequency='.urlencode($search_frequency);
448 if ($search_unit_frequency !=
'') {
449 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
451 if ($search_status !=
'') {
452 $param .=
'&search_status='.urlencode($search_status);
454 if ($optioncss !=
'') {
455 $param .=
'&optioncss='.urlencode($optioncss);
458 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
460 $massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend'=>$langs->trans(
"SendByMail"),
'builddoc'=>$langs->trans(
"PDFMerge")));
462 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
463 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
466 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
467 if ($optioncss !=
'') {
468 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
470 print
'<input type="hidden" name="token" value="'.newToken().
'">';
471 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
472 print
'<input type="hidden" name="action" value="list">';
473 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
474 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
475 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
476 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
478 $title = $langs->trans(
"RepeatableSupplierInvoices");
480 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
482 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedSupplierInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
488 print
'<div class="div-table-responsive">';
489 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
492 print
'<tr class="liste_titre_filter">';
494 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
495 print
'<td class="liste_titre left">';
496 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
500 if (!empty($arrayfields[
's.nom'][
'checked'])) {
501 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
503 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
505 print
'<td class="liste_titre right">';
506 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
509 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
511 print
'<td class="liste_titre right">';
512 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
515 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
517 print
'<td class="liste_titre right">';
518 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
521 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
523 print
'<td class="liste_titre right">';
524 print $form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
527 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
529 print
'<td class="liste_titre right">';
530 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
533 if (!empty($arrayfields[
'recurring'][
'checked'])) {
535 print
'<td class="liste_titre center">';
536 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
539 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
541 print
'<td class="liste_titre center">';
542 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
545 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
547 print
'<td class="liste_titre center">';
548 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
551 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
553 print
'<td class="liste_titre" align="center">';
557 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
558 print
'<td class="liste_titre center">';
559 print
'<div class="nowrap">';
560 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
562 print
'<div class="nowrap">';
563 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
568 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
569 print
'<td class="liste_titre center">';
570 print
'<div class="nowrap">';
571 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'));
573 print
'<div class="nowrap">';
574 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'));
579 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
582 $parameters = array(
'arrayfields'=>$arrayfields);
583 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
584 print $hookmanager->resPrint;
586 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
587 print
'<td class="liste_titre">';
591 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
592 print
'<td class="liste_titre">';
596 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
597 print
'<td class="liste_titre">';
601 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
602 print
'<td class="liste_titre">';
606 print
'<td class="liste_titre" align="middle">';
607 $searchpicto = $form->showFilterButtons();
612 print
'<tr class="liste_titre">';
613 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
614 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
616 if (!empty($arrayfields[
's.nom'][
'checked'])) {
617 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
619 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
620 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'class="right"', $sortfield, $sortorder);
622 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
623 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'class="right"', $sortfield, $sortorder);
625 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
626 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
628 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
629 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
631 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
632 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
634 if (!empty($arrayfields[
'recurring'][
'checked'])) {
635 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'class="center"', $sortfield, $sortorder);
637 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
638 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
640 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
641 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
643 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
644 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'align="center"', $sortfield, $sortorder);
646 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
647 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'align="center"', $sortfield, $sortorder);
649 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
650 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'align="center"', $sortfield, $sortorder);
652 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
653 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'align="center"', $sortfield, $sortorder);
655 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
656 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'align="center"', $sortfield, $sortorder);
658 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
659 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'align="center"', $sortfield, $sortorder);
661 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
662 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'align="center"', $sortfield, $sortorder);
665 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
666 if (!empty($arrayfields[
'status'][
'checked'])) {
667 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'align="center"', $sortfield, $sortorder);
669 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'center maxwidthsearch ');
674 $totalarray = array();
675 $totalarray[
'nbfield'] = 0;
676 $totalarray[
'val'][
'f.total_ht'] = 0;
677 $totalarray[
'val'][
'f.total_tva'] = 0;
678 $totalarray[
'val'][
'f.total_ttc'] = 0;
679 while ($i < min($num, $limit)) {
680 $objp = $db->fetch_object($resql);
685 $companystatic->id = $objp->socid;
686 $companystatic->name = $objp->name;
688 $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
689 $supplierinvoicerectmp->frequency = $objp->frequency;
690 $supplierinvoicerectmp->suspended = $objp->suspended;
691 $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
692 $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
693 $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
694 $supplierinvoicerectmp->ref = $objp->title;
695 $supplierinvoicerectmp->total_ht = $objp->total_ht;
696 $supplierinvoicerectmp->total_tva = $objp->total_tva;
697 $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
699 print
'<tr class="oddeven">';
701 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
702 print
'<td class="nowrap tdoverflowmax200">';
703 print $supplierinvoicerectmp->getNomUrl(1);
707 $totalarray[
'nbfield']++;
710 if (!empty($arrayfields[
's.nom'][
'checked'])) {
711 print
'<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
713 $totalarray[
'nbfield']++;
716 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
717 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
719 $totalarray[
'nbfield']++;
722 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
724 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
726 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
727 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
729 $totalarray[
'nbfield']++;
732 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
734 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
736 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
737 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
739 $totalarray[
'nbfield']++;
742 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
744 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
747 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
748 print
'<td class="right">';
749 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
752 $totalarray[
'nbfield']++;
756 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
757 print
'<td class="right">';
758 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
761 $totalarray[
'nbfield']++;
765 if (!empty($arrayfields[
'recurring'][
'checked'])) {
766 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>';
768 $totalarray[
'nbfield']++;
771 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
772 print
'<td class="center">'.($objp->frequency > 0 ? $objp->frequency :
'').
'</td>';
774 $totalarray[
'nbfield']++;
777 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
778 print
'<td class="center">'.($objp->frequency > 0 ? $objp->unit_frequency :
'').
'</td>';
780 $totalarray[
'nbfield']++;
783 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
784 print
'<td class="center">';
785 print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
788 $totalarray[
'nbfield']++;
792 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
793 print
'<td class="center">';
794 print ($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
797 $totalarray[
'nbfield']++;
801 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
802 print
'<td class="center">';
803 print
'<div class="nowraponall">';
804 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>');
805 if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
806 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
810 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
815 $totalarray[
'nbfield']++;
818 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
819 print
'<td class="center tdoverflowmax150">';
820 if ($objp->fk_user_author > 0) {
821 $tmpuser->fetch($objp->fk_user_author);
822 print $tmpuser->getNomUrl(1);
826 $totalarray[
'nbfield']++;
829 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
830 print
'<td class="center tdoverflowmax150">';
831 if ($objp->fk_user_author > 0) {
832 $tmpuser->fetch($objp->fk_user_author);
833 print $tmpuser->getNomUrl(1);
837 $totalarray[
'nbfield']++;
840 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
841 print
'<td class="center">';
845 $totalarray[
'nbfield']++;
848 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
849 print
'<td class="center">';
853 $totalarray[
'nbfield']++;
859 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
861 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$objp,
'i'=>$i,
'totalarray'=>&$totalarray);
862 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
863 print $hookmanager->resPrint;
865 if (!empty($arrayfields[
'status'][
'checked'])) {
866 print
'<td class="center">';
867 print $supplierinvoicerectmp->getLibStatut(3, 0);
870 $totalarray[
'nbfield']++;
874 print
'<td class="center tdoverflowmax125">';
875 if ($user->hasRight(
'facture',
'creer') && empty($supplierinvoicerectmp->suspended)) {
876 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
877 print $langs->trans(
"MaxNumberOfGenerationReached");
878 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
879 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
880 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
881 print $langs->trans(
"CreateBill").
'</a>';
883 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
889 $totalarray[
'nbfield']++;
899 foreach ($arrayfields as $key => $val) {
900 if (!empty($val[
'checked'])) {
904 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
908 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
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 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.
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.
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.