diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index 0c50e416a..055bbabc8 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -1717,6 +1717,41 @@ class Acc_Ledger_Purchase extends Acc_Ledger $ret = $this->db->exec_sql($sql, array($this->id,$p_from, $p_end)); return $ret; } + static function heading_detail_purchase() + { + $array['jr_id'] = _('Numéro opération'); + $array['jr_date'] = _('Date'); + $array['jr_date_paid'] = _('Date paiement'); + $array['jr_ech'] = _('Date échéance'); + $array['jr_tech_per'] = _('Période'); + $array['jr_comment'] = _('Libellé'); + $array['jr_pj_number'] = _('Pièce'); + $array['jr_internal'] = _('Interne'); + $array['jr_def_id'] = _('Code journal'); + $array['j_poste'] = _('Poste'); + $array['j_text'] = _('Commentaire'); + $array['j_qcode'] = _('Code Item'); + $array['item_card'] = _('N° fiche'); + $array['item_name'] = _('Nom fiche'); + $array['qp_supplier'] = _('N° fiche fournisseur'); + $array['tiers_name'] = _('Nom fournisseur'); + $array['quick_code'] = _('Code fournisseur'); + $array['tva_label'] = _('Nom TVA'); + $array['tva_comment'] = _('Commentaire TVA'); + $array['tva_both_side'] = _('TVA annulée'); + $array['vat_sided'] = _('Retrait TVA'); + $array['vat_code'] = _('Code TVA'); + $array['vat'] = _('Montant TVA'); + $array['price'] = _('Total HTVA'); + $array['quantity'] = _('quantité'); + $array['price_per_unit'] = _('PU'); + $array['non_ded_amount'] = _('Montant ND'); + $array['non_ded_tva'] = _('Montant TVA ND'); + $array['non_ded_tva_recup'] = _('TVA récup.'); + $array['htva'] = _('HTVA Opération'); + $array['tot_vat'] = _('TVA Opération'); + return $array; + } } diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index a799b3135..e6a359a5b 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -1300,6 +1300,38 @@ class Acc_Ledger_Sold extends Acc_Ledger { .' order by jr_date,substring(jr_pj_number,\'[0-9]+$\')::numeric asc '; $ret = $this->db->exec_sql($sql, array($this->id,$p_from, $p_end)); return $ret; + } + static function heading_detail_sale() + { + $array['jr_id'] = _('Numéro opération'); + $array['jr_date'] = _('Date'); + $array['jr_date_paid'] = _('Date paiement'); + $array['jr_ech'] = _('Date échéance'); + $array['jr_tech_per'] = _('Période'); + $array['jr_comment'] = _('Libellé'); + $array['jr_pj_number'] = _('Pièce'); + $array['jr_internal'] = _('Interne'); + $array['jr_def_id'] = _('Code journal'); + $array['j_poste'] = _('Poste'); + $array['j_text'] = _('Commentaire'); + $array['j_qcode'] = _('Code Item'); + $array['item_card'] = _('N° fiche'); + $array['item_name'] = _('Nom fiche'); + $array['qs_client'] = _('N° fiche fournisseur'); + $array['tiers_name'] = _('Nom fournisseur'); + $array['quick_code'] = _('Code fournisseur'); + $array['tva_label'] = _('Nom TVA'); + $array['tva_comment'] = _('Commentaire TVA'); + $array['tva_both_side'] = _('TVA annulée'); + $array['vat_sided'] = _('Retrait TVA'); + $array['vat_code'] = _('Code TVA'); + $array['vat'] = _('Montant TVA'); + $array['price'] = _('Total HTVA'); + $array['quantity'] = _('quantité'); + $array['price_per_unit'] = _('PU'); + $array['htva'] = _('HTVA Opération'); + $array['tot_vat'] = _('TVA Opération'); + return $array; } /* !\brief test function */ diff --git a/include/export_ledger_csv.php b/include/export_ledger_csv.php index d3788dcf5..83baf1dd9 100644 --- a/include/export_ledger_csv.php +++ b/include/export_ledger_csv.php @@ -85,11 +85,13 @@ if ($get_option == 2) case 'VEN': $ledger = new Acc_Ledger_Sold($cn, $get_jrn); $ret_detail = $ledger->get_detail_sale($get_from_periode, $get_to_periode); + $a_heading= Acc_Ledger_Sold::heading_detail_sale(); + break; case 'ACH': $ledger = new Acc_Ledger_Purchase($cn, $get_jrn); $ret_detail = $ledger->get_detail_purchase($get_from_periode, $get_to_periode); - + $a_heading= Acc_Ledger_Purchase::heading_detail_purchase(); break; default: die(__FILE__ . ":" . __LINE__ . 'Journal invalide'); @@ -103,10 +105,7 @@ if ($get_option == 2) for ($i = 0;$i < $nb ; $i++) { $row=Database::fetch_array($ret_detail, $i); if ( $i == 0 ) { - foreach ($row as $key=>$value) { - if (isNumber($key) == 0 )$array_key[]=$key; - } - fputcsv($output,$array_key,';'); + fputcsv($output,$a_heading,';'); } $a_row=array(); for ($j=0;$j < count($row) / 2;$j++) { @@ -212,7 +211,10 @@ if ($get_option == 1) $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode, 0); - $cn->prepare('reconcile_date',"select to_char(jr_date,'DD.MM.YY') as str_date,* from jrn where jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)"); + $cn->prepare('reconcile_date',"select to_char(jr_date,'DD.MM.YY') as str_date,* " + . "from jrn " + . "where " + . "jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)"); $own=new Own($cn); $col_tva=""; diff --git a/include/export_ledger_pdf.php b/include/export_ledger_pdf.php index 4271bf322..2da727ad2 100644 --- a/include/export_ledger_pdf.php +++ b/include/export_ledger_pdf.php @@ -39,7 +39,7 @@ require_once('class_periode.php'); require_once 'class_print_ledger.php'; - $cn = new Database($gDossier); +$cn = new Database($gDossier); $periode = new Periode($cn); $l_type = "JRN";