Commit 96d29d40 authored by rtelang's avatar rtelang

AttdDailyPos.java

Changes made in Daily Attandance post save component 
-To reprocess the attandance after record has been deleted.



git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@201600 ce508802-f39f-4f6c-b175-0d175dae99d5
parent adcbc2e1
...@@ -20,6 +20,7 @@ import java.util.Calendar; ...@@ -20,6 +20,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.StringTokenizer;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.rpc.ParameterMode; import javax.xml.rpc.ParameterMode;
...@@ -76,6 +77,15 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att ...@@ -76,6 +77,15 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
String prdCode = ""; String prdCode = "";
String procWindow = ""; String procWindow = "";
int addOnDays = 0; int addOnDays = 0;
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String currDbId = "";
int detailListLength = 0;
String delim = ":";
ArrayList tokens = null;
boolean isReproc = false;
String shiftStr = "";
String shift = "";
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][END] //Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][END]
int cnt = 0; int cnt = 0;
try try
...@@ -96,7 +106,36 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att ...@@ -96,7 +106,36 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
prevOutTime = checkNullAndTrim(genericUtility.getColumnValue("prev_out_time",headerDom)); prevOutTime = checkNullAndTrim(genericUtility.getColumnValue("prev_out_time",headerDom));
newOutTime = checkNullAndTrim(genericUtility.getColumnValue("out_time",headerDom)); newOutTime = checkNullAndTrim(genericUtility.getColumnValue("out_time",headerDom));
punchStr = checkNullAndTrim(genericUtility.getColumnValue("punch_str",headerDom)); punchStr = checkNullAndTrim(genericUtility.getColumnValue("punch_str",headerDom));
//Modified by Rohini T on [20/05/19][start]
shiftStr = checkNullAndTrim(genericUtility.getColumnValue("shift",headerDom));
if("D".equalsIgnoreCase(editFlag))
{
toUpdate = false;
isReproc = true;
detailList = headerDom.getElementsByTagName("Detail1");
currDetail = detailList.item(0);
currDbId = currDetail.getAttributes().getNamedItem("dbID").getNodeValue();
tokens = new ArrayList();
StringTokenizer st = new StringTokenizer(currDbId, delim);
while(st.hasMoreTokens())
{
tokens.add(st.nextToken());
}
if(tokens.size() > 2)
{
empCode = (String) tokens.get(0);
attdDateStr = (String) tokens.get(1);
attdDateStr = genericUtility.getValidDateString(attdDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
attdDate = java.sql.Timestamp.valueOf(attdDateStr + " 00:00:00");
}
}
else if("A".equalsIgnoreCase(editFlag))
{
toUpdate = true;
isReproc = false;
}
else if("E".equalsIgnoreCase(editFlag))
{
if (!prevInTime.equalsIgnoreCase(newInTime)) if (!prevInTime.equalsIgnoreCase(newInTime))
{ {
punchStr = "*-" + newInTime + "," + punchStr; punchStr = "*-" + newInTime + "," + punchStr;
...@@ -111,10 +150,44 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att ...@@ -111,10 +150,44 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
punchStr = punchStr + "*-" + newOutTime; punchStr = punchStr + "*-" + newOutTime;
toUpdate = true; toUpdate = true;
} }
if (toUpdate)
{
attdDateStr = genericUtility.getValidDateString(attdDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); attdDateStr = genericUtility.getValidDateString(attdDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
attdDate = java.sql.Timestamp.valueOf(attdDateStr + " 00:00:00"); attdDate = java.sql.Timestamp.valueOf(attdDateStr + " 00:00:00");
sql = "SELECT SHIFT FROM ATTENDANCE_DAY WHERE EMP_CODE = ? AND ATTD_DATE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,attdDate);
rs = pstmt.executeQuery();
if (rs.next())
{
shift = rs.getString("SHIFT");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(!(shiftStr.equalsIgnoreCase(shift)) )
{
toUpdate = false;
isReproc = true;
}
}
//Modified by Rohini T on [20/05/19][end]
if (toUpdate)
{
//Modified by Rohini T on [29/05/19][start]
/*attdDateStr = genericUtility.getValidDateString(attdDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
attdDate = java.sql.Timestamp.valueOf(attdDateStr + " 00:00:00");*/
//Modified by Rohini T on [29/05/19][end]
sql = "UPDATE ATTENDANCE_DAY SET PUNCH_STR = ? WHERE EMP_CODE = ? AND ATTD_DATE = ?"; sql = "UPDATE ATTENDANCE_DAY SET PUNCH_STR = ? WHERE EMP_CODE = ? AND ATTD_DATE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1 , punchStr); pstmt.setString(1 , punchStr);
...@@ -130,6 +203,7 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att ...@@ -130,6 +203,7 @@ public class AttdDailyPos extends ValidatorEJB implements AttdDailyPosLocal, Att
} }
//Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][START] //Modified by Rohini Telang on 12/feb/2019[Req ID: A17DSUN001][START]
System.out.println("toUpdate---["+toUpdate+"]"); System.out.println("toUpdate---["+toUpdate+"]");
System.out.println("isReproc---["+isReproc+"]");
//Modified by Azhar K. commented on 26/APR/2019[Req ID: A17DSUN001][Start] //Modified by Azhar K. commented on 26/APR/2019[Req ID: A17DSUN001][Start]
/*if (toUpdate) /*if (toUpdate)
{*/ {*/
......
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