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
|
private String sqlQuerySupCom,rechArtSup,rechAgtSD,rechAgtSDMaj,totArtSup,soldDispoArtSup,mAAS,mAASRet;
private int soldDisposupp,totArtSu,matrAgent;
private RequestDB selArtSup,selAgtArtSup,majSDAgt;
private void SupToutCmdes(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:
majSDAgt = new RequestDB();
selArtSup = new RequestDB();
selAgtArtSup = new RequestDB();
soldDisposupp = totArtSu=0;
rechArtSup = "SELECT c.MATRAGENT , c.TOTART , p.SOLDDISPO FROM commandes AS c, personnel AS p LEFT JOIN personnel ON c.MATRAGENT = p.MATRAGENT WHERE CODEART ='"+codArtSuppress.getText()+"'";
selArtSup.openMyDataBaseConnection();
if (selArtSup.byStatementQuery(rechArtSup) != null)
{JOptionPane.showMessageDialog(null,"CODEART : "+codArtSuppress.getText());
while (selArtSup.myGoNext())
{
mAAS=selArtSup.myGetString("c.MATRAGENT");
mAASRet = mAAS.toString();
totArtSu=Integer.parseInt(selArtSup.myGetString("c.TOTART"));
soldDispoArtSup=selArtSup.myGetString("p.SOLDDISPO");
JOptionPane.showMessageDialog(null,"Matricule à updater 1 : "+
mAASRet+" total de l'article à supprimer : "+totArtSu+" Solde Disponible : "+soldDispoArtSup);
JOptionPane.showMessageDialog(null,"SoldDispoArtSup : "+soldDispoArtSup);
soldDisposupp=(Integer.parseInt(soldDispoArtSup))+totArtSu;
JOptionPane.showMessageDialog(null, "après addition : "+soldDisposupp+" matricule à updater : "+mAASRet);
rechAgtSDMaj = "UPDATE personnel SET SOLDDISPO='"+soldDisposupp+"' WHERE MATRAGENT ='"+ mAAS +"'";
majSDAgt.openMyDataBaseConnection();
majSDAgt.byStatementUpdate(rechAgtSDMaj);
majSDAgt.closeMyDataBaseConnection();
selArtSup.myGoNext();
}
selArtSup.myGoNext();
}
else
{
JOptionPane.showMessageDialog(null, "Aucune commande 96");
}
majSDAgt.closeMyDataBaseConnection();
selArtSup.closeMyDataBaseConnection();
} |
Partager