Commit cba45176 authored by gahmad's avatar gahmad

changes made by Pawan for following request id: AD01SUN007, AD01SUN008, AD01SUN009, AD01SUN010


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91414 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 864bfda3
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>webitm-adm</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
package ibase.webitm.ejb.adm; import java.rmi.RemoteException; import java.util.*;import java.util.Date;import java.text.*;import java.sql.*;import org.w3c.dom.*; import javax.ejb.*; import ibase.system.config.ConnDriver;import ibase.webitm.utility.ITMException;import ibase.webitm.utility.*;import ibase.webitm.ejb.*;import javax.ejb.Stateless; // added for ejb3 @Stateless // added for ejb3 public class AttendanceWorkBal extends ValidatorEJB implements AttendanceWorkBalLocal,AttendanceWorkBalRemote // SessionBean { GenericUtility genericUtility = GenericUtility.getInstance(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ConnDriver connDriver = new ConnDriver(); /* public void ejbCreate() throws RemoteException, CreateException { System.out.println("Entering into AttendancesEJB............."); } public void ejbRemove() { } public void ejbActivate() { } public void ejbPassivate() { }*/ public String wfValData() throws RemoteException,ITMException { return ""; } public String itemChanged() throws RemoteException,ITMException { return ""; } public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException { Document dom = null; Document dom1 = null; Document dom2 = null; String valueXmlString = ""; try { dom = parseString(xmlString); //returns the DOM Object for the passed XML Stirng System.out.println("xmlString :" + xmlString); dom1 = parseString(xmlString1); //returns the DOM Object for the passed XML Stirng System.out.println("xmlString1 :" + xmlString1); System.out.println("xmlString2 :" + xmlString2); if (xmlString2.trim().length() > 0 ) { dom2 = parseString(xmlString2); } valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams); } catch(Exception e) { System.out.println("Exception : [AttendancesEJB][itemChanged(String,String)] :==>\n"+e.getMessage()); } return valueXmlString; }
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException { System.out.println(" in itemChanged "); StringBuffer valueXmlString = new StringBuffer(); StringBuffer retString = new StringBuffer(); String errCode = ""; String sql = ""; String sundrySql= ""; String columnValue = ""; String loginSite = ""; String format = ""; String accPrd = ""; String childNodeName = ""; String dateStr=""; String endDateStr=""; String endTime=null; String stsrtTime=null; int childListLength=0; NodeList parentNodeList = null; NodeList childNodeList = null; Node parentNode = null; Node childNode = null; int ctr = 0; int n = 0; int currentFormNo = 0; String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); System.out.println("userId ::-"+userId); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); System.out.println("loginSiteCode ::-"+loginSite); System.out.println("currentColumn ::-"+currentColumn); try { if(objContext != null && objContext.trim().length()>0) { currentFormNo = Integer.parseInt(objContext); } valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); valueXmlString.append(editFlag).append("</editFlag></header>"); switch (currentFormNo) { case 1: parentNodeList = dom.getElementsByTagName("Detail1"); parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); valueXmlString.append("<Detail1>"); if(currentColumn.trim().equals("itm_default")) { Calendar cal=Calendar.getInstance(); Date date=cal.getTime(); SimpleDateFormat dateFormat=new SimpleDateFormat(genericUtility.getApplDateFormat()); dateStr=dateFormat.format(date); System.out.println("Today's Date "+dateStr); valueXmlString.append("<start_date>").append(dateStr).append("</start_date>\r\n"); } /*else if(currentColumn.trim().equals("end_date") || currentColumn.trim().equals("start_date")) { parentNodeList = dom.getElementsByTagName("Detail1"); parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); ctr = 0; childListLength = childNodeList.getLength(); while(ctr<childListLength) { String dateString=childNodeList.item(ctr).getNodeName(); if("end_date".equals(dateString)) endTime=childNodeList.item(ctr).getFirstChild().getNodeValue(); else if("start_date".equals(dateString)) stsrtTime=childNodeList.item(ctr).getFirstChild().getNodeValue(); ctr++; } if(endTime.indexOf(' ')!=-1) { endTime=endTime.substring(0,endTime.indexOf(' ')); } if(stsrtTime.indexOf(' ')!=-1) { stsrtTime=stsrtTime.substring(0,stsrtTime.indexOf(' ')); } if(endTime.indexOf('-')!=-1) { endTime=endTime.replace('-','/'); } if(stsrtTime.indexOf('-')!=-1) { stsrtTime=stsrtTime.replace('-','/'); } System.out.println(">>>>>>.. endTime "+endTime); System.out.println(">>>>>>.. stsrtTime "+stsrtTime); if(stsrtTime !=null && endTime !=null) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); Date stDate = simpleDateFormat.parse(stsrtTime); Date edDate = simpleDateFormat.parse(endTime); // Date stDate = new Date(stsrtTime); // Date edDate = new Date(endTime); long stTimeImMilsec=stDate.getTime(); long edTimeImMilsec=edDate.getTime(); long dayTminMilsec=24*60*60*1000; long noOfDays =(edTimeImMilsec - stTimeImMilsec)/dayTminMilsec; if(noOfDays !=0) { noOfDays=noOfDays + 1; } System.out.println(">>>>>>.. stTimeImMilsec "+stTimeImMilsec); System.out.println(">>>>>>.. edTimeImMilsec "+edTimeImMilsec); System.out.println(">>>>>>.. noOfDays "+noOfDays); valueXmlString.append("<paid_prdcode>").append(noOfDays).append("</paid_prdcode>\r\n"); } }*/ valueXmlString.append("</Detail1>\r\n"); break; } valueXmlString.append("</Root>"); } catch(Exception e) { System.out.println("Exception ::"+e.getMessage()); e.printStackTrace(); } return valueXmlString.toString(); }
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException { System.out.println(" in itemChanged "); StringBuffer valueXmlString = new StringBuffer(); StringBuffer retString = new StringBuffer(); String errCode = ""; String sql = ""; String sundrySql= ""; String columnValue = ""; String loginSite = ""; String format = ""; String accPrd = ""; String childNodeName = ""; String dateStr=""; String endDateStr=""; String endTime=null; String stsrtTime=null; int childListLength=0; NodeList parentNodeList = null; NodeList childNodeList = null; Node parentNode = null; Node childNode = null; int ctr = 0; int n = 0; int currentFormNo = 0; String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); System.out.println("userId ::-"+userId); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); System.out.println("loginSiteCode ::-"+loginSite); System.out.println("currentColumn ::-"+currentColumn); try { if(objContext != null && objContext.trim().length()>0) { currentFormNo = Integer.parseInt(objContext); } valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); valueXmlString.append(editFlag).append("</editFlag></header>"); switch (currentFormNo) { case 1: parentNodeList = dom.getElementsByTagName("Detail1"); parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); valueXmlString.append("<Detail1>"); if(currentColumn.trim().equals("itm_default")) { Calendar cal=Calendar.getInstance(); Date date=cal.getTime(); //Changed by Pawan on 5/2/2011 [AD01SUN007] for date formating.start //SimpleDateFormat dateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat dateFormat = null; if( xtraParams.indexOf("user_lang=") <= 0 ) { dateFormat = new SimpleDateFormat("yyyy-MM-dd"); } else { dateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); } //Changed by Pawan on 5/2/2011 [AD01SUN009] for date formating.end dateStr=dateFormat.format(date); System.out.println("Today's Date "+dateStr); valueXmlString.append("<start_date>").append(dateStr).append("</start_date>\r\n"); } /*else if(currentColumn.trim().equals("end_date") || currentColumn.trim().equals("start_date")) { parentNodeList = dom.getElementsByTagName("Detail1"); parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); ctr = 0; childListLength = childNodeList.getLength(); while(ctr<childListLength) { String dateString=childNodeList.item(ctr).getNodeName(); if("end_date".equals(dateString)) endTime=childNodeList.item(ctr).getFirstChild().getNodeValue(); else if("start_date".equals(dateString)) stsrtTime=childNodeList.item(ctr).getFirstChild().getNodeValue(); ctr++; } if(endTime.indexOf(' ')!=-1) { endTime=endTime.substring(0,endTime.indexOf(' ')); } if(stsrtTime.indexOf(' ')!=-1) { stsrtTime=stsrtTime.substring(0,stsrtTime.indexOf(' ')); } if(endTime.indexOf('-')!=-1) { endTime=endTime.replace('-','/'); } if(stsrtTime.indexOf('-')!=-1) { stsrtTime=stsrtTime.replace('-','/'); } System.out.println(">>>>>>.. endTime "+endTime); System.out.println(">>>>>>.. stsrtTime "+stsrtTime); if(stsrtTime !=null && endTime !=null) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); Date stDate = simpleDateFormat.parse(stsrtTime); Date edDate = simpleDateFormat.parse(endTime); // Date stDate = new Date(stsrtTime); // Date edDate = new Date(endTime); long stTimeImMilsec=stDate.getTime(); long edTimeImMilsec=edDate.getTime(); long dayTminMilsec=24*60*60*1000; long noOfDays =(edTimeImMilsec - stTimeImMilsec)/dayTminMilsec; if(noOfDays !=0) { noOfDays=noOfDays + 1; } System.out.println(">>>>>>.. stTimeImMilsec "+stTimeImMilsec); System.out.println(">>>>>>.. edTimeImMilsec "+edTimeImMilsec); System.out.println(">>>>>>.. noOfDays "+noOfDays); valueXmlString.append("<paid_prdcode>").append(noOfDays).append("</paid_prdcode>\r\n"); } }*/ valueXmlString.append("</Detail1>\r\n"); break; } valueXmlString.append("</Root>"); } catch(Exception e) { System.out.println("Exception ::"+e.getMessage()); e.printStackTrace(); } return valueXmlString.toString(); }
private long getTimeInMinit(String timeStr) { String hr=timeStr.substring(0,timeStr.indexOf(':')); String min=timeStr.substring(timeStr.indexOf(':')+1); long timinMin=Integer.parseInt(hr)*60+Integer.parseInt(min); return timinMin; } public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException { Document dom = null; Document dom1 = null; Document dom2 = null; String errString = null; System.out.println("Entering into validations ..................."); System.out.println("xmlString : "+xmlString); System.out.println("xmlString1 : "+xmlString1); System.out.println("xmlString2 : "+xmlString2); try { dom = parseString(xmlString); dom1 = parseString(xmlString1); if (xmlString2.trim().length() > 0 ) { dom2 = parseString(xmlString2); } errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams); } catch(Exception e) { System.out.println("Exception : PayableOpeningsEJB : wfValData(String xmlString) : ==>\n"+e.getMessage()); } return (errString); }
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException { System.out.println(" IN wfValData 2"); Connection conn = null; Statement stmt = null; PreparedStatement pstmt = null; ResultSet rs = null; String errString = ""; String errCode = ""; String sql = ""; String userId = ""; String loginSite = ""; String startDateStr = ""; String endDateStr = ""; String shiftPattern = ""; String periodCode = ""; String itemSer = ""; String currCode = ""; String childNodeName = ""; NodeList parentNodeList = null; NodeList childNodeList = null; Node parentNode = null; Node childNode = null; int ctr,currentFormNo=0; int childNodeListLength; int cnt; Date startDate=null; Date endDate=null; String workTblNo = ""; int lineNo = 0; String lineNoStr = ""; SimpleDateFormat simpleDateFormat = null; userId = getValueFromXTRA_PARAMS(xtraParams,"userId"); try { conn = getConnection(); simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); if(objContext != null && objContext.trim().length()>0) { currentFormNo = Integer.parseInt(objContext); } parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo); startDateStr = genericUtility.getColumnValue("start_date",dom); endDateStr = genericUtility.getColumnValue("end_date",dom); workTblNo = genericUtility.getColumnValue("work_tblno",dom); lineNoStr = genericUtility.getColumnValue("line_no",dom); System.out.println("Line No : "+lineNoStr); if(lineNoStr != null && lineNoStr.trim().length() > 0){ lineNo = Integer.parseInt(lineNoStr); } if(startDateStr !=null && endDateStr !=null) { if(startDateStr.indexOf(" ")!= -1) { startDateStr=startDateStr.substring(0,startDateStr.indexOf(" ")); } if(endDateStr.indexOf(" ")!=-1) { endDateStr=endDateStr.substring(0,endDateStr.indexOf(" ")); } if(startDateStr.indexOf('-')!=-1) { startDateStr=startDateStr.replace('-','/'); } if(endDateStr.indexOf('-')!=-1) { endDateStr=endDateStr.replace('-','/'); } startDate = simpleDateFormat.parse(startDateStr); endDate = simpleDateFormat.parse(endDateStr); } parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); childNodeListLength = childNodeList.getLength(); for (ctr = 0; ctr < childNodeListLength; ctr++) { childNode = childNodeList.item(ctr); childNodeName = childNode.getNodeName(); switch (currentFormNo) { case 1: //if (childNodeName.equals("paid_prdcode")) if (childNodeName.equals("prd_code__pay")) { if (childNode.getFirstChild() == null) { errCode = "VTCALPRD"; errString = getErrorString("prd_code__pay",errCode,userId); break; } periodCode=childNode.getFirstChild().getNodeValue(); sql = "SELECT COUNT(*) AS COUNT FROM PERIOD WHERE CODE = '"+periodCode+"'"; stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if (rs.next()) { cnt = rs.getInt("COUNT"); if (cnt == 0) { errCode = "STARTPRD"; errString = getErrorString("prd_code__pay",errCode,userId); break; } } stmt.close(); rs.close(); } else if((startDateStr ==null)) { errCode = "VEDAT2"; errString = getErrorString("start_date",errCode,userId); break; } else if((endDateStr ==null)) { errCode = "VEDAT2"; errString = getErrorString("end_date",errCode,userId); break; } else if((endDate.compareTo(startDate) <= 0)) { errCode = "VTDATE1"; errString = getErrorString("end_date",errCode,userId); break; } else if (childNodeName.equals("start_date") || childNodeName.equals("end_date")){ if(editFlag.equalsIgnoreCase("E")){ java.sql.Date dbFrDate = new java.sql.Date(System.currentTimeMillis()); java.sql.Date dbToDate = new java.sql.Date(System.currentTimeMillis()); sql = "SELECT START_DATE,END_DATE FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' AND LINE_NO = "+lineNo+""; System.out.println("SQL :: "+sql); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if(rs.next()){ dbFrDate = rs.getDate("START_DATE"); dbToDate = rs.getDate("END_DATE"); System.out.println("DomFrDate : "+startDate+" DbFromDate :"+dbFrDate+" DomEndDate :"+endDate+" dbEndDate :"+dbToDate); if(startDate.compareTo(new java.util.Date(dbFrDate.getTime())) == 0 && endDate.compareTo(new java.util.Date(dbToDate.getTime())) == 0){ break; } } stmt.close(); } int count = 0; java.sql.Date startSqlDate = new java.sql.Date(startDate.getTime()); java.sql.Date endSqlDate = new java.sql.Date(endDate.getTime()); System.out.println("Work Table No ::"+workTblNo); if(workTblNo != null && workTblNo.trim().length() > 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"'"; System.out.println("SQL ::"+sql); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if(rs.next()){ count = rs.getInt(1); if(count > 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND ? BETWEEN START_DATE AND END_DATE AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); System.out.println("SET 1 "+Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND ? BETWEEN START_DATE AND END_DATE AND LINE_NO != "+lineNo+""; pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); System.out.println("SET 1 "+Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("end_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND START_DATE BETWEEN ? AND ? AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND END_DATE BETWEEN ? AND ? AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } } } } } } } } } } } catch(Exception e) { System.out.println("Exception ::"+e); e.printStackTrace(); } finally { try { if(stmt != null){ stmt.close(); stmt = null; } if(pstmt != null){ pstmt.close(); pstmt = null; } if(conn != null) { conn.close(); } } catch(Exception ex) { System.out.println("Exception ::"+ex.getMessage()); ex.printStackTrace(); } } return errString; } }
\ No newline at end of file
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException { System.out.println(" IN wfValData 2"); Connection conn = null; Statement stmt = null; PreparedStatement pstmt = null; ResultSet rs = null; String errString = ""; String errCode = ""; String sql = ""; String userId = ""; String loginSite = ""; String startDateStr = ""; String endDateStr = ""; String shiftPattern = ""; String periodCode = ""; String itemSer = ""; String currCode = ""; String childNodeName = ""; NodeList parentNodeList = null; NodeList childNodeList = null; Node parentNode = null; Node childNode = null; int ctr,currentFormNo=0; int childNodeListLength; int cnt; Date startDate=null; Date endDate=null; String workTblNo = ""; int lineNo = 0; String lineNoStr = ""; SimpleDateFormat simpleDateFormat = null; userId = getValueFromXTRA_PARAMS(xtraParams,"userId"); try { conn = getConnection(); simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); if(objContext != null && objContext.trim().length()>0) { currentFormNo = Integer.parseInt(objContext); } parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo); startDateStr = genericUtility.getColumnValue("start_date",dom); endDateStr = genericUtility.getColumnValue("end_date",dom); workTblNo = genericUtility.getColumnValue("work_tblno",dom); lineNoStr = genericUtility.getColumnValue("line_no",dom); System.out.println("Line No : "+lineNoStr); if(lineNoStr != null && lineNoStr.trim().length() > 0){ lineNo = Integer.parseInt(lineNoStr); } if(startDateStr !=null && endDateStr !=null) { if(startDateStr.indexOf(" ")!= -1) { startDateStr=startDateStr.substring(0,startDateStr.indexOf(" ")); } if(endDateStr.indexOf(" ")!=-1) { endDateStr=endDateStr.substring(0,endDateStr.indexOf(" ")); } if(startDateStr.indexOf('-')!=-1) { startDateStr=startDateStr.replace('-','/'); } if(endDateStr.indexOf('-')!=-1) { endDateStr=endDateStr.replace('-','/'); } startDate = simpleDateFormat.parse(startDateStr); endDate = simpleDateFormat.parse(endDateStr); } parentNode = parentNodeList.item(0); childNodeList = parentNode.getChildNodes(); childNodeListLength = childNodeList.getLength(); for (ctr = 0; ctr < childNodeListLength; ctr++) { childNode = childNodeList.item(ctr); childNodeName = childNode.getNodeName(); switch (currentFormNo) { case 1: //Changed by Pawan on 5/14/2011 [AD01SUN007] to check blank work_tblno and line_no.start if (childNodeName.equals("work_tblno")) { if (childNode.getFirstChild() == null) { errCode = "INVWORKTBL"; errString = getErrorString("work_tblno",errCode,userId); break; } } if (childNodeName.equals("line_no")) { if (childNode.getFirstChild() == null) { errCode = "INVDLINENO"; errString = getErrorString("line_no",errCode,userId); break; } } //Changed by Pawan on 5/14/2011 [AD01SUN007] to check blank work_tblno and line_no.end //if (childNodeName.equals("paid_prdcode")) if (childNodeName.equals("prd_code__pay")) { if (childNode.getFirstChild() == null) { errCode = "VTCALPRD"; errString = getErrorString("prd_code__pay",errCode,userId); break; } periodCode=childNode.getFirstChild().getNodeValue(); sql = "SELECT COUNT(*) AS COUNT FROM PERIOD WHERE CODE = '"+periodCode+"'"; stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if (rs.next()) { cnt = rs.getInt("COUNT"); if (cnt == 0) { errCode = "STARTPRD"; errString = getErrorString("prd_code__pay",errCode,userId); break; } } stmt.close(); rs.close(); } else if((startDateStr ==null)) { errCode = "VEDAT2"; errString = getErrorString("start_date",errCode,userId); break; } else if((endDateStr ==null)) { errCode = "VEDAT2"; errString = getErrorString("end_date",errCode,userId); break; } else if((endDate.compareTo(startDate) <= 0)) { errCode = "VTDATE1"; errString = getErrorString("end_date",errCode,userId); break; } else if (childNodeName.equals("start_date") || childNodeName.equals("end_date")){ if(editFlag.equalsIgnoreCase("E")){ java.sql.Date dbFrDate = new java.sql.Date(System.currentTimeMillis()); java.sql.Date dbToDate = new java.sql.Date(System.currentTimeMillis()); sql = "SELECT START_DATE,END_DATE FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' AND LINE_NO = "+lineNo+""; System.out.println("SQL :: "+sql); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if(rs.next()){ dbFrDate = rs.getDate("START_DATE"); dbToDate = rs.getDate("END_DATE"); System.out.println("DomFrDate : "+startDate+" DbFromDate :"+dbFrDate+" DomEndDate :"+endDate+" dbEndDate :"+dbToDate); if(startDate.compareTo(new java.util.Date(dbFrDate.getTime())) == 0 && endDate.compareTo(new java.util.Date(dbToDate.getTime())) == 0){ break; } } stmt.close(); } int count = 0; java.sql.Date startSqlDate = new java.sql.Date(startDate.getTime()); java.sql.Date endSqlDate = new java.sql.Date(endDate.getTime()); System.out.println("Work Table No ::"+workTblNo); if(workTblNo != null && workTblNo.trim().length() > 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"'"; System.out.println("SQL ::"+sql); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if(rs.next()){ count = rs.getInt(1); if(count > 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND ? BETWEEN START_DATE AND END_DATE AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); System.out.println("SET 1 "+Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND ? BETWEEN START_DATE AND END_DATE AND LINE_NO != "+lineNo+""; pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); System.out.println("SET 1 "+Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("end_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND START_DATE BETWEEN ? AND ? AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } else if(count == 0){ sql = "SELECT COUNT(*) FROM WORK_TABLE WHERE WORK_TBLNO = '"+workTblNo+"' "+ "AND END_DATE BETWEEN ? AND ? AND LINE_NO != "+lineNo+""; System.out.println("SQL ::"+sql); pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(startDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(simpleDateFormat.format(endDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()))); rs = pstmt.executeQuery(); if(rs.next()){ count = rs.getInt(1); } System.out.println("Count ::"+count); if(count > 0){ errCode = "VTINVOT"; errString = getErrorString("start_date",errCode,userId); break; } } } } } } } } } } } catch(Exception e) { System.out.println("Exception ::"+e); e.printStackTrace(); } finally { try { if(stmt != null){ stmt.close(); stmt = null; } if(pstmt != null){ pstmt.close(); pstmt = null; } if(conn != null) { conn.close(); } } catch(Exception ex) { System.out.println("Exception ::"+ex.getMessage()); ex.printStackTrace(); } } return errString; } }
\ No newline at end of file
......
......@@ -208,6 +208,17 @@ public class Form16Payment1 extends ValidatorEJB implements Form16Payment1Local,
break;
}
}
//Changed by Pawan on 5/14/2011 [AD01SUN010] to check blank bank_name.start
else if (childNodeName.equals("bank_name"))
{
if (childNode.getFirstChild() == null)
{
errCode = "INVBANKNAM";
errString = getErrorString("bank_name",errCode,loginCode);
break;
}
}
//Changed by Pawan on 5/14/2011 [AD01SUN010] to check blank bank_name.end
else if (childNodeName.equals("date__payment"))
{
datePayment = getColumnValue("date__payment",dom);
......@@ -295,6 +306,9 @@ public class Form16Payment1 extends ValidatorEJB implements Form16Payment1Local,
String siteDescr = null, prdCode = "", periodDescr = "";
try
{
System.out.println("xtra parm is : "+xtraParams);
System.out.println("currentColumn is : "+currentColumn);
conn = connDriver.getConnectDB("DriverITM");
if(objContext != null && objContext.trim().length()>0)
......@@ -334,9 +348,11 @@ public class Form16Payment1 extends ValidatorEJB implements Form16Payment1Local,
{
try
{
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("loginSite in ItemChange ::: [" + loginSite + "]");
if (loginSite != null)
if ( loginSite != null )
{
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = '"+ loginSite + "'";
System.out.println("sql ::: [" + sql + "]");
......@@ -430,7 +446,6 @@ public class Form16Payment1 extends ValidatorEJB implements Form16Payment1Local,
valueXmlString.append("<emp_fname>").append("<![CDATA[" + fName + "]]>").append("</emp_fname>\r\n");
valueXmlString.append("<emp_lname>").append("<![CDATA[" + lName + "]]>").append("</emp_lname>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
......
......@@ -146,7 +146,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
break;
}
*/
empCode = childNode.getFirstChild().getNodeValue().trim();
//Changed by Pawan on 5/3/2011 [AD01SUN009].
//empCode = childNode.getFirstChild().getNodeValue().trim();
//empCode = getColumnValue("emp_code",dom);
if (childNode.getFirstChild() == null)
{
......@@ -154,144 +155,153 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
errString = getErrorString("emp_code",errCode,userId);
break;
}
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = '"+empCode.trim()+"'";
System.out.println("sql :"+sql);
System.out.println("emp_code :"+empCode);
rs = stmt.executeQuery(sql);
if (rs.next())
else //Changed by Pawan on 5/3/2011 [AD01SUN009] to validate employee code.start
{
cnt = rs.getInt("COUNT");
if (cnt == 0)
empCode = childNode.getFirstChild().getNodeValue().trim();
if (empCode == null || empCode.trim().length() == 0)
{
errCode = "EMPCODENF";
errString = getErrorString("emp_code",errCode,userId);
errString = getErrorString("emp_code","VMEMP1",userId);
break;
}//Changed by Pawan on 5/3/2011 [AD01SUN009] to validate employee code.end
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = '"+empCode.trim()+"'";
System.out.println("sql :"+sql);
System.out.println("emp_code :"+empCode);
rs = stmt.executeQuery(sql);
if (rs.next())
{
cnt = rs.getInt("COUNT");
if (cnt == 0)
{
errCode = "EMPCODENF";
errString = getErrorString("emp_code",errCode,userId);
break;
}
}
}
rs.close();
/* sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'X'";
rs = stmt.executeQuery(sql);
if (rs.next())
{
cnt = rs.getInt("COUNT");
if (cnt != 0)
rs.close();
/* sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'X'";
rs = stmt.executeQuery(sql);
if (rs.next())
{
errCode = "VDEMP1";
errString = getErrorString("emp_code",errCode,userId);
break;
cnt = rs.getInt("COUNT");
if (cnt != 0)
{
errCode = "VDEMP1";
errString = getErrorString("emp_code",errCode,userId);
break;
}
}*/
//start - Added by jaimin on 02/07/2008 (ADM5000192)
//sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'X' AND TRAN_ID <> '"+ tranId +"' "; //Remarked by Raj (ADM5000192)- 21/01/2009
sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'A' AND TRAN_ID <> '"+ tranId +"' "; //Added by Raj (ADM5000192)- 21/01/2009
rs = stmt.executeQuery(sql);
if (rs.next())
{
cnt = rs.getInt("COUNT");
if (cnt != 0)
{
errCode = "VDEMP1";
errString = getErrorString("emp_code",errCode,userId);
break;
}
}
}*/
//start - Added by jaimin on 02/07/2008 (ADM5000192)
//sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'X' AND TRAN_ID <> '"+ tranId +"' "; //Remarked by Raj (ADM5000192)- 21/01/2009
sql = "SELECT COUNT(*) AS COUNT FROM SEPARATION_CLOSE WHERE emp_code = '"+empCode.trim()+"' AND STATUS <>'A' AND TRAN_ID <> '"+ tranId +"' "; //Added by Raj (ADM5000192)- 21/01/2009
rs = stmt.executeQuery(sql);
if (rs.next())
{
cnt = rs.getInt("COUNT");
if (cnt != 0)
//End - Added by jaimin on 02/07/2008 (ADM5000192)
//********************
String empSite="";
sql = "SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE = '"+empCode.trim()+"'" ;
System.out.println("sql emp site validation:::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
errCode = "VDEMP1";
errString = getErrorString("emp_code",errCode,userId);
break;
empSite = (rs.getString(1)==null?" ":rs.getString(1));
}
}
//End - Added by jaimin on 02/07/2008 (ADM5000192)
//********************
String empSite="";
sql = "SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE = '"+empCode.trim()+"'" ;
System.out.println("sql emp site validation:::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
empSite = (rs.getString(1)==null?" ":rs.getString(1));
}
rs.close();
System.out.println("emp_code :"+empCode);
System.out.println("Employee Site::["+empSite+"]");
/* sql = "SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE = '"+empCodeAprv.trim()+"'" ;
System.out.println("sql Log in site validation:::"+sql);
System.out.println("empCodeAprv :"+empCodeAprv);
rs = stmt.executeQuery(sql);
if (rs.next())
{
empSiteAprv = (rs.getString(1)==null?"":rs.getString(1));
}
System.out.println("LoginEmployee:::["+empCodeAprv+"]");*/
System.out.println("LoginSite:::["+loginSite+"]");
if(!(empSite.trim().equalsIgnoreCase(loginSite.trim())))
{
errCode = "SITEMISS";
errString = getErrorString("site_code",errCode,userId);
break;
}
rs.close();
System.out.println("emp_code :"+empCode);
System.out.println("Employee Site::["+empSite+"]");
// ************************
//Code Added below by Raj (ADM5000192)- 24/04/2008
sql = "SELECT COUNT(*) AS COUNT FROM FULLFINAL_HDR WHERE EMP_CODE = '"+empCode.trim()+"' AND CONFIRMED = 'Y'";
rs = stmt.executeQuery(sql);
if (rs.next())
{
cnt = rs.getInt("COUNT");
System.out.println("Count :: "+cnt);//Added by jaimin on 17/07/2008 (AD89SUN025)
}
rs.close();
if (cnt > 0)
{
errCode = "VTFFS1";
errString = getErrorString("emp_code",errCode,userId);
break;
}
else
{
resiDate = genericUtility.getColumnValue("resi_date", dom);
// Shifted following validation from above in sequence - Piyush - (AD89SUN025) - 21/07/2008
// Added by Raj - Req.ID:ADM5000192 - 27/05/08
if (resiDate == null || resiDate.trim().length() == 0 )
/* sql = "SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE = '"+empCodeAprv.trim()+"'" ;
System.out.println("sql Log in site validation:::"+sql);
System.out.println("empCodeAprv :"+empCodeAprv);
rs = stmt.executeQuery(sql);
if (rs.next())
{
errCode = "VTSEPNT";
errString = getErrorString("emp_code",errCode,userId);
break;
empSiteAprv = (rs.getString(1)==null?"":rs.getString(1));
}
java.sql.Timestamp resiDate1 = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(resiDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
//sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' AND RESI_DATE = ? ";
//sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' "; //Commented by jaimin on 17/07/2008 (AD89SUN025)
sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' AND STATUS = 'C' "; //Added by jaimin on 17/07/2008 (AD89SUN025)
System.out.println("sql1 :: "+sql1);//Added by jaimin on 17/07/2008 (AD89SUN025)
pstmt = conn.prepareStatement(sql1);
//pstmt.setTimestamp(1, resiDate1);//Commented by jaimin on 30/06/2008 (ADM5000192)
rs1 = pstmt.executeQuery();
if (rs1.next())
System.out.println("LoginEmployee:::["+empCodeAprv+"]");*/
System.out.println("LoginSite:::["+loginSite+"]");
if(!(empSite.trim().equalsIgnoreCase(loginSite.trim())))
{
status = rs1.getString("status");
System.out.println("status :: "+status);//Added by jaimin on 17/07/2008 (AD89SUN025)
errCode = "SITEMISS";
errString = getErrorString("site_code",errCode,userId);
break;
}
else
// ************************
//Code Added below by Raj (ADM5000192)- 24/04/2008
sql = "SELECT COUNT(*) AS COUNT FROM FULLFINAL_HDR WHERE EMP_CODE = '"+empCode.trim()+"' AND CONFIRMED = 'Y'";
rs = stmt.executeQuery(sql);
if (rs.next())
{
status = "*"; // To identify seperation is not exist
cnt = rs.getInt("COUNT");
System.out.println("Count :: "+cnt);//Added by jaimin on 17/07/2008 (AD89SUN025)
}
rs1.close();
pstmt.close();
if (status != null && status.trim().length() > 0 && status.equals("*"))
rs.close();
if (cnt > 0)
{
System.out.println("status is * ");//Added by jaimin on 17/07/2008 (AD89SUN025)
errCode = "VTSEPNT";
errCode = "VTFFS1";
errString = getErrorString("emp_code",errCode,userId);
break;
}
else if (status != null && status.trim().length() > 0 && !status.equals("C"))
else
{
System.out.println("status is C ");//Added by jaimin on 17/07/2008 (AD89SUN025)
errCode = "VTSEPNTCON";
errString = getErrorString("emp_code",errCode,userId);
break;
resiDate = genericUtility.getColumnValue("resi_date", dom);
// Shifted following validation from above in sequence - Piyush - (AD89SUN025) - 21/07/2008
// Added by Raj - Req.ID:ADM5000192 - 27/05/08
if (resiDate == null || resiDate.trim().length() == 0 )
{
errCode = "VTSEPNT";
errString = getErrorString("emp_code",errCode,userId);
break;
}
java.sql.Timestamp resiDate1 = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(resiDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
//sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' AND RESI_DATE = ? ";
//sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' "; //Commented by jaimin on 17/07/2008 (AD89SUN025)
sql1 = "SELECT STATUS FROM SEPARATION WHERE EMP_CODE = '"+empCode.trim()+"' AND STATUS = 'C' "; //Added by jaimin on 17/07/2008 (AD89SUN025)
System.out.println("sql1 :: "+sql1);//Added by jaimin on 17/07/2008 (AD89SUN025)
pstmt = conn.prepareStatement(sql1);
//pstmt.setTimestamp(1, resiDate1);//Commented by jaimin on 30/06/2008 (ADM5000192)
rs1 = pstmt.executeQuery();
if (rs1.next())
{
status = rs1.getString("status");
System.out.println("status :: "+status);//Added by jaimin on 17/07/2008 (AD89SUN025)
}
else
{
status = "*"; // To identify seperation is not exist
}
rs1.close();
pstmt.close();
if (status != null && status.trim().length() > 0 && status.equals("*"))
{
System.out.println("status is * ");//Added by jaimin on 17/07/2008 (AD89SUN025)
errCode = "VTSEPNT";
errString = getErrorString("emp_code",errCode,userId);
break;
}
else if (status != null && status.trim().length() > 0 && !status.equals("C"))
{
System.out.println("status is C ");//Added by jaimin on 17/07/2008 (AD89SUN025)
errCode = "VTSEPNTCON";
errString = getErrorString("emp_code",errCode,userId);
break;
}
}
}
}//end of else . Changed by Pawan on 5/3/2011 [AD01SUN009].
//Add ended by Raj (ADM5000192)- 24/04/2008
}
}
......@@ -445,8 +455,20 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
Object date = null;
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = sdf.parse(ts.toString());
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
//Changed by Pawan on 4/21/2011 [AD01SUN009] for date formating.start
//SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat sdf1 = null;
if( xtraParams.indexOf("user_lang=") <= 0 )
{
sdf1 = new SimpleDateFormat("yyyy-MM-dd");
}
else
{
sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
}
//Changed by Pawan on 4/21/2011 [AD01SUN009] for date formating.end
currDate=sdf1.format(date).toString();
String siteDescr = "";
String fName= "";
String lName= "";
......@@ -471,7 +493,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
valueXmlString.append("<emp_lname_1>").append(lName).append("</emp_lname_1>\r\n");
*///End - Commented by jaimin on 17/07/2008 (AD89SUN025)
valueXmlString.append("<tran_date>").append(currDate).append("</tran_date>\r\n");
/*--Commented by pawan - 11/10/10 unnecessary S.O.P are not required
System.out.println("EmpCodeaprv::::["+empCodeAprv+"]");
System.out.println("EmpCodeaprv(FNAME)::::["+fName+"]");
......@@ -528,23 +549,48 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
rsSep = null;
stmtSep.close();
stmtSep = null;
//Added below by Raj (AD90SUN017)- 08/05/2010
if ( confDate != null && confDate.trim().length() > 0 )
{
confDate = genericUtility.getValidDateTimeString(confDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
if ( reliveDate != null && reliveDate.trim().length() > 0 )
{
//Commented by Pawan 11/10/10 [AD01SUN009]
//reliveDate = genericUtility.getValidDateTimeString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
reliveDate = genericUtility.getValidDateString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
if ( resiDate != null && resiDate.trim().length() > 0 )//Added by Pawan on 09/10/10 [AD01SUN009]
//Changed by Pawan on 4/21/2011 [AD01SUN009] for date formating.start
if( xtraParams.indexOf("user_lang=") <= 0 )
{
// Modified by Piyush for testing - 09/10/2010
//resiDate = genericUtility.getValidDateTimeString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
resiDate = genericUtility.getValidDateString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf3 = new SimpleDateFormat(genericUtility.getDBDateFormat());
if ( confDate != null && confDate.trim().length() > 0 )
{
java.util.Date confDate1 = sdf3.parse(confDate);
confDate = sdf2.format(confDate1);
}
if ( reliveDate != null && reliveDate.trim().length() > 0 )
{
java.util.Date reliveDate1 = sdf3.parse(reliveDate);
reliveDate = sdf2.format(reliveDate1);
}
if ( resiDate != null && resiDate.trim().length() > 0 )
{
java.util.Date resiDate1 = sdf3.parse(resiDate);
resiDate = sdf2.format(resiDate1);
}
}
else
{//Changed by Pawan on 4/21/2011 [AD01SUN009] for date formating.end
//Added below by Raj (AD90SUN017)- 08/05/2010
if ( confDate != null && confDate.trim().length() > 0 )
{
confDate = genericUtility.getValidDateTimeString(confDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
if ( reliveDate != null && reliveDate.trim().length() > 0 )
{
//Commented by Pawan 11/10/10 [AD01SUN009]
//reliveDate = genericUtility.getValidDateTimeString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
reliveDate = genericUtility.getValidDateString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
if ( resiDate != null && resiDate.trim().length() > 0 )//Added by Pawan on 09/10/10 [AD01SUN009]
{
// Modified by Piyush for testing - 09/10/2010
//resiDate = genericUtility.getValidDateTimeString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
resiDate = genericUtility.getValidDateString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
}//Changed by Pawan on 4/21/2011 [AD01SUN009] for date formating.
valueXmlString.append("<sep_status>").append(status).append("</sep_status>\r\n");
valueXmlString.append("<separation_mode>").append(sepMode).append("</separation_mode>\r\n");
valueXmlString.append("<reason>").append(reason).append("</reason>\r\n");
......
......@@ -20,6 +20,10 @@ import ibase.webitm.ejb.*;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.GenericUtility;
//Changed by Rohan on 4/20/2011 [AD01SUN009] to import below given classes.start
import ibase.webitm.ejb.sys.GenerateXmlFromDB;
import ibase.webitm.ejb.sys.NFCreateEdiMultiLogic;
//Changed by Rohan on 4/20/2011 [AD01SUN009] to import below given classes.end
@javax.ejb.Stateless
public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal, SepCloseConfRemote
......@@ -39,7 +43,9 @@ public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal,
String empCodeConf = "";
String deleteSepOnClose = "";
String relieveDate = "";
String confDate = "";
//Changed by Pawan on 5/4/2011 [AD01SUN009].
//String confDate = "";
java.sql.Timestamp confDate = null;
String sql = "";
Statement stmt = null;
......@@ -123,7 +129,9 @@ public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal,
separationMode = rSet.getString("SEPARATION_MODE");
reason = rSet.getString("REASON");
vacNoCreated = rSet.getString("VAC_NO__CREATED");
confDate = rSet.getString("CONF_DATE");
//Changed by Pawan on 5/4/2011 [AD01SUN009].
//confDate = rSet.getString("CONF_DATE");
confDate = rSet.getTimestamp("CONF_DATE");
empCodeConf = rSet.getString("EMP_CODE__CONF");
}
if( pstmt != null )
......@@ -152,7 +160,9 @@ public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal,
pstmt.setString(3, reason);
pstmt.setString(4, vacNoCreated);
pstmt.setString(5, status);
pstmt.setTimestamp(6,Timestamp.valueOf( confDate ) );
//Changed by Pawan on 5/4/2011 [AD01SUN009].
//pstmt.setTimestamp(6,Timestamp.valueOf( confDate ) );
pstmt.setTimestamp(6, confDate);
pstmt.setString(7, empCodeConf);
pstmt.setString(8, loginEmpCode);
pstmt.setString(9, tranId);
......@@ -240,13 +250,56 @@ public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal,
rSet.close();
rSet = null;
}
sql = "UPDATE EMPLOYEE SET RESI_DATE = NULL, RELIEVE_DATE = NULL WHERE EMP_CODE = '"+empCode+"'";
updCnt = stmt.executeUpdate(sql);
if ( updCnt > 0 )
{
System.out.println("EMPLOYEE Updated Successfully ::"+updCnt);
}
//Changed by Rohan on 19/04/11 [AD01SUN009] to generate EDI data.start
Document dom = null;
String runMode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "runMode" );
String ediOption = "";
System.out.println("runMode is :"+runMode);
if(runMode != null && runMode.trim().length() > 0 && !runMode.equalsIgnoreCase("B"))
{
sql = " SELECT EDI_OPTION FROM TRANSETUP WHERE TRAN_WINDOW = 'w_sep_close' ";
stmt = connectionObject.createStatement();
rSet = stmt.executeQuery(sql);
while ( rSet.next() )
{
ediOption = rSet.getString("EDI_OPTION");
}
if (ediOption == null)
{
ediOption = "0";
}
stmt.close();
stmt = null;
rSet.close();
rSet = null;
if (!"0".equals(ediOption))
{
GenerateXmlFromDB generateXmlFromDB = GenerateXmlFromDB.getInstance();
String dataString = generateXmlFromDB.getXMLData("w_sep_close", tranId , connectionObject);
System.out.println("generateXmlFromDB returned [" + dataString + "]");
generateXmlFromDB = null;
dom = genericUtility.parseString(dataString);
NFCreateEdiMultiLogic ceateEdiMultiLogic = new NFCreateEdiMultiLogic();
errString = ceateEdiMultiLogic.nfCreateEdiMultiLogic( dom, "w_sep_close", "E", xtraParams, connectionObject );
ceateEdiMultiLogic = null;
if (errString != null && !"SUCCESS".equals(errString))
{
return errString;
}
else
{
errString = "";
}
}
}
//Changed by Rohan on 19/04/11 [AD01SUN009] to generate EDI data.end
}
catch(Exception e)
{
......
......@@ -287,8 +287,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
patternCodeFilt = genericUtility.getColumnValue("pattern_code",headerDom);
fromDate = genericUtility.getColumnValue("date__fr",headerDom);
System.out.println(" From Date [" +fromDate+"]");
toDate = genericUtility.getColumnValue("date__to",headerDom);
//Changed by Pawan on 5/11/2011 [AD01SUN008].start
if ( fromDate == null || fromDate.length() <= 0 )
{
errString = itmdbAccessLocal.getErrorString("","INVFRMDATE","","",conn);
return errString;
}
//Changed by Pawan on 5/11/2011 [AD01SUN008].end
toDate = genericUtility.getColumnValue("date__to",headerDom );
//Changed by Pawan on 5/11/2011 [AD01SUN008].start
if ( toDate == null || toDate.length() <= 0)
{
errString = itmdbAccessLocal.getErrorString("","INVDTODATE","","",conn);
return errString;
}
//Changed by Pawan on 5/11/2011 [AD01SUN008].end
System.out.println("ToDate:::[" +toDate+"]");
System.out.println("empCodeFr :"+empCodeFr+" empCodeTo :"+empCodeTo+" deptCodeFr :"+deptCodeFr+" siteCodeFr :"+siteCodeFr);
......@@ -298,6 +313,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
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+"]");
java.util.Date frDate = sdf.parse(strFrDate);
fromPrdDate = frDate;
System.out.println("From Date Object :["+frDate+"]");
......
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