' . "\n";
+
+ // Fields title search
+ // --------------------------------------------------------------------
+ print '';
+
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '| ';
+ $searchpicto = $form->showFilterButtons('left');
+ print $searchpicto;
+ print ' | ';
+ }
+
+ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
+ print '';
+ print ' | ';
+ }
+ // Ref
+ if (!empty($arrayfields['f.ref']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Ref customer
+ if (!empty($arrayfields['f.ref_client']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Type
+ if (!empty($arrayfields['f.type']['checked'])) {
+ print '';
+ $listtype = array(
+ Facture::TYPE_STANDARD => $langs->trans("InvoiceStandard"),
+ Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"),
+ Facture::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"),
+ Facture::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"),
+ );
+ if (getDolGlobalString('INVOICE_USE_SITUATION')) {
+ $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
+ }
+ //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
+ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
+ print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth75');
+ print ' | ';
+ }
+ // Invoice Subtype
+ if (!empty($arrayfields['f.subtype']['checked'])) {
+ print '';
+ print $form->selectarray('search_subtype', $subtypearray, $search_subtype, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
+ print ' | ';
+ }
+ // Date invoice
+ if (!empty($arrayfields['f.datef']['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 valid
+ if (!empty($arrayfields['f.date_valid']['checked'])) {
+ print '';
+ print ' ';
+ print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1, 'search_date_valid_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print ' ';
+ print '';
+ print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1, 'search_date_valid_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print ' ';
+ print ' | ';
+ }
+ // Date due
+ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
+ print '';
+ print ' ';
+ print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print ' ';
+ print '';
+ print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print ' ';
+ print ' | ';
+ }
+ // Project ref
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print ' | ';
+ }
+ // Project label
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print ' | ';
+ }
+ // Thirdparty
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print ' 0 ? " disabled" : "") . '> | ';
+ }
+ // Alias
+ if (!empty($arrayfields['s.name_alias']['checked'])) {
+ print ' | ';
+ }
+ // Parent company
+ if (!empty($arrayfields['s2.nom']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Customer Code
+ if (!empty($arrayfields['s.code_client']['checked'])) {
+ print ' | ';
+ }
+ // Town
+ if (!empty($arrayfields['s.town']['checked'])) {
+ print ' | ';
+ }
+ // Zip
+ if (!empty($arrayfields['s.zip']['checked'])) {
+ print ' | ';
+ }
+ // State
+ if (!empty($arrayfields['state.nom']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Country
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
+ print '';
+ print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, array(), 1);
+ print ' | ';
+ }
+ // Company type
+ if (!empty($arrayfields['typent.code']['checked'])) {
+ print '';
+ print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100', 1);
+ print ' | ';
+ }
+ // Payment mode
+ if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
+ print '';
+ print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 0, 1, 'minwidth100 maxwidth100', 1);
+ print ' | ';
+ }
+ // Payment terms
+ if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
+ print '';
+ print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1, 'minwidth100 maxwidth100');
+ print ' | ';
+ }
+ // Module source
+ if (!empty($arrayfields['f.module_source']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // POS Terminal
+ if (!empty($arrayfields['f.pos_source']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.total_ht']['checked'])) {
+ // Amount without tax
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.total_tva']['checked'])) {
+ // Amount vat
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.total_localtax1']['checked'])) {
+ // Localtax1
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.total_localtax2']['checked'])) {
+ // Localtax2
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.total_ttc']['checked'])) {
+ // Amount inc tax
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['u.login']['checked'])) {
+ // Author
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['sale_representative']['checked'])) {
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.retained_warranty']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['dynamount_payed']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['rtp']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
+ // Currency
+ print '';
+ print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
+ // Currency rate
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
+ // Amount
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
+ // Amount
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
+ // Amount
+ print '';
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['multicurrency_rtp']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['total_pa']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['total_margin']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['total_margin_rate']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['total_mark_rate']['checked'])) {
+ 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, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Date creation
+ if (!empty($arrayfields['f.datec']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ // Date modification
+ if (!empty($arrayfields['f.tms']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ // Date closing
+ if (!empty($arrayfields['f.date_closing']['checked'])) {
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.note_public']['checked'])) {
+ // Note public
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.note_private']['checked'])) {
+ // Note private
+ print '';
+ print ' | ';
+ }
+ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
+ // Template Invoice
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Import key
+ if (!empty($arrayfields['f.import_key']['checked'])) {
+ print '';
+ print '';
+ print ' | ';
+ }
+ // Status
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
+ print '';
+ $liststatus = array('0' => $langs->trans("BillShortStatusDraft"), '0,1' => $langs->trans("BillShortStatusDraft") . '+' . $langs->trans("BillShortStatusNotPaid"), '1' => $langs->trans("BillShortStatusNotPaid"), '1,2' => $langs->trans("BillShortStatusNotPaid") . '+' . $langs->trans("BillShortStatusPaid"), '2' => $langs->trans("BillShortStatusPaid"), '3' => $langs->trans("BillShortStatusCanceled"));
+ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
+ print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage', 1);
+ print ' | ';
+ }
+ // Action column
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '';
+ $searchpicto = $form->showFilterButtons();
+ print $searchpicto;
+ print ' | ';
+ }
+ print "
\n";
-$projectstatic = new Project($db);
-$discount = new DiscountAbsolute($db);
-$userstatic = new User($db);
-
-// Loop on record
-// --------------------------------------------------------------------
-if ($num > 0) {
- $i = 0;
- $savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
- $totalarray['val'] = array();
- $totalarray['val']['f.total_ht'] = 0;
- $totalarray['val']['f.total_tva'] = 0;
- $totalarray['val']['f.total_localtax1'] = 0;
- $totalarray['val']['f.total_localtax1'] = 0;
- $totalarray['val']['f.total_ttc'] = 0;
- $totalarray['val']['dynamount_payed'] = 0;
- $totalarray['val']['rtp'] = 0;
-
- $typenArray = $formcompany->typent_array(1);
-
- $with_margin_info = false;
- if (isModEnabled('margin') && (
- !empty($arrayfields['total_pa']['checked'])
- || !empty($arrayfields['total_margin']['checked'])
- || !empty($arrayfields['total_margin_rate']['checked'])
- || !empty($arrayfields['total_mark_rate']['checked'])
- )
- ) {
- $with_margin_info = true;
- }
- $total_ht = 0;
- $total_margin = 0;
-
- $imaxinloop = ($limit ? min($num, $limit) : $num);
- while ($i < $imaxinloop) {
- $obj = $db->fetch_object($resql);
-
- $datelimit = $db->jdate($obj->datelimite);
- $facturestatic->id = $obj->id;
- $facturestatic->ref = $obj->ref;
- $facturestatic->ref_client = $obj->ref_client; // deprecated
- $facturestatic->ref_customer = $obj->ref_client;
- $facturestatic->type = $obj->type;
- $facturestatic->subtype = $obj->subtype;
- $facturestatic->total_ht = $obj->total_ht;
- $facturestatic->total_tva = $obj->total_tva;
- $facturestatic->total_ttc = $obj->total_ttc;
- $facturestatic->multicurrency_code = $obj->multicurrency_code;
- $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
- $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
- $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
- $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
- $facturestatic->statut = $obj->fk_statut; // deprecated
- $facturestatic->status = $obj->fk_statut;
- $facturestatic->close_code = $obj->close_code;
- $facturestatic->total_ttc = $obj->total_ttc;
- $facturestatic->paye = $obj->paye;
- $facturestatic->socid = $obj->fk_soc;
-
- $facturestatic->date = $db->jdate($obj->datef);
- $facturestatic->date_validation = $db->jdate($obj->date_valid);
- $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
-
- $facturestatic->note_public = $obj->note_public;
- $facturestatic->note_private = $obj->note_private;
-
- if (getDolGlobalString('INVOICE_USE_SITUATION') && getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
- $facturestatic->retained_warranty = $obj->retained_warranty;
- $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
- $facturestatic->situation_final = $obj->retained_warranty_date_limit;
- $facturestatic->situation_final = $obj->retained_warranty_date_limit;
- $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
- $facturestatic->situation_counter = $obj->situation_counter;
- }
-
- $companystatic->id = $obj->socid;
- $companystatic->name = $obj->name;
- $companystatic->name_alias = $obj->alias;
- $companystatic->client = $obj->client;
- $companystatic->fournisseur = $obj->fournisseur;
- $companystatic->code_client = $obj->code_client;
- $companystatic->code_compta_client = $obj->code_compta_client;
- $companystatic->code_fournisseur = $obj->code_fournisseur;
- $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
- $companystatic->email = $obj->email;
- $companystatic->phone = $obj->phone;
- $companystatic->fax = $obj->fax;
- $companystatic->address = $obj->address;
- $companystatic->zip = $obj->zip;
- $companystatic->town = $obj->town;
- $companystatic->country_code = $obj->country_code;
-
- $projectstatic->id = $obj->project_id;
- $projectstatic->ref = $obj->project_ref;
- $projectstatic->title = $obj->project_label;
-
- $paiement = $facturestatic->getSommePaiement();
- $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
- $totaldeposits = $facturestatic->getSumDepositsUsed();
- $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
- $remaintopay = $obj->total_ttc - $totalallpayments;
-
- $multicurrency_paiement = $facturestatic->getSommePaiement(1);
- $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
- $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
-
- $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
- $remaintopay = price2num($facturestatic->total_ttc - $totalallpayments);
-
- $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
- $multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
-
- if ($facturestatic->status == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
- $remaintopay = 0;
- $multicurrency_remaintopay = 0;
- }
- if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
- $remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id);
- $remaintopay = -$remaincreditnote;
- $totalallpayments = price2num($facturestatic->total_ttc - $remaintopay);
- $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
- $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
- $multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
- }
-
- $facturestatic->alreadypaid = $paiement;
- $facturestatic->totalpaid = $paiement;
- $facturestatic->totalcreditnotes = $totalcreditnotes;
- $facturestatic->totaldeposits = $totaldeposits;
-
- $marginInfo = array();
- if ($with_margin_info) {
- $facturestatic->fetch_lines();
- $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
- $total_ht += $obj->total_ht;
- $total_margin += $marginInfo['total_margin'];
- }
-
- $object = $facturestatic;
-
- if ($mode == 'kanban') {
- if ($i == 0) {
- print '| ';
- print ' ';
- }
- // Output Kanban
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($object->id, $arrayofselected)) {
- $selected = 1;
- }
- }
-
- $arraydata = array('alreadypaid' => $paiement, 'thirdparty' => $companystatic->getNomUrl(1, '', 12), 'userauthor' => $userstatic->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected));
- print $facturestatic->getKanbanView('', $arraydata);
- if ($i == ($imaxinloop - 1)) {
- print ' ';
- print ' |
';
- }
- } else {
- // Show line of result
- $j = 0;
- print 'ref));
- print 'parent.place=\''.dol_escape_js($place).'\'';
- }
- print '});"';
- }
- print '>';
-
- // Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '| ';
- if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ // Fields title label
+ // --------------------------------------------------------------------
+ print ' |
';
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
+ $totalarray['nbfield']++;
+ }
+ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
+ print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.ref']['checked'])) {
+ print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER['PHP_SELF'], 'f.ref', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.ref_client']['checked'])) {
+ print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], 'f.ref_client', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.type']['checked'])) {
+ print_liste_field_titre($arrayfields['f.type']['label'], $_SERVER["PHP_SELF"], 'f.type', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.subtype']['checked'])) {
+ print_liste_field_titre($arrayfields['f.subtype']['label'], $_SERVER["PHP_SELF"], 'f.subtype', '', $param, '', $sortfield, $sortorder);
+ }
+ if (!empty($arrayfields['f.datef']['checked'])) {
+ print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.date_valid']['checked'])) {
+ print_liste_field_titre($arrayfields['f.date_valid']['label'], $_SERVER['PHP_SELF'], 'f.date_valid', '', $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
+ print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ $langs->load("projects");
+ print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER['PHP_SELF'], "p.title", '', $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['s.name_alias']['checked'])) {
+ // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
+ print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER['PHP_SELF'], 's.name_alias', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['s2.nom']['checked'])) {
+ print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['s.code_client']['checked'])) {
+ print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER['PHP_SELF'], 's.code_client', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['s.town']['checked'])) {
+ print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['s.zip']['checked'])) {
+ print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['state.nom']['checked'])) {
+ print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
+ print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['typent.code']['checked'])) {
+ print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
+ $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['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.module_source']['checked'])) {
+ print_liste_field_titre($arrayfields['f.module_source']['label'], $_SERVER["PHP_SELF"], "f.module_source", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.pos_source']['checked'])) {
+ print_liste_field_titre($arrayfields['f.pos_source']['label'], $_SERVER["PHP_SELF"], "f.pos_source", "", $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_localtax1']['checked'])) {
+ print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.total_localtax2']['checked'])) {
+ print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $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['u.login']['checked'])) {
+ print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['sale_representative']['checked'])) {
+ print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.retained_warranty']['checked'])) {
+ print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['dynamount_payed']['checked'])) {
+ print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['rtp']['checked'])) {
+ print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
+ print_liste_field_titre($arrayfields['f.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_code', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
+ print_liste_field_titre($arrayfields['f.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
+ print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
+ print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
+ print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
+ print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['multicurrency_rtp']['checked'])) {
+ print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['total_pa']['checked'])) {
+ print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['total_margin']['checked'])) {
+ print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['total_margin_rate']['checked'])) {
+ print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['total_mark_rate']['checked'])) {
+ print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ }
+ // Extra fields
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
+ // Hook fields
+ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => $totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ if (!empty($arrayfields['f.datec']['checked'])) {
+ print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'nowraponall 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, 'nowraponall center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.date_closing']['checked'])) {
+ print_liste_field_titre($arrayfields['f.date_closing']['label'], $_SERVER["PHP_SELF"], "f.date_closing", "", $param, '', $sortfield, $sortorder, 'nowraponall center ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.note_public']['checked'])) {
+ print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.note_private']['checked'])) {
+ print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_fac_rec_source']['label'], $_SERVER["PHP_SELF"], "facrec.titre", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ }
+ // Import key
+ if (!empty($arrayfields['f.import_key']['checked'])) {
+ print_liste_field_titre($arrayfields['f.import_key']['label'], $_SERVER["PHP_SELF"], "f.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ // Status
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
+ print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+ }
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
+ $totalarray['nbfield']++;
+ }
+
+ print "
\n";
+
+ $projectstatic = new Project($db);
+ $discount = new DiscountAbsolute($db);
+ $userstatic = new User($db);
+
+ // Loop on record
+ // --------------------------------------------------------------------
+ if ($num > 0) {
+ $i = 0;
+ $savnbfield = $totalarray['nbfield'];
+ $totalarray = array();
+ $totalarray['nbfield'] = 0;
+ $totalarray['val'] = array();
+ $totalarray['val']['f.total_ht'] = 0;
+ $totalarray['val']['f.total_tva'] = 0;
+ $totalarray['val']['f.total_localtax1'] = 0;
+ $totalarray['val']['f.total_localtax1'] = 0;
+ $totalarray['val']['f.total_ttc'] = 0;
+ $totalarray['val']['dynamount_payed'] = 0;
+ $totalarray['val']['rtp'] = 0;
+
+ $typenArray = $formcompany->typent_array(1);
+
+ $with_margin_info = false;
+ if (
+ isModEnabled('margin') && (
+ !empty($arrayfields['total_pa']['checked'])
+ || !empty($arrayfields['total_margin']['checked'])
+ || !empty($arrayfields['total_margin_rate']['checked'])
+ || !empty($arrayfields['total_mark_rate']['checked'])
+ )
+ ) {
+ $with_margin_info = true;
+ }
+ $total_ht = 0;
+ $total_margin = 0;
+
+ $imaxinloop = ($limit ? min($num, $limit) : $num);
+ while ($i < $imaxinloop) {
+ $obj = $db->fetch_object($resql);
+
+ $datelimit = $db->jdate($obj->datelimite);
+
+ $facturestatic->id = $obj->id;
+ $facturestatic->ref = $obj->ref;
+ $facturestatic->ref_client = $obj->ref_client; // deprecated
+ $facturestatic->ref_customer = $obj->ref_client;
+ $facturestatic->type = $obj->type;
+ $facturestatic->subtype = $obj->subtype;
+ $facturestatic->total_ht = $obj->total_ht;
+ $facturestatic->total_tva = $obj->total_tva;
+ $facturestatic->total_ttc = $obj->total_ttc;
+ $facturestatic->multicurrency_code = $obj->multicurrency_code;
+ $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
+ $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
+ $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
+ $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
+ $facturestatic->statut = $obj->fk_statut; // deprecated
+ $facturestatic->status = $obj->fk_statut;
+ $facturestatic->close_code = $obj->close_code;
+ $facturestatic->total_ttc = $obj->total_ttc;
+ $facturestatic->paye = $obj->paye;
+ $facturestatic->socid = $obj->fk_soc;
+
+ $facturestatic->date = $db->jdate($obj->datef);
+ $facturestatic->date_validation = $db->jdate($obj->date_valid);
+ $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
+
+ $facturestatic->note_public = $obj->note_public;
+ $facturestatic->note_private = $obj->note_private;
+
+ if (getDolGlobalString('INVOICE_USE_SITUATION') && getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
+ $facturestatic->retained_warranty = $obj->retained_warranty;
+ $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
+ $facturestatic->situation_final = $obj->retained_warranty_date_limit;
+ $facturestatic->situation_final = $obj->retained_warranty_date_limit;
+ $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
+ $facturestatic->situation_counter = $obj->situation_counter;
+ }
+
+ $companystatic->id = $obj->socid;
+ $companystatic->name = $obj->name;
+ $companystatic->name_alias = $obj->alias;
+ $companystatic->client = $obj->client;
+ $companystatic->fournisseur = $obj->fournisseur;
+ $companystatic->code_client = $obj->code_client;
+ $companystatic->code_compta_client = $obj->code_compta_client;
+ $companystatic->code_fournisseur = $obj->code_fournisseur;
+ $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
+ $companystatic->email = $obj->email;
+ $companystatic->phone = $obj->phone;
+ $companystatic->fax = $obj->fax;
+ $companystatic->address = $obj->address;
+ $companystatic->zip = $obj->zip;
+ $companystatic->town = $obj->town;
+ $companystatic->country_code = $obj->country_code;
+
+ $projectstatic->id = $obj->project_id;
+ $projectstatic->ref = $obj->project_ref;
+ $projectstatic->title = $obj->project_label;
+
+ $paiement = $facturestatic->getSommePaiement();
+ $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
+ $totaldeposits = $facturestatic->getSumDepositsUsed();
+ $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
+ $remaintopay = $obj->total_ttc - $totalallpayments;
+
+ $multicurrency_paiement = $facturestatic->getSommePaiement(1);
+ $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
+ $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
+
+ $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
+ $remaintopay = price2num($facturestatic->total_ttc - $totalallpayments);
+
+ $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
+ $multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
+
+ if ($facturestatic->status == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
+ $remaintopay = 0;
+ $multicurrency_remaintopay = 0;
+ }
+ if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
+ $remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source=' . $facturestatic->id);
+ $remaintopay = -$remaincreditnote;
+ $totalallpayments = price2num($facturestatic->total_ttc - $remaintopay);
+ $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source=' . $facturestatic->id, 0, 0, 1);
+ $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
+ $multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
+ }
+
+ $facturestatic->alreadypaid = $paiement;
+ $facturestatic->totalpaid = $paiement;
+ $facturestatic->totalcreditnotes = $totalcreditnotes;
+ $facturestatic->totaldeposits = $totaldeposits;
+
+ $marginInfo = array();
+ if ($with_margin_info) {
+ $facturestatic->fetch_lines();
+ $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
+ $total_ht += $obj->total_ht;
+ $total_margin += $marginInfo['total_margin'];
+ }
+
+ $object = $facturestatic;
+
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print '| ';
+ print ' ';
+ }
+ // Output Kanban
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
- if (in_array($obj->id, $arrayofselected)) {
+ if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
- print '';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
}
- }
- // No
- if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
- print ''.(($offset * $limit) + $i).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ $arraydata = array('alreadypaid' => $paiement, 'thirdparty' => $companystatic->getNomUrl(1, '', 12), 'userauthor' => $userstatic->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected));
+ print $facturestatic->getKanbanView('', $arraydata);
+ if ($i == ($imaxinloop - 1)) {
+ print '';
+ print '
';
}
- }
-
- // Ref
- if (!empty($arrayfields['f.ref']['checked'])) {
- print '';
-
- print '';
-
- print '| ';
+ } else {
+ // Show line of result
+ $j = 0;
+ print ' | ref);
- } else {
- print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
+ print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid=' . $obj->id . '\', function() {parent.$.colorbox.close();';
+ if (strpos($obj->ref, 'PROV') !== false) {
+ //If is a draft invoice, load var to be able to add products
+ $place = str_replace(")", "", str_replace("(PROV-POS" . $_SESSION["takeposterminal"] . "-", "", $obj->ref));
+ print 'parent.place=\'' . dol_escape_js($place) . '\'';
+ }
+ print '});"';
}
+ print '>';
- $filename = dol_sanitizeFileName($obj->ref);
- $filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output;
- $filedir = $filepath.'/'.$filename;
-
- $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id;
- print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
- print '';
- print ' ';
- print ' ';
-
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '';
+ if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Customer ref
- if (!empty($arrayfields['f.ref_client']['checked'])) {
- print '';
- print dol_escape_htmltag($obj->ref_client);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // No
+ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
+ print '' . (($offset * $limit) + $i) . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Type
- if (!empty($arrayfields['f.type']['checked'])) {
- print '';
- print $facturestatic->getLibType(2);
- print " | ";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
+ // Ref
+ if (!empty($arrayfields['f.ref']['checked'])) {
+ print '';
+
+ print '';
+
+ print '| ';
+ if ($contextpage == 'poslist') {
+ print dol_escape_htmltag($obj->ref);
+ } else {
+ print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
+ }
- // Invoice Subtype
- if (!empty($arrayfields['f.subtype']['checked'])) {
- $labeltoshow = '';
- if ($facturestatic->subtype > 0) {
- $labeltoshow = $facturestatic->getSubtypeLabel('facture');
- }
- print ' | ';
- print $labeltoshow;
- print " | ";
- if (!$i) {
- $totalarray['nbfield']++;
+ $filename = dol_sanitizeFileName($obj->ref);
+ $filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output;
+ $filedir = $filepath . '/' . $filename;
+
+ $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->id;
+ print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
+ print '';
+ print ' ';
+ print ' ';
+
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Date
- if (!empty($arrayfields['f.datef']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->datef), 'day');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Customer ref
+ if (!empty($arrayfields['f.ref_client']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->ref_client);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Date
- if (!empty($arrayfields['f.date_valid']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_valid), 'day');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Type
+ if (!empty($arrayfields['f.type']['checked'])) {
+ print '';
+ print $facturestatic->getLibType(2);
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Date limit
- if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
- print ''.dol_print_date($datelimit, 'day');
- if ($facturestatic->hasDelay()) {
- print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Invoice Subtype
+ if (!empty($arrayfields['f.subtype']['checked'])) {
+ $labeltoshow = '';
+ if ($facturestatic->subtype > 0) {
+ $labeltoshow = $facturestatic->getSubtypeLabel('facture');
+ }
+ print '';
+ print $labeltoshow;
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Project ref
- if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- if ($obj->project_id > 0) {
- print $projectstatic->getNomUrl(1);
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Date
+ if (!empty($arrayfields['f.datef']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->datef), 'day');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Project title
- if (!empty($arrayfields['p.title']['checked'])) {
- print '';
- if ($obj->project_id > 0) {
- print dol_escape_htmltag($projectstatic->title);
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Date
+ if (!empty($arrayfields['f.date_valid']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_valid), 'day');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Third party
- if (!empty($arrayfields['s.nom']['checked'])) {
- print '';
- if ($contextpage == 'poslist') {
- print dol_escape_htmltag($companystatic->name);
- } else {
- print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
+ // Date limit
+ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
+ print ' | ' . dol_print_date($datelimit, 'day');
+ if ($facturestatic->hasDelay()) {
+ print img_warning($langs->trans('Alert') . ' - ' . $langs->trans('Late'));
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Alias
- if (!empty($arrayfields['s.name_alias']['checked'])) {
- print '';
- print dol_escape_htmltag($companystatic->name_alias);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Parent company
- if (!empty($arrayfields['s2.nom']['checked'])) {
- print '';
- if ($obj->fk_parent > 0) {
- if (!isset($company_url_list[$obj->fk_parent])) {
- $companyparent = new Societe($db);
- $res = $companyparent->fetch($obj->fk_parent);
- if ($res > 0) {
- $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
- }
+
+ // Project ref
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print ' | ';
+ if ($obj->project_id > 0) {
+ print $projectstatic->getNomUrl(1);
}
- if (isset($company_url_list[$obj->fk_parent])) {
- print $company_url_list[$obj->fk_parent];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print "";
- if (!$i) {
- $totalarray['nbfield']++;
+
+ // Project title
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print '';
+ if ($obj->project_id > 0) {
+ print dol_escape_htmltag($projectstatic->title);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Customer Code
- if (!empty($arrayfields['s.code_client']['checked'])) {
- print '';
- print dol_escape_htmltag($companystatic->code_client);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+
+ // Third party
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '';
+ if ($contextpage == 'poslist') {
+ print dol_escape_htmltag($companystatic->name);
+ } else {
+ print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Town
- if (!empty($arrayfields['s.town']['checked'])) {
- print '';
- print dol_escape_htmltag($obj->town);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Alias
+ if (!empty($arrayfields['s.name_alias']['checked'])) {
+ print '';
+ print dol_escape_htmltag($companystatic->name_alias);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Zip
- if (!empty($arrayfields['s.zip']['checked'])) {
- print '';
- print dol_escape_htmltag($obj->zip);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Parent company
+ if (!empty($arrayfields['s2.nom']['checked'])) {
+ print '';
+ if ($obj->fk_parent > 0) {
+ if (!isset($company_url_list[$obj->fk_parent])) {
+ $companyparent = new Societe($db);
+ $res = $companyparent->fetch($obj->fk_parent);
+ if ($res > 0) {
+ $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
+ }
+ }
+ if (isset($company_url_list[$obj->fk_parent])) {
+ print $company_url_list[$obj->fk_parent];
+ }
+ }
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // State
- if (!empty($arrayfields['state.nom']['checked'])) {
- print ''.dol_escape_htmltag($obj->state_name)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Customer Code
+ if (!empty($arrayfields['s.code_client']['checked'])) {
+ print '';
+ print dol_escape_htmltag($companystatic->code_client);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Country
- if (!empty($arrayfields['country.code_iso']['checked'])) {
- $tmparray = getCountry($obj->fk_pays, 'all');
- print '';
- print dol_escape_htmltag($tmparray['label']);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Town
+ if (!empty($arrayfields['s.town']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->town);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Type ent
- if (!empty($arrayfields['typent.code']['checked'])) {
- if (!is_array($typenArray) || count($typenArray) == 0) {
- $typenArray = $formcompany->typent_array(1);
+ // Zip
+ if (!empty($arrayfields['s.zip']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->zip);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!empty($obj->typent_code)) {
- print $typenArray[$obj->typent_code];
+ // State
+ if (!empty($arrayfields['state.nom']['checked'])) {
+ print ' | ' . dol_escape_htmltag($obj->state_name) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Country
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
+ $tmparray = getCountry($obj->fk_pays, 'all');
+ print '';
+ print dol_escape_htmltag($tmparray['label']);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Staff
- if (!empty($arrayfields['staff.code']['checked'])) {
- if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) {
- $conf->cache['staff'] = $formcompany->effectif_array(1);
+ // Type ent
+ if (!empty($arrayfields['typent.code']['checked'])) {
+ if (!is_array($typenArray) || count($typenArray) == 0) {
+ $typenArray = $formcompany->typent_array(1);
+ }
+ print '';
+ if (!empty($obj->typent_code)) {
+ print $typenArray[$obj->typent_code];
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- print $conf->cache['staff'][$obj->staff_code];
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Staff
+ if (!empty($arrayfields['staff.code']['checked'])) {
+ if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) {
+ $conf->cache['staff'] = $formcompany->effectif_array(1);
+ }
+ print '';
+ print $conf->cache['staff'][$obj->staff_code];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Payment mode
- if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
- $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1);
- print '';
- print $s;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Payment mode
+ if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
+ $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1);
+ print '';
+ print $s;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Payment terms
- if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
- $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1);
- print '';
- print $s;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Payment terms
+ if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
+ $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1);
+ print '';
+ print $s;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Module Source
- if (!empty($arrayfields['f.module_source']['checked'])) {
- print '';
- print dol_escape_htmltag($obj->module_source);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Module Source
+ if (!empty($arrayfields['f.module_source']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->module_source);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // POS Terminal
- if (!empty($arrayfields['f.pos_source']['checked'])) {
- print '';
- print dol_escape_htmltag($obj->pos_source);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // POS Terminal
+ if (!empty($arrayfields['f.pos_source']['checked'])) {
+ print '';
+ print dol_escape_htmltag($obj->pos_source);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Amount HT
- if (!empty($arrayfields['f.total_ht']['checked'])) {
- print ''.price($obj->total_ht)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
- }
- $totalarray['val']['f.total_ht'] += $obj->total_ht;
- }
- // Amount VAT
- if (!empty($arrayfields['f.total_tva']['checked'])) {
- print ''.price($obj->total_tva)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva';
- }
- $totalarray['val']['f.total_tva'] += $obj->total_tva;
- }
- // Amount LocalTax1
- if (!empty($arrayfields['f.total_localtax1']['checked'])) {
- print ''.price($obj->total_localtax1)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1';
+ // Amount HT
+ if (!empty($arrayfields['f.total_ht']['checked'])) {
+ print '' . price($obj->total_ht) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
+ }
+ $totalarray['val']['f.total_ht'] += $obj->total_ht;
}
- $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
- }
- // Amount LocalTax2
- if (!empty($arrayfields['f.total_localtax2']['checked'])) {
- print ''.price($obj->total_localtax2)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount VAT
+ if (!empty($arrayfields['f.total_tva']['checked'])) {
+ print '' . price($obj->total_tva) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva';
+ }
+ $totalarray['val']['f.total_tva'] += $obj->total_tva;
}
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2';
+ // Amount LocalTax1
+ if (!empty($arrayfields['f.total_localtax1']['checked'])) {
+ print '' . price($obj->total_localtax1) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1';
+ }
+ $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
}
- $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
- }
- // Amount TTC
- if (!empty($arrayfields['f.total_ttc']['checked'])) {
- print ''.price($obj->total_ttc)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount LocalTax2
+ if (!empty($arrayfields['f.total_localtax2']['checked'])) {
+ print '' . price($obj->total_localtax2) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2';
+ }
+ $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
}
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
+ // Amount TTC
+ if (!empty($arrayfields['f.total_ttc']['checked'])) {
+ print '' . price($obj->total_ttc) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
+ }
+ $totalarray['val']['f.total_ttc'] += $obj->total_ttc;
}
- $totalarray['val']['f.total_ttc'] += $obj->total_ttc;
- }
-
- $userstatic->id = $obj->fk_user_author;
- $userstatic->login = $obj->login;
- $userstatic->lastname = $obj->lastname;
- $userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->user_email;
- $userstatic->status = $obj->user_statut;
- $userstatic->entity = $obj->entity;
- $userstatic->photo = $obj->photo;
- $userstatic->office_phone = $obj->office_phone;
- $userstatic->office_fax = $obj->office_fax;
- $userstatic->user_mobile = $obj->user_mobile;
- $userstatic->job = $obj->job;
- $userstatic->gender = $obj->gender;
- // Author
- if (!empty($arrayfields['u.login']['checked'])) {
- print '';
- if ($userstatic->id) {
- print $userstatic->getNomUrl(-1);
- } else {
- print ' ';
- }
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ $userstatic->id = $obj->fk_user_author;
+ $userstatic->login = $obj->login;
+ $userstatic->lastname = $obj->lastname;
+ $userstatic->firstname = $obj->firstname;
+ $userstatic->email = $obj->user_email;
+ $userstatic->status = $obj->user_statut;
+ $userstatic->entity = $obj->entity;
+ $userstatic->photo = $obj->photo;
+ $userstatic->office_phone = $obj->office_phone;
+ $userstatic->office_fax = $obj->office_fax;
+ $userstatic->user_mobile = $obj->user_mobile;
+ $userstatic->job = $obj->job;
+ $userstatic->gender = $obj->gender;
+
+ // Author
+ if (!empty($arrayfields['u.login']['checked'])) {
+ print '';
+ if ($userstatic->id) {
+ print $userstatic->getNomUrl(-1);
+ } else {
+ print ' ';
+ }
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- if (!empty($arrayfields['sale_representative']['checked'])) {
- // Sales representatives
- print '';
- if ($obj->socid > 0) {
- $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
- if ($listsalesrepresentatives < 0) {
- dol_print_error($db);
- }
- $nbofsalesrepresentative = count($listsalesrepresentatives);
- if ($nbofsalesrepresentative > 6) {
- // We print only number
- print $nbofsalesrepresentative;
- } elseif ($nbofsalesrepresentative > 0) {
- $j = 0;
- foreach ($listsalesrepresentatives as $val) {
- $userstatic->id = $val['id'];
- $userstatic->lastname = $val['lastname'];
- $userstatic->firstname = $val['firstname'];
- $userstatic->email = $val['email'];
- $userstatic->status = $val['statut'];
- $userstatic->entity = $val['entity'];
- $userstatic->photo = $val['photo'];
- $userstatic->login = $val['login'];
- $userstatic->office_phone = $val['office_phone'];
- $userstatic->office_fax = $val['office_fax'];
- $userstatic->user_mobile = $val['user_mobile'];
- $userstatic->job = $val['job'];
- $userstatic->gender = $val['gender'];
- //print '':
- print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
- $j++;
- if ($j < $nbofsalesrepresentative) {
- print ' ';
+ if (!empty($arrayfields['sale_representative']['checked'])) {
+ // Sales representatives
+ print ' ';
+ if ($obj->socid > 0) {
+ $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
+ if ($listsalesrepresentatives < 0) {
+ dol_print_error($db);
+ }
+ $nbofsalesrepresentative = count($listsalesrepresentatives);
+ if ($nbofsalesrepresentative > 6) {
+ // We print only number
+ print $nbofsalesrepresentative;
+ } elseif ($nbofsalesrepresentative > 0) {
+ $j = 0;
+ foreach ($listsalesrepresentatives as $val) {
+ $userstatic->id = $val['id'];
+ $userstatic->lastname = $val['lastname'];
+ $userstatic->firstname = $val['firstname'];
+ $userstatic->email = $val['email'];
+ $userstatic->status = $val['statut'];
+ $userstatic->entity = $val['entity'];
+ $userstatic->photo = $val['photo'];
+ $userstatic->login = $val['login'];
+ $userstatic->office_phone = $val['office_phone'];
+ $userstatic->office_fax = $val['office_fax'];
+ $userstatic->user_mobile = $val['user_mobile'];
+ $userstatic->job = $val['job'];
+ $userstatic->gender = $val['gender'];
+ //print ' ':
+ print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
+ $j++;
+ if ($j < $nbofsalesrepresentative) {
+ print ' ';
+ }
+ //print ' ';
}
- //print '';
}
+ //else print $langs->trans("NoSalesRepresentativeAffected");
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- //else print $langs->trans("NoSalesRepresentativeAffected");
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
}
- }
- if (!empty($arrayfields['f.retained_warranty']['checked'])) {
- print ''.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ if (!empty($arrayfields['f.retained_warranty']['checked'])) {
+ print '' . (!empty($obj->retained_warranty) ? price($obj->retained_warranty) . '%' : ' ') . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- if (!empty($arrayfields['dynamount_payed']['checked'])) {
- print ''.(!empty($totalallpayments) ? price($totalallpayments, 0, $langs) : ' ').' | '; // TODO Use a denormalized field
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'dynamount_payed';
+ if (!empty($arrayfields['dynamount_payed']['checked'])) {
+ print '' . (!empty($totalallpayments) ? price($totalallpayments, 0, $langs) : ' ') . ' | '; // TODO Use a denormalized field
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'dynamount_payed';
+ }
+ $totalarray['val']['dynamount_payed'] += $totalallpayments;
}
- $totalarray['val']['dynamount_payed'] += $totalallpayments;
- }
- // Pending amount
- if (!empty($arrayfields['rtp']['checked'])) {
- print '';
- print(!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' ');
- print ' | '; // TODO Use a denormalized field
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'rtp';
+ // Pending amount
+ if (!empty($arrayfields['rtp']['checked'])) {
+ print '';
+ print(!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' ');
+ print ' | '; // TODO Use a denormalized field
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'rtp';
+ }
+ $totalarray['val']['rtp'] += $remaintopay;
}
- $totalarray['val']['rtp'] += $remaintopay;
- }
- // Currency
- if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
- print '';
- if (!getDolGlobalString('MAIN_SHOW_ONLY_CODE_MULTICURRENCY')) {
- print $langs->transnoentitiesnoconv('Currency'.$obj->multicurrency_code);
- } else {
- print dol_escape_htmltag($obj->multicurrency_code);
- }
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Currency
+ if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
+ print '';
+ if (!getDolGlobalString('MAIN_SHOW_ONLY_CODE_MULTICURRENCY')) {
+ print $langs->transnoentitiesnoconv('Currency' . $obj->multicurrency_code);
+ } else {
+ print dol_escape_htmltag($obj->multicurrency_code);
+ }
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Currency rate
- if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
- print '';
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Currency rate
+ if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
+ print '';
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Amount HT
- if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
- print ''.price($obj->multicurrency_total_ht)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount HT
+ if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
+ print '' . price($obj->multicurrency_total_ht) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Amount VAT
- if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
- print ''.price($obj->multicurrency_total_vat)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount VAT
+ if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
+ print '' . price($obj->multicurrency_total_vat) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Amount TTC
- if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
- print ''.price($obj->multicurrency_total_ttc)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount TTC
+ if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
+ print '' . price($obj->multicurrency_total_ttc) . " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Dyn amount
- if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
- print ''.(!empty($multicurrency_totalpay) ? price($multicurrency_totalpay, 0, $langs) : ' ').' | '; // TODO Use a denormalized field
- if (!$i) {
- $totalarray['nbfield']++;
+ // Dyn amount
+ if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
+ print '' . (!empty($multicurrency_totalpay) ? price($multicurrency_totalpay, 0, $langs) : ' ') . ' | '; // TODO Use a denormalized field
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Pending amount
- if (!empty($arrayfields['multicurrency_rtp']['checked'])) {
- print '';
- print(!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' ');
- print ' | '; // TODO Use a denormalized field ?
- if (!$i) {
- $totalarray['nbfield']++;
+ // Pending amount
+ if (!empty($arrayfields['multicurrency_rtp']['checked'])) {
+ print '';
+ print(!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' ');
+ print ' | '; // TODO Use a denormalized field ?
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Total buying or cost price
- if (!empty($arrayfields['total_pa']['checked'])) {
- print ''.price($marginInfo['pa_total'], 0, $langs, 1, -1, 'MT').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- $totalarray['pos'][$totalarray['nbfield']] = 'total_pa';
+ // Total buying or cost price
+ if (!empty($arrayfields['total_pa']['checked'])) {
+ print '' . price($marginInfo['pa_total'], 0, $langs, 1, -1, 'MT') . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_pa';
+ }
+ if (empty($totalarray['val']['total_pa'])) {
+ $totalarray['val']['total_pa'] = 0;
+ }
+ $totalarray['val']['total_pa'] += $marginInfo['pa_total'];
}
- if (empty($totalarray['val']['total_pa'])) {
- $totalarray['val']['total_pa'] = 0;
+ // Total margin
+ if (!empty($arrayfields['total_margin']['checked'])) {
+ print '' . price($marginInfo['total_margin'], 0, $langs, 1, -1, 'MT') . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
+ }
+ if (empty($totalarray['val']['total_margin'])) {
+ $totalarray['val']['total_margin'] = 0;
+ }
+ $totalarray['val']['total_margin'] += $marginInfo['total_margin'];
}
- $totalarray['val']['total_pa'] += $marginInfo['pa_total'];
- }
- // Total margin
- if (!empty($arrayfields['total_margin']['checked'])) {
- print ''.price($marginInfo['total_margin'], 0, $langs, 1, -1, 'MT').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
+ // Total margin rate
+ if (!empty($arrayfields['total_margin_rate']['checked'])) {
+ print '' . (($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], 0, '', 0, 0, 2) . '%') . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (empty($totalarray['val']['total_margin'])) {
- $totalarray['val']['total_margin'] = 0;
+ // Total mark rate
+ if (!empty($arrayfields['total_mark_rate']['checked'])) {
+ print '' . (($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], 0, '', 0, 0, 2) . '%') . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
+ }
+ if ($i >= $imaxinloop - 1) {
+ if (!empty($total_ht)) {
+ $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
+ } else {
+ $totalarray['val']['total_mark_rate'] = '';
+ }
+ }
}
- $totalarray['val']['total_margin'] += $marginInfo['total_margin'];
- }
- // Total margin rate
- if (!empty($arrayfields['total_margin_rate']['checked'])) {
- print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], 0, '', 0, 0, 2).'%').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+
+ // Extra fields
+ 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, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Date creation
+ if (!empty($arrayfields['f.datec']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Total mark rate
- if (!empty($arrayfields['total_mark_rate']['checked'])) {
- print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], 0, '', 0, 0, 2).'%').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
+ // Date modification
+ if (!empty($arrayfields['f.tms']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if ($i >= $imaxinloop - 1) {
- if (!empty($total_ht)) {
- $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
- } else {
- $totalarray['val']['total_mark_rate'] = '';
+ // Date closing
+ if (!empty($arrayfields['f.date_closing']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- }
-
- // Extra fields
- 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, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Date creation
- if (!empty($arrayfields['f.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date modification
- if (!empty($arrayfields['f.tms']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date closing
- if (!empty($arrayfields['f.date_closing']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Note public
- if (!empty($arrayfields['f.note_public']['checked'])) {
- print '';
- print dolPrintHTML($obj->note_public);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Note private
- if (!empty($arrayfields['f.note_private']['checked'])) {
- print '';
- print dolPrintHTML($obj->note_private);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Template Invoice
- if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
- print '';
- if (!empty($obj->fk_fac_rec_source)) {
- $facrec = new FactureRec($db);
- $result = $facrec->fetch($obj->fk_fac_rec_source);
- if ($result < 0) {
- setEventMessages($facrec->error, $facrec->errors, 'errors');
- } else {
- print $facrec->getNomUrl();
+ // Note public
+ if (!empty($arrayfields['f.note_public']['checked'])) {
+ print ' | ';
+ print dolPrintHTML($obj->note_public);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Note private
+ if (!empty($arrayfields['f.note_private']['checked'])) {
+ print '';
+ print dolPrintHTML($obj->note_private);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Template Invoice
+ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
+ print '';
+ if (!empty($obj->fk_fac_rec_source)) {
+ $facrec = new FactureRec($db);
+ $result = $facrec->fetch($obj->fk_fac_rec_source);
+ if ($result < 0) {
+ setEventMessages($facrec->error, $facrec->errors, 'errors');
+ } else {
+ print $facrec->getNomUrl();
+ }
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Import key
- if (!empty($arrayfields['f.import_key']['checked'])) {
- print ''.dol_escape_htmltag($obj->import_key).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Import key
+ if (!empty($arrayfields['f.import_key']['checked'])) {
+ print '' . dol_escape_htmltag($obj->import_key) . ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Status
- if (!empty($arrayfields['f.fk_statut']['checked'])) {
- print '';
- print $facturestatic->getLibStatut(5, $totalallpayments);
- print " | ";
- if (!$i) {
- $totalarray['nbfield']++;
+ // Status
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
+ print '';
+ print $facturestatic->getLibStatut(5, $totalallpayments);
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Action column (Show the massaction button only when this page is not opend from the Extended POS)
+ // Action column (Show the massaction button only when this page is not opend from the Extended POS)
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '';
- if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->id, $arrayofselected)) {
- $selected = 1;
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print ' | ';
+ if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- print '';
- }
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
}
+
+ print '' . "\n";
}
- print ''."\n";
+ $i++;
}
- $i++;
- }
-
- // Use correct digits number for totals
- $totalarray['val']['total_pa'] = (isset($totalarray['val']['total_pa']) ? price2num($totalarray['val']['total_pa'], 'MT') : null);
- $totalarray['val']['total_margin'] = (isset($totalarray['val']['total_margin']) ? price2num($totalarray['val']['total_margin'], 'MT') : null);
+ // Use correct digits number for totals
+ $totalarray['val']['total_pa'] = (isset($totalarray['val']['total_pa']) ? price2num($totalarray['val']['total_pa'], 'MT') : null);
+ $totalarray['val']['total_margin'] = (isset($totalarray['val']['total_margin']) ? price2num($totalarray['val']['total_margin'], 'MT') : null);
- // 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++;
- }
+ // Show total line
+ include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
}
- print '| '.$langs->trans("NoRecordFound").' |
';
-}
-
-$db->free($resql);
-
-$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
-$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-print $hookmanager->resPrint;
-print '