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
|
var query ="SELECT * FROM poubelle.clisig WHERE societe="+ soc + " AND CLIENT="+ "'" + num_Client + "'"
var result = dbConn.executeCachedQuery(query);
if (result.next())
{
//Client connu ==> MAJ dans CLISIG
//----------------------------------
ver = result.getString(27);//recup la version
ver = parseInt(ver) + 1 ;
heureCre = result.getString("HEURE_CRE");//recup heure creation
dateCre = result.getString("DATE_CRE");//recup date creation
query = "UPDATE poubelle.clisig SET NOM_RCH=" + "'" + nom + "'"
query = query + ", NOM ="+ "'" + nom + "'" + ", RUE ="+ "'" + rue + "'"
query = query + ", PAYS ="+ "'" + codePays + "'"
query = query + ", CPOST ="+ "'" + cp + "'" + ", DEVISE ="+ "'"
query = query + device + "'" + ", TYPE_TIERS ="+ "'" + type_tiers + "'"
query = query + ", CD_ACTIF ="+ "'" + cd_actif + "'" + ", LANGUE ="+ "'" + langue + "'"
query = query + ", TVA_REGIME ="+ "'" + tva_regime + "'" + ", USER_CRE ="+ "'"
query = query + user + "'" + ", DATE_CRE ="+ "'" + dateCre + "'"
query = query + ", HEURE_CRE ="+ "'" + heureCre + "'"
query = query + ", USER_MOD ="+ "'" + user + "'"+ ", DATE_MOD ="+ "'"
query = query + dateMaj + "'"+ ", HEURE_MOD ="+ "'" + heureMaj + "'"
query = query + ", VER_ENR ="+ "'" + parseInt(ver) + "'"
query = query +" WHERE societe="+ soc + " AND CLIENT="+ "'" + num_Client + "'"
result.close;
result = dbConn.executeCachedQuery(query);
FileUtil.write("C:/test_as400.txt", false,query);
}
else
{
//Client inconnu ==> ajouts dans CLISIG
//-------------------------------------
ver = 0 ;
query = "INSERT INTO poubelle.clisig (SOCIETE,CLIENT,NOM_RCH,NOM,RUE,PAYS,CPOST,"
query = query + "DEVISE,TYPE_TIERS,CD_ACTIF,LANGUE,TVA_REGIME,USER_CRE,DATE_CRE,"
query = query + "HEURE_CRE,USER_MOD,DATE_MOD,HEURE_MOD,VER_ENR) VALUES ( "
query = query + "'" + soc + "'" + "," + "'" + num_Client + "'" + "," + "'" + nom + "'"
query = query + "," +"'" + nom + "'"+ "," + "'" + rue + "'" + "," + "'" + codePays + "'"
query = query + "," + "'" + cp + "'" + "," + "'" + device + "'" + "," + "'"
query = query + type_tiers + "'" + "," + "'" + cd_actif + "'" + "," + "'"
query = query + langue + "'" + "," + "'" + tva_regime + "'" + "," + "'" + user + "'"
query = query + "," + "'" + dateCre + "'" + "," + "'" + heureCre + "'" +"," + "'"
query = query + user + "'" + "," + "'" + dateCre + "'" + "," + "'"
query = query + heureCre + "'" + "," + "'" + ver + "'" + ")"
FileUtil.write("C:/test_as400_.txt", false,query);
result = dbConn.executeCachedQuery(query);
//Client inconnu ==> ajouts dans TIEBNQ
//----------------------------------------
//query = "INSERT INTO poubelle.tiebnq (SOCIETE,TYPE_COMPTE_TIERS,TIERS,TYPE_COMPTE_BANQUE,PAYS_COMPTE_BANQUE,COMPTE_BANQUE,BIC,USER_CRE,DATE_CRE,HEURE_CRE,"
//query = query + "USER_MOD,DATE_MOD,HEURE_MOD,VER_ENR) VALUES ( "
//query = query + "'" + soc + "'" + "," + "'" + typeCptTiers + "'" + "," + "'" + num_Client + "'"
//query = query + "'" + typeCptBnq + "'"
//query = query + "," +"'" + pCptBnq + "'"+ "," + "'" + cptBnq + "'" + "," + "'" + bic+ "'" + "," + "'" + user + "'" + "," + "'" + dateCre + "'"
//query = query + "," + "'" + cp + "'" + "," + "'" + device + "'" + "," + "'"
//query = query + "," + heureCre + "'" + "," + "'" + user + "'" + "," + "'"
//query = query + dateCre + "'" + "," + "'" + heureCre + "'" + "," + "'" + ver + "'" + ")"
FileUtil.write("C:/test_as400.txt", false,query);
//result = dbConn.executeCachedQuery(query);
} |
Partager