Commit 7ef2cddd authored by pbhosale's avatar pbhosale

Updated on [19/11/2019] changes done as suggested By Piyush Sir

AdmCommon.java
AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212440 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 750c1c3f
......@@ -558,88 +558,63 @@ public class AdmCommon
if(voucherNo != null && (voucherNo.trim().equalsIgnoreCase("PAYROLL")))
//Modified by Poonam B[19/11/2019][END][Changes done as suggested by piyush sir]
{
}//Added by Anjali R. on [19/07/2019][To terminate if condition here as per pb code]
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration]
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration]
// if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY"))
else if ((voucherNo != null && voucherNo.trim().length() > 0) || procType.equalsIgnoreCase("PY") || winName.equalsIgnoreCase("W_ATTD_PROC_NORULE") || winName.equalsIgnoreCase("W_ATTD_MON"))
{
sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" +
" AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ;
System.out.println("sqlStr In [payarrToProcUpdation][sqlStr][6]........:: " + sqlStr);
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sqlStr);
if (rs1.next())
{
sqlStr = "SELECT COUNT(*) AS COUNT FROM PAYARR_TO_PROC WHERE EMP_CODE = '"+currEmpCode+"'" +
" AND PRD_CODE = '"+currPeriod+"' AND STATUS = 'U' AND PROC_TYPE = '"+procType+"'" ;
System.out.println("sqlStr In [payarrToProcUpdation][sqlStr][6]........:: " + sqlStr);
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sqlStr);
if (rs1.next())
{
count1 = rs1.getInt("COUNT");
}
rs1.close();
rs1 = null;
stmt1.close();
stmt1 = null;
System.out.println("COUNT(*) FROM PAYARR_TO_PROC.....::[count1]:: "+ count1);
if (count1 == 0)
{
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].Start
/*
count1 = rs1.getInt("COUNT");
}
rs1.close();
rs1 = null;
stmt1.close();
stmt1 = null;
System.out.println("COUNT(*) FROM PAYARR_TO_PROC.....::[count1]:: "+ count1);
if (count1 == 0)
{
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].Start
/*
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1></Detail1></Root>";
*/
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><work_site><![CDATA[" + workSite.trim() + "]]></work_site><pay_site><![CDATA[" + paySite.trim() + "]]></pay_site><emp_site><![CDATA[" + empSite.trim() + "]]></emp_site></Detail1></Root>";
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].End
CommonConstants.setIBASEHOME();
TransIDGenerator tg = new TransIDGenerator(XMLString, userId, CommonConstants.DB_NAME);
tranID = tg.generateTranSeqID("PAYARR", "tran_id", keyString, conn);
System.out.println("Transaction Id Generated [tranID] :: "+tranID);
if(tranID.equalsIgnoreCase("ERROR"))
{
errCode = "VTTRANID";
break;
}
String status = "U";
sqlIns = "INSERT INTO PAYARR_TO_PROC (TRAN_ID, EMP_CODE, PRD_CODE, STATUS, PROC_TYPE, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)";
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][1]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,tranID);
pstmt.setString(2,currEmpCode);
pstmt.setString(3,currPeriod);
pstmt.setString(4,status);
pstmt.setString(5,procType);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate();
if (insCnt == 1)
{
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully.........");
}
else
{
errCode = "DS000";
break;
}
pstmt.close();
pstmt = null;
*/
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><work_site><![CDATA[" + workSite.trim() + "]]></work_site><pay_site><![CDATA[" + paySite.trim() + "]]></pay_site><emp_site><![CDATA[" + empSite.trim() + "]]></emp_site></Detail1></Root>";
// Modified by chetna on [06-09-2014][To incorporate changes of ITM in RCP Migration. Added emp_site,pay_site,work_site].End
CommonConstants.setIBASEHOME();
TransIDGenerator tg = new TransIDGenerator(XMLString, userId, CommonConstants.DB_NAME);
tranID = tg.generateTranSeqID("PAYARR", "tran_id", keyString, conn);
System.out.println("Transaction Id Generated [tranID] :: "+tranID);
if(tranID.equalsIgnoreCase("ERROR"))
{
errCode = "VTTRANID";
break;
}
sqlIns = "INSERT INTO PAYARR_TO_PROC_TRACE (EMP_CODE, PRD_CODE, PROC_TYPE, TRAN_WINDOW, KEY_VALUES, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)" ;
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][2]........:: " + sqlIns);
String status = "U";
sqlIns = "INSERT INTO PAYARR_TO_PROC (TRAN_ID, EMP_CODE, PRD_CODE, STATUS, PROC_TYPE, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)";
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][1]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,currEmpCode);
pstmt.setString(2,currPeriod);
pstmt.setString(3,procType);
pstmt.setString(4,winName);
pstmt.setString(5,keyStr);
pstmt.setString(1,tranID);
pstmt.setString(2,currEmpCode);
pstmt.setString(3,currPeriod);
pstmt.setString(4,status);
pstmt.setString(5,procType);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
pstmt.setString(7,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate();
if (insCnt == 1)
{
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully:: [insCnt].........::" + insCnt);
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully.........");
}
else
{
......@@ -649,6 +624,31 @@ public class AdmCommon
pstmt.close();
pstmt = null;
}
sqlIns = "INSERT INTO PAYARR_TO_PROC_TRACE (EMP_CODE, PRD_CODE, PROC_TYPE, TRAN_WINDOW, KEY_VALUES, CHG_DATE, CHG_USER, CHG_TERM) " +
" VALUES(?,?,?,?,?,?,?,?)" ;
System.out.println("Insert sql In [payarrToProcUpdation][sqlIns][2]........:: " + sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,currEmpCode);
pstmt.setString(2,currPeriod);
pstmt.setString(3,procType);
pstmt.setString(4,winName);
pstmt.setString(5,keyStr);
pstmt.setTimestamp(6,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(7,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmt.setString(8,genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
int insCnt = pstmt.executeUpdate();
if (insCnt == 1)
{
System.out.println("Inserted Into PAYARR_TO_PROC_TRACE Successfully:: [insCnt].........::" + insCnt);
}
else
{
errCode = "DS000";
break;
}
pstmt.close();
pstmt = null;
}
//}
}//End Of If Block
rs.close();
......@@ -2218,9 +2218,9 @@ public class AdmCommon
}
//Ended by Azhar for payroll period validation
// Added by Azhar LogWriter methods----------------------------------
public LogWriterDatabase initializeLogWriter(HashMap gbflogWriterMap,Document headerDom, Connection logConn) throws ITMException
{
System.out.println("Inside admCommon initializeLogWriter localConn method....");
......@@ -2253,7 +2253,7 @@ public class AdmCommon
System.out.println("userInfoBean:::: " + userInfoBean);
transDb = userInfoBean.getTransDB();
System.out.println("transDb:::: " + transDb);
if(localConn == null)
{
System.out.println("creating localConn.....");
......@@ -2272,20 +2272,20 @@ public class AdmCommon
System.out.println("connFlag becomes false to ---["+ connFlag +"]");
}*/
System.out.println("gbflogWriterMap:::: " + gbflogWriterMap);
logWriter.setCurrentProcess((String) gbflogWriterMap.get("currentProcess"));
logWriter.setActivity((String) gbflogWriterMap.get("activity"));
logWriter.setProcessId((String) gbflogWriterMap.get("processId"));
logWriter.setObjName((String) gbflogWriterMap.get("objName"));
logWriter.setFileNameStartWith((String) gbflogWriterMap.get("fileNameStartName"));
objName = logWriter.getObjName();
logWriter.setObjName((String) gbflogWriterMap.get("objName"));
logWriter.setFileNameStartWith((String) gbflogWriterMap.get("fileNameStartName"));
objName = logWriter.getObjName();
userId = (String) gbflogWriterMap.get("userId");
logWriter.setUserId(userId);
loginSite = (String) gbflogWriterMap.get("loginSite");
xtraParams = (String) gbflogWriterMap.get("xtraParams");
System.out.println("objName::: " + objName + " \nuserId::: " + userId + " \nloginSite::: " + loginSite + " \nxtraParams::: " + xtraParams);
logWriter.setErrorCode("");
processId = logWriter.getProcessId();
System.out.println("processId:::: " + processId);
......@@ -2306,7 +2306,7 @@ public class AdmCommon
System.out.println("Final File Path =" + filePath);
try
{
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{
......@@ -2329,7 +2329,7 @@ public class AdmCommon
String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata);
logLocationType = logWriter.getLogLocationType();
logServerAddress = logWriter.getLogServerAddress();
if(logLocationType == null || logLocationType.trim().length() == 0)
......@@ -2358,7 +2358,7 @@ public class AdmCommon
}
logWriter.setLogLocationType(logLocationType);
logWriter.setLogServerAddress(logServerAddress);
jobId = logWriter.getJobID();
System.out.println("jobId :::: " + jobId);
if(jobId == null || jobId.trim().length() == 0)
......@@ -2385,10 +2385,10 @@ public class AdmCommon
while(resultSet.next())
{
maxJobId = checkNull(resultSet.getString("job_id"));
}
System.out.println("maxJobId:::: " + maxJobId);
if(resultSet != null)
{
resultSet.close();
......@@ -2483,7 +2483,7 @@ public class AdmCommon
}
}
}
else
{
logWriter.setJobID(null);
......@@ -2515,10 +2515,10 @@ public class AdmCommon
istr_log_writer.io_inet = create inet
logWriter.setInetCreatedBy("self");
}*/
logWriter.setInetCreatedBy("caller");
logWriter.setInetCreatedBy("caller");
}
if("B".equalsIgnoreCase(logLocationType) || "N".equalsIgnoreCase(logLocationType))
{
......@@ -2549,9 +2549,9 @@ public class AdmCommon
}
}
}
logWriter.setlogWriterFlag(liRet);
}
catch (Exception e)
......@@ -2563,7 +2563,7 @@ public class AdmCommon
finally
{
try {
/* if(connFlag == true)
{
System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!");
......@@ -2590,8 +2590,8 @@ public class AdmCommon
}
return logWriter;
}
public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,LogWriterDatabase logWriter,Connection logConn) throws ITMException
{
System.out.println("Inside admCommon gbfErrWrite method with 5 parameters....");
......@@ -2609,14 +2609,14 @@ public class AdmCommon
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
/*userInfoStr = getUserInfoStr(xtraParams);
System.out.println("userInfoStr:::: " + userInfoStr);
userInfoBean = new UserInfoBean(userInfoStr);
System.out.println("userInfoBean:::: " + userInfoBean);
transDb = userInfoBean.getTransDB();
System.out.println("transDb:::: " + transDb);
if(localConn == null)
{
System.out.println("creating localConn in gbfErrWrite.....");
......@@ -2634,7 +2634,7 @@ public class AdmCommon
connFlag = true;
System.out.println("connFlag becomes false to ---["+ connFlag +"]");
}*/
if(asPrdCode != null && asPrdCode.trim().length() > 0)
{
lsErr = lsErr + "Prd : " + asPrdCode;
......@@ -2647,9 +2647,9 @@ public class AdmCommon
{
lsStr = asErrCode;
asErrCode = getToken(lsStr,"~t");
}
logWriter.setStatusDetail(lsErr + logWriter.getCurrentProcess().trim() + " " + lsStr);
logWriter.setErrorCode(asErrCode);
logWriter.setStatusType(asSeverity);
......@@ -2676,7 +2676,7 @@ public class AdmCommon
finally
{
try {
/*if(connFlag == true)
{
System.out.println("connFlag is [" + connFlag + "] and ready to commit localConn....!!!");
......@@ -2689,7 +2689,7 @@ public class AdmCommon
localConn.close();
localConn = null;
}*/
}
catch (Exception e)
{
......@@ -2699,11 +2699,11 @@ public class AdmCommon
}
return logWriter;
}
public LogWriterDatabase gbfErrWrite(String asPrdCode, String asEmpCode, String asType, String asErrCode, String asSeverity,int Num,LogWriterDatabase logWriter,Connection logConn) throws ITMException
{
System.out.println("Inside admCommon gbfErrWrite method with 6 parameters....");
try
{
logWriter.setTotalRows(logWriter.getTotalRows() + 1);
......@@ -2731,7 +2731,7 @@ public class AdmCommon
}
return logWriter;
}
public LogWriterDatabase gfLogWriter(LogWriterDatabase logWriter1,Connection logConn) throws ITMException, IOException
{
System.out.println("Inside admCommon gfLogWriter method....");
......@@ -2750,7 +2750,7 @@ public class AdmCommon
lsActivity = logWriter1.getActivity();
lsErrorCode = logWriter1.getErrorCode();
lsErrorCode1 = logWriter1.getErrorCode();
System.out.println("lsSeverity::: " + lsSeverity + " lsCurrentProcess::: " + lsCurrentProcess + " lsActivity:::: " + lsActivity +
" lsErrorCode:::" + lsErrorCode + " lsErrorCode1::: " + lsErrorCode1);
......@@ -2761,7 +2761,7 @@ public class AdmCommon
lsStr = lsStr + " " + logWriter1.getStatusDetail();
System.out.println("lsStr::: " + lsStr);
if(lsErrorCode != null && lsErrorCode.trim().length() > 0)
{
lsErrorCode1 = getToken(lsErrorCode1 , "~t");
......@@ -2788,7 +2788,7 @@ public class AdmCommon
pstmt = null;
}
System.out.println("lsMsgStr::: " + lsMsgStr + " lsDescr::: " + lsDescr + " lsMsgType::: " + lsMsgType);
if(lsMsgStr == null || lsMsgStr.trim().length() == 0)
{
lsMsgStr = "";
......@@ -2819,7 +2819,7 @@ public class AdmCommon
lsStr = lsStr + " " + lsMsg;
}
System.out.println("lsStr::: " + lsStr + " lsMsg::: " + lsMsg);
if("E".equalsIgnoreCase(lsSeverity) || (lsMsgType != null && "E".equalsIgnoreCase(lsMsgType)))
{
lsStr = "(ERROR$)-" + lsStr;
......@@ -2828,7 +2828,7 @@ public class AdmCommon
{
lsStr = "(INFORMATION$)-" + lsStr;
}
if(lsStr != null && lsStr.trim().length() > 0)
{
lsStr = lsStr.replace( '"' , ' ');
......@@ -2836,7 +2836,7 @@ public class AdmCommon
System.out.println("lsStr got replaced::: " + lsStr);
jobId = logWriter1.getJobID();
System.out.println("jobId:::: " + jobId);
if(jobId != null && jobId.trim().length() > 0)
{
logWriter1.setStatusType(lsSeverity);
......@@ -2891,7 +2891,7 @@ public class AdmCommon
String webServiceValue = callE12ExtService(url, query);
System.out.println("webServiceValue>>" + webServiceValue);
//this need to be done
/*
lsKey = string(now() , "hhmmssfff");
......@@ -2906,7 +2906,7 @@ public class AdmCommon
ls_temp_data = astr_log_writer.inet_ret.is_return*/
}
}
}
catch(Exception e)
{
......@@ -2921,7 +2921,7 @@ public class AdmCommon
{
output.close();
}
if(rs != null)
{
rs.close();
......@@ -2942,7 +2942,7 @@ public class AdmCommon
return logWriter1;
}
public String gfUpdBackgroundPrcStatus(LogWriterDatabase LogWriter2,Connection logConn) throws ITMException, RemoteException
{
System.out.println("Inside admCommon gfUpdBackgroundPrcStatus method....");
......@@ -2955,8 +2955,8 @@ public class AdmCommon
PreparedStatement pstmt = null;
String sql = "";
int cnt = 0;
try
{
processID = LogWriter2.getProcessId().trim().toUpperCase();
......@@ -2971,14 +2971,14 @@ public class AdmCommon
{
lsStatusDet = "[" + processID + "] " + statusDetail;
}
if(lsStatusDet.length() > 1024)
{
lsStatusDet = utilMethod.left(lsStatusDet,1024);
}
System.out.println("lsStatusDet:::: " + lsStatusDet);
// Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [Start]
Timestamp timestamp = null;
timestamp = new Timestamp(System.currentTimeMillis());
......@@ -2988,17 +2988,17 @@ public class AdmCommon
val = genericUtility.getValidDateTimeString(val, genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat());
System.out.println("val--["+val+"]");
ldtCurrent = Timestamp.valueOf(val);
// Modified by Azhar to print sysdate with time in background_status table field STATUS_TIME on 29-03-2019 [End]
//LocalDateTime now = LocalDateTime.now();
//todayDate = sdf.format(sdf);
//ldtCurrent= utilMethod.dateTime(utilMethod.todaySqlDate(),utilMethod.now());
//System.out.println("todayDate==>" + todayDate);
//ldtCurrent = Timestamp.valueOf(genericUtility.getValidDateString(todayDate,
//genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat()));
//genericUtility.getApplDateTimeFormat(), genericUtility.getDBDateTimeFormat()));
System.out.println("ldtCurrent==>" + ldtCurrent);
sql = "insert into background_status(job_id , obj_name , line_no , status_det , status_time, status_type)" +
"values (? , ? , ? , ? , ?, ? )";
pstmt = logConn.prepareStatement(sql);
......@@ -3015,9 +3015,9 @@ public class AdmCommon
pstmt.close();
pstmt = null;
}
userId = LogWriter2.getUserId();
}
catch(Exception e)
{
......@@ -3043,7 +3043,7 @@ public class AdmCommon
}
return lsReturn;
}
public String getUserInfoStr( String xtraParams )throws ITMException
{
StringBuffer userInfoStr = new StringBuffer();
......@@ -3053,7 +3053,7 @@ public class AdmCommon
String entityCode = "";
String profileId = "";
String userType = "";
String chgTerm = "";
try
{
......@@ -3064,9 +3064,9 @@ public class AdmCommon
entityCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"entityCode");
profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"profileId");
userType = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userType");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
System.out.println("xtraParams is @@@@@ " + xtraParams);
userInfoStr.append("<UserInfo>");
......@@ -3076,7 +3076,7 @@ public class AdmCommon
userInfoStr.append("<entityCode>").append("<![CDATA["+entityCode+"]]>").append("</entityCode>\r\n");
userInfoStr.append("<profileId>").append("<![CDATA["+profileId+"]]>").append("</profileId>\r\n");
userInfoStr.append("<userType>").append("<![CDATA["+userType+"]]>").append("</userType>\r\n");
userInfoStr.append("<remoteHost>").append("<![CDATA["+chgTerm+"]]>").append("</remoteHost>\r\n");
userInfoStr.append("</UserInfo>");
}
......@@ -3086,64 +3086,64 @@ public class AdmCommon
}
return userInfoStr.toString();
}
public int gfOpenFile (String asKeyValue, String asWriteMode, String asFileName) throws ITMException
{
String lsPath = "",lsOvWrt = "",filePath = "",isCurrentLine = "";
StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods();
int li_ret = 0;
try
{
//default path will be root directory
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 +"init.xml";
System.out.println("Final File Path =" + filePath);
try
public int gfOpenFile (String asKeyValue, String asWriteMode, String asFileName) throws ITMException
{
String lsPath = "",lsOvWrt = "",filePath = "",isCurrentLine = "";
StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods();
int li_ret = 0;
try
{
//default path will be root directory
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 +"init.xml";
System.out.println("Final File Path =" + filePath);
try
{
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
System.out.println("isCurrentLine =" + isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
System.out.println("isCurrentLine =" + isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
xmlFileData.append(isCurrentLine.trim());
}
xmlFileData.append(isCurrentLine.trim());
}
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
} catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
} catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata);
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
/* if(lsPath == null || lsPath.trim().length() == 0)
String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata);
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
/* if(lsPath == null || lsPath.trim().length() == 0)
{
lsPath = "";
}
if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1))))
{
lsPath = lsPath + "\\";
}
//default will be overwrite
if("N".equalsIgnoreCase(lsOvWrt))
{
......@@ -3164,125 +3164,157 @@ public class AdmCommon
{
li_ret = FileOpen(asFileName, streammode!, Write!, LockWrite!,Replace!); need to change
}*/
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return li_ret;
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return li_ret;
}
public String gfGetLogFileName(String asKeyValue, String xtraParams) throws ITMException
{
String lsPath = "", lsOvWrt = "N", asFileName = "", filePath = "", isCurrentLine = "", userid = "",chgTerm = "";
StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods();
}
try
{
System.out.println("Inside gfGetLogFileName Method....!!!!!");
userid = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
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 + "init.xml";
System.out.println("Final File Path =" + filePath);
try
{
public String gfGetLogFileName(String asKeyValue, String xtraParams) throws ITMException
{
String lsPath = "", lsOvWrt = "N", asFileName = "", filePath = "", isCurrentLine = "", userid = "",chgTerm = "";
StringBuffer xmlFileData = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods UtilMethod = new UtilMethods();
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{
System.out.println("isCurrentLine =" + isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
xmlFileData.append(isCurrentLine.trim());
}
}
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
}
catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
try
{
System.out.println("Inside gfGetLogFileName Method....!!!!!");
userid = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
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 + "init.xml";
System.out.println("Final File Path =" + filePath);
try
{
String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata);
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{
System.out.println("isCurrentLine =" + isCurrentLine.trim());
if (isCurrentLine.trim().length() > 0)
{
xmlFileData.append(isCurrentLine.trim());
}
}
}
catch (FileNotFoundException e)
{
System.out.println("getMetaData in ParentMetaDataServlet ********* ");
}
catch (IOException e)
{
e.printStackTrace();
}
System.out.println(" xmlFileData.toString().replace :=" + xmlFileData.toString().replace("//", "").trim());
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
String xmlMetadata = xmlFileData.toString().replace("//", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
Document domInitData = genericUtility.parseString(xmlMetadata);
if (lsPath == null || lsPath.trim().length() == 0)
{
lsPath = "";
}
lsPath = checkNull(genericUtility.getColumnValue("Logfile_path", domInitData));
lsOvWrt = checkNull(genericUtility.getColumnValue("Logfile_overwrite", domInitData));
System.out.println("lsPath:::" + lsPath + " lsOvWrt::: " + lsOvWrt);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss");
String todayDateTime = sdf.format(cal.getTime());
System.out.println("todayDateTime::::: " + todayDateTime);
/*
* if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1)))) commented due to
* file separator { lsPath = lsPath + "\\"; }
*/
if (lsPath == null || lsPath.trim().length() == 0)
{
lsPath = "";
}
if ("N".equalsIgnoreCase(lsOvWrt))
{
asFileName = lsPath + asKeyValue.toUpperCase() + "_" + userid.toUpperCase() + "_"
+ chgTerm.toUpperCase() + "_" + todayDateTime;
System.out.println("asFileName:::: " + asFileName);
}
else
{
asFileName = lsPath + asKeyValue.toUpperCase();
System.out.println("asFileName:::: " + asFileName);
}
/*
* if (!("\\".equalsIgnoreCase(UtilMethod.right(lsPath, 1)))) commented due to
* file separator { lsPath = lsPath + "\\"; }
*/
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return asFileName;
if ("N".equalsIgnoreCase(lsOvWrt))
{
asFileName = lsPath + asKeyValue.toUpperCase() + "_" + userid.toUpperCase() + "_"
+ chgTerm.toUpperCase() + "_" + todayDateTime;
System.out.println("asFileName:::: " + asFileName);
}
else
{
asFileName = lsPath + asKeyValue.toUpperCase();
System.out.println("asFileName:::: " + asFileName);
}
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return asFileName;
}
public boolean gfJobTerminateRequested(String jobID, Connection logConn) throws ITMException
{
int cnt = 0;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
public boolean gfJobTerminateRequested(String jobID, Connection logConn) throws ITMException
try
{
int cnt = 0;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
System.out.println("Inside gfJobTerminateRequested Method....!!!!!");
System.out.println("jobID::::: " + jobID);
if (jobID == null || jobID.trim().length() == 0)
{
return false;
}
try
sql = "select count(1) as count from background_job where job_id = ? and case when terminate_req is null then 'N' else terminate_req end = 'Y'";
pstmt = logConn.prepareStatement(sql);
pstmt.setString(1, jobID);
rs = pstmt.executeQuery();
if (rs.next())
{
System.out.println("Inside gfJobTerminateRequested Method....!!!!!");
System.out.println("jobID::::: " + jobID);
if (jobID == null || jobID.trim().length() == 0)
{
return false;
}
cnt = rs.getInt("count");
System.out.println("count is:::: " + cnt);
}
sql = "select count(1) as count from background_job where job_id = ? and case when terminate_req is null then 'N' else terminate_req end = 'Y'";
pstmt = logConn.prepareStatement(sql);
pstmt.setString(1, jobID);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("count");
System.out.println("count is:::: " + cnt);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (cnt > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
......@@ -3294,16 +3326,6 @@ public class AdmCommon
pstmt.close();
pstmt = null;
}
if (cnt > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception e)
{
......@@ -3311,90 +3333,68 @@ public class AdmCommon
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
}
public String callE12ExtService(String urlStr, String paramStr) throws ITMException {
String output = "";
try
{
System.out.println("Inside callE12ExtService Method....!!!!");
URL url = new URL(urlStr + paramStr);
System.out.println("URL: " + url);
String urlTest = url.toString();
System.out.println("@S@urlTest[" + urlTest + "");
urlTest = urlTest.replaceAll(" ", "%20");
System.out.println("@S@ urlTest using %20[" + urlTest + "]");
url = new URL(urlTest);
System.out.println("@S@ url using %20[" + url + "]");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
System.out.println("RequestMethod- " + conn.getRequestMethod());
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setRequestProperty("Accept", "application/json");
conn.connect();
}
/*
* try { DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
* wr.writeBytes( paramStr ); wr.flush(); } catch (Exception e) {
* System.out.println( "Exception - "+ e.getMessage() ); e.printStackTrace(); }
*/
System.out.println("URL: " + url);
System.out.println("ResponseCode: " + conn.getResponseCode());
System.out.println("ResponseMessage: " + conn.getResponseMessage());
public String callE12ExtService(String urlStr, String paramStr) throws ITMException {
String output = "";
try
{
System.out.println("Inside callE12ExtService Method....!!!!");
URL url = new URL(urlStr + paramStr);
System.out.println("URL: " + url);
String urlTest = url.toString();
System.out.println("@S@urlTest[" + urlTest + "");
urlTest = urlTest.replaceAll(" ", "%20");
System.out.println("@S@ urlTest using %20[" + urlTest + "]");
url = new URL(urlTest);
System.out.println("@S@ url using %20[" + url + "]");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
System.out.println("RequestMethod- " + conn.getRequestMethod());
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setRequestProperty("Accept", "application/json");
conn.connect();
if (conn.getResponseCode() != 200)
{
System.out.println("Failed : HTTP error code : " + conn.getResponseCode());
System.out.println("ErrorStream: "
+ (new BufferedReader(new InputStreamReader(conn.getErrorStream()))).readLine());
}
/*
* try { DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
* wr.writeBytes( paramStr ); wr.flush(); } catch (Exception e) {
* System.out.println( "Exception - "+ e.getMessage() ); e.printStackTrace(); }
*/
System.out.println("URL: " + url);
System.out.println("ResponseCode: " + conn.getResponseCode());
System.out.println("ResponseMessage: " + conn.getResponseMessage());
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((output = br.readLine()) != null)
{
System.out.println(output);
}
conn.disconnect();
System.out.println("Output: " + output);
if (conn.getResponseCode() != 200)
{
System.out.println("Failed : HTTP error code : " + conn.getResponseCode());
System.out.println("ErrorStream: "
+ (new BufferedReader(new InputStreamReader(conn.getErrorStream()))).readLine());
}
}
catch (Exception e)
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((output = br.readLine()) != null)
{
e.printStackTrace();
throw new ITMException(e);
System.out.println(output);
}
conn.disconnect();
System.out.println("Output: " + output);
return output;
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return output;
}
// Ended by Azhar LogWriter method---------------------------------
public String getToken(String source, String separator)
{
......@@ -3424,49 +3424,49 @@ public class AdmCommon
return ret;
}
public Timestamp gfLastDate(Timestamp mdate) throws ITMException
{
Timestamp retDate = null;
java.util.Date nDate = null;
SimpleDateFormat sdf = null;
UtilMethods utilMethod = new UtilMethods();
{
Timestamp retDate = null;
java.util.Date nDate = null;
SimpleDateFormat sdf = null;
UtilMethods utilMethod = new UtilMethods();
try
{
System.out.println("*************Inside gfLastDate Method*******************");
sdf = new SimpleDateFormat("dd/MM/yyyy");
String formatDate = sdf.format(mdate);
System.out.println("formatDate:::[" + formatDate +"]");
if(mdate == null || ("01/01/1900".equalsIgnoreCase(formatDate)))
{
return mdate;
}
nDate = utilMethod.date(utilMethod.year(mdate), utilMethod.month(mdate), 01);
//nDate = utilMethod.year(utilMethod.date(mdate)), utilMethod.month(mdate)), 01);
try
{
System.out.println("*************Inside gfLastDate Method*******************");
sdf = new SimpleDateFormat("dd/MM/yyyy");
String formatDate = sdf.format(mdate);
System.out.println("formatDate:::[" + formatDate +"]");
if(mdate == null || ("01/01/1900".equalsIgnoreCase(formatDate)))
{
return mdate;
}
nDate = utilMethod.date(utilMethod.year(mdate), utilMethod.month(mdate), 01);
//nDate = utilMethod.year(utilMethod.date(mdate)), utilMethod.month(mdate)), 01);
nDate = utilMethod.RelativeDate(nDate, 31);
System.out.println("nDate ::[" + nDate + "]" );
do
{
if(utilMethod.month(nDate) == utilMethod.month(mdate))
{
break;
}
nDate = utilMethod.RelativeDate(nDate, -1);
System.out.println("nDate ::[" + nDate + "]" );
}
while(true);
retDate = new Timestamp(nDate.getTime());
System.out.println("retDate::[" + retDate + "]");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retDate;
}
/*public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
nDate = utilMethod.RelativeDate(nDate, 31);
System.out.println("nDate ::[" + nDate + "]" );
do
{
if(utilMethod.month(nDate) == utilMethod.month(mdate))
{
break;
}
nDate = utilMethod.RelativeDate(nDate, -1);
System.out.println("nDate ::[" + nDate + "]" );
}
while(true);
retDate = new Timestamp(nDate.getTime());
System.out.println("retDate::[" + retDate + "]");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retDate;
}
/*public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{
double rndAmt = 0;
double lcMultiply = 1;
......@@ -3541,112 +3541,112 @@ public class AdmCommon
return rndAmt;
}
//Added by Azhar K. on[08-07-2019][End]
*/
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start]
public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException
{
String lsRetVal = "";
long llJobId = 0;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
UtilMethods utilMethod = new UtilMethods();
*/
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start]
try
{
System.out.println("************ Inside gfGetHrBackgroundJobid Method ******************");
public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException
{
String lsRetVal = "";
long llJobId = 0;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
UtilMethods utilMethod = new UtilMethods();
sql = "select hrbackgroundjobseq.nextval as jobIdValue from dual ";
pstmt = logConn.prepareStatement(sql);
rs = pstmt.executeQuery();
try
{
System.out.println("************ Inside gfGetHrBackgroundJobid Method ******************");
if(rs.next())
{
llJobId = rs.getLong("jobIdValue");
}
else
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
lsRetVal = "ERR$DS000";
hrBackGrndJobId.put("ErrorCode", lsRetVal);
return hrBackGrndJobId;
}
sql = "select hrbackgroundjobseq.nextval as jobIdValue from dual ";
pstmt = logConn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//lsRetVal = "HMS" + right("000000000000000" + trim(string((llJobId))) , 12)
lsRetVal = "HMS" + utilMethod.right("000000000000000" + String.valueOf(llJobId).trim(), 12);
hrBackGrndJobId.put("jobId", lsRetVal);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e1)
{
e1.printStackTrace();
throw new ITMException(e1);
}
}
return hrBackGrndJobId;
}
if(rs.next())
{
llJobId = rs.getLong("jobIdValue");
}
else
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
lsRetVal = "ERR$DS000";
hrBackGrndJobId.put("ErrorCode", lsRetVal);
return hrBackGrndJobId;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//lsRetVal = "HMS" + right("000000000000000" + trim(string((llJobId))) , 12)
lsRetVal = "HMS" + utilMethod.right("000000000000000" + String.valueOf(llJobId).trim(), 12);
hrBackGrndJobId.put("jobId", lsRetVal);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e1)
{
e1.printStackTrace();
throw new ITMException(e1);
}
}
return hrBackGrndJobId;
}
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][End]
//Added by sarita on setNodeValue method on 14 AUG 2019 [START]
public static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
System.out.println("tempNode is ["+tempNode+"]");
if( tempNode != null )
{
if( tempNode.getFirstChild() == null )
{
CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection );
System.out.println("tempNode is 1["+tempNode+"]");
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
System.out.println("tempNode is 2["+tempNode+"]");
}
}
tempNode = null;
}//End of Method setNodeValue
//Added by sarita on setNodeValue method on 14 AUG 2019 [START]
public static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
System.out.println("tempNode is ["+tempNode+"]");
if( tempNode != null )
{
if( tempNode.getFirstChild() == null )
{
CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection );
System.out.println("tempNode is 1["+tempNode+"]");
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
System.out.println("tempNode is 2["+tempNode+"]");
}
}
tempNode = null;
}//End of Method setNodeValue
//Added by sarita on setNodeValue method on 14 AUG 2019 [END]
//Added by Varsha V on 05-07-19
......@@ -3691,9 +3691,9 @@ public class AdmCommon
pstmt.close();
pstmt = null;
}
int month = utilMethods.month(frDateTm);
if(calcPropDays.get("calcprop") != null && calcPropDays.get("calcprop").toString().trim().length() > 0)
{
calcProp = calcPropDays.get("calcprop").toString();
......@@ -3731,7 +3731,7 @@ public class AdmCommon
errorCode = utilMethods.mid(woffInPropdays , 5);
break;
}
holidayInPropdays = checkNull(getAdmEnv(cPaysite, cCadre, cGrade, "HOLINPROPDAYS", frDateTm, conn));
if(holidayInPropdays.equalsIgnoreCase("NULLFOUND"))
{
......@@ -3747,9 +3747,9 @@ public class AdmCommon
{
woffInPropdays = "Y";
}
propDays = utilMethods.DaysAfter(frDateTm, toDateTm)+1;
if(woffInPropdays.equalsIgnoreCase("N"))
{
sql = "select hol_tblno from employee where emp_code = ?";
......@@ -3878,7 +3878,7 @@ public class AdmCommon
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
todayDateStr = sdf.format(new java.util.Date());
todatDateTm = Timestamp.valueOf(genericUtility.getValidDateString(todayDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(propAd != null && propAd.trim().length() > 0 && propAd.equalsIgnoreCase("NULLFOUND"))
{
count = 0;
......@@ -3978,7 +3978,7 @@ public class AdmCommon
System.out.println("Error code in gfCalcPropDays : "+errorCode);
return errorCode;
}
public double gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) throws ITMException, SQLException
{
System.out.println("Calling gfGetProp(String periodCode, String empCode, String cadre, String grade, String paysite, String paytable, String setDefault, Connection conn) of AdmCommon");
......@@ -3993,7 +3993,7 @@ public class AdmCommon
double amount = 0;
try {
monthCode = Integer.parseInt(checkInt(utilMethods.mid(periodCode, 5, 2)));
if(setDefault == null)
{
setDefault = "N";
......@@ -4008,7 +4008,7 @@ public class AdmCommon
setDefault = "N";
}
// Piyush - 26/08/2019.End
sql = "select fr_date, to_date from period where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
......@@ -4087,7 +4087,7 @@ public class AdmCommon
}
break;
}
count = 0;
sql = "select count(*) as count from grade_mthad where pay_table = ? " +
" and grade_code = ? and month_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " +
......@@ -4145,7 +4145,7 @@ public class AdmCommon
}
break;
}
count = 0;
sql = "select count(*) as count from cadre_mthad where pay_table = ? and cadre_code = ? and month_code = ? " +
" and ad_code = ? and eff_date <= ? and exp_date >= ? and amount is not null and type = 'F'";
......@@ -4202,7 +4202,7 @@ public class AdmCommon
}
break;
}
count = 0;
sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ? and eff_date <= ? and exp_date >= ? " +
" and confirmed = 'Y' and type='F' and amount is not null";
......@@ -4255,7 +4255,7 @@ public class AdmCommon
}
break;
}
count = 0;
sql = "select count(*) as count from grade_ad where pay_table = ? and grade_code = ? and ad_code = ? and eff_date <= ? " +
" and exp_date >= ? and amount is not null and type = 'F'";
......@@ -4310,7 +4310,7 @@ public class AdmCommon
}
break;
}
count = 0;
sql = "select count(*) as count from cadre_ad where pay_table = ? and cadre_code = ? and ad_code = ? and eff_date <= ? " +
" and exp_date >= ? and amount is not null and type = 'F'";
......@@ -4445,7 +4445,7 @@ public class AdmCommon
return amount;
}
public LinkedHashMap gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) throws ITMException, SQLException
{
System.out.println("Calling gfGetStatStanPayTable(String deptCode, String siteCode, String stanCodeHQ, String payTable, Connection conn) of AdmCommon");
......@@ -4477,7 +4477,7 @@ public class AdmCommon
pstmt.close();
pstmt = null;
}
sql = "select pay_table from site_stan_paytbl where site_code = ? and state_code = ? and stan_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
......@@ -4520,7 +4520,7 @@ public class AdmCommon
}
System.out.println("value of pay_table in site_stan_paytbl :: ["+lsPayTable+"]");
}
}
catch (Exception e) {
retVal = -1;
......@@ -4649,7 +4649,7 @@ public class AdmCommon
flag = "N";
if(count == 0)
{
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql);
......@@ -4680,12 +4680,12 @@ public class AdmCommon
pstmt = null;
}
System.out.println("holDataAll map :: ["+holDataAll+"]");
}
else
{
sql = "select hol_tblno__fr ,hol_tblno__to, eff_date from emp_employ_events where emp_code = ? " +
" and trans_type = 'H' and confirmed = 'Y' order by eff_date asc ";
" and trans_type = 'H' and confirmed = 'Y' order by eff_date asc ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
resultSet = pstmt.executeQuery();
......@@ -4694,11 +4694,11 @@ public class AdmCommon
holTblNoFr = checkNull(resultSet.getString("hol_tblno__fr"));
holTblNoTo = checkNull(resultSet.getString("hol_tblno__to"));
effDateTm = resultSet.getTimestamp("eff_date");
tempFr = frDateTm;
do {
if(count == 1)
{
if(effDateTm.after(frDateTm))
......@@ -4710,8 +4710,8 @@ public class AdmCommon
{
flag = "Y";
tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime());
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql);
......@@ -4719,7 +4719,8 @@ public class AdmCommon
pstmt.setTimestamp(2, frDateTm);
pstmt.setTimestamp(3, toDateTm);
resultSet = pstmt.executeQuery();
while(resultSet.next()) {
while(resultSet.next())
{
holData = new HashMap();
holDate = resultSet.getTimestamp("hol_date");
holDateStr = sdf.format(holDate);
......@@ -4749,12 +4750,12 @@ public class AdmCommon
{
holDataAll.put(key, holDataAll1.get(key));
}
}
else
{
tempTo = new Timestamp(utilMethods.RelativeDate(effDate, -1).getTime());
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql);
......@@ -4792,7 +4793,7 @@ public class AdmCommon
{
holDataAll.put(key, holDataAll1.get(key));
}
}
tempFr1 = effDateTm;
tempTo1 = toDateTm;
......@@ -4814,7 +4815,7 @@ public class AdmCommon
if(tempFrDate1.before(toDate) || tempFrDate1.equals(toDate))
{
flag = "Y";
if(effDate.after(FrDate) || effDate.equals(FrDate))
{
tempFr = tempFr1;
......@@ -4835,7 +4836,7 @@ public class AdmCommon
{
holTblNo1 = holTblNoFr;
}
sql = "SELECT hol_date, hol_type, no_days, hol_tblno FROM holiday WHERE (( hol_tblno = ? ) AND " +
"( hol_date between ? and ? ) AND (hol_type = 'W')) ";
pstmt = conn.prepareStatement(sql);
......@@ -4902,7 +4903,7 @@ public class AdmCommon
}
}
}
}
else
{
......@@ -5003,7 +5004,7 @@ public class AdmCommon
}
break;
}while(true);
returnMap.put("holiday", holDataAll);
returnMap.put("errorcode", errorCode);
}
......@@ -5056,48 +5057,141 @@ public class AdmCommon
{
pstmt = conn.prepareStatement(sqlstr);
sqlInput = msqlinput.split(",");
if(sqlInput.length == 0)
{
errorCode = "CONFERR";
}
else
//Modified By Poonam B[19/11/2019][START]
//if(sqlInput.length == 0)
if(sqlInput.length > 0)
{
/*errorCode = "CONFERR";
}*/
/*else
{*/
//Modified By Poonam B[19/11/2019][END]
for(int ctr = 0; ctr < sqlInput.length; ctr++)
{
counter++;
input = sqlInput[ctr];
if(input != null && input.trim().length() > 0)
{
Object obj = dwobject.get(input);
inputType = getHashMapValType(obj);
if(inputType.contains("String"))
{
pstmt.setString(counter, obj.toString());
}
else if(inputType.contains("Double"))
{
pstmt.setDouble(counter, Double.parseDouble(checkInt(obj.toString())));
}
else if(inputType.contains("Integer"))
{
pstmt.setInt(counter, Integer.parseInt(checkInt(obj.toString())));
}
else if(inputType.contains("Timestamp") || inputType.contains("Date"))
{
localTm = Timestamp.valueOf(genericUtility.getValidDateString(obj.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter, localTm);
}
else
{
errorCode = "CONFIGUREERR";
}
}
}
rs = pstmt.executeQuery();
String resultType = rs.getMetaData().getColumnTypeName(1);
if(resultType.equalsIgnoreCase("NUMBER"))
{
if(rs.next())
//Added By Poonam B[19/11/2019][START]
System.out.println("input::::"+input);
System.out.println("inputType::::"+inputType);
System.out.println("msqlinput::::"+msqlinput);
System.out.println("sqlstr::::"+sqlstr);
if(inputType == null || inputType.trim().length() == 0)
{
if((input != null &&input.trim().length() >= 3) && (input.startsWith(":S") || input.startsWith(":N") || input.startsWith(":D")))
{
if(input.startsWith(":S"))
{
String value = input.substring(2);
try
{
int pos1 = Integer.parseInt(value)-1;
String data = (String) envVarStr.get(pos1);
pstmt.setString(counter, data);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else if(input.startsWith(":N"))
{
String value = input.substring(2);
try
{
int pos1 = Integer.parseInt(value)-1;
double data = (double) envVarNum.get(pos1);
pstmt.setDouble(counter, data);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else if(input.startsWith(":D"))
{
String dateStr = input.substring(2);
try
{
int pos1 = Integer.parseInt(dateStr)-1;
Timestamp date1 = (Timestamp) envVarDate.get(pos1);
Timestamp date = Timestamp.valueOf(genericUtility.getValidDateString(date1.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter,date);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else
{
errorCode = "CONFIGUREERR";
break;
}
}
else
{
pstmt.setString(counter, input);
}
}
else
{
//Added By Poonam B[18/11/2019][END]
if(inputType.contains("String"))
{
pstmt.setString(counter, obj.toString());
}
else if(inputType.contains("Double"))
{
pstmt.setDouble(counter, Double.parseDouble(checkInt(obj.toString())));
}
else if(inputType.contains("Integer"))
{
pstmt.setInt(counter, Integer.parseInt(checkInt(obj.toString())));
}
else if(inputType.contains("Timestamp") || inputType.contains("Date"))
{
localTm = Timestamp.valueOf(genericUtility.getValidDateString(obj.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter, localTm);
}
else
{
errorCode = "CONFIGUREERR";
break; //Added By Poonam B on[19/11/2019]
}
}
}
//Added By Poonam B on[19/11/2019][START]
if(errorCode != null && errorCode.trim().length() > 0)
{
break;
}
//Added By Poonam B on[19/11/2019][END]
}
}
//Modified By Poonam B on[19/11/2019][START]
if(errorCode == null || errorCode.trim().length() == 0)
{
rs = pstmt.executeQuery();
String resultType = rs.getMetaData().getColumnTypeName(1);
if(resultType.equalsIgnoreCase("NUMBER"))
{
if(rs.next())
{
outputSql = rs.getDouble(1);
}
......@@ -5117,13 +5211,29 @@ public class AdmCommon
pstmt = null;
}
}
//Modified By Poonam B on[19/11/2019][END]
returnMap.put("errorcode", errorCode);
returnMap.put("value", outputSql);
}
//Added By Poonam B on[19/11/2019][START]
catch(SQLException e)
{
e.printStackTrace();
errorCode = "SQLERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
//Added By Poonam B on[19/11/2019][END]
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
//Modified By Poonam B[18/11/2019][START]
//throw new ITMException(e);
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
//Modified By Poonam B[18/11/2019][END]
}
finally
{
......@@ -5139,10 +5249,17 @@ public class AdmCommon
}
}
System.out.println("returnMap in gfGetResSqlNvo:: "+returnMap);
//Added By Poonam B on[19/11/2019][START][To fetch sql Error]
if(errorCode != null && errorCode.trim().length() > 0)
{
String errStr = (String) returnMap.get("errorcode");
errStr = errStr +"[SQL : " +sqlstr+ "]" + "[SQL INPUT : " +msqlinput+ "]";
returnMap.put("errorcode", errStr);
}
//Added By Poonam B on[19/11/2019][END][To fetch sql Error]
return returnMap;
}
public String getHashMapValType(Object obj) throws ITMException
{
Class cls = null;
......@@ -5166,7 +5283,7 @@ public class AdmCommon
}
return type;
}
public LinkedHashMap gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) throws ITMException, SQLException
{
System.out.println("Calling gfSetEnvVarNvo(String prdCode, String className, ArrayList envVarStr, ArrayList envVarDate, ArrayList envVarNum, Connection conn) of AdmCommon");
......@@ -5230,61 +5347,61 @@ public class AdmCommon
return returnMap;
}
//Ended by Varsha V on 17-07-19
//Added by Jaffar for interest calculation [Start]
public double gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) throws ITMException
{
System.out.println("Calling gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) of AdmCommon");
//Connection conn = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
String lsMethod = "";
double lcAmount = 0.0;
try
{
System.out.println("Inside gbfCalcInterest method of AdmCommon");
sql = "select cal_base from interestterm where int_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mintterm);
rs = pstmt.executeQuery();
if(rs.next())
{
lsMethod = checkNull(rs.getString("cal_base"));
System.out.println("sql = "+sql+" "+mintterm+" \nls_method is == "+lsMethod);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
public double gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) throws ITMException
{
System.out.println("Calling gbfCalcInterest(String mintterm, double mnoDays, double mintPerc, double mbalAmt,Connection conn) of AdmCommon");
//Connection conn = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
String lsMethod = "";
double lcAmount = 0.0;
if("R".equalsIgnoreCase(lsMethod) || "E".equalsIgnoreCase(lsMethod))
{
lcAmount = mbalAmt * ( mintPerc / 100 ) * ( mnoDays / 365 );
System.out.println("lc_amount = "+lcAmount);
}
else
{
return -1;
}
try
{
System.out.println("Inside gbfCalcInterest method of AdmCommon");
sql = "select cal_base from interestterm where int_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mintterm);
rs = pstmt.executeQuery();
if(rs.next())
{
lsMethod = checkNull(rs.getString("cal_base"));
System.out.println("sql = "+sql+" "+mintterm+" \nls_method is == "+lsMethod);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception in InterestProcess gbf_emploan_int_proc "+ e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
if("R".equalsIgnoreCase(lsMethod) || "E".equalsIgnoreCase(lsMethod))
{
lcAmount = mbalAmt * ( mintPerc / 100 ) * ( mnoDays / 365 );
System.out.println("lc_amount = "+lcAmount);
}
else
{
return -1;
}
}
finally
{
}
catch (Exception e)
{
System.out.println("Exception in InterestProcess gbf_emploan_int_proc "+ e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
......@@ -5303,206 +5420,206 @@ public class AdmCommon
d.printStackTrace();
throw new ITMException(d);
}
}
System.out.println("lcAmount ======= > "+lcAmount);
return Math.round(lcAmount);
}
//Added by Jaffar for interest calculation [End]
//Added by Jaffar for sorting Map[Start]
public static Map sortMap(HashMap argMap)
{
TreeMap treeMap = new TreeMap();
treeMap.putAll(argMap);
Map retMap = new HashMap();
retMap.putAll(treeMap);
return retMap;
}
}
System.out.println("lcAmount ======= > "+lcAmount);
return Math.round(lcAmount);
}
//Added by Jaffar for interest calculation [End]
//Added by Jaffar for sorting Map[Start]
public static Map sortMap(HashMap argMap)
{
TreeMap treeMap = new TreeMap();
treeMap.putAll(argMap);
Map retMap = new HashMap();
retMap.putAll(treeMap);
return retMap;
}
//Added by Jaffar [End]
public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{
System.out.println("Calling gfGetRndAmt(double unrAmt, String rndOff, double rndTo) of AdmCommon");
double retVal = 0;
double lcMultiply = 1;
UtilMethods utilMethods = new UtilMethods();
try
{
if(unrAmt < 0)
{
lcMultiply = -1;
unrAmt = Math.abs(unrAmt);
}
else if(unrAmt == 0)
{
return unrAmt;
}
else if("N".equalsIgnoreCase(rndOff))
{
return unrAmt;
}
else if(rndTo == 0) {
return unrAmt;
}
if("X".equalsIgnoreCase(rndOff))
{
if(utilMethods.mod(unrAmt, rndTo) > 0)
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
}
else
{
retVal = unrAmt;
}
}
else if("P".equalsIgnoreCase(rndOff))
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
}
else if("R".equalsIgnoreCase(rndOff))
{
if(utilMethods.mod(unrAmt, rndTo) < rndTo/2)
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
}
else
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
}
}
else
{
retVal = unrAmt;
}
retVal = retVal * lcMultiply;
}
catch(Exception e)
{
throw new ITMException(e);
}
System.out.println("retVal in gfGetRndAmt:: "+retVal);
return retVal;
}
public double gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) throws SQLException, ITMException
{
System.out.println("Calling gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) of AdmCommon");
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
double mminbamt = 0d;
double mmaxbamt = 0d;
double mamount = 0d;
double mminamt = 0d;
double mmaxamt = 0d;
String type = "";
double retval = 0;
double applyamt = 0d;
try
{
sql = "select min_base_amt, max_base_amt,amount,type,min_amt,max_amt from ad_slabs where ad_code = ? and eff_date <= ? " +
"and exp_date >= ? order by slab_no";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adcode);
pstmt.setTimestamp(2, mdate);
pstmt.setTimestamp(3, mdate);
rs = pstmt.executeQuery();
while(rs.next())
{
mminbamt = rs.getDouble("min_base_amt");
mmaxbamt = rs.getDouble("max_base_amt");
mamount = rs.getDouble("amount");
type = rs.getString("type");
mminamt = rs.getDouble("min_amt");
mmaxamt = rs.getDouble("max_amt");
applyamt = baseamt;
do {
if(slabopt.equalsIgnoreCase("D"))
{
if(slabamt >= mminbamt && slabamt <= mmaxbamt)
{
if("P".equalsIgnoreCase(type))
{
retval = applyamt * mamount / 100;
}
else
{
retval = mamount;
}
if(mminamt > 0 && retval < mminamt)
retval = mminamt;
if(mmaxamt > 0 && retval > mmaxamt)
retval = mmaxamt;
break;
}
}
else
{
if(mmaxbamt <= slabamt)
{
if("P".equalsIgnoreCase(type))
{
retval = retval + ((mmaxbamt - mminbamt+1) * mamount / 100);
}
else
{
retval = retval + mamount;
}
applyamt = applyamt - (mmaxbamt - mminbamt + 1);
}
else if(mminbamt <= slabamt)
{
if("P".equalsIgnoreCase(type))
{
retval = retval + (applyamt * mamount / 100);
}
else
{
retval = retval + mamount;
}
break;
}
else
{
break;
}
}
}while(true);
}
if (rs != null)
{
public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{
System.out.println("Calling gfGetRndAmt(double unrAmt, String rndOff, double rndTo) of AdmCommon");
double retVal = 0;
double lcMultiply = 1;
UtilMethods utilMethods = new UtilMethods();
try
{
if(unrAmt < 0)
{
lcMultiply = -1;
unrAmt = Math.abs(unrAmt);
}
else if(unrAmt == 0)
{
return unrAmt;
}
else if("N".equalsIgnoreCase(rndOff))
{
return unrAmt;
}
else if(rndTo == 0) {
return unrAmt;
}
if("X".equalsIgnoreCase(rndOff))
{
if(utilMethods.mod(unrAmt, rndTo) > 0)
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
}
else
{
retVal = unrAmt;
}
}
else if("P".equalsIgnoreCase(rndOff))
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
}
else if("R".equalsIgnoreCase(rndOff))
{
if(utilMethods.mod(unrAmt, rndTo) < rndTo/2)
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo);
}
else
{
retVal = unrAmt - utilMethods.mod(unrAmt, rndTo) + rndTo;
}
}
else
{
retVal = unrAmt;
}
retVal = retVal * lcMultiply;
}
catch(Exception e)
{
throw new ITMException(e);
}
System.out.println("retVal in gfGetRndAmt:: "+retVal);
return retVal;
}
public double gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) throws SQLException, ITMException
{
System.out.println("Calling gfGetSlabAmt(String adcode, Timestamp mdate, String slabopt, double slabamt, double baseamt, Connection conn) of AdmCommon");
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
double mminbamt = 0d;
double mmaxbamt = 0d;
double mamount = 0d;
double mminamt = 0d;
double mmaxamt = 0d;
String type = "";
double retval = 0;
double applyamt = 0d;
try
{
sql = "select min_base_amt, max_base_amt,amount,type,min_amt,max_amt from ad_slabs where ad_code = ? and eff_date <= ? " +
"and exp_date >= ? order by slab_no";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adcode);
pstmt.setTimestamp(2, mdate);
pstmt.setTimestamp(3, mdate);
rs = pstmt.executeQuery();
while(rs.next())
{
mminbamt = rs.getDouble("min_base_amt");
mmaxbamt = rs.getDouble("max_base_amt");
mamount = rs.getDouble("amount");
type = rs.getString("type");
mminamt = rs.getDouble("min_amt");
mmaxamt = rs.getDouble("max_amt");
applyamt = baseamt;
do {
if(slabopt.equalsIgnoreCase("D"))
{
if(slabamt >= mminbamt && slabamt <= mmaxbamt)
{
if("P".equalsIgnoreCase(type))
{
retval = applyamt * mamount / 100;
}
else
{
retval = mamount;
}
if(mminamt > 0 && retval < mminamt)
retval = mminamt;
if(mmaxamt > 0 && retval > mmaxamt)
retval = mmaxamt;
break;
}
}
else
{
if(mmaxbamt <= slabamt)
{
if("P".equalsIgnoreCase(type))
{
retval = retval + ((mmaxbamt - mminbamt+1) * mamount / 100);
}
else
{
retval = retval + mamount;
}
applyamt = applyamt - (mmaxbamt - mminbamt + 1);
}
else if(mminbamt <= slabamt)
{
if("P".equalsIgnoreCase(type))
{
retval = retval + (applyamt * mamount / 100);
}
else
{
retval = retval + mamount;
}
break;
}
else
{
break;
}
}
}while(true);
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if (rs != null)
{
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("retval in gfGetSlabAmt:: "+retval);
return retval;
}
}
}
System.out.println("retval in gfGetSlabAmt:: "+retval);
return retval;
}
}
......@@ -1113,6 +1113,15 @@ public class AllowDednSalComp
retMap = null;
// Modified by Piyush on 07/09/2019 [to create all ad code maps for select in formula].Start
// retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), argEmpDataMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
//Added By Poonam B[18/11/2019][START]
System.out.println("strResFormula::::" +strResFormula);
System.out.println("SQL_INPUT::::" +adMap.get("SQL_INPUT").toString());
System.out.println("allInputMap::::" +allInputMap);
System.out.println("argStrVars::::" +argStrVars);
System.out.println("argStrDate::::" +argStrDate);
System.out.println("argDblVars::::" +argDblVars);
System.out.println("argConn:::::" +argConn);
//Added By Poonam B[18/11/2019][END]
retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), allInputMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
if(retMap.containsKey("errorcode"))
{
......
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