| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 
 | package com.xxxx.facturation.controlleur;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
 
import com.xxxx.facturation.dao.FactureDAO;
import com.xxxx.facturation.dao.FournisseurDAO;
import com.xxxx.facturation.dao.LignecomdDAO;
import com.xxxx.facturation.dao.ProduitDAO;
import com.xxxx.facturation.persistance.Facture;
import com.xxxx.facturation.persistance.Fournisseur;
import com.xxxx.facturation.persistance.Lignecomd;
import com.xxxx.facturation.persistance.Produit;
@ManagedBean(name="factu")
@SessionScoped
public class FactureBean implements Serializable{
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    FournisseurDAO fourdao= new FournisseurDAO();
    ProduitDAO pdao=new ProduitDAO();
    //LignecomdDAO lcdao =new LignecomdDAO();
   // private Date date;
     Lignecomd lcd= new Lignecomd();
 
    private List<Lignecomd> cmd= new ArrayList<Lignecomd>();
    private List<Fournisseur> fs = new ArrayList<Fournisseur>();
    private List<SelectItem>listElements;
    private List<Produit> prdt= new ArrayList<Produit>();
    private List<SelectItem>listElementsprod;
    private String nomf;
    private String prodnom;//********//
    private float total ;
    private float pu;
    private Fournisseur f = new  Fournisseur();
    private Produit p = new  Produit();
    private Facture fac = new  Facture();
    FactureDAO factdao= new FactureDAO();
    LignecomdDAO ligdao =new LignecomdDAO();
    FournisseurDAO frndao= new FournisseurDAO(); 
    FactureDAO fa= new FactureDAO();
 
    public Facture getFac() {
        return fac;
    }
 
    public void setFac(Facture fac) {
        this.fac = fac;
    }
    public String ajouter(){
        //fac.setLcde(lcd);
        fa.ajouter(fac);
        return null;
        }
 
    public Fournisseur getF() {
        return f;
    }
 
    public void setF(Fournisseur f) {
        this.f = f;
    }
 
    public float getTotal() {
        return total;
    }
 
    public void setTotal(float total) {
        this.total = total;
    }
 
    public Produit getP() {
        return p;
    }
 
    public void setP(Produit p) {
        this.p = p;
    }
 
    public List<Fournisseur> getFs() {
        return fs;
    }
 
    public void setFs(List<Fournisseur> fs) {
        this.fs = fs;
    }
/* affichage de la liste du fournisseur */
    public List<SelectItem> getListElements() {
        listElements=new ArrayList<SelectItem>();
        for(Fournisseur frn:fourdao.selectAll())
            listElements.add(new SelectItem(frn.getPrenom()));
        return listElements;
    }
 
    public void setListElements(List<SelectItem> listElements) {
        this.listElements = listElements;
    }
 
    public List<Produit> getPrdt() {
        return prdt;
    }
 
    public void setPrdt(List<Produit> prdt) {
        this.prdt = prdt;
    }
    /*affichage de la liste du fournisseur */
    public List<SelectItem> getListElementsprod() {
         listElementsprod=new ArrayList<SelectItem>();
        for(Produit prod:pdao.selectAll())
             listElementsprod.add(new SelectItem(prod.getNom()));
        return listElementsprod;
    }
 
    public void setListElementsprod(List<SelectItem> listElementsprod) {
        this.listElementsprod = listElementsprod;
    }
 
    public List<Lignecomd> getCmd() {
       cmd.add(new Lignecomd());
        return cmd;    
 
    }
 
    public void setCmd(List<Lignecomd> cmd) {
        this.cmd = cmd;
    }
    public String add(){
 
    /*****************    Selection Produit      ************************/
            p=pdao.selectBynom(prodnom);
            prdt.add(p);
            p=new Produit();
            prodnom=new String();
    /*****************   Selection Fournisseur       ************************/
            f=frndao.selectBynom(nomf);
            fs.add(f);
            f=new Fournisseur();
            nomf=new String();
    /****************    Selection Ligne de commande     *************************/
            cmd.add(lcd);
            fac.setLcde(cmd);
            lcd=new Lignecomd();
            return null;
            }
 
    public float getPu() {
        return pu;
    }
 
    public void setPu(float pu) {
        this.pu = pu;
    }
    public String getProdnom() {
        return prodnom;
    }
 
    public void setProdnom(String prodnom) {
        this.prodnom = prodnom;
    }
    public Lignecomd getLcd() {
        return lcd;
    }
 
    public void setLcd(Lignecomd lcd) {
        this.lcd = lcd;
    }
    public String getNomf() {
        return nomf;
    }
 
    public void setNomf(String nomf) {
        this.nomf = nomf;
    }
} | 
Partager