1 2 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
| private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
try {
int fil = 0;
ArrayList liste = new ArrayList();
liste.clear();
ProduitFacture pfac;
for (fil = 0; fil < jTable1.getRowCount(); fil++) {
pfac = new ProduitFacture(Integer.valueOf(jTable1.getValueAt(fil, 0).toString()), jTable1.getValueAt(fil, 1).toString(), jTable1.getValueAt(fil, 2).toString(), jTable1.getValueAt(fil, 3).toString(), Integer.parseInt(jTable1.getValueAt(fil, 4).toString()), Double.valueOf(jTable1.getValueAt(fil, 5).toString()), Double.valueOf(jTable1.getValueAt(fil, 6).toString()));
liste.add(pfac);
}
Map map = new HashMap();
JasperPrint jp = null;
JDialog raport = new JDialog();
raport.setSize(900, 700);
raport.setLocationRelativeTo(null);
raport.setTitle("Impression");
map.put("entreprise", "Taima-info");
map.put("date", "Constantine le: ");
map.put("rcf", "RC N°:");
map.put("niff", "NIF:");
map.put("nisf", "NIS:");
map.put("facture", "Facture N°:");
map.put("rcc", "RC N°:");
map.put("nifc", "NIF:");
map.put("nisc", "NIS:");
map.put("image", "supr1.png");
map.put("ht", jTextField3.getText());
map.put("tva", jTextField4.getText());
map.put("timbre", jTextField5.getText());
map.put("ttc", jTextField6.getText());
map.put("ht_1", "HT");
map.put("tva_1", "TVA");
map.put("timbre_1", "Timbre");
map.put("ttc_1", "TTC");
jp = JasperFillManager.fillReport(this.getClass().getClassLoader().getResourceAsStream("raport/Facture.jasper"), map, new JRBeanCollectionDataSource(liste));
JRViewer jv = new JRViewer(jp);
raport.getContentPane().add(jv);
raport.setVisible(true);
} catch (JRException ex) {
ex.printStackTrace();
}
} |