Commit 0c744eff authored by cshah's avatar cshah

DI90UNI059-update query change for depb table ,instead of adv_licence_exp the...

DI90UNI059-update query change for depb table ,instead of adv_licence_exp the update query is set for adv_licence tablejava-projects-ejb3/ibase/webitm-dis/ibase/webitm/ejb/dis


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91343 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ce814f53
...@@ -146,9 +146,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -146,9 +146,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
return resultString; return resultString;
} }
sql = " select count(*) from benefit_trace where ref_ser = 'S-DSP' and ref_no = ? "; /*
sql = " select count(*) from benefit_trace where ref_ser = 'S-DSP' and ref_no = ? ";
*/
//Benefit_type condition is Added in select query by Chandni Shah - 14/09/10 ---DI89UNI060
sql = " select count(*) from benefit_trace where benefit_type = ? and ref_ser = 'S-DSP' and ref_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId.trim()); pstmt.setString(1,benefitType.trim());
pstmt.setString(2,tranId.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -367,6 +373,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -367,6 +373,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
return retStr; return retStr;
}//END OF PROCESS (1) }//END OF PROCESS (1)
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
String retStr = ""; String retStr = "";
...@@ -379,6 +387,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -379,6 +387,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
String retString = "" ,errCode = "",tranId=""; String retString = "" ,errCode = "",tranId="";
String loginSiteCode="",empCode="",chgUser="",chgTerm="",loginCode="",termid = ""; String loginSiteCode="",empCode="",chgUser="",chgTerm="",loginCode="",termid = "";
String policyNo="",insCertNo="",agent_code="",invoiceId=""; String policyNo="",insCertNo="",agent_code="",invoiceId="";
String confirm ="";
String invId = "" ;
String conf = "";
int count =0,cnt =0; int count =0,cnt =0;
String curr_code="",dayNo = "",shiftOfDay = ""; String curr_code="",dayNo = "",shiftOfDay = "";
double exch_rate=0,netAmt=0; double exch_rate=0,netAmt=0;
...@@ -453,7 +464,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -453,7 +464,8 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
int cntSec = 0,i=0; int cntSec = 0,i=0;
// end of code // end of code
try try
{ {
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
...@@ -470,294 +482,344 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -470,294 +482,344 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
currAppdate = genericUtility.getValidDateString(currAppdate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()); currAppdate = genericUtility.getValidDateString(currAppdate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
currDate = Timestamp.valueOf(currAppdate + " 00:00:00.00"); currDate = Timestamp.valueOf(currAppdate + " 00:00:00.00");
parentNodeList = detailDom.getElementsByTagName("Detail2"); parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength(); parentNodeListLength = parentNodeList.getLength();
benefitType = genericUtility.getColumnValue("benefit_type",headerDom); benefitType = genericUtility.getColumnValue("benefit_type",headerDom);
benefitType = benefitType == null ? "" :benefitType.trim(); benefitType = benefitType == null ? "" :benefitType.trim();
tranId = genericUtility.getColumnValue("tran_id",headerDom); tranId = genericUtility.getColumnValue("tran_id",headerDom);
tranId = tranId == null ? "" :tranId.trim(); tranId = tranId == null ? "" :tranId.trim();
exchangeRate = genericUtility.getColumnValue("exchange_rate",headerDom); exchangeRate = genericUtility.getColumnValue("exchange_rate",headerDom);
exchangeRate = exchangeRate == null ? "1.000":exchangeRate.trim(); exchangeRate = exchangeRate == null ? "1.000":exchangeRate.trim();
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{ //-Added by Chandni Shah 26/08/10 ---DI89UNI060
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes(); //if selectd despatch is confirmed and invoice is generated then only the process is completed
childNodeListLength = childNodeList.getLength(); sql="select confirmed from despatch where desp_id = ? ";
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
if (childNodeName.equals("tran_id"))
{
if(childNode.getFirstChild()!=null)
{
// add on 14/10/09
//advLicMulTranId[selectedRow] = childNode.getFirstChild().getNodeValue();
String advLicMulTranIdStr = childNode.getFirstChild().getNodeValue();
advLicMulTranId.add(advLicMulTranIdStr);
//advLicMulTranId[selectedRow] = childNode.getFirstChild().getNodeValue();
// end of code on 14/10/09
System.out.println("advLicMulTranIdStr>>>>>"+advLicMulTranIdStr);
}
}
if (childNodeName.equals("exchange_rate"))
{
if(childNode.getFirstChild()!=null)
{
exchangeRate = childNode.getFirstChild().getNodeValue();
}
}
}//inner for loop] lotNoFromStr
if((exchangeRate==null || exchangeRate.length()==0 ) && benefitType.trim().equalsIgnoreCase("AL"))
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
exchangeRateStr = itmDBAccessEJB.getErrorString("","VTEXHEMTY",userId);
return exchangeRateStr ;
}
}// OUT FOR LOOP
////////////////////////code to be migrated for dispatch//////////////////
// all details is in site the
// changes by manazir on 30-05-09
/*StringTokenizer stringTokenizer = null;
stringTokenizer = new StringTokenizer(advLicMulTranId[0] ,",");
// actually this is tranId of follwing datawindow
int i=0;
while(stringTokenizer.hasMoreElements())
{
asAdvLic[i]= Double.parseDouble(stringTokenizer.nextToken());
i++;
}*/
// changes on 15/10/09
// asAdvLic = advLicMulTranId ;
System.out.println("advLicMulTranId.get(0)>>>"+advLicMulTranId.get(0));
// System.out.println("asAdvLic>>>"+asAdvLic[0]);
sql="select curr_code, exch_rate "
+" from despatch where desp_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId.trim()); pstmt.setString(1,tranId.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
despCurrCode = rs.getString(1) == null ?"":rs.getString(1); confirm = rs.getString(1);
exchRate = rs.getString(2) == null ?"":rs.getString(2);
if(!("".equalsIgnoreCase(exchRate) && exchRate != null ))
{
exchRateDec = Double.parseDouble(exchRate );
}
else{exchRateDec=0;}
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
////////////////////////////////end of code//////////////////////// if ("Y".equalsIgnoreCase(confirm))
//s_pass1.mdecimal = exchRateDec {
//Added By Jasmina 22/10/08 -DI89SUN109 sql = "select invoice_id,confirmed from invoice where desp_id = ? ";
//advLicTranId = gfGetSqlInString(asAdvLic); pstmt = conn.prepareStatement(sql);
// changes on the 15/10/09 as ArrayList pass to the function pstmt.setString(1,tranId.trim());
advLicTranId = gfGetSqlInString(advLicMulTranId); rs = pstmt.executeQuery();
//ls_sql = ' ' if(rs.next())
//advLicTranId = asAdvLic[0]; {
System.out.println(" return value of String parameter advLicTranId>>>"+advLicTranId); invId = rs.getString(1);
sql=" SELECT count(1) from " conf = rs.getString(2);
+" (SELECT b.site_code,d.item_code,a.eff_from ,a.extend_upto, a.valid_upto, " }
+" d.quantity,d.quantity_exp, a.ext_valid1, a.ext_valid2, a. ext_valid3 " rs.close();
+" FROM adv_licence a,site b,finent c ,adv_licence_exp d " rs = null;
+" where a.tran_id = d.tran_id and a.site_code = b.site_code and b.fin_entity = c.fin_entity and " pstmt.close();
+" a.tran_id in (" +advLicTranId+ ") and d.quantity > d.quantity_exp and a.status = 'O' ) X, " pstmt = null;
+"(select p.desp_id,s.item_code,eff_date, p.site_code from despatch p,site q,finent r, despatchdet s " if (invId != null && ("Y".equalsIgnoreCase(conf)) )
+" where p.desp_id = s.desp_id and p.site_code = q.site_code and q.fin_entity = r.fin_entity and " {
+" p.desp_id = ? ) Y where x.eff_from <= y.eff_date "
+" and x.site_code = y.site_code and " for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
+"((x.valid_upto >= y.eff_date and x.valid_upto is not null ) " {
+"OR (x.extend_upto >= y.eff_date and x.extend_upto is not null) " parentNode = parentNodeList.item(selectedRow);
+"OR (x.ext_valid1 >= y.eff_date and x.ext_valid1 is not null) " childNodeList = parentNode.getChildNodes();
+"OR (x.ext_valid2 >= y.eff_date and x.ext_valid2 is not null) " childNodeListLength = childNodeList.getLength();
+"OR (x.ext_valid3 >= y.eff_date and x.ext_valid3 is not null) ) " for (int childRow = 0; childRow < childNodeListLength; childRow++)
+"and x.item_code in (select item_code from item where item_code__al = (select item_code__al from item where item_code = y.item_code)) "; {
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
if (childNodeName.equals("tran_id"))
{
if(childNode.getFirstChild()!=null)
{
// add on 14/10/09
//advLicMulTranId[selectedRow] = childNode.getFirstChild().getNodeValue();
String advLicMulTranIdStr = childNode.getFirstChild().getNodeValue();
advLicMulTranId.add(advLicMulTranIdStr);
//advLicMulTranId[selectedRow] = childNode.getFirstChild().getNodeValue();
// end of code on 14/10/09
System.out.println("advLicMulTranIdStr>>>>>"+advLicMulTranIdStr);
}
}
if (childNodeName.equals("exchange_rate"))
{
if(childNode.getFirstChild()!=null)
{
exchangeRate = childNode.getFirstChild().getNodeValue();
}
}
}//inner for loop] lotNoFromStr
if((exchangeRate==null || exchangeRate.length()==0 ) && benefitType.trim().equalsIgnoreCase("AL"))
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
exchangeRateStr = itmDBAccessEJB.getErrorString("","VTEXHEMTY",userId);
return exchangeRateStr ;
}
}// OUT FOR LOOP
/////////////code to be migrated for dispatch//////////////////
// all details is in site the
// changes by manazir on 30-05-09
/*StringTokenizer stringTokenizer = null;
stringTokenizer = new StringTokenizer(advLicMulTranId[0] ,",");
// actually this is tranId of follwing datawindow
int i=0;
while(stringTokenizer.hasMoreElements())
{
asAdvLic[i]= Double.parseDouble(stringTokenizer.nextToken());
i++;
}*/
// changes on 15/10/09 Chandni Shah
// asAdvLic = advLicMulTranId ;
System.out.println("advLicMulTranId.get(0)>>>"+advLicMulTranId.get(0));
// System.out.println("asAdvLic>>>"+asAdvLic[0]);
sql="select curr_code, exch_rate "
+" from despatch where desp_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId.trim()); pstmt.setString(1,tranId.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt(1); despCurrCode = rs.getString(1) == null ?"":rs.getString(1);
exchRate = rs.getString(2) == null ?"":rs.getString(2);
if(!("".equalsIgnoreCase(exchRate) && exchRate != null ))
{
exchRateDec = Double.parseDouble(exchRate );
}
else{exchRateDec=0;}
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt ==0) /////////////////end of code////////////////////////
//s_pass1.mdecimal = exchRateDec
//Added By Jasmina 22/10/08 -DI89SUN109
//advLicTranId = gfGetSqlInString(asAdvLic);
// changes on the 15/10/09 as ArrayList pass to the function
advLicTranId = gfGetSqlInString(advLicMulTranId);
System.out.println(" advLicTranId ==============>>>>>>>>>>>>>>>>>>>>>"+advLicTranId);
// changes on 13/09/10 -- Chandni Shah ---DI89UNI060
// advLicTranId is only for benefit_type == 'AL'
if ("AL".equalsIgnoreCase(benefitType))
{ {
sqlSec=" SELECT count(1) FROM " //advLicTranId = gfGetSqlInString(advLicMulTranId);
+" (SELECT b.site_code,d.item_code,a.eff_from ,a.extend_upto, a.valid_upto, " //ls_sql = ' '
+" d.quantity,d.quantity_exp, a.ext_valid1, a.ext_valid2, a. ext_valid3 " //advLicTranId = asAdvLic[0];
+" FROM adv_licence a,site b,finent c ,adv_licence_exp d " System.out.println(" return value of String parameter advLicTranId>>>"+advLicTranId);
+" where a.tran_id = d.tran_id and a.site_code = b.site_code and b.fin_entity = c.fin_entity and " sql=" SELECT count(1) from "
+" a.tran_id in (" +advLicTranId+") and d.quantity > d.quantity_exp and a.status = 'O' ) X, " +" (SELECT b.site_code,d.item_code,a.eff_from ,a.extend_upto, a.valid_upto, "
+" (select p.desp_id,s.item_code,eff_date, p.site_code from despatch p,site q,finent r, despatchdet s " +" d.quantity,d.quantity_exp, a.ext_valid1, a.ext_valid2, a. ext_valid3 "
+" where p.desp_id = s.desp_id and p.site_code = q.site_code and q.fin_entity = r.fin_entity and " +" FROM adv_licence a,site b,finent c ,adv_licence_exp d "
+" p.desp_id = ? ) Y where x.eff_from <= y.eff_date " +" where a.tran_id = d.tran_id and a.site_code = b.site_code and b.fin_entity = c.fin_entity and "
+" and ((x.valid_upto >= y.eff_date and x.valid_upto is not null ) " +" a.tran_id in (" +advLicTranId+ ") and d.quantity > d.quantity_exp and a.status = 'O' ) X, "
+" OR (x.extend_upto >= y.eff_date and x.extend_upto is not null) " +"(select p.desp_id,s.item_code,eff_date, p.site_code from despatch p,site q,finent r, despatchdet s "
+" OR (x.ext_valid1 >= y.eff_date and x.ext_valid1 is not null) " +" where p.desp_id = s.desp_id and p.site_code = q.site_code and q.fin_entity = r.fin_entity and "
+" OR (x.ext_valid2 >= y.eff_date and x.ext_valid2 is not null) " +" p.desp_id = ? ) Y where x.eff_from <= y.eff_date "
+" OR (x.ext_valid3 >= y.eff_date and x.ext_valid3 is not null) ) " +" and x.site_code = y.site_code and "
+" and x.item_code in (select item_code from item where item_code__al = (select item_code__al from item where item_code = y.item_code)) "; +"((x.valid_upto >= y.eff_date and x.valid_upto is not null ) "
pstmtSec = conn.prepareStatement(sqlSec); +"OR (x.extend_upto >= y.eff_date and x.extend_upto is not null) "
pstmtSec.setString(1,tranId.trim()); +"OR (x.ext_valid1 >= y.eff_date and x.ext_valid1 is not null) "
rs = pstmtSec.executeQuery(); +"OR (x.ext_valid2 >= y.eff_date and x.ext_valid2 is not null) "
if(rsSec.next()) +"OR (x.ext_valid3 >= y.eff_date and x.ext_valid3 is not null) ) "
{ +"and x.item_code in (select item_code from item where item_code__al = (select item_code__al from item where item_code = y.item_code)) ";
cntSec = rsSec.getInt(1); pstmt = conn.prepareStatement(sql);
} pstmt.setString(1,tranId.trim());
rsSec.close(); rs = pstmt.executeQuery();
rsSec = null; if(rs.next())
pstmtSec.close();
pstmtSec = null;
if(cntSec > 0)
{
sqlThr = "select msg_type "
+" from messages_level "
+ "where profile_id = ? " ////////////????????????????
+" and msg_no = 'VNOALSITE' "
+ "and UPPER(win_name) = 'W_DESPATCH' ";
pstmtThr = conn.prepareStatement(sqlThr);
pstmtThr.setString(1,chgUser.trim());
rsThr = pstmtThr.executeQuery();
if(rsThr.next())
{ {
msgType = rsThr.getString(1) == null ?"":rsThr.getString(1); cnt = rs.getInt(1);
} }
rsThr.close(); rs.close();
rsThr = null; rs = null;
pstmtThr.close(); pstmt.close();
pstmtThr = null; pstmt = null;
if(msgType==null || msgType.trim().length()==0) if(cnt ==0)
{ {
sqlThr = "select msg_type " sqlSec=" SELECT count(1) FROM "
+" from messages " +" (SELECT b.site_code,d.item_code,a.eff_from ,a.extend_upto, a.valid_upto, "
+ "where msg_no = 'VNOALSITE' " ; +" d.quantity,d.quantity_exp, a.ext_valid1, a.ext_valid2, a. ext_valid3 "
pstmtThr = conn.prepareStatement(sqlThr); +" FROM adv_licence a,site b,finent c ,adv_licence_exp d "
rsThr = pstmtThr.executeQuery(); +" where a.tran_id = d.tran_id and a.site_code = b.site_code and b.fin_entity = c.fin_entity and "
if(rsThr.next()) +" a.tran_id in (" +advLicTranId+") and d.quantity > d.quantity_exp and a.status = 'O' ) X, "
+" (select p.desp_id,s.item_code,eff_date, p.site_code from despatch p,site q,finent r, despatchdet s "
+" where p.desp_id = s.desp_id and p.site_code = q.site_code and q.fin_entity = r.fin_entity and "
+" p.desp_id = ? ) Y where x.eff_from <= y.eff_date "
+" and ((x.valid_upto >= y.eff_date and x.valid_upto is not null ) "
+" OR (x.extend_upto >= y.eff_date and x.extend_upto is not null) "
+" OR (x.ext_valid1 >= y.eff_date and x.ext_valid1 is not null) "
+" OR (x.ext_valid2 >= y.eff_date and x.ext_valid2 is not null) "
+" OR (x.ext_valid3 >= y.eff_date and x.ext_valid3 is not null) ) "
+" and x.item_code in (select item_code from item where item_code__al = (select item_code__al from item where item_code = y.item_code)) ";
pstmtSec = conn.prepareStatement(sqlSec);
pstmtSec.setString(1,tranId.trim());
rsSec = pstmtSec.executeQuery();
if(rsSec.next())
{ {
msgType = rsThr.getString(1) == null ?"":rsThr.getString(1); cntSec = rsSec.getInt(1);
} }
rsThr.close(); rsSec.close();
rsThr = null; rsSec = null;
pstmtThr.close(); pstmtSec.close();
pstmtThr = null; pstmtSec = null;
} if(cntSec > 0)
if(msgType.equalsIgnoreCase("E")) {
sqlThr = "select msg_type "
+" from messages_level "
+ "where profile_id = ? " ////////////????????????????
+" and msg_no = 'VNOALSITE' "
+ "and UPPER(win_name) = 'W_DESPATCH' ";
pstmtThr = conn.prepareStatement(sqlThr);
pstmtThr.setString(1,chgUser.trim());
rsThr = pstmtThr.executeQuery();
if(rsThr.next())
{
msgType = rsThr.getString(1) == null ?"":rsThr.getString(1);
}
rsThr.close();
rsThr = null;
pstmtThr.close();
pstmtThr = null;
if(msgType==null || msgType.trim().length()==0)
{
sqlThr = "select msg_type "
+" from messages "
+ "where msg_no = 'VNOALSITE' " ;
pstmtThr = conn.prepareStatement(sqlThr);
rsThr = pstmtThr.executeQuery();
if(rsThr.next())
{
msgType = rsThr.getString(1) == null ?"":rsThr.getString(1);
}
rsThr.close();
rsThr = null;
pstmtThr.close();
pstmtThr = null;
}
if(msgType.equalsIgnoreCase("E"))
{
errString = itmDBAccessEJB.getErrorString("","VNOALSITE",userId);
resultString =errString ;
return resultString ;
}
}
else
{
errString = itmDBAccessEJB.getErrorString("","VNOAL",userId);
resultString =errString ;
return resultString ;
}
} // end of if cnt==0
// comment on 15/10/09
//for(i=0;i<asAdvLic.length ; i++)
for(i=0; i<advLicMulTranId.size(); i++)
{ {
errString = itmDBAccessEJB.getErrorString("","VNOALSITE",userId); advLicStr = (String)advLicMulTranId.get(i);
resultString =errString ; System.out.println("advLicMulTranId.get(i) "+advLicMulTranId.get(i));
return resultString ; System.out.println("get From ArrayList "+advLicStr);
} sql= "select curr_code, file_no "
+" from adv_licence where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,advLicStr);
rs = pstmt.executeQuery();
if(rs.next())
{
currCode = rs.getString("curr_code")==null ?"":rs.getString("curr_code");
fileNo = rs.getString("file_no")==null ?"":rs.getString("file_no");
}
pstmt.close();
pstmt =null;
rs.close();
rs=null;
// add on 15/10/09
//currCodeArry[i]=currCode;
currCodeArry.add(currCode);
fileNoArry.add(fileNo);
//fileNoArry[i] = fileNo;
//exchRateArry[i] = exchRateDec;
exchRateArry.add(new Double(exchRateDec));
// end of add on 15/10/09
//if(despCurrCode.equalsIgnoreCase(currCodeArry[i]))
//{
//}
/*if (ls_desp_curr_code) <> (las_curr_code[li_cnt]) then
s_pass1.mvar1 = asAdvLic[li_cnt]
s_pass1.mvar2 = las_file_no[li_cnt]
s_pass1.mvar3 = ls_desp_curr_code
s_pass1.mvar4 = las_curr_code[li_cnt]
openwithparm(w_benefit_trace,s_pass1)
s_pass2 = message.powerobjectparm
if s_pass2.mdecimal > 0 then
lcExchrate[li_cnt] = s_pass2.mdecimal
end if
end if
next*/
}
} // end of IF stmt for benefit_type = 'AL'
if(advLicTranId.trim().length() > 0 && benefitType.trim().equalsIgnoreCase("AL"))
{
// merrcode = advanceLicence(tranId ,asAdvLic, exchRateArry , conn);
System.out.println("call the advanceLicence() method ");
merrcode = advanceLicence(tranId ,advLicMulTranId, exchRateArry , conn);
System.out.println("Returned merrcode>>>>>>>>>>>>>>>>>>"+merrcode );
} }
else if(advLicTranId.trim().length() > 0 && benefitType.trim().equalsIgnoreCase("DP"))
{
System.out.println("call the wfDepb() method ");
merrcode = wfDepb(tranId,advLicMulTranId , conn);
System.out.println("Returned merrcode>>>>>>>>>>>>>>>>>>"+merrcode );
}
if ("Error".equalsIgnoreCase(merrcode))
{ {
errString = itmDBAccessEJB.getErrorString("","VNOAL",userId); conn.rollback();
errString = itmDBAccessEJB.getErrorString("","VTERRNT",userId);
resultString =errString ; resultString =errString ;
return resultString ; return resultString;
} }
} // end of if cnt==0 if ("Success".equalsIgnoreCase(merrcode))
// comment on 15/10/09
//for(i=0;i<asAdvLic.length ; i++)
for(i=0; i<advLicMulTranId.size(); i++)
{
advLicStr = (String)advLicMulTranId.get(i);
System.out.println("advLicMulTranId.get(i) "+advLicMulTranId.get(i));
System.out.println("get From ArrayList "+advLicStr);
sql= "select curr_code, file_no "
+" from adv_licence where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,advLicStr);
rs = pstmt.executeQuery();
if(rs.next())
{ {
currCode = rs.getString("curr_code")==null ?"":rs.getString("curr_code"); errString = itmDBAccessEJB.getErrorString("","VTSUCCE",userId);
fileNo = rs.getString("file_no")==null ?"":rs.getString("file_no"); resultString =errString ;
} conn.commit();
pstmt.close(); return resultString;
pstmt =null;
rs.close(); }
rs=null; }
// add on 15/10/09 else
{
//currCodeArry[i]=currCode; errString = itmDBAccessEJB.getErrorString("","VTINVN ",userId);
currCodeArry.add(currCode); resultString =errString ;
fileNoArry.add(fileNo); return resultString ;
//fileNoArry[i] = fileNo; }
//exchRateArry[i] = exchRateDec; } // end of if stmt of confirmed
exchRateArry.add(new Double(exchRateDec)); else
{
// end of add on 15/10/09 errString = itmDBAccessEJB.getErrorString("","VTCONFN ",userId);
resultString =errString ;
return resultString ;
//if(despCurrCode.equalsIgnoreCase(currCodeArry[i])) }
//{
//}
/*if (ls_desp_curr_code) <> (las_curr_code[li_cnt]) then
s_pass1.mvar1 = asAdvLic[li_cnt]
s_pass1.mvar2 = las_file_no[li_cnt]
s_pass1.mvar3 = ls_desp_curr_code
s_pass1.mvar4 = las_curr_code[li_cnt]
openwithparm(w_benefit_trace,s_pass1)
s_pass2 = message.powerobjectparm
if s_pass2.mdecimal > 0 then
lcExchrate[li_cnt] = s_pass2.mdecimal
end if
end if
next*/
}
if(advLicTranId.trim().length() > 0 && benefitType.trim().equalsIgnoreCase("AL"))
{
// merrcode = advanceLicence(tranId ,asAdvLic, exchRateArry , conn);
System.out.println("call the advanceLicence() method ");
merrcode = advanceLicence(tranId ,advLicMulTranId, exchRateArry , conn);
System.out.println("Returned merrcode>>>>>>>>>>>>>>>>>>"+merrcode );
}
if(advLicTranId.trim().length() > 0 && benefitType.trim().equalsIgnoreCase("DP"))
{
System.out.println("call the wfDepb() method ");
merrcode = wfDepb(tranId,advLicMulTranId , conn);
System.out.println("Returned merrcode>>>>>>>>>>>>>>>>>>"+merrcode );
}
if ("Error".equalsIgnoreCase(merrcode))
{
conn.rollback();
errString = itmDBAccessEJB.getErrorString("","VTERRNT",userId);
resultString =errString ;
return resultString;
}
if ("Success".equalsIgnoreCase(merrcode))
{
errString = itmDBAccessEJB.getErrorString("","VTSUCCE",userId);
resultString =errString ;
conn.commit();
return resultString;
}
} }
catch(Exception e) catch(Exception e)
{ {
try{ try{
conn.rollback(); conn.rollback();
}catch(Exception e1) }catch(Exception e1)
{e1.printStackTrace();} {e1.printStackTrace();}
System.out.println("Exception in BenefitDisPrcEJB..."+e.getMessage()); System.out.println("Exception in BenefitDisPrcEJB..."+e.getMessage());
e.printStackTrace(); e.printStackTrace();
errorString = e.getMessage(); errorString = e.getMessage();
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
...@@ -813,8 +875,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -813,8 +875,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
double baseValue = 0.00; double baseValue = 0.00;
String merrcode = ""; String merrcode = "";
String sql =""; String sql ="";
PreparedStatement pstmt =null,pstmtSec = null,pstmtInsert=null ; PreparedStatement pstmt =null,pstmtSec = null,pstmtInsert=null,pstmt1 = null ;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null;
Timestamp tranDate = null; Timestamp tranDate = null;
tranDate = new java.sql.Timestamp(System.currentTimeMillis()) ; tranDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
Timestamp chgDate = null; Timestamp chgDate = null;
...@@ -897,36 +960,38 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -897,36 +960,38 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
+" order by despatchdet.item_code "; +" order by despatchdet.item_code ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,despId); pstmt.setString(1,despId);
rs = pstmt.executeQuery(); rs1 = pstmt.executeQuery();
if(rs.next()) //if(rs.next())
while (rs1.next())
{ {
itemCode = rs.getString(1)==null ?"":rs.getString(1); itemCode = rs1.getString(1)==null ?"":rs1.getString(1);
currCode =rs.getString(2)==null ?"":rs.getString(2); currCode =rs1.getString(2)==null ?"":rs1.getString(2);
exchRate = rs.getString(3)==null ?"":rs.getString(3); exchRate = rs1.getString(3)==null ?"":rs1.getString(3);
siteCode =rs.getString(4)==null ?"":rs.getString(4); siteCode =rs1.getString(4)==null ?"":rs1.getString(4);
quantity = rs.getString(5)==null ?"":rs.getString(5); quantity = rs1.getString(5)==null ?"":rs1.getString(5);
if(!("".equalsIgnoreCase(quantity))) if(!("".equalsIgnoreCase(quantity)))
{ {
quantityDec = Double.parseDouble(quantity); quantityDec = Double.parseDouble(quantity);
} }
value = rs.getString(6)==null ?"":rs.getString(6); value = rs1.getString(6)==null ?"":rs1.getString(6);
if(!("".equalsIgnoreCase(value))) if(!("".equalsIgnoreCase(value)))
{ {
valueDec = Double.parseDouble(value); valueDec = Double.parseDouble(value);
} }
despLineNo=rs.getString(7)==null ?"":rs.getString(7); despLineNo=rs1.getString(7)==null ?"":rs1.getString(7);
unit =rs.getString(8)==null ?"":rs.getString(8); unit =rs1.getString(8)==null ?"":rs1.getString(8);
} //}
rs.close(); //rs.close();
rs = null; //rs = null;
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
despQtyBal = quantityDec; despQtyBal = quantityDec;
System.out.println("lsAdvLic.size() "+lsAdvLic.size() ); System.out.println("lsAdvLic.size() "+lsAdvLic.size() );
for(int i=0; i<lsAdvLic.size() ; i++) //for(int i=0; i<lsAdvLic.size() ; i++)
{ //{
//baseValue = valueDec * acAxchrate[i]; //baseValue = valueDec * acAxchrate[i];
// added on 15/10/09 // added on 15/10/09
int i = 0;
baseValue = valueDec * ((Double)lcExchrate.get(i)).doubleValue(); baseValue = valueDec * ((Double)lcExchrate.get(i)).doubleValue();
// end of code on 15/10/09 // end of code on 15/10/09
sql=" select adv_licence.tran_id, adv_licence_exp.line_no, " sql=" select adv_licence.tran_id, adv_licence_exp.line_no, "
...@@ -941,11 +1006,12 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -941,11 +1006,12 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
+" from item where item_code = ? )) " +" from item where item_code = ? )) "
+" and (case when adv_licence_exp.quantity is null then 0 else adv_licence_exp.quantity end) - " +" and (case when adv_licence_exp.quantity is null then 0 else adv_licence_exp.quantity end) - "
+" (case when adv_licence_exp.quantity_exp is null then 0 else adv_licence_exp.quantity_exp end) > 0 "; +" (case when adv_licence_exp.quantity_exp is null then 0 else adv_licence_exp.quantity_exp end) > 0 ";
pstmt = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
//pstmt.setString(1,advLicMulTranId[i]); //pstmt.setString(1,advLicMulTranId[i]);
pstmt.setString(1,(String)lsAdvLic.get(i)); pstmt1.setString(1,(String)lsAdvLic.get(i));
pstmt.setString(2,itemCode); pstmt1.setString(2,itemCode);
rs = pstmt.executeQuery(); rs = pstmt1.executeQuery();
System.out.println("ITEM CODE ==============="+itemCode);
while(rs.next()) while(rs.next())
{ {
tranId = rs.getString(1) == null ?"":rs.getString(1); tranId = rs.getString(1) == null ?"":rs.getString(1);
...@@ -976,19 +1042,23 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -976,19 +1042,23 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
pstmtItemCodeAl = null; pstmtItemCodeAl = null;
sqlItem= "select trim(unit) from item " sqlItem= "select trim(unit) from item "
+" where item_code = ? "; +" where item_code = ? ";
pstmtItem = conn.prepareStatement(sqlItem); pstmtItem = conn.prepareStatement(sqlItem);
pstmtItem.setString(1,itemCodeDeal); pstmtItem.setString(1,itemCodeDeal);
rsItem = pstmtItem.executeQuery(); rsItem = pstmtItem.executeQuery();
System.out.println(" UNIT ========"+unit);
if(rsItem.next()) if(rsItem.next())
{ {
unitAl = rsItem.getString(1) == null ?"" : rsItem.getString(1); unitAl = rsItem.getString(1) == null ?"" : rsItem.getString(1);
System.out.println(" UNITALLL11 ========"+unitAl);
} }
rsItem.close(); rsItem.close();
rsItem = null; rsItem = null;
pstmtItem.close(); pstmtItem.close();
pstmtItem = null; pstmtItem = null;
System.out.println("unit.equalsIgnoreCase(unitAl)[[["+unit.equalsIgnoreCase(unitAl)); System.out.println(" UNITALLL ========"+unitAl);
if(!(unit.equalsIgnoreCase(unitAl))) System.out.println("unit.equalsIgnoreCase(unitAl)[[[" +(unit.trim().equalsIgnoreCase(unitAl.trim())));
if(!(unit.trim().equalsIgnoreCase(unitAl.trim())))
{ {
// ??? despQtyBal = gf_conv_qty_fact(unit, unitAl, itemCode, despQtyBal, lcConv) ; // ??? despQtyBal = gf_conv_qty_fact(unit, unitAl, itemCode, despQtyBal, lcConv) ;
convQuantityFactArryList = distCommon.getConvQuantityFact(unit,unitAl,itemCode,despQtyBal,lcConv,conn); convQuantityFactArryList = distCommon.getConvQuantityFact(unit,unitAl,itemCode,despQtyBal,lcConv,conn);
...@@ -1020,8 +1090,12 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1020,8 +1090,12 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
//((Double)lcAlqtyexp.get(i)).doubleValue() = ((Double)lcAlqtyexp.get(i)).doubleValue() + updqty ; //((Double)lcAlqtyexp.get(i)).doubleValue() = ((Double)lcAlqtyexp.get(i)).doubleValue() + updqty ;
System.out.println("break1"); System.out.println("break1");
lcAlqtyexp.add(i,new Double( ((Double)lcAlqtyexp.get(i)).doubleValue() + updqty )); lcAlqtyexp.add(i,new Double( ((Double)lcAlqtyexp.get(i)).doubleValue() + updqty ));
System.out.println("break22222222"); System.out.println("valueDec"+valueDec);
System.out.println("quantityDec" +quantityDec);
System.out.println("lcConv"+lcConv);
System.out.println("updqty"+updqty);
benefitValue = (valueDec / (quantityDec * lcConv)) * updqty ; benefitValue = (valueDec / (quantityDec * lcConv)) * updqty ;
System.out.println("benefitValue"+benefitValue);
if(unitAl.equalsIgnoreCase(unit)) if(unitAl.equalsIgnoreCase(unit))
{ {
despQtyBal = despQtyBal/ lcConv ; despQtyBal = despQtyBal/ lcConv ;
...@@ -1040,7 +1114,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1040,7 +1114,9 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
errorString = "Success"; errorString = "Success";
if(errorString !=null && errorString.trim().length()>0) if(errorString !=null && errorString.trim().length()>0)
{ {
System.out.println("break3"); System.out.println("break3" + lcExchrate.get(i));
sqlSec = "update adv_licence_exp " sqlSec = "update adv_licence_exp "
+"SET quantity_exp = (case when quantity_exp is null then 0 else quantity_exp end) + ? , " +"SET quantity_exp = (case when quantity_exp is null then 0 else quantity_exp end) + ? , "
+"exp_obl_exp = (case when exp_obl_exp is null then 0 else exp_obl_exp end) + ( ? * ? ) " +"exp_obl_exp = (case when exp_obl_exp is null then 0 else exp_obl_exp end) + ( ? * ? ) "
...@@ -1120,9 +1196,16 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1120,9 +1196,16 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
} // end of while loop } // end of while loop
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt1.close();
pstmt = null; pstmt1 = null;
} // end of for loop //} // end of for loop
}
rs1.close();
rs1 = null;
pstmt.close();
pstmt = null;
}// try }// try
catch(Exception e) catch(Exception e)
...@@ -1134,7 +1217,7 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1134,7 +1217,7 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
//valueXmlString.append("</Root>\r\n"); //valueXmlString.append("</Root>\r\n");
return errorString ; return errorString ;
} // end of advanceLicence } // end of advanceLicence
public String wfDepb(String lsTranId,ArrayList despId ,Connection conn ) throws RemoteException, ITMException public String wfDepb(String despId,ArrayList lsTranId ,Connection conn ) throws RemoteException, ITMException
{ {
String keyString = ""; String keyString = "";
String alType = ""; String alType = "";
...@@ -1144,7 +1227,16 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1144,7 +1227,16 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
String itemCode = ""; String itemCode = "";
String currCode = ""; String currCode = "";
String exchRate = ""; String exchRate = "";
String invoiceId ="";
double exchRateDec = 0.0; double exchRateDec = 0.0;
String commAmt = "";
double commAmtDec = 0.00;
String exchangeRate = "";
double exeRateDec = 0.00;
String commAmtOc = "" ;
double commAmtOcDec = 0.00;
String invAmt = "";
double invAmtDec = 0.00;
String quantity = ""; String quantity = "";
double quantityDec = 0.00; double quantityDec = 0.00;
String value =""; String value ="";
...@@ -1161,11 +1253,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1161,11 +1253,15 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
String creditPerc = ""; String creditPerc = "";
double creditPercDec = 0.00; double creditPercDec = 0.00;
double depbvalue = 0.00; double depbvalue = 0.00;
double invoicevalue = 0.00;
double benefitValue = 0.00;
double invAmtRate = 0.00;
double invoiceAmt = 0.00;
String despLineNo =""; String despLineNo ="";
String tranId = ""; String tranId = "";
String sql = ""; String sql = "";
String merrcode = ""; String merrcode = "";
PreparedStatement pstmt = null,pstmtSec = null,pstmtInsert=null,pstmtCrper=null; PreparedStatement pstmt = null,pstmtSec = null,pstmtInsert=null,pstmtCrper=null,pstmtInv=null;
ResultSet rs = null , rsSec = null,rsCrper=null; ResultSet rs = null , rsSec = null,rsCrper=null;
Timestamp tranDate = null; Timestamp tranDate = null;
tranDate = new java.sql.Timestamp(System.currentTimeMillis()) ; tranDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
...@@ -1200,6 +1296,7 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1200,6 +1296,7 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
/* commented by Chandni Shah 26/08/10 ---DI89UNI060
sql= "select b.line_no,b.unit__std,b.item_code,d.curr_code,d.exch_rate, " sql= "select 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) "
+ " from depb a , despatchdet b ,despatch d " + " from depb a , despatchdet b ,despatch d "
...@@ -1208,23 +1305,46 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1208,23 +1305,46 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
+" and a.tran_id = ? " +" and a.tran_id = ? "
+" group by b.line_no,b.unit__std,b.item_code, " +" group by b.line_no,b.unit__std,b.item_code, "
+" d.curr_code,d.exch_rate "; +" d.curr_code,d.exch_rate ";
*/
// 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, "
+" sum(b.quantity__stduom), sum(b.quantity__stduom * b.rate__stduom), "
+" i.comm_amt,i.exch_rate,i.comm_amt__oc,i.inv_amt"
+" from invoice i, depb a , despatchdet b ,despatch d "
+" where d.desp_id = b.desp_id "
+" and d.desp_id = i.desp_id "
+" and d.desp_id = ? "
+" and a.tran_id = ? "
+" 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 ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,(String)despId.get(0)); //pstmt.setString(1,(String)despId.get(0));
pstmt.setString(2,lsTranId); //pstmt.setString(2,lsTranId);
pstmt.setString(1,despId);
pstmt.setString(2,(String)lsTranId.get(0));
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
invoiceId = rs.getString(1);
despLineNo = rs.getString(1); despLineNo = rs.getString(2);
unit = rs.getString(2); unit = rs.getString(3);
itemCode = rs.getString(3); itemCode = rs.getString(4);
currCode = rs.getString(4); currCode = rs.getString(5);
exchRate = rs.getString(5); exchRate = rs.getString(6);
exchRateDec = Double.parseDouble(exchRate); exchRateDec = Double.parseDouble(exchRate);
quantity = rs.getString(6); quantity = rs.getString(7);
quantityDec = Double.parseDouble(quantity); quantityDec = Double.parseDouble(quantity);
value = rs.getString(7); value = rs.getString(8);
valueDec = Double.parseDouble(value); valueDec = Double.parseDouble(value);
commAmt = rs.getString(9);
commAmtDec = Double.parseDouble(commAmt);
exchangeRate = rs.getString(10);
exeRateDec = Double.parseDouble(exchangeRate);
commAmtOc = rs.getString(11);
commAmtOcDec = Double.parseDouble(commAmtOc);
invAmt = rs.getString(12);
invAmtDec = Double.parseDouble(invAmt);
sqlSec="select credit_perc " sqlSec="select credit_perc "
+" from depb_rate where item_code__depb = ? " +" from depb_rate where item_code__depb = ? "
...@@ -1246,17 +1366,111 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1246,17 +1366,111 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
{ {
errorString ="VTDEPBRT1" ; errorString ="VTDEPBRT1" ;
} }
depbvalue = valueDec * creditPercDec * 0.01 ; depbvalue = valueDec * creditPercDec * 0.01 * exeRateDec ; //exeRateDec is Added ..
invoicevalue = (commAmtOcDec * exeRateDec); //Chandni Shah 26/08/10
benefitValue = (depbvalue - invoicevalue) + commAmtDec ;//Chandni Shah 06/09/10
invAmtRate = (invAmtDec * exeRateDec )* (12.5/100);//Added by Chandni Shah 06/09/10 as Y
invoiceAmt = (depbvalue - invoicevalue)+invAmtRate;
//commAmt = ()
rsCrper.close(); rsCrper.close();
rsCrper = null; rsCrper = null;
sqlSec= "UPDATE depb " //Chandni Shah 13/09/2010
+"SET amount_cr = (case when amount_cr is null " //To check [ comm_amt__oc > (inv_amt*exh_rate*12.5%)]
+" then 0 else amount_cr end) + ( ? * 1.0 ) " System.out.println(" commAmtOCDec ========>>>>>>>>>" +invoicevalue);
+" WHERE tran_id = ? "; System.out.println(" invAmtRate ========>>>>>>>>>" +invAmtRate);
System.out.println(" commAmtOCDec > invAmtRate ========>>>>>>>>>" +(invoicevalue > invAmtRate));
if (invoicevalue > invAmtRate)
{
sqlSec = "UPDATE depb "
+" SET amount_cr = (case when amount_cr is null "
+" then 0 else amount_cr end) + ? "
+" WHERE tran_id = ? ";
pstmtInv = conn.prepareStatement(sqlSec);
pstmtInv.setDouble(1,invoiceAmt);
pstmtInv.setString(2,(String)lsTranId.get(0));
rsCrper = pstmtInv.executeQuery();
rsCrper.close();
rsCrper = null;
pstmtInv.close();
pstmtInv = null;
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<tramn_date>"+tranDate+"</tramn_date>" ;
xmlValues = xmlValues + "</Detail1></Root>";
String genTranId = generateTranId("w_benefit_trace", xmlValues, conn);
System.out.println("genTranId >>>>>>>>>"+ genTranId);
sqlInsert = " INSERT INTO benefit_trace ( "
+" tran_id, tran_date, adj_type, "
+" benefit_type, benefit_no, line_no__benefit, "
+" ref_ser, ref_no, line_no__ref, "
+" item_code, unit, quantity, "
+" curr_code, exch_rate, benefit_value,"
+" status, chg_date, chg_user, "
+" chg_term, value__base, benefit_perc, "
+" exch_rate__base ) "
+" VALUES ( ?, ?,?, "
+" ?, ?, ?, "
+" ?, ?,?, "
+" ?, ?, ?, "
+" ?, ?, ?, "
+" ?, ?, ?, "
+" ?,?,?, "
+" ? ) " ;
pstmtInsert = conn.prepareStatement(sqlInsert);
pstmtInsert.setString(1, genTranId);
pstmtInsert.setTimestamp(2, tranDate);
pstmtInsert.setString(3, "P");
pstmtInsert.setString(4, "DP");
pstmtInsert.setString(5, (String)lsTranId.get(0));//
pstmtInsert.setInt(6, 0);
pstmtInsert.setString(7, "S-DSP");
pstmtInsert.setString(8, despId);//
pstmtInsert.setString(9, despLineNo);
//pstmtInsert.setString(9, ls_pocldet_line_no);
pstmtInsert.setString(10, itemCode);
pstmtInsert.setString(11, unit);
pstmtInsert.setDouble(12, quantityDec);
pstmtInsert.setString(13, currCode);
pstmtInsert.setDouble(14, exchRateDec);
//pstmtInsert.setDouble(15, depbvalue);
pstmtInsert.setDouble(15, invoiceAmt); //
pstmtInsert.setString(16, "O");
pstmtInsert.setTimestamp(17,tranDate);
pstmtInsert.setString(18, "BASE"); //chg USer
pstmtInsert.setString(19, "BASE"); // LoginCOde
//pstmtInsert.setDouble(20, depbvalue);
pstmtInsert.setDouble(20, invoiceAmt); //-----
pstmtInsert.setString(21, "0.000");
pstmtInsert.setDouble(22, exchRateDec);
pstmtInsert.executeUpdate();
}
else //To check [ comm_amt__oc <= (inv_amt*exh_rate*12.5%)] Chandni Shah 13/09/2010 ---DI89UNI060
{
//
/* Commented by Chandni Shah 26/08/10
sqlSec= "UPDATE depb "
+"SET amount_cr = (case when amount_cr is null "
+" then 0 else amount_cr end) + ( ? * 1.0 ) "
+" WHERE tran_id = ? ";
*/
// Changes done by Chandni Shah 26/08/10 ---DI89UNI060
sqlSec= "UPDATE depb "
+" SET amount_cr = (case when amount_cr is null "
+" then 0 else amount_cr end) + ? "
+" WHERE tran_id = ? ";
pstmtSec = conn.prepareStatement(sqlSec); pstmtSec = conn.prepareStatement(sqlSec);
pstmtSec.setDouble(1,depbvalue); pstmtSec.setDouble(1,benefitValue);
pstmtSec.setString(2,lsTranId); pstmtSec.setString(2,(String)lsTranId.get(0));
pstmtSec.executeUpdate(); pstmtSec.executeUpdate();
pstmtSec.close();
pstmtSec = null;
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>"; xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>"; xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>"; xmlValues = xmlValues + "<Detail1>";
...@@ -1281,40 +1495,43 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene ...@@ -1281,40 +1495,43 @@ public class BenefitDisPrc extends ProcessEJB implements BenefitDisPrcLocal,Bene
+" ?, ?, ?, " +" ?, ?, ?, "
+" ?, ?, ?, " +" ?, ?, ?, "
+" ?,?,?, " +" ?,?,?, "
+" ?,?,?, " +" ? ) " ;
+" ?,? ) " ;
pstmtInsert = conn.prepareStatement(sqlInsert); pstmtInsert = conn.prepareStatement(sqlInsert);
pstmtInsert.setString(1, genTranId); pstmtInsert.setString(1, genTranId);
pstmtInsert.setTimestamp(2, tranDate); pstmtInsert.setTimestamp(2, tranDate);
pstmtInsert.setString(3, "P"); pstmtInsert.setString(3, "P");
pstmtInsert.setString(4, "DP"); pstmtInsert.setString(4, "DP");
pstmtInsert.setString(5, lsTranId); pstmtInsert.setString(5, (String)lsTranId.get(0));//
pstmtInsert.setInt(6, 0); pstmtInsert.setInt(6, 0);
pstmtInsert.setString(7, "S-DSP"); pstmtInsert.setString(7, "S-DSP");
pstmtInsert.setString(8, tranId); pstmtInsert.setString(8, despId);//
pstmtInsert.setString(9, ls_pocldet_line_no); pstmtInsert.setString(9, despLineNo);
//pstmtInsert.setString(9, ls_pocldet_line_no);
pstmtInsert.setString(10, itemCode); pstmtInsert.setString(10, itemCode);
pstmtInsert.setString(11, unit); pstmtInsert.setString(11, unit);
pstmtInsert.setDouble(12, quantityDec); pstmtInsert.setDouble(12, quantityDec);
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, benefitValue); //
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, benefitValue); //-----
pstmtInsert.setString(21, "0.000"); pstmtInsert.setString(21, "0.000");
pstmtInsert.setDouble(22, exchRateDec); pstmtInsert.setDouble(22, exchRateDec);
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
}
} // 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();
......
...@@ -417,10 +417,16 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -417,10 +417,16 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
errString = itmDBAccessEJB.getErrorString("","VTBENUL",userId); errString = itmDBAccessEJB.getErrorString("","VTBENUL",userId);
resultString =errString ; resultString =errString ;
return resultString; return resultString;
} }
/*
sql = " select count(*) from benefit_trace where ref_ser = 'P-BE' and ref_no = ? "; sql = " select count(*) from benefit_trace where ref_ser = 'P-BE' and ref_no = ? ";
*/
//Benefit_type condition is Added in select query by Chandni Shah - 14/09/10 ---DI89UNI059
sql = " select count(*) from benefit_trace where benefit_type= ? and ref_ser = 'P-BE' and ref_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId.trim()); pstmt.setString(1,benefitType.trim());
pstmt.setString(2,tranId.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -442,7 +448,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -442,7 +448,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
if(benefitType != null && benefitType.trim().equalsIgnoreCase("AL")) if(benefitType != null && benefitType.trim().equalsIgnoreCase("AL"))
{ {
sql = "select distinct x.tran_id,x.file_no,x.al_no, x.line_no__exp, x.item_code__exp from " sql = "select distinct x.tran_id,x.file_no,x.al_no, x.line_no__exp, x.item_code__exp from "
+ "(SELECT a.tran_id,a.file_no,d.item_code,a.al_no,a.site_code, " + "(SELECT a.tran_id,a.file_no,d.item_code,a.al_no,a.site_code, "
+"a.eff_from ,(case when a.extend_upto is null then a.valid_upto else a.extend_upto end) valid_upto, " +"a.eff_from ,(case when a.extend_upto is null then a.valid_upto else a.extend_upto end) valid_upto, "
+" c.fin_entity,d.line_no__exp,d.item_code__exp FROM adv_licence a,site b,finent c , " +" c.fin_entity,d.line_no__exp,d.item_code__exp FROM adv_licence a,site b,finent c , "
+" adv_licence_imp d where a.tran_id = d.tran_id and a.site_code = b.site_code " +" adv_licence_imp d where a.tran_id = d.tran_id and a.site_code = b.site_code "
...@@ -596,6 +602,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -596,6 +602,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
double valueDec =0.00; double valueDec =0.00;
String qtyImp = ""; String qtyImp = "";
double qtyImpDec = 0.00; double qtyImpDec = 0.00;
String netAmount = "";
double netAmountDec = 0.00 ;
String amtImp = ""; String amtImp = "";
double amtImpDec = 0.00; double amtImpDec = 0.00;
String qty = ""; String qty = "";
...@@ -608,6 +616,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -608,6 +616,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
String ll_exp_lineno = ""; String ll_exp_lineno = "";
String ls_item_code = ""; String ls_item_code = "";
String lc_exp = ""; String lc_exp = "";
String amt_imp ="";
String amt_impBc ="";
String sqlsec = ""; String sqlsec = "";
String noUpdate = ""; String noUpdate = "";
PreparedStatement pstmt =null,pstmtSec = null ,pstmtInsert = null ; PreparedStatement pstmt =null,pstmtSec = null ,pstmtInsert = null ;
...@@ -655,7 +665,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -655,7 +665,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = " select a.line_no , d.line_no, d.unit, a.item_code, b.curr_code , b.exch_rate, " sql = " select a.line_no , d.line_no, d.unit, a.item_code, b.curr_code , b.exch_rate, b.net_amt , "
+ "sum(case when d.quantity is null then 0 else d.quantity end), " + "sum(case when d.quantity is null then 0 else d.quantity end), "
+" sum(case when d.asseable_amt is null then 0 else d.asseable_amt end)," +" sum(case when d.asseable_amt is null then 0 else d.asseable_amt end),"
+ "(case when a.quantity_imp is null then 0 else a.quantity_imp end), " + "(case when a.quantity_imp is null then 0 else a.quantity_imp end), "
...@@ -668,7 +678,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -668,7 +678,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
+ "and d.tran_id = '"+tranId+"' " + "and d.tran_id = '"+tranId+"' "
+ "and a.tran_id = '"+ls_adv_lic+"' " + "and a.tran_id = '"+ls_adv_lic+"' "
+ "group by a.line_no , d.line_no , d.unit , a.item_code , " + "group by a.line_no , d.line_no , d.unit , a.item_code , "
+" b.curr_code , b.exch_rate , a.quantity_imp , a.amount_imp_bc, " +" b.curr_code , b.exch_rate ,b.net_amt, a.quantity_imp , a.amount_imp_bc, "
+"a.quantity , a.amount_bc "; +"a.quantity , a.amount_bc ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -681,17 +691,19 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -681,17 +691,19 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
currCode = rs.getString(5); currCode = rs.getString(5);
exchRate = rs.getString(6); exchRate = rs.getString(6);
exchRateDec = Double.parseDouble(exchRate); exchRateDec = Double.parseDouble(exchRate);
quantity = rs.getString(7); netAmount = rs.getString(7);
netAmountDec = Double.parseDouble(netAmount);
quantity = rs.getString(8);
quantityDec = Double.parseDouble(quantity); quantityDec = Double.parseDouble(quantity);
value = rs.getString(8); value = rs.getString(9);
valueDec = Double.parseDouble(value); valueDec = Double.parseDouble(value);
qtyImp = rs.getString(9); qtyImp = rs.getString(10);
qtyImpDec = Double.parseDouble(qtyImp); qtyImpDec = Double.parseDouble(qtyImp);
amtImp= rs.getString(10); amtImp= rs.getString(11);
amtImpDec = Double.parseDouble(amtImp); amtImpDec = Double.parseDouble(amtImp);
qty = rs.getString(11); qty = rs.getString(12);
qtyDec = Double.parseDouble(qty); qtyDec = Double.parseDouble(qty);
amt = rs.getString(12); amt = rs.getString(13);
amtDec = Double.parseDouble(amt); amtDec = Double.parseDouble(amt);
System.out.println("exchRateDec>>>>>>>>>>"+exchRateDec); System.out.println("exchRateDec>>>>>>>>>>"+exchRateDec);
System.out.println("quantityDec>>>>>>>>>>"+quantityDec); System.out.println("quantityDec>>>>>>>>>>"+quantityDec);
...@@ -700,6 +712,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -700,6 +712,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
System.out.println("amtImpDec>>>>>>>>>>"+amtImpDec); System.out.println("amtImpDec>>>>>>>>>>"+amtImpDec);
System.out.println("qtyDec>>>>>>>>>>"+qtyDec); System.out.println("qtyDec>>>>>>>>>>"+qtyDec);
System.out.println("amtDec>>>>>>>>>>"+amtDec); System.out.println("amtDec>>>>>>>>>>"+amtDec);
System.out.println("netAmount>>>>>>>>>>"+netAmountDec);
System.out.println("returnExchRateDec>>>>>>>>>>"+returnExchRateDec); System.out.println("returnExchRateDec>>>>>>>>>>"+returnExchRateDec);
baseValue = valueDec * returnExchRateDec ; //??lc_value * s_pass1.mdecimal consider s_pass1.mdecimal =returnExchRateDec; baseValue = valueDec * returnExchRateDec ; //??lc_value * s_pass1.mdecimal consider s_pass1.mdecimal =returnExchRateDec;
System.out.println("valueDec * returnExchRateDec>>>>>>>>>>"+baseValue); System.out.println("valueDec * returnExchRateDec>>>>>>>>>>"+baseValue);
...@@ -764,18 +778,29 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -764,18 +778,29 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
pstmtInsert.close(); pstmtInsert.close();
pstmtInsert = null; pstmtInsert = null;
sqlSec="update adv_licence_imp " /*
sqlSec="update adv_licence_imp "
+" SET quantity_imp = (case when quantity_imp is null then 0 else quantity_imp end ) + '"+quantityDec+"' , " +" SET quantity_imp = (case when quantity_imp is null then 0 else quantity_imp end ) + '"+quantityDec+"' , "
+"amount_imp = (case when amount_imp is null then 0 else amount_imp end) + '"+valueDec+"' , " +"amount_imp = (case when amount_imp is null then 0 else amount_imp end) + '"+valueDec+"' , "
+" amount_imp_bc = (case when amount_imp_bc is null then 0 else amount_imp_bc end) + ('"+valueDec+"' * '"+returnExchRateDec+"' ) " +" amount_imp_bc = (case when amount_imp_bc is null then 0 else amount_imp_bc end) + ('"+valueDec+"' * '"+returnExchRateDec+"' ) "
+ " WHERE tran_id = '"+ls_adv_lic+"' " + " WHERE tran_id = '"+ls_adv_lic+"' "
+" AND line_no = '"+ls_advlic_line_no+"' "; +" AND line_no = '"+ls_advlic_line_no+"' ";
*/
//Chandni Shah 14/09/10 ---DI89UNI059
sqlSec="update adv_licence_imp "
+" SET quantity_imp = (case when quantity_imp is null then 0 else quantity_imp end ) + '"+quantityDec+"' , "
+"amount_imp = (case when amount_imp is null then 0 else amount_imp end) + '"+netAmountDec+"' , "
+" amount_imp_bc = (case when amount_imp_bc is null then 0 else amount_imp_bc end) + ('"+netAmountDec+"' * '"+returnExchRateDec+"' ) "
+ " WHERE tran_id = '"+ls_adv_lic+"' "
+" AND line_no = '"+ls_advlic_line_no+"' ";
pstmtSec = conn.prepareStatement(sqlSec); pstmtSec = conn.prepareStatement(sqlSec);
pstmtSec.executeUpdate(); pstmtSec.executeUpdate();
pstmtSec.close(); pstmtSec.close();
pstmtSec = null; pstmtSec = null;
}// end of whil e loop }// end of while loop
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
...@@ -792,6 +817,11 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -792,6 +817,11 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
/*
//chandni Shah ---> 14/09/2010 ---DI89UNI059
// instead of adv_licence_exp table ,adv_licence table is updated
sql= " select max((amount_imp/amount)*100) " sql= " select max((amount_imp/amount)*100) "
+" from adv_licence_imp " +" from adv_licence_imp "
+ "where tran_id = '"+ls_adv_lic+"' " + "where tran_id = '"+ls_adv_lic+"' "
...@@ -813,6 +843,31 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -813,6 +843,31 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
pstmtSec.close(); pstmtSec.close();
pstmtSec = null; pstmtSec = null;
} }
*/
//chandni Shah ---> 14/09/2010 ---DI89UNI059
sql= " select amount_imp,amount_imp_bc "
+" from adv_licence_imp "
+ "where tran_id = '"+ls_adv_lic+"' "
+ "and line_no__exp = '"+ll_exp_lineno+"' "
+" and item_code__exp = '"+ls_item_code+"' "
+"and amount > 0 ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next())
{
amt_imp = rs.getString(1) == null ? "" : rs.getString(1) ;
amt_impBc = rs.getString(2) == null ? "" : rs.getString(2) ;
// update query for adv_licence
sqlsec = "update adv_licence "
+" set import_amt = (case when import_amt is null then 0 else import_amt end ) + '"+ amt_imp +"' , "
+" import_amt__bc = (case when import_amt__bc is null then 0 else import_amt__bc end ) + '"+ amt_impBc +"' "
+"where tran_id = '"+ls_adv_lic+"' " ;
pstmtSec = conn.prepareStatement(sqlsec);
pstmtSec.executeUpdate();
pstmtSec.close();
pstmtSec = null;
}
if(merrcode.length()==0) if(merrcode.length()==0)
{ {
merrcode ="success"; merrcode ="success";
...@@ -853,7 +908,9 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -853,7 +908,9 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
String qty = ""; String qty = "";
double qtyDec =0.00; double qtyDec =0.00;
String amt = ""; String amt = "";
double amtDec=0.0; double amtDec=0.0;
String taxAmount = "";
double taxAmountDec = 0.00;
String sqlSec = ""; String sqlSec = "";
String creditPerc = ""; String creditPerc = "";
double creditPercDec = 0.00; double creditPercDec = 0.00;
...@@ -901,13 +958,13 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -901,13 +958,13 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql= " select b.line_no,b.unit,b.item_code,d.curr_code,d.exch_rate," sql= " select b.line_no,b.unit,b.item_code,d.curr_code,d.exch_rate,"
+" sum(b.quantity), sum(b.asseable_amt)" +" sum(b.quantity), sum(b.asseable_amt), d.tax_amt "
+" from depb a , po_clearance_det b ,po_clearance d " +" from depb a , po_clearance_det b ,po_clearance d "
+" where d.tran_id = b.tran_id " +" where d.tran_id = b.tran_id "
+" and d.tran_id = '"+ ls_tran_id+"' " +" and d.tran_id = '"+ ls_tran_id+"' "
+" and a.tran_id = '"+ls_depb_no+"' " //?? as_depb_no +" and a.tran_id = '"+ls_depb_no+"' " //?? as_depb_no
+" group by b.line_no,b.unit,b.item_code, " +" group by b.line_no,b.unit,b.item_code, "
+" d.curr_code,d.exch_rate "; +" d.curr_code,d.exch_rate,d.tax_amt ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
...@@ -923,6 +980,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -923,6 +980,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
quantityDec = Double.parseDouble(quantity); quantityDec = Double.parseDouble(quantity);
value = rs.getString(7); value = rs.getString(7);
valueDec = Double.parseDouble(value); valueDec = Double.parseDouble(value);
taxAmount = rs.getString(8);
taxAmountDec = Double.parseDouble(taxAmount);
sqlSec="select credit_perc " sqlSec="select credit_perc "
+" from depb_rate where item_code__depb = '"+itemCode+"' "; +" from depb_rate where item_code__depb = '"+itemCode+"' ";
pstmtSec = conn.prepareStatement(sqlSec); pstmtSec = conn.prepareStatement(sqlSec);
...@@ -947,6 +1006,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -947,6 +1006,7 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
System.out.println("valueDec>>>>>>>" + valueDec); System.out.println("valueDec>>>>>>>" + valueDec);
System.out.println("creditPercDec>>>>>>>" + creditPercDec); System.out.println("creditPercDec>>>>>>>" + creditPercDec);
System.out.println("depbvalue>>>>>>>" + depbvalue); System.out.println("depbvalue>>>>>>>" + depbvalue);
System.out.println ("taxAmount>>>>>>>>>>>"+taxAmountDec);
String genTranId = generateTranId("w_benefit_trace", "S-BTR", conn); String genTranId = generateTranId("w_benefit_trace", "S-BTR", conn);
System.out.println("tranId>>>>>>>" + genTranId); System.out.println("tranId>>>>>>>" + genTranId);
String sqlInsert = "INSERT INTO benefit_trace (tran_id, tran_date, adj_type, " String sqlInsert = "INSERT INTO benefit_trace (tran_id, tran_date, adj_type, "
...@@ -970,12 +1030,12 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -970,12 +1030,12 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
pstmtInsert.setDouble(12, quantityDec); pstmtInsert.setDouble(12, quantityDec);
pstmtInsert.setString(13, currCode); pstmtInsert.setString(13, currCode);
pstmtInsert.setDouble(14, exchRateDec); pstmtInsert.setDouble(14, exchRateDec);
pstmtInsert.setDouble(15, valueDec); pstmtInsert.setDouble(15, taxAmountDec);//
pstmtInsert.setString(16, "O"); pstmtInsert.setString(16, "O");
pstmtInsert.setTimestamp(17, tranDate); pstmtInsert.setTimestamp(17, tranDate);
pstmtInsert.setString(18, "BASE"); pstmtInsert.setString(18, "BASE");
pstmtInsert.setString(19, ""); pstmtInsert.setString(19, "");
pstmtInsert.setDouble(20, valueDec); pstmtInsert.setDouble(20, taxAmountDec);//
pstmtInsert.setString(21, "0.000"); pstmtInsert.setString(21, "0.000");
pstmtInsert.setDouble(22, exchRateDec); pstmtInsert.setDouble(22, exchRateDec);
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
...@@ -985,7 +1045,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc ...@@ -985,7 +1045,8 @@ public class BenefitPrc extends ProcessEJB implements BenefitPrcLocal,BenefitPrc
+" (case when amount_dr is null then 0 else amount_dr end) + (? * ?) " +" (case when amount_dr is null then 0 else amount_dr end) + (? * ?) "
+ " WHERE tran_id = ? " ; + " WHERE tran_id = ? " ;
pstmtInsert = conn.prepareStatement(sqlSec); pstmtInsert = conn.prepareStatement(sqlSec);
pstmtInsert.setDouble(1,depbvalue); //pstmtInsert.setDouble(1,depbvalue);
pstmtInsert.setDouble(1,taxAmountDec);
pstmtInsert.setDouble(2,exchRateDec); pstmtInsert.setDouble(2,exchRateDec);
pstmtInsert.setString(3,ls_depb_no); pstmtInsert.setString(3,ls_depb_no);
int i= pstmtInsert.executeUpdate(); int i= pstmtInsert.executeUpdate();
......
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