Commit af79c044 authored by pdas's avatar pdas

REQUEST ID -D15ESUN002

VALIDATION FOR BUDGET AMT AGAINST PROJECT CODE


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98645 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 62fe4d2b
......@@ -101,7 +101,10 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
String curlineNo = "", tempindno = "", templinenoord = "", templineno = "", curlineno = "", qtybrowStr = "";
String rateStduomStr = "", empCodeQcaprv = "", qcReqd = "", withHeld = "";
Timestamp resigDate = null, duedate = null;
;
String pordType ="",sql1 ="";
int cntproj =0,cntporder =0,cntamd =0,cntind =0,cntindhdr =0;
PreparedStatement pstmt1 = null;
ResultSet rs1 = null;
String dutyPaid = "", eou = "", lopReqd = "", formNo = "", dutyPaidO = "", formNoO = "", quantityO = "", termCode = "";
String lineNoBrow = "", amdNoTemp = "", formNoTemp = "", lineNoTemp = "", quantitybrow = "", totalQuantity = "";
double totQty = 0, ct3Qty = 0, qtyUsed = 0;
......@@ -124,7 +127,8 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
String type = "", task_code = "",taskcodeparent = "", rel_agnst = "", val = "", val1 = "", retval = "";
double mmin_day = 0, mmax_day = 0, mmin_amt = 0, mmax_amt = 0;
boolean isLine = false;
String pordNo ="";
double totAmtDetPoamdDetbrow =0,totAmtDetIndent =0,totAmtDetporder =0,approxCost =0,totAmtProj =0;
try
{
System.out.println("@@@@@@@@ wfvaldata called");
......@@ -853,19 +857,51 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
if( childNodeName.equalsIgnoreCase("acct_code__cr") )
{
System.out.println("Priyanka dom:::"+genericUtility.serializeDom(dom));
System.out.println("Priyanka dom1:::"+genericUtility.serializeDom(dom1));
System.out.println("Priyanka dom2:::"+genericUtility.serializeDom(dom2));
acctCodeCr = genericUtility.getColumnValue("acct_code__cr", dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
System.out.println("@@@@@ acctCodeCr ["+acctCodeCr+"]");
if( acctCodeCr != null && acctCodeCr.length() > 0 )
{
System.out.println("@@@@@ acctCodeCr ["+acctCodeCr.trim()+"]");
//errCode = this.isAcctCode(siteCode, acctCodeCr, modName);
errCode = fincommon.isAcctCode(siteCode, acctCodeCr, modName, conn);
if (errCode != null && errCode.trim().length() > 0 )
//added by Priyanka Das for acctcodecr validation request id -d15esun002
NodeList detail2List = dom2.getElementsByTagName("Detail2");
noOfParent = detail2List.getLength();
acctCodeCr = genericUtility.getColumnValue("acct_code__cr", dom);
acctCodeCr = acctCodeCr==null ? "" : acctCodeCr.trim();
System.out.println("<acctCodeCr >@@@@@@ " + acctCodeCr);
System.out.println("noOfParent@@@@@@@@@@@"+noOfParent);
int a=0;
for (a = noOfParent-1; a >= 0 ; a--)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("noOfParent@@@@@@@@@@@"+noOfParent);
System.out.println("a@@@@ value"+a);
//System.out.println("ctr1@@@@@@@@"+ctr1);
String acctCodeCrbrow = genericUtility.getColumnValueFromNode("acct_code__cr", detail2List.item(a));
acctCodeCrbrow = acctCodeCrbrow==null ? "" : acctCodeCrbrow.trim();
System.out.println("@@@@acctCodeCrBrow------"+acctCodeCrbrow);
System.out.println("!(acctCodeCr.equals(acctCodeCrbrow)"+!(acctCodeCr.equals(acctCodeCrbrow)));
if(!(acctCodeCr.equals(acctCodeCrbrow)))
{
errCode = "VTACCTCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("in error for vtacctcode");
break;
}
}
}
else
{
......@@ -928,12 +964,14 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
if (childNodeName.equalsIgnoreCase("proj_code"))
{
String ordType ="";
projCode = checkNull(genericUtility.getColumnValue( "proj_code", dom));
projCodeO = checkNull(genericUtility.getColumnValue("proj_code__o", dom));
indNo = checkNull(genericUtility.getColumnValue("ind_no", dom));
ordType =checkNull(genericUtility.getColumnValue("PORD_TYPE", dom1));
System.out.println("Proj Code" + projCode);
// if (projCode.trim().length() > 0 || projCode != null)
......@@ -970,10 +1008,9 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if (projindNo.trim().length() != 0 || projindNo != null)
{
if (!(indNo.trim().equalsIgnoreCase(projindNo.trim())))
else if(ordType.equals("P"))
{
if (!(indNo.trim().equalsIgnoreCase(projindNo.trim())))
{
System.out.println("Indentno is "+indNo);
System.out.println("ProjIndentno is "+projindNo);
......@@ -982,13 +1019,315 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal, POrde
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Added by Priyanka Das Request ID -D15ESUN002
pordNo = checkNull(genericUtility.getColumnValue("purc_order", dom));
lineNoOrd = checkNull(genericUtility.getColumnValue("line_no__ord", dom));
amdNo = checkNull(genericUtility.getColumnValue("amd_no",dom ));
purcOrder = checkNull(genericUtility.getColumnValue("purc_order", dom));
indNo =checkNull(genericUtility.getColumnValue("ind_no", dom));
varValue = discommon.getDisparams("999999", "TYPE_ALLOW_PROJBUDGET", conn);
sql="select pord_type from porder where purc_order = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, purcOrder);
rs = pstmt.executeQuery();
if (rs.next())
{
pordType = rs.getString(1);
}
System.out.println("Amdtype.........."+pordType);
if (varValue != null && varValue.trim().length() > 0
&& varValue != "NULLFOUND" && pordType.equalsIgnoreCase(varValue))
{
System.out.println("Project Code>>>> [" +projCode);
if(projCode==null || projCode.trim().length()==0)
{
errCode = "VEPRJ1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (projCode != null && projCode.trim().length() > 0)
{
errCode = isExist("project", "proj_code",projCode, conn);
if ("FALSE".equalsIgnoreCase(errCode))
{
errCode = "VTPROJ1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
ordDateStr = checkNull(genericUtility.getColumnValue("ord_date", dom1));
sql ="select count(*) from project where proj_code = ? and ('" + ordDateStr + "' between start_date and end_date OR '" + ordDateStr + "'between start_date and ext_end_date)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cntproj = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Count for project not between order date>>>> + "+cntproj);
if (cntproj == 0)
{
errCode = "VTINVORDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
sql1 ="select approx_cost from project where proj_code = ?" ;
projCode =checkNull(genericUtility.getColumnValue("proj_code",dom ));
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, projCode);
System.out.println("Project code is....."+projCode);
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
approxCost =rs1.getDouble(1);
System.out.println("approxCost for Project Code>>>>>>>> "
+ approxCost);
}
sql = "select count(*) from porder,porddet"
+ " where (porddet.purc_order = porder.purc_order)"
+ "and porder.confirmed = 'N' and porddet.proj_code = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
cntporder = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Count for porder>>>> + "+cntporder);
if (cntporder >= 1)
{
errCode = "VTDUPROJ1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
System.out.println("AmdNo>>>>>" +amdNo);
if(amdNo == null || amdNo.trim().length() ==0)
{
amdNo ="@@@@@";
}
sql = "select count(*) from poamd_hdr,poamd_det"
+ " where (poamd_det.amd_no = poamd_hdr.amd_no)"
+ "and poamd_hdr.confirmed = 'N' and poamd_det.proj_code = ? " +
"and poamd_det.amd_no ! = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,projCode);
pstmt.setString(2,amdNo);
rs = pstmt.executeQuery();
while (rs.next())
{
cntamd = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Count for poamd>>>> + "+cntamd);
if (cntamd >= 1)
{
errCode = "VTDUPRO3";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
/*CODE FOR INDENT AND INDENT REQ VALIDATION COUNT*/
sql="select count(*) from indent where status = 'U' and proj_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
cntind = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Count for indent>>>> + "+ cntind);
if (cntind >= 1)
{
errCode = "VTDUPROJ2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
sql = "select count(*) from indent_hdr where confirmed = 'N' and proj_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
cntindhdr = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Count for indent where unconfirmed indent>>>> + "+ cntindhdr);
if (cntindhdr >= 1)
{
errCode = "VTDUPROJ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
double indBalance=0;
double totAmtIndent =0;
sql1 =" select sum(quantity * purc_rate) " +
"from indent where proj_code = ? " +
"and status NOT IN ('C','X')";
projCode =checkNull(genericUtility.getColumnValue("proj_code",dom ));
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, projCode);
System.out.println("Project code IN (quantity * purc_rate) is....."+projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
totAmtIndent =rs.getDouble(1);
System.out.println("totAmtDet for Indent with quant* rate>>>>>>>> "+ totAmtIndent);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("totAmtDet for Indent with quant* rate>>>>>>>> "+ totAmtIndent);
sql ="select sum(ord_qty * purc_rate) from indent where proj_code = ?" +
"and status NOT IN ('C','X') ";
projCode =checkNull(genericUtility.getColumnValue("proj_code",dom ));
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
System.out.println("Project code in (ord_qty * purc_rate)is....."+projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
indBalance =rs.getDouble(1);
System.out.println("totAmtDet for Indent with ordqty * purcrate>>>>>>>> "+indBalance);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
totAmtDetIndent =totAmtIndent - indBalance;
System.out.println("totAmtDet for Indent with quant* rate>>>>>>>> "+ totAmtIndent);
System.out.println("totAmtDet for Indent with ordqty * purcrate>>>>>>>> "+indBalance);
System.out.println("totAmtDet for Indent with totAmtDetIndent>>>>>>>> "+totAmtDetIndent);
sql1 ="select sum(a.quantity * a.rate) from porddet a, porder b" +
" where ( a.purc_order = b.purc_order ) and b.confirmed = 'Y'" +
" and a.proj_code = ? and a.purc_order! = ? and line_no != ?" ;
projCode =checkNull(genericUtility.getColumnValue("proj_code",dom ));
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, projCode);
pstmt.setString(2,pordNo);
pstmt.setString(3, lineNoOrd);
System.out.println("Project code is....."+projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
totAmtDetporder =rs.getDouble(1);
System.out.println("totAmtDet for Porder in loop>>>>>>>> "
+ totAmtDetporder);
}
System.out.println("totAmtDet for Porder outside loop>>>>>>>> "
+ totAmtDetporder);
System.out.println("dom@@@@"+genericUtility.serializeDom(dom));
System.out.println("dom1111@@@@"+genericUtility.serializeDom(dom1));
System.out.println("dom2222222222@@@@"+genericUtility.serializeDom(dom2));
NodeList detail2List = dom2.getElementsByTagName("Detail2");
System.out.println("ChildNOde"+childNodeName);
System.out.println("detail2List"+detail2List);
noOfParent = detail2List.getLength();
System.out.println("NO OF PARENT@@@@"+noOfParent);
int a=0;
projCode =checkNull(genericUtility.getColumnValue("proj_code",dom ));
System.out.println("projCode>>>>"+projCode);
for (a = 0; a < noOfParent; a++)
{
System.out.println("in loop");
System.out.println(" detail2List.item(a)"+ detail2List.item(a));
System.out.println(genericUtility.getColumnValueFromNode("proj_code", detail2List.item(a))+"in genericutility");
String projcodeBrow =checkNull(genericUtility.getColumnValueFromNode("proj_code", detail2List.item(a)));
System.out.println("projcodebrow>>>"+projcodeBrow);
System.out.println("projcode>>"+projCode);
if(projcodeBrow.equals(projCode))
{
System.out.println("in condition!!!");
String quantitypoamd=checkNull(genericUtility.getColumnValueFromNode("quantity", detail2List.item(a)));
double quantitypoamddet =0,ratepoamddet =0,totAmtDetPoamdDetbrowtemp =0;
quantitypoamddet = quantitypoamd==null?0:Double.parseDouble(quantitypoamd);
System.out.println("<quantitypoamd >@@@@@@ " + quantitypoamd);
String ratepoamd=checkNull(genericUtility.getColumnValueFromNode("rate", detail2List.item(a)));
ratepoamd = ratepoamd != null && ratepoamd.trim().length() > 0 ? ratepoamd.trim() : "0";
System.out.println("<ratepoamd > @@@@@@@@@@@@@@@@@" + ratepoamd);
ratepoamddet = ratepoamd==null?0:Double.parseDouble(ratepoamd);
totAmtDetPoamdDetbrowtemp =quantitypoamddet * ratepoamddet;
System.out.println("totAmtDetPoamdDetbrowtemp @@@ "+totAmtDetPoamdDetbrowtemp);
totAmtDetPoamdDetbrow =totAmtDetPoamdDetbrowtemp +totAmtDetPoamdDetbrow;
}
System.out.println("totAmtDetPoamdDetbrow>>"+ totAmtDetPoamdDetbrow);
}
System.out.println("totAmtDet for Indent with quant* rate>>>>>>>> "+ totAmtDetIndent);
System.out.println("totAmtDet for poamd>>>>>>>> " +totAmtDetPoamdDetbrow);
System.out.println("totAmtDet for porder>>>>>>>> " +totAmtDetporder);
totAmtProj = totAmtDetIndent + totAmtDetPoamdDetbrow + totAmtDetporder;
System.out.println("totAmtProj>>>>> "+totAmtProj);
if(totAmtProj > approxCost )
{
errCode = "VTPROJCOST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
//Ended by Priyanka Das Request ID -D15ESUN002
}
if( childNodeName.equalsIgnoreCase("req_date") )
{
......
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