Commit f16dac1b authored by dpingle's avatar dpingle

* Dipesh Updated src file on [04/09/19]

EmpMthadIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@206788 ce508802-f39f-4f6c-b175-0d175dae99d5
parent dc3538f8
...@@ -4,6 +4,7 @@ import java.rmi.RemoteException; ...@@ -4,6 +4,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -24,7 +25,6 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -24,7 +25,6 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException String xtraParams) throws RemoteException, ITMException
{ {
System.out.println(xmlString); System.out.println(xmlString);
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
...@@ -375,39 +375,47 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -375,39 +375,47 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
} }
else if ("min_basic".equalsIgnoreCase(childNodeName)) else if ("min_basic".equalsIgnoreCase(childNodeName))
{ {
minBasic = Double.parseDouble(checkNull(genericUtility.getColumnValue("min_basic",dom))); //Aded by varsha on 31 July 2019 [START]
if(minBasic == 0 || minBasic < 0) minBasic = Double.parseDouble(checkInt(genericUtility.getColumnValue("min_basic",dom)));
if(genericUtility.getColumnValue("min_basic",dom) == null || minBasic < 0)
{ {
errList.add("VMPAYSTR01"); errList.add("VMPAYSTR01");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Aded by varsha on 31 July 2019 [END]
} }
else if ("max_basic".equalsIgnoreCase(childNodeName)) else if ("max_basic".equalsIgnoreCase(childNodeName))
{ {
maxBasic = Double.parseDouble(checkNull(genericUtility.getColumnValue("max_basic",dom))); //Aded by varsha on 31 July 2019 [START]
if(maxBasic == 0 || maxBasic < 0) maxBasic = Double.parseDouble(checkInt(genericUtility.getColumnValue("max_basic",dom)));
if(genericUtility.getColumnValue("max_basic",dom) == null || maxBasic < 0)
{ {
errList.add("VMPAYSTR02"); errList.add("VMPAYSTR02");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Aded by varsha on 31 July 2019 [END]
} }
else if ("min_amt".equalsIgnoreCase(childNodeName)) else if ("min_amt".equalsIgnoreCase(childNodeName))
{ {
minAmt = Double.parseDouble(checkNull(genericUtility.getColumnValue("min_amt",dom))); //Aded by varsha on 31 July 2019 [START]
if(minAmt == 0 || minAmt < 0) minAmt = Double.parseDouble(checkInt(genericUtility.getColumnValue("min_amt",dom)));
if(genericUtility.getColumnValue("min_amt",dom) == null || minAmt < 0)
{ {
errList.add("VMPAYSTR03"); errList.add("VMPAYSTR03");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Aded by varsha on 31 July 2019 [END]
} }
else if ("max_amt".equalsIgnoreCase(childNodeName)) else if ("max_amt".equalsIgnoreCase(childNodeName))
{ {
maxAmt = Double.parseDouble(checkNull(genericUtility.getColumnValue("max_amt",dom))); //Aded by varsha on 31 July 2019 [START]
if(maxAmt == 0 || maxAmt < 0) maxAmt = Double.parseDouble(checkInt(genericUtility.getColumnValue("max_amt",dom)));
if(genericUtility.getColumnValue("max_amt",dom) == null || maxAmt < 0)
{ {
errList.add("VMPAYSTR04"); errList.add("VMPAYSTR04");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Aded by varsha on 31 July 2019 [END]
} }
} }
break; break;
...@@ -541,10 +549,22 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -541,10 +549,22 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
String paySite = ""; String paySite = "";
AdmCommon admCommon = new AdmCommon(); AdmCommon admCommon = new AdmCommon();
// Modified By Sana s on 25/07/2019 [start]
String effDateStr="";
Timestamp joinDate = null, effDate = null;
String empName = "";
String todayDate ="";
Timestamp todayTm= null;
long cnt = 0;
SimpleDateFormat sdf = null;
String entryMode = "E";
// Modified By Sana s on 25/07/2019 [end]
try try
{ {
genericUtility = new E12GenericUtility(); genericUtility = new E12GenericUtility();
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());/////////////////
System.out.println("currentFormNo...." + currentFormNo); System.out.println("currentFormNo...." + currentFormNo);
conn = getConnection(); conn = getConnection();
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
...@@ -565,16 +585,25 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -565,16 +585,25 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
{ {
empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "emp_code"); empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "emp_code");
monthCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "month_code"); monthCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "month_code");
// Modified By Sana S on 25/07/2019 [start]
sql="select pay_site as pay_site from employee where emp_code =?"; //sql="select pay_site as pay_site from employee where emp_code =?";
sql="select date_join, FN_GET_EMP_NAME(?,'FL1') as emp_name,pay_site from employee where emp_code= ?";
// Modified By Sana S on 25/07/2019 [start]
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
paySite = rs.getString("pay_site"); paySite = rs.getString("pay_site");
// Modified By Sana S on 25/07/2019 [start]
joinDate = rs.getTimestamp("date_join");
empName = rs.getString("emp_name");
// Modified By Sana S on 25/07/2019 [start]
} }
System.out.println("date_join ["+joinDate+"]\t emp_name ["+empName+"]");
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
...@@ -616,14 +645,67 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -616,14 +645,67 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
lsVarValue = admCommon.getEnv("999999", "AD_EFFDATE", conn); lsVarValue = admCommon.getEnv("999999", "AD_EFFDATE", conn);
System.out.println("lsVarValue==["+lsVarValue+"]"); System.out.println("lsVarValue==["+lsVarValue+"]");
System.out.println("genericUtility.getApplDateFormat()==["+genericUtility.getApplDateFormat()+"]"); System.out.println("genericUtility.getApplDateFormat()==["+genericUtility.getApplDateFormat()+"]");
lsVarValue = genericUtility.getValidDateString(lsVarValue, genericUtility.getApplDateFormat()); //Modify by Varsha V on 30-07-19 for formating payparm date
//lsVarValue = genericUtility.getValidDateString(lsVarValue, genericUtility.getApplDateFormat());
lsVarValue = genericUtility.getValidDateString(lsVarValue,"dd-MM-yy", genericUtility.getApplDateFormat());
System.out.println("lsVarValue==after["+lsVarValue+"]"); System.out.println("lsVarValue==after["+lsVarValue+"]");
lsVarValues = admCommon.getEnv("999999", "AD_EXPDATE", conn); lsVarValues = admCommon.getEnv("999999", "AD_EXPDATE", conn);
lsVarValues = genericUtility.getValidDateString(lsVarValues, genericUtility.getApplDateFormat()); //Modify by Varsha V on 30-07-19 for formating payparm date
//lsVarValues = genericUtility.getValidDateString(lsVarValues, genericUtility.getApplDateFormat());
lsVarValues = genericUtility.getValidDateString(lsVarValues,"dd-MM-yy", genericUtility.getApplDateFormat());
valueXmlString.append("<eff_date ><![CDATA[").append(lsVarValue).append("]]></eff_date>\r\n"); valueXmlString.append("<eff_date ><![CDATA[").append(lsVarValue).append("]]></eff_date>\r\n");
valueXmlString.append("<exp_date ><![CDATA[").append(lsVarValues).append("]]></exp_date>\r\n"); valueXmlString.append("<exp_date ><![CDATA[").append(lsVarValues).append("]]></exp_date>\r\n");
//////////////
// Modified by Sana S on 25/07/2019 [Shifted outside from bellow if condition to set employee name].Start
valueXmlString.append("<emp_name>").append("<![CDATA["+empName+"]]>").append("</emp_name>");
if((effDateStr == null || effDateStr.trim().length() == 0) && "E".equalsIgnoreCase(entryMode))
{
effDateStr = todayDate;
effDate=todayTm;
System.out.println("effDateStr :::::"+ effDateStr +" effDate :::::"+ effDate);
cnt = 0;
if(joinDate != null)
{
sql = "select count(*) as count from employee_ad where emp_code = ? and eff_date > ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,joinDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
effDate= joinDate;
effDateStr= sdf.format(joinDate);
}
}
cnt = 0;
}
valueXmlString.append("<eff_date>").append("<![CDATA["+effDateStr+"]]>").append("</eff_date>");
valueXmlString.append("<pay_site>").append("<![CDATA["+paySite+"]]>").append("</pay_site>");
////Modified By Sana S on 25/07/2019 [end]
} }
else if ("ad_code".equalsIgnoreCase(currentColumn)) else if ("ad_code".equalsIgnoreCase(currentColumn))
{ {
...@@ -654,14 +736,20 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -654,14 +736,20 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
else if ("emp_code".equalsIgnoreCase(currentColumn)) else if ("emp_code".equalsIgnoreCase(currentColumn))
{ {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select pay_site as pay_site from employee where emp_code = ?"; //sql="select pay_site as pay_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql); sql = "select pay_site,date_join, FN_GET_EMP_NAME(?,'FL1') as emp_name from employee where emp_code = ?";
pstmt.setString(1, empCode); pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
paySite = rs.getString("pay_site"); paySite = rs.getString("pay_site");
// Modified By Sana S on 25/07/2019 [start] to get datejoin and empname column
joinDate= rs.getTimestamp("date_join");
empName = checkNull(rs.getString("emp_name"));
// Modified By Sana S on 25/07/2019 [end] to get datejoin and empname column
} }
if (rs != null) if (rs != null)
{ {
...@@ -788,4 +876,14 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe ...@@ -788,4 +876,14 @@ public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRe
} }
return input; return input;
} }
//Added by varsha on 31 July 2019 [START]
private String checkInt(String input)
{
if (input == null)
{
input = "0";
}
return input;
}
//Added by varsha on 31 July 2019 [END]
} }
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