Commit 9479bc22 authored by sanashaikh's avatar sanashaikh

Sana S: Modified on 12/03/20

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217798 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 97b973e4
......@@ -139,7 +139,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if(rtrStr == null || rtrStr.trim().length() == 0)
{
conn.commit();
rtrStr = itmDBAccess.getErrorString("","VTPCOMPT","","",conn);// Added by sana s on 25/02/2020
}
else
{
......@@ -268,9 +267,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String holiTblNo =null;
int selectedLineNo = 0;
//added by Sana S on [18/09/2019]
//SimpleDateFormat sdf1= new SimpleDateFormat("dd-MM-yy");
ArrayList<EmpInfo> empList = new ArrayList<EmpInfo>();
HashMap empEventsMap = new HashMap();
int shiftIndexFr = 0;//Added by jaimin on 16/06/2008 (AD89SUN014)
......@@ -422,7 +418,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//getting date in sql date and dbdate format
String strFrDate = genericUtility.getValidDateString(fromDate,genericUtility.getApplDateFormat(),genericUtility.getApplDateFormat());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
// SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy");// Modified by Sana s o 18/09/2019
System.out.println("FromDate in DbDate Format :["+strFrDate+"]");
String strToDate = genericUtility.getValidDateString(toDate,genericUtility.getApplDateFormat(),genericUtility.getApplDateFormat());
System.out.println("To Date in Db Date Format:["+strToDate+"]");
......@@ -440,14 +435,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println(""
+ ""+toSqlDate+"]");
// added by sana s on 25/02/2020 [start]
sDateFr=sdf1.format(frSqlDate);
dateFr=java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sDateFr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
sDateTo=sdf1.format(toSqlDate);
dateTo=java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sDateFr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
//added by sana s on 25/02/2020 [end]
//end getting dates in sqldate and dbdate format
if (siteCodeFr != null )
{
//query changed by msalam on 170308 as it was unnecessary to call the query repeteadly
......@@ -478,18 +465,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pStmt = conn.prepareStatement( getDataSql );
System.out.print("Parameters 1:: [" + frSqlDate+"]");
//pStmt.setDate( 1, frSqlDate );
//Modified by Sana S on 25/02/2020 [start]
pStmt.setTimestamp( 1, dateFr);
//Modified by Sana S on 25/02/2020 [end]
pStmt.setDate( 1, frSqlDate );
// Modified by Piyush on 31/10/2012 [for not to fetch those employee whose joining date is beyound shift to date specified in argument].Start
System.out.print("Parameters 1-1:: [" + toSqlDate+"]");
//pStmt.setDate( 2, toSqlDate );
//Modified by Sana S on 25/02/2020 [start]
pStmt.setTimestamp( 2, dateTo);
//Modified by Sana S on 25/02/2020 [end]
pStmt.setDate( 2, toSqlDate );
// Modified by Piyush on 31/10/2012 [for not to fetch those employee whose joining date is beyound shift to date specified in argument].End
rsn1 = pStmt.executeQuery( );
......@@ -570,7 +549,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
reliDate = empInfo.relieveDate;
System.out.print("reliDate:"+reliDate);
System.out.print("Compare date result>>>>>"+reliDate.compareTo(toSqlDate));
//System.out.print("Compare date result>>>>>"+reliDate.compareTo(toSqlDate));
if(reliDate != null && reliDate.compareTo(toSqlDate) < 0)
{
toSqlDate = (java.sql.Date)reliDate;
......@@ -580,12 +559,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
updateSql = "UPDATE WORK_SHIFT SET TO_DT = ? WHERE EMP_CODE = '"+emp+"' "+
"AND ? BETWEEN FROM_DT AND TO_DT ";
pstmtTemp = conn.prepareStatement(updateSql);
//Modified By Sana S on 18/09/2019 [start]
/*pstmtTemp.setDate( 1, toSqlDate );
pstmtTemp.setDate( 2, toSqlDate );*/
pstmtTemp.setTimestamp( 1, dateTo );
pstmtTemp.setTimestamp( 2, dateTo);
//Modified By Sana S on 18/09/2019 [end]
pstmtTemp.setDate( 1, toSqlDate );
pstmtTemp.setDate( 2, toSqlDate );
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -597,8 +572,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
updateSql = "DELETE FROM WORK_SHIFT WHERE EMP_CODE = '"+emp+"' "+
"AND FROM_DT > ? ";
pstmtTemp = conn.prepareStatement(updateSql);
//pstmtTemp.setDate( 1, toSqlDate );
pstmtTemp.setTimestamp( 1, dateTo); //Modified By Sana S on 18/09/2019
pstmtTemp.setDate( 1, toSqlDate );
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -642,12 +616,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
updateSql = "UPDATE WORK_SHIFT SET TO_DT = ? WHERE EMP_CODE = '"+emp+"' "+
"AND ? BETWEEN FROM_DT AND TO_DT AND FROM_DT <> ? ";
pstmtTemp = conn.prepareStatement(updateSql);
//pstmtTemp.setDate( 1, prevFrDate );
pstmtTemp.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(prevFrDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())) );// Modified By Sana S on 18/09/2019
//pstmtTemp.setDate( 2, frSqlDate );
pstmtTemp.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())) );// Modified By Sana S on 18/09/2019
//pstmtTemp.setDate( 3, frSqlDate );
pstmtTemp.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate ),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
pstmtTemp.setDate( 1, prevFrDate );
pstmtTemp.setDate( 2, frSqlDate );
pstmtTemp.setDate( 3, frSqlDate );
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -662,15 +633,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
updateSql = "UPDATE WORK_SHIFT SET FROM_DT = ? WHERE EMP_CODE = '"+emp+"' "+
"AND ? BETWEEN FROM_DT AND TO_DT AND TO_DT <> ? ";
pstmtTemp = conn.prepareStatement(updateSql);
//Modified By Sana S on 18/09/2019[start]
/*pstmtTemp.setDate( 1, nextToDate );
pstmtTemp.setDate( 1, nextToDate );
pstmtTemp.setDate( 2, toSqlDate );
pstmtTemp.setDate( 3, toSqlDate );*/
pstmtTemp.setDate( 3, toSqlDate );
pstmtTemp.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(nextToDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtTemp.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtTemp.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//Modified By Sana S on 18/09/2019[end]
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -689,16 +655,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("sql :"+sql);
pstmtn2 = conn.prepareStatement(sql);
pstmtn2.setString(1,emp);
//pstmtn2.setDate(2,frSqlDate);
pstmtn2.setTimestamp(2,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
pstmtn2.setDate(2,frSqlDate);
System.out.println("frSqlDate :-"+frSqlDate);
//pstmtn2.setDate(3,toSqlDate);
pstmtn2.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
pstmtn2.setDate(3,toSqlDate);
System.out.println("toSqlDate :-"+toSqlDate);
//pstmtn2.setDate(4,frSqlDate);
pstmtn2.setTimestamp(4,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
//pstmtn2.setDate(5,toSqlDate);
pstmtn2.setTimestamp(5,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
pstmtn2.setDate(4,frSqlDate);
pstmtn2.setDate(5,toSqlDate);
upd = pstmtn2.executeUpdate();
System.out.println("No Of record deleted from WORK_SHIFT ["+upd+"]");
pstmtn2.close();
......@@ -775,8 +737,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.print("Parameters 1:: [" + frSqlDate+"]");
patternPStmt = conn.prepareStatement( sql );
//patternPStmt.setDate(1,frSqlDate);
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternPStmt.setDate(1,frSqlDate);
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -831,8 +792,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
" FROM EMP_EMPLOY_EVENTS WHERE EMP_CODE = '"+emp+"' "+
"AND EFF_DATE = ? and nvl(PATTERN_CODE__TO, ' ') = '" + patternCodeFilt + "' AND NVL(CONFIRMED , 'N') = 'N'";
patternPStmt = conn.prepareStatement( sql );
//patternPStmt.setDate(1,frSqlDate);
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternPStmt.setDate(1,frSqlDate);
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -891,8 +851,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.print("Parameters 1:: [" + frSqlDate+"]");
patternPStmt = conn.prepareStatement( sql );
// patternPStmt.setDate(1,frSqlDate);
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternPStmt.setDate(1,frSqlDate);
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -916,8 +875,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
lastShiftIndexStr = "1";
}
//if(shiftStDate2.compareTo(joiningDate)< 0)
//if (edShiftDate.compareTo( frSqlDate) == 0)
if (edShiftDate.equals(sdf1.format(frSqlDate)))
if (edShiftDate.compareTo( frSqlDate) == 0)
{
isTransfrFound = true; // Modified by Prashant on [23/01/2013] [ to check whether employee is transfered or not]
if (frPatternCodeList.size() > 0)
......@@ -1111,14 +1069,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
errString = "";
}
//commented by Sana S on 25/02/2020[start]
/*else
else
{
//Commented and added by Varsha V on 20-Jul-18 for calling connection method
//errString = itmdbAccessLocal.getErrorString("","VTPCOMPT","","",conn);
errString = itmDBAccess.getErrorString("","VTPCOMPT","","",conn);
}*/
//commented by Sana S on 25/02/2020[end]
}
}
return errString;
}
......@@ -1218,7 +1175,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try
{
SimpleDateFormat sdf1 = new SimpleDateFormat( genericUtility.getApplDateFormat() );// added by Sana S on 25/02/20
stmt = conn.createStatement();
sql = "SELECT SHIFT_PATTERN, START_DATE, NO_OF_DAYS, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].start
......@@ -1332,8 +1288,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
sql = "SELECT COUNT(*) FROM WORK_SHIFT WHERE FROM_DT = ? AND SHIFT = '"+tempShift+"' AND EMP_CODE = '"+empCode+"'";
pstmtn6 = conn.prepareStatement(sql);
//pstmtn6.setDate(1, shiftStDate);
pstmtn6.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Moldified by Sana S on 18/09/2019
pstmtn6.setDate(1, shiftStDate);
System.out.println("Sql At 1444 :: " + sql);
System.out.println("PARAMETER IN UPDATE QUERY SHIFT START DATE(FROM_DT) =["+shiftStDate+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT =["+tempShift+"]");
......@@ -1357,8 +1312,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("In insert at 668 insertSql "+insertSql);
shiftStDate = shiftStDate2;
pstmtInsert.setString(1,empCode);
pstmtInsert.setTimestamp(2,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified By Sana S on 18/09/2019
pstmtInsert.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified By Sana S on 18/09/2019
pstmtInsert.setDate(2,shiftStDate);
pstmtInsert.setDate(3,shiftStDate2);
pstmtInsert.setString(4,shift);
pstmtInsert.setString(5,chgUser);
pstmtInsert.setString(6,chgTerm);
......@@ -1378,9 +1333,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("In update at 686 updateSql "+updateSql);
pstmtUpdate.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
pstmtUpdate.setDate(1,shiftStDate2);
pstmtUpdate.setString(2,empCode);
pstmtUpdate.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
pstmtUpdate.setDate(3,shiftStDate);
pstmtUpdate.executeUpdate();
pstmtUpdate.clearParameters();
pstmtUpdate.close();
......@@ -1617,8 +1572,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
sql = "SELECT COUNT(*) FROM WORK_SHIFT WHERE FROM_DT = ? AND SHIFT = '" + shift + "' AND EMP_CODE = '"+empCode+"'";
pstmtn6 = conn.prepareStatement(sql);
//next line added by msalam on 28/02/07 and modified line added.
//pstmtn6.setDate( 1, shiftStDate );
pstmtn6.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by sana s on 18/09/2019
pstmtn6.setDate( 1, shiftStDate );
//end next line added by msalam on 28/02/07 and modified line added.
//pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
System.out.println("Sql At 1365 :: " + sql);
......@@ -1649,12 +1603,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("In insert at 668 insertSql "+insertSql);
shiftStDate = shiftStDate2;
pstmtInsert.setString( 1, empCode );
//Modified by sana s on 18/09/2019
/*pstmtInsert.setString( 2, shiftStDate );
pstmtInsert.setString( 3, shiftStDate2 );*/
pstmtInsert.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtInsert.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//Modified by sana s on 18/09/2019
pstmtInsert.setDate( 2, shiftStDate );
pstmtInsert.setDate( 3, shiftStDate2 );
pstmtInsert.setString( 4, shift );
pstmtInsert.setString( 5, chgUser );
pstmtInsert.setString( 6, chgTerm );
......@@ -1679,11 +1629,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtInsert.close();
pstmtInsert=null;
//commented by Sana S on 25/02/20
/*if(insertcnt>0)
{
conn.commit();
}*/
}
//else if( cnt > 0 && shiftStDate2.compareTo( shiftStDate ) != 0 )
else if( cnt > 0 )
......@@ -1694,22 +1639,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println( "In update at 686 updateSql " + updateSql );
pstmtUpdate = conn.prepareStatement(updateSql);
//pstmtUpdate.setDate(1,shiftStDate2);
pstmtUpdate.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
pstmtUpdate.setDate(1,shiftStDate2);
pstmtUpdate.setString(2,empCode);
//pstmtUpdate.setDate(3,shiftStDate);
pstmtUpdate.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
pstmtUpdate.setDate(3,shiftStDate);
updatecnt=pstmtUpdate.executeUpdate();
System.out.print("update count:::"+updatecnt);
//pstmtUpdate.clearParameters();
pstmtUpdate.close();
pstmtUpdate=null;
}
//commented by Sana S on 25/02/20
/*if(updatecnt>0)
{
conn.commit();
}*/
if(pstmtInsert!=null)
{
pstmtInsert.close();
......@@ -1738,7 +1677,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("Holiday type for date :: " + shiftDate);
try{
SimpleDateFormat sdf = new SimpleDateFormat( genericUtility.getApplDateFormat() );//added by Sana S on 25/02/20
//sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "'";//Commentd by jaimin on 17/06/2008 (AD89SUN016)
sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "' and HOL_TYPE <> 'W' "; //Added by jaimin on 17/06/2008 (AD89SUN016)
stmt = conn.prepareStatement( sqlStr );
......
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