Commit 8f741124 authored by ysawant's avatar ysawant

Updated component of Tour Programme menu

TourIC.java



git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@216875 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ebb09ab4
......@@ -141,7 +141,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
System.out.println("currentFormNo...." + currentFormNo);
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -379,19 +379,19 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("mDate1 ========"+mDate1);
}
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
tourStarts = checkNull(genericUtility.getColumnValue("tour_starts", dom));
tourEnds = checkNull(genericUtility.getColumnValue("tour_ends", dom));
valueXmlString.append("<start_time>").append("<![CDATA["+mDate1Str+"]]>").append("</start_time>");
if("B".equalsIgnoreCase(tourStarts) || "B".equalsIgnoreCase(tourEnds))
{
if(mDate1 != null && mDate2 != null)
......@@ -434,7 +434,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
}
if(mDate1 != null && mDate2 != null)
{
if(mDate1.after(mDate2))
......@@ -442,36 +442,36 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
noDays = utilmethod.DaysAfter(mDate1, mDate2) + 1;
}
}
if(String.valueOf(noDays) == null ||noDays < 0)
{
noDays = 0;
}
valueXmlString.append("<no_days>").append("<![CDATA["+noDays+"]]>").append("</no_days>");
}
else if(currentColumn.trim().equalsIgnoreCase("date_to"))
{
System.out.println("::::Inside date_to::::");
mDate1Str = checkNull(genericUtility.getColumnValue("date_from", dom));
if(mDate1Str != null && mDate1Str.trim().length() > 0)
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
tourStarts = checkNull(genericUtility.getColumnValue("tour_starts", dom));
tourEnds = checkNull(genericUtility.getColumnValue("tour_ends", dom));
valueXmlString.append("<end_time>").append("<![CDATA["+mDate2Str+"]]>").append("</end_time>");
if("B".equalsIgnoreCase(tourStarts) || "B".equalsIgnoreCase(tourEnds))
{
if(mDate1 != null && mDate2 != null)
......@@ -499,7 +499,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
}
}
else
{
......@@ -515,7 +515,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
}
if(mDate1 != null && mDate2 != null)
{
if(mDate2.before(mDate1))
......@@ -523,14 +523,14 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
noDays = utilmethod.DaysAfter(mDate1, mDate2) + 1;
}
}
if(String.valueOf(noDays) == null ||noDays < 0)
{
noDays = 0;
}
valueXmlString.append("<no_days>").append("<![CDATA["+noDays+"]]>").append("</no_days>");
}
else if(currentColumn.trim().equalsIgnoreCase("tour_starts"))
{
......@@ -538,7 +538,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
tourStarts = checkNull(genericUtility.getColumnValue("tour_starts", dom));
noDaysStr = checkNull(genericUtility.getColumnValue("no_days", dom));
if(noDaysStr != null && noDaysStr.trim().length()>0)
{
noDays = Double.parseDouble(noDaysStr);
......@@ -555,7 +555,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(mDate1 != null && mDate2 != null)
{
if(mDate1.before(mDate2) || mDate1.equals(mDate2))
......@@ -588,7 +588,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
noDays = utilmethod.DaysAfter(mDate1, mDate2) + 1;
}
}
if(String.valueOf(noDays) == null ||noDays < 0)
{
......@@ -605,7 +605,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
tourEnds = checkNull(genericUtility.getColumnValue("tour_ends", dom));
noDaysStr = checkNull(genericUtility.getColumnValue("no_days", dom));
if(noDaysStr != null && noDaysStr.trim().length()>0)
{
noDays = Double.parseDouble(noDaysStr);
......@@ -616,13 +616,13 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(mDate1 != null && mDate2 != null)
{
if(mDate2.after(mDate1) || mDate2.equals(mDate1))
......@@ -660,7 +660,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
{
noDays = 0;
}
valueXmlString.append("<no_days>").append("<![CDATA["+noDays+"]]>").append("</no_days>");
}
valueXmlString.append ("</Detail1>\r\n");
......@@ -687,16 +687,16 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
{
System.out.println("::::Inside itm_default case 2::::");
System.out.println("xtraParams ==="+xtraParams);
tourId = checkNull(genericUtility.getColumnValue("tour_id", dom));
System.out.println("tourId---->"+tourId);
valueXmlString.append("<tour_id>").append("<![CDATA["+tourId+"]]>").append("</tour_id>");
lineStr = checkNull(genericUtility.getColumnValue("line_no", dom));
System.out.println("lineStr---->"+lineStr);
if(lineStr != null && lineStr.trim().length() > 0)
{
liLine = Long.parseLong(lineStr);
......@@ -747,13 +747,13 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
valueXmlString.append("<stan_code>").append("<![CDATA["+mstancd+"]]>").append("</stan_code>");
valueXmlString.append("<to_place>").append("<![CDATA["+mplace+"]]>").append("</to_place>");
if(mdtfr != null)
{
mdtfrStr = genericUtility.getValidDateString(mdtfr, genericUtility.getApplDateFormat());
}
valueXmlString.append("<date_from>").append("<![CDATA["+mdtfrStr+"]]>").append("</date_from>");
if(mdtto != null)
{
mdttoStr = genericUtility.getValidDateString(mdtto, genericUtility.getApplDateFormat());
......@@ -762,7 +762,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
valueXmlString.append("<purpose>").append("<![CDATA["+mpurpose+"]]>").append("</purpose>");
valueXmlString.append("<mode_travel>").append("<![CDATA["+mroad+"]]>").append("</mode_travel>");
}
else if(currentColumn.trim().equalsIgnoreCase("stan_code"))
{
System.out.println("::::Inside stan_code::::");
......@@ -932,7 +932,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
currentFormNo = Integer.parseInt(objContext);
}
System.out.println(" ***********Validation for Tour "+currentFormNo + " ***********");
sql = "select usr_lev from users where code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId);
......@@ -982,7 +982,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
System.out.println(":::Inside emp_code Validation:::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select count(*) as cnt from employee where emp_code = ? and work_site = (case when ? > 1 then ? else work_site end)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
......@@ -1067,7 +1067,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
System.out.println("empCode :::["+empCode+"]");
System.out.println("tour empCode :::["+mtpemp+"]");
if(!empCode.equalsIgnoreCase(mtpemp))
{
errList.add("VTEMPNF");
......@@ -1125,12 +1125,12 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
System.out.println(":::Inside no_days Validation:::");
noDays =checkNull(genericUtility.getColumnValue("no_days", dom));
if(noDays != null && noDays.trim().length() > 0)
{
lval = Double.parseDouble(noDays);
}
if(lval <= 0)
{
errList.add("VTTOUR0003");
......@@ -1148,13 +1148,13 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
tourStarts = checkNull(genericUtility.getColumnValue("tour_starts", dom));
tourEnds = checkNull(genericUtility.getColumnValue("tour_ends", dom));
......@@ -1206,11 +1206,11 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
else if(childNodeName.equalsIgnoreCase("plan_id"))
{
System.out.println(":::Inside plan_id Validation:::");
planId = checkNull(genericUtility.getColumnValue("plan_id", dom));
if(planId != null && planId.trim().length() > 0)
{
sql = "select count(*) as cnt from tourplan where plan_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,planId);
......@@ -1245,17 +1245,17 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
else if(childNodeName.equalsIgnoreCase("date_to"))
{
System.out.println(":::Inside date_to Validation:::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
System.out.println("mDate2Str---->"+mDate2Str);
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("mDate2---->"+mDate2);
}
sql = "select relieve_date from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
......@@ -1274,7 +1274,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
pstmt.close();
pstmt = null;
}
if(ldRel != null && mDate2 != null && mDate2.after(ldRel))
{
errList.add("VTRELDT");
......@@ -1286,14 +1286,14 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
System.out.println("--after relive date---");
mDate1Str = checkNull(genericUtility.getColumnValue("date_from", dom));
if(mDate1Str != null && mDate1Str.trim().length() > 0)
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("mDate1---->"+mDate1);
}
if(mDate1 == null || mDate2 == null)
{
errList.add("VEDATE");
......@@ -1339,14 +1339,11 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
break;
}
}
if(mDate != null && mDate2 != null)
if(mDate.after(mDate2) || mDate.equals(mDate2)) //if mdate >= mdate2 then
{
if(mDate.after(mDate2) || mDate.equals(mDate2)) //if mdate >= mdate2 then
{
break;
}
mDate = utilmethod.RelativeDate(mDate, 1);
}
break;
}
mDate = utilmethod.RelativeDate(mDate, 1);
} while (true);
}
}
......@@ -1370,7 +1367,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
continue;
}
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("to_place"))
{
System.out.println(":::Inside to_place Validation:::");
......@@ -1387,11 +1384,57 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
else if(childNodeName.equalsIgnoreCase("date_from"))
else if(childNodeName.equalsIgnoreCase("line_no__plan"))
{
System.out.println(":::Inside date_from Validation:::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println(":::Inside line_no__plan Validation:::");
lineNo = checkNull(genericUtility.getColumnValue("line_no__plan", dom));
planId = checkNull(genericUtility.getColumnValue("plan_id", dom1));
System.out.println("lineNo -->"+lineNo);
System.out.println("planId -->"+planId);
if(lineNo != null && lineNo.trim().length() > 0)
{
lval = Double.parseDouble(lineNo);
sql = "select count(*) as cnt from Tourplandet where plan_id = ? and line_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,planId);
pstmt.setDouble(2,lval);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMPLANLINE");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMPLANLINE");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
else if(childNodeName.equalsIgnoreCase("date_from"))
{
System.out.println(":::: Inside date_from Validation ::::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom1));
System.out.println("EMPCODE =="+empCode);
sql = "select work_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
......@@ -1410,29 +1453,61 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
pstmt.close();
pstmt = null;
}
mDate1Str = checkNull(genericUtility.getColumnValue("date_from", dom));
System.out.println("mDate1Str---->>"+mDate1Str);
if(mDate1Str != null && mDate1Str.trim().length() > 0)
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
errCode = finCommon.nfCheckPeriod("ADM", mDate1, lsSite, conn);
System.out.println("errCode -->"+errCode);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, errCode);
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
if(errCode == null || errCode.trim().length() == 0)
if(errCode == null || errCode.trim().length() == 0)
{
if(mDate1 == null)
if(mDate1 != null)
{
mDate2Str = checkNull(genericUtility.getColumnValue("date_from", dom));
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
mDate3Str = checkNull(genericUtility.getColumnValue("date_to", dom));
mDate3 = Timestamp.valueOf(genericUtility.getValidDateString(mDate3Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(mDate1.after(mDate2) || mDate1.equals(mDate2))
mDate2Str = checkNull(genericUtility.getColumnValue("date_from", dom1));
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
if(mDate1.after(mDate3))
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
mDate3Str = checkNull(genericUtility.getColumnValue("date_to", dom1));
if(mDate3Str != null && mDate3Str.trim().length() > 0)
{
mDate3 = Timestamp.valueOf(genericUtility.getValidDateString(mDate3Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(mDate2 != null && mDate3 != null)
{
if(mDate1.after(mDate2) || mDate1.equals(mDate2))
{
if(mDate1.after(mDate3))
{
errList.add("VTDTFR1");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VTDTFR1");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
else
{
errList.add("VTDTFR1");
errFields.add(childNodeName.toLowerCase());
......@@ -1443,16 +1518,6 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
}
else
{
errList.add("VTDTFR1");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VTDTFR1");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
else
{
......@@ -1466,78 +1531,30 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
}
}
else if(childNodeName.equalsIgnoreCase("line_no__plan"))
{
System.out.println(":::Inside line_no__plan Validation:::");
lineNo = checkNull(genericUtility.getColumnValue("line_no__plan", dom));
System.out.println("lineNo -->"+lineNo);
if(lineNo != null && lineNo.trim().length() > 0)
{
lval = Double.parseDouble(lineNo);
}
planId = checkNull(genericUtility.getColumnValue("plan_id", dom1));
System.out.println("planId -->"+planId);
if(String.valueOf(lval) != null)
{
sql = "select count(*) as cnt from Tourplandet where plan_id = ? and line_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,planId);
pstmt.setDouble(2,lval);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMPLANLINE");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMPLANLINE");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
else if(childNodeName.equalsIgnoreCase("date_to"))
{
System.out.println(":::Inside date_to Validation form 2:::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println(":::: Inside date_to Validation form 2 ::::");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom1));
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom));
System.out.println("emp-Code -->"+empCode);
mDate2Str = checkNull(genericUtility.getColumnValue("date_to", dom1));
System.out.println("Dom 1 mDate2Str --> "+mDate2Str);
if(mDate2Str != null && mDate2Str.trim().length() > 0)
{
mDate2 = Timestamp.valueOf(genericUtility.getValidDateString(mDate2Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
mDate1Str = checkNull(genericUtility.getColumnValue("date_to", dom1));
mDate1Str = checkNull(genericUtility.getColumnValue("date_to", dom));
System.out.println("mDate1Str --> "+mDate1Str);
if(mDate1Str != null && mDate1Str.trim().length() > 0)
{
mDate1 = Timestamp.valueOf(genericUtility.getValidDateString(mDate1Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
sql = "select work_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
......@@ -1545,10 +1562,22 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
if (rs.next())
{
lsSite = checkNull(rs.getString("work_site"));
if(mDate1 != null)
{
errCode = admCommon.gbfEmp(empCode, mDate1, lsSite, loginSiteCode, conn);
System.out.println("errCode -->"+errCode);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, errCode);
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
if (rs != null)
......@@ -1561,16 +1590,15 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
pstmt.close();
pstmt = null;
}
if(mDate1 != null && mDate2 != null)
{
mDate3Str = checkNull(genericUtility.getColumnValue("date_from", dom));
mDate3Str = checkNull(genericUtility.getColumnValue("date_from", dom1));
if(mDate3Str != null && mDate3Str.trim().length() > 0)
{
mDate3 = Timestamp.valueOf(genericUtility.getValidDateString(mDate3Str, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(mDate1.before(mDate2) || mDate1.equals(mDate2) && mDate3 != null)
{
if(mDate1.before(mDate3))
......@@ -1752,7 +1780,7 @@ public class TourIC extends ValidatorEJB implements TourICLocal,TourICRemote
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
......
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