Commit a3549410 authored by dhirajchavan's avatar dhirajchavan

added reas_code validation if not existed in gencodes tables


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100397 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7e8402ee
......@@ -132,10 +132,10 @@ public class CustCreditByPass extends ValidatorEJB implements CustCreditByPassLo
pstmt = conn.prepareStatement(Sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,custcode);
pstmt.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(eff_from,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//pstmt.setString(3,eff_from);
// pstmt.setString(4,valid_upto);
pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(valid_upto,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//pstmt.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(eff_from,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(3,eff_from);
pstmt.setString(4,valid_upto);
// pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(valid_upto,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
// pstmt.setString(5,reasCode);
rs = pstmt.executeQuery();
System.out.println("Sql@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@by dhiraj@@@@@@@@" + Sql);
......@@ -246,10 +246,10 @@ public class CustCreditByPass extends ValidatorEJB implements CustCreditByPassLo
errString = itmDBAccessEJB.getErrorString("","VMCRVTOB ",userId);
break ;
}
else if(eff_from !=null || eff_from.trim().length() > 0)
else if(eff_from !=null && eff_from.trim().length() > 0)
{
System.out.println("eff_from"+eff_from);
System.out.println("valid_upto"+valid_upto);
System.out.println("valid_upto"+validDate);
effDate = Timestamp.valueOf(genericUtility.getValidDateString(eff_from, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validDate = Timestamp.valueOf(genericUtility.getValidDateString(valid_upto, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("effDate"+effDate);
......@@ -271,7 +271,32 @@ public class CustCreditByPass extends ValidatorEJB implements CustCreditByPassLo
{
errString = getErrorString(" ", "VMRESC", userId);
break;
}
}
else if (reasCode != null && reasCode.trim().length() > 0) {
System.out.println("reason code"+reasCode);
sql = "select count(*) from gencodes where fld_value = ? AND mod_name = 'W_CR_BYPASS_CHK' AND fld_Name = 'REAS_CODE'" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, reasCode);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
System.out.println("count for reas code"+cnt);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errString = itmDBAccessEJB.getErrorString("","VTRESKCD ",userId);
break ;
}
}
}
System.out.println("Value of itemcode is:*************************"+siteCode);
System.out.println("Value ofcust code is:*********************"+custcode);
......@@ -445,7 +470,7 @@ public class CustCreditByPass extends ValidatorEJB implements CustCreditByPassLo
else if (currentColumn.trim().equalsIgnoreCase("reas_code")) {
reasCode = genericUtility.getColumnValue("reas_code", dom);
reasCode = reasCode == null ? "" : reasCode.trim();
sql = "select descr from gencodes where fld_value =?";
sql = "select descr from gencodes where fld_value =? AND mod_name = 'W_CR_BYPASS_CHK' AND fld_Name = 'REAS_CODE'";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, reasCode);
rs = pStmt.executeQuery();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment