/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Models.FactureFrs;

import Controllers.Traitement.Adaptateur;
import static Controllers.Traitement.Adaptateur.StringToFloat;
import Controllers.Traitement.ParametreSystem;
import Controllers.Traitement.contro;
import Models.BonReceptionFrs.BonReceptionDB;
import Models.BonReceptionFrs.BonReceptionFrs;
import Models.Fournisseur.Fournisseur;
import Models.Fournisseur.FournisseurDB;
import Models.Produit.ListeProduit;
import Models.Stock.StockDetail;
import Models.Stock.StockDetailDB;
import Models.User.Profile;
import Models.User.ProfileDB;
import Models.User.User;
import Models.connexion;
import java.sql.ResultSet;
import java.sql.SQLException;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

/**
 *
 * @author Maher
 */
public class FactureFrsDB {
    
    connexion cnx = new connexion();
    contro clt = new contro();
    
    public FactureFrs setFactureBRDB(FactureFrs Facture){
        
        String Numero = Facture.getNumero();
        String DateCreation = Facture.getDateCreation();
        String HeurCreation = Facture.getHeurCreation();
        String TotalHorsTaxNet = Facture.getTotalHorsTaxNet().replace(",",".");
        String TotalRemise = Facture.getRemise().replace(",",".");
        String TotalTVA = Facture.getTotalTVA().replace(",",".");
        String NetAPayer = Facture.getNetAPayer().replace(",",".");
        String Fourisseur = Facture.getFournisseur().getCode();
        String Local = Facture.getLocal();
        
        ObservableList<ListeProduit> ListProduit = Facture.getListProduit();
        
        ObservableList<BonReceptionFrs> ListBonReception = Facture.getListeBonReception();
        
        
        String CommandeFrs = "NULL";
        if(Facture.getCommandeFrs() != null){
            CommandeFrs = "'"+Facture.getCommandeFrs().getCodeCommandeFrs()+"'";
        }
        
        //0  comptant   |     1  facilité
        String TypeReglement = "NULL";
        if(Facture.getTypeReglement() != null){
            TypeReglement = "'"+Facture.getTypeReglement()+"'";
        }
        
        //  0payer 	|	1en cour 	| NULL      non pays
        String EtatReglement = "NULL";
        if(Facture.getEtatReglement() != null){
            EtatReglement = "'"+Facture.getEtatReglement()+"'";
        }
        
        String Query = "INSERT INTO `facture_frs` (`numero`, `date_creation`, `type_reglement`, `etat_reglement`, `bon_reception`, `devise`, `total_h_t_net`, `remise`, `total_tva`, `timbre_loi`, `net_a_payer`, `id_fourisseur`, `local_reception`, `id_commande_frs`, `id_profile`)  VALUES  ('"+Numero+"', '"+DateCreation+" "+HeurCreation+"', "+TypeReglement+", "+EtatReglement+", 1, '"+ ParametreSystem.CurrencySign+"', '"+TotalHorsTaxNet+"', '"+TotalRemise+"', '"+TotalTVA+"', '"+ParametreSystem.Timbre+"', '"+NetAPayer+"', '"+Fourisseur+"', '"+Local+"', "+CommandeFrs+", '"+User.idprofile+"');";
        String IdFacture = cnx.InsertGetLastId(Query);
        Facture.setIdFactureFrs(IdFacture);
        
        String Req = "INSERT INTO `list_prod_fact_frs` (`id_facture_frs`, `reference`, `designation_produit`, `quantite`, `p_u_h_t`, `remise`, `p_u_h_t_net`, `tva`, `montant`) VALUES ";
        for(int i=0; i<ListProduit.size(); i++){
            String Reference = ListProduit.get(i).getReference();
            if(!Reference.equals("")){
                String Designation = Adaptateur.addSlashes(ListProduit.get(i).getDesignation());
                String Quantite = ListProduit.get(i).getQuantite().replace(",",".");
                String PrixUnitaireHorsTaxe = ListProduit.get(i).getPrixHT().replace(",",".");
                String PrixUnitaireHorsTaxenNet = ListProduit.get(i).getTotalHT().replace(",",".");
                String Remise = ListProduit.get(i).getRemise().replace(",",".").replace("%","");
                String TVA = ListProduit.get(i).getTVA().replace(",",".").replace("%","");
                String Montant = ListProduit.get(i).getTotalTTC().replace(",",".");
                Req = Req + "('"+IdFacture+"', '"+Reference+"', '"+Designation+"', '"+Quantite+"', '"+PrixUnitaireHorsTaxe+"', '"+Remise+"', '"+PrixUnitaireHorsTaxenNet+"', '"+TVA+"', '"+Montant+"'),";
            }
        }
        
        if(Req != null){
            Req = Req.substring(0, Req.length()-1) + ";";
            cnx.insertion(Req);
        }
        
        String ListIdBonReception = "";
        for(int i=0; i<ListBonReception.size(); i++){
            ListIdBonReception += ListBonReception.get(i).getIdBonReception()+",";
        }
        ListIdBonReception = ListIdBonReception.substring(0, ListIdBonReception.length()-1) + "";
        
        String QueryUpdateBonReception = "UPDATE `bonreception_frs` SET `id_facture_frs` = '"+IdFacture+"' WHERE `bonreception_frs`.`id_bonreception` IN ("+ListIdBonReception+") ; ";
        
        cnx.MettreAJour(QueryUpdateBonReception);
        
        return Facture;
    }
    
    
    
