Commit 7e8402ee authored by agaikwad's avatar agaikwad

Added exch_rate in validation and Confirm.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100395 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 50d24956
...@@ -608,7 +608,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -608,7 +608,7 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
double totAmtpoamdtempold=0; double totAmtpoamdtempold=0;
String totAmtpoamdtempold1=""; String totAmtpoamdtempold1="";
sql="select line_no__ord from poamd_det where amd_no = ?"; sql="select line_no__ord , proj_code from poamd_det where amd_no = ?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, amdNo); pstmt1.setString(1, amdNo);
System.out.println("Line is for poamdconf....."+ projCode); System.out.println("Line is for poamdconf....."+ projCode);
...@@ -616,27 +616,31 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -616,27 +616,31 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
while(rs1.next()) while(rs1.next())
{ {
lineNoold= rs1.getString(1); lineNoold= rs1.getString(1);
System.out.println(" POAMD old"+lineNoold); projCode= rs1.getString(2);
sql ="select a.proj_code, sum(a.tot_amt * b.exch_rate)" +//a.net_amt * b.exch_rate System.out.println(" Abhi Line is " +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 " + " from poamd_det a,poamd_hdr b " +
"where a.amd_no = b.amd_no " + "where a.amd_no = b.amd_no and a.line_no__ord= ?" +
"and a.amd_no = ? group by a.proj_code"; "and a.amd_no = ? group by a.proj_code";*/
sql="select 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 and a.proj_code= ?" +
"and a.amd_no = ? group by a.proj_code";
System.out.println("AmdNo>>>>>" + amdNo); System.out.println("AmdNo>>>>>" + amdNo);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, amdNo); pstmt.setString(1, projCode);
System.out.println("Project code is for poamdconf....."+ projCode); pstmt.setString(2, amdNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
projCode = rs.getString(1); totAmtpoamdtemp = rs.getDouble(1);
totAmtpoamdtemp = rs.getDouble(2);
System.out.println("TOTAMT OF POAMD"+totAmtpoamdtemp); System.out.println("TOTAMT OF POAMD"+totAmtpoamdtemp);
sql2 ="select approx_cost from project where proj_code =?"; sql2 ="select approx_cost from project where proj_code =?";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,projCode); pstmt2.setString(1,projCode);
System.out.println("Project code is for poamdvalidation....."+ projCode); System.out.println("Project code is Abhi....."+ projCode);
rs2 = pstmt2.executeQuery(); rs2 = pstmt2.executeQuery();
if(rs2.next()) if(rs2.next())
{ {
...@@ -751,31 +755,25 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd ...@@ -751,31 +755,25 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
rsold = null; rsold = null;
pstmtold.close(); pstmtold.close();
pstmtold = null; pstmtold = null;
System.out.println("ABhi testing add old qty" + totAmtpoamdtempold);
System.out.println("linenoOrdBrow>>>["+totAmtpoamdtempold+"]" );
if((lineNoold == null || "@".equalsIgnoreCase(lineNoold) || "".equalsIgnoreCase(lineNoold) || lineNoold.trim().length()==0 ) && firstNull== true) if((lineNoold == null || "@".equalsIgnoreCase(lineNoold) || "".equalsIgnoreCase(lineNoold) || lineNoold.trim().length()==0 ) && firstNull== true)
{ {
firstNull=false; firstNull=false;
System.out.println("totAmtpoamdtemp@@@@@@@@" +totAmtpoamdtemp);
tottemp+=totAmtpoamdtemp; tottemp+=totAmtpoamdtemp;
System.out.println("totAmtpoamdtemp Null @@@@@" + totAmtpoamdtemp); System.out.println("totAmtpoamdtemp Null @@@@@" + totAmtpoamdtemp);
} }
else else
{ {
System.out.println("totAmtDetPoamdDetbrowtemp else @@@@@@@@" +totAmtpoamdtemp);
System.out.println("sumQtyamd else @@@@@@@@" + sumQtyamd);
tottemp+= totAmtpoamdtemp - totAmtpoamdtempold; tottemp+= totAmtpoamdtemp - totAmtpoamdtempold;
if(tottemp < 0) if(tottemp < 0)
{ {
System.out.println(" IF tottemp"); System.out.println(" IF tottemp");
tottemp=0; tottemp=0;
} }
System.out.println("tottemp else @@@@@@@@" + tottemp);
} }
totAmtPoamd = totAmtDetpordertot + tottemp; totAmtPoamd = totAmtDetpordertot + tottemp;
System.out.println("tottemp>>>>.."+tottemp); System.out.println("tottemp>>>>.."+tottemp);
System.out.println("totamtpordertot"+totAmtDetpordertot); System.out.println("totamtpordertot"+totAmtDetpordertot);
System.out.println("totAmtPoamd>>>>.."+totAmtPoamd);
if(approxCost < totAmtPoamd) if(approxCost < totAmtPoamd)
{ {
System.out.println("In approxcost validation>>"); System.out.println("In approxcost validation>>");
......
...@@ -141,14 +141,14 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -141,14 +141,14 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
String temparr ="",sql2 = ""; String temparr ="",sql2 = "";
int a =0; int a =0;
ArrayList line =new ArrayList(); ArrayList line =new ArrayList();
double quantitypoamddet = 0, ratepoamddet = 0, totAmtDetPoamdDetbrowtemp = 0; double quantitypoamddet = 0, ratepoamddet = 0, totAmtDetPoamdDetbrowtemp = 0,exRate=0;
String line1 =""; String line1 ="";
String startStr ="",endStr = "",descrStr = "",descrStart ="", descrEnd ="" ,exchRateStr ="",value =""; String startStr ="",endStr = "",descrStr = "",descrStart ="", descrEnd ="" ,exchRateStr ="",value ="";
double discountpoamddet =0,taxpoamddet =0,totAmtpoamd = 0; double discountpoamddet =0,taxpoamddet =0,totAmtpoamd = 0;
boolean ValueType = false,ValueProjectType = false,firstNull=true; boolean ValueType = false,ValueProjectType = false,firstNull=true;
int cntindamdhdr = 0,itrArr =0,maxLine =0; int cntindamdhdr = 0,itrArr =0,maxLine =0;
int pos; int pos;
String totAmtDetpordertempstr ="",quantitypoamd ="",ratepoamd ="",acctCodeCrporder =""; String totAmtDetpordertempstr ="",quantitypoamd ="",ratepoamd ="",acctCodeCrporder ="",exchate="";
String acctCodeCrbrow ="", taxpoamd =""; String acctCodeCrbrow ="", taxpoamd ="";
String discountpoamd ="",varValueprojectType =""; String discountpoamd ="",varValueprojectType ="";
String rateOld="",qtyOld = "",sumqty ="",totAmtDetPoamdDetbrow1 =""; String rateOld="",qtyOld = "",sumqty ="",totAmtDetPoamdDetbrow1 ="";
...@@ -1463,6 +1463,8 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -1463,6 +1463,8 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
String chekAMt1=""; String chekAMt1="";
projCode = checkNull(genericUtility.getColumnValue("proj_code", dom)); projCode = checkNull(genericUtility.getColumnValue("proj_code", dom));
double tottemp = 0.0; double tottemp = 0.0;
String exchRateOld="";
double exchRateOldamd=0;
System.out.println("projCode>>>>" + projCode); System.out.println("projCode>>>>" + projCode);
for (a = 0; a < noOfParent; a++) for (a = 0; a < noOfParent; a++)
{ {
...@@ -1473,7 +1475,13 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -1473,7 +1475,13 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("projcode>>" + projCode); System.out.println("projcode>>" + projCode);
if (projcodeBrow != null && projcodeBrow.trim().equalsIgnoreCase(projCode.trim())) if (projcodeBrow != null && projcodeBrow.trim().equalsIgnoreCase(projCode.trim()))
{ {
//EXCH_RATE
System.out.println("in condition!!!"); System.out.println("in condition!!!");
exchate = (genericUtility.getColumnValue("exch_rate", dom1));
System.out.println("exchate"+exchate);
exRate = exchate == null ? 0: Double.parseDouble(exchate);
System.out.println("exRate"+exRate);
quantitypoamd = checkNull(genericUtility.getColumnValueFromNode("quantity__stduom",detail2List.item(a))); quantitypoamd = checkNull(genericUtility.getColumnValueFromNode("quantity__stduom",detail2List.item(a)));
quantitypoamddet = quantitypoamd == null ? 0: Double.parseDouble(quantitypoamd); quantitypoamddet = quantitypoamd == null ? 0: Double.parseDouble(quantitypoamd);
System.out.println("<quantitySTDUOMpoamd >@@@@@@ "+ quantitypoamd); System.out.println("<quantitySTDUOMpoamd >@@@@@@ "+ quantitypoamd);
...@@ -1492,7 +1500,9 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -1492,7 +1500,9 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("<taxpoamd > @@@@@@@@@@@@@@@@@"+ taxpoamd); System.out.println("<taxpoamd > @@@@@@@@@@@@@@@@@"+ taxpoamd);
System.out.println("<taxpoamddet > @@@@@@@@@@@@@@@@@"+ taxpoamddet); System.out.println("<taxpoamddet > @@@@@@@@@@@@@@@@@"+ taxpoamddet);
//totAmtDetPoamdDetbrowtemp = quantitypoamddet* ratepoamddet; //totAmtDetPoamdDetbrowtemp = quantitypoamddet* ratepoamddet;
totAmtDetPoamdDetbrowtemp = (quantitypoamddet* ratepoamddet)- ((quantitypoamddet* ratepoamddet * discountpoamddet) / 100)+ taxpoamddet; //lc_tot_amt = lc_tot_amt +((((mqty_brow * lc_rate_brow)-((mqty_brow * lc_rate_brow *lc_disc)/100)) + lc_tax_amt)) * lc_exch_rate
totAmtDetPoamdDetbrowtemp = ((quantitypoamddet* ratepoamddet)- ((quantitypoamddet* ratepoamddet * discountpoamddet) / 100)+ taxpoamddet) * exRate;
System.out.println("totAmtDetPoamdDetbrowtemp"+totAmtDetPoamdDetbrowtemp);
System.out.println("<totAmtDetPoamdDetbrowtemp > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrowtemp); System.out.println("<totAmtDetPoamdDetbrowtemp > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrowtemp);
pordNo = checkNull(genericUtility.getColumnValueFromNode("purc_order",detail2List.item(a))); pordNo = checkNull(genericUtility.getColumnValueFromNode("purc_order",detail2List.item(a)));
linenoOrdBrow = checkNull(genericUtility.getColumnValueFromNode("line_no__ord",detail2List.item(a))); linenoOrdBrow = checkNull(genericUtility.getColumnValueFromNode("line_no__ord",detail2List.item(a)));
...@@ -1514,8 +1524,15 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -1514,8 +1524,15 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
qtyOld = qtyOld != null&& qtyOld.trim().length() > 0 ? qtyOld.trim() : "0"; qtyOld = qtyOld != null&& qtyOld.trim().length() > 0 ? qtyOld.trim() : "0";
System.out.println("************QTY OLD poamd **********"+ qtyOld); System.out.println("************QTY OLD poamd **********"+ qtyOld);
qtyOldamd = qtyOld == null ? 0: Double.parseDouble(qtyOld); qtyOldamd = qtyOld == null ? 0: Double.parseDouble(qtyOld);
//EXCH_RATE__O
exchRateOld =(genericUtility.getColumnValue("exch_rate__o", dom1));
System.out.println("************QTY OLD poamd **********"+ exchRateOld);
exchRateOld = exchRateOld != null&& exchRateOld.trim().length() > 0 ? exchRateOld.trim() : "0";
System.out.println("************QTY OLD poamd **********"+ exchRateOld);
exchRateOldamd = exchRateOld == null ? 0: Double.parseDouble(exchRateOld);
sumQtyamd=rateOldamd * qtyOldamd; sumQtyamd = rateOldamd * qtyOldamd * exchRateOldamd ;
sumqty= String.valueOf(sumQtyamd); sumqty= String.valueOf(sumQtyamd);
System.out.println("Sum Quamtity String" + sumqty); System.out.println("Sum Quamtity String" + sumqty);
...@@ -3042,8 +3059,9 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder ...@@ -3042,8 +3059,9 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("<totAmtDetporder @@@@@@@@@@@@@@@@@"+ totAmtDetporder); System.out.println("<totAmtDetporder @@@@@@@@@@@@@@@@@"+ totAmtDetporder);
System.out.println("<sumQtyamd + totAmtDetporder - approxCost IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ sumQtyamd + totAmtDetporder); System.out.println("<sumQtyamd + totAmtDetporder - approxCost IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ sumQtyamd + totAmtDetporder);
System.out.println("<sumQtyamd + totAmtDetpordertot IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrow + totAmtDetporder); System.out.println("<sumQtyamd + totAmtDetpordertot IN ERROR MESSAGE > @@@@@@@@@@@@@@@@@"+ totAmtDetPoamdDetbrow + totAmtDetporder);
value = " ; Project Aprroved Amount : "+ BigDecimal.valueOf(approxCost).toPlainString() value = " ; Amount Exceeded Project Code : " + projCode +
+" ; Consumed Amount : "+ BigDecimal.valueOf(totAmtDetpordertot).toPlainString() ";Project Aprroved Amount : "+ BigDecimal.valueOf(approxCost).toPlainString()
+" ;Consumed Amount : "+ BigDecimal.valueOf(totAmtDetpordertot).toPlainString()
//+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow + totAmtDetporder ).toPlainString() //+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow + totAmtDetporder ).toPlainString()
+" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow).toPlainString() +" ; Current Purchase Amendment Amount : "+ BigDecimal.valueOf(totAmtDetPoamdDetbrow).toPlainString()
//+" ; Exceeded Amount : "+ BigDecimal.valueOf( sumQtyamd + totAmtDetpordertot - approxCost).toPlainString(); //+" ; Exceeded Amount : "+ BigDecimal.valueOf( sumQtyamd + totAmtDetpordertot - approxCost).toPlainString();
......
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