Commit b4cee4aa authored by msalla's avatar msalla

ReceiptDishonour Migaration & Not Allowed Duplicate Receipt No.at ReceiptDishonour



git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212238 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a27f05c7
...@@ -110,10 +110,10 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -110,10 +110,10 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
int count = 0; int count = 0;
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null; ResultSet rs = null,rs1=null;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String rcpacctAmt = "", tranDateStr =" "; String rcpacctAmt = "", tranDateStr =" ",tranId=" ";
double exrate,exRbc; double exrate,exRbc;
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
...@@ -357,8 +357,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -357,8 +357,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
else else
{ {
rcptno = this.genericUtility.getColumnValue("receipt_no", dom); rcptno = this.genericUtility.getColumnValue("receipt_no", dom);
tranId=this.genericUtility.getColumnValue("tran_id", dom);//added by monika 18 nov 19
if(tranId == null)
{
tranId =" ";
}//end
System.out.println(" else inside receipt no tran series validation"); System.out.println(" else inside receipt no tran series validation");
sql="select confirmed from Rcpdishnr where Receipt_No = ?";
//commented by monika on 18 nov 2019
/*sql="select confirmed from Rcpdishnr where Receipt_No = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, rcptno); pstmt.setString(1, rcptno);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -377,6 +384,30 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -377,6 +384,30 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
*/
sql="select count(*) from Rcpdishnr where Receipt_No = ? and tran_id<>?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, rcptno);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if(cnt>0)
{
System.out.println("confirm receiptdishionor"+cnt);
errCode="VTRCPUNDH";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}//end
rs.close();
rs= null;
pstmt.close();
pstmt = null;
} }
} }
else else
...@@ -738,7 +769,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -738,7 +769,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
String stdExrted = null, date; String stdExrted = null, date;
String vcode = " ", currCodeBc = "", cctrCodeCf = " ", acctCodeBc = " ", cctrCodeBc = " "; String vcode = " ", currCodeBc = "", cctrCodeCf = " ", acctCodeBc = " ", cctrCodeBc = " ";
Timestamp trandate; Timestamp trandate;
String finEntity = " ", diffAmtExchange = " ", receipt = null; String finEntity = " ", diffAmtExchange = " ", receipt = null,findescr=" ";
String chqAmt,rcpSundryCodefor=" "; String chqAmt,rcpSundryCodefor=" ";
double adjAmtBc = 0, netAmt = 0, chequeAmt = 0; double adjAmtBc = 0, netAmt = 0, chequeAmt = 0;
double intPerc, chqamt, billamt = 0; double intPerc, chqamt, billamt = 0;
...@@ -887,6 +918,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -887,6 +918,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
bankAccCodeBc = checkNull(rs.getString("acct_code__bc")); bankAccCodeBc = checkNull(rs.getString("acct_code__bc"));
bankcctrCodebc = checkNull(rs.getString("cctr_code__bc")); bankcctrCodebc = checkNull(rs.getString("cctr_code__bc"));
crTerm = checkNull(rs.getString("cr_term")); crTerm = checkNull(rs.getString("cr_term"));
System.out.println("cr tem in receipt"+crTerm);
custName = checkNull(rs.getString("cust_name")); custName = checkNull(rs.getString("cust_name"));
siteDesr = checkNull(rs.getString("descr")); siteDesr = checkNull(rs.getString("descr"));
} }
...@@ -898,8 +930,11 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -898,8 +930,11 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
if ("NULLFOUND".equalsIgnoreCase(finparamcrterm) || finparamcrterm == null) if ("NULLFOUND".equalsIgnoreCase(finparamcrterm) || finparamcrterm == null)
{ {
finparmCrTerm = crTerm; finparmCrTerm = crTerm;
valueXmlString.append("<cr_term>").append("<![CDATA[" + finparmCrTerm + "]]>").append("</cr_term>");
} }
// System.out.println("inside the if finparamcrterm");
System.out.println("inside the if finparamcrterm"+crTerm);
//System.out.println("custCode----------->>>>>>>>>>>>>"+custCode); //System.out.println("custCode----------->>>>>>>>>>>>>"+custCode);
sql = "select descr from crterm where cr_term = ?"; sql = "select descr from crterm where cr_term = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -916,13 +951,16 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -916,13 +951,16 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
if (finEntity != null && finEntity.trim().length() > 0) if (finEntity != null && finEntity.trim().length() > 0)
{ {
// System.out.println("inside the if FinEntity"+finEntity); // System.out.println("inside the if FinEntity"+finEntity);
sql = "select curr_code from finent where FIN_ENTITY = ?"; //sql = "select curr_code,descr from finent where FIN_ENTITY = ?"; commented to find fin_entity description by monika on 18 -11-19
sql = "select curr_code,descr from finent where FIN_ENTITY = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, finEntity); pstmt.setString(1, finEntity);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
currCodeBc = checkNull(rs.getString("curr_code")); currCodeBc = checkNull(rs.getString("curr_code"));
findescr=checkNull(rs.getString("descr"));//added by monika 18-11-19
} }
// System.out.println("curr_code_bc>>["+currCodeBc); // System.out.println("curr_code_bc>>["+currCodeBc);
...@@ -940,13 +978,18 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -940,13 +978,18 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
valueXmlString.append("<net_amt>").append("<![CDATA[" + netAmt + "]]>").append("</net_amt>"); valueXmlString.append("<net_amt>").append("<![CDATA[" + netAmt + "]]>").append("</net_amt>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>"); valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
valueXmlString.append("<cust_name>").append("<![CDATA[" + custName + "]]>").append("</cust_name>"); valueXmlString.append("<cust_name>").append("<![CDATA[" + custName + "]]>").append("</cust_name>");
valueXmlString.append("<cr_term>").append("<![CDATA[" + finparmCrTerm + "]]>").append("</cr_term>"); // valueXmlString.append("<cr_term>").append("<![CDATA[" + finparmCrTerm + "]]>").append("</cr_term>");
valueXmlString.append("<cr_term>").append("<![CDATA[" + crTerm + "]]>").append("</cr_term>");
System.out.println("crterm in xml"+crTerm);
valueXmlString.append("<cr_term__old>").append("<![CDATA[" + crTermOld + "]]>").append("</cr_term__old>"); valueXmlString.append("<cr_term__old>").append("<![CDATA[" + crTermOld + "]]>").append("</cr_term__old>");
valueXmlString.append("<bank_code>").append("<![CDATA[" + bankCode + "]]>").append("</bank_code>"); valueXmlString.append("<bank_code>").append("<![CDATA[" + bankCode + "]]>").append("</bank_code>");
valueXmlString.append("<bank_bank_name>").append("<![CDATA[" + bankBName + "]]>").append("</bank_bank_name>"); valueXmlString.append("<bank_bank_name>").append("<![CDATA[" + bankBName + "]]>").append("</bank_bank_name>");
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>"); valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>");
valueXmlString.append("<site_descr>").append("<![CDATA[" + siteDesr + "]]>").append("</site_descr>"); valueXmlString.append("<site_descr>").append("<![CDATA[" + siteDesr + "]]>").append("</site_descr>");
valueXmlString.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>"); valueXmlString.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>");
valueXmlString.append("<finent_descr>").append("<![CDATA[" + findescr + "]]>").append("</finent_descr>");
setNodeValue(dom, "fin_entity", finEntity); setNodeValue(dom, "fin_entity", finEntity);
valueXmlString.append("<rcp_mode>").append("<![CDATA[" + rcpMode + "]]>").append("</rcp_mode>"); valueXmlString.append("<rcp_mode>").append("<![CDATA[" + rcpMode + "]]>").append("</rcp_mode>");
valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
...@@ -956,7 +999,9 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -956,7 +999,9 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
valueXmlString.append("<cctr_code__bc>").append("<![CDATA[" + bankcctrCodebc + "]]>").append("</cctr_code__bc>"); valueXmlString.append("<cctr_code__bc>").append("<![CDATA[" + bankcctrCodebc + "]]>").append("</cctr_code__bc>");
valueXmlString.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExchange + "]]>").append("</diff_amt__exch>"); valueXmlString.append("<diff_amt__exch>").append("<![CDATA[" + diffAmtExchange + "]]>").append("</diff_amt__exch>");
valueXmlString.append("<crterm_descr>").append("<![CDATA[" + crTermDesr + "]]>").append("</crterm_descr>"); // valueXmlString.append("<crterm_descr>").append("<![CDATA[" + crTermDesr + "]]>").append("</crterm_descr>");
valueXmlString.append("<crterm_descr>").append("<![CDATA[" + descr + "]]>").append("</crterm_descr>");//added by monika 18 nov 19 to get the correct value of cooumn
// System.out.println("currency_code bc before --"+currCodeBc); // System.out.println("currency_code bc before --"+currCodeBc);
valueXmlString.append("<curr_code__bc>").append("<![CDATA[" + currCodeBc + "]]>").append("</curr_code__bc>"); valueXmlString.append("<curr_code__bc>").append("<![CDATA[" + currCodeBc + "]]>").append("</curr_code__bc>");
// System.out.println("currency_code bc after --"+currCodeBc); // System.out.println("currency_code bc after --"+currCodeBc);
...@@ -973,7 +1018,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -973,7 +1018,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
valueXmlString.append(reStr); valueXmlString.append(reStr);
// System.out.println("\nInside header..dom.."+reStr); // System.out.println("\nInside header..dom.."+reStr);
} }//end of receipt
else else
{ {
//System.out.println("inside the else receipt_no"); //System.out.println("inside the else receipt_no");
...@@ -1045,13 +1090,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -1045,13 +1090,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
if (finEntity != null && finEntity.trim().length() > 0) if (finEntity != null && finEntity.trim().length() > 0)
{ {
//System.out.println("ist ansi check for finEntity..if started"); //System.out.println("ist ansi check for finEntity..if started");
sql = "select curr_code from finent where FIN_ENTITY = ? "; sql = "select curr_code,descr from finent where FIN_ENTITY = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, finEntity); pstmt.setString(1, finEntity);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
currCode = checkNull(rs.getString("curr_code")); currCode = checkNull(rs.getString("curr_code"));
findescr=checkNull(rs.getString("descr"));//added by monika 18-11-19
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -1112,13 +1159,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -1112,13 +1159,15 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
//System.out.println("if for fin entity started in ansi inside ansi"+finEntity); //System.out.println("if for fin entity started in ansi inside ansi"+finEntity);
finEntity = checkNull(genericUtility.getColumnValue("FIN_ENTITY", dom)); finEntity = checkNull(genericUtility.getColumnValue("FIN_ENTITY", dom));
// System.out.println("finentity>>>>>>>>>>>>"+finEntity); // System.out.println("finentity>>>>>>>>>>>>"+finEntity);
sql = "select curr_code from finent where FIN_ENTITY = ?"; sql = "select curr_code,descr from finent where FIN_ENTITY = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, finEntity); pstmt.setString(1, finEntity);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
currCode = checkNull(rs.getString(" curr_code")); currCode = checkNull(rs.getString(" curr_code"));
findescr=checkNull(rs.getString("descr"));//added by monika 18-11-19
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -1150,6 +1199,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -1150,6 +1199,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
valueXmlString.append("<bank_bank_name>").append("<![CDATA[" + bankBName + "]]>").append("</bank_bank_name>"); valueXmlString.append("<bank_bank_name>").append("<![CDATA[" + bankBName + "]]>").append("</bank_bank_name>");
valueXmlString.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
valueXmlString.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>"); valueXmlString.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>");
valueXmlString.append("<finent_descr>").append("<![CDATA[" + findescr + "]]>").append("</finent_descr>");//added by monika 18-11-19
setNodeValue(dom, "fin_entity", finEntity); setNodeValue(dom, "fin_entity", finEntity);
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>"); valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>");
valueXmlString.append("<site_descr>").append("<![CDATA[" + siteDesr + "]]>").append("</site_descr>"); valueXmlString.append("<site_descr>").append("<![CDATA[" + siteDesr + "]]>").append("</site_descr>");
...@@ -1157,7 +1207,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour ...@@ -1157,7 +1207,7 @@ public class ReceiptDishonourIC extends ValidatorEJB implements ReceiptDishonour
valueXmlString.append("<cctr_code__bc>").append("<![CDATA[" + cctrCodeBc + "]]>").append("</cctr_code__bc>"); valueXmlString.append("<cctr_code__bc>").append("<![CDATA[" + cctrCodeBc + "]]>").append("</cctr_code__bc>");
valueXmlString.append("<cr_term>").append("<![CDATA[" + finparmCrTerm + "]]>").append("</cr_term>"); valueXmlString.append("<cr_term>").append("<![CDATA[" + finparmCrTerm + "]]>").append("</cr_term>");
valueXmlString.append("<cr_term__old>").append("<![CDATA[" + crTermOld + "]]>").append("</cr_term__old>"); valueXmlString.append("<cr_term__old>").append("<![CDATA[" + crTermOld + "]]>").append("</cr_term__old>");
valueXmlString.append("<crterm_descr>").append("<![CDATA[" + crTermDesr + "]]>").append("</crterm_descr>"); valueXmlString.append("<crterm_descr>").append("<![CDATA[" + descr + "]]>").append("</crterm_descr>");
//commentde by monika 15 nov 2019 as value currcodebc is taking from receipt--= currcodebc //commentde by monika 15 nov 2019 as value currcodebc is taking from receipt--= currcodebc
//valueXmlString.append("<curr_code__bc>").append("<![CDATA[" + currCodeBc + "]]>").append("</curr_code__bc>"); //valueXmlString.append("<curr_code__bc>").append("<![CDATA[" + currCodeBc + "]]>").append("</curr_code__bc>");
// System.out.println("currency code set in misc couch"+currCode); // System.out.println("currency code set in misc couch"+currCode);
......
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