Commit c1dbadaa authored by pbhosale's avatar pbhosale

Updated on[24-01-2020][To assign connection to exprsEngine]

AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215648 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 599cd9be
...@@ -57,7 +57,7 @@ public class AllowDednSalComp ...@@ -57,7 +57,7 @@ public class AllowDednSalComp
// Modified By Poonam B[26/11/2019][START] // Modified By Poonam B[26/11/2019][START]
//if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0) //if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0)
if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") != -1 && varValue.indexOf("]") != -1) if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") != -1 && varValue.indexOf("]") != -1)
{ {
//String[] syntaxStr = varValue.split("["); //String[] syntaxStr = varValue.split("[");
String[] syntaxStr = varValue.split("\\["); String[] syntaxStr = varValue.split("\\[");
...@@ -124,7 +124,7 @@ public class AllowDednSalComp ...@@ -124,7 +124,7 @@ public class AllowDednSalComp
{ {
pbToJavaSyntaxKeySize = -1; pbToJavaSyntaxKeySize = -1;
String filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator + "setting" + File.separator +"ADCompFormulaSyntax.xml"; String filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator + "setting" + File.separator +"ADCompFormulaSyntax.xml";
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath)); BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null) while ((isCurrentLine = bufferedReader.readLine()) != null)
{ {
if (isCurrentLine.trim().length() > 0) if (isCurrentLine.trim().length() > 0)
...@@ -193,11 +193,11 @@ public class AllowDednSalComp ...@@ -193,11 +193,11 @@ public class AllowDednSalComp
if(input.indexOf("IF(")>=0) if(input.indexOf("IF(")>=0)
input = input.replace("IF(", "iif("); input = input.replace("IF(", "iif(");
if(input.indexOf("ISNULL(")>=0) if(input.indexOf("ISNULL(")>=0)
input = input.replace("ISNULL(", "isnull("); input = input.replace("ISNULL(", "isnull(");
if(input.indexOf("ISNULL (")>=0) if(input.indexOf("ISNULL (")>=0)
input = input.replace("ISNULL (", "isnull("); input = input.replace("ISNULL (", "isnull(");
System.out.println(input); System.out.println(input);
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -205,7 +205,7 @@ public class AllowDednSalComp ...@@ -205,7 +205,7 @@ public class AllowDednSalComp
} }
return input; return input;
} }
//Modified by Rohini T on [09/08/19][Start] //Modified by Rohini T on [09/08/19][Start]
public LinkedHashMap getAdCompInfo(String processType, Connection conn) throws ITMException public LinkedHashMap getAdCompInfo(String processType, Connection conn) throws ITMException
{ {
...@@ -275,7 +275,7 @@ public class AllowDednSalComp ...@@ -275,7 +275,7 @@ public class AllowDednSalComp
strBaseFormula = replaceIF(strBaseFormula.trim().toUpperCase()); strBaseFormula = replaceIF(strBaseFormula.trim().toUpperCase());
System.out.println("strBaseFormula::::inside getAdCompInfo after"+strBaseFormula); System.out.println("strBaseFormula::::inside getAdCompInfo after"+strBaseFormula);
} }
*/ */
//Added by Varsha V on 28-11-19 //Added by Varsha V on 28-11-19
/*if(strBaseFormula != null && strBaseFormula.trim().length() > 0 && !strBaseFormula.startsWith("SELECT ")) /*if(strBaseFormula != null && strBaseFormula.trim().length() > 0 && !strBaseFormula.startsWith("SELECT "))
{ {
...@@ -305,7 +305,7 @@ public class AllowDednSalComp ...@@ -305,7 +305,7 @@ public class AllowDednSalComp
strSlabFormula = replaceIF(strSlabFormula.trim().toUpperCase()); strSlabFormula = replaceIF(strSlabFormula.trim().toUpperCase());
System.out.println("strSlabFormula::::inside getAdCompInfo after"+strSlabFormula); System.out.println("strSlabFormula::::inside getAdCompInfo after"+strSlabFormula);
} }
*/ */
//Added by Varsha V on 28-11-19 //Added by Varsha V on 28-11-19
/*if(strSlabFormula != null && strSlabFormula.trim().length() > 0 && !strSlabFormula.startsWith("SELECT ")) /*if(strSlabFormula != null && strSlabFormula.trim().length() > 0 && !strSlabFormula.startsWith("SELECT "))
{ {
...@@ -335,7 +335,7 @@ public class AllowDednSalComp ...@@ -335,7 +335,7 @@ public class AllowDednSalComp
strResFormula = replaceIF(strResFormula.trim().toUpperCase()); strResFormula = replaceIF(strResFormula.trim().toUpperCase());
System.out.println("strResFormula::::inside getAdCompInfo after"+strResFormula); System.out.println("strResFormula::::inside getAdCompInfo after"+strResFormula);
} }
*/ */
//Added by Varsha V on 28-11-19 //Added by Varsha V on 28-11-19
/*if(strResFormula != null && strResFormula.trim().length() > 0 && ! strResFormula.startsWith("SELECT ")) /*if(strResFormula != null && strResFormula.trim().length() > 0 && ! strResFormula.startsWith("SELECT "))
{ {
...@@ -902,7 +902,7 @@ public class AllowDednSalComp ...@@ -902,7 +902,7 @@ public class AllowDednSalComp
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);" + "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);"
+ "return res;}");*/ + "return res;}");*/
//Commented by Poonam B[16-12-2019][To avoid nullPointer][END] //Commented by Poonam B[16-12-2019][To avoid nullPointer][END]
//Ended by Varsha V on 02-12-19 //Ended by Varsha V on 02-12-19
//Commented by Poonam B[16-12-2019][To avoid nullPointer][START] //Commented by Poonam B[16-12-2019][To avoid nullPointer][START]
//AdmCommon admCommon = new AdmCommon(); //AdmCommon admCommon = new AdmCommon();
//Commented by Poonam B[16-12-2019][To avoid nullPointer][END] //Commented by Poonam B[16-12-2019][To avoid nullPointer][END]
...@@ -931,16 +931,30 @@ public class AllowDednSalComp ...@@ -931,16 +931,30 @@ public class AllowDednSalComp
try try
{ {
//Added below line by Varsha V on 02-12-19 //Added below line by Varsha V on 02-12-19
admCommonConn = argConn; //Modified By Poonam B[24-01-2020][To assign argConn to exprsEngine][START]
//admCommonConn = argConn;
exprsEngine.put("conn", argConn);
System.out.println("argConn inside exprsEngine is::::" +exprsEngine.get("conn").toString()+"\nargConn is ::::" +argConn);
//added by Poonam B[16-12-2019][To avoid nullPointer][START] //added by Poonam B[16-12-2019][To avoid nullPointer][START]
exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;" /*exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();" + "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.getEnv(a,b);" + "var res = obj.getEnv(a,b);"
+ "return res;}"); + "return res;}");
exprsEngine.eval("function GF_CALL_PYRL_DDF(a,b,c,d,e,f) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;" exprsEngine.eval("function GF_CALL_PYRL_DDF(a,b,c,d,e,f) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();" + "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);" + "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);"
+ "return res;}"); + "return res;}");*/
exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.getEnv(a,b,conn);"
+ "return res;}");
exprsEngine.eval("function GF_CALL_PYRL_DDF(a,b,c,d,e,f) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f,conn);"
+ "return res;}");
//Modified By Poonam B[24-01-2020][To assign argConn to exprsEngine][END]
//added by Poonam B[16-12-2019][To avoid nullPointer][END] //added by Poonam B[16-12-2019][To avoid nullPointer][END]
/*sql = "select date_join, relieve_date, retirement_date from employee where emp_code = ? "; /*sql = "select date_join, relieve_date, retirement_date from employee where emp_code = ? ";
pstmt = argConn.prepareStatement(sql);*/ pstmt = argConn.prepareStatement(sql);*/
...@@ -1082,18 +1096,18 @@ public class AllowDednSalComp ...@@ -1082,18 +1096,18 @@ public class AllowDednSalComp
{ {
System.out.println("exprsEngine::::"+exprsEngine.toString()); System.out.println("exprsEngine::::"+exprsEngine.toString());
System.out.println("strBaseFormula:::123:"+strBaseFormula); System.out.println("strBaseFormula:::123:"+strBaseFormula);
String strResult = String.valueOf(exprsEngine.eval(strBaseFormula)); String strResult = String.valueOf(exprsEngine.eval(strBaseFormula));
System.out.println("strResult::::123"+strResult); System.out.println("strResult::::123"+strResult);
if(strResult == null || strResult.trim().length() == 0) if(strResult == null || strResult.trim().length() == 0)
{ {
dBaseAmt = 0d; dBaseAmt = 0d;
} }
else else
{ {
if ("NaN".equalsIgnoreCase(strResult)) if ("NaN".equalsIgnoreCase(strResult))
{ {
errorCode = "VPPAYPRC01\tResult is non numeric - Error in base formula of AD Code [" + strCompCode + "]"; errorCode = "VPPAYPRC01\tResult is non numeric - Error in base formula of AD Code [" + strCompCode + "]";
break; break;
} }
else else
{ {
...@@ -1104,14 +1118,14 @@ public class AllowDednSalComp ...@@ -1104,14 +1118,14 @@ public class AllowDednSalComp
} }
catch(Exception dsParseEx) catch(Exception dsParseEx)
{ {
//Modified By Poonam B[23-12-2019][START] //Modified By Poonam B[23-12-2019][START]
//errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage(); //errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage();
errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage().replace('"' , ' ').replace('<', ' '); errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage().replace('"' , ' ').replace('<', ' ');
//Modified By Poonam B[23-12-2019][END] //Modified By Poonam B[23-12-2019][END]
break; break;
} }
} }
} }
} }
catch(Exception bEvalEx) catch(Exception bEvalEx)
{ {
...@@ -1136,17 +1150,17 @@ public class AllowDednSalComp ...@@ -1136,17 +1150,17 @@ public class AllowDednSalComp
{ {
try try
{ {
String strResult = String.valueOf(exprsEngine.eval(strSlabFormula)); String strResult = String.valueOf(exprsEngine.eval(strSlabFormula));
if(strResult == null || strResult.trim().length() == 0) if(strResult == null || strResult.trim().length() == 0)
{ {
dSlabAmt = 0d; dSlabAmt = 0d;
} }
else else
{ {
if ("NaN".equalsIgnoreCase(strResult)) if ("NaN".equalsIgnoreCase(strResult))
{ {
errorCode = "VPPAYPRC01\tResult is non numeric - Error in slab formula of AD Code [" + strCompCode + "]"; errorCode = "VPPAYPRC01\tResult is non numeric - Error in slab formula of AD Code [" + strCompCode + "]";
break; break;
} }
else else
{ {
...@@ -1157,11 +1171,11 @@ public class AllowDednSalComp ...@@ -1157,11 +1171,11 @@ public class AllowDednSalComp
} }
catch(Exception dsParseEx) catch(Exception dsParseEx)
{ {
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage(); errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage();
break; break;
} }
} }
} }
} }
catch(Exception bEvalEx) catch(Exception bEvalEx)
{ {
...@@ -1443,17 +1457,17 @@ public class AllowDednSalComp ...@@ -1443,17 +1457,17 @@ public class AllowDednSalComp
{ {
try try
{ {
String strResult = String.valueOf(exprsEngine.eval(strResFormula)); String strResult = String.valueOf(exprsEngine.eval(strResFormula));
if(strResult == null || strResult.trim().length() == 0) if(strResult == null || strResult.trim().length() == 0)
{ {
dResAmt = 0d; dResAmt = 0d;
} }
else else
{ {
if ("NaN".equalsIgnoreCase(strResult)) if ("NaN".equalsIgnoreCase(strResult))
{ {
errorCode = "VPPAYPRC01\tResult is non numeric - Error in result formula of AD Code [" + strCompCode + "]"; errorCode = "VPPAYPRC01\tResult is non numeric - Error in result formula of AD Code [" + strCompCode + "]";
break; break;
} }
else else
{ {
...@@ -1463,11 +1477,11 @@ public class AllowDednSalComp ...@@ -1463,11 +1477,11 @@ public class AllowDednSalComp
} }
catch(Exception rsParseEx) catch(Exception rsParseEx)
{ {
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + rsParseEx.getMessage(); errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + rsParseEx.getMessage();
break; break;
} }
} }
} }
} }
catch(Exception bEvalEx) catch(Exception bEvalEx)
{ {
...@@ -2337,9 +2351,12 @@ public class AllowDednSalComp ...@@ -2337,9 +2351,12 @@ public class AllowDednSalComp
System.out.println("retMap from GbfGetSplitAttd :: ["+retMap+"]"); System.out.println("retMap from GbfGetSplitAttd :: ["+retMap+"]");
return retMap; return retMap;
} }
//Added by Varsha V on 2-12-19 //Added by Varsha V on 2-12-19
public String getEnv(String prdCode, String varName) throws ITMException //Modified by Poonam B[24-01-2020][to add connection to method][START]
//public String getEnv(String prdCode, String varName) throws ITMException
public String getEnv(String prdCode, String varName, Connection conn) throws ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][END]
{ {
String retValue = ""; String retValue = "";
String sql = ""; String sql = "";
...@@ -2348,7 +2365,11 @@ public class AllowDednSalComp ...@@ -2348,7 +2365,11 @@ public class AllowDednSalComp
try try
{ {
System.out.println("prd_code: "+prdCode+ " varName: "+varName); System.out.println("prd_code: "+prdCode+ " varName: "+varName);
retValue = admCommon.getEnv(prdCode, varName, admCommonConn); //Modified by Poonam B[24-01-2020][to add connection to method][START]
//retValue = admCommon.getEnv(prdCode, varName, admCommonConn);
retValue = admCommon.getEnv(prdCode, varName, conn);
System.out.println("retValue: "+retValue);
//Modified by Poonam B[24-01-2020][to add connection to method][END]
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -2358,13 +2379,20 @@ public class AllowDednSalComp ...@@ -2358,13 +2379,20 @@ public class AllowDednSalComp
} }
return retValue; return retValue;
} }
public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode) throws SQLException, ITMException //Modified by Poonam B[24-01-2020][to add connection to method][START]
//public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode) throws SQLException, ITMException
public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode , Connection conn) throws SQLException, ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][END]
{ {
double retAmt = 0.0; double retAmt = 0.0;
System.out.println("gfCallPayrollDdf Method called"); System.out.println("gfCallPayrollDdf Method called");
try try
{ {
retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, admCommonConn); //Modified by Poonam B[24-01-2020][to add connection to method][START]
//retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, admCommonConn);
System.out.println("conn inside AllowDednSalComp::::" +conn);
retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, conn);
//Modified by Poonam B[24-01-2020][to add connection to method][END]
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -2372,7 +2400,7 @@ public class AllowDednSalComp ...@@ -2372,7 +2400,7 @@ public class AllowDednSalComp
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return retAmt; return retAmt;
} }
//Ended by Varsha V on 2-12-19 //Ended by Varsha V on 2-12-19
......
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