36require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture-rec.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
56$langs->loadLangs(array(
'bills',
'compta',
'admin',
'other',
'suppliers'));
58$action =
GETPOST(
'action',
'alpha');
59$massaction =
GETPOST(
'massaction',
'alpha');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$cancel =
GETPOST(
'cancel',
'alpha');
63$toselect =
GETPOST(
'toselect',
'array');
64$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicestemplatelist';
65$optioncss =
GETPOST(
'optioncss',
'aZ');
74 $socid = $user->socid;
76$objecttype =
'facture_fourn_rec';
77if ($action ==
"create" || $action ==
"add") {
81$search_ref =
GETPOST(
'search_ref');
82$search_societe =
GETPOST(
'search_societe');
83$search_montant_ht =
GETPOST(
'search_montant_ht');
84$search_montant_vat =
GETPOST(
'search_montant_vat');
85$search_montant_ttc =
GETPOST(
'search_montant_ttc');
86$search_payment_mode =
GETPOST(
'search_payment_mode');
87$search_payment_term =
GETPOST(
'search_payment_term');
88$search_date_startday =
GETPOSTINT(
'search_date_startday');
89$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
90$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
91$search_date_endday =
GETPOSTINT(
'search_date_endday');
92$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
93$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
94$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
95$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
96$search_date_when_startday =
GETPOSTINT(
'search_date_when_startday');
97$search_date_when_startmonth =
GETPOSTINT(
'search_date_when_startmonth');
98$search_date_when_startyear =
GETPOSTINT(
'search_date_when_startyear');
99$search_date_when_endday =
GETPOSTINT(
'search_date_when_endday');
100$search_date_when_endmonth =
GETPOSTINT(
'search_date_when_endmonth');
101$search_date_when_endyear =
GETPOSTINT(
'search_date_when_endyear');
102$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
103$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
104$search_recurring =
GETPOST(
'search_recurring',
'intcomma');
105$search_frequency =
GETPOST(
'search_frequency',
'alpha');
106$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
107$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
108$search_status =
GETPOST(
'search_status',
'intcomma');
111$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
112$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
114if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
118$offset = $limit * $page;
119$pageprev = $page - 1;
120$pagenext = $page + 1;
126if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
127 $ret =
$object->fetch($id, $ref);
134$hookmanager->initHooks(array(
'supplierinvoicereclist'));
137$extrafields->fetch_name_optionals_label(
$object->table_element);
139$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
146 $sortfield =
'f.titre';
149 'f.titre' => array(
'label' =>
'Ref',
'checked' => 1),
150 's.nom' => array(
'label' =>
'ThirdParty',
'checked' => 1),
151 'f.total_ht' => array(
'label' =>
'AmountHT',
'checked' => 1),
152 'f.total_tva' => array(
'label' =>
'AmountVAT',
'checked' => 1),
153 'f.total_ttc' => array(
'label' =>
'AmountTTC',
'checked' => 1),
154 'f.fk_mode_reglement' => array(
'label' =>
'PaymentMode',
'checked' => 0),
155 'f.fk_cond_reglement' => array(
'label' =>
'PaymentTerm',
'checked' => 0),
156 'recurring' => array(
'label' =>
'RecurringInvoice',
'checked' => 1),
157 'f.frequency' => array(
'label' =>
'Frequency',
'checked' => 1),
158 'f.unit_frequency' => array(
'label' =>
'FrequencyUnit',
'checked' => 1),
159 'f.nb_gen_done' => array(
'label' =>
'NbOfGenerationDoneShort',
'checked' => 1),
160 'f.date_last_gen' => array(
'label' =>
'DateLastGenerationShort',
'checked' => 1),
161 'f.date_when' => array(
'label' =>
'NextDateToExecutionShort',
'checked' => 1),
162 'f.fk_user_author' => array(
'label' =>
'UserCreation',
'checked' => 0,
'position' => 500),
163 'f.fk_user_modif' => array(
'label' =>
'UserModification',
'checked' => 0,
'position' => 505),
164 'f.datec' => array(
'label' =>
'DateCreation',
'checked' => 0,
'position' => 520),
165 'f.tms' => array(
'label' =>
'DateModificationShort',
'checked' => 0,
'position' => 525),
166 'status' => array(
'label' =>
'Status',
'checked' => 1,
'position' => 1000),
169include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
173'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
176 $tmpthirdparty =
new Societe($db);
177 $res = $tmpthirdparty->fetch($socid);
179 $search_societe = $tmpthirdparty->name;
183$objecttype =
'facture_fourn_rec';
185$permissionnote = $user->hasRight(
'facture',
'creer');
186$permissiondellink = $user->hasRight(
'facture',
'creer');
187$permissiontoedit = $user->hasRight(
'facture',
'creer');
197if (
GETPOST(
'cancel',
'alpha')) {
201if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
205$parameters = array(
'socid' => $socid);
206$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
211if (empty($reshook)) {
217 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
220 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
222 $search_societe =
'';
223 $search_montant_ht =
'';
224 $search_montant_vat =
'';
225 $search_montant_ttc =
'';
226 $search_payment_mode =
'';
227 $search_payment_term =
'';
228 $search_date_startday =
'';
229 $search_date_startmonth =
'';
230 $search_date_startyear =
'';
231 $search_date_endday =
'';
232 $search_date_endmonth =
'';
233 $search_date_endyear =
'';
234 $search_date_start =
'';
235 $search_date_end =
'';
236 $search_date_when_startday =
'';
237 $search_date_when_startmonth =
'';
238 $search_date_when_startyear =
'';
239 $search_date_when_endday =
'';
240 $search_date_when_endmonth =
'';
241 $search_date_when_endyear =
'';
242 $search_date_when_start =
'';
243 $search_date_when_end =
'';
244 $search_recurring =
'';
245 $search_frequency =
'';
246 $search_unit_frequency =
'';
247 $search_nb_gen_done =
'';
250 $search_array_options = array();
252 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
253 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
271$form =
new Form($db);
273if (isModEnabled(
'project')) {
276$companystatic =
new Societe($db);
278$tmpuser =
new User($db);
283$title = $langs->trans(
"RepeatableSupplierInvoices");
288$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
294$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,";
295$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
296$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
297$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
299if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
300 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
301 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
305$parameters = array();
306$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
307$sql .= $hookmanager->resPrint;
308$sql = preg_replace(
'/,\s*$/',
'', $sql);
312$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn_rec as f';
313$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_rec_extrafields as ef ON ef.fk_object = f.rowid';
314if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
315 $sql .=
', '.MAIN_DB_PREFIX.
'societe_commerciaux as sc';
318$parameters = array();
319$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
320$sql .= $hookmanager->resPrint;
322$sql .=
" WHERE f.fk_soc = s.rowid";
323$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
324if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
325 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
331 $sql .=
' AND s.rowid = '.(int) $socid;
333if ($search_societe) {
336if ($search_montant_ht !=
'') {
339if ($search_montant_vat !=
'') {
342if ($search_montant_ttc !=
'') {
345if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
346 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
348if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
349 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
351if ($search_recurring ==
'1') {
352 $sql .=
' AND f.frequency > 0';
354if ($search_recurring ==
'0') {
355 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
357if ($search_frequency !=
'') {
360if ($search_unit_frequency !=
'') {
361 $sql .=
' AND f.frequency > 0';
362 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
364if ($search_nb_gen_done !=
'') {
367if ($search_status !=
'' && $search_status >= -1) {
368 if ($search_status == 0) {
369 $sql .=
' AND frequency = 0 AND suspended = 0';
371 if ($search_status == 1) {
372 $sql .=
' AND frequency != 0 AND suspended = 0';
374 if ($search_status == -1) {
375 $sql .=
' AND suspended = 1';
378if ($search_date_start) {
379 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
381if ($search_date_end) {
382 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
384if ($search_date_when_start) {
385 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
387if ($search_date_when_end) {
388 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
391include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
394$nbtotalofrecords =
'';
397 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
398 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
399 $resql = $db->query($sqlforcount);
401 $objforcount = $db->fetch_object($resql);
402 $nbtotalofrecords = $objforcount->nbtotalofrecords;
407 if (($page * $limit) > $nbtotalofrecords) {
414$tmpsortfield = $sortfield;
415if ($tmpsortfield ==
'recurring') {
416 $tmpsortfield =
'f.frequency';
420$sql .= $db->order($tmpsortfield, $sortorder);
422 $sql .= $db->plimit($limit + 1, $offset);
425$resql = $db->query($sql);
431$num = $db->num_rows($resql);
436llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-fourn-facture page-list-rec');
438$arrayofselected = is_array($toselect) ? $toselect : array();
442 $param .=
'&mode='.urlencode($mode);
444if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
445 $param .=
'&contextpage='.urlencode($contextpage);
447if ($limit > 0 && $limit !=
$conf->liste_limit) {
448 $param .=
'&limit='.((int) $limit);
451 $param .=
'&socid='.urlencode((
string) ($socid));
453if ($search_date_startday) {
454 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
456if ($search_date_startmonth) {
457 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
459if ($search_date_startyear) {
460 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
462if ($search_date_endday) {
463 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
465if ($search_date_endmonth) {
466 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
468if ($search_date_endyear) {
469 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
471if ($search_date_when_startday) {
472 $param .=
'&search_date_when_startday='.urlencode((
string) ($search_date_when_startday));
474if ($search_date_when_startmonth) {
475 $param .=
'&search_date_when_startmonth='.urlencode((
string) ($search_date_when_startmonth));
477if ($search_date_when_startyear) {
478 $param .=
'&search_date_when_startyear='.urlencode((
string) ($search_date_when_startyear));
480if ($search_date_when_endday) {
481 $param .=
'&search_date_when_endday='.urlencode((
string) ($search_date_when_endday));
483if ($search_date_when_endmonth) {
484 $param .=
'&search_date_when_endmonth='.urlencode((
string) ($search_date_when_endmonth));
486if ($search_date_when_endyear) {
487 $param .=
'&search_date_when_endyear='.urlencode((
string) ($search_date_when_endyear));
490 $param .=
'&search_ref='.urlencode($search_ref);
492if ($search_societe) {
493 $param .=
'&search_societe='.urlencode($search_societe);
495if ($search_montant_ht !=
'') {
496 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
498if ($search_montant_vat !=
'') {
499 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
501if ($search_montant_ttc !=
'') {
502 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
504if ($search_payment_mode !=
'') {
505 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
507if ($search_payment_term !=
'') {
508 $param .=
'&search_payment_term='.urlencode($search_payment_term);
510if ($search_recurring !=
'' && $search_recurring !=
'-1') {
511 $param .=
'&search_recurring='.urlencode($search_recurring);
513if ($search_frequency > 0) {
514 $param .=
'&search_frequency='.urlencode($search_frequency);
516if ($search_unit_frequency !=
'') {
517 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
519if ($search_nb_gen_done !=
'') {
520 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
522if ($search_status !=
'') {
523 $param .=
'&search_status='.urlencode($search_status);
525if ($optioncss !=
'') {
526 $param .=
'&optioncss='.urlencode($optioncss);
529include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
531$parameters = array(
'param' => &$param);
532$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
533$param .= $hookmanager->resPrint;
536$arrayofmassactions = array(
543$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend' => $langs->trans(
"SendByMail"),
'builddoc' => $langs->trans(
"PDFMerge")));
545$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
546$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
547$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
550print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
551if ($optioncss !=
'') {
552 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
554print
'<input type="hidden" name="token" value="'.newToken().
'">';
555print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
556print
'<input type="hidden" name="action" value="list">';
557print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
558print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
559print
'<input type="hidden" name="page" value="'.$page.
'">';
560print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
561print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
562print
'<input type="hidden" name="page_y" value="">';
563print
'<input type="hidden" name="mode" value="'.$mode.
'">';
566print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
568print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateAPredefinedSupplierInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</span><br><br>';
574$parameters = array();
575$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
576if (empty($reshook)) {
577 $moreforfilter .= $hookmanager->resPrint;
579 $moreforfilter = $hookmanager->resPrint;
582if (!empty($moreforfilter)) {
583 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
584 print $moreforfilter;
588$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
589$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
590$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
592print
'<div class="div-table-responsive">';
593print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
597print
'<tr class="liste_titre_filter">';
600 print
'<td class="liste_titre maxwidthsearch center">';
601 $searchpicto = $form->showFilterButtons(
'left');
606if (!empty($arrayfields[
'f.titre'][
'checked'])) {
607 print
'<td class="liste_titre left">';
608 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
612if (!empty($arrayfields[
's.nom'][
'checked'])) {
613 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
615if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
617 print
'<td class="liste_titre right">';
618 print
'<input class="flat width50" type="text" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
621if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
623 print
'<td class="liste_titre right">';
624 print
'<input class="flat width50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
627if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
629 print
'<td class="liste_titre right">';
630 print
'<input class="flat width50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
633if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
635 print
'<td class="liste_titre">';
636 print $form->getSelectConditionsPaiements($search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
639if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
641 print
'<td class="liste_titre">';
642 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
645if (!empty($arrayfields[
'recurring'][
'checked'])) {
647 print
'<td class="liste_titre center">';
648 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
651if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
653 print
'<td class="liste_titre center">';
654 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
657if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
659 print
'<td class="liste_titre center">';
660 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
663if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
665 print
'<td class="liste_titre" align="center">';
666 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
670if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
671 print
'<td class="liste_titre center">';
672 print
'<div class="nowrapfordate">';
673 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
675 print
'<div class="nowrapfordate">';
676 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
681if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
682 print
'<td class="liste_titre center">';
683 print
'<div class="nowrapfordate">';
684 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'));
686 print
'<div class="nowrapfordate">';
687 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'));
692include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
695$parameters = array(
'arrayfields' => $arrayfields);
696$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
697print $hookmanager->resPrint;
699if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
700 print
'<td class="liste_titre">';
704if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
705 print
'<td class="liste_titre">';
709if (!empty($arrayfields[
'f.datec'][
'checked'])) {
710 print
'<td class="liste_titre">';
714if (!empty($arrayfields[
'f.tms'][
'checked'])) {
715 print
'<td class="liste_titre">';
719if (!empty($arrayfields[
'status'][
'checked'])) {
720 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
722 0 => $langs->trans(
"Draft"),
723 1 => $langs->trans(
"Active"),
724 -1 => $langs->trans(
"Disabled"),
727 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
732 print
'<td class="liste_titre maxwidthsearch center">';
733 $searchpicto = $form->showFilterButtons();
739$totalarray = array();
740$totalarray[
'nbfield'] = 0;
744print
'<tr class="liste_titre">';
747 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
748 $totalarray[
'nbfield']++;
750if (!empty($arrayfields[
'f.titre'][
'checked'])) {
752 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
753 $totalarray[
'nbfield']++;
755if (!empty($arrayfields[
's.nom'][
'checked'])) {
756 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
757 $totalarray[
'nbfield']++;
759if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
760 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
761 $totalarray[
'nbfield']++;
763if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
764 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
765 $totalarray[
'nbfield']++;
767if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
768 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
769 $totalarray[
'nbfield']++;
771if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
772 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
773 $totalarray[
'nbfield']++;
775if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
776 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
777 $totalarray[
'nbfield']++;
779if (!empty($arrayfields[
'recurring'][
'checked'])) {
780 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
781 $totalarray[
'nbfield']++;
783if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
784 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
785 $totalarray[
'nbfield']++;
787if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
788 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
789 $totalarray[
'nbfield']++;
791if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
792 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
793 $totalarray[
'nbfield']++;
795if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
796 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
797 $totalarray[
'nbfield']++;
799if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
801 $totalarray[
'nbfield']++;
803if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
805 $totalarray[
'nbfield']++;
807if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
808 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
809 $totalarray[
'nbfield']++;
811if (!empty($arrayfields[
'f.datec'][
'checked'])) {
812 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
813 $totalarray[
'nbfield']++;
815if (!empty($arrayfields[
'f.tms'][
'checked'])) {
816 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
817 $totalarray[
'nbfield']++;
820include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
821if (!empty($arrayfields[
'status'][
'checked'])) {
822 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
823 $totalarray[
'nbfield']++;
827 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
828 $totalarray[
'nbfield']++;
833$savnbfield = $totalarray[
'nbfield'];
834$totalarray = array();
835$totalarray[
'nbfield'] = 0;
836$totalarray[
'val'][
'f.total_ht'] = 0;
837$totalarray[
'val'][
'f.total_tva'] = 0;
838$totalarray[
'val'][
'f.total_ttc'] = 0;
839$imaxinloop = ($limit ? min($num, $limit) : $num);
841while ($i < $imaxinloop) {
842 $objp = $db->fetch_object($resql);
847 $companystatic->id = $objp->socid;
848 $companystatic->name = $objp->name;
850 $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
851 $supplierinvoicerectmp->frequency = $objp->frequency;
852 $supplierinvoicerectmp->suspended = $objp->suspended;
853 $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
854 $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
855 $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
856 $supplierinvoicerectmp->ref = $objp->title;
857 $supplierinvoicerectmp->total_ht = $objp->total_ht;
858 $supplierinvoicerectmp->total_tva = $objp->total_tva;
859 $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
863 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
866 print
'<td class="center tdoverflowmax125">';
867 if ($user->hasRight(
'facture',
'creer') && empty($supplierinvoicerectmp->suspended)) {
868 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
869 print $langs->trans(
"MaxNumberOfGenerationReached");
870 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
871 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
872 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
876 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
881 $totalarray[
'nbfield']++;
885 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
886 print
'<td class="nowrap tdoverflowmax200">';
887 print $supplierinvoicerectmp->getNomUrl(1);
890 $totalarray[
'nbfield']++;
893 if (!empty($arrayfields[
's.nom'][
'checked'])) {
894 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
896 $totalarray[
'nbfield']++;
899 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
900 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
902 $totalarray[
'nbfield']++;
905 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
907 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
909 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
910 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
912 $totalarray[
'nbfield']++;
915 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
917 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
919 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
920 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
922 $totalarray[
'nbfield']++;
925 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
927 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
930 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
931 print
'<td class="tdoverflowmax150">';
932 $form->form_conditions_reglement(
'', $objp->fk_cond_reglement,
'none');
935 $totalarray[
'nbfield']++;
939 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
940 print
'<td class="tdoverflowmax150">';
941 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
944 $totalarray[
'nbfield']++;
948 if (!empty($arrayfields[
'recurring'][
'checked'])) {
949 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>';
951 $totalarray[
'nbfield']++;
954 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
955 print
'<td class="center">';
956 print($objp->frequency > 0 ? $objp->frequency :
'');
959 $totalarray[
'nbfield']++;
962 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
963 print
'<td class="center">';
964 if ($objp->frequency > 1) {
965 $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"));
967 $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"));
969 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
972 $totalarray[
'nbfield']++;
975 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
976 print
'<td class="center">';
977 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
980 $totalarray[
'nbfield']++;
984 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
985 print
'<td class="center">';
986 print($objp->frequency > 0 ?
dol_print_date($db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
989 $totalarray[
'nbfield']++;
993 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
994 print
'<td class="center">';
995 print
'<div class="nowraponall">';
996 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>');
997 if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
998 if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
1002 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1007 $totalarray[
'nbfield']++;
1010 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
1011 print
'<td class="center tdoverflowmax150">';
1012 if ($objp->fk_user_author > 0) {
1013 $tmpuser->fetch($objp->fk_user_author);
1014 print $tmpuser->getNomUrl(1);
1018 $totalarray[
'nbfield']++;
1021 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1022 print
'<td class="center tdoverflowmax150">';
1023 if ($objp->fk_user_author > 0) {
1024 $tmpuser->fetch($objp->fk_user_author);
1025 print $tmpuser->getNomUrl(1);
1029 $totalarray[
'nbfield']++;
1032 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1033 print
'<td class="center nowraponall">';
1037 $totalarray[
'nbfield']++;
1040 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1041 print
'<td class="center nowraponall">';
1045 $totalarray[
'nbfield']++;
1051 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1053 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1054 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1055 print $hookmanager->resPrint;
1057 if (!empty($arrayfields[
'status'][
'checked'])) {
1058 print
'<td class="center">';
1059 print $supplierinvoicerectmp->getLibStatut(5, 0);
1062 $totalarray[
'nbfield']++;
1067 print
'<td class="nowrap center tdoverflowmax125">';
1068 if ($user->hasRight(
'facture',
'creer') && empty($supplierinvoicerectmp->suspended)) {
1069 if ($supplierinvoicerectmp->isMaxNbGenReached()) {
1070 print $langs->trans(
"MaxNumberOfGenerationReached");
1071 } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
1072 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1073 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1077 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1082 $totalarray[
'nbfield']++;
1093include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1098 foreach ($arrayfields as $key => $val) {
1099 if (!empty($val[
'checked'])) {
1103 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1109$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1110$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1111print $hookmanager->resPrint;
1113print
'</table>'.
"\n";
1116print
'</form>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoice templates.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_info($titlealt='default')
Show info logo.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.