Commit 923b5172 authored by ngadkari's avatar ngadkari

new scheme auto add functionality

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@197074 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 27b61c6b
......@@ -22,6 +22,7 @@ import javax.ejb.Stateless;
@Stateless
public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSaveLocal,SaleOrderPostSaveRemote {
E12GenericUtility genericUtility= new E12GenericUtility();
DistCommon distCommon = new DistCommon();//added by nandkumar gadkari on 11/02/19
public String postSave(String xmlString,String tranId,String editFlag, String xtraParams,Connection conn) throws RemoteException,ITMException
{
......@@ -57,14 +58,37 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
ordAmtH=0,ordValueH=0,ordValue=0,totOrdValueH=0,
billBackAmt=0,offInvAmt=0,netTotAmtDet=0,netTotAmtHdr=0,ordBillBackAmt=0,ordOffInvAmt=0,lineBillBackAmt=0,lineOffInvAmt=0;
int count=0,lineNo=0;
String freeBalOrd="",nature="";//added by nandkumar gadkari on 11/02/19
double freeBalValue=0.0,totFreeBalValue=0.0;//added by nandkumar gadkari on 11/02/19
try
{
//GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
tranId = genericUtility.getColumnValue("sale_order",dom);
//added by nandkumar gadkari on 11/02/19------------------------start--------------------------------
freeBalValue = checkDoubleNull(genericUtility.getColumnValue("free_bal_value",dom));
freeBalOrd = distCommon.getDisparams( "999999", "FREE_BAL_ORD", conn );
if(freeBalOrd==null || freeBalOrd.trim().length() ==0 || freeBalOrd.equalsIgnoreCase("NULLFOUND"))
{
freeBalOrd="N";
}
else
{
freeBalOrd=freeBalOrd.trim();
}
if("Y".equalsIgnoreCase(freeBalOrd) && freeBalValue == 0)
{
System.out.println("in schemeFreeQtyAdd postSave ----");
errorString= schemeFreeQtyAdd(dom,tranId,xtraParams,conn);
errorString="";
}
//added by nandkumar gadkari on 11/02/19------------------------end--------------------------------
System.out.println("sale_order--->>["+tranId+"]");
sql="select quantity__stduom,rate__stduom,discount,tax_amt,line_no,ord_value,"
+ "billback_amt,offinv_amt " //VALLABH KADAM [20/JUL/15] find billback_amt,offinv_amt
+ "billback_amt,offinv_amt, " //VALLABH KADAM [20/JUL/15] find billback_amt,offinv_amt
+ "nature " //added by nandkumar gadkari on 11/02/19
+ "from sorddet where sale_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -79,7 +103,7 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
ordValue=rs.getDouble(6);
billBackAmt=rs.getDouble(7); //VALLABH KADAM [20/JUL/15] find billback_amt
offInvAmt=rs.getDouble(8); //VALLABH KADAM [20/JUL/15] find offinv_amt
nature =rs.getString(9);//added by nandkumar gadkari on 11/02/19
System.out.println("quantityStduom-->["+quantityStduom+"]");
System.out.println("rateStduom-->["+rateStduom+"]taxAmt-->["+taxAmt+"]");
System.out.println("discount-->["+discount+"] lineNo-->["+lineNo+"]");
......@@ -111,6 +135,12 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
totAmtH=totAmtH + netAmt;
totOrdValueH=totOrdValueH + ordValue;
//condition added by nandkuar gadkari on 11/02/19------------start-------------
if("I".equalsIgnoreCase(nature) || "V".equalsIgnoreCase(nature))
{
totFreeBalValue= totFreeBalValue + ordValue;
}
//condition added by nandkuar gadkari on 11/02/19------------end -------------
} //end while
if (pstmt != null)
{
......@@ -126,7 +156,7 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
System.out.println("pre count---->>["+count+"]");
System.out.println("taxAmtH-->["+taxAmtH+"] totAmtH-->["+totAmtH+"]");
System.out.println("ordAmtH-->["+ordAmtH+"] totOrdValueH-->["+totOrdValueH+"]");
System.out.println("totFreeBalValue---->>["+totFreeBalValue+"]");
/**
* VALLABH KADAM [20/JUL/15]
* find ord_billback_amt, ord_offinv_amt, line_billback_amt, line_offinv_amt
......@@ -152,14 +182,15 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
System.out.println("Net Tot Amt Hdr :- ["+netTotAmtHdr+"]");
sql="update sorder set tax_amt = ? ,tot_amt= ? ,ord_amt = ?,tot_ord_value= ?,net_tot_amt=? where sale_order = ?";
sql="update sorder set tax_amt = ? ,tot_amt= ? ,ord_amt = ?,tot_ord_value= ?,net_tot_amt=? ,free_bal_value= ? where sale_order = ?";// free_bal_value column added by nandkumar gadkari
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1, taxAmtH);
pstmt.setDouble(2, totAmtH);
pstmt.setDouble(3, ordAmtH);
pstmt.setDouble(4, totOrdValueH);
pstmt.setDouble(5, netTotAmtHdr); // VALLABH KADAM [20/JUL/15] net_tot_amt for header
pstmt.setString(6, tranId);
pstmt.setDouble(6, totFreeBalValue);// free_bal_value- nandkumar gadkari
pstmt.setString(7, tranId);
count=pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]");
//Manoj dtd 18/03/2016 Removed Commit and Rollback condition
......@@ -224,4 +255,509 @@ public class SaleOrderPostSave extends ValidatorEJB implements SaleOrderPostSave
// Changed by Manish for Maximum open cursor on 29/03/16 [end]
return errorString;
}
//added by nandkumar gadkari on 11/02/19------------------------start--------------------------------
private String schemeFreeQtyAdd(Document dom,String tranId,String xtraParams,Connection conn) throws ITMException
{
ResultSet rs=null,rs1=null,rs2=null;
PreparedStatement pstmt=null,pstmt1=null,pstmt2=null;
String sql="",sql1="",errorString="";
double quantityStduom = 0,rateStduom=0,discount=0,taxAmt=0,netAmt=0,taxAmtH=0,totAmtH=0,
ordAmtH=0,ordValueH=0,ordValue=0,totOrdValueH=0,
billBackAmt=0,offInvAmt=0,netTotAmtDet=0,netTotAmtHdr=0,ordBillBackAmt=0,ordOffInvAmt=0,lineBillBackAmt=0,totOrdValue=0,freeOrdvalue=0;
int count=0,lineNo=0;
String freeBalOrd="",freeBalOrdPerStr="",itemCodeOrd="",custCode="",siteCode="",priceList="",lsListType="",unit="",lsRefNo="",orderDateStr="";//added by nandkumar gadkari on 06/02/19
double freeBalOrdPer=0.0,freeBalValue=0.0,schemeBalFreeQty=0.0,unConfTotFreeQty=0.0,freeValue=0.0,freeQtyToadd=0.0,convRtuomStduom=0.0,convQtyStduom=0.0,rateClg=0.0;//added by nandkumar gadkari on 06/02/19
Timestamp orderDate=null,currDate = null;
int llPlcount=0,minShelfLife=0,lineNos=0,cnt=0;
String itemFlag="",lineNoSord="",chgUser="",chgTerm="",taxChap="",taxEnv="",taxClass="",unitRate="",itemDesc="",status="",unitStd="",packCode="",itemCode="";
String itemSer="",itemSerProm="",locType="",holdflag="",nature="",unitSal="",mType="";
boolean schemeUsedInDetail=false;
try {
chgUser = (genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
chgTerm = (genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
currDate = getCurrtDate();
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDateStr = sdfAppl.format(currDate);
currDate = getCurrtDate();
custCode = genericUtility.getColumnValue("cust_code",dom);
orderDate = Timestamp.valueOf(
genericUtility.getValidDateString(genericUtility.getColumnValue("order_date", dom),
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())
+ " 00:00:00.0");
orderDateStr = genericUtility.getColumnValue("order_date", dom);
siteCode = (genericUtility.getColumnValue("site_code", dom));
sql="select item_code__ord,ord_value,unit,quantity__stduom,ITEM_FLG,TAX_CLASS,TAX_CHAP,TAX_ENV,STATUS,ITEM_DESCR,UNIT__RATE,"
+ "CONV__QTY_STDUOM,CONV__RTUOM_STDUOM,UNIT__STD,PACK_CODE,ITEM_CODE,MIN_SHELF_LIFE,ITEM_SER,RATE__CLG,ITEM_SER__PROM,LOC_TYPE,HOLD_FLAG,"
+ "NATURE "
+ "from sorddet where sale_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs=pstmt.executeQuery();
while(rs.next())
{
schemeBalFreeQty=0.0;
itemCodeOrd=rs.getString(1);
ordValue=rs.getDouble(2);
quantityStduom=rs.getDouble(4);
itemFlag=rs.getString(5);
taxChap=rs.getString("TAX_CHAP");
taxEnv=rs.getString("TAX_ENV");
taxClass=rs.getString("TAX_CLASS");
status=rs.getString("STATUS");
convQtyStduom=rs.getDouble("CONV__QTY_STDUOM");
convRtuomStduom=rs.getDouble("CONV__RTUOM_STDUOM");
minShelfLife=rs.getInt("MIN_SHELF_LIFE");
rateClg=rs.getDouble("RATE__CLG");
holdflag=rs.getString("HOLD_FLAG");
nature=rs.getString("NATURE");
System.out.println("itemCodeOrd-->["+itemCodeOrd+"]");
if("I".equalsIgnoreCase(nature) || "V".equalsIgnoreCase(nature))
{
schemeUsedInDetail=true;
}
totOrdValue= totOrdValue + ordValue;
}
if (rs !=null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
if(!schemeUsedInDetail)
{
priceList = (distCommon.getDisparams( "999999", "MRP", conn ));
freeBalOrdPerStr = distCommon.getDisparams( "999999", "FREE_BAL_ORD_PER", conn );
if(freeBalOrdPerStr==null || freeBalOrdPerStr.trim().length() ==0 || freeBalOrdPerStr.equalsIgnoreCase("NULLFOUND"))
{
freeBalOrdPer=50.0;
}
else
{
freeBalOrdPer=Double.parseDouble(freeBalOrdPerStr);
}
// caluclation of quantity to be add
freeValue= (totOrdValue * freeBalOrdPer)/100;
//freeQtyToadd=freeValue/rateStduom;
System.out.println("freeValue " + freeValue);
System.out.println("totOrdValue" + totOrdValue);
System.out.println("freeBalOrdPer " + freeBalOrdPer);
System.out.println("totOrdValue " + totOrdValue);
sql = " SELECT BALANCE_FREE_QTY - USED_FREE_QTY ,ITEM_CODE FROM SCHEME_BALANCE WHERE BALANCE_FREE_QTY - USED_FREE_QTY > 0 "
+ " AND EFF_FROM <= ? AND VALID_UPTO >=? AND CUST_CODE = ? ";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setTimestamp(1, orderDate);
pstmt2.setTimestamp(2, orderDate);
pstmt2.setString(3,custCode);
//pstmt2.setString(4,itemCodeOrd);
rs2 = pstmt2.executeQuery();
while (rs2.next())
{
schemeBalFreeQty = rs2.getDouble(1);
itemCodeOrd = rs2.getString(2);
if(schemeBalFreeQty > 0 && freeValue > 0)
{
sql = " select sum(case when nature ='I' then quantity else 0 end) as unconfirmFreeQty " +
" from sorder a,sorddet b where a.sale_order = b.sale_order and a.site_code = ? "
+ " and a.cust_code = ? and a.order_date between ? and ?"
+ " and b.item_code__ord = ?"
+ " and (case when a.confirmed is null then 'N' else a.confirmed end )= 'N' and b.nature in ('I')";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, siteCode);
pstmt1.setString(2, custCode);
pstmt1.setTimestamp(3, orderDate);
pstmt1.setTimestamp(4, orderDate);
pstmt1.setString(5, itemCodeOrd);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
unConfTotFreeQty = rs1.getDouble("unconfirmFreeQty");
System.out.println("unConfTotFreeQty separte free" + unConfTotFreeQty);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if ((unConfTotFreeQty) < schemeBalFreeQty)
{
schemeBalFreeQty=schemeBalFreeQty-unConfTotFreeQty;
sql="select descr , loc_type ,pack_code,unit,unit__rate,unit__sal,item_stru from item where item_code =?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd);
rs=pstmt.executeQuery();
if(rs.next())
{
itemDesc = rs.getString("descr");
locType = rs.getString("loc_type");
packCode = rs.getString("pack_code");
unit = rs.getString("unit");
unitRate = rs.getString("unit__rate");
unitSal = rs.getString("unit__sal");
mType = rs.getString("item_stru");
}
if (rs !=null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
if (unitSal == null || unitSal.trim().length() == 0) {
unitSal = unit;
}
if(priceList ==null || priceList.trim().length() ==0 || priceList.equalsIgnoreCase("NULLFOUND"))
{
priceList = (genericUtility.getColumnValue("price_list", dom));
}
lsListType = distCommon.getPriceListType(priceList, conn);
sql = "select count(1) as llPlcount from pricelist where price_list=?"
+ " and item_code= ? and unit= ? and list_type=? and eff_from<=? and valid_upto >=? and min_qty<=? and max_qty>= ?"
+ " and (ref_no is not null)";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, priceList);
pstmt1.setString(2, itemCodeOrd);
pstmt1.setString(3, unitSal);
pstmt1.setString(4, lsListType);
pstmt1.setTimestamp(5, orderDate);
pstmt1.setTimestamp(6, orderDate);
pstmt1.setDouble(7, quantityStduom);
pstmt1.setDouble(8, quantityStduom);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
llPlcount = rs1.getInt("llPlcount");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if (llPlcount >= 1) {
sql = "select max(ref_no)from pricelist where price_list =? and item_code= ? and unit=? and list_type= ?"
+ " and eff_from<=? and valid_upto>=? and min_qty<=? and max_qty>=? and (ref_no is not null)";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, priceList);
pstmt1.setString(2, itemCodeOrd);
pstmt1.setString(3, unitSal);
pstmt1.setString(4, lsListType);
pstmt1.setTimestamp(5, orderDate);
pstmt1.setTimestamp(6, orderDate);
pstmt1.setDouble(7, quantityStduom);
pstmt1.setDouble(8, quantityStduom);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
lsRefNo = rs1.getString(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
rateStduom = distCommon.pickRateRefnoWise(priceList, orderDateStr, itemCodeOrd, lsRefNo, lsListType, quantityStduom,
conn);
}
if (rateStduom <= 0) {
rateStduom = distCommon.pickRate(priceList, orderDateStr, itemCodeOrd, "", "L", quantityStduom, conn);
}
if (rateStduom > 0)
{
// caluclation of quantity to be add
freeOrdvalue = schemeBalFreeQty * rateStduom;
//
System.out.println("freeOrdvalue " + freeOrdvalue);
System.out.println("schemeBalFreeQty" + schemeBalFreeQty);
System.out.println("rateStduom " + rateStduom);
System.out.println("freeValue Remaning " + freeValue);
sql="select trim(max(cast(line_no as number))) from sorddet where sale_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs=pstmt.executeQuery();
if(rs.next())
{
lineNos=rs.getInt(1);
}
if (rs !=null)
{
rs.close();
rs=null;
}
if (pstmt != null)
{
pstmt.close();
pstmt=null;
}
lineNos ++;
lineNoSord= Integer.toString(lineNos);
if ("F".equalsIgnoreCase(mType)) {
itemFlag="B";
} else {
itemFlag="I";
}
itemSer = distCommon.getItemSer(itemCodeOrd, siteCode, orderDate, custCode, "C", conn);
itemSerProm = distCommon.getItemSer(itemCodeOrd, siteCode, orderDate, custCode, "O",
conn);
sql = "select count(*) as cnt from customer_series where cust_code = ? and item_ser =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSerProm);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("cnt=========[" + cnt + "]");
if (cnt == 0) {
sql = "select item_ser from item_credit_perc where item_code = ?"
+ " and item_ser in ( select item_ser from customer_series where cust_code = ?"
+ " and item_ser = item_credit_perc.item_ser)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd);
pstmt.setString(2, custCode);
rs = pstmt.executeQuery();
if (rs.next()) {
itemSerProm = rs.getString("item_ser");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (itemSerProm != null && itemSerProm.trim().length() > 0) {
sql = "select item_ser__inv from customer_series where cust_code = ? and item_ser =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSerProm);
rs = pstmt.executeQuery();
if (rs.next()) {
itemSer = rs.getString("item_ser__inv");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
sql="insert into SORDDET (SALE_ORDER,LINE_NO,SITE_CODE,ITEM_FLG,QUANTITY,UNIT,DSP_DATE,RATE,DISCOUNT,TAX_AMT,TAX_CLASS,"//11
+ "TAX_CHAP,TAX_ENV,NET_AMT,STATUS,CHG_DATE,CHG_USER,CHG_TERM,ITEM_DESCR,UNIT__RATE,CONV__QTY_STDUOM,"//21
+ "CONV__RTUOM_STDUOM,UNIT__STD,QUANTITY__STDUOM,RATE__STDUOM,NO_ART,PACK_CODE,ITEM_CODE,MIN_SHELF_LIFE,ITEM_SER,"//30
+ "RATE__CLG,ORD_VALUE,ITEM_SER__PROM,"//33
+ "ITEM_CODE__ORD,OVER_SHIP_PERC,COMM_PERC_1,COMM_PERC_2,COMM_PERC_3,"//38
+ "SALES_PERS_COMM_1,SALES_PERS_COMM_2,SALES_PERS_COMM_3,RATE__STD,"//42
+ "LOC_TYPE,QUANTITY__FC,NATURE,"//45
+ "BILLBACK_AMT,OFFINV_AMT,HOLD_FLAG,NET_TOT_AMT,SCH_ATTR) " //50
+ "values(?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?,"
+"?,?,?,?,?,?,?,?,?,?,"
+"?,?,?,?,?,?,?,?,?,?,"
+"?,?,?,?,?,?,?,?,?,?)"; //50
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranId);
lineNoSord = " " + lineNoSord;
lineNoSord = lineNoSord.substring(lineNoSord.length()-3);
pstmt1.setString(2, lineNoSord);
pstmt1.setString(3, siteCode);
pstmt1.setString(4, itemFlag);
//pstmt1.setDouble(5, schemeBalFreeQty);
pstmt1.setString(6, unitSal);
pstmt1.setTimestamp(7, currDate); //dsp_date
pstmt1.setDouble(8, 0);
pstmt1.setDouble(9, 0);
pstmt1.setDouble(10, 0);
pstmt1.setString(11, taxClass);
pstmt1.setString(12, taxChap);
pstmt1.setString(13, taxEnv);
pstmt1.setDouble(14, 0);
pstmt1.setString(15, status);
pstmt1.setTimestamp(16, currDate); //chgDate
pstmt1.setString(17, chgUser);
pstmt1.setString(18, chgTerm);
pstmt1.setString(19, itemDesc);
pstmt1.setString(20, unitRate);
pstmt1.setDouble(21, convQtyStduom);
pstmt1.setDouble(22, convRtuomStduom);
pstmt1.setString(23, unit);
//pstmt1.setDouble(24, schemeBalFreeQty);
pstmt1.setDouble(25, 0);
pstmt1.setDouble(26,0);//NO_ART
pstmt1.setString(27,packCode);
pstmt1.setString(28,itemCodeOrd);//
pstmt1.setInt(29,minShelfLife);//
pstmt1.setString(30,itemSer);//
pstmt1.setDouble(31,rateClg);//
// ordValue=schemeBalFreeQty * rateStduom;
// System.out.println("ordValue--->>"+ordValue +" ("+schemeBalFreeQty +" * "+rateStduom+")");
// pstmt1.setDouble(32,ordValue);//ord_value
pstmt1.setString(33,itemSerProm);
pstmt1.setString(34,itemCodeOrd);
pstmt1.setDouble(35,0);
pstmt1.setDouble(36,0);//
pstmt1.setDouble(37,0);
pstmt1.setDouble(38,0);
pstmt1.setDouble(39,0);
pstmt1.setDouble(40,0);
pstmt1.setDouble(41,0);
pstmt1.setDouble(42,0);//RATE__STD
pstmt1.setString(43,locType);
// pstmt1.setDouble(44,schemeBalFreeQty);
pstmt1.setString(45,"I");
pstmt1.setDouble(46,0);
pstmt1.setDouble(47,0);
pstmt1.setString(48,holdflag);
pstmt1.setDouble(49,0);
pstmt1.setString(50,"N");
if(freeOrdvalue < freeValue)
{
pstmt1.setDouble(5, schemeBalFreeQty);
pstmt1.setDouble(24, schemeBalFreeQty);
ordValue=schemeBalFreeQty * rateStduom;
System.out.println("ordValue--->>"+ordValue +" ("+schemeBalFreeQty +" * "+rateStduom+")");
pstmt1.setDouble(32,ordValue);//ord_value
pstmt1.setDouble(44,schemeBalFreeQty);
}
else
{
freeQtyToadd=freeValue/rateStduom;// if freeValue is less than freeOrdvalue
System.out.println("freeQtyToadd befor" + freeQtyToadd);
freeQtyToadd=integralPartQty(freeQtyToadd);
System.out.println("freeQtyToadd after" + freeQtyToadd);
pstmt1.setDouble(5, freeQtyToadd);
pstmt1.setDouble(24, freeQtyToadd);
ordValue=freeQtyToadd * rateStduom;
System.out.println("ordValue--->>"+ordValue +" ("+freeQtyToadd +" * "+rateStduom+")");
pstmt1.setDouble(32,ordValue);//ord_value
pstmt1.setDouble(44,freeQtyToadd);
}
int rows=pstmt1.executeUpdate();
System.out.println("rows in detail ----["+rows+"]");
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(rows > 0)
{
errorString="Success";
freeValue= freeValue - freeOrdvalue;
}
}
}
}
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
}
} catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
} catch (Exception e) {
e.printStackTrace();
throw new ITMException(e);
}
}
return errorString;
}
private java.sql.Timestamp getCurrtDate() throws RemoteException,ITMException
{
String currAppdate = "";
java.sql.Timestamp currDate = null;
try
{
Object date = null;
currDate = new java.sql.Timestamp(System.currentTimeMillis());
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(genericUtility.getDBDateFormat());
date = sdf.parse(currDate.toString());
currDate = java.sql.Timestamp.valueOf(sdf.format(date).toString()+ " 00:00:00.0");
}
catch (Exception e)
{
throw new ITMException(e);
}
return (currDate);
}
private double checkDoubleNull(String str) {
if (str == null || str.trim().length() == 0) {
return 0.0;
} else {
return Double.parseDouble(str);
}
}
private double integralPartQty(double value) {
double fractionalPart = value % 1;
double integralPart = value - fractionalPart;
System.out.println(integralPart +" integralPart "+ fractionalPart);
return integralPart;
}
//added by nandkumar gadkari on 11/02/19------------------------end--------------------------------
}
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