Commit 6a0a8983 authored by agaikwad's avatar agaikwad

Changes in Exceeded and Current Order Amd amount.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100093 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c61d9178
......@@ -415,6 +415,8 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
{
PreparedStatement pstmt = null, pstmt1 = null, pstmt3 = null, pstmtSql = null, pstmt4 = null,pstmt2 = null,pstmt5 = null,pstmt6 = null, pstmt7 = null, pstmtmax = null, pstmtcount = null,pstmtupd = null;
PreparedStatement pstmtopen=null,pstmtrcp=null,pstmtret=null,pstmtold=null;
ResultSet rsopen=null,rsrcp=null,rsret=null,rsold=null;
ResultSet rs = null, rs1 = null, rs3 = null, rs2 = null, rs6= null, rs7 = null, rsmax= null, rscount= null;
int cnt = 0 ,cnt1 = 0,cntpo = 0;
// Document dom = null;
......@@ -464,12 +466,14 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
String allowover="";
String taskcodeParent="";
double apprvlead= 0 ;
String lineNoold="";
String remark="";
double totAmtpoamdtemp =0,approxCost = 0,totAmtDetpordertot = 0,totAmtPoamd =0,totAmtDetpordertotNtc = 0.0 ,totAmtDetpordertotPorcpConf=0.0, totAmtDetpordertotPorcpSer=0.0;;;
String pordType ="";
String varValue ="";
boolean ValueType = false;
DistCommon discommon = new DistCommon();
double sumQtyamd=0,excedAmt=0;
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -591,7 +595,19 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
System.out.println("ValueType2222222>>>>"+ValueType);
System.out.println("Project Code>>>> [" + projCode);
double totAmtpoamdtempold=0;
String totAmtpoamdtempold1="";
sql="select line_no__ord from poamd_det where amd_no = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, amdNo);
System.out.println("Line is for poamdconf....."+ projCode);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
lineNoold= rs1.getString(1);
System.out.println(" POAMD old"+lineNoold);
sql ="select a.proj_code, sum(a.tot_amt * b.exch_rate)" +//a.net_amt * b.exch_rate
" from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no " +
......@@ -602,7 +618,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
pstmt.setString(1, amdNo);
System.out.println("Project code is for poamdconf....."+ projCode);
rs = pstmt.executeQuery();
while (rs.next())
if (rs.next())
{
projCode = rs.getString(1);
totAmtpoamdtemp = rs.getDouble(2);
......@@ -674,58 +690,137 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
" and b.confirmed = 'Y' and c.proj_code = ? " +
" and b.status ! = 'X'" +
" and c.status = 'C' and b.tran_ser='P-RCP'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
pstmtrcp = conn.prepareStatement(sql);
pstmtrcp.setString(1, projCode);
//pstmt.setString(2, pordNo);
rs = pstmt.executeQuery();
if (rs.next())
rsrcp = pstmtrcp.executeQuery();
if (rsrcp.next())
{
totAmtDetpordertotPorcpConf= rs.getDouble(1);
totAmtDetpordertotPorcpConf= rsrcp.getDouble(1);
System.out.println(" POrcp VALUE>>>>>>>> "+ totAmtDetpordertotPorcpConf);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
rsrcp.close();
rsrcp = null;
pstmtrcp.close();
pstmtrcp = null;
sql = "select sum( a.tot_amt * b.exch_rate) from porddet a, porder b"
+ " where ( a.purc_order = b.purc_order ) and b.confirmed = 'Y' and a.proj_code = ? and b.status! = 'X' and a.status! ='C'" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
pstmtopen = conn.prepareStatement(sql);
pstmtopen.setString(1, projCode);
// pstmt.setString(2, pordNo);
rs = pstmt.executeQuery();
if (rs.next())
rsopen = pstmtopen.executeQuery();
if (rsopen.next())
{
totAmtDetpordertotNtc= rs.getDouble(1);
totAmtDetpordertotNtc= rsopen.getDouble(1);
System.out.println("totAmtDet for Porder without in loop and status pordet is not C>>>>>>>> "+ totAmtDetpordertotNtc);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
rsopen.close();
rsopen = null;
pstmtopen.close();
pstmtopen = null;
sql= "select sum(a.net_amt * b.exch_rate) from porcpdet a, porcp b ,porddet c " +
" where ( a.purc_order = c.purc_order )" +
"and (a.tran_id = b.tran_id )" +
"and b.confirmed = 'Y' and a.line_no__ord = c.line_no and c.proj_code = ?" +
" and b.status ! = 'X'and c.status = 'C' and b.tran_ser= 'P-RET'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, projCode);
pstmtret = conn.prepareStatement(sql);
pstmtret.setString(1, projCode);
// pstmt.setString(2, pordNo);
rs = pstmt.executeQuery();
if (rs.next())
rsret = pstmtret.executeQuery();
if (rsret.next())
{
totAmtDetpordertotPorcpSer = rs.getDouble(1);
totAmtDetpordertotPorcpSer = rsret.getDouble(1);
System.out.println(" return value is>>>>>>>> "+ totAmtDetpordertotPorcpSer);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
rsret.close();
rsret = null;
pstmtret.close();
pstmtret = null;
totAmtDetpordertot= totAmtDetpordertotNtc + totAmtDetpordertotPorcpConf - totAmtDetpordertotPorcpSer;
sql="select sum(a.rate__o * a.quantity__o * b.exch_rate) " +
" from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no " +
"and a.amd_no = ?";
pstmtold = conn.prepareStatement(sql);
pstmtold.setString(1, amdNo);
System.out.println("Project code is for poamdconf....."+ projCode);
rsold = pstmtold.executeQuery();
if(rsold.next())
{
totAmtpoamdtempold = rsold.getDouble(1);
System.out.println("TOTAMT OF POAMD old"+totAmtpoamdtempold);
}
rsold.close();
rsold = null;
pstmtold.close();
pstmtold = null;
totAmtpoamdtempold = totAmtpoamdtemp - totAmtpoamdtempold;
System.out.println("sumQtyamd" + totAmtpoamdtempold1);
totAmtpoamdtempold1=String.valueOf(totAmtpoamdtempold);
if(totAmtpoamdtempold1.contains("-"))
{
System.out.println("INNNNNN");
totAmtpoamdtempold = totAmtpoamdtempold * (-1);
System.out.println("IN MINUS " + totAmtpoamdtempold);
}
System.out.println("ABhi testing add old qty" + totAmtpoamdtempold);
System.out.println("linenoOrdBrow>>>["+totAmtpoamdtempold+"]" );
/*sumQtyamd=rateOldamd * qtyOldamd;
sumqty= String.valueOf(sumQtyamd);
System.out.println("Sum Quamtity String" + sumqty);
sumQtyamd = totAmtDetPoamdDetbrowtemp - sumQtyamd;
System.out.println("sumQtyamd" + sumQtyamd);
if(sumqty.contains("-"))
{
System.out.println("INNNNNN");
sumQtyamd = sumQtyamd * (-1);
System.out.println("IN MINUS " + sumQtyamd);
}
System.out.println("ABhi testing add old qty" + sumQtyamd);
countqty++;
System.out.println("linenoOrdBrow>>>["+linenoOrdBrow+"]a["+a+"]" );
if(linenoOrdBrow == null || "@".equalsIgnoreCase(linenoOrdBrow) || "".equalsIgnoreCase(linenoOrdBrow) || linenoOrdBrow.trim().length()==0)
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]+totAmtDetpordertot["+totAmtDetpordertot+"]-approxCost["+approxCost+"]");
excedAmt += sumQtyamd + totAmtDetpordertot - approxCost;
}
else
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]");
excedAmt += sumQtyamd;
}
System.out.println("@@@@@@@@@@ after excedAmt["+excedAmt+"]");*/
if(lineNoold == null || "@".equalsIgnoreCase(lineNoold) || "".equalsIgnoreCase(lineNoold) || lineNoold.trim().length()==0)
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]+totAmtDetpordertot["+totAmtDetpordertot+"]-approxCost["+approxCost+"]");
excedAmt += totAmtpoamdtempold + totAmtDetpordertot - approxCost;
}
else
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]");
excedAmt += totAmtpoamdtempold;
}
System.out.println("@@@@@@@@@@ after excedAmt["+excedAmt+"]");
/* totAmtDetpordertot = totAmtDetpordertotNtc + totAmtDetpordertotPorcpConf - totAmtDetpordertotPorcpSer;
System.out.println( totAmtDetpordertotNtc +"-" +totAmtDetpordertotPorcpConf+"-"+ totAmtDetpordertotPorcpSer);
System.out.println("Consumed Amount " + totAmtDetpordertot);*/
/* Ended by Abhijit */
totAmtPoamd = totAmtnotcurr + totAmtDetpordertot + totAmtpoamdtemp;
......@@ -755,7 +850,9 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
+" ; Consumed Amount : "+ BigDecimal.valueOf(totAmtDetpordertot).toPlainString()
+" ; Current Purchase Order Amendment Amount : "+ BigDecimal.valueOf(totAmtpoamdtemp).toPlainString()
// +" ; Exceeded Amount : "+ BigDecimal.valueOf(totAmtPoamd - approxCost).toPlainString();
+" ; Exceeded Amount : "+ BigDecimal.valueOf(approxCost - totAmtDetpordertot).toPlainString();
// +" ; Exceeded Amount : "+ BigDecimal.valueOf(approxCost - totAmtDetpordertot).toPlainString();
//+" ; Exceeded Amount : "+ BigDecimal.valueOf( totAmtpoamdtempold + totAmtDetpordertot - approxCost).toPlainString();
+" ; Exceeded Amount : "+ BigDecimal.valueOf( excedAmt).toPlainString();
System.out.println("Value ::: "+ value);
......@@ -771,6 +868,11 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rs = null;
pstmt.close();
pstmt = null;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
}
/*Request ID -D15ISUN003 End*/
......
......@@ -150,6 +150,8 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
String totAmtDetpordertempstr ="",quantitypoamd ="",ratepoamd ="",acctCodeCrporder ="";
String acctCodeCrbrow ="", taxpoamd ="";
String discountpoamd ="",varValueprojectType ="";
String rateOld="",qtyOld = "",sumqty ="",totAmtDetPoamdDetbrow1 ="";
double rateOldamd=0,qtyOldamd=0,sumQtyamd=0,sumQtyamdNew=0,excedAmt=0;
DistCommon distCommon = new DistCommon();
try {
......@@ -1508,17 +1510,19 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("detail2List" + detail2List);
noOfParent = detail2List.getLength();
System.out.println("NO OF PARENT@@@@"+ noOfParent);
int countqty=0;
a = 0;
projCode = checkNull(genericUtility.getColumnValue("proj_code", dom));
System.out.println("projCode>>>>" + projCode);
for (a = 0; a < noOfParent; a++)
{
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("a["+a+"]projcodebrow>>>"+ projcodeBrow);
System.out.println("projcode>>" + projCode);
if (projcodeBrow.equals(projCode))
if (projcodeBrow != null && projcodeBrow.trim().equalsIgnoreCase(projCode.trim()))
{
System.out.println("in condition!!!");
quantitypoamd = checkNull(genericUtility.getColumnValueFromNode("quantity__stduom",detail2List.item(a)));
......@@ -1543,6 +1547,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("<totAmtDetPoamdDetbrowtemp > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrowtemp);
pordNo = checkNull(genericUtility.getColumnValueFromNode("purc_order",detail2List.item(a)));
linenoOrdBrow = checkNull(genericUtility.getColumnValueFromNode("line_no__ord",detail2List.item(a)));
//line_no__ord
System.out.println("linenoOrdBrow>>>" +linenoOrdBrow );
if(linenoOrdBrow == null || linenoOrdBrow.trim().length() == 0)
{
......@@ -1551,11 +1556,60 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("totAmtDetPoamdDetbrowtemp @@@ "+ totAmtDetPoamdDetbrowtemp);
totAmtDetPoamdDetbrow = totAmtDetPoamdDetbrowtemp + totAmtDetPoamdDetbrow;
temparr = temparr + linenoOrdBrow +",";
}
rateOld = checkNull(genericUtility.getColumnValueFromNode("rate__o",detail2List.item(a)));
rateOld = rateOld != null&& rateOld.trim().length() > 0 ? rateOld.trim() : "0";
System.out.println("*********rateOLDpoamd*************"+ rateOld);
rateOldamd = rateOld == null ? 0: Double.parseDouble(rateOld);
qtyOld = checkNull(genericUtility.getColumnValueFromNode("quantity__o",detail2List.item(a)));
qtyOld = qtyOld != null&& qtyOld.trim().length() > 0 ? qtyOld.trim() : "0";
System.out.println("************QTY OLD poamd **********"+ qtyOld);
qtyOldamd = qtyOld == null ? 0: Double.parseDouble(qtyOld);
sumQtyamd=rateOldamd * qtyOldamd;
sumqty= String.valueOf(sumQtyamd);
System.out.println("Sum Quamtity String" + sumqty);
sumQtyamd = totAmtDetPoamdDetbrowtemp - sumQtyamd;
System.out.println("sumQtyamd" + sumQtyamd);
if(sumqty.contains("-"))
{
System.out.println("INNNNNN");
sumQtyamd = sumQtyamd * (-1);
System.out.println("IN MINUS " + sumQtyamd);
}
System.out.println("ABhi testing add old qty" + sumQtyamd);
countqty++;
System.out.println("linenoOrdBrow>>>["+linenoOrdBrow+"]a["+a+"]" );
if(linenoOrdBrow == null || "@".equalsIgnoreCase(linenoOrdBrow) || "".equalsIgnoreCase(linenoOrdBrow) || linenoOrdBrow.trim().length()==0)
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]+totAmtDetpordertot["+totAmtDetpordertot+"]-approxCost["+approxCost+"]");
excedAmt += sumQtyamd + totAmtDetpordertot - approxCost;
}
else
{
System.out.println("@@@@@@@@@@ excedAmt["+excedAmt+"]sumQtyamd["+sumQtyamd+"]");
excedAmt += sumQtyamd;
}
System.out.println("@@@@@@@@@@ after excedAmt["+excedAmt+"]");
/* if(countqty > 1)
{
excedAmt = sumQtyamd + totAmtDetpordertot - approxCost;
System.out.println("totAmtDetpordertot");
System.out.println("approxCost" +approxCost);
System.out.println("sumQtyamd"+sumQtyamd);
System.out.println("excedAmt"+excedAmt);
sumQtyamd = excedAmt +sumQtyamd;
System.out.println("sumQtyamd" +sumQtyamd );
}*/
}
if(temparr.length() >0)
}
/* if(temparr.length() >0)
{
String tempArray[]=temparr.split(",");
System.out.println("tempArray[].length :-["+tempArray.length+"]");
......@@ -1590,7 +1644,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
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 ! = ?";
......@@ -1620,7 +1674,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("totAmtDet for porder>>>>>>>> "+ totAmtDetporder);
//totAmtDetPoamdDetbrow = totAmtDetPoamdDetbrow *exchRatePoAmd;
totAmtProj = totAmtDetPoamdDetbrow + totAmtDetporder+ totAmtDetpordertot;
System.out.println("totAmtProj>>>>> "+ totAmtProj);
System.out.println("totA mtProj>>>>> "+ totAmtProj);
if (totAmtProj > approxCost)
{
errCode = "VTPROJCOST";
......@@ -3095,12 +3149,17 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
descrEnd = descrStr.substring(descrStr.indexOf("]"),descrStr.length());
System.out.println("<approxCost IN ERROR MESSAGE> @@@@@@@@@@@@@@@@@"+ approxCost);
System.out.println("<totAmtDetpordertot IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ totAmtDetpordertot);
System.out.println("<totAmtDetPoamdDetbrow + totAmtDetporder IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrow + totAmtDetporder);
System.out.println("<excedAmt @@@@@@@@@@@@@@@@@"+ excedAmt);
System.out.println("<totAmtDetporder @@@@@@@@@@@@@@@@@"+ totAmtDetporder);
System.out.println("<sumQtyamd + totAmtDetporder - approxCost IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ sumQtyamd + totAmtDetporder);
System.out.println("<sumQtyamd + totAmtDetpordertot IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrow + totAmtDetporder);
value = " ; Project Aprroved Amount : "+ BigDecimal.valueOf(approxCost).toPlainString()
+" ; Consumed Amount : "+ BigDecimal.valueOf(totAmtDetpordertot).toPlainString()
+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow + totAmtDetporder ).toPlainString()
//+" ; Exceeded Amount : "+ BigDecimal.valueOf(totAmtProj - approxCost).toPlainString();
+" ; Exceeded Amount : "+ BigDecimal.valueOf(totAmtDetpordertot - approxCost).toPlainString();
//+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow + totAmtDetporder ).toPlainString()
+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow).toPlainString()
//+" ; Exceeded Amount : "+ BigDecimal.valueOf( sumQtyamd + totAmtDetpordertot - approxCost).toPlainString();
// +" ; Exceeded Amount : "+ BigDecimal.valueOf(totAmtDetpordertot - approxCost).toPlainString();
+" ; Exceeded Amount : "+ BigDecimal.valueOf(excedAmt).toPlainString();
System.out.println("Value ::: "+ value);
descrStart = descrStart.concat(value).concat(descrEnd);
......
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