Commit 86523bcf authored by pdas's avatar pdas

REQUEST ID -D1ISUN003

Changes made for validation of porder amdic and confirm VALIDATION


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99395 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 575afe2c
package ibase.webitm.ejb.dis;
import java.math.BigDecimal;
import java.rmi.RemoteException;
//import java.util.logging.Level;
//import java.util.logging.Logger;
......@@ -14,7 +15,11 @@ import java.text.SimpleDateFormat;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
//import javax.swing.text.Document;
import java.util.Date;
......@@ -173,6 +178,7 @@ public class POrderAmdConf extends ActionHandlerEJB implements POrderAmdConfLoca
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
......@@ -180,6 +186,7 @@ public class POrderAmdConf extends ActionHandlerEJB implements POrderAmdConfLoca
System.out.println( ">>>>>>>>>>>>>In finaly errString:"+errString);
if (errString != null && errString.trim().length() > 0 && !("d".equalsIgnoreCase(errString)))
{
conn.rollback();
System.out.println("Transaction rollback... ");
conn.close();
......@@ -287,7 +294,7 @@ public class POrderAmdConf extends ActionHandlerEJB implements POrderAmdConfLoca
}
errCode = ConfirmPordAmd(amdNo, conn);
if (errCode != null && errCode.trim().length() > 0)
{
conn.rollback();
......@@ -458,6 +465,11 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
String taskcodeParent="";
double apprvlead= 0 ;
String remark="";
double totAmtpoamdtemp =0,approxCost = 0,totAmtDetpordertot = 0,totAmtPoamd =0;
String pordType ="";
String varValue ="";
boolean ValueType = false;
DistCommon discommon = new DistCommon();
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -534,6 +546,144 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
errCode = itmDBAccessLocal.getErrorString("", errCode, "");
return errCode;
}
/*Request ID -D15ISUN003 Start Changed By Priyanka Das */
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);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Amdtype.........." + pordType);
varValue = discommon.getDisparams("999999","TYPE_ALLOW_PROJBUDGET", conn);
System.out.println(">>>>>>>>>In for loop afer schemeKey varValue:"+varValue);
varValue = varValue.trim();
if(varValue != null && varValue.trim().length() > 0)
{
String varValArr[] = varValue.split(",");
ArrayList varValList = new ArrayList<String>(Arrays.asList(varValArr));
System.out.println("varValList ::"+varValList);
System.out.println("varValList.contains(pordType) ::"+varValList.contains(pordType));
if(varValList.contains(pordType))
{
ValueType = true;
}
else
{
ValueType = false;
}
}
System.out.println("ValueType11111>>>>"+ValueType);
if (varValue != null && varValue.trim().length() > 0 && varValue != "NULLFOUND" && ValueType == true)
{
System.out.println("ValueType2222222>>>>"+ValueType);
System.out.println("Project Code>>>> [" + projCode);
sql ="select a.proj_code, sum(a.tot_amt)" +
" from poamd_det a,poamd_hdr b " +
"where a.purc_order = b.purc_order " +
"and a.amd_no = ? group by a.proj_code";
System.out.println("AmdNo>>>>>" + amdNo);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, amdNo);
System.out.println("Project code is for poamdvalidation....."+ projCode);
rs = pstmt.executeQuery();
while (rs.next())
{
projCode = rs.getString(1);
totAmtpoamdtemp = rs.getDouble(2);
System.out.println("TOTAMT OF POAMD"+totAmtpoamdtemp);
sql2 ="select approx_cost from project where proj_code =?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,projCode);
System.out.println("Project code is for poamdvalidation....."+ projCode);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
approxCost = rs2.getDouble(1);
}
System.out.println("APPROXCOST FOR PROJECT CODE>>>>"+approxCost);
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
sql1 = "select sum( a.tot_amt ) 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 b.status! = 'X'";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, projCode);
pstmt1.setString(2,purcOrder);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
totAmtDetpordertot = rs1.getDouble(1);
System.out.println("totAmtDet for Porder without in loop>>>>>>>> "+ totAmtDetpordertot);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("totAmtDet for Porder outside loop>>>>>>>> "+ totAmtDetpordertot);
totAmtPoamd = totAmtDetpordertot + totAmtpoamdtemp;
System.out.println("totamtpoamd>>>>.."+totAmtPoamd);
System.out.println("totamtpordertot"+totAmtDetpordertot);
System.out.println("totamtpoamdtemp"+totAmtpoamdtemp);
if(approxCost < totAmtPoamd)
{
System.out.println("In approxcost validation>>");
errCode = "VTPROJCOST";
errCode = new ValidatorEJB().getErrorString("", errCode, "");
System.out.println("::: errCode["+errCode+"]");
String startStr = errCode.substring(0,errCode.indexOf("<description>") + 13);
String endStr = errCode.substring(errCode.indexOf("</description>"),errCode.length());
System.out.println("endStr ["+endStr+"]");
String descrStr = errCode.substring(errCode.indexOf("<description>") + 13,errCode.indexOf("</description>"));
System.out.println("::: descrStr ["+descrStr+"]");
String descrStart = descrStr.substring(0, descrStr.indexOf("]"));
String descrEnd = descrStr.substring(descrStr.indexOf("]"),descrStr.length());
String value = " ; Project Aprroved Amount : "+ BigDecimal.valueOf(approxCost).toPlainString()
+" ; Consumed Amount : "+ BigDecimal.valueOf(totAmtDetpordertot).toPlainString()
+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtpoamdtemp).toPlainString()
+" ; Exceeded Amount : "+ BigDecimal.valueOf(totAmtPoamd - approxCost).toPlainString()
+"; For Project Code : " + projCode;
System.out.println("Value ::: "+ value);
descrStart = descrStart.concat(value).concat(descrEnd);
errCode = startStr.concat(descrStart).concat(endStr);
return errCode;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
/*Request ID -D15ISUN003 End*/
/**
* VALLABH select Advance account code CCTR code from header
* supp_code VALLABH KADAM 19/NOV/14 END
......@@ -1425,6 +1575,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
{
cctrCodeCr = " ";
}
sql = " insert into porddet ( purc_order,line_no,site_code,ind_no,item_code,quantity,unit,rate,"
+ " discount,tax_amt,tot_amt,loc_code,req_date,dlv_date,dlv_qty,status,status_date,"
......
......@@ -137,13 +137,13 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
double totAmtDetPoamdDetbrow = 0, totAmtDetIndent = 0, totAmtDetporder = 0, approxCost = 0, totAmtProj = 0;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String linearr [];
String temparr ="";
String temparr ="",sql2 = "";
int a =0;
ArrayList line =new ArrayList();
double quantitypoamddet = 0, ratepoamddet = 0, totAmtDetPoamdDetbrowtemp = 0;
String line1 ="";
String startStr ="",endStr = "",descrStr = "",descrStart ="", descrEnd ="" ,exchRateStr ="",value ="";
double discountpoamddet =0,taxpoamddet =0;
double discountpoamddet =0,taxpoamddet =0,totAmtpoamd = 0;
boolean ValueType = false,ValueProjectType = false;
int cntindamdhdr = 0,itrArr =0,maxLine =0;
int pos;
......@@ -1193,7 +1193,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql = "select count(*) from porder,porddet"
/*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);
......@@ -1215,13 +1215,13 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
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"
/* 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 ! = ?";
......@@ -1245,12 +1245,12 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
errFields.add(childNodeName.toLowerCase());
}
/*
*/ /*
* CODE FOR INDENT AND INDENT REQ VALIDATION
* COUNT
*/
sql = "select count(*) from indent where status = 'U' and proj_code = ?";
/*sql = "select count(*) from indent where status = 'U' and proj_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
rs = pstmt.executeQuery();
......@@ -1309,7 +1309,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
errFields.add(childNodeName.toLowerCase());
}
/*
*/ /*
* sql1 =" select sum(quantity * purc_rate) " +
* "from indent where proj_code = ? " +
* "and status NOT IN ('C','X')"; projCode
......@@ -1489,12 +1489,40 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
totAmtDetporder = totAmtDetporder + totAmtDetpordertemp;
System.out.println("totAmtDet for Porder in loop>>>>>>>> "+ totAmtDetporder);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
sql2 ="select sum(a.tot_amt) from poamd_det a,poamd_hdr b " +
" where (a.purc_order = b.purc_order) and a.proj_code = ? " +
" and a.amd_no ! = ?";
projCode = checkNull(genericUtility.getColumnValue("proj_code", dom));
System.out.println("AmdNo>>>>>" + amdNo);
if (amdNo == null || amdNo.trim().length() == 0)
{
amdNo = "@@@@@";
}
pstmt = conn.prepareStatement(sql2);
pstmt.setString(1, projCode);
pstmt.setString(2, amdNo);
System.out.println("Project code is for poamdvalidation....."+ projCode);
rs = pstmt.executeQuery();
if (rs.next())
{
totAmtpoamd = rs.getDouble(1);
System.out.println("totAmtDet for Porderamendment for total@@@@@@@>>>>>>>> "+ totAmtpoamd);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("totAmtDet for Porderamendment for total@@@@@@@>>>>>>>> "+ totAmtpoamd);
System.out.println("totAmtDetPoamdDetbrow>>"+ totAmtDetPoamdDetbrow);
System.out.println("totAmtDet for poamd>>>>>>>> "+ totAmtDetPoamdDetbrow);
System.out.println("totAmtDet for porder>>>>>>>> "+ totAmtDetporder);
//totAmtDetPoamdDetbrow = totAmtDetPoamdDetbrow *exchRatePoAmd;
totAmtProj = totAmtDetPoamdDetbrow + totAmtDetporder+ totAmtDetpordertot;
totAmtProj = totAmtDetPoamdDetbrow + totAmtDetporder+ totAmtDetpordertot +totAmtpoamd;
System.out.println("totAmtProj>>>>> "+ totAmtProj);
if (totAmtProj > approxCost)
{
......
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