    public FactureFrs setFactureFrsDB(FactureFrs Facture){
        
        String Numero = Facture.getNumero();
        String DateCreation = Facture.getDateCreation();
        String HeurCreation = Facture.getHeurCreation();
        String TotalHorsTaxNet = Facture.getTotalHorsTaxNet().replace(",",".");
        String TotalRemise = Facture.getRemise().replace(",",".");
        String TotalTVA = Facture.getTotalTVA().replace(",",".");
        String NetAPayer = Facture.getNetAPayer().replace(",",".");
        String Fourisseur = Facture.getFournisseur().getCode();
        String Local = Facture.getLocal();
        
        
        ObservableList<ListeProduit> ListProduit = Facture.getListProduit();
        
        String CommandeFrs = "NULL";
        if(Facture.getCommandeFrs() != null){
            CommandeFrs = "'"+Facture.getCommandeFrs().getCodeCommandeFrs()+"'";
        }
        
        //0  comptant   |     1  facilité
        String TypeReglement = "NULL";
        if(Facture.getTypeReglement() != null){
            TypeReglement = "'"+Facture.getTypeReglement()+"'";
        }
        
        //  0payer 	|	1en cour 	| NULL      non pays
        String EtatReglement = "NULL";
        if(Facture.getEtatReglement() != null){
            EtatReglement = "'"+Facture.getEtatReglement()+"'";
        }
        
        String Query = "INSERT INTO `facture_frs` (`numero`, `date_creation`, `type_reglement`, `etat_reglement`, `devise`, `total_h_t_net`, `remise`, `total_tva`, `timbre_loi`, `net_a_payer`, `id_fourisseur`, `local_reception`, `id_commande_frs`, `id_profile`)  VALUES  ('"+Numero+"', '"+DateCreation+" "+HeurCreation+"', "+TypeReglement+", "+EtatReglement+", '"+ParametreSystem.CurrencySign+"', '"+TotalHorsTaxNet+"', '"+TotalRemise+"', '"+TotalTVA+"', '"+ParametreSystem.Timbre+"', '"+NetAPayer+"', '"+Fourisseur+"', '"+Local+"', "+CommandeFrs+", '"+User.idprofile+"');";
        String IdFacture = cnx.InsertGetLastId(Query);
        Facture.setIdFactureFrs(IdFacture);
        
        ObservableList<StockDetail> ListStockDetail=FXCollections.observableArrayList();
        
        String Req = "INSERT INTO `list_prod_fact_frs` (`id_facture_frs`, `reference`, `designation_produit`, `quantite`, `p_u_h_t`, `remise`, `p_u_h_t_net`, `tva`, `montant`) VALUES ";
        for(int i=0; i<ListProduit.size(); i++){
            String Reference = ListProduit.get(i).getReference();
            if(!Reference.equals("")){
                String Designation =  Adaptateur.addSlashes(ListProduit.get(i).getDesignation());
                String Quantite = ListProduit.get(i).getQuantite().replace(",",".");
                String PrixUnitaireHorsTaxe = ListProduit.get(i).getPrixHT().replace(",",".");
                String PrixUnitaireHorsTaxenNet = ListProduit.get(i).getTotalHT().replace(",",".");
                String Remise = ListProduit.get(i).getRemise().replace(",",".").replace("%","");
                String TVA = ListProduit.get(i).getTVA().replace(",",".").replace("%","");
                String Montant = ListProduit.get(i).getTotalTTC().replace(",",".");
                Req = Req + "('"+IdFacture+"', '"+Reference+"', '"+Designation+"', '"+Quantite+"', '"+PrixUnitaireHorsTaxe+"', '"+Remise+"', '"+PrixUnitaireHorsTaxenNet+"', '"+TVA+"', '"+Montant+"'),";
                
                ListStockDetail.add(new StockDetail(Reference, StringToFloat(Quantite), null, null, null, null, IdFacture, null));
            }
        }
        
        if(Req != null){
            Req = Req.substring(0, Req.length()-1) + ";";
            cnx.insertion(Req);
            new StockDetailDB().InsertStockDetail(ListStockDetail);
        }
        
        
        return Facture;
    }
    
    
    public FactureFrs getFactureFrs(String IdFactureFrs, String Numero, String IdFournisseur){
        FactureFrs Facture = new FactureFrs();
        
        String Query = "SELECT *, DATE_FORMAT(date_creation, '%d/%m/%Y') as date_recep, DATE_FORMAT(date_creation, '%H:%i') as heur_recep FROM `facture_frs` WHERE `id_facture_frs` = "+IdFactureFrs+";";
        
        if(Numero!=null && IdFournisseur!=null){
            Query = "SELECT *, DATE_FORMAT(date_creation, '%d/%m/%Y') as date_recep, DATE_FORMAT(date_creation, '%H:%i') as heur_recep FROM `facture_frs` WHERE (numero="+Numero+") AND (id_fourisseur="+IdFournisseur+");";
        }
        
        if(cnx.ouverture()){
            try{
               ResultSet resultat = cnx.excutionquery(Query);
                //on place le curseur sur le dernier tuple
                resultat.last();
                //on récupère le numéro de la ligne
                int nombreLignes = resultat.getRow();
                if(nombreLignes>0){
                    Facture.setNumero(resultat.getString("numero"));
                    Facture.setIdFactureFrs(resultat.getString("id_facture_frs"));
                    Facture.setHeurCreation(resultat.getString("heur_recep"));
                    Facture.setDateCreation(resultat.getString("date_recep"));
                    
                    Facture.setTotalHorsTaxNet(resultat.getString("total_h_t_net"));
                    Facture.setTotalTVA(resultat.getString("total_tva"));
                    Facture.setRemise(resultat.getString("remise"));
                    Facture.setNetAPayer(resultat.getString("net_a_payer"));
                    Facture.setTimbre(resultat.getString("timbre_loi"));
                    
                    Facture.setFTotalHorsTaxNet(resultat.getFloat("total_h_t_net"));
                    Facture.setFTotalTVA(resultat.getFloat("total_tva"));
                    Facture.setFRemise(resultat.getFloat("remise"));
                    Facture.setFNetAPayer(resultat.getFloat("net_a_payer"));
                    Facture.setFTimbre(resultat.getFloat("timbre_loi"));
                    
                    Facture.setLocal(resultat.getString("local_reception"));
                    Facture.setTypeReglement(resultat.getString("type_reglement"));
                    Facture.setEtatReglement(resultat.getString("etat_reglement"));
                    Facture.setDevise(resultat.getString("devise"));
                    Facture.setBonReception(resultat.getString("bon_reception"));
                    
                    Fournisseur Frs = new FournisseurDB().GetFournisseurDB(resultat.getString("id_fourisseur"));
                    Facture.setFournisseur(Frs);
                    
                    Profile profile = new ProfileDB().getpro(resultat.getInt("id_profile"));
                    Facture.setProfile(profile);
                    
                    Facture.setListProduit(this.getFactureProduitList(resultat.getString("id_facture_frs")));
                    
                    if(Facture.getBonReception() != null){
                        if(Facture.getBonReception().equals("1") ){
                            BonReceptionDB BonRecepDB= new BonReceptionDB();
                            ObservableList<BonReceptionFrs>  ListeBonReception = BonRecepDB.getBonReceptionByFact(resultat.getString("id_facture_frs"));
                            Facture.setListeBonReception(ListeBonReception);
                        }
                    }
                    
                    
                }
            }catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(Query);
            }
        }
        return Facture;
    }
    
    
    public ObservableList<ListeProduit> getFactureProduitList(String IdFactureFrs){
        ObservableList<ListeProduit> ListProd = FXCollections.observableArrayList();
        if(cnx.ouverture()){
            try{
                String Query = "SELECT * FROM `list_prod_fact_frs` WHERE (`id_facture_frs` = "+IdFactureFrs+");";
                ResultSet ResultListProd = cnx.excutionquery(Query);
                ResultListProd.beforeFirst();
                while (ResultListProd.next() ) {
                    String  reference = ResultListProd.getString("reference");
                    String  designation = ResultListProd.getString("designation_produit");
                    String  quantite = ResultListProd.getString("quantite").replace(",",".");
                    String  PrixHT = ResultListProd.getString("p_u_h_t").replace(",",".");
                    String  Remise = ResultListProd.getString("remise").replace(",",".").replace("%","");
                    String  TotalHT = ResultListProd.getString("p_u_h_t_net").replace(",",".");
                    String  TVA = ResultListProd.getString("tva").replace(",",".").replace("%","");
                    String  TotalTTC= ResultListProd.getString("montant").replace(",",".");
                    ListProd.add(new ListeProduit(reference, designation, quantite, PrixHT, Remise, TotalHT, TVA, TotalTTC));
                }
            }catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
            }
        }
        return ListProd;
    }
    
    public  ObservableList<FactureFrs> SearchFactureFrsGestion(Integer debut, Integer nbr, String NumeroFacture, String IdFournisseur, String LocalReception, String DateReception)
    {
        ObservableList<FactureFrs> ListFactureFrs = FXCollections.observableArrayList();
        
        String Where = "";
        
        if(!clt.isStringNull(NumeroFacture)){
            Where += " (`numero` = \""+NumeroFacture+"\") AND ";
        }
        
        if(!clt.isStringNull(IdFournisseur)){
            Where += " (`id_fourisseur` = \""+IdFournisseur+"\") AND ";
        }
        
        if(!clt.isStringNull(LocalReception)){
            Where += " (`local_reception` = \""+LocalReception+"\") AND ";
        }
        
        if(!clt.isStringNull(DateReception)){
            Where += " (DATE(`date_creation`) = \""+DateReception+"\") AND ";
        }
        
        if(!Where.equals("")){
            Where = Where.substring(0, Where.length() - 4);
            Where = "WHERE  " + Where;
        } 
        
        String req="SELECT  *, DATE_FORMAT(date_creation, '%d/%m/%Y') as date_recep, DATE_FORMAT(date_creation, '%H:%i') as heur_recep "
                + "FROM `facture_frs`   "
                + Where
                + "ORDER BY id_facture_frs DESC "
                + " LIMIT "+debut+" , "+nbr+";";
        
        if(cnx.ouverture()){
            try{
               // Exécution d'une requête de lecture 
                ResultSet resultat = cnx.excutionquery(req);
                //on place le curseur sur le dernier tuple
                resultat.last();
                //on récupère le numéro de la ligne
                int nombreLignes = resultat.getRow();
                if(nombreLignes>0){
                    //on repace le curseur avant la première ligne
                    resultat.beforeFirst();
                    while ( resultat.next() ) {
                        FactureFrs Facture = new FactureFrs();
                        Facture.setNumero(resultat.getString("numero"));
                        Facture.setIdFactureFrs(resultat.getString("id_facture_frs"));
                        Facture.setHeurCreation(resultat.getString("heur_recep"));
                        Facture.setDateCreation(resultat.getString("date_recep"));

                        Facture.setTotalHorsTaxNet(resultat.getString("total_h_t_net"));
                        Facture.setTotalTVA(resultat.getString("total_tva"));
                        Facture.setRemise(resultat.getString("remise"));
                        Facture.setNetAPayer(resultat.getString("net_a_payer"));
                        Facture.setTimbre(resultat.getString("timbre_loi"));
                        Facture.setLocal(resultat.getString("local_reception"));
                        Facture.setTypeReglement(resultat.getString("type_reglement"));
                        Facture.setEtatReglement(resultat.getString("etat_reglement"));
                        Facture.setDevise(resultat.getString("devise"));
                        Facture.setBonReception(resultat.getString("bon_reception"));
                        
                        
                        Fournisseur Frs = new FournisseurDB().GetFournisseurDB(resultat.getString("id_fourisseur"));
                        Facture.setFournisseur(Frs);
                        
                    
                        ListFactureFrs.add(Facture);
                    }
                }
            }
            catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(req);
            }
        }
        return ListFactureFrs;
    }
    
    
    public Integer nbrFactureFrsGestion( String NumeroFacture, String IdFournisseur, String LocalReception, String DateReception)
    {
        String Where = "";
        
        if(!clt.isStringNull(NumeroFacture)){
            Where += " (`numero` = \""+NumeroFacture+"\") AND ";
        }
        
        if(!clt.isStringNull(IdFournisseur)){
            Where += " (`id_fourisseur` = \""+IdFournisseur+"\") AND ";
        }
        
        if(!clt.isStringNull(LocalReception)){
            Where += " (`local_reception` = \""+LocalReception+"\") AND ";
        }
        
        if(!clt.isStringNull(DateReception)){
            Where += " (DATE(`date_creation`) = \""+DateReception+"\") AND ";
        }
        
        
        if(!Where.equals("")){
            Where = Where.substring(0, Where.length() - 4);
            Where = "WHERE  " + Where;
        }
        
        String req=" SELECT COUNT(`id_facture_frs`) " 
                    + " FROM `facture_frs` "
                    + Where+ " ;"; 
        
        int sommme =0;
        
        if(cnx.ouverture()){
            try{
               /* Exécution d'une requête de lecture */
                ResultSet resultat = cnx.excutionquery(req);
                resultat.next();    // get the number of rows from the result set
                sommme = resultat.getInt(1);
            }
            catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(req);
            }
        }
        return sommme ;
    }
    
    public  ObservableList<FactureFrs> getDataFactureFrs(String  tab, String  mot, Integer debut, Integer nbr){
        
        ObservableList<FactureFrs> ListFactureFrs = FXCollections.observableArrayList();
        
        String Limit = "";
        if(debut != null || nbr!= null){
            Limit = "LIMIT "+debut+" , "+nbr;
        }
        String req="SELECT  *, DATE_FORMAT(date_creation, '%d/%m/%Y') as date_recep, DATE_FORMAT(date_creation, '%H:%i') as heur_recep FROM `facture_frs` WHERE (id_reglement_frs IS NULL) AND ("+tab+" "+mot+") ORDER BY id_facture_frs DESC "+Limit+" ;";
        
        if(cnx.ouverture()){
            try{
                // Exécution d'une requête de lecture 
                ResultSet resultat = cnx.excutionquery(req);
                //on place le curseur sur le dernier tuple
                resultat.last();
                //on récupère le numéro de la ligne
                int nombreLignes = resultat.getRow();
                if(nombreLignes>0){
                    //on repace le curseur avant la première ligne
                    resultat.beforeFirst();
                    while ( resultat.next() ) {
                        FactureFrs Facture = new FactureFrs();
                        Facture.setNumero(resultat.getString("numero"));
                        Facture.setIdFactureFrs(resultat.getString("id_facture_frs"));
                        Facture.setHeurCreation(resultat.getString("heur_recep"));
                        Facture.setDateCreation(resultat.getString("date_recep"));

                        Facture.setTotalHorsTaxNet(resultat.getString("total_h_t_net"));
                        Facture.setTotalTVA(resultat.getString("total_tva"));
                        Facture.setRemise(resultat.getString("remise"));
                        Facture.setNetAPayer(resultat.getString("net_a_payer"));
                        Facture.setTimbre(resultat.getString("timbre_loi"));
                        Facture.setLocal(resultat.getString("local_reception"));
                        Facture.setTypeReglement(resultat.getString("type_reglement"));
                        Facture.setEtatReglement(resultat.getString("etat_reglement"));
                        Facture.setDevise(resultat.getString("devise"));
                        Facture.setBonReception(resultat.getString("bon_reception"));
                        
                        
                        Fournisseur Frs = new FournisseurDB().GetFournisseurDB(resultat.getString("id_fourisseur"));
                        Facture.setFournisseur(Frs);
                        
                    
                        ListFactureFrs.add(Facture);
                    }
                }
            }
            catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(req);
            }
        }
        return ListFactureFrs;
    }
    
    
    public String nbrFactureFrs(String  tab, String mot){
        
        String req = "SELECT count(*) FROM facture_frs WHERE "+tab+" "+mot+" ;";
        
        
        int sommme =0;
        if(cnx.ouverture()){
            try{
               /* Exécution d'une requête de lecture */
                ResultSet resultat = cnx.excutionquery(req);
                resultat.next();    // get the number of rows from the result set
                sommme= resultat.getInt(1);
            }
            catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(req);
            }
        }
       return  Integer.toString(sommme) ;
    }
    
    
    public  ObservableList<FactureFrs> getFactureByIdReglement(String  IdReglement){
        
        ObservableList<FactureFrs> ListFactureFrs = FXCollections.observableArrayList();
        
        String req="SELECT  *, DATE_FORMAT(date_creation, '%d/%m/%Y') as date_recep, DATE_FORMAT(date_creation, '%H:%i') as heur_recep FROM `facture_frs`   WHERE id_reglement_frs = "+IdReglement+" ORDER BY id_facture_frs DESC ;";
        
        if(cnx.ouverture()){
            try{
               // Exécution d'une requête de lecture 
                ResultSet resultat = cnx.excutionquery(req);
                //on place le curseur sur le dernier tuple
                resultat.last();
                //on récupère le numéro de la ligne
                int nombreLignes = resultat.getRow();
                if(nombreLignes>0){
                    //on repace le curseur avant la première ligne
                    resultat.beforeFirst();
                    while ( resultat.next() ) {
                        FactureFrs Facture = new FactureFrs();
                        Facture.setNumero(resultat.getString("numero"));
                        Facture.setIdFactureFrs(resultat.getString("id_facture_frs"));
                        Facture.setHeurCreation(resultat.getString("heur_recep"));
                        Facture.setDateCreation(resultat.getString("date_recep"));

                        Facture.setTotalHorsTaxNet(resultat.getString("total_h_t_net"));
                        Facture.setTotalTVA(resultat.getString("total_tva"));
                        Facture.setRemise(resultat.getString("remise"));
                        Facture.setNetAPayer(resultat.getString("net_a_payer"));
                        Facture.setTimbre(resultat.getString("timbre_loi"));
                        Facture.setLocal(resultat.getString("local_reception"));
                        Facture.setTypeReglement(resultat.getString("type_reglement"));
                        Facture.setEtatReglement(resultat.getString("etat_reglement"));
                        Facture.setDevise(resultat.getString("devise"));
                        Facture.setBonReception(resultat.getString("bon_reception"));
                        
                        Profile profile = new ProfileDB().getpro(resultat.getInt("id_profile"));
                        Facture.setProfile(profile);
                    
                        if(Facture.getBonReception() != null){
                            if(Facture.getBonReception().equals("1") ){
                                BonReceptionDB BonRecepDB= new BonReceptionDB();
                                ObservableList<BonReceptionFrs>  ListeBonReception = BonRecepDB.getBonReceptionByFact(resultat.getString("id_facture_frs"));
                                Facture.setListeBonReception(ListeBonReception);
                            }
                        }
                        
                        ListFactureFrs.add(Facture);
                    }
                }
            }
            catch(SQLException ex){
                System.err.println("Erreur SQL ! \n"+ex.getMessage());
                System.out.println(req);
            }
        }
        return ListFactureFrs;
    }
    
}
