Commit 36848e42 authored by prane's avatar prane

[F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@185449 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ad5ca2a1
...@@ -49,12 +49,13 @@ public class GenerateReceiptPrc extends ProcessEJB implements GenerateReceiptPrc ...@@ -49,12 +49,13 @@ public class GenerateReceiptPrc extends ProcessEJB implements GenerateReceiptPrc
String custCode = ""; String custCode = "";
String sdueDate = ""; String sdueDate = "";
String remarks = ""; String remarks = "";
String suggestAdj="";
java.sql.Timestamp dueDate = null; java.sql.Timestamp dueDate = null;
ArrayList invoiceList = new ArrayList(); ArrayList invoiceList = new ArrayList();
boolean amtFlag = true; boolean amtFlag = true;
PreparedStatement pstmt = null; PreparedStatement pstmt = null,pstmt1 = null;
Connection conn = null; Connection conn = null;
ResultSet rs = null; ResultSet rs = null,rs1 = null;
String bankCode=""; String bankCode="";
int cntHdr = 0; int cntHdr = 0;
...@@ -163,7 +164,7 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -163,7 +164,7 @@ Put a validation chq amount in filter and total of details matches in case heade
*/ */
//StringBuffer retTabSepStrBuff = new StringBuffer();
StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>"); StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>");
retTabSepStrBuff.append("<DocumentRoot>"); retTabSepStrBuff.append("<DocumentRoot>");
retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>"); retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>");
...@@ -171,36 +172,56 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -171,36 +172,56 @@ Put a validation chq amount in filter and total of details matches in case heade
retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>"); retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>");
retTabSepStrBuff.append("<Header0>"); retTabSepStrBuff.append("<Header0>");
StringBuffer xmlBuff = new StringBuffer("<?xml version = \"1.0\"?>");
xmlBuff.append("<DocumentRoot>");
xmlBuff.append("<description>").append("Datawindow Root").append("</description>");
xmlBuff.append("<group0>");
xmlBuff.append("<description>").append("Group0 description").append("</description>");
xmlBuff.append("<Header0>");
java.sql.Date currDate = new java.sql.Date(System.currentTimeMillis()); java.sql.Date currDate = new java.sql.Date(System.currentTimeMillis());
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
String errString = ""; String errString = "";
String resultString = "", filterChqNo = "", sFilterChqAmt = "", sFilterChqDate = ""; String resultString = "", filterChqNo = "", sFilterChqAmt = "", sFilterChqDate = "";
java.sql.Timestamp dueDateTo = null; java.sql.Timestamp dueDateTo = null;
//String tranSer2 = "";
SimpleDateFormat sdf=null; SimpleDateFormat sdf=null;
String invoiceId = "";
String tranSer = "";
String custRefNo = "";
String reasCode = "";
String custName = "";
String custCode = "";
String bankCode = "";
String chequeNo = "";
String reasDetail = "";
String groupCode = "";
double totAmt = 0.0;
double balAmt = 0.0;
double adjAmt = 0.0;
double adjustedAmt = 0.0;
double invAmt = 0.0;
double chqAmount = 0.0;
double custRefAmt = 0.0;
Timestamp tranDate = null;
Timestamp chequeDate = null;
Timestamp custRefDate= null;
Timestamp dueDate = null;
try try
{ {
if(conn==null) if(conn==null)
{ {
ConnDriver connDriver = new ConnDriver(); conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
} }
sdf=new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf=new SimpleDateFormat(genericUtility.getApplDateFormat());
DatabaseMetaData dbmd = conn.getMetaData(); DatabaseMetaData dbmd = conn.getMetaData();
/*Commented by Manoj dtd 03/05/2014
writeLog(filePtr,"DriverName["+dbmd.getDriverName() + "]",true);
writeLog(filePtr,"DriverURI["+dbmd.getURL() + "]",true);
writeLog(filePtr,"DriverUSER["+dbmd.getUserName() + "]",true);
writeLog(filePtr,"ApplDateFormat["+genericUtility.getApplDateFormat() + "]",true);
writeLog(filePtr,"DBDateFormat["+genericUtility.getDBDateFormat() + "]",true);
*/
siteCode = genericUtility.getColumnValue("site_code",headerDom); siteCode = genericUtility.getColumnValue("site_code",headerDom);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"siteCode:::"+siteCode,true);
System.out.println("siteCode------>"+ siteCode); System.out.println("siteCode------>"+ siteCode);
if(siteCode == null || siteCode.trim().length() == 0) if(siteCode == null || siteCode.trim().length() == 0)
...@@ -224,7 +245,6 @@ conn = getConnection(); ...@@ -224,7 +245,6 @@ conn = getConnection();
} }
if(count == 0) if(count == 0)
{ {
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"siteCode NOT founds in siteMaster:::",true);
errCode = "VMSITE1"; errCode = "VMSITE1";
errString = itmDBAccessEJB.getErrorString("site_code",errCode,userId,"",conn); errString = itmDBAccessEJB.getErrorString("site_code",errCode,userId,"",conn);
return errString; return errString;
...@@ -258,12 +278,8 @@ conn = getConnection(); ...@@ -258,12 +278,8 @@ conn = getConnection();
{ {
sFilterChqDate = ""; sFilterChqDate = "";
} }
//custCode = genericUtility.getColumnValue("cust_code",headerDom);
//System.out.println("custCode is :::"+custCode);
System.out.println("cust_code__from is :::"+custCodeFrom); System.out.println("cust_code__from is :::"+custCodeFrom);
System.out.println("cust_code__to is :::"+custCodeTo); System.out.println("cust_code__to is :::"+custCodeTo);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"cust_code__from:::"+custCodeFrom,true);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"cust_code__to:::"+custCodeTo,true);
if(custCodeFrom == null || custCodeFrom.trim().length() ==0) //ADDED BY RAJESH K TO CHECK CUSTCODEFROM AND CUSTCODETO if(custCodeFrom == null || custCodeFrom.trim().length() ==0) //ADDED BY RAJESH K TO CHECK CUSTCODEFROM AND CUSTCODETO
{ {
...@@ -276,14 +292,6 @@ conn = getConnection(); ...@@ -276,14 +292,6 @@ conn = getConnection();
return errString; return errString;
} }
/*writeLog(filePtr,"custCode:::"+custCode,true);
if(custCode == null || custCode.trim().length() ==0)
{
errString = itmDBAccessEJB.getErrorString("","VTMSG","","",conn);
return errString;
}*/
sdueDate = genericUtility.getColumnValue("due_date",headerDom); sdueDate = genericUtility.getColumnValue("due_date",headerDom);
System.out.println("due_date is :::"+sdueDate); System.out.println("due_date is :::"+sdueDate);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"sdueDate:::"+sdueDate,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"sdueDate:::"+sdueDate,true);
...@@ -312,192 +320,22 @@ conn = getConnection(); ...@@ -312,192 +320,22 @@ conn = getConnection();
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);
try suggestAdj = genericUtility.getColumnValue("suggest_adj",headerDom);
{ System.out.println("suggest_adj........["+suggestAdj+"]");
// 13-09-2006 manoharan as per kedar cheque # to be checked in
// invoice_amendment (invoice_amendment is compulsory)
//sql = "SELECT A.INVOICE_ID,A.TRAN_DATE,D.TOT_AMT - D.ADJ_AMT,C.CUST_NAME,"
// + "B.BANK_CODE,B.CHEQUE_DATE,B.CHEQUE_NO,B.CHQ_AMOUNT "
// + "FROM INVOICE A,SORDER B ,CUSTOMER C, RECEIVABLES D "
// + "WHERE A.SALE_ORDER = B.SALE_ORDER "
// + "AND A.CUST_CODE = C.CUST_CODE "
// + "AND D.TRAN_SER = 'S-INV' "
// + "AND D.REF_NO = A.INVOICE_ID "
// + "AND D.TOT_AMT - D.ADJ_AMT > 0 "
// + "AND A.SITE_CODE = '"+siteCode.trim()+"' "
// + "AND A.CUST_CODE = '"+custCode.trim()+"' "
// + "AND A.DUE_DATE = ? "
// + "AND B.CHEQUE_NO IS NOT NULL "
// + "AND NOT EXISTS (SELECT 1 FROM RECEIPT I "
// + "WHERE I.SITE_CODE = A.SITE_CODE "
// + "AND I.CUST_CODE = A.CUST_CODE "
// + "AND I.REF_NO = B.CHEQUE_NO ) "
// + "ORDER BY B.CHEQUE_NO ";
// 20/07/12 manoharan invoice amendment consideration removed
/*//Manoj dtd 28/12/2012 Not Required
sql = "SELECT A.INVOICE_ID,D.TRAN_SER,A.TRAN_DATE,D.TOT_AMT - D.ADJ_AMT,C.CUST_NAME,"
+ "B.BANK_CODE,B.CHEQUE_DATE,E.REF_NO AS CHEQUE_NO,B.CHQ_AMOUNT,A.CUST_CODE,D.TOT_AMT " //added by rajesh k to get cust_code
+ "FROM INVOICE A,SORDER B ,CUSTOMER C, RECEIVABLES D, INVOICE_AMENDMENT E "
+ "WHERE A.SALE_ORDER = B.SALE_ORDER "
+ "AND A.CUST_CODE = C.CUST_CODE "
+ "AND D.TRAN_SER = 'S-INV' "
+ "AND D.REF_NO = A.INVOICE_ID "
+ "AND D.TOT_AMT - D.ADJ_AMT > 0 "
+ "AND E.INVOICE_ID = A.INVOICE_ID "
+ "AND E.CONFIRMED = 'Y' "
+ "AND E.STATUS = 'S' "
+ "AND E.REF_NO IS NOT NULL "
+ "AND A.SITE_CODE = ? "
//+ "AND A.CUST_CODE >= '"+custCodeFrom.trim()+"' AND A.CUST_CODE <= '"+custCodeTo.trim()+"' "
//+ " c.cust_code in ( select distinct group_code from customer where cust_code >= ? and cust_code <= ?) "
+" and a.cust_code in (select cust_code from customer where group_code in ( select distinct group_code from customer where group_code >= ? and group_code <= ? ) ) " //added by Kunal on 19/10/12
// + "AND A.DUE_DATE = ? "
// + "AND D.EXP_RCP_DATE = ? "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
+ "AND ((D.DUE_DATE >= ? "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
+ "AND D.DUE_DATE <= ? ) OR (D.DUE_DATE IS NULL)) "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
+ "AND NOT EXISTS (SELECT 1 FROM RECEIPT I "
+ "WHERE I.SITE_CODE = A.SITE_CODE "
+ "AND I.CUST_CODE = A.CUST_CODE "
+ "AND I.REF_NO = E.REF_NO ) "
+ "ORDER BY A.CUST_CODE, E.REF_NO ";
sql = "SELECT A.INVOICE_ID,D.TRAN_SER,A.TRAN_DATE,D.TOT_AMT - D.ADJ_AMT,C.CUST_NAME,"
//+ "B.BANK_CODE,B.CHEQUE_DATE,(select E.REF_NO from invoice_amendment e where e.invoice_id = a.invoice_id and e.status = 'S' and e.confirmed = 'Y') AS CHEQUE_NO ,B.CHQ_AMOUNT,A.CUST_CODE,D.TOT_AMT " //added by rajesh k to get cust_code
+ "B.BANK_CODE,B.CHEQUE_DATE,'' AS CHEQUE_NO ,B.CHQ_AMOUNT,A.CUST_CODE,D.TOT_AMT " //Added by manoj dtd 21/12/2012
+ "FROM INVOICE A,SORDER B ,CUSTOMER C, RECEIVABLES D " //INVOICE_AMENDMENT E "
+ "WHERE A.SALE_ORDER = B.SALE_ORDER "
+ "AND A.CUST_CODE = C.CUST_CODE "
+ "AND D.TRAN_SER = 'S-INV' "
+ "AND D.REF_NO = A.INVOICE_ID "
+ "AND D.TOT_AMT - D.ADJ_AMT > 0 "
//+ "AND E.INVOICE_ID = A.INVOICE_ID "
//+ "AND E.CONFIRMED = 'Y' "
//+ "AND E.STATUS = 'S' "
//+ "AND E.REF_NO IS NOT NULL "
+ "AND A.SITE_CODE = ? "
//+ "AND A.CUST_CODE >= '"+custCodeFrom.trim()+"' AND A.CUST_CODE <= '"+custCodeTo.trim()+"' "
//+ " and c.group_code in ( select distinct group_code from customer where cust_code >= ? and cust_code <= ?) "
+" and a.cust_code in (select cust_code from customer where group_code in ( select distinct group_code from customer where group_code >= ? and group_code <= ? ) ) "
// + "AND A.DUE_DATE = ? "
// + "AND D.EXP_RCP_DATE = ? "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
+ "AND ((D.DUE_DATE >= ? "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
+ "AND D.DUE_DATE <= ? ) OR (D.DUE_DATE IS NULL)) "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
/* 22/12/2012 Commented by Manoj not required
+ "AND NOT EXISTS (SELECT 1 FROM RECEIPT I "
+ "WHERE I.SITE_CODE = A.SITE_CODE "
+ "AND I.CUST_CODE = A.CUST_CODE "
//+ "AND I.REF_NO = (select E.REF_NO from invoice_amendment e where e.invoice_id = a.invoice_id and e.status = 'S' and e.confirmed = 'Y') " // Commented by manoj dtd 21/12/2012 to remove join with invoice amendment
+" ) "
*/
/*+ "ORDER BY A.CUST_CODE ";
//this.fw.write("getData SQL ..."+ sql + "\n");
writeLog(filePtr,"GetData 1st Sql :::."+ sql,true);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode.trim());
pstmt.setString(2,custCodeFrom.trim());
pstmt.setString(3,custCodeTo.trim());
pstmt.setTimestamp(4,dueDate);
pstmt.setTimestamp(5,dueDateTo);
writeLog(filePtr,"dueDate :::."+ dueDate.toString(),true);
System.out.println("The getDataSQL becomes .................:"+sql);
writeLog(filePtr,"############## :::."+ sql,true);
rs = pstmt.executeQuery();
while (rs.next()) HashMap<String, ArrayList<ReceiptBean>> custGrpMap = new HashMap<String, ArrayList<ReceiptBean>>();
{ ArrayList<ReceiptBean> selectedList = null;
// invoice_id tran_ser tran_date cust_ref inv_amt adj_amt cust_name try
//TD0000 MDRCRD 2012-07-04 50.0 0.0 CVS PHARMACY COORD 0.0 2012-07-04 CV0004 0.0
//INVOICE_ID
System.out.println(sdf.format(rs.getTimestamp(3)));
retTabSepStrBuff.append((rs.getString(1)==null?" ":rs.getString(1).trim())).append("\t");
//TRAN_SER
retTabSepStrBuff.append((rs.getString(2)==null?" ":rs.getString(2).trim())).append("\t");
//TRAN_DATE
retTabSepStrBuff.append(sdf.format(rs.getTimestamp(3))).append("\t");
// cust_ref_no
retTabSepStrBuff.append("").append("\t");
//INV_AMT
retTabSepStrBuff.append(rs.getDouble(4)).append("\t");
//Added by manoj dtd 18/10/2012 to display absolute value
retTabSepStrBuff.append(Math.abs(rs.getDouble(4))).append("\t");
// adj_amt
retTabSepStrBuff.append(rs.getDouble(4)).append("\t");
//CHEQUE_NO
// 20/07/12 manoharan if cheque number is not specified in sales order set from augument
System.out.println("ch no 1 = "+rs.getString(8));
if(rs.getString(8)==null || rs.getString(8).trim().length() == 0)
{
retTabSepStrBuff.append(filterChqNo).append("\t");
}
else
{
retTabSepStrBuff.append((rs.getString(8)==null?" ":rs.getString(8).trim())).append("\t");
}
//CUST_NAME
retTabSepStrBuff.append((rs.getString(5)==null?" ":rs.getString(5).trim())).append("\t");
// due_date
retTabSepStrBuff.append("").append("\t");
// cust_ref_date
retTabSepStrBuff.append("").append("\t");
// reas_code
retTabSepStrBuff.append("").append("\t");
// reas_detail
retTabSepStrBuff.append("").append("\t");
//CHQ_AMOUNT
retTabSepStrBuff.append(rs.getDouble(9)).append("\t");
//CHEQUE_DATE
if(rs.getString(7) == null)
{
//retTabSepStrBuff.append(currDate).append("\t");
retTabSepStrBuff.append(sdf.format(currDate)).append("\t");
}
else
{ {
retTabSepStrBuff.append(sdf.format(rs.getTimestamp(7))).append("\t");
}
//BANK_CODE
retTabSepStrBuff.append((rs.getString(6)==null?" ":rs.getString(6).trim())).append("\t");
//CUST_CODE
retTabSepStrBuff.append((rs.getString(10)==null?" ":rs.getString(10).trim())).append("\t"); // added by rajesh k to get cust_code
// cust_ref_amt
retTabSepStrBuff.append("0").append("\t");
retTabSepStrBuff.append(remarks).append("\t");
// adjusted_amt
retTabSepStrBuff.append(0).append("\t");
retTabSepStrBuff.append(rs.getDouble("TOT_AMT")).append("\n");
System.out.println("INVOICE_ID :::::::: "+rs.getString(1));
System.out.println("TRAN_DATE :::::::: "+rs.getDate(3));
writeLog(filePtr,"@@@@@@@@@@@@@@ INVOICE_ID :::."+rs.getString(1),true);
writeLog(filePtr,"@@@@@@@@@@@@@@ CHEQUE_DATE :::."+rs.getString(7),true);
writeLog(filePtr,"@@@@@@@@@@@@@@ CHQ_AMOUNT :::."+rs.getDouble(9),true);
writeLog(filePtr,"@@@@@@@@@@@@@@ BANK_CODE :::."+rs.getString(6),true);
}//while
rs.close();
pstmt.close();
*/
//*********Added on 28092006 //*********Added on 28092006
sql = "SELECT D.REF_NO,D.TRAN_SER,D.REF_DATE,D.TOT_AMT - D.ADJ_AMT,C.CUST_NAME ," sql = "SELECT D.REF_NO,D.TRAN_SER,D.REF_DATE,D.TOT_AMT - D.ADJ_AMT ,C.CUST_NAME ,"
//+ "' ' C.BANK_CODE,D.TRAN_DATE,' ' AS CHEQUE_NO,0.0 CHQ_AMOUNT,C.CUST_CODE "
+ "' ' BANK_CODE,D.TRAN_DATE,' ' AS CHEQUE_NO,0.0 CHQ_AMOUNT,C.CUST_CODE, " // ADDED BY RAJESH AS ALIAS IS NOT REQUIRED FOR BANK_CODE + "' ' BANK_CODE,D.TRAN_DATE,' ' AS CHEQUE_NO,0.0 CHQ_AMOUNT,C.CUST_CODE, " // ADDED BY RAJESH AS ALIAS IS NOT REQUIRED FOR BANK_CODE
+ " D.CUST_REF_NO,D.REAS_CODE,D.REAS_DETAIL,D.CUST_REF_DATE,D.ADJ_AMT,D.CUST_REF_AMT,D.DUE_DATE,D.TOT_AMT " // ADDED BY RAJESH AS ALIAS IS NOT REQUIRED FOR BANK_CODE + " D.CUST_REF_NO,D.REAS_CODE,D.REAS_DETAIL,D.CUST_REF_DATE,D.ADJ_AMT,D.CUST_REF_AMT,D.DUE_DATE,D.TOT_AMT, C.GROUP_CODE " // ADDED BY RAJESH AS ALIAS IS NOT REQUIRED FOR BANK_CODE
+ "FROM CUSTOMER C, RECEIVABLES D " + "FROM CUSTOMER C, RECEIVABLES D "
+ "WHERE C.CUST_CODE = D.CUST_CODE " + "WHERE C.CUST_CODE = D.CUST_CODE "
//+ "AND D.TRAN_SER <> 'S-INV' "//Manoj dtd 28/12/2012 Not Required
+ "AND D.TOT_AMT - D.ADJ_AMT <> 0 " + "AND D.TOT_AMT - D.ADJ_AMT <> 0 "
+ "AND D.SITE_CODE = ? " //'"+siteCode.trim()+"' " + "AND D.SITE_CODE = ? " //'"+siteCode.trim()+"' "
//+ "AND D.CUST_CODE >= '"+custCodeFrom.trim()+"' AND D.CUST_CODE <= '"+custCodeTo.trim()+"' "
//+ " and c.group_code in ( select distinct group_code from customer where cust_code >= ? and cust_code <= ?) "
+" and C.cust_code in (select cust_code from customer where group_code in ( select distinct group_code from customer where group_code >= ? and group_code <= ? ) ) " +" and C.cust_code in (select cust_code from customer where group_code in ( select distinct group_code from customer where group_code >= ? and group_code <= ? ) ) "
// commented by cpatil start on 30-03-13
//+ "AND ((D.DUE_DATE >= ? "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
//+ "AND D.DUE_DATE <= ? ) OR (D.DUE_DATE IS NULL)) "//CHANGES MADE ON 18/12/2006 AND A.DUE_DATE->D.EXP_RCP_DATE
//+ "ORDER BY D.DUE_DATE ";
// commented by cpatil end on 30-03-13
+ "AND ((D.TRAN_DATE >= ? " + "AND ((D.TRAN_DATE >= ? "
+ "AND D.TRAN_DATE <= ? ) OR (D.TRAN_DATE IS NULL)) " + "AND D.TRAN_DATE <= ? ) OR (D.TRAN_DATE IS NULL)) "
+ "ORDER BY D.TRAN_DATE "; + "ORDER BY D.TRAN_DATE ";
...@@ -511,173 +349,140 @@ conn = getConnection(); ...@@ -511,173 +349,140 @@ conn = getConnection();
System.out.println("The getDataSQL Becomes ......:"+sql); System.out.println("The getDataSQL Becomes ......:"+sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{
invoiceId = rs.getString("REF_NO")==null?" ":rs.getString("REF_NO");
invoiceId = checkNull(rs.getString("REF_NO"));
tranSer = checkNull(rs.getString("TRAN_SER"));
custRefNo = checkNull(rs.getString("CUST_REF_NO"));
tranDate = rs.getTimestamp("REF_DATE");
totAmt = rs.getDouble("TOT_AMT");
balAmt = rs.getDouble(4);
adjAmt = rs.getDouble(4);
adjustedAmt = rs.getDouble("ADJ_AMT");
invAmt = rs.getDouble(4);
reasCode = checkNull(rs.getString("REAS_CODE"));
custName = checkNull(rs.getString("CUST_NAME"));
custCode = checkNull(rs.getString("CUST_CODE"));
bankCode = checkNull(rs.getString("BANK_CODE"));
chequeDate = rs.getTimestamp("TRAN_DATE");
chequeNo = checkNull(rs.getString("CHEQUE_NO"));
chqAmount = rs.getDouble("CHQ_AMOUNT");
custRefDate= rs.getTimestamp("CUST_REF_DATE");
dueDate = rs.getTimestamp("DUE_DATE");
reasDetail = checkNull(rs.getString("REAS_DETAIL"));
custRefAmt = rs.getDouble("CUST_REF_AMT");
//Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.
groupCode = checkNull(rs.getString("GROUP_CODE"));
//System.out.println("~~~GroupCode["+groupCode+"]");
if("Y".equalsIgnoreCase(suggestAdj))
{
ArrayList<ReceiptBean> custList = new ArrayList<ReceiptBean>();
ReceiptBean rcpBean = new ReceiptBean();
rcpBean.setInvoiceId(invoiceId);
rcpBean.setTranSer(tranSer);
rcpBean.setCustRefNo(custRefNo);
rcpBean.setTranDate(tranDate);
rcpBean.setTotAmt(totAmt);
rcpBean.setBalAmt(balAmt);
rcpBean.setAdjAmt(adjAmt);
rcpBean.setAdjustedAmt(adjustedAmt);
rcpBean.setInvAmt(invAmt);
rcpBean.setReasCode(reasCode);
rcpBean.setCustName(custName);
rcpBean.setCustCode(custCode);
rcpBean.setBankCode(bankCode);
rcpBean.setChequeDate(chequeDate);
rcpBean.setChequeNo(chequeNo);
rcpBean.setChqAmount(chqAmount);
rcpBean.setCustRefDate(custRefDate);
rcpBean.setDueDate(dueDate);
rcpBean.setReasDetail(reasDetail);
rcpBean.setCustRefAmt(custRefAmt);
if (!custGrpMap.containsKey(groupCode))
{ custList.add(rcpBean);
custGrpMap.put(groupCode, custList);
}
else {
if(custGrpMap.containsKey(groupCode))
{
ArrayList<ReceiptBean> tempList = new ArrayList<ReceiptBean>();
tempList = custGrpMap.get(groupCode);
tempList.add(rcpBean);
custGrpMap.put(groupCode, tempList);
//System.out.println(">>>>tempList.size()["+tempList.size()+"]");
}
}
}//Pavan R on 24MAY18 End
else
{ {
retTabSepStrBuff.append("<Detail2>"); retTabSepStrBuff.append("<Detail2>");
System.out.println("ch no 1 = "+rs.getString(8)); retTabSepStrBuff.append("<tran_ser>").append("<![CDATA[" + tranSer +"]]>").append("</tran_ser>");
retTabSepStrBuff.append("<invoice_id>").append("<![CDATA[" + invoiceId +"]]>").append("</invoice_id>");
//TRAN_SERNO if (custRefNo == null || custRefNo.trim().length() == 0)
//retTabSepStrBuff.append(rs.getString(2)).append("\t");
retTabSepStrBuff.append("<tran_ser>").append("<![CDATA[" + rs.getString(2) +"]]>").append("</tran_ser>");
//INVOICE_ID
//retTabSepStrBuff.append(rs.getString(1)).append("\t");
//added by kunal on 04/02/13 Data set in Xml string format
retTabSepStrBuff.append("<invoice_id>").append("<![CDATA[" + rs.getString(1) +"]]>").append("</invoice_id>");
//cust_ref_no
if (rs.getString("CUST_REF_NO") == null || rs.getString("CUST_REF_NO").trim().length() == 0)
{ {
//retTabSepStrBuff.append("").append("\t");
retTabSepStrBuff.append("<cust_ref_no>").append("<![CDATA[]]>").append("</cust_ref_no>"); retTabSepStrBuff.append("<cust_ref_no>").append("<![CDATA[]]>").append("</cust_ref_no>");
}else{
retTabSepStrBuff.append("<cust_ref_no>").append("<![CDATA[" + custRefNo +"]]>").append("</cust_ref_no>");
} }
else if(tranDate == null)
{
//retTabSepStrBuff.append(rs.getString("CUST_REF_NO")).append("\t");
retTabSepStrBuff.append("<cust_ref_no>").append("<![CDATA[" +rs.getString("CUST_REF_NO") +"]]>").append("</cust_ref_no>");
}
//TRAN_DATE
//retTabSepStrBuff.append(rs.getDate(3)).append("\t");
// CHANGES BY NANDKUMAR GADKARI ON 24/04/18 added if condition on ref_date
if(rs.getTimestamp(3) == null)
{ {
retTabSepStrBuff.append("<tran_date>").append("<![CDATA[]]>").append("</tran_date>"); retTabSepStrBuff.append("<tran_date>").append("<![CDATA[]]>").append("</tran_date>");
} }else{
else
{
System.out.println(sdf.format(rs.getTimestamp(3))); System.out.println(sdf.format(rs.getTimestamp(3)));
retTabSepStrBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(rs.getTimestamp(3)) +"]]>").append("</tran_date>"); retTabSepStrBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>");
}
//TOT_AMT
//retTabSepStrBuff.append(rs.getDouble("TOT_AMT")).append("\n");
retTabSepStrBuff.append("<tot_amt>").append("<![CDATA["+rs.getDouble("TOT_AMT")+"]]>").append("</tot_amt>");
//retTabSepStrBuff.append(Math.abs(rs.getDouble(4))).append("\t");
retTabSepStrBuff.append("<bal_amt>").append("<![CDATA[" +Math.abs(rs.getDouble(4)) +"]]>").append("</bal_amt>");
//adj_AMT
//retTabSepStrBuff.append(rs.getDouble(4)).append("\t");
retTabSepStrBuff.append("<adj_amt>").append("<![CDATA[" +rs.getDouble(4) +"]]>").append("</adj_amt>");
// adjusted_amt
//retTabSepStrBuff.append(rs.getDouble("ADJ_AMT")).append("\t");
retTabSepStrBuff.append("<adjusted_amt>").append("<![CDATA["+rs.getDouble("ADJ_AMT")+"]]>").append("</adjusted_amt>");
//INV_AMT
//retTabSepStrBuff.append(rs.getDouble(4)).append("\t");
retTabSepStrBuff.append("<inv_amt>").append("<![CDATA[" +rs.getDouble(4) +"]]>").append("</inv_amt>");
//Added by manoj dtd 18/10/2012 to display absolute value
//Order change by ritesh on 18/10/13 start
//reas_CODE
if (rs.getString("REAS_CODE") == null || rs.getString("REAS_CODE").trim().length() == 0)
{
//retTabSepStrBuff.append("").append("\t");
retTabSepStrBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>");
} }
else retTabSepStrBuff.append("<tot_amt>").append("<![CDATA["+ totAmt +"]]>").append("</tot_amt>");
retTabSepStrBuff.append("<bal_amt>").append("<![CDATA[" +Math.abs(balAmt) +"]]>").append("</bal_amt>");
retTabSepStrBuff.append("<adj_amt>").append("<![CDATA[" + adjAmt +"]]>").append("</adj_amt>");
retTabSepStrBuff.append("<adjusted_amt>").append("<![CDATA["+ adjustedAmt +"]]>").append("</adjusted_amt>");
retTabSepStrBuff.append("<inv_amt>").append("<![CDATA[" + invAmt +"]]>").append("</inv_amt>");
if ( reasCode == null || reasCode.trim().length() == 0)
{ {
//retTabSepStrBuff.append(rs.getString("REAS_CODE")).append("\t"); retTabSepStrBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>");
retTabSepStrBuff.append("<reas_code>").append("<![CDATA["+rs.getString("REAS_CODE")+"]]>").append("</reas_code>"); }else{
retTabSepStrBuff.append("<reas_code>").append("<![CDATA["+reasCode+"]]>").append("</reas_code>");
} }
//Order change by ritesh on 18/10/13 end retTabSepStrBuff.append("<cust_name>").append("<![CDATA[" + custName +"]]>").append("</cust_name>");
//CUST_NAME retTabSepStrBuff.append("<cust_code>").append("<![CDATA["+ custCode+"]]>").append("</cust_code>");
//retTabSepStrBuff.append(rs.getString(5)).append("\t"); retTabSepStrBuff.append("<bank_code>").append("<![CDATA["+bankCode+"]]>").append("</bank_code>");
retTabSepStrBuff.append("<cust_name>").append("<![CDATA[" +rs.getString(5) +"]]>").append("</cust_name>"); if(chequeDate == null)
//CUST_CODE
//retTabSepStrBuff.append(rs.getString(10)).append("\t");//added by rajesh k to append cust_code
retTabSepStrBuff.append("<cust_code>").append("<![CDATA["+rs.getString(10)+"]]>").append("</cust_code>");
//BANK_CODE
//retTabSepStrBuff.append(rs.getString(6)).append("\t");
retTabSepStrBuff.append("<bank_code>").append("<![CDATA["+rs.getString(6)+"]]>").append("</bank_code>");
//CHEQUE_DATE
if(rs.getDate(7) == null)
{ {
//retTabSepStrBuff.append(currDate).append("\t");
//retTabSepStrBuff.append(sdf.format(currDate)).append("\t");
retTabSepStrBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(currDate)+"]]>").append("</cheque_date>"); retTabSepStrBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(currDate)+"]]>").append("</cheque_date>");
}else{
retTabSepStrBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(chequeDate)+"]]>").append("</cheque_date>");
} }
else if(chequeNo==null || chequeNo.trim().length() == 0)
{
//retTabSepStrBuff.append(sdf.format(rs.getTimestamp(7))).append("\t");
retTabSepStrBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(rs.getTimestamp(7))+"]]>").append("</cheque_date>");
}
//CHEQUE_NO
if(rs.getString(8)==null || rs.getString(8).trim().length() == 0) //change done by Kunal on 19/10/12
{ {
//retTabSepStrBuff.append(filterChqNo).append("\t");
retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +filterChqNo +"]]>").append("</cheque_no>"); retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +filterChqNo +"]]>").append("</cheque_no>");
}else{
retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +(chequeNo==null?" ":chequeNo.trim()) +"]]>").append("</cheque_no>");
} }
else retTabSepStrBuff.append("<chq_amount>").append("<![CDATA["+chqAmount+"]]>").append("</chq_amount>");
if(custRefDate == null)
{ {
//retTabSepStrBuff.append((rs.getString(8)==null?" ":rs.getString(8).trim())).append("\t");
retTabSepStrBuff.append("<cheque_no>").append("<![CDATA[" +(rs.getString(8)==null?" ":rs.getString(8).trim()) +"]]>").append("</cheque_no>");
}
//retTabSepStrBuff.append(rs.getString(8)).append("\t");
//CHQ_AMOUNT
//retTabSepStrBuff.append(rs.getDouble(9)).append("\t");
retTabSepStrBuff.append("<chq_amount>").append("<![CDATA["+rs.getDouble(9)+"]]>").append("</chq_amount>");
//cust_ref_date
if(rs.getDate("CUST_REF_DATE") == null)
{
//retTabSepStrBuff.append("").append("\t");
retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA[]]>").append("</cust_ref_date>"); retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA[]]>").append("</cust_ref_date>");
}else {
retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA["+sdf.format(custRefDate)+"]]>").append("</cust_ref_date>");
} }
else if(dueDate == null)
{
//retTabSepStrBuff.append(rs.getDate("CUST_REF_DATE")).append("\t");
//retTabSepStrBuff.append(sdf.format(rs.getTimestamp("CUST_REF_DATE"))).append("\t");
retTabSepStrBuff.append("<cust_ref_date>").append("<![CDATA["+sdf.format(rs.getTimestamp("CUST_REF_DATE"))+"]]>").append("</cust_ref_date>");
}
//due_date
if(rs.getDate("DUE_DATE") == null)
{ {
//retTabSepStrBuff.append("").append("\t");
retTabSepStrBuff.append("<due_date>").append("<![CDATA[]]>").append("</due_date>"); retTabSepStrBuff.append("<due_date>").append("<![CDATA[]]>").append("</due_date>");
}else{
retTabSepStrBuff.append("<due_date>").append("<![CDATA[" +sdf.format(dueDate) +"]]>").append("</due_date>");
} }
else if (reasDetail == null || reasDetail.trim().length() == 0)
{
//retTabSepStrBuff.append(sdf.format(rs.getTimestamp("DUE_DATE"))).append("\t");
retTabSepStrBuff.append("<due_date>").append("<![CDATA[" +sdf.format(rs.getTimestamp("DUE_DATE")) +"]]>").append("</due_date>");
}
//reas_detail
if (rs.getString("REAS_DETAIL") == null || rs.getString("REAS_DETAIL").trim().length() == 0)
{ {
//retTabSepStrBuff.append("").append("\t");
retTabSepStrBuff.append("<reas_detail>").append("<![CDATA[]]>").append("</reas_detail>"); retTabSepStrBuff.append("<reas_detail>").append("<![CDATA[]]>").append("</reas_detail>");
}else{
retTabSepStrBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>");
} }
else retTabSepStrBuff.append("<cust_ref_amt>").append("<![CDATA["+ custRefAmt +"]]>").append("</cust_ref_amt>");
{
//retTabSepStrBuff.append(rs.getString("REAS_DETAIL")).append("\t");
retTabSepStrBuff.append("<reas_detail>").append("<![CDATA["+rs.getString("REAS_DETAIL")+"]]>").append("</reas_detail>");
}
//cust_ref_amt
//retTabSepStrBuff.append(rs.getDouble("CUST_REF_AMT")).append("\t");
retTabSepStrBuff.append("<cust_ref_amt>").append("<![CDATA["+rs.getDouble("CUST_REF_AMT")+"]]>").append("</cust_ref_amt>");
//retTabSepStrBuff.append(remarks).append("\t");
retTabSepStrBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>"); retTabSepStrBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>");
System.out.println("INVOICE_ID :::::::: "+rs.getString(1));
/*Commented by Manoj dtd 03/05/2014
writeLog(filePtr,"%%%%%%%%% INVOICE_ID :::."+rs.getString(1),true);
writeLog(filePtr,"%%%%%%%%% CHEQUE_DATE :::."+rs.getString(7),true);
writeLog(filePtr,"%%%%%%%%% CHQ_AMOUNT :::."+rs.getDouble(9),true);
writeLog(filePtr,"%%%%%%%%% CHEQUE_DATE :::."+rs.getString(6),true);
*/
retTabSepStrBuff.append("</Detail2>"); retTabSepStrBuff.append("</Detail2>");
}
}//while }//while
rs.close(); rs.close();
...@@ -686,25 +491,116 @@ conn = getConnection(); ...@@ -686,25 +491,116 @@ conn = getConnection();
retTabSepStrBuff.append("</group0>"); retTabSepStrBuff.append("</group0>");
retTabSepStrBuff.append("</DocumentRoot>"); retTabSepStrBuff.append("</DocumentRoot>");
System.out.println("xml string::::"+retTabSepStrBuff); //Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.
if("Y".equalsIgnoreCase(suggestAdj))
{
for (String sp : custGrpMap.keySet())
{
System.out.println("*******keyset [ "+sp+" ]******");
}
for (ArrayList<ReceiptBean> templist : custGrpMap.values())
{
selectedList = new ArrayList<ReceiptBean>();
Collections.sort(templist, ReceiptBean.receiptComparator);
double totAmount = 0.0;
System.out.println("^^^^^^^templist Size["+templist.size()+"]^^^^^^^^^^");
for (int i = 0; i < templist.size(); i++)
{
ReceiptBean rcpBean = templist.get(i);
//System.out.println("--Balance Amount---["+rcpBean.getBalAmt()+"]Cnt["+i+"]");
invoiceId = rcpBean.getInvoiceId();
tranSer = rcpBean.getTranSer();
custRefNo= rcpBean.getCustRefNo();
tranDate = rcpBean.getTranDate();
totAmt= rcpBean.getTotAmt();
balAmt = rcpBean.getBalAmt();
adjAmt = rcpBean.getAdjAmt();
adjustedAmt = rcpBean.getAdjustedAmt();
invAmt = rcpBean.getInvAmt();
reasCode = rcpBean.getReasCode();
custName = rcpBean.getCustName();
custCode = rcpBean.getCustCode();
bankCode = rcpBean.getBankCode();
chequeDate = rcpBean.getChequeDate();
chequeNo = rcpBean.getChequeNo();
chqAmount = rcpBean.getChqAmount();
custRefDate = rcpBean.getCustRefDate();
dueDate = rcpBean.getDueDate();
reasDetail = rcpBean.getReasDetail();
custRefAmt = rcpBean.getCustRefAmt();
totAmount = totAmount+balAmt;
System.out.println("@@@totAmount["+totAmount+"]BalAmount["+balAmt+"]cnt["+i+"]");
rcpBean.setRunningTotal(getRequiredDecimal(totAmount,3));
templist.set(i, rcpBean);
}
//reverse loop to find 0 amount(match of +ve and -ve)
for (int index = templist.size() - 1; index >= 0; index--)
{
ReceiptBean rcpBean = templist.get(index);
System.out.println("Balance Amount["+rcpBean.getBalAmt()+"]getRunningTotal():["+rcpBean.getRunningTotal()+"]Cnt["+index+"]");
//If runningTot is 0 then select remianing records else mark unselected
if(rcpBean.getRunningTotal() == 0)
{
int count = 0;
for (int selInx = index; selInx >= 0; selInx--)
{ count = selInx;
rcpBean = templist.get(selInx);
//added for asc ordr viewdata
rcpBean.setIsSelected("Y");
rcpBean.setDomId(selInx);
selectedList.add(rcpBean);
}
index = count;
}
else
{ //unselected list
rcpBean.setIsSelected("N");
rcpBean.setDomId(index);
selectedList.add(rcpBean);
}
}
for(int index = selectedList.size() - 1; index >= 0; index--)
{
ReceiptBean receiptBean = selectedList.get(index);
if ("Y".equals(receiptBean.getIsSelected())) {
xmlBuff.append(generateXmls(headerDom, receiptBean.getDomId(),"Y",receiptBean));
}else if ("N".equals(receiptBean.getIsSelected())) {
xmlBuff.append(generateXmls(headerDom, receiptBean.getDomId(),"N",receiptBean));
}
}
System.out.println("Total Amount - ["+totAmount+"]");
}//end of for (ArrayList templist : custGrpMap.values())
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
System.out.println("xml xmlBuff::::"+xmlBuff);
//********* }//end of suggestion flag
//Pavan R on 24MAY18 End
}//try }//try
catch (SQLException e) catch (SQLException e)
{ {
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,e,true);
System.out.println("SQLException ::GenerateReceiptPrcEJB :" +sql+ e.getMessage() + ":"); System.out.println("SQLException ::GenerateReceiptPrcEJB :" +sql+ e.getMessage() + ":");
throw new ITMException(e); throw new ITMException(e);
} }
catch(Exception ex) catch(Exception ex)
{ {
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,ex,true);
System.out.println("Exception []::GenerateReceiptPrcEJB :"+ex.getMessage()); System.out.println("Exception []::GenerateReceiptPrcEJB :"+ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
} }
//if suggested adj is Y then display selected/unselected data else exsting will work
if("Y".equalsIgnoreCase(suggestAdj))
{
resultString = xmlBuff.toString();
}else
{
resultString = retTabSepStrBuff.toString(); resultString = retTabSepStrBuff.toString();
}
System.out.println("xml----["+resultString+"]");
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,resultString,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,resultString,true);
if (!errCode.equals("")) if (!errCode.equals(""))
{ {
...@@ -730,6 +626,7 @@ conn = getConnection(); ...@@ -730,6 +626,7 @@ conn = getConnection();
try try
{ {
retTabSepStrBuff = null; retTabSepStrBuff = null;
xmlBuff= null;
conn.close(); conn.close();
conn = null; conn = null;
if(rs!=null) if(rs!=null)
...@@ -2914,10 +2811,324 @@ conn = getConnection(); ...@@ -2914,10 +2811,324 @@ conn = getConnection();
return retString; return retString;
} */ } */
//Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.
private StringBuffer generateXmls(Document headerDom, int id, String isSelected, ReceiptBean rcpBean) throws ITMException
{
String invoiceId = "";
String tranSer = "";
String custRefNo = "";
String reasCode = "";
String custName = "";
String custCode = "";
String bankCode = "";
String chequeNo = "";
String reasDetail = "";
String groupCode = "";
String filterChqNo = "";
double totAmt = 0.0;
double balAmt = 0.0;
double adjAmt = 0.0;
double adjustedAmt = 0.0;
double invAmt = 0.0;
double chqAmount = 0.0;
double custRefAmt = 0.0;
double totAmount = 0.0;
Timestamp tranDate = null;
Timestamp chequeDate = null;
Timestamp custRefDate= null;
Timestamp dueDate = null;
StringBuffer xmlBuff = null;
try{
java.sql.Date currDate = new java.sql.Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
xmlBuff = new StringBuffer();
invoiceId = rcpBean.getInvoiceId();
tranSer = rcpBean.getTranSer();
custRefNo= rcpBean.getCustRefNo();
tranDate = rcpBean.getTranDate();
totAmt= rcpBean.getTotAmt();
balAmt = rcpBean.getBalAmt();
adjAmt = rcpBean.getAdjAmt();
adjustedAmt = rcpBean.getAdjustedAmt();
invAmt = rcpBean.getInvAmt();
reasCode = rcpBean.getReasCode();
custName = rcpBean.getCustName();
custCode = rcpBean.getCustCode();
//System.out.println("--custCode--["+custCode+"]");
bankCode = rcpBean.getBankCode();
chequeDate = rcpBean.getChequeDate();
chequeNo = rcpBean.getChequeNo();
chqAmount = rcpBean.getChqAmount();
custRefDate = rcpBean.getCustRefDate();
dueDate = rcpBean.getDueDate();
reasDetail = rcpBean.getReasDetail();
custRefAmt = rcpBean.getCustRefAmt();
filterChqNo = genericUtility.getColumnValue("cheque_no",headerDom);
//System.out.println("totAmount["+totAmount+"");
xmlBuff.append("<Detail2 domID=\""+id+"\" selected=\""+isSelected+"\" > \r\n");
xmlBuff.append("<attribute selected=\""+isSelected+"\" updateFlag=\"\" status=\"N\" pkNames=\"\" />\r\n");
xmlBuff.append("<tran_ser>").append("<![CDATA[" + tranSer +"]]>").append("</tran_ser>");
xmlBuff.append("<invoice_id>").append("<![CDATA[" + invoiceId +"]]>").append("</invoice_id>");
if (custRefNo == null || custRefNo.trim().length() == 0)
{
xmlBuff.append("<cust_ref_no>").append("<![CDATA[]]>").append("</cust_ref_no>");
}else{
xmlBuff.append("<cust_ref_no>").append("<![CDATA[" + custRefNo +"]]>").append("</cust_ref_no>");
}
if(tranDate == null)
{
xmlBuff.append("<tran_date>").append("<![CDATA[]]>").append("</tran_date>");
}else{
xmlBuff.append("<tran_date>").append("<![CDATA[" +sdf.format(tranDate) +"]]>").append("</tran_date>");
}
xmlBuff.append("<tot_amt>").append("<![CDATA["+ totAmt +"]]>").append("</tot_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("<adjusted_amt>").append("<![CDATA["+ adjustedAmt +"]]>").append("</adjusted_amt>");
xmlBuff.append("<inv_amt>").append("<![CDATA[" + invAmt +"]]>").append("</inv_amt>");
if ( reasCode == null || reasCode.trim().length() == 0)
{
xmlBuff.append("<reas_code>").append("<![CDATA[]]>").append("</reas_code>");
}else{
xmlBuff.append("<reas_code>").append("<![CDATA["+reasCode+"]]>").append("</reas_code>");
}
xmlBuff.append("<cust_name>").append("<![CDATA[" + custName +"]]>").append("</cust_name>");
xmlBuff.append("<cust_code>").append("<![CDATA["+ custCode+"]]>").append("</cust_code>");
xmlBuff.append("<bank_code>").append("<![CDATA["+bankCode+"]]>").append("</bank_code>");
if(chequeDate == null)
{
xmlBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(currDate)+"]]>").append("</cheque_date>");
}else{
xmlBuff.append("<cheque_date>").append("<![CDATA["+sdf.format(chequeDate)+"]]>").append("</cheque_date>");
}
if(chequeNo==null || chequeNo.trim().length() == 0)
{
xmlBuff.append("<cheque_no>").append("<![CDATA[" +filterChqNo +"]]>").append("</cheque_no>");
}else{
xmlBuff.append("<cheque_no>").append("<![CDATA[" +(chequeNo==null?" ":chequeNo.trim()) +"]]>").append("</cheque_no>");
}
xmlBuff.append("<chq_amount>").append("<![CDATA["+chqAmount+"]]>").append("</chq_amount>");
if(custRefDate == null)
{
xmlBuff.append("<cust_ref_date>").append("<![CDATA[]]>").append("</cust_ref_date>");
}else {
xmlBuff.append("<cust_ref_date>").append("<![CDATA["+sdf.format(custRefDate)+"]]>").append("</cust_ref_date>");
}
if(dueDate == null)
{
xmlBuff.append("<due_date>").append("<![CDATA[]]>").append("</due_date>");
}else{
xmlBuff.append("<due_date>").append("<![CDATA[" +sdf.format(dueDate) +"]]>").append("</due_date>");
}
if (reasDetail == null || reasDetail.trim().length() == 0)
{
xmlBuff.append("<reas_detail>").append("<![CDATA[]]>").append("</reas_detail>");
}else{
xmlBuff.append("<reas_detail>").append("<![CDATA["+ reasDetail +"]]>").append("</reas_detail>");
}
xmlBuff.append("<cust_ref_amt>").append("<![CDATA["+ custRefAmt +"]]>").append("</cust_ref_amt>");
xmlBuff.append("<remarks>").append("<![CDATA["+remarks+"]]>").append("</remarks>");
xmlBuff.append("</Detail2>");
}catch (SQLException se)
{
//System.out.println("SQLException :RetainerContractReleasePrc :getData(Document dom, Document dom2, String winName, String xtraParams):" + se.getMessage() + ":");
se.printStackTrace();
throw new ITMException(se);
} catch (Exception e)
{
//System.out.println("Exception :RetainerContractReleasePrc :getData(Document dom, Document dom2, String winName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return xmlBuff;
}
//Pavan R on 24MAY18 End
}//class }//class
//LHL22 //LHL22
//AD018 //AD018
//28/12/2005 //28/12/2005
//Added by Pavan R on 24MAY18 [F18BGTP001]- "Suggest adjustments" in Automatic AR settlement filter screen.
class ReceiptBean
{
private String invoiceId = "";
private String tranSer = "";
private String custRefNo = "";
private Timestamp tranDate = null;
private double totAmt = 0;
private double balAmt = 0;
private double adjAmt = 0;
private double adjustedAmt = 0;
private double invAmt = 0;
private String reasCode = "";
private String custName = "";
private String custCode = "";
private String bankCode = "";
private Timestamp chequeDate = null;
private String chequeNo = "";
private double chqAmount = 0;
private Timestamp custRefDate = null;
private Timestamp dueDate = null;
private String reasDetail = "";
private double custRefAmt = 0;
private double runningTotal = 0;
private String isSelected = "";
private int domId = 0;
public String getInvoiceId() {
return invoiceId;
}
public void setInvoiceId(String invoiceId) {
this.invoiceId = invoiceId;
}
public String getTranSer() {
return tranSer;
}
public void setTranSer(String tranSer) {
this.tranSer = tranSer;
}
public String getCustRefNo() {
return custRefNo;
}
public void setCustRefNo(String custRefNo) {
this.custRefNo = custRefNo;
}
public Timestamp getTranDate() {
return tranDate;
}
public void setTranDate(Timestamp tranDate) {
this.tranDate = tranDate;
}
public double getTotAmt() {
return totAmt;
}
public void setTotAmt(double totAmt) {
this.totAmt = totAmt;
}
public double getBalAmt() {
return balAmt;
}
public void setBalAmt(double balAmt) {
this.balAmt = balAmt;
}
public double getAdjAmt() {
return adjAmt;
}
public void setAdjAmt(double adjAmt) {
this.adjAmt = adjAmt;
}
public double getAdjustedAmt() {
return adjustedAmt;
}
public void setAdjustedAmt(double adjustedAmt) {
this.adjustedAmt = adjustedAmt;
}
public double getInvAmt() {
return invAmt;
}
public void setInvAmt(double invAmt) {
this.invAmt = invAmt;
}
public String getReasCode() {
return reasCode;
}
public void setReasCode(String reasCode) {
this.reasCode = reasCode;
}
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public String getCustCode() {
return custCode;
}
public void setCustCode(String custCode) {
this.custCode = custCode;
}
public String getBankCode() {
return bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
public Timestamp getChequeDate() {
return chequeDate;
}
public void setChequeDate(Timestamp chequeDate) {
this.chequeDate = chequeDate;
}
public String getChequeNo() {
return chequeNo;
}
public void setChequeNo(String chequeNo) {
this.chequeNo = chequeNo;
}
public double getChqAmount() {
return chqAmount;
}
public void setChqAmount(double chqAmount) {
this.chqAmount = chqAmount;
}
public Timestamp getCustRefDate() {
return custRefDate;
}
public void setCustRefDate(Timestamp custRefDate) {
this.custRefDate = custRefDate;
}
public Timestamp getDueDate() {
return dueDate;
}
public void setDueDate(Timestamp dueDate) {
this.dueDate = dueDate;
}
public String getReasDetail() {
return reasDetail;
}
public void setReasDetail(String reasDetail) {
this.reasDetail = reasDetail;
}
public double getCustRefAmt() {
return custRefAmt;
}
public void setCustRefAmt(double custRefAmt) {
this.custRefAmt = custRefAmt;
}
public double getRunningTotal() {
return runningTotal;
}
public void setRunningTotal(double runningTotal) {
this.runningTotal = runningTotal;
}
public String getIsSelected() {
return isSelected;
}
public void setIsSelected(String isSelected) {
this.isSelected = isSelected;
}
public int getDomId() {
return domId;
}
public void setDomId(int domId) {
this.domId = domId;
}
public static Comparator<ReceiptBean> receiptComparator = new Comparator<ReceiptBean>() {
public int compare(ReceiptBean rcpBean1, ReceiptBean rcpBean2)
{
//System.out.println("inside comparator["+rcpBean1.getDueDate()+"]["+rcpBean2.getDueDate()+"]");
//ascending order
return rcpBean1.getDueDate().compareTo(rcpBean2.getDueDate());
//descending order
//return rcpBean2.compareTo(rcpBean1);
}
};
}
//Pavan R on 24MAY18 End
\ 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