';
- // Ref
- if (!empty($arrayfields['f.titre']['checked'])) {
- print '| ';
- print '';
- print ' | ';
- }
- // Thirdparty
- if (!empty($arrayfields['s.nom']['checked'])) {
- print ' | ';
- }
- if (!empty($arrayfields['f.total_ht']['checked'])) {
- // Amount net
- print '';
- print '';
- print ' | ';
- }
- if (!empty($arrayfields['f.total_tva']['checked'])) {
- // Amount Vat
- print '';
- print '';
- print ' | ';
- }
- if (!empty($arrayfields['f.total_ttc']['checked'])) {
- // Amount
- print '';
- print '';
- print ' | ';
- }
- if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
- // Payment term
- print '';
- print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
- print " | ";
- }
- if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
- // Payment mode
- print '';
- print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1);
- print ' | ';
- }
- if (!empty($arrayfields['recurring']['checked'])) {
- // Recurring or not
- print '';
- print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1);
- print ' | ';
- }
- if (!empty($arrayfields['f.frequency']['checked'])) {
- // Recurring or not
- print '';
- print '';
- print ' | ';
- }
- if (!empty($arrayfields['f.unit_frequency']['checked'])) {
- // Frequency unit
- print '';
- print '';
- print ' | ';
- }
- if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
- // Nb generation
- print '';
- print ' | ';
- }
- // Date invoice
- if (!empty($arrayfields['f.date_last_gen']['checked'])) {
- print '';
- print ' ';
- print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
- print ' ';
- print '';
- print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
- print ' ';
- print ' | ';
- }
- // Date next generation
- if (!empty($arrayfields['f.date_when']['checked'])) {
- print '';
- print ' ';
- 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'));
- print ' ';
- print '';
- 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'));
- print ' ';
- print ' | ';
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
+print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields);
- $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // User creation
- if (!empty($arrayfields['f.fk_user_author']['checked'])) {
- print '';
- print ' | ';
- }
- // User modification
- if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
- print '';
- print ' | ';
- }
- // Date creation
- if (!empty($arrayfields['f.datec']['checked'])) {
- print '';
- print ' | ';
- }
- // Date modification
- if (!empty($arrayfields['f.tms']['checked'])) {
- print '';
- print ' | ';
- }
- // Action column
- print '';
+print ''.$langs->trans("ToCreateAPredefinedSupplierInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'
';
+
+$i = 0;
+
+$moreforfilter = '';
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+if (empty($reshook)) {
+ $moreforfilter .= $hookmanager->resPrint;
+} else {
+ $moreforfilter = $hookmanager->resPrint;
+}
+
+if (!empty($moreforfilter)) {
+ print '';
+ print $moreforfilter;
+ print ' ';
+}
+
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
+$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
+
+print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+print ' '."\n";
+
+// Fields title search
+// --------------------------------------------------------------------
+print '';
+// Action column
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '| ';
+ $searchpicto = $form->showFilterButtons('left');
+ print $searchpicto;
+ print ' | ';
+}
+// Ref
+if (!empty($arrayfields['f.titre']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+}
+// Thirdparty
+if (!empty($arrayfields['s.nom']['checked'])) {
+ print ' | ';
+}
+if (!empty($arrayfields['f.total_ht']['checked'])) {
+ // Amount net
+ print '';
+ print '';
+ print ' | ';
+}
+if (!empty($arrayfields['f.total_tva']['checked'])) {
+ // Amount Vat
+ print '';
+ print '';
+ print ' | ';
+}
+if (!empty($arrayfields['f.total_ttc']['checked'])) {
+ // Amount
+ print '';
+ print '';
+ print ' | ';
+}
+if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
+ // Payment term
+ print '';
+ print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
+ print " | ";
+}
+if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
+ // Payment mode
+ print '';
+ print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1);
+ print ' | ';
+}
+if (!empty($arrayfields['recurring']['checked'])) {
+ // Recurring or not
+ print '';
+ print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1);
+ print ' | ';
+}
+if (!empty($arrayfields['f.frequency']['checked'])) {
+ // Recurring or not
+ print '';
+ print '';
+ print ' | ';
+}
+if (!empty($arrayfields['f.unit_frequency']['checked'])) {
+ // Frequency unit
+ print '';
+ print '';
+ print ' | ';
+}
+if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
+ // Nb generation
+ print '';
+ print '';
+ print ' | ';
+}
+// Date invoice
+if (!empty($arrayfields['f.date_last_gen']['checked'])) {
+ print '';
+ print ' ';
+ print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print ' ';
+ print '';
+ print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print ' ';
+ print ' | ';
+}
+// Date next generation
+if (!empty($arrayfields['f.date_when']['checked'])) {
+ print '';
+ print ' ';
+ 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'));
+ print ' ';
+ print '';
+ 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'));
+ print ' ';
+ print ' | ';
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
+
+// Fields from hook
+$parameters = array('arrayfields'=>$arrayfields);
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+// User creation
+if (!empty($arrayfields['f.fk_user_author']['checked'])) {
+ print '';
+ print ' | ';
+}
+// User modification
+if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
+ print '';
+ print ' | ';
+}
+// Date creation
+if (!empty($arrayfields['f.datec']['checked'])) {
+ print '';
+ print ' | ';
+}
+// Date modification
+if (!empty($arrayfields['f.tms']['checked'])) {
+ print '';
+ print ' | ';
+}
+// Status
+if (!empty($arrayfields['status']['checked'])) {
+ print '';
+ $liststatus = array(
+ 0=>$langs->trans("Draft"),
+ 1=>$langs->trans("Active"),
+ -1=>$langs->trans("Disabled"),
+ );
+ print $form->selectarray('search_status', $liststatus, $search_status, -2, 0, 0, '', 0, 0, 0, '', 'width100 onrightofpage');
+ print ' | ';
+}
+// Action column
+if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' | ';
- print " \n";
+}
+print ''."\n";
+
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+
+// Fields title label
+// --------------------------------------------------------------------
+print '';
+// Action column
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.titre']['checked'])) {
+ print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['s.nom']['checked'])) {
+ print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.total_ht']['checked'])) {
+ print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.total_tva']['checked'])) {
+ print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.total_ttc']['checked'])) {
+ print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['recurring']['checked'])) {
+ print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.frequency']['checked'])) {
+ print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.unit_frequency']['checked'])) {
+ print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
+ print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.date_last_gen']['checked'])) {
+ print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.date_when']['checked'])) {
+ print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.fk_user_author']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.datec']['checked'])) {
+ print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['f.tms']['checked'])) {
+ print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
+if (!empty($arrayfields['status']['checked'])) {
+ print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+// Action column
+if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+ $totalarray['nbfield']++;
+}
+print ' '."\n";
+
+$i = 0;
+$savnbfield = $totalarray['nbfield'];
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+$totalarray['val']['f.total_ht'] = 0;
+$totalarray['val']['f.total_tva'] = 0;
+$totalarray['val']['f.total_ttc'] = 0;
+$imaxinloop = ($limit ? min($num, $limit) : $num);
+
+while ($i < $imaxinloop) {
+ $objp = $db->fetch_object($resql);
+ if (empty($objp)) {
+ break;
+ }
+
+ $companystatic->id = $objp->socid;
+ $companystatic->name = $objp->name;
+
+ $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
+ $supplierinvoicerectmp->frequency = $objp->frequency;
+ $supplierinvoicerectmp->suspended = $objp->suspended;
+ $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
+ $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
+ $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
+ $supplierinvoicerectmp->ref = $objp->title;
+ $supplierinvoicerectmp->total_ht = $objp->total_ht;
+ $supplierinvoicerectmp->total_tva = $objp->total_tva;
+ $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
+
+ // Show here line of result
+ $j = 0;
+ print '';
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '| ';
+ if ($user->hasRight('facture', 'creer') && empty($supplierinvoicerectmp->suspended)) {
+ if ($supplierinvoicerectmp->isMaxNbGenReached()) {
+ print $langs->trans("MaxNumberOfGenerationReached");
+ } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
+ print '';
+ print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"');
+ print $langs->trans("CreateBill").'';
+ } else {
+ print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));
+ }
+ }
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
- print ' ';
if (!empty($arrayfields['f.titre']['checked'])) {
- print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
+ print '| ';
+ print $supplierinvoicerectmp->getNomUrl(1);
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['s.nom']['checked'])) {
- print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
+ print ''.$companystatic->getNomUrl(1, 'supplier').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.total_ht']['checked'])) {
- print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
+ print ''.price($objp->total_ht).' | '."\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
+ }
+ $totalarray['val']['f.total_ht'] += $objp->total_ht;
}
if (!empty($arrayfields['f.total_tva']['checked'])) {
- print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, 'class="right"', $sortfield, $sortorder);
+ print ''.price($objp->total_tva).' | '."\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva';
+ }
+ $totalarray['val']['f.total_tva'] += $objp->total_tva;
}
if (!empty($arrayfields['f.total_ttc']['checked'])) {
- print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
+ print ''.price($objp->total_ttc).' | '."\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
+ }
+ $totalarray['val']['f.total_ttc'] += $objp->total_ttc;
}
+ // Payment term
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
- print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
+ print '';
+ $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
+ print ' | '."\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+ // Payment mode
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
- print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
+ print '';
+ $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
+ print ' | '."\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+ // Is it a recurring invoice
if (!empty($arrayfields['recurring']['checked'])) {
- print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder);
+ print ''.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.frequency']['checked'])) {
- print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print ($objp->frequency > 0 ? $objp->frequency : '');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.unit_frequency']['checked'])) {
- print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ if ($objp->frequency > 1) {
+ $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"));
+ } else {
+ $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"));
+ }
+ print ($objp->frequency > 0 ? $dur[$objp->unit_frequency] : '');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
- print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : ''.$langs->trans('NA').'');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+ // Date last generation
if (!empty($arrayfields['f.date_last_gen']['checked'])) {
- print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').'');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+ // Date next generation
if (!empty($arrayfields['f.date_when']['checked'])) {
- print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print ' ';
+ print ($objp->frequency ? ($supplierinvoicerectmp->isMaxNbGenReached() ? '' : '').dol_print_date($db->jdate($objp->date_when), 'day').($supplierinvoicerectmp->isMaxNbGenReached() ? '' : '') : ''.$langs->trans('NA').'');
+ if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
+ if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
+ print img_warning($langs->trans("Late"));
+ }
+ } else {
+ print img_info($langs->trans("MaxNumberOfGenerationReached"));
+ }
+ print ' ';
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.fk_user_author']['checked'])) {
- print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ if ($objp->fk_user_author > 0) {
+ $tmpuser->fetch($objp->fk_user_author);
+ print $tmpuser->getNomUrl(1);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
- print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ if ($objp->fk_user_author > 0) {
+ $tmpuser->fetch($objp->fk_user_author);
+ print $tmpuser->getNomUrl(1);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.datec']['checked'])) {
- print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print dol_print_date($db->jdate($objp->datec), 'dayhour');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['f.tms']['checked'])) {
- print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print dol_print_date($db->jdate($objp->tms), 'dayhour');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+
+ $obj = $objp;
// Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Status
if (!empty($arrayfields['status']['checked'])) {
- print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
+ print '';
+ print $supplierinvoicerectmp->getLibStatut(5, 0);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'center maxwidthsearch ');
- print " \n";
-
- if ($num > 0) {
- $i = 0;
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- $totalarray['val']['f.total_ht'] = 0;
- $totalarray['val']['f.total_tva'] = 0;
- $totalarray['val']['f.total_ttc'] = 0;
- while ($i < min($num, $limit)) {
- $objp = $db->fetch_object($resql);
- if (empty($objp)) {
- break;
- }
-
- $companystatic->id = $objp->socid;
- $companystatic->name = $objp->name;
-
- $supplierinvoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
- $supplierinvoicerectmp->frequency = $objp->frequency;
- $supplierinvoicerectmp->suspended = $objp->suspended;
- $supplierinvoicerectmp->unit_frequency = $objp->unit_frequency;
- $supplierinvoicerectmp->nb_gen_max = $objp->nb_gen_max;
- $supplierinvoicerectmp->nb_gen_done = $objp->nb_gen_done;
- $supplierinvoicerectmp->ref = $objp->title;
- $supplierinvoicerectmp->total_ht = $objp->total_ht;
- $supplierinvoicerectmp->total_tva = $objp->total_tva;
- $supplierinvoicerectmp->total_ttc = $objp->total_ttc;
-
- print '';
-
- if (!empty($arrayfields['f.titre']['checked'])) {
- print '| ';
- print $supplierinvoicerectmp->getNomUrl(1);
- print "";
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['s.nom']['checked'])) {
- print ''.$companystatic->getNomUrl(1, 'supplier').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.total_ht']['checked'])) {
- print ''.price($objp->total_ht).' | '."\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
- }
- $totalarray['val']['f.total_ht'] += $objp->total_ht;
- }
- if (!empty($arrayfields['f.total_tva']['checked'])) {
- print ''.price($objp->total_tva).' | '."\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva';
- }
- $totalarray['val']['f.total_tva'] += $objp->total_tva;
- }
- if (!empty($arrayfields['f.total_ttc']['checked'])) {
- print ''.price($objp->total_ttc).' | '."\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
- }
- $totalarray['val']['f.total_ttc'] += $objp->total_ttc;
- }
- // Payment term
- if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
- print '';
- $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
- print ' | '."\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Payment mode
- if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
- print '';
- $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
- print ' | '."\n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Is it a recurring invoice
- if (!empty($arrayfields['recurring']['checked'])) {
- print ''.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.frequency']['checked'])) {
- print '';
- print ($objp->frequency > 0 ? $objp->frequency : '');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.unit_frequency']['checked'])) {
- print '';
- if ($objp->frequency > 1) {
- $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"));
- } else {
- $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"));
- }
- print ($objp->frequency > 0 ? $dur[$objp->unit_frequency] : '');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
- print '';
- print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : ''.$langs->trans('NA').'');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date last generation
- if (!empty($arrayfields['f.date_last_gen']['checked'])) {
- print '';
- print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').'');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date next generation
- if (!empty($arrayfields['f.date_when']['checked'])) {
- print '';
- print ' ';
- print ($objp->frequency ? ($supplierinvoicerectmp->isMaxNbGenReached() ? '' : '').dol_print_date($db->jdate($objp->date_when), 'day').($supplierinvoicerectmp->isMaxNbGenReached() ? '' : '') : ''.$langs->trans('NA').'');
- if (!$supplierinvoicerectmp->isMaxNbGenReached()) {
- if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) {
- print img_warning($langs->trans("Late"));
- }
- } else {
- print img_info($langs->trans("MaxNumberOfGenerationReached"));
- }
- print ' ';
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.fk_user_author']['checked'])) {
- print '';
- if ($objp->fk_user_author > 0) {
- $tmpuser->fetch($objp->fk_user_author);
- print $tmpuser->getNomUrl(1);
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
- print '';
- if ($objp->fk_user_author > 0) {
- $tmpuser->fetch($objp->fk_user_author);
- print $tmpuser->getNomUrl(1);
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($objp->datec), 'dayhour');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['f.tms']['checked'])) {
- print '';
- print dol_print_date($db->jdate($objp->tms), 'dayhour');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- $obj = $objp;
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Status
- if (!empty($arrayfields['status']['checked'])) {
- print '';
- print $supplierinvoicerectmp->getLibStatut(3, 0);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Action column
- print '';
- if ($user->hasRight('facture', 'creer') && empty($supplierinvoicerectmp->suspended)) {
- if ($supplierinvoicerectmp->isMaxNbGenReached()) {
- print $langs->trans("MaxNumberOfGenerationReached");
- } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
- print '';
- print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"');
- print $langs->trans("CreateBill").'';
- } else {
- print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));
- }
+ // Action column
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print ' | ';
+ if ($user->hasRight('facture', 'creer') && empty($supplierinvoicerectmp->suspended)) {
+ if ($supplierinvoicerectmp->isMaxNbGenReached()) {
+ print $langs->trans("MaxNumberOfGenerationReached");
+ } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
+ print '';
+ print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"');
+ print $langs->trans("CreateBill").'';
} else {
- print " ";
- }
- if (!$i) {
- $totalarray['nbfield']++;
- }
- print " | ";
-
- print " \n";
-
- $i++;
- }
- } else {
- $colspan = 1;
- foreach ($arrayfields as $key => $val) {
- if (!empty($val['checked'])) {
- $colspan++;
+ print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));
}
}
- print '| '.$langs->trans("NoRecordFound").' | ';
+ print '';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- // Show total line
- include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+ print ''."\n";
-
- print " ";
- print " ";
- print "";
-
- $db->free($resql);
-} else {
- dol_print_error($db);
+ $i++;
}
+
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
+// If no record found
+if ($num == 0) {
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) {
+ if (!empty($val['checked'])) {
+ $colspan++;
+ }
+ }
+ print ' |