/*
 * 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 Controllers.DevisClt;

import Controllers.Traitement.Adaptateur;
import javafx.beans.property.SimpleStringProperty;

/**
 *
 * @author PC-Maher
 */
public class ListProduitDevis {
    
        
    private final SimpleStringProperty reference;
    private final SimpleStringProperty designaton;
    private final SimpleStringProperty quantite;
    private final SimpleStringProperty PrixHT;
    private final SimpleStringProperty Remise;
    private final SimpleStringProperty TotalHT;
    private final SimpleStringProperty TVA;
    private final SimpleStringProperty TotalTTC;
    
    public ListProduitDevis(String reference, String designaton, String quantite, String PrixHT, String Remise, String TotalHT, String TVA, String TotalTTC) {
        
    if(!reference.isEmpty()){  
        
        float remise = Adaptateur.ArrondStringToFloat(Remise.replace("%", "")) ;
        float prixht = Adaptateur.ArrondStringToFloat(PrixHT) ;
        float tva = Adaptateur.StringToFloat(TVA) ;
        float qte = Adaptateur.StringToFloat(quantite) ;
        float totalht = (prixht - ((prixht * remise)/100))* qte ;
        float totalttc = totalht + ((totalht * tva)/100) ;
        if(!Remise.contains("%")){ Remise=Remise+"%"; }
        if(!TVA.contains("%")){ TVA=TVA+"%"; }
        TotalHT = Adaptateur.ArrondFloatToString(totalht);
        TotalTTC= Adaptateur.ArrondFloatToString(totalttc);
    }
    
    
        this.reference = new SimpleStringProperty(reference);
        this.designaton = new SimpleStringProperty(designaton);
        this.quantite = new SimpleStringProperty(quantite);
        this.PrixHT = new SimpleStringProperty(PrixHT);
        this.Remise = new SimpleStringProperty(Remise);
        this.TotalHT = new SimpleStringProperty(TotalHT);
        this.TVA = new SimpleStringProperty(TVA);
        this.TotalTTC = new SimpleStringProperty(TotalTTC);
    }

   

    public String getReference() {
        return reference.get();
    }
    
    public void setReference(String Reference) {
        reference.set(Reference);
    }
    
    public String getDesignaton() {
        return designaton.get();
    }
    
    public void setDesignaton(String Designaton) {
        designaton.set(Designaton);
    }
    
    public String getQuantite() {
        return quantite.get();
    }
    public void setQuantite(String Quantite) {
        quantite.set(Quantite);
    }
    
    public String getPrixHT() {
        return PrixHT.get();
        
    }
    public void setPrixHT(String prixHT) {
        PrixHT.set(prixHT);
    }
    
    public String getRemise() {
        return Remise.get();
    }
    public void setRemise(String remise) {
        Remise.set(remise);
    }
    
    public String getTotalHT() {
        return TotalHT.get();
       
    }
    public void setTotalHT(String totalHT) {
        TotalHT.set(totalHT);
    }
    
    public String getTVA() {
        return TVA.get();
        
    }
    public void setTVA(String tva) {
        TVA.set(tva);
    }
    
    public String getTotalTTC() {
        return TotalTTC.get();
    }
    
    public void setTotalTTC(String totalTTC) {
        TotalTTC.set(totalTTC);
    }
    
}
