Commit d023a805 authored by arawankar's avatar arawankar

Changes merged in MiscPayAutoPrc.java

-Added changes to validate paymode 

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187018 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f24a47b6
...@@ -16,6 +16,7 @@ import java.sql.ResultSet; ...@@ -16,6 +16,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -507,17 +508,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -507,17 +508,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
if(retStr == null || retStr.trim().length() == 0) if(retStr == null || retStr.trim().length() == 0)
{ {
System.out.println("connection commit"); errString = itmDBAccess.getErrorString( "", "VTFIN00001" , loginCode);
//conn.commit();
errString = itmDBAccess.getErrorString( "", "VTFIN0001" , loginCode);
System.out.println("connection commited");
return errString; return errString;
} }
else else
{ {
//conn.rollback();
System.out.println("retStr---["+retStr+"]"); System.out.println("retStr---["+retStr+"]");
return getErrorXML("Unconfirmed transactions", retStr, "VTUNCONF01", ""); //return getErrorXML("ALL CONFIRM AND UNCONFIRMED TRANSACTIONS", retStr, "VTUNCONF01", "");
return getErrorXml(retStr);
} }
} }
catch(Exception e) catch(Exception e)
...@@ -593,6 +591,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -593,6 +591,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
private String miscAutoPay(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn)throws ITMException private String miscAutoPay(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn)throws ITMException
{ {
String confirmRetString = "";
String errString = ""; String errString = "";
String loginCode = ""; String loginCode = "";
String tranType = ""; String tranType = "";
...@@ -657,6 +656,10 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -657,6 +656,10 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
String miscPaymentTranID = ""; String miscPaymentTranID = "";
String chqName = ""; String chqName = "";
String compType = ""; String compType = "";
String errorString = "";
String succesString = "";
String successLine = "";
String errorLine = "";
int lineNo = 0; int lineNo = 0;
int refLen = 0; int refLen = 0;
...@@ -722,7 +725,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -722,7 +725,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local"); itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
successLine = "-----------------Confirmed Transactions------------";
succesString = successLine + succesString;
errorLine = "-----------------Unconfirmed Transactions------------";
errorString = errorLine + errorString;
xmlString = new StringBuffer("<?xml version = \"1.0\"?>"); xmlString = new StringBuffer("<?xml version = \"1.0\"?>");
xmlString.append("<DocumentRoot>"); xmlString.append("<DocumentRoot>");
...@@ -806,12 +813,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -806,12 +813,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
{ {
//Bank code is not found in the master. //Bank code is not found in the master.
errString = itmDBAccess.getErrorString( "", "VMBANK0" , loginCode); errString = itmDBAccess.getErrorString( "", "VMBANK0" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
if(acctCodeBal == null || acctCodeBal.trim().length() == 0) if(acctCodeBal == null || acctCodeBal.trim().length() == 0)
{ {
//VMACCT //VMACCT
errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode); errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
if(resultSet != null) if(resultSet != null)
...@@ -897,6 +906,37 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -897,6 +906,37 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
String payModeArray[] = {"Q","N","G","T","C","D"}; String payModeArray[] = {"Q","N","G","T","C","D"};
ArrayList<String> payModeList = new ArrayList<String>( Arrays.asList( payModeArray) );
parentNodeList = detailDom.getElementsByTagName("Detail2");
//Added by Anjali R. on [27/06/2018][To validate the paymode][Start]
System.out.println("childNodeLength---["+parentNodeList.getLength()+"]");
for(ctr = 0; ctr < parentNodeList.getLength(); ctr++)
{
parentNode = parentNodeList.item(ctr);
String payMode = genericUtility.getColumnValueFromNode("pay_mode", parentNode);
System.out.println("payMode---["+payMode+"]");
if(payModeList.contains(payMode))
{
System.out.println("continue paymode");
continue;
}
else if(payMode == null || payMode.trim().length() == 0)
{
errString = itmDBAccess.getErrorString( "pay_mode", "VTFIN00002" , loginCode);
errString = getErrorXml(errString);
return errString;
}
else
{
System.out.println("return paymode");
errString = itmDBAccess.getErrorString( "pay_mode", "VTFIN00003" , loginCode);
errString = getErrorXml(errString);
return errString;
}
}
//Added by Anjali R. on [27/06/2018][To validate the paymode][End]
for(int key = 0;key< payModeArray.length;key++) for(int key = 0;key< payModeArray.length;key++)
{ {
...@@ -906,7 +946,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -906,7 +946,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
XPath xpath = xpathFactory.newXPath(); XPath xpath = xpathFactory.newXPath();
String tempPayMode = payModeArray[key]; String tempPayMode = payModeArray[key];
parentNodeList = getNodebypkValue(detailDom, xpath, tempPayMode ,"P"); parentNodeList = getNodebyValue(detailDom, xpath, tempPayMode ,"P");
System.out.println("Payment mode -["+ tempPayMode +"] number of details --["+ parentNodeList.getLength() +"]"); System.out.println("Payment mode -["+ tempPayMode +"] number of details --["+ parentNodeList.getLength() +"]");
Document payModeDom = getNodeListToDom(parentNodeList); Document payModeDom = getNodeListToDom(parentNodeList);
...@@ -941,23 +981,25 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -941,23 +981,25 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
continue; continue;
} }
parentNodeList1 = getNodebypkValue(payModeDom, xpath1, mSundryType,"S"); parentNodeList1 = getNodebyValue(payModeDom, xpath1, mSundryType,"S");
alreadyExist.add(mSundryType); alreadyExist.add(mSundryType);
mRemarks = "Automatic Payment ";
tot = 0.0;
mTotAmt = 0.0;
mTotDiff = 0.0;
sundryAmt = 0.0;
taxAmt = 0.0;
totTax = 0.0;
System.out.println("mSundryCode--["+mSundryType+"]parentNodeList1---["+parentNodeList1.getLength()+"]"); System.out.println("mSundryCode--["+mSundryType+"]parentNodeList1---["+parentNodeList1.getLength()+"]");
for(int j = 0; j < parentNodeList1.getLength(); j++) for(int j = 0; j < parentNodeList1.getLength(); j++)
{ {
parentNode1 = parentNodeList1.item(j); parentNode1 = parentNodeList1.item(j);
mRemarks = "Automatic Payment ";
tot = 0.0;
mTotAmt = 0.0;
mTotDiff = 0.0;
isFst = true; isFst = true;
isSundry = true; isSundry = true;
sundryAmt = 0.0;
taxAmt = 0.0;
totTax = 0.0;
cnt++; cnt++;
detailBuff.append("<Detail2 dbID=\"\" domID=\""+cnt+"\" objName=\"misc_pay\" objContext=\"2\">"); detailBuff.append("<Detail2 dbID=\"\" domID=\""+cnt+"\" objName=\"misc_pay\" objContext=\"2\">");
...@@ -1004,7 +1046,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1004,7 +1046,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
mPayAmt = temp!= null && temp.trim().length()>0 ?Double.parseDouble(temp):0.0; mPayAmt = temp!= null && temp.trim().length()>0 ?Double.parseDouble(temp):0.0;
mChequeNo = genericUtility.getColumnValueFromNode("cheque_no", parentNode1); mChequeNo = genericUtility.getColumnValueFromNode("cheque_no", parentNode1);
//Added by Varsha V on 25-06-18 //Added by Varsha V on 25-06-18
try { try
{
chequeNoInt = mChequeNo!= null && mChequeNo.trim().length()>0 ? Integer.parseInt(mChequeNo):0; chequeNoInt = mChequeNo!= null && mChequeNo.trim().length()>0 ? Integer.parseInt(mChequeNo):0;
} }
catch(Exception e) catch(Exception e)
...@@ -1159,6 +1202,9 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1159,6 +1202,9 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
System.out.println("discAmt---["+discAmt+"]"); System.out.println("discAmt---["+discAmt+"]");
} }
} }
System.out.println("totDiscAmt-before--["+totDiscAmt+"]");
totDiscAmt = totDiscAmt + discAmt;
System.out.println("totDiscAmt--after-["+totDiscAmt+"]");
adjAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("adj_amt", parentNode1)); adjAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("adj_amt", parentNode1));
System.out.println("adjAmt---["+adjAmt+"]"); System.out.println("adjAmt---["+adjAmt+"]");
...@@ -1179,9 +1225,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1179,9 +1225,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
{ {
//The currency in which you want to make the payment is not the same on voucher. //The currency in which you want to make the payment is not the same on voucher.
errString = itmDBAccess.getErrorString( "", "VTPAYM4" , loginCode); errString = itmDBAccess.getErrorString( "", "VTPAYM4" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
System.out.println("isFst---["+isFst+"]");
if(isFst) if(isFst)
{ {
isFst = false; isFst = false;
...@@ -1285,8 +1333,6 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1285,8 +1333,6 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
System.out.println("totTax---["+totTax+"]"); System.out.println("totTax---["+totTax+"]");
mTotAmt = mTotAmt + taxAmt - discAmt; mTotAmt = mTotAmt + taxAmt - discAmt;
System.out.println("mTotAmt---["+mTotAmt+"]"); System.out.println("mTotAmt---["+mTotAmt+"]");
totDiscAmt = totDiscAmt + discAmt;
System.out.println("totDiscAmt---["+totDiscAmt+"]");
updCount = 0; updCount = 0;
/*************************************************************************************** /***************************************************************************************
...@@ -1374,7 +1420,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1374,7 +1420,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
if(mRefNoUpto != null && mRefNoUpto.trim().length() > 0 && Integer.parseInt(mRefNo) > Integer.parseInt(mRefNoUpto)) if(mRefNoUpto != null && mRefNoUpto.trim().length() > 0 && Integer.parseInt(mRefNo) > Integer.parseInt(mRefNoUpto))
{ {
errString = itmDBAccess.getErrorString( "", "VTPAYM7" , loginCode); errString = itmDBAccess.getErrorString( "", "VTPAYM7" , loginCode);
break; errString = getErrorXml(errString);
return errString;
} }
} }
} }
...@@ -1535,7 +1582,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1535,7 +1582,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
System.out.println("mPayMode----["+ mPayMode +"]"); System.out.println("mPayMode----["+ mPayMode +"]");
//Changed by Varsha V on 25-06-18 for assigning cheque name value blank base on paymode //Changed by Varsha V on 25-06-18 for assigning cheque name value blank base on paymode
if(!"N".equalsIgnoreCase(mPayMode) && !"G".equalsIgnoreCase(mPayMode) && !"T".equalsIgnoreCase(mPayMode)) if(!"N".equalsIgnoreCase(mPayMode) && !"G".equalsIgnoreCase(mPayMode) && !"T".equalsIgnoreCase(mPayMode) && !"C".equalsIgnoreCase(mPayMode))
{ {
chqName = finCommon.getChequeName(mSundryType, mSundryCode, "C", conn); chqName = finCommon.getChequeName(mSundryType, mSundryCode, "C", conn);
System.out.println("chqName--- NOT N - G - T["+chqName+"]"); System.out.println("chqName--- NOT N - G - T["+chqName+"]");
...@@ -1661,7 +1708,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1661,7 +1708,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.setString(1, oSundryType); pstmt.setString(1, oSundryType);
pstmt.setString(2, oSundryCode); pstmt.setString(2, oSundryCode);
pstmt.setString(3, oPayMode); pstmt.setString(3, oPayMode);
pstmt.setString(4, mRefNo); //pstmt.setString(4, mRefNo);
pstmt.setInt(4, refNoInt);
pstmt.setString(5, mRemarks); pstmt.setString(5, mRemarks);
pstmt.setDouble(6, mTotAmt); pstmt.setDouble(6, mTotAmt);
pstmt.setString(7, mCurrcode); pstmt.setString(7, mCurrcode);
...@@ -1670,6 +1718,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1670,6 +1718,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.setDouble(10, mTotDiff); pstmt.setDouble(10, mTotDiff);
pstmt.setString(11, chqName); pstmt.setString(11, chqName);
pstmt.setDouble(12, totTax); pstmt.setDouble(12, totTax);
System.out.println("Total discount amount--["+totDiscAmt+"]");
pstmt.setDouble(13, totDiscAmt); pstmt.setDouble(13, totDiscAmt);
pstmt.setString(14, miscPaymentTranID); pstmt.setString(14, miscPaymentTranID);
updCount = pstmt.executeUpdate(); updCount = pstmt.executeUpdate();
...@@ -1680,12 +1729,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1680,12 +1729,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
String errorString = "";
//Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice. //Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice.
if("Y".equalsIgnoreCase(autoPost)) if("Y".equalsIgnoreCase(autoPost))
{ {
String confirmed = ""; String confirmed = "";
String confirmRetString = confirm(miscPaymentTranID, xtraParams, conn); confirmRetString = confirm(miscPaymentTranID, xtraParams, conn);
System.out.println("confirmRetString---["+confirmRetString+"]"); System.out.println("confirmRetString---["+confirmRetString+"]");
sql = "select confirmed from misc_payment where tran_id = ?"; sql = "select confirmed from misc_payment where tran_id = ?";
...@@ -1709,18 +1758,20 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1709,18 +1758,20 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
if(!"Y".equalsIgnoreCase(confirmed)) if(!"Y".equalsIgnoreCase(confirmed))
{ {
errorString = errorString + miscPaymentTranID; errorString = errorString + "\n" + miscPaymentTranID+"\n";
} }
else else
{ {
errorString = ""; succesString = succesString + "\n" + miscPaymentTranID+"\n";
} }
} }
if(errorString != null && errorString.trim().length() >0) confirmRetString = "";
confirmRetString = succesString + errorString;
if("N".equalsIgnoreCase(autoPost))
{ {
return errorString; confirmRetString = "";
} }
System.out.println("ALL TRANSACTION ---["+confirmRetString+"]");
} }
alreadyExist.clear(); alreadyExist.clear();
} }
...@@ -1762,7 +1813,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1762,7 +1813,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
throw new ITMException(e); throw new ITMException(e);
} }
} }
return errString; return confirmRetString;
} }
private String getMiscAutoPayCheckSplit(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn)throws ITMException private String getMiscAutoPayCheckSplit(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn)throws ITMException
{ {
...@@ -1828,6 +1879,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1828,6 +1879,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
String miscPaymentTranID = ""; String miscPaymentTranID = "";
String chqName = ""; String chqName = "";
String compType = ""; String compType = "";
String errorString = "";
String succesString = "";
String successLine = "";
String errorLine = "";
String confirmRetString = "";
int lineNo = 0; int lineNo = 0;
int refLen = 0; int refLen = 0;
...@@ -1892,7 +1948,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1892,7 +1948,11 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
initialCtx = new InitialContext(appConnect.getProperty()); initialCtx = new InitialContext(appConnect.getProperty());
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local"); itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
successLine = "-----------------Confirmed Transactions------------";
succesString = successLine + succesString;
errorLine = "-----------------Unconfirmed Transactions------------";
errorString = errorLine + errorString;
xmlString = new StringBuffer("<?xml version = \"1.0\"?>"); xmlString = new StringBuffer("<?xml version = \"1.0\"?>");
...@@ -1977,12 +2037,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1977,12 +2037,14 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
{ {
//Bank code is not found in the master. //Bank code is not found in the master.
errString = itmDBAccess.getErrorString( "", "VMBANK0" , loginCode); errString = itmDBAccess.getErrorString( "", "VMBANK0" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
if(acctCodeBal == null || acctCodeBal.trim().length() == 0) if(acctCodeBal == null || acctCodeBal.trim().length() == 0)
{ {
//VMACCT //VMACCT
errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode); errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
if(resultSet != null) if(resultSet != null)
...@@ -1999,6 +2061,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -1999,6 +2061,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
{ {
//VMACCT--Entered account not defined in accounts master //VMACCT--Entered account not defined in accounts master
errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode); errString = itmDBAccess.getErrorString( "", "VMACCT" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
if(acctCodeCfAp == null || acctCodeCfAp.trim().length() == 0) if(acctCodeCfAp == null || acctCodeCfAp.trim().length() == 0)
...@@ -2068,6 +2131,36 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2068,6 +2131,36 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
String payModeArray[] = {"Q","N","G","T","C","D"}; String payModeArray[] = {"Q","N","G","T","C","D"};
ArrayList<String> payModeList = new ArrayList<String>( Arrays.asList( payModeArray) );
parentNodeList = detailDom.getElementsByTagName("Detail2");
System.out.println("childNodeLength---["+parentNodeList.getLength()+"]");
for(ctr = 0; ctr < parentNodeList.getLength(); ctr++)
{
parentNode = parentNodeList.item(ctr);
String payMode = genericUtility.getColumnValueFromNode("pay_mode", parentNode);
System.out.println("payMode---["+payMode+"]");
if(payModeList.contains(payMode))
{
System.out.println("continue paymode");
continue;
}
else if(payMode == null || payMode.trim().length() == 0)
{
errString = itmDBAccess.getErrorString( "pay_mode", "VTFIN00002" , loginCode);
errString = getErrorXml(errString);
return errString;
}
else
{
System.out.println("return paymode");
errString = itmDBAccess.getErrorString( "pay_mode", "VTFIN00003" , loginCode);
errString = getErrorXml(errString);
return errString;
}
}
for(int key = 0;key< payModeArray.length;key++) for(int key = 0;key< payModeArray.length;key++)
{ {
...@@ -2077,7 +2170,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2077,7 +2170,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
XPath xpath = xpathFactory.newXPath(); XPath xpath = xpathFactory.newXPath();
String tempPayMode = payModeArray[key]; String tempPayMode = payModeArray[key];
parentNodeList = getNodebypkValue(detailDom, xpath, tempPayMode ,"P"); parentNodeList = getNodebyValue(detailDom, xpath, tempPayMode ,"P");
System.out.println("Payment mode -["+ tempPayMode +"] number of details --["+ parentNodeList.getLength() +"]"); System.out.println("Payment mode -["+ tempPayMode +"] number of details --["+ parentNodeList.getLength() +"]");
Document payModeDom = getNodeListToDom(parentNodeList); Document payModeDom = getNodeListToDom(parentNodeList);
...@@ -2107,28 +2200,29 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2107,28 +2200,29 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
mSundryType = genericUtility.getColumnValueFromNode("sundry_type", parentNode); mSundryType = genericUtility.getColumnValueFromNode("sundry_type", parentNode);
System.out.println("mSundryType--["+mSundryType+"]"); System.out.println("mSundryType--["+mSundryType+"]");
if(alreadyExist.contains(mSundryType) && (!"Q".equalsIgnoreCase(tempPayMode) || !"D".equalsIgnoreCase(tempPayMode))) //if(alreadyExist.contains(mSundryType) && (!"Q".equalsIgnoreCase(tempPayMode) && !"D".equalsIgnoreCase(tempPayMode)))
if(alreadyExist.contains(mSundryType) )
{ {
continue; continue;
} }
System.out.println("alreadyExist---["+alreadyExist+"]");
parentNodeList1 = getNodebypkValue(payModeDom, xpath1, mSundryType,"S"); parentNodeList1 = getNodebyValue(payModeDom, xpath1, mSundryType,"S");
alreadyExist.add(mSundryType); alreadyExist.add(mSundryType);
mRemarks = "Automatic Payment ";
tot = 0.0;
mTotAmt = 0.0;
mTotDiff = 0.0;
sundryAmt = 0.0;
taxAmt = 0.0;
totTax = 0.0;
System.out.println("mSundryCode--["+mSundryType+"]parentNodeList1---["+parentNodeList1.getLength()+"]"); System.out.println("mSundryCode--["+mSundryType+"]parentNodeList1---["+parentNodeList1.getLength()+"]");
for(int j = 0; j < parentNodeList1.getLength(); j++) for(int j = 0; j < parentNodeList1.getLength(); j++)
{ {
parentNode1 = parentNodeList1.item(j); parentNode1 = parentNodeList1.item(j);
mRemarks = "Automatic Payment ";
tot = 0.0;
mTotAmt = 0.0;
mTotDiff = 0.0;
isFst = true; isFst = true;
isSundry = true; isSundry = true;
sundryAmt = 0.0;
taxAmt = 0.0;
totTax = 0.0;
cnt++; cnt++;
detailBuff.append("<Detail2 dbID=\"\" domID=\""+cnt+"\" objName=\"misc_pay\" objContext=\"2\">"); detailBuff.append("<Detail2 dbID=\"\" domID=\""+cnt+"\" objName=\"misc_pay\" objContext=\"2\">");
...@@ -2348,6 +2442,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2348,6 +2442,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
{ {
//The currency in which you want to make the payment is not the same on voucher. //The currency in which you want to make the payment is not the same on voucher.
errString = itmDBAccess.getErrorString( "", "VTPAYM4" , loginCode); errString = itmDBAccess.getErrorString( "", "VTPAYM4" , loginCode);
errString = getErrorXml(errString);
return errString; return errString;
} }
...@@ -2562,6 +2657,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2562,6 +2657,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
mTotAmtBc = mTotAmt * Double.parseDouble(mExchRateHdr); mTotAmtBc = mTotAmt * Double.parseDouble(mExchRateHdr);
System.out.println("mTotAmtBc---["+mTotAmtBc+"]"); System.out.println("mTotAmtBc---["+mTotAmtBc+"]");
//mTotAmtBc = mTotAmtBc + mTotAmt * Double.parseDouble(mExchRateHdr);
System.out.println("mTotAmtBc total-["+mTotAmtBc+"]");
System.out.println("isSundry--["+isSundry+"]oPayMode--["+oPayMode+"]"); System.out.println("isSundry--["+isSundry+"]oPayMode--["+oPayMode+"]");
//if(!isSundry && ("D".equalsIgnoreCase(oPayMode) || "T".equalsIgnoreCase(oPayMode) || "P".equalsIgnoreCase(oPayMode) ))//Changed for NEFT & RTGS //if(!isSundry && ("D".equalsIgnoreCase(oPayMode) || "T".equalsIgnoreCase(oPayMode) || "P".equalsIgnoreCase(oPayMode) ))//Changed for NEFT & RTGS
if(!isSundry && ("D".equalsIgnoreCase(oPayMode) || "T".equalsIgnoreCase(oPayMode) || "P".equalsIgnoreCase(oPayMode)) || "G".equalsIgnoreCase(oPayMode) || "N".equalsIgnoreCase(oPayMode)) if(!isSundry && ("D".equalsIgnoreCase(oPayMode) || "T".equalsIgnoreCase(oPayMode) || "P".equalsIgnoreCase(oPayMode)) || "G".equalsIgnoreCase(oPayMode) || "N".equalsIgnoreCase(oPayMode))
...@@ -2703,7 +2800,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2703,7 +2800,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
refNoInt = chequeNoInt; refNoInt = chequeNoInt;
} }
if(!"N".equalsIgnoreCase(mPayMode) || !"G".equalsIgnoreCase(mPayMode) || !"T".equalsIgnoreCase(mPayMode)) if(!"N".equalsIgnoreCase(mPayMode) && !"G".equalsIgnoreCase(mPayMode) && !"T".equalsIgnoreCase(mPayMode) && !"C".equalsIgnoreCase(mPayMode))
{ {
chqName = finCommon.getChequeName(mSundryType, mSundryCode, "C", conn); chqName = finCommon.getChequeName(mSundryType, mSundryCode, "C", conn);
System.out.println("chqName---["+chqName+"]"); System.out.println("chqName---["+chqName+"]");
...@@ -2826,7 +2923,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2826,7 +2923,8 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.setString(1, oSundryType); pstmt.setString(1, oSundryType);
pstmt.setString(2, oSundryCode); pstmt.setString(2, oSundryCode);
pstmt.setString(3, oPayMode); pstmt.setString(3, oPayMode);
pstmt.setString(4, mRefNo); //pstmt.setString(4, mRefNo);
pstmt.setInt(4, refNoInt);
pstmt.setString(5, mRemarks); pstmt.setString(5, mRemarks);
pstmt.setDouble(6, mTotAmt); pstmt.setDouble(6, mTotAmt);
pstmt.setString(7, mCurrcode); pstmt.setString(7, mCurrcode);
...@@ -2845,12 +2943,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2845,12 +2943,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
String errorString = "";
//Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice. //Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice.
if("Y".equalsIgnoreCase(autoPost)) if("Y".equalsIgnoreCase(autoPost))
{ {
String confirmed = ""; String confirmed = "";
String confirmRetString = confirm(miscPaymentTranID, xtraParams, conn); confirmRetString = confirm(miscPaymentTranID, xtraParams, conn);
System.out.println("confirmRetString---["+confirmRetString+"]"); System.out.println("confirmRetString---["+confirmRetString+"]");
sql = "select confirmed from misc_payment where tran_id = ?"; sql = "select confirmed from misc_payment where tran_id = ?";
...@@ -2874,23 +2972,32 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2874,23 +2972,32 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
if(!"Y".equalsIgnoreCase(confirmed)) if(!"Y".equalsIgnoreCase(confirmed))
{ {
errorString = errorString + miscPaymentTranID; errorString = errorString + "\n" + miscPaymentTranID+"\n";
} }
else else
{ {
errorString = ""; succesString = succesString + "\n" + miscPaymentTranID+"\n";
} }
} }
confirmRetString = "";
confirmRetString = succesString + errorString;
System.out.println("ALL TRANSACTION ---["+confirmRetString+"]");
if(errorString != null && errorString.trim().length() >0) if(errorString != null && errorString.trim().length() >0)
{ {
return errorString; //return errorString;
} }
xmldata = null; xmldata = null;
xmldata = new StringBuffer(); xmldata = new StringBuffer();
detailBuff = null; detailBuff = null;
detailBuff = new StringBuffer(); detailBuff = new StringBuffer();
mRemarks = "Automatic Payment ";
tot = 0.0;
mTotAmt = 0.0;
mTotDiff = 0.0;
sundryAmt = 0.0;
taxAmt = 0.0;
totTax = 0.0;
} }
} }
...@@ -2941,12 +3048,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2941,12 +3048,12 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
String errorString = "";
//Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice. //Confirmation part as discussed with Piyush Sir,If component type is WSR then call webservice.
if("Y".equalsIgnoreCase(autoPost)) if("Y".equalsIgnoreCase(autoPost))
{ {
String confirmed = ""; String confirmed = "";
String confirmRetString = confirm(miscPaymentTranID, xtraParams, conn); confirmRetString = confirm(miscPaymentTranID, xtraParams, conn);
System.out.println("confirmRetString---["+confirmRetString+"]"); System.out.println("confirmRetString---["+confirmRetString+"]");
sql = "select confirmed from misc_payment where tran_id = ?"; sql = "select confirmed from misc_payment where tran_id = ?";
...@@ -2970,16 +3077,19 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -2970,16 +3077,19 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
if(!"Y".equalsIgnoreCase(confirmed)) if(!"Y".equalsIgnoreCase(confirmed))
{ {
errorString = errorString + miscPaymentTranID; errorString = errorString + "\n" + miscPaymentTranID+"\n";
} }
else else
{ {
errorString = ""; succesString = succesString + "\n" + miscPaymentTranID+"\n";
} }
} }
if(errorString != null && errorString.trim().length() >0) confirmRetString = "";
confirmRetString = succesString+"\n" + errorString;
System.out.println("ALL TRANSACTION ---["+confirmRetString+"]");
if("N".equalsIgnoreCase(autoPost) || "".equalsIgnoreCase(autoPost))
{ {
return errorString; confirmRetString = "";
} }
} }
...@@ -3024,7 +3134,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -3024,7 +3134,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
throw new ITMException(e); throw new ITMException(e);
} }
} }
return errString; return confirmRetString;
} }
private String confirm(String tranId ,String xtraParams ,Connection conn) throws ITMException, Exception private String confirm(String tranId ,String xtraParams ,Connection conn) throws ITMException, Exception
{ {
...@@ -3139,7 +3249,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -3139,7 +3249,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
else else
{ {
System.out.println("Exception while calling WSR component"); System.out.println("Transaction FAILED TO CONFIRM");
} }
} }
catch(Exception e) catch(Exception e)
...@@ -3191,7 +3301,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -3191,7 +3301,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
return retString; return retString;
} }
public String getErrorXML(String messageValue,String message ,String errorId, String traceInfo) throws RemoteException,ITMException public String getErrorXML(String message,String messageValue,String errorId, String traceInfo) throws RemoteException,ITMException
{ {
System.out.println("getErrorXML.........."); System.out.println("getErrorXML..........");
String errString = ""; String errString = "";
...@@ -3256,7 +3366,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -3256,7 +3366,7 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
return tranId; return tranId;
} }
private NodeList getNodebypkValue(Document doc, XPath xpath,String name,String columnName) private NodeList getNodebyValue(Document doc, XPath xpath,String name,String columnName)
{ {
NodeList nodes = null; NodeList nodes = null;
XPathExpression expr = null; XPathExpression expr = null;
...@@ -3327,4 +3437,70 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi ...@@ -3327,4 +3437,70 @@ public class MiscPayAutoPrc extends ProcessEJB implements MiscPayAutoPrcLocal,Mi
} }
return newXmlDocument; return newXmlDocument;
} }
}//end of ejbs private String getErrorXml(String retXml)
{
System.out.println("retXml------["+ retXml + "]");
E12GenericUtility genericUtility = null;
NodeList parentNodeList = null;
Node parentNode = null;
NodeList childNodeList = null;
Node childNode = null;
String childNodeName = "";
String message = "";
String description = "";
String errId = "";
int childNodeLength = 0;
int ctr=0;
try
{
if(retXml.indexOf("<root>") != -1)
{
System.out.println("Inside root condition......");
genericUtility = new E12GenericUtility();
Document errDom = genericUtility.parseString(retXml);
//message = errDom.getElementsByTagName("root");
parentNodeList = errDom.getElementsByTagName("root");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if("error".equalsIgnoreCase(childNodeName))
{
errId = childNode.getAttributes().getNamedItem("id").getNodeValue();
System.out.println("Error code -----["+ errId +"]");
}
else if("message".equalsIgnoreCase(childNodeName))
{
message = genericUtility.getColumnValue("message", errDom);
System.out.println("message--["+message+"]");
}
else if("description".equalsIgnoreCase(childNodeName))
{
description = genericUtility.getColumnValue("description", errDom);
System.out.println("description--["+description+"]");
}
}
retXml = getErrorXML(message, description, errId, "");
System.out.println("retXml----[" + retXml + "]");
}
else
{
retXml = getErrorXML("", retXml, "", "");
}
}
catch(Exception e)
{
System.out.println("Exception from getErrorXml---["+ e.getMessage() +"]");
e.printStackTrace();
return retXml;
}
return retXml;
}
}
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