Commit 257731bd authored by prane's avatar prane

Used Big decimal instead of double for amounts in getData() method and rounded by 3 decimal.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@194309 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6bd59d3b
...@@ -7,7 +7,7 @@ import java.util.*; ...@@ -7,7 +7,7 @@ import java.util.*;
import java.lang.*; import java.lang.*;
import javax.ejb.*; import javax.ejb.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import java.math.BigDecimal;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import java.util.HashMap; import java.util.HashMap;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -245,14 +245,21 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -245,14 +245,21 @@ Put a validation chq amount in filter and total of details matches in case heade
String chequeNo = ""; String chequeNo = "";
String reasDetail = ""; String reasDetail = "";
String groupCode = ""; String groupCode = "";
//Pavan R 11dec18[to use Big decimal instead of double]
double totAmt = 0.0; /*double totAmt = 0.0;
double balAmt = 0.0; double balAmt = 0.0;
double adjAmt = 0.0; double adjAmt = 0.0;
double adjustedAmt = 0.0; double adjustedAmt = 0.0;
double invAmt = 0.0; double invAmt = 0.0;
double chqAmount = 0.0; double chqAmount = 0.0;
double custRefAmt = 0.0; double custRefAmt = 0.0;*/
BigDecimal totAmt = new BigDecimal(0.0);
BigDecimal balAmt = new BigDecimal(0.0);
BigDecimal adjAmt = new BigDecimal(0.0);
BigDecimal adjustedAmt = new BigDecimal(0.0);
BigDecimal invAmt = new BigDecimal(0.0);
BigDecimal chqAmount = new BigDecimal(0.0);
BigDecimal custRefAmt = new BigDecimal(0.0);
Timestamp tranDate = null; Timestamp tranDate = null;
Timestamp chequeDate = null; Timestamp chequeDate = null;
...@@ -267,16 +274,21 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -267,16 +274,21 @@ Put a validation chq amount in filter and total of details matches in case heade
conn = getConnection(); conn = getConnection();
}*/ }*/
sdf=new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf=new SimpleDateFormat(genericUtility.getApplDateFormat());
DatabaseMetaData dbmd = conn.getMetaData(); //DatabaseMetaData dbmd = conn.getMetaData();
suggestAdj = genericUtility.getColumnValue("suggest_adj",headerDom);
if(suggestAdj == null || suggestAdj.trim().length() == 0 || "null".equals(suggestAdj))
{
suggestAdj = "N";
}
siteCode = genericUtility.getColumnValue("site_code",headerDom); siteCode = genericUtility.getColumnValue("site_code",headerDom);
System.out.println("siteCode------>"+ siteCode); System.out.println("siteCode------>"+ siteCode+"suggestAdj----->"+suggestAdj);
System.out.println("Serialize Dom["+genericUtility.serializeDom(headerDom)); System.out.println("Serialize Dom["+genericUtility.serializeDom(headerDom));
StringBuffer xmlBuffStr = new StringBuffer("<?xml version = \"1.0\"?>"); StringBuffer xmlBuffStr = new StringBuffer("<?xml version = \"1.0\"?>");
NodeList parentNodeList = headerDom.getElementsByTagName("Detail1"); NodeList parentNodeList = headerDom.getElementsByTagName("Detail1");
Node parentNode = parentNodeList.item(0); Node parentNode = parentNodeList.item(0);
objName = getObjName(parentNode); objName = getObjName(parentNode);
System.out.println("Inside getData ObjName::["+objName+"]");
if("generate_receipt_process".equals(objName)) if("generate_receipt_process".equals(objName))
{ {
xmlBuffStr.append("<DocumentRoot>"); xmlBuffStr.append("<DocumentRoot>");
...@@ -284,6 +296,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -284,6 +296,7 @@ Put a validation chq amount in filter and total of details matches in case heade
xmlBuffStr.append("<group0>"); xmlBuffStr.append("<group0>");
xmlBuffStr.append("<description>").append("Group0 description").append("</description>"); xmlBuffStr.append("<description>").append("Group0 description").append("</description>");
xmlBuffStr.append("<Header0>"); xmlBuffStr.append("<Header0>");
suggestAdj = "Y";
} }
if(siteCode == null || siteCode.trim().length() == 0) if(siteCode == null || siteCode.trim().length() == 0)
...@@ -382,7 +395,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -382,7 +395,7 @@ Put a validation chq amount in filter and total of details matches in case heade
dueDateTo = java.sql.Timestamp.valueOf(sdueDate + " 00:00:00"); dueDateTo = java.sql.Timestamp.valueOf(sdueDate + " 00:00:00");
System.out.println("Due Date **..........................**:"+dueDate); System.out.println("Due Date **..........................**:"+dueDate);
suggestAdj = genericUtility.getColumnValue("suggest_adj",headerDom); //suggestAdj = genericUtility.getColumnValue("suggest_adj",headerDom);
System.out.println("suggest_adj........["+suggestAdj+"]"); System.out.println("suggest_adj........["+suggestAdj+"]");
HashMap<String, ArrayList<ReceiptBean>> custGrpMap = new HashMap<String, ArrayList<ReceiptBean>>(); HashMap<String, ArrayList<ReceiptBean>> custGrpMap = new HashMap<String, ArrayList<ReceiptBean>>();
...@@ -417,22 +430,22 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -417,22 +430,22 @@ Put a validation chq amount in filter and total of details matches in case heade
tranSer = checkNull(rs.getString("TRAN_SER")); tranSer = checkNull(rs.getString("TRAN_SER"));
custRefNo = checkNull(rs.getString("CUST_REF_NO")); custRefNo = checkNull(rs.getString("CUST_REF_NO"));
tranDate = rs.getTimestamp("REF_DATE"); tranDate = rs.getTimestamp("REF_DATE");
totAmt = rs.getDouble("TOT_AMT"); totAmt = new BigDecimal(rs.getDouble("TOT_AMT"));//rs.getDouble("TOT_AMT");
balAmt = rs.getDouble(4); balAmt = new BigDecimal(rs.getDouble(4));//rs.getDouble(4);
adjAmt = rs.getDouble(4); adjAmt = new BigDecimal(rs.getDouble(4));//rs.getDouble(4);
adjustedAmt = rs.getDouble("ADJ_AMT"); adjustedAmt = new BigDecimal(rs.getDouble("ADJ_AMT"));//rs.getDouble("ADJ_AMT");
invAmt = rs.getDouble(4); invAmt = new BigDecimal(rs.getDouble(4));//rs.getDouble(4);
reasCode = checkNull(rs.getString("REAS_CODE")); reasCode = checkNull(rs.getString("REAS_CODE"));
custName = checkNull(rs.getString("CUST_NAME")); custName = checkNull(rs.getString("CUST_NAME"));
custCode = checkNull(rs.getString("CUST_CODE")); custCode = checkNull(rs.getString("CUST_CODE"));
bankCode = checkNull(rs.getString("BANK_CODE")); bankCode = checkNull(rs.getString("BANK_CODE"));
chequeDate = rs.getTimestamp("TRAN_DATE"); chequeDate = rs.getTimestamp("TRAN_DATE");
chequeNo = checkNull(rs.getString("CHEQUE_NO")); chequeNo = checkNull(rs.getString("CHEQUE_NO"));
chqAmount = rs.getDouble("CHQ_AMOUNT"); chqAmount = new BigDecimal(rs.getDouble("CHQ_AMOUNT"));//rs.getDouble("CHQ_AMOUNT");
custRefDate= rs.getTimestamp("CUST_REF_DATE"); custRefDate= rs.getTimestamp("CUST_REF_DATE");
dueDate = rs.getTimestamp("DUE_DATE"); dueDate = rs.getTimestamp("DUE_DATE");
reasDetail = checkNull(rs.getString("REAS_DETAIL")); reasDetail = checkNull(rs.getString("REAS_DETAIL"));
custRefAmt = rs.getDouble("CUST_REF_AMT"); custRefAmt = new BigDecimal(rs.getDouble("CUST_REF_AMT"));//rs.getDouble("CUST_REF_AMT");
//Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen. //Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.
groupCode = checkNull(rs.getString("GROUP_CODE")); groupCode = checkNull(rs.getString("GROUP_CODE"));
...@@ -495,11 +508,11 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -495,11 +508,11 @@ Put a validation chq amount in filter and total of details matches in case heade
System.out.println(sdf.format(rs.getTimestamp(3))); System.out.println(sdf.format(rs.getTimestamp(3)));
retTabSepStrBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>"); retTabSepStrBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>");
} }
retTabSepStrBuff.append("<tot_amt>").append("<![CDATA["+ totAmt +"]]>").append("</tot_amt>"); retTabSepStrBuff.append("<tot_amt>").append("<![CDATA["+ rounded(totAmt,3) +"]]>").append("</tot_amt>");
retTabSepStrBuff.append("<bal_amt>").append("<![CDATA[" +Math.abs(balAmt) +"]]>").append("</bal_amt>"); retTabSepStrBuff.append("<bal_amt>").append("<![CDATA[" +rounded(balAmt,3) +"]]>").append("</bal_amt>");
retTabSepStrBuff.append("<adj_amt>").append("<![CDATA[" + adjAmt +"]]>").append("</adj_amt>"); retTabSepStrBuff.append("<adj_amt>").append("<![CDATA[" + rounded(adjAmt,3) +"]]>").append("</adj_amt>");
retTabSepStrBuff.append("<adjusted_amt>").append("<![CDATA["+ adjustedAmt +"]]>").append("</adjusted_amt>"); retTabSepStrBuff.append("<adjusted_amt>").append("<![CDATA["+ rounded(adjustedAmt,3) +"]]>").append("</adjusted_amt>");
retTabSepStrBuff.append("<inv_amt>").append("<![CDATA[" + invAmt +"]]>").append("</inv_amt>"); retTabSepStrBuff.append("<inv_amt>").append("<![CDATA[" + rounded(invAmt,3) +"]]>").append("</inv_amt>");
if ( reasCode == null || reasCode.trim().length() == 0) if ( reasCode == null || reasCode.trim().length() == 0)
{ {
retTabSepStrBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>"); retTabSepStrBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>");
...@@ -521,7 +534,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -521,7 +534,7 @@ Put a validation chq amount in filter and total of details matches in case heade
}else{ }else{
retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +(chequeNo==null?" ":chequeNo.trim()) +"]]>").append("</cheque_no>"); retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +(chequeNo==null?" ":chequeNo.trim()) +"]]>").append("</cheque_no>");
} }
retTabSepStrBuff.append("<chq_amount>").append("<![CDATA["+chqAmount+"]]>").append("</chq_amount>"); retTabSepStrBuff.append("<chq_amount>").append("<![CDATA["+rounded(chqAmount,3)+"]]>").append("</chq_amount>");
if(custRefDate == null) if(custRefDate == null)
{ {
retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA[]]>").append("</cust_ref_date>"); retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA[]]>").append("</cust_ref_date>");
...@@ -540,7 +553,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -540,7 +553,7 @@ Put a validation chq amount in filter and total of details matches in case heade
}else{ }else{
retTabSepStrBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>"); retTabSepStrBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>");
} }
retTabSepStrBuff.append("<cust_ref_amt>").append("<![CDATA["+ custRefAmt +"]]>").append("</cust_ref_amt>"); retTabSepStrBuff.append("<cust_ref_amt>").append("<![CDATA["+ rounded(custRefAmt,3) +"]]>").append("</cust_ref_amt>");
retTabSepStrBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>"); retTabSepStrBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>");
retTabSepStrBuff.append("</Detail2>"); retTabSepStrBuff.append("</Detail2>");
...@@ -563,6 +576,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -563,6 +576,7 @@ Put a validation chq amount in filter and total of details matches in case heade
int gCnt = 1; int gCnt = 1;
for (ArrayList<ReceiptBean> templist : custGrpMap.values()) for (ArrayList<ReceiptBean> templist : custGrpMap.values())
{ {
BigDecimal tmpVal = new BigDecimal(-1);
System.out.println("Global dom count["+gCnt+"]"); System.out.println("Global dom count["+gCnt+"]");
selectedList = new ArrayList<ReceiptBean>(); selectedList = new ArrayList<ReceiptBean>();
Collections.sort(templist, ReceiptBean.receiptComparator); Collections.sort(templist, ReceiptBean.receiptComparator);
...@@ -570,7 +584,9 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -570,7 +584,9 @@ Put a validation chq amount in filter and total of details matches in case heade
ArrayList<ReceiptBean> posList = new ArrayList<ReceiptBean>(); ArrayList<ReceiptBean> posList = new ArrayList<ReceiptBean>();
ArrayList<ReceiptBean> negList = new ArrayList<ReceiptBean>(); ArrayList<ReceiptBean> negList = new ArrayList<ReceiptBean>();
System.out.println("^^^^^^^templist Size["+ templist.size() + "]^^^^^^^^^^"); System.out.println("^^^^^^^templist Size["+ templist.size() + "]^^^^^^^^^^");
double totNegAmt = 0.0, totPosAmt = 0.0; //double totNegAmt = 0.0, totPosAmt = 0.0;
BigDecimal totNegAmt = new BigDecimal(0.0);
BigDecimal totPosAmt = new BigDecimal(0.0);
// Storing Positive amounts List as posList // Storing Positive amounts List as posList
for (int i = 0; i < templist.size(); i++) { for (int i = 0; i < templist.size(); i++) {
...@@ -580,9 +596,11 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -580,9 +596,11 @@ Put a validation chq amount in filter and total of details matches in case heade
adjAmt = rcpBean.getAdjAmt(); adjAmt = rcpBean.getAdjAmt();
adjustedAmt = rcpBean.getAdjustedAmt(); adjustedAmt = rcpBean.getAdjustedAmt();
invAmt = rcpBean.getInvAmt(); invAmt = rcpBean.getInvAmt();
if (balAmt > 0) //if (balAmt > 0)
if ((balAmt.compareTo(BigDecimal.ZERO) == 1))
{ {
totPosAmt = totPosAmt + balAmt; //totPosAmt = totPosAmt + balAmt;
totPosAmt = totPosAmt.add(balAmt);
posList.add(rcpBean); posList.add(rcpBean);
} }
} }
...@@ -594,16 +612,19 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -594,16 +612,19 @@ Put a validation chq amount in filter and total of details matches in case heade
adjAmt = rcpBean.getAdjAmt(); adjAmt = rcpBean.getAdjAmt();
adjustedAmt = rcpBean.getAdjustedAmt(); adjustedAmt = rcpBean.getAdjustedAmt();
invAmt = rcpBean.getInvAmt(); invAmt = rcpBean.getInvAmt();
if (balAmt < 0) //if (balAmt < 0)
if ((balAmt.compareTo(BigDecimal.ZERO) == -1))
{ {
totNegAmt = getRequiredDecimal(totNegAmt, 3) + balAmt; //totNegAmt = getRequiredDecimal(totNegAmt, 3) + balAmt;
totNegAmt = rounded(totNegAmt.add(balAmt),3);
negList.add(rcpBean); negList.add(rcpBean);
} }
} }
System.out.println("***Total Amount Positive[" + totPosAmt + "]Negative[" + totNegAmt + "]"); System.out.println("***Total Amount Positive[" + totPosAmt + "]Negative[" + totNegAmt + "]");
System.out.println("****POSListSize[" + posList.size()+ "]****NEGListSize[" + negList.size() + "]"); System.out.println("****POSListSize[" + posList.size()+ "]****NEGListSize[" + negList.size() + "]");
// If positive Amt is greater than negative // If positive Amt is greater than negative
if (totPosAmt > totNegAmt*(-1)) //if (totPosAmt > totNegAmt*(-1))
if (totPosAmt.compareTo(totNegAmt.multiply(tmpVal)) == 1)
{ {
System.out.println("544::totNegAmt["+totNegAmt+"]"); System.out.println("544::totNegAmt["+totNegAmt+"]");
// If positive Amt is greater then select all negative and match and select value with positive // If positive Amt is greater then select all negative and match and select value with positive
...@@ -616,26 +637,33 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -616,26 +637,33 @@ Put a validation chq amount in filter and total of details matches in case heade
for (int i = 0; i < posList.size(); i++) for (int i = 0; i < posList.size(); i++)
{ {
ReceiptBean posBean = posList.get(i); ReceiptBean posBean = posList.get(i);
double balsAmt = posBean.getBalAmt(); //double balsAmt = posBean.getBalAmt();
double temp = totNegAmt; BigDecimal balsAmt = posBean.getBalAmt();
totNegAmt = getRequiredDecimal(totNegAmt,3) + balsAmt; //double temp = totNegAmt;
BigDecimal temp = totNegAmt;
//totNegAmt = getRequiredDecimal(totNegAmt,3) + balsAmt;
totNegAmt = rounded(totNegAmt.add(balsAmt),3);
System.out.println("555::totNegAmt["+totNegAmt+"]balsAmt["+balsAmt+"]cnt["+i+"]"); System.out.println("555::totNegAmt["+totNegAmt+"]balsAmt["+balsAmt+"]cnt["+i+"]");
posBean.setIsSelected("Y"); posBean.setIsSelected("Y");
posList.set(i, posBean); posList.set(i, posBean);
if (totNegAmt > 0) //to updated the to be adjusted amt //if (totNegAmt > 0) //to updated the to be adjusted amt
if ((totNegAmt.compareTo(BigDecimal.ZERO) == 1))
{ {
System.out.println("before break...totPosAmt::"+totNegAmt); System.out.println("before break...totPosAmt::"+totNegAmt);
ReceiptBean posBean2 = posList.get(i); ReceiptBean posBean2 = posList.get(i);
posBean2.setAdjAmt(temp*(-1)); //posBean2.setAdjAmt(temp*(-1));
posBean2.setAdjAmt(temp.multiply(tmpVal));
posList.set(i, posBean2); posList.set(i, posBean2);
break; break;
}else if (totNegAmt == 0){ }//else if (totNegAmt == 0){
else if (totNegAmt.compareTo(BigDecimal.ZERO) == 0){
System.out.println("only break....!!!"); System.out.println("only break....!!!");
break; break;
} }
} }
} // If negative Amt is greater than positive } // If negative Amt is greater than positive
else if (totNegAmt*(-1) >= totPosAmt) //else if (totNegAmt*(-1) >= totPosAmt)
else if ((totNegAmt.multiply(tmpVal)).compareTo(totPosAmt) == 1 || (totNegAmt.multiply(tmpVal)).compareTo(totPosAmt) == 0)
{ {
// If negative Amt is greater then select all positive and match and select value with negative // If negative Amt is greater then select all positive and match and select value with negative
for (int i = 0; i < posList.size(); i++) for (int i = 0; i < posList.size(); i++)
...@@ -647,20 +675,24 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -647,20 +675,24 @@ Put a validation chq amount in filter and total of details matches in case heade
for (int i = 0; i < negList.size(); i++) for (int i = 0; i < negList.size(); i++)
{ {
ReceiptBean negBean = negList.get(i); ReceiptBean negBean = negList.get(i);
double balsAmt = negBean.getBalAmt(); //double balsAmt = negBean.getBalAmt();
double temp = totPosAmt; BigDecimal balsAmt = negBean.getBalAmt();
totPosAmt = getRequiredDecimal(totPosAmt, 3) + balsAmt; //double temp = totPosAmt;
BigDecimal temp = totPosAmt;
//totPosAmt = getRequiredDecimal(totPosAmt, 3) + balsAmt;
totPosAmt = rounded(totPosAmt.add(balsAmt),3);
System.out.println("589::totNegAmt["+totPosAmt+"]Negative amt["+balsAmt+"]cnt["+i+"]"); System.out.println("589::totNegAmt["+totPosAmt+"]Negative amt["+balsAmt+"]cnt["+i+"]");
negBean.setIsSelected("Y"); negBean.setIsSelected("Y");
negList.set(i, negBean); negList.set(i, negBean);
if (totPosAmt < 0) //to updated the to be adjusted amt //if (totPosAmt < 0) //to updated the to be adjusted amt
if (totPosAmt.compareTo(BigDecimal.ZERO)== -1)
{ {
System.out.println("before break...totPosAmt::"+totPosAmt); System.out.println("before break...totPosAmt::"+totPosAmt);
ReceiptBean negBean2 = negList.get(i); ReceiptBean negBean2 = negList.get(i);
negBean2.setAdjAmt(temp*(-1)); negBean2.setAdjAmt(temp.multiply(tmpVal));
negList.set(i, negBean2); negList.set(i, negBean2);
break; break;
}else if(totPosAmt == 0) }else if(totPosAmt.compareTo(BigDecimal.ZERO) == 0)
{ {
System.out.println("only break..."); System.out.println("only break...");
break; break;
...@@ -3036,14 +3068,22 @@ conn = getConnection(); ...@@ -3036,14 +3068,22 @@ conn = getConnection();
String reasDetail = ""; String reasDetail = "";
String groupCode = ""; String groupCode = "";
String filterChqNo = ""; String filterChqNo = "";
double totAmt = 0.0; /*double totAmt = 0.0;
double balAmt = 0.0; double balAmt = 0.0;
double adjAmt = 0.0; double adjAmt = 0.0;
double adjustedAmt = 0.0; double adjustedAmt = 0.0;
double invAmt = 0.0; double invAmt = 0.0;
double chqAmount = 0.0; double chqAmount = 0.0;
double custRefAmt = 0.0; double custRefAmt = 0.0;
double totAmount = 0.0; double totAmount = 0.0;*/
BigDecimal totAmt = new BigDecimal(0.0);
BigDecimal balAmt = new BigDecimal(0.0);
BigDecimal adjAmt = new BigDecimal(0.0);
BigDecimal adjustedAmt = new BigDecimal(0.0);
BigDecimal invAmt = new BigDecimal(0.0);
BigDecimal chqAmount = new BigDecimal(0.0);
BigDecimal custRefAmt = new BigDecimal(0.0);
BigDecimal totAmount = new BigDecimal(0.0);
Timestamp tranDate = null; Timestamp tranDate = null;
Timestamp chequeDate = null; Timestamp chequeDate = null;
...@@ -3095,11 +3135,12 @@ conn = getConnection(); ...@@ -3095,11 +3135,12 @@ conn = getConnection();
}else{ }else{
xmlBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>"); xmlBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>");
} }
xmlBuff.append("<tot_amt>").append("<![CDATA["+ totAmt +"]]>").append("</tot_amt>"); xmlBuff.append("<tot_amt>").append("<![CDATA["+ rounded(totAmt,3) +"]]>").append("</tot_amt>");
xmlBuff.append("<bal_amt>").append("<![CDATA[" +Math.abs(balAmt) +"]]>").append("</bal_amt>"); //xmlBuff.append("<bal_amt>").append("<![CDATA[" +Math.abs(balAmt) +"]]>").append("</bal_amt>");
xmlBuff.append("<adj_amt>").append("<![CDATA[" + adjAmt +"]]>").append("</adj_amt>"); xmlBuff.append("<bal_amt>").append("<![CDATA[" +rounded(balAmt,3) +"]]>").append("</bal_amt>");
xmlBuff.append("<adjusted_amt>").append("<![CDATA["+ adjustedAmt +"]]>").append("</adjusted_amt>"); xmlBuff.append("<adj_amt>").append("<![CDATA[" + rounded(adjAmt,3) +"]]>").append("</adj_amt>");
xmlBuff.append("<inv_amt>").append("<![CDATA[" + invAmt +"]]>").append("</inv_amt>"); xmlBuff.append("<adjusted_amt>").append("<![CDATA["+ rounded(adjustedAmt,3) +"]]>").append("</adjusted_amt>");
xmlBuff.append("<inv_amt>").append("<![CDATA[" + rounded(invAmt,3) +"]]>").append("</inv_amt>");
if ( reasCode == null || reasCode.trim().length() == 0) if ( reasCode == null || reasCode.trim().length() == 0)
{ {
xmlBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>"); xmlBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>");
...@@ -3141,7 +3182,7 @@ conn = getConnection(); ...@@ -3141,7 +3182,7 @@ conn = getConnection();
}else{ }else{
xmlBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>"); xmlBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>");
} }
xmlBuff.append("<cust_ref_amt>").append("<![CDATA["+ custRefAmt +"]]>").append("</cust_ref_amt>"); xmlBuff.append("<cust_ref_amt>").append("<![CDATA["+ rounded(custRefAmt,3) +"]]>").append("</cust_ref_amt>");
xmlBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>"); xmlBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>");
xmlBuff.append("</Detail2>"); xmlBuff.append("</Detail2>");
}catch (SQLException se) }catch (SQLException se)
...@@ -3180,6 +3221,10 @@ conn = getConnection(); ...@@ -3180,6 +3221,10 @@ conn = getConnection();
} }
//Pavan R on 24MAY18 End //Pavan R on 24MAY18 End
public static BigDecimal rounded(BigDecimal aNumber, int prec)
{
return aNumber.setScale(prec, BigDecimal.ROUND_HALF_EVEN);
}
}//class }//class
...@@ -3193,25 +3238,36 @@ class ReceiptBean ...@@ -3193,25 +3238,36 @@ class ReceiptBean
private String tranSer = ""; private String tranSer = "";
private String custRefNo = ""; private String custRefNo = "";
private Timestamp tranDate = null; private Timestamp tranDate = null;
private double totAmt = 0; /*private double totAmt = 0;
private double balAmt = 0; private double balAmt = 0;
private double adjAmt = 0; private double adjAmt = 0;
private double adjustedAmt = 0; private double adjustedAmt = 0;
private double invAmt = 0; private double invAmt = 0;*/
private String reasCode = ""; private String reasCode = "";
private String custName = ""; private String custName = "";
private String custCode = ""; private String custCode = "";
private String bankCode = ""; private String bankCode = "";
private Timestamp chequeDate = null; private Timestamp chequeDate = null;
private String chequeNo = ""; private String chequeNo = "";
private double chqAmount = 0; //private double chqAmount = 0;
private Timestamp custRefDate = null; private Timestamp custRefDate = null;
private Timestamp dueDate = null; private Timestamp dueDate = null;
private String reasDetail = ""; private String reasDetail = "";
private double custRefAmt = 0; //private double custRefAmt = 0;
private double runningTotal = 0; //private double runningTotal = 0;
private String isSelected = ""; private String isSelected = "";
private int domId = 0; private int domId = 0;
private BigDecimal totAmt = new BigDecimal(0.0);
private BigDecimal balAmt = new BigDecimal(0.0);
private BigDecimal adjAmt = new BigDecimal(0.0);
private BigDecimal adjustedAmt = new BigDecimal(0.0);
private BigDecimal invAmt = new BigDecimal(0.0);
private BigDecimal chqAmount = new BigDecimal(0.0);
private BigDecimal custRefAmt = new BigDecimal(0.0);
private BigDecimal runningTotal = new BigDecimal(0.0);
public String getInvoiceId() { public String getInvoiceId() {
return invoiceId; return invoiceId;
} }
...@@ -3236,7 +3292,7 @@ class ReceiptBean ...@@ -3236,7 +3292,7 @@ class ReceiptBean
public void setTranDate(Timestamp tranDate) { public void setTranDate(Timestamp tranDate) {
this.tranDate = tranDate; this.tranDate = tranDate;
} }
public double getTotAmt() { /*public double getTotAmt() {
return totAmt; return totAmt;
} }
public void setTotAmt(double totAmt) { public void setTotAmt(double totAmt) {
...@@ -3265,7 +3321,7 @@ class ReceiptBean ...@@ -3265,7 +3321,7 @@ class ReceiptBean
} }
public void setInvAmt(double invAmt) { public void setInvAmt(double invAmt) {
this.invAmt = invAmt; this.invAmt = invAmt;
} }*/
public String getReasCode() { public String getReasCode() {
return reasCode; return reasCode;
} }
...@@ -3302,12 +3358,12 @@ class ReceiptBean ...@@ -3302,12 +3358,12 @@ class ReceiptBean
public void setChequeNo(String chequeNo) { public void setChequeNo(String chequeNo) {
this.chequeNo = chequeNo; this.chequeNo = chequeNo;
} }
public double getChqAmount() { /*public double getChqAmount() {
return chqAmount; return chqAmount;
} }
public void setChqAmount(double chqAmount) { public void setChqAmount(double chqAmount) {
this.chqAmount = chqAmount; this.chqAmount = chqAmount;
} }*/
public Timestamp getCustRefDate() { public Timestamp getCustRefDate() {
return custRefDate; return custRefDate;
} }
...@@ -3326,7 +3382,7 @@ class ReceiptBean ...@@ -3326,7 +3382,7 @@ class ReceiptBean
public void setReasDetail(String reasDetail) { public void setReasDetail(String reasDetail) {
this.reasDetail = reasDetail; this.reasDetail = reasDetail;
} }
public double getCustRefAmt() { /*public double getCustRefAmt() {
return custRefAmt; return custRefAmt;
} }
public void setCustRefAmt(double custRefAmt) { public void setCustRefAmt(double custRefAmt) {
...@@ -3338,7 +3394,7 @@ class ReceiptBean ...@@ -3338,7 +3394,7 @@ class ReceiptBean
} }
public void setRunningTotal(double runningTotal) { public void setRunningTotal(double runningTotal) {
this.runningTotal = runningTotal; this.runningTotal = runningTotal;
} }*/
public String getIsSelected() { public String getIsSelected() {
return isSelected; return isSelected;
} }
...@@ -3351,6 +3407,55 @@ class ReceiptBean ...@@ -3351,6 +3407,55 @@ class ReceiptBean
public void setDomId(int domId) { public void setDomId(int domId) {
this.domId = domId; this.domId = domId;
} }
public BigDecimal getTotAmt() {
return totAmt;
}
public void setTotAmt(BigDecimal totAmt) {
this.totAmt = totAmt;
}
public BigDecimal getBalAmt() {
return balAmt;
}
public void setBalAmt(BigDecimal balAmt) {
this.balAmt = balAmt;
}
public BigDecimal getAdjAmt() {
return adjAmt;
}
public void setAdjAmt(BigDecimal adjAmt) {
this.adjAmt = adjAmt;
}
public BigDecimal getAdjustedAmt() {
return adjustedAmt;
}
public void setAdjustedAmt(BigDecimal adjustedAmt) {
this.adjustedAmt = adjustedAmt;
}
public BigDecimal getInvAmt() {
return invAmt;
}
public void setInvAmt(BigDecimal invAmt) {
this.invAmt = invAmt;
}
public BigDecimal getChqAmount() {
return chqAmount;
}
public void setChqAmount(BigDecimal chqAmount) {
this.chqAmount = chqAmount;
}
public BigDecimal getCustRefAmt() {
return custRefAmt;
}
public void setCustRefAmt(BigDecimal custRefAmt) {
this.custRefAmt = custRefAmt;
}
public BigDecimal getRunningTotal() {
return runningTotal;
}
public void setRunningTotal(BigDecimal runningTotal) {
this.runningTotal = runningTotal;
}
public static Comparator<ReceiptBean> receiptComparator = new Comparator<ReceiptBean>() { public static Comparator<ReceiptBean> receiptComparator = new Comparator<ReceiptBean>() {
public int compare(ReceiptBean rcpBean1, ReceiptBean rcpBean2) public int compare(ReceiptBean rcpBean1, ReceiptBean rcpBean2)
......
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