Commit 56ff7d30 authored by vkadam's avatar vkadam

Change in SQL of PORCP and PORCPDET matching.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98079 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1ac081f8
...@@ -240,19 +240,22 @@ public class MatchVoucherConfSch implements Schedule ...@@ -240,19 +240,22 @@ public class MatchVoucherConfSch implements Schedule
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=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=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=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,
...@@ -593,6 +596,61 @@ public class MatchVoucherConfSch implements Schedule ...@@ -593,6 +596,61 @@ public class MatchVoucherConfSch implements Schedule
} }
return s; return s;
} }
/**
* Change Introduce by S Manoharan.
* This method Match
* the record with table PORCP and PORCPDET
* 09/JUN/15
* */
private int matchPORCP_Field(String fieldName1, String fieldValue1, String fieldName2, String fieldValue2,String porderNo, Connection conn)
{
int cnt=0;
String sql="";
PreparedStatement pstmt = null;
ResultSet rs = null;
Timestamp bllDate = null,amddate=null;
java.util.Date tempDt = new java.util.Date();
try{
if(fieldName2.equalsIgnoreCase("BILL_DATE")||fieldName2.equalsIgnoreCase("INVOICE_DATE"))
{
SimpleDateFormat sdfDb= new SimpleDateFormat(genericUtility.getDBDateFormat());
tempDt=sdfDb.parse(fieldValue2);
bllDate = java.sql.Timestamp.valueOf( sdfDb.format(tempDt)+" 00:00:00.0");
}
// sql ="select count(*) as cnt from "+tableName+" where "+fieldName1+"=? AND "+fieldName2+"=? AND PURC_ORDER=?"; // Add pordNo also 09/JUN/15.
sql ="select count(*) as cnt from PORCP p,PORCPDET pd where p.TRAN_ID=pd.TRAN_ID AND p."+fieldName1+"=? AND p."+fieldName2+"=? AND pd.PURC_ORDER=?"; // Add pordNo also 09/JUN/15.
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fieldValue1);
if(fieldName2.equalsIgnoreCase("BILL_DATE")||fieldName2.equalsIgnoreCase("INVOICE_DATE"))
{
pstmt.setTimestamp(2,bllDate);
}
else
{
pstmt.setString(2,fieldValue2);
}
pstmt.setString(3, porderNo);
rs = pstmt.executeQuery();
while (rs.next())
{
cnt=rs.getInt("cnt");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
catch(SQLException sqlE){
sqlE.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
System.out.println("@@New SQLin PORCP is :-----"+sql);
System.out.println("Matching Count is :- ["+cnt+"]");
return cnt;
}
/** /**
* The method match single field * The method match single field
* in respective table * in respective table
......
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