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 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
| /* Génération et remplissage de l'encadré "Signer/Dater" pour les sous-traitants */
public void sousTraitant(JTable jTableST) throws SQLException, WriteException
{
String nomST = null;
String nomCCST = null;
String fonctionCCST = null;
String telCCST = null;
ResultSet resultats = null;
Connexion connexionSousTraitant = new Connexion();
for(int i = 0;i < jTableST.getRowCount(); i++)
{
ChefChantier.recupererIdCCST(jTableST, i);
WritableFont font = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat format12 = new WritableCellFormat (font);
format12.setAlignment(Alignment.CENTRE);
format12.setBorder(Border.LEFT, BorderLineStyle.THIN);
int idChefChantier = (int) ChefChantier.recupererIdCCST(jTableST, i);
PreparedStatement ps = connexionSousTraitant.getConnexion().prepareStatement("" +
"SELECT FonctionCC, NomCC, PrenomCC " +
"FROM ChefChantier " +
"WHERE IdCC = ?;");
ps.setInt(1, idChefChantier);
resultats = ps.executeQuery();
while(resultats.next())
{
fonctionCCST = resultats.getString(1);
nomST = (String) jTableST.getValueAt(i , 0);
nomCCST = (String) resultats.getString(2)+" "+resultats.getString(3);
telCCST = (String) jTableST.getValueAt(i , 3);
for(int r=0; r<4; r++)
{
sheet.insertRow(52);
Label label25 = new Label(0, 52, "", format12);
sheet.addCell(label25);
}
sheet.mergeCells(3, 52, 4, 52);
sheet.mergeCells(4, 53, 5, 53);
WritableCellFormat format = new WritableCellFormat (font);
format.setAlignment(Alignment.CENTRE);
format.setBorder(Border.ALL, BorderLineStyle.THIN);
WritableCellFormat format2 = new WritableCellFormat (font);
format2.setAlignment(Alignment.RIGHT);
format2.setBorder(Border.LEFT, BorderLineStyle.THIN);
WritableCellFormat format3 = new WritableCellFormat (font);
format3.setAlignment(Alignment.RIGHT);
WritableCellFormat format4 = new WritableCellFormat (font);
format4.setAlignment(Alignment.LEFT);
WritableCellFormat format5 = new WritableCellFormat (font);
format5.setAlignment(Alignment.LEFT);
format5.setBorder(Border.RIGHT, BorderLineStyle.THIN);
WritableCellFormat format13 = new WritableCellFormat (font);
format13.setAlignment(Alignment.LEFT);
format13.setBorder(Border.RIGHT, BorderLineStyle.THIN);
format13.setBorder(Border.TOP, BorderLineStyle.THIN);
WritableCellFormat format6 = new WritableCellFormat (font);
format6.setAlignment(Alignment.RIGHT);
format6.setBorder(Border.LEFT, BorderLineStyle.THIN);
WritableCellFormat format7 = new WritableCellFormat (font);
format7.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
WritableCellFormat format8 = new WritableCellFormat (font);
format8.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
WritableCellFormat format9 = new WritableCellFormat (font);
format9.setBorder(Border.BOTTOM, BorderLineStyle.THIN);
WritableCellFormat format10 = new WritableCellFormat (font);
format10.setBorder(Border.RIGHT, BorderLineStyle.THIN);
WritableCellFormat format11 = new WritableCellFormat (font);
format11.setBorder(Border.LEFT, BorderLineStyle.THIN);
Label label5 = new Label(3, 52, "pour la société :", format2);
Label label6 = new Label(5, 52, nomST, format4);
Label label7 = new Label(6, 52, "date :", format3);
Label label8 = new Label(7, 52, "", format5);
Label label9 = new Label(3, 53, "nom :", format2);
Label label10 = new Label(4, 53, nomCCST, format4);
Label label11 = new Label(3, 54, "fonction :", format2);
Label label12 = new Label(4, 54, fonctionCCST, format4);
Label label13 = new Label(6, 54, "Signature :", format3);
Label label14 = new Label(7, 53, "", format5);
Label label15 = new Label(7, 54, "", format5);
Label label16 = new Label(7, 55, "", format5);
Label label17 = new Label(7, 55, "", format2);
Label label18 = new Label(3, 55, "", format8);
Label label19 = new Label(4, 55, "", format7);
Label label20 = new Label(5, 55, "", format7);
Label label21 = new Label(6, 55, "", format7);
Label label22 = new Label(7, 55, "", format9);
Label label23 = new Label(2, 55, "", format10);
Label label24 = new Label(8, 55, "", format11);
Label label28 = new Label(7, 52, "", format13);
sheet.addCell(label28);
sheet.addCell(label5);
sheet.addCell(label6);
sheet.addCell(label7);
sheet.addCell(label8);
sheet.addCell(label9);
sheet.addCell(label10);
sheet.addCell(label11);
sheet.addCell(label12);
sheet.addCell(label13);
sheet.addCell(label14);
sheet.addCell(label15);
sheet.addCell(label16);
sheet.addCell(label17);
sheet.addCell(label18);
sheet.addCell(label19);
sheet.addCell(label20);
sheet.addCell(label21);
sheet.addCell(label22);
sheet.addCell(label23);
sheet.addCell(label24);
}
resultats.close();
}
connexionSousTraitant.closeConn();
} |
Partager