Commit 669ac973 authored by vkadam's avatar vkadam

Change in 3 way matching scheduler.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98096 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 27ecec89
...@@ -46,28 +46,33 @@ public class MatchVoucherConfSch implements Schedule ...@@ -46,28 +46,33 @@ public class MatchVoucherConfSch implements Schedule
public String schedule(String scheduleParamXML)throws Exception{ public String schedule(String scheduleParamXML)throws Exception{
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Connection conn = null; Connection conn = null;
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
PreparedStatement pstmt1 = null,pstmt2=null,pstmt3=null,pstmt4=null,pstmt5=null; PreparedStatement pstmt1 = null,pstmt2=null,pstmt3=null,pstmt4=null,pstmt5=null;
ResultSet rs1 = null,rs2=null,rs3=null,rs4=null,rs5=null; ResultSet rs1 = null,rs2=null,rs3=null,rs4=null,rs5=null;
String sql="",sql1="",sql2="",sql3="",sql4="",sql5=""; String sql="",sql1="",sql2="",sql3="",sql4="",sql5="";
String tranId="",loginSiteCode=""; String tranId="",loginSiteCode="";
ibase.utility.UserInfoBean userInfo = null; ibase.utility.UserInfoBean userInfo = null;
String sysDate =""; String sysDate ="";
int cnt1=0, cnt2=0, cnt=0,vCnt=0,rcpCnt=0; int cnt1=0, cnt2=0, cnt=0,vCnt=0,rcpCnt=0,insertCnt=0;
String retString=""; String retString="";
String xtraParams = "",siteCode="",porderNo="",billNo="",billDate="",billAmt=""; //The parameters from BaseApplication.xml String xtraParams = "",siteCode="",porderNo="",billNo=""; //The parameters from BaseApplication.xml
Date bllDate; Date bllDate;
String voucherNo="", receiptNo="",suppBillId="",strToWrite="";; //Other parameters String voucherNo="", receiptNo="",suppBillId="",strToWrite="", voucherBillNo=""; //Other parameters
String suppCode="";
double rcpAmt=0;
String invNo="",challanNo="";
Timestamp invDate=null,challanDate=null,billDate=null,voucherBillDate=null;
double billAmt=0,vouchAmt=0;
try try
{ {
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
System.out.println("********* In Scheduler Begine TRY ***************"); System.out.println("********* In Scheduler Begine TRY ***************");
Document dom = null; Document dom = null;
int noOfParam=0; int noOfParam=0;
userInfo = new ibase.utility.UserInfoBean( scheduleParamXML ); userInfo = new ibase.utility.UserInfoBean( scheduleParamXML );
loginSiteCode = userInfo.getSiteCode(); loginSiteCode = userInfo.getSiteCode();
xtraParams = "loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode+"~~loginEmpCode="+userInfo.getEmpCode(); xtraParams = "loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="
+loginSiteCode+"~~loginEmpCode="+userInfo.getEmpCode();
System.out.println("XTRAPARAMS contain :- ["+xtraParams+"]"); System.out.println("XTRAPARAMS contain :- ["+xtraParams+"]");
...@@ -93,10 +98,9 @@ public class MatchVoucherConfSch implements Schedule ...@@ -93,10 +98,9 @@ public class MatchVoucherConfSch implements Schedule
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength !!!!!"+childNodeListLength); System.out.println("childNodeListLength !!!!!"+childNodeListLength);
SimpleDateFormat sdfDb= new SimpleDateFormat(genericUtility.getDBDateFormat());
//Select porder_no from 'SUPPLIER_BILL'
// sql1 = "select TRAN_ID as supplier_bill_id,PORDER_NO,BILL_NO,BILL_AMT,BILL_DATE,VOUCHER_NO from SUPPLIER_BILL where MATCH_STATUS='1'"; sql1 = "select TRAN_ID as supplier_bill_id,PORDER_NO,BILL_NO,BILL_AMT,BILL_DATE,VOUCHER_NO,SUPP_CODE "
sql1 = "select TRAN_ID as supplier_bill_id,PORDER_NO,BILL_NO,BILL_AMT,BILL_DATE,VOUCHER_NO"
+ " from SUPPLIER_BILL where (CASE WHEN MATCH_STATUS IS NULL THEN '1' ELSE MATCH_STATUS END) ='1'";// VALLABH KADAM check for NULL also 25/MAY/15 + " from SUPPLIER_BILL where (CASE WHEN MATCH_STATUS IS NULL THEN '1' ELSE MATCH_STATUS END) ='1'";// VALLABH KADAM check for NULL also 25/MAY/15
pstmt1 = conn.prepareStatement(sql1); pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
...@@ -105,24 +109,26 @@ public class MatchVoucherConfSch implements Schedule ...@@ -105,24 +109,26 @@ public class MatchVoucherConfSch implements Schedule
suppBillId=rs1.getString("supplier_bill_id"); suppBillId=rs1.getString("supplier_bill_id");
porderNo=rs1.getString("PORDER_NO"); porderNo=rs1.getString("PORDER_NO");
billNo=rs1.getString("BILL_NO"); billNo=rs1.getString("BILL_NO");
billDate=rs1.getString("BILL_DATE"); billDate=rs1.getTimestamp("BILL_DATE");
bllDate=rs1.getDate("BILL_DATE"); billAmt=rs1.getDouble("BILL_AMT");
billAmt=rs1.getString("BILL_AMT"); voucherNo=checkNull(rs1.getString("VOUCHER_NO"));
voucherNo=rs1.getString("VOUCHER_NO"); suppCode=rs1.getString("SUPP_CODE");
/**
* If voucherNo is NULL System.out.println("&&&&Supplier Bill Tran Id:- ["+suppBillId+"]");
* select from table 'VOUCHER' System.out.println("&&&&Supplier Bill Voucher No:- ["+voucherNo+"]");
* for porderNo,billNo
* and update it in table 'SUPPLIER_BILL' insertCnt=0; //Insert Count set to 0
* 25/MAY/15
* */
if(voucherNo==null || voucherNo.trim().length()<=0){ if(voucherNo==null || voucherNo.trim().length()<=0){
sql4 ="select TRAN_ID from voucher where BILL_NO=? AND PURC_ORDER=?"; sql4 ="select TRAN_ID from voucher a,acctprd b where BILL_NO=? AND PURC_ORDER=? AND SUPP_CODE=? "
+ "and bill_date between fr_date and to_date";
pstmt4 = conn.prepareStatement(sql4); pstmt4 = conn.prepareStatement(sql4);
pstmt4.setString(1,billNo); pstmt4.setString(1,billNo);
pstmt4.setString(2,porderNo); pstmt4.setString(2,porderNo);
pstmt4.setString(3,suppCode);
rs4 = pstmt4.executeQuery(); rs4 = pstmt4.executeQuery();
while (rs4.next()) if(rs4.next())
{ {
voucherNo=checkNull(rs4.getString("TRAN_ID")); voucherNo=checkNull(rs4.getString("TRAN_ID"));
} }
...@@ -131,87 +137,213 @@ public class MatchVoucherConfSch implements Schedule ...@@ -131,87 +137,213 @@ public class MatchVoucherConfSch implements Schedule
pstmt4.close(); pstmt4.close();
pstmt4=null; pstmt4=null;
System.out.println("Voucher No from VOUCHER :- ["+voucherNo+"]");
/**UPDATE voucherNo in table 'SUPPLIER_BILL'*/ /**UPDATE voucherNo in table 'SUPPLIER_BILL'*/
sql5 = "UPDATE SUPPLIER_BILL set VOUCHER_NO=? WHERE TRAN_ID=?"; if(checkNull(voucherNo).trim().length()>0)
pstmt5 = conn.prepareStatement(sql5); {
pstmt5.setString(1,checkNull(voucherNo).trim()); sql5 = "UPDATE SUPPLIER_BILL set VOUCHER_NO=? WHERE TRAN_ID=?";
pstmt5.setString(2,checkNull(suppBillId).trim()); pstmt5 = conn.prepareStatement(sql5);
pstmt5.executeUpdate(); pstmt5.setString(1,checkNull(voucherNo).trim());
pstmt5.close(); pstmt5.setString(2,checkNull(suppBillId).trim());
pstmt5 = null; pstmt5.executeUpdate();
pstmt5.close();
pstmt5 = null;
}
} }
if(voucherNo.trim().length()>0)
{
// sql2 = "select A.tran_id,A.tran_id__rcp from VOUCHER A,VOUCHRCP B where A.TRAN_ID=B.TRAN_ID AND B.PURC_ORDER=? and A.confirmed='N' "; //check from vouchrcp // sql2 = "select A.tran_id,A.tran_id__rcp from VOUCHER A,VOUCHRCP B where A.TRAN_ID=B.TRAN_ID AND B.PURC_ORDER=? and A.confirmed='N' "; //check from vouchrcp
sql2 = "select distinct A.tran_id,A.tran_id__rcp from VOUCHER A,VOUCHRCP B where A.TRAN_ID=B.TRAN_ID AND B.PURC_ORDER=? AND A.tran_id=? and A.confirmed='N' "; //check from vouchrcp sql2 = "select A.tran_id,B.PRCP_ID,SUM(B.NET_AMT) as NET_AMT_VCH,A.BILL_NO,A.BILL_DATE from VOUCHER A,VOUCHRCP B where A.TRAN_ID=B.TRAN_ID "
+ "AND B.PURC_ORDER=? AND A.tran_id=? and A.confirmed='N' and a.supp_code=? "
+ "and B.VOUCH_QTY>0 group by A.tran_id,B.PRCP_ID,A.BILL_NO,A.BILL_DATE "; //check from vouchrcp
// sql2 = "select tran_id,tran_id__rcp from VOUCHER where TRAN_ID=? and PURC_ORDER=? AND CONFIRMED='N'"; // sql2 = "select tran_id,tran_id__rcp from VOUCHER where TRAN_ID=? and PURC_ORDER=? AND CONFIRMED='N'";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,porderNo); pstmt2.setString(1,porderNo);
pstmt2.setString(2,voucherNo); pstmt2.setString(2,voucherNo);
pstmt2.setString(3,suppCode);
rs2 = pstmt2.executeQuery(); rs2 = pstmt2.executeQuery();
while (rs2.next()) while (rs2.next())
{ {
//cnt1=rs2.getInt("cnt"); //cnt1=rs2.getInt("cnt");
voucherNo=rs2.getString("tran_id"); voucherNo=rs2.getString("tran_id");
receiptNo=rs2.getString("tran_id__rcp"); receiptNo=rs2.getString("PRCP_ID");
// vouchAmt=rs2.getDouble("NET_AMT");
//Match the billNo,billDate,billAmt in table VOUCHER for voucherNo. vouchAmt=rs2.getDouble("NET_AMT_VCH");
vCnt=threeWayMatching(suppBillId,voucherNo,porderNo,receiptNo,billNo,billDate,bllDate,billAmt,"VOUCHER",conn,xtraParams); voucherBillNo=rs2.getString("BILL_NO");
if(vCnt>0) voucherBillDate=rs2.getTimestamp("BILL_DATE");
System.out.println("@@@@Voucher AMT :-["+vouchAmt+"]");
System.out.println("@@@@Voucher BILL NO :-["+voucherBillNo+"]");
System.out.println("@@@@Voucher BILL DATE :-["+voucherBillDate+"]");
sql="select p.amount,p.invoice_no,p.INVOICE_DATE,p.dc_no,p.dc_date from PORCP p,PORCPDET pd where p.TRAN_ID=pd.TRAN_ID "
+ "AND p.tran_id=? and p.supp_code=? and pd.purc_order=?";
pstmt3=conn.prepareStatement(sql);
pstmt3.setString(1, receiptNo);
pstmt3.setString(2, suppCode);
pstmt3.setString(3, porderNo);
rs3=pstmt3.executeQuery();
if(rs3.next())
{
rcpAmt=rs3.getDouble("amount");
invNo=checkNull(rs3.getString("invoice_no"));
invDate=rs3.getTimestamp("INVOICE_DATE");
challanNo=checkNull(rs3.getString("dc_no"));
challanDate=rs3.getTimestamp("dc_date");
System.out.println("$$$$PORCP rcpAmt :- ["+rcpAmt+"]");
System.out.println("$$$$PORCP invNo :- ["+invNo+"]");
System.out.println("$$$$PORCP invDate :- ["+invDate+"]");
System.out.println("$$$$PORCP challanNO :- ["+challanNo+"]");
System.out.println("$$$$PORCP challanDate :- ["+challanDate+"]");
if(invNo.trim().length()>0)
{
if(!(billNo.trim()).equalsIgnoreCase(invNo.trim()))
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"PORCP","BILL_NO",conn,
xtraParams,"BNO_MISMMATCH_REAS");
insertCnt++;
}
}
else if(challanNo.trim().length()>0)
{
if(!(billNo.trim()).equalsIgnoreCase(challanNo.trim()))
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"PORCP","BILL_NO",conn,
xtraParams,"BNO_MISMMATCH_REAS");
insertCnt++;
}
}
if(invDate!=null)
{
if(!billDate.equals(invDate))
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"PORCP","BILL_DATE",conn,
xtraParams,"BDT_MISMMATCH_REAS");
insertCnt++;
}
}
else if(challanDate!=null)
{
if(!billDate.equals(challanDate))
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"PORCP","BILL_DATE",conn,
xtraParams,"BDT_MISMMATCH_REAS");
insertCnt++;
}
}
if(billAmt!=rcpAmt)
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"PORCP","BILL_AMT",conn,
xtraParams,"BAMT_MISMMATCH_REAS");
insertCnt++;
}
}
rs3.close();
rs3=null;
pstmt3.close();
pstmt3=null;
if(voucherBillNo.trim().length()>0)
{
if(!(billNo.trim()).equalsIgnoreCase(voucherBillNo.trim()))
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"VOUCHER","BILL_NO",conn,
xtraParams,"BNO_MISMMATCH_REAS");
insertCnt++;
}
}
if(voucherBillDate!=null)
{ {
//Match the billNo,billDate,billAmt in table PORCP for porderNo if(!billDate.equals(voucherBillDate))
rcpCnt=threeWayMatching(suppBillId,voucherNo,porderNo,receiptNo,billNo,billDate,bllDate,billAmt,"PORCP",conn,xtraParams); {
if(rcpCnt>0){ insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"VOUCHER","BILL_DATE",conn,
voucherDetails.put(suppBillId, voucherNo); xtraParams,"BDT_MISMMATCH_REAS");
rcpCnt=0; insertCnt++;
} }
}
if(billAmt!=vouchAmt)
{
insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,billDate,"VOUCHER","BILL_AMT",conn,
xtraParams,"BAMT_MISMMATCH_REAS");
insertCnt++;
} }
}
}
rs2.close(); rs2.close();
rs2=null; rs2=null;
pstmt2.close(); pstmt2.close();
pstmt2=null; pstmt2=null;
/**
* Check insertCnt
* And Update match_status
* */
System.out.println("%%%%Insert Count is :- ["+insertCnt+"]");
if(insertCnt>0)
{
//Update the status from table SUPPLIER_BILL set MATCH_STATUS to '2', 'Reject'
cnt1=updateStatus(suppBillId,voucherNo,"2",conn);
}
else
{
//Update the status from table SUPPLIER_BILL set MATCH_STATUS to '3', 'MATCH'
cnt1=updateStatus(suppBillId,voucherNo,"3",conn);
}
}
} }
rs1.close(); rs1.close();
rs1=null; rs1=null;
pstmt1.close(); pstmt1.close();
pstmt1=null; pstmt1=null;
//Check HashMap size for match found // //Check HashMap size for match found
System.out.println("VoucherDetails Map size :-["+voucherDetails.size()+"]"); // System.out.println("VoucherDetails Map size :-["+voucherDetails.size()+"]");
if(voucherDetails.size()>0){ // if(voucherDetails.size()>0){
// For VOUCHER confirmation. // // For VOUCHER confirmation.
Set<String> keySet=voucherDetails.keySet(); // Set<String> keySet=voucherDetails.keySet();
//
//iterate keySet // //iterate keySet
for(String key: keySet){ // for(String key: keySet){
System.out.println("Supplier_bill_id :- ["+key+"]"); // System.out.println("Supplier_bill_id :- ["+key+"]");
voucherNo=voucherDetails.get(key); // voucherNo=voucherDetails.get(key);
System.out.println("Voucher No 2 :- ["+voucherNo+"]"); // System.out.println("Voucher No 2 :- ["+voucherNo+"]");
// retString=confirmVoucher("voucher",voucherNo,key,xtraParams,conn); //CONFIRMETION process commented 16/MAR/15 //// retString=confirmVoucher("voucher",voucherNo,key,xtraParams,conn); //CONFIRMETION process commented 16/MAR/15
//
// if(retString!=null && (retString.indexOf("VTSUCC1")>-1)){ //// if(retString!=null && (retString.indexOf("VTSUCC1")>-1)){
// strToWrite = "VOUCHER Confirmation for Tran Id "+voucherNo+" AND supplier bill id :-["+key+"] : \r\n\r\n"; //// strToWrite = "VOUCHER Confirmation for Tran Id "+voucherNo+" AND supplier bill id :-["+key+"] : \r\n\r\n";
cnt1=updateStatus(key,voucherNo,"3",conn); //Update the status from table SUPPLIER_BILL set MATCH_STATUS to '3', 'MATCH' // cnt1=updateStatus(key,voucherNo,"3",conn); //Update the status from table SUPPLIER_BILL set MATCH_STATUS to '3', 'MATCH'
if(cnt1>0){ // if(cnt1>0){
System.out.println("Status update count2 :-["+cnt1+"]"); // System.out.println("Status update count2 :-["+cnt1+"]");
conn.commit(); // conn.commit();
}// Connection commit // }// Connection commit
//// }
// else
// {
// System.out.println("Transaction ROLL BACK At voucher confirm***********");
// strToWrite = "VOUCHER UnConfirmation for Tran Id "+voucherNo+" is : "+retString+" \r\n\r\n";
// conn.rollback(); //Connection roll back
// } // }
else // }
{ // }
System.out.println("Transaction ROLL BACK At voucher confirm***********"); // else
strToWrite = "VOUCHER UnConfirmation for Tran Id "+voucherNo+" is : "+retString+" \r\n\r\n"; // {
conn.rollback(); //Connection roll back // System.out.println("***************No Matching DATA found FINALLY*************");
} // }
}
}
else
{
System.out.println("***************No Matching DATA found FINALLY*************");
}
} }
catch(Exception e) catch(Exception e)
{ {
conn.rollback();
System.out.println(">>>>>>>>>>>>>In catch:"); System.out.println(">>>>>>>>>>>>>In catch:");
e.printStackTrace(); e.printStackTrace();
System.out.println(e); System.out.println(e);
...@@ -220,7 +352,7 @@ public class MatchVoucherConfSch implements Schedule ...@@ -220,7 +352,7 @@ public class MatchVoucherConfSch implements Schedule
{ {
if(conn!=null) if(conn!=null)
{ {
// conn.commit(); conn.commit();
conn.close(); conn.close();
conn=null; conn=null;
} }
...@@ -233,62 +365,62 @@ public class MatchVoucherConfSch implements Schedule ...@@ -233,62 +365,62 @@ public class MatchVoucherConfSch implements Schedule
* return matching count * return matching count
* in tables VOUCHER or PORCP * in tables VOUCHER or PORCP
* */ * */
private int threeWayMatching(String suppBillId, String voucherNo, String porderNo,String receiptNo, String billNo, String billDate,Date bllDate, String billAmt,String tableName, Connection conn, String xtraParams) // private int threeWayMatching(String suppBillId, String voucherNo, String porderNo,String receiptNo, String billNo, String billDate,Date bllDate, String billAmt,String tableName, Connection conn, String xtraParams)
{ // {
int finalCount=0,billNoCnt=0,billAmtCnt=0,billDateCnt=0,failCnt=0; // int finalCount=0,billNoCnt=0,billAmtCnt=0,billDateCnt=0,failCnt=0;
//
if(tableName.equalsIgnoreCase("PORCP")) // if(tableName.equalsIgnoreCase("PORCP"))
{ // {
// billNoCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_NO",billNo,conn); // Change to pordNo to receiptNo //// billNoCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_NO",billNo,conn); // Change to pordNo to receiptNo
// billNoCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_NO",billNo,porderNo,conn); // Add pordNo also 09/JUN/15. //// billNoCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_NO",billNo,porderNo,conn); // Add pordNo also 09/JUN/15.
billNoCnt=matchPORCPField("TRAN_ID",receiptNo,"INVOICE_NO",billNo,porderNo,conn);// Change introduce by S Manoharan 09/JUN/15. // billNoCnt=matchPORCP_Field("TRAN_ID",receiptNo,"INVOICE_NO",billNo,porderNo,conn);// Change introduce by S Manoharan 09/JUN/15.
if(billNoCnt<=0){ // if(billNoCnt<=0){
//Insert mismatch status of PORCP bill_no in table PAY_3WAY_STAT // //Insert mismatch status of PORCP bill_no in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_NO",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_NO",conn,
xtraParams,"BNO_MISMMATCH_REAS"); // xtraParams,"BNO_MISMMATCH_REAS");
} // }
// billDateCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_DATE",billDate,porderNo,conn); //// billDateCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"INVOICE_DATE",billDate,porderNo,conn);
billDateCnt=matchPORCPField("TRAN_ID",receiptNo,"INVOICE_DATE",billDate,porderNo,conn); // billDateCnt=matchPORCP_Field("TRAN_ID",receiptNo,"INVOICE_DATE",billDate,porderNo,conn);
if(billDateCnt<=0){ // if(billDateCnt<=0){
//Insert mismatch status of PORCP bill_date in table PAY_3WAY_STAT // //Insert mismatch status of PORCP bill_date in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_DATE",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_DATE",conn,
xtraParams,"BDT_MISMMATCH_REAS"); // xtraParams,"BDT_MISMMATCH_REAS");
} // }
// billAmtCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"AMOUNT",billAmt,porderNo,conn); //// billAmtCnt=matchTableField("PORCP","TRAN_ID",receiptNo,"AMOUNT",billAmt,porderNo,conn);
billAmtCnt=matchPORCPField("TRAN_ID",receiptNo,"AMOUNT",billAmt,porderNo,conn); // billAmtCnt=matchPORCP_Field("TRAN_ID",receiptNo,"AMOUNT",billAmt,porderNo,conn);
if(billAmtCnt<=0){ // if(billAmtCnt<=0){
//Insert mismatch status of PORCP bill_amt in table PAY_3WAY_STAT // //Insert mismatch status of PORCP bill_amt in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_AMT",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"PORCP","BILL_AMT",conn,
xtraParams,"BAMT_MISMMATCH_REAS"); // xtraParams,"BAMT_MISMMATCH_REAS");
} // }
} // }
else // else
{ // {
billNoCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_NO", billNo,porderNo, conn); // Add pordNo also 09/JUN/15. // billNoCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_NO", billNo,porderNo, conn); // Add pordNo also 09/JUN/15.
if(billNoCnt<=0){ // if(billNoCnt<=0){
//Insert mismatch status of VOUCHER bill_no in table PAY_3WAY_STAT // //Insert mismatch status of VOUCHER bill_no in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_NO",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_NO",conn,
xtraParams,"BNO_MISMMATCH_REAS"); // xtraParams,"BNO_MISMMATCH_REAS");
} // }
billDateCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_DATE", billDate,porderNo, conn); // billDateCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_DATE", billDate,porderNo, conn);
if(billDateCnt<=0){ // if(billDateCnt<=0){
//Insert mismatch status of VOUCHER bill_date in table PAY_3WAY_STAT // //Insert mismatch status of VOUCHER bill_date in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_DATE",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_DATE",conn,
xtraParams,"BDT_MISMMATCH_REAS"); // xtraParams,"BDT_MISMMATCH_REAS");
} // }
// billAmtCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_AMT", billAmt, conn); //// billAmtCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "BILL_AMT", billAmt, conn);
billAmtCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "NET_AMT", billAmt,porderNo, conn);//Changed by Manoj dtd 11/06/2015 to match with net_amt // billAmtCnt=matchTableField("VOUCHER","TRAN_ID",voucherNo, "NET_AMT", billAmt,porderNo, conn);//Changed by Manoj dtd 11/06/2015 to match with net_amt
if(billAmtCnt<=0){ // if(billAmtCnt<=0){
//Insert mismatch status of VOUCHER bill_amt in table PAY_3WAY_STAT // //Insert mismatch status of VOUCHER bill_amt in table PAY_3WAY_STAT
failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_AMT",conn, // failCnt=insertMismatchReason(suppBillId,voucherNo,porderNo,billNo,bllDate,"VOUCHER","BILL_AMT",conn,
xtraParams,"BAMT_MISMMATCH_REAS"); // xtraParams,"BAMT_MISMMATCH_REAS");
} // }
} // }
if(billNoCnt>0 && billDateCnt>0 && billAmtCnt>0){ // if(billNoCnt>0 && billDateCnt>0 && billAmtCnt>0){
finalCount=1; // finalCount=1;
} // }
return finalCount; // return finalCount;
} // }
private String checkNull(String str) private String checkNull(String str)
{ {
if(str == null) if(str == null)
...@@ -302,7 +434,7 @@ public class MatchVoucherConfSch implements Schedule ...@@ -302,7 +434,7 @@ public class MatchVoucherConfSch implements Schedule
} }
private int insertMismatchReason(String suppBillId, String voucherNo, String porderNo, String billNo, Date billDate, String tableName, private int insertMismatchReason(String suppBillId, String voucherNo, String porderNo, String billNo, Timestamp billDate, String tableName,
String fieldName, Connection conn,String xtraParams, String finParam) String fieldName, Connection conn,String xtraParams, String finParam)
{ {
int insertCnt=0,updateCnt=0; int insertCnt=0,updateCnt=0;
...@@ -469,21 +601,21 @@ public class MatchVoucherConfSch implements Schedule ...@@ -469,21 +601,21 @@ public class MatchVoucherConfSch implements Schedule
// pstmt.close(); // pstmt.close();
// pstmt=null; // pstmt=null;
if (retString.indexOf("Success") > -1) // if (retString.indexOf("Success") > -1)
{ // {
System.out.println("suppBillId at mismatch status update :--["+suppBillId+"]"); // System.out.println("suppBillId at mismatch status update :--["+suppBillId+"]");
updateCnt+=updateStatus(suppBillId,voucherNo,"2",conn); //Update the status from table SUPPLIER_BILL set MATCH_STATUS to '2' as REJECTED // updateCnt+=updateStatus(suppBillId,voucherNo,"2",conn); //Update the status from table SUPPLIER_BILL set MATCH_STATUS to '2' as REJECTED
if(updateCnt>0) // if(updateCnt>0)
{ // {
System.out.println("Connection commit at not matching **********"); // System.out.println("Connection commit at not matching **********");
conn.commit(); //Connection commit // conn.commit(); //Connection commit
} // }
else // else
{ // {
System.out.println("Connection roll back at not matching ***********"); // System.out.println("Connection roll back at not matching ***********");
conn.rollback(); //Connection roll back // conn.rollback(); //Connection roll back
} // }
} // }
} }
catch(SQLException sqlE){ catch(SQLException sqlE){
sqlE.printStackTrace(); sqlE.printStackTrace();
...@@ -602,7 +734,7 @@ public class MatchVoucherConfSch implements Schedule ...@@ -602,7 +734,7 @@ public class MatchVoucherConfSch implements Schedule
* the record with table PORCP and PORCPDET * the record with table PORCP and PORCPDET
* 09/JUN/15 * 09/JUN/15
* */ * */
private int matchPORCPField(String fieldName1, String fieldValue1, String fieldName2, String fieldValue2,String porderNo, Connection conn) private int matchPORCP_Field(String fieldName1, String fieldValue1, String fieldName2, String fieldValue2,String porderNo, Connection conn)
{ {
int cnt=0; int cnt=0;
String sql=""; String sql="";
......
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