Commit cd0dfb06 authored by caluka's avatar caluka

closing value opening value change to required decimal


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@38530 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a704f3c1
......@@ -3503,7 +3503,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rcpQtyList = GetRcpQtyCommon("R",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
receiptLast=rcpQtyList.get(0);
//receiptRate=rcpQtyList.get(1);
rcpquantityRate=rcpQtyList.get(1);
rcpquantityRate=getRequiredDcml(rcpQtyList.get(1),2);
//System.out.println("receiptRate@@@@@@@@@>>>>>>"+receiptRate);
//receiptAmount=receiptLast*receiptRate;
......@@ -3514,7 +3514,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rcpFreesLast=0.0;
rcpFreeQtyList = GetFreeQtyCommon("R",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
rcpFreesLast=rcpFreeQtyList.get(0);
rcpFreesValue=rcpFreeQtyList.get(1);
rcpFreesValue=getRequiredDcml(rcpFreeQtyList.get(1),2);
System.out.println("rcpFreesLast :"+rcpFreesLast);
//rcpFreesAmount=rcpFreesLast*receiptRate;
//System.out.println("rcpFreesAmount :"+rcpFreesAmount);
......@@ -3543,7 +3543,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyList=null;
transitQtyList=GetRcpQtyCommon("T",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQty=transitQtyList.get(0);
transitQuantityRate=rcpQtyList.get(1);
transitQuantityRate=getRequiredDcml(rcpQtyList.get(1),2);
System.out.println("transitQty quantity cal for avaible transcation id :"+transitQty);
System.out.println("receiptLast :"+receiptLast);
......@@ -3554,7 +3554,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyFreesLast=0.0;
transitFreeQtyList=GetFreeQtyCommon("T",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQtyFreesLast=transitFreeQtyList.get(0);
transitFreeValue=transitFreeQtyList.get(1);
transitFreeValue=getRequiredDcml(transitFreeQtyList.get(1),2);
System.out.println("transitQtyFreesLast :"+transitQtyFreesLast);
transitCharQty=0.0;
......@@ -3571,7 +3571,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
cmrcpQtyList = GetRcpQtyCM("R",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("cmrcpQtyList>>>>>>>"+cmrcpQtyList+"iTEMcODE@@@@@@"+itemCode);
cmQuantity=cmrcpQtyList.get(0);
cmValue=cmrcpQtyList.get(1);
cmValue=getRequiredDcml(cmrcpQtyList.get(1),2);
descrLast="";
......@@ -3890,7 +3890,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyList=null;
transitQtyList = GetRcpQtyCommon("T",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQtyAll=transitQtyList.get(0);
transitQuantityRate=rcpQtyList.get(1);
transitQuantityRate=getRequiredDcml(rcpQtyList.get(1),2);
//transitQtyRate=transitQtyList.get(1);
System.out.println("transitQtyAll@@@@@@@"+transitQtyAll+">>>>>>"+itemSerHd);
System.out.println("transitQtyRate@@@@@@@"+transitQtyRate);
......@@ -3901,7 +3901,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitFreeQtyList=null;
transitFreeQtyList = GetFreeQtyCommon("T",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQtyFrees=transitFreeQtyList.get(0);
transitFreeValue=transitFreeQtyList.get(1);
transitFreeValue=getRequiredDcml(transitFreeQtyList.get(1),2);
System.out.println("transitQtyFrees :"+transitQtyFrees);
transitCharQtyAll = 0.0;
......@@ -3912,7 +3912,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
cmrcpQtyList = GetRcpQtyCM("R",custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,transitInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("cmrcpQtyList>>>>>>>"+cmrcpQtyList+"iTEMcODE@@@@@@"+itemCode);
cmQuantity=cmrcpQtyList.get(0);
cmValue=cmrcpQtyList.get(1);
cmValue=getRequiredDcml(cmrcpQtyList.get(1),2);
/*
rateAll=0.0;
......@@ -4073,8 +4073,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<sret_vale>").append("<![CDATA["+getRequiredDecimal(Double.parseDouble(itemMap.get("sretValue@"+itemDomId).toString()),3)+"]]>").append("</sret_vale>");
valueXmlString.append("<pur_value>").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("rcpValue@"+itemDomId).toString()))+"]]>").append("</pur_value>");
openingValue=(long)Math.round((Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))*(Double.parseDouble(itemMap.get("oldRate@"+itemDomId).toString())));
salesValueCal=openingValue+Double.parseDouble(itemMap.get("rcpValue@"+itemDomId).toString())+Double.parseDouble(itemMap.get("replValue@"+itemDomId).toString())-Double.parseDouble(itemMap.get("sretValue@"+itemDomId).toString());
openingValue=getRequiredDcml((Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))*(Double.parseDouble(itemMap.get("oldRate@"+itemDomId).toString())),2);
System.out.println("net secondary salesopeningValue>>>>>>"+openingValue);
salesValueCal=openingValue+Double.parseDouble(itemMap.get("rcpValue@"+itemDomId).toString())
+ Double.parseDouble(itemMap.get("replValue@"+itemDomId).toString())
- Double.parseDouble(itemMap.get("sretValue@"+itemDomId).toString());
valueXmlString.append("<op_value>").append("<![CDATA["+getRequiredDecimal(openingValue, 2)+"]]>").append("</op_value>");
valueXmlString.append("<sales_value>").append("<![CDATA["+ getRequiredDecimal(salesValueCal,2)+"]]>").append("</sales_value>");
valueXmlString.append("<cl_value>").append("<![CDATA[0]]>").append("</cl_value>");
......@@ -4097,7 +4100,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("repl value>>>>>>"+Double.parseDouble(itemMap.get("replValue@"+itemDomId).toString()));
System.out.println("free value>>>>>>"+Double.parseDouble(itemMap.get("freeValue@"+itemDomId).toString()));
System.out.println("sret value>>>>>>"+Double.parseDouble(itemMap.get("sretValue@"+itemDomId).toString()));
grosSalesValueCal=(long)Math.round(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString())*Double.parseDouble(itemMap.get("oldRateOrg@"+itemDomId).toString()))
grosSalesValueCal= getRequiredDcml(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString())*Double.parseDouble(itemMap.get("oldRateOrg@"+itemDomId).toString()),2)
+Double.parseDouble(itemMap.get("rcpValue@"+itemDomId).toString())
+Double.parseDouble(itemMap.get("replValue@"+itemDomId).toString())
+Double.parseDouble(itemMap.get("freeValue@"+itemDomId).toString())
......@@ -4159,7 +4162,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
secondarySales = Double.parseDouble(genericUtility.getColumnValue("sales",dom));
System.out.println("SECONDARYsales :"+secondarySales);
String itemSer1 = genericUtility.getColumnValue("item_ser",dom);
String itemSerIC = genericUtility.getColumnValue("item_ser",dom);
rateOld = Double.parseDouble(genericUtility.getColumnValue("rate_old",dom));
......@@ -4287,12 +4290,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
sql = "SELECT inv.invoice_id,itrc.rate__stduom as rate__stduom,itrc.quantity__stduom as ,itrc.quantity__stduom,inv.tran_date " +
"FROM invoice_trace itrc,invoice inv WHERE itrc.item_code=? " +
"and itrc.invoice_id=inv.invoice_id and inv.tran_date>=? " +
"and inv.tran_date<=? AND itrc.rate__stduom >0 ORDER BY inv.tran_date DESC";
"and inv.tran_date<=? AND itrc.rate__stduom >0 and inv.cust_code=? " +
" ORDER BY inv.tran_date DESC";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode1);
//pstmt.setTimestamp(2,thirdMonthFrDt);
pstmt.setTimestamp(2,thirdMonthDay);
pstmt.setTimestamp(3,prdtoDateTmstmp);
pstmt.setString(4, custCodeStatic );
rs = pstmt.executeQuery( );
while( rs.next() )
{
......@@ -4341,7 +4346,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
closingValue=closingValue+formulaValue*rateAll;
}
if(clStock>0)
{
closingRate=closingValue/clStock;
}else
{
closingRate=0.0;
}
System.out.println("closingRate@@@@@@@@@"+closingRate);
grossSecondaryQty=opStkDom+rcpQtmDom+rcpReplQtmDom+rcpFreeQtmDom-retQtyDom-clStock;
......@@ -4373,7 +4384,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
closingValue=closingRate*clStock;
System.out.println("closingValue>>>>>>>"+closingValue);*/
//grossClosingValue=grossClosingRate*clStock;
netSecondarySalesValue=Math.round(opStkDom*rateOld)+rcpValue+replValue-retValue-closingValue;
netSecondarySalesValue=(opStkDom*rateOld)+rcpValue+replValue-retValue-closingValue;
System.out.println("netSecondarySalesValue>>>>>>>"+netSecondarySalesValue);
/*secondaryQty=opStkDom+rcpQtmDom+rcpReplQtmDom-retQtyDom-clStock;
......@@ -4381,13 +4392,19 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
netSecondaryRate=netSecondarySalesValue/secondaryQty;
System.out.println("netSecondaryRate>>>"+netSecondaryRate);*/
grossSecondarySalesValue=Math.round(opStkDom*rateOrgOld)+rcpValue+replValue+rcpFreeValue-retValue-closingValue;
grossSecondarySalesValue=(opStkDom*rateOrgOld)+rcpValue+replValue+rcpFreeValue-retValue-closingValue;
System.out.println("rcpFreeValue>>>>"+rcpFreeValue);
System.out.println("grossSecondarySalesValue>>>>"+grossSecondarySalesValue);
System.out.println("grossSecondaryQty>>>>"+grossSecondaryQty);
/*grossSecondaryQty=opStkDom+rcpQtmDom+rcpReplQtmDom+rcpFreeQtmDom-retQtyDom-clStock;
System.out.println("grossSecondaryQty>>>>"+grossSecondaryQty);*/
grossSecondaryRate=grossSecondarySalesValue/grossSecondaryQty;
if(grossSecondaryQty>0)
{
grossSecondaryRate = grossSecondarySalesValue / grossSecondaryQty;
}else
{
grossSecondaryRate=0.0;
}
System.out.println("grossSecondaryRate>>>"+grossSecondaryRate);
//End by chandrashekar on 29-dec-2015
salesQtyCal = opStkDom + (rcpQtmDom + rcpReplQtmDom) - (retQtyDom + retQtyFreeDom) - clStock;
......@@ -4425,15 +4442,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
if(!Double.isNaN(closingValue))
{
valueXmlString.append("<cl_value>").append("<![CDATA[" + (long) Math.round(closingValue) + "]]>").append("</cl_value>");
valueXmlString.append("<cl_value>").append("<![CDATA[" + getRequiredDcml(closingValue,2) + "]]>").append("</cl_value>");
}
if(!Double.isNaN(netSecondarySalesValue))
{
valueXmlString.append("<sales_value>").append("<![CDATA[" + (long) Math.round(netSecondarySalesValue) + "]]>").append("</sales_value>");
valueXmlString.append("<sales_value>").append("<![CDATA[" + getRequiredDcml(netSecondarySalesValue,2) + "]]>").append("</sales_value>");
}
if(!Double.isNaN(opStkDom*rateOld))
{
valueXmlString.append("<op_value>").append("<![CDATA[" + (long) Math.round(opStkDom*rateOld) + "]]>").append("</op_value>");
valueXmlString.append("<op_value>").append("<![CDATA[" + getRequiredDcml((opStkDom*rateOld),2) + "]]>").append("</op_value>");
}
valueXmlString.append("</Detail3>\r\n");
......@@ -8249,5 +8266,24 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
System.out.println("isItemFound>>>>>"+isItemFound);
return isItemFound;
}
public double getRequiredDcml(double actVal, int prec)
{
double value=0.0;
String fmtStr = "############0";
String strValue = null;
if (prec > 0)
{
fmtStr = fmtStr + "." + "000000000".substring(0, prec);
}
DecimalFormat decFormat = new DecimalFormat(fmtStr);
if(decFormat.format(actVal) != null && decFormat.format(actVal).trim().length() > 0 )
{
value=Double.parseDouble(decFormat.format(actVal));
}else
{
value=0.00;
}
return value;
}
}
\ No newline at end of file
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