Commit 56329a9c authored by mmhatre's avatar mmhatre

added common validation for cctr code

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@213633 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b43efd48
......@@ -2691,7 +2691,7 @@ public class FinCommon {
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String active=""; //added by manish mhatre on 16-dec-2019
String cctrCheck = null;
try {
......@@ -2709,7 +2709,8 @@ public class FinCommon {
rs = null;
pstmt.close();
pstmt = null;
if ("Y".equalsIgnoreCase(cctrCheck.trim()) && cctrCode != null && cctrCode.trim().length() > 0) {
if ("Y".equalsIgnoreCase(cctrCheck.trim()) && cctrCode != null && cctrCode.trim().length() > 0)
{
sql = "SELECT COUNT(1) AS COUNTER FROM COSTCTR WHERE CCTR_CODE = ? ";
// stmt = con.createStatement();
// rs = stmt.executeQuery(sql);
......@@ -2723,9 +2724,29 @@ public class FinCommon {
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
if (cnt == 0)
{
errCode = "VMCCTR1";
} else {
} else
{
//added by manish mhatre on 13-dec-2019
sql="SELECT ACTIVE FROM COSTCTR WHERE CCTR_CODE= ?";
pstmt=con.prepareStatement(sql);
pstmt.setString(1, cctrCode);
rs=pstmt.executeQuery();
if(rs.next())
{
active=rs.getString("ACTIVE");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if("N".equalsIgnoreCase(active))
{
errCode = "VTCCTR2"; //end manish
}else
{
// chandni
sql = "SELECT COUNT(1) FROM ACCOUNTS_CCTR WHERE ACCT_CODE = ? AND CCTR_CODE = ? ";
// stmt = con.createStatement();
......@@ -2763,8 +2784,13 @@ public class FinCommon {
}
}
}
}
}
} catch (SQLException se) {
System.out.println("SQLException :ITMDBAccessEJB :isCctrCode:" + se.getMessage() + ":");
se.printStackTrace();
......
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