Commit 36258746 authored by cshah's avatar cshah

DI90SUN060-changes done in wfDepb method for calculating BenefitValue


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91379 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1709e354
...@@ -206,13 +206,13 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -206,13 +206,13 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
{ {
valueXmlString.append(rs.getString(1)==null ?"":rs.getString(1)).append("\t"); valueXmlString.append(rs.getString(1)==null ?"":rs.getString(1)).append("\t");
valueXmlString.append(rs.getString(2)==null ?"":rs.getString(1)).append("\t"); valueXmlString.append(rs.getString(2)==null ?"":rs.getString(2)).append("\t");
valueXmlString.append(rs.getString(3)==null ?"":rs.getString(2)).append("\t"); valueXmlString.append(rs.getString(3)==null ?"":rs.getString(3)).append("\t");
valueXmlString.append(rs.getString(4)==null ?"":rs.getString(3)).append("\t"); valueXmlString.append(rs.getString(4)==null ?"":rs.getString(4)).append("\t");
valueXmlString.append(rs.getString(5)==null ?"":rs.getString(4)).append("\t"); valueXmlString.append(rs.getString(5)==null ?"":rs.getString(5)).append("\t");
valueXmlString.append(rs.getString(6)==null ?"":rs.getString(5)).append("\t"); valueXmlString.append(rs.getString(6)==null ?"":rs.getString(6)).append("\t");
valueXmlString.append(rs.getString(7)==null ?"":rs.getString(5)).append("\t"); valueXmlString.append(rs.getString(7)==null ?"":rs.getString(7)).append("\t");
valueXmlString.append(rs.getString(8)==null ?"":rs.getString(5)).append("\t"); valueXmlString.append(rs.getString(8)==null ?"":rs.getString(8)).append("\t");
valueXmlString.append("\n"); valueXmlString.append("\n");
} }
rs.close(); rs.close();
...@@ -554,7 +554,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -554,7 +554,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
} }
} }
}//inner for loop] lotNoFromStr }//inner for loop] lotNoFromStr
if((exchangeRate==null || exchangeRate.length()==0 ) && benefitType.trim().equalsIgnoreCase("AL")) //if((exchangeRate==null || exchangeRate.length()==0 ) && benefitType.trim().equalsIgnoreCase("AL")) --- chandni 29/12/10
if((exchangeRate==null || exchangeRate.length()==0 ) )
{ {
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
exchangeRateStr = itmDBAccessEJB.getErrorString("","VTEXHEMTY",userId); exchangeRateStr = itmDBAccessEJB.getErrorString("","VTEXHEMTY",userId);
...@@ -1190,8 +1191,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1190,8 +1191,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
pstmtInsert = null; pstmtInsert = null;
updqty = 0.00; updqty = 0.00;
benefitValue = 0.00; benefitValue = 0.00;
conn.commit(); //conn.commit();
errorString = "Success"; merrcode = "Success";
} }
} // end of while loop } // end of while loop
rs.close(); rs.close();
...@@ -1215,7 +1216,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1215,7 +1216,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
} }
//valueXmlString.append("</Root>\r\n"); //valueXmlString.append("</Root>\r\n");
return errorString ; //return errorString ;
return merrcode;
} // end of advanceLicence } // end of advanceLicence
public String wfDepb(String despId,ArrayList lsTranId ,Connection conn ) throws RemoteException, ITMException public String wfDepb(String despId,ArrayList lsTranId ,Connection conn ) throws RemoteException, ITMException
{ {
...@@ -1237,6 +1239,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1237,6 +1239,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
double commAmtOcDec = 0.00; double commAmtOcDec = 0.00;
String invAmt = ""; String invAmt = "";
double invAmtDec = 0.00; double invAmtDec = 0.00;
String frtRate = "",exchFrtRate ="" ,insRate="",exchInsRate="";
double frtRateInv = 0.00,exchFrtRateInv = 0.00,insRateInv = 0.00,exchInsRateInv= 0.00;
double frtValue = 0.00, insValue = 0.00;
String quantity = ""; String quantity = "";
double quantityDec = 0.00; double quantityDec = 0.00;
String value =""; String value ="";
...@@ -1309,14 +1314,17 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1309,14 +1314,17 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
// Changes done by Chandni Shah 26/08/10 ---DI89UNI060 // Changes done by Chandni Shah 26/08/10 ---DI89UNI060
sql= " select distinct i.invoice_id,b.line_no,b.unit__std,b.item_code,d.curr_code,d.exch_rate, " sql= " select distinct i.invoice_id,b.line_no,b.unit__std,b.item_code,d.curr_code,d.exch_rate, "
+" sum(b.quantity__stduom), sum(b.quantity__stduom * b.rate__stduom), " +" sum(b.quantity__stduom), sum(b.quantity__stduom * b.rate__stduom), "
+" i.comm_amt,i.exch_rate,i.comm_amt__oc,i.inv_amt" +" i.comm_amt,i.exch_rate,i.comm_amt__oc,i.inv_amt,i.frt_amt,i.exch_rate__frt, "
+" i.ins_amt ,i.exch_rate__ins "
+" from invoice i, depb a , despatchdet b ,despatch d " +" from invoice i, depb a , despatchdet b ,despatch d "
+" where d.desp_id = b.desp_id " +" where d.desp_id = b.desp_id "
+" and d.desp_id = i.desp_id " +" and d.desp_id = i.desp_id "
+" and d.desp_id = ? " +" and d.desp_id = ? "
+" and a.tran_id = ? " +" and a.tran_id = ? "
+" group by i.inv_amt,i.invoice_id,b.line_no,b.unit__std,b.item_code, " +" group by i.inv_amt,i.invoice_id,b.line_no,b.unit__std,b.item_code, "
+" d.curr_code,d.exch_rate,i.exch_rate,i.comm_amt__oc,i.comm_amt "; +" d.curr_code,d.exch_rate,i.exch_rate,i.comm_amt__oc,i.comm_amt , "
+" i.frt_amt,i.exch_rate__frt,i.ins_amt ,i.exch_rate__ins " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,(String)despId.get(0)); //pstmt.setString(1,(String)despId.get(0));
...@@ -1345,7 +1353,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1345,7 +1353,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
commAmtOcDec = Double.parseDouble(commAmtOc); commAmtOcDec = Double.parseDouble(commAmtOc);
invAmt = rs.getString(12); invAmt = rs.getString(12);
invAmtDec = Double.parseDouble(invAmt); invAmtDec = Double.parseDouble(invAmt);
frtRate = rs.getString(13);
frtRateInv = Double.parseDouble (frtRate);
exchFrtRate = rs.getString(14);
exchFrtRateInv = Double.parseDouble (exchFrtRate);
insRate = rs.getString(15);
insRateInv = Double.parseDouble (insRate);
exchInsRate = rs.getString(16);
exchInsRateInv = Double.parseDouble (exchInsRate);
sqlSec="select credit_perc " sqlSec="select credit_perc "
+" from depb_rate where item_code__depb = ? " +" from depb_rate where item_code__depb = ? "
+" and eff_from <= ? " +" and eff_from <= ? "
...@@ -1367,11 +1383,19 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1367,11 +1383,19 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
errorString ="VTDEPBRT1" ; errorString ="VTDEPBRT1" ;
} }
depbvalue = valueDec * creditPercDec * 0.01 * exeRateDec ; //exeRateDec is Added .. depbvalue = valueDec * creditPercDec * 0.01 * exeRateDec ; //exeRateDec is Added ..
System.out.println(" depbvalue ========>>>>>>>>>" +depbvalue);
invoicevalue = (commAmtOcDec * exeRateDec); //Chandni Shah 26/08/10 invoicevalue = (commAmtOcDec * exeRateDec); //Chandni Shah 26/08/10
benefitValue = (depbvalue - invoicevalue) + commAmtDec ;//Chandni Shah 06/09/10 System.out.println(" invoicevalue ========>>>>>>>>>" +invoicevalue);
frtValue = (frtRateInv * exchFrtRateInv) ;
System.out.println(" frtValue ========>>>>>>>>>" +frtValue);
insValue = (insRateInv * exchInsRateInv);
System.out.println(" insValue ========>>>>>>>>>" +insValue);
//benefitValue = (depbvalue - invoicevalue) + commAmtDec ;//Chandni Shah 06/09/10
benefitValue = (depbvalue )+ (invoicevalue) - (frtValue) - (insValue);
System.out.println(" benefitValue ========>>>>>>>>>" +benefitValue);
invAmtRate = (invAmtDec * exeRateDec )* (12.5/100);//Added by Chandni Shah 06/09/10 as Y invAmtRate = (invAmtDec * exeRateDec )* (12.5/100);//Added by Chandni Shah 06/09/10 as Y
invoiceAmt = (depbvalue - invoicevalue)+invAmtRate; invoiceAmt = (depbvalue - invoicevalue)+invAmtRate;
//commAmt = () //commAmt = ()
rsCrper.close(); rsCrper.close();
...@@ -1384,6 +1408,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1384,6 +1408,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
if (invoicevalue > invAmtRate) if (invoicevalue > invAmtRate)
{ {
System.out.println(" Inside If condition :::::::::" );
sqlSec = "UPDATE depb " sqlSec = "UPDATE depb "
+" SET amount_cr = (case when amount_cr is null " +" SET amount_cr = (case when amount_cr is null "
+" then 0 else amount_cr end) + ? " +" then 0 else amount_cr end) + ? "
...@@ -1439,20 +1465,22 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1439,20 +1465,22 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
pstmtInsert.setString(13, currCode); pstmtInsert.setString(13, currCode);
pstmtInsert.setDouble(14, exchRateDec); pstmtInsert.setDouble(14, exchRateDec);
//pstmtInsert.setDouble(15, depbvalue); //pstmtInsert.setDouble(15, depbvalue);
pstmtInsert.setDouble(15, invoiceAmt); // //pstmtInsert.setDouble(15, invoiceAmt); //
pstmtInsert.setDouble(15, benefitValue); //22/12/10
pstmtInsert.setString(16, "O"); pstmtInsert.setString(16, "O");
pstmtInsert.setTimestamp(17,tranDate); pstmtInsert.setTimestamp(17,tranDate);
pstmtInsert.setString(18, "BASE"); //chg USer pstmtInsert.setString(18, "BASE"); //chg USer
pstmtInsert.setString(19, "BASE"); // LoginCOde pstmtInsert.setString(19, "BASE"); // LoginCOde
//pstmtInsert.setDouble(20, depbvalue); //pstmtInsert.setDouble(20, depbvalue);
pstmtInsert.setDouble(20, invoiceAmt); //----- //pstmtInsert.setDouble(20, invoiceAmt); //-----
pstmtInsert.setDouble(20, benefitValue); //22/12/10
pstmtInsert.setString(21, "0.000"); pstmtInsert.setString(21, "0.000");
pstmtInsert.setDouble(22, exchRateDec); pstmtInsert.setDouble(22, exchRateDec);
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
} }
else //To check [ comm_amt__oc <= (inv_amt*exh_rate*12.5%)] Chandni Shah 13/09/2010 ---DI89UNI060 else //To check [ comm_amt__oc <= (inv_amt*exh_rate*12.5%)] Chandni Shah 13/09/2010 ---DI89UNI060
{ {
// System.out.println(" Inside Else condition :::::::::" );
/* Commented by Chandni Shah 26/08/10 /* Commented by Chandni Shah 26/08/10
sqlSec= "UPDATE depb " sqlSec= "UPDATE depb "
+"SET amount_cr = (case when amount_cr is null " +"SET amount_cr = (case when amount_cr is null "
...@@ -1522,20 +1550,28 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1522,20 +1550,28 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
pstmtInsert.setDouble(20, benefitValue); //----- pstmtInsert.setDouble(20, benefitValue); //-----
pstmtInsert.setString(21, "0.000"); pstmtInsert.setString(21, "0.000");
pstmtInsert.setDouble(22, exchRateDec); pstmtInsert.setDouble(22, exchRateDec);
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert = null;
//conn.commit();
merrcode = "Success";
} }
} // end of while code } // end of while code
pstmtCrper.close(); pstmtCrper.close();
pstmtCrper = null; pstmtCrper = null;
pstmtInsert.close(); //pstmtInsert.close();
pstmtInsert = null; //pstmtInsert = null;
//pstmtSec.close(); //pstmtSec.close();
//pstmtSec = null; //pstmtSec = null;
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//conn.close();
//conn = null;
} }
catch(Exception e) catch(Exception e)
{ {
......
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