Commit e5c4985e authored by vkadam's avatar vkadam

Add condition on supplier_bill as status='Y' and Update bill_no, bill_date and...

Add condition on supplier_bill as status='Y' and Update bill_no, bill_date and bill_recd_date in table VOUCHER.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98133 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4797a9a1
......@@ -60,7 +60,7 @@ public class MatchVoucherConfSch implements Schedule
String suppCode="";
double rcpAmt=0;
String invNo="",challanNo="";
Timestamp invDate=null,challanDate=null,billDate=null,voucherBillDate=null;
Timestamp invDate=null,challanDate=null,billDate=null,voucherBillDate=null,billRcvDate=null;
double billAmt=0,vouchAmt=0;
try
{
......@@ -100,8 +100,9 @@ public class MatchVoucherConfSch implements Schedule
System.out.println("childNodeListLength !!!!!"+childNodeListLength);
SimpleDateFormat sdfDb= new SimpleDateFormat(genericUtility.getDBDateFormat());
sql1 = "select TRAN_ID as supplier_bill_id,PORDER_NO,BILL_NO,BILL_AMT,BILL_DATE,VOUCHER_NO,SUPP_CODE "
+ " 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
sql1 = "select TRAN_ID as supplier_bill_id,PORDER_NO,BILL_NO,BILL_AMT,BILL_DATE,VOUCHER_NO,SUPP_CODE,BILL_RCVD_DT "
+ " 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
+ " AND STATUS='Y'";// VALLABH KADAM Check for status='Y' 23/JUN/15
pstmt1 = conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
while (rs1.next())
......@@ -113,14 +114,15 @@ public class MatchVoucherConfSch implements Schedule
billAmt=rs1.getDouble("BILL_AMT");
voucherNo=checkNull(rs1.getString("VOUCHER_NO"));
suppCode=rs1.getString("SUPP_CODE");
billRcvDate=rs1.getTimestamp("BILL_RCVD_DT"); //SELECT bill_rcvd_date 22/JUN/15
System.out.println("&&&&Supplier Bill Tran Id:- ["+suppBillId+"]");
System.out.println("&&&&Supplier Bill Voucher No:- ["+voucherNo+"]");
insertCnt=0; //Insert Count set to 0
if(voucherNo==null || voucherNo.trim().length()<=0){
if(voucherNo==null || voucherNo.trim().length()<=0)
{
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);
......@@ -139,9 +141,13 @@ public class MatchVoucherConfSch implements Schedule
System.out.println("Voucher No from VOUCHER :- ["+voucherNo+"]");
/**UPDATE voucherNo in table 'SUPPLIER_BILL'*/
if(checkNull(voucherNo).trim().length()>0)
{
/**
* UPDATE voucherNo
* in table 'SUPPLIER_BILL'
* */
sql5 = "UPDATE SUPPLIER_BILL set VOUCHER_NO=? WHERE TRAN_ID=?";
pstmt5 = conn.prepareStatement(sql5);
pstmt5.setString(1,checkNull(voucherNo).trim());
......@@ -149,6 +155,22 @@ public class MatchVoucherConfSch implements Schedule
pstmt5.executeUpdate();
pstmt5.close();
pstmt5 = null;
/**
* UPDATE table 'VOUCHER'
* set [bill_no], [bill_date], [bill_recd_date]
* for found voucherNo
* 23/JUN/15
* */
sql5 = "UPDATE VOUCHER SET BILL_NO=?, BILL_DATE=?, BILL_RECD_DATE=? WHERE TRAN_ID=?";
pstmt5 = conn.prepareStatement(sql5);
pstmt5.setString(1,checkNull(billNo).trim());
pstmt5.setTimestamp(2,billDate);
pstmt5.setTimestamp(3,billRcvDate);
pstmt5.setString(4,checkNull(voucherNo).trim());
pstmt5.executeUpdate();
pstmt5.close();
pstmt5 = null;
}
}
if(voucherNo.trim().length()>0)
......@@ -734,188 +756,188 @@ public class MatchVoucherConfSch implements Schedule
* 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");
}
// 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
// * in respective table
// * and return matching count
// * */
// private int matchTableField(String tableName, 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
* in respective table
* and return matching count
* */
private int matchTableField(String tableName, 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.
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 SQL is :-----"+sql);
System.out.println("Matching Count is :- ["+cnt+"]");
return cnt;
}
// 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 SQL is :-----"+sql);
// System.out.println("Matching Count is :- ["+cnt+"]");
// return cnt;
// }
/**
* The method get voucherNo as tranId
* call confirm voucher
* */
public String confirmVoucher(String objName,String tranId,String suppBillId,String xtraParams,Connection conn){
int cnt=0,cnt1=0;
String methodName = "",compName = "",compType="",retString = "",serviceCode = "",serviceURI = "",actionURI = "";
String forcedFlag="N";
String sql;
PreparedStatement pstmt=null;
ResultSet rs = null;
System.out.println("********************In confirm voucher **************");
try
{
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,objName);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
compType = rs.getString("COMP_TYPE");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("serviceCode = "+serviceCode+" compName "+compName+" compType "+compType);
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,serviceCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("serviceURI = "+serviceURI+" compName = "+compName);
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[5];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_type"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compType);
aobj[1] = new String(compName);
aobj[2] = new String(tranId);
aobj[3] = new String(xtraParams);
aobj[4] = new String(forcedFlag);
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println(">>>>Confirm Complete Return string from NVO is:==>["+retString+"]");
}
catch (Exception eX)
{
eX.printStackTrace();
}
return retString;
}
// public String confirmVoucher(String objName,String tranId,String suppBillId,String xtraParams,Connection conn){
// int cnt=0,cnt1=0;
// String methodName = "",compName = "",compType="",retString = "",serviceCode = "",serviceURI = "",actionURI = "";
// String forcedFlag="N";
// String sql;
// PreparedStatement pstmt=null;
// ResultSet rs = null;
// System.out.println("********************In confirm voucher **************");
// try
// {
// methodName = "gbf_post";
// actionURI = "http://NvoServiceurl.org/" + methodName;
//
// sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm'";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,objName);
// rs = pstmt.executeQuery();
// if ( rs.next() )
// {
// serviceCode = rs.getString("SERVICE_CODE");
// compName = rs.getString("COMP_NAME");
// compType = rs.getString("COMP_TYPE");
// }
// rs.close();
// rs=null;
// pstmt.close();
// pstmt=null;
// System.out.println("serviceCode = "+serviceCode+" compName "+compName+" compType "+compType);
//
// sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,serviceCode);
// rs = pstmt.executeQuery();
// if ( rs.next() )
// {
// serviceURI = rs.getString("SERVICE_URI");
// }
// rs.close();
// rs=null;
// pstmt.close();
// pstmt=null;
// System.out.println("serviceURI = "+serviceURI+" compName = "+compName);
//
// Service service = new Service();
// Call call = (Call)service.createCall();
// call.setTargetEndpointAddress(new java.net.URL(serviceURI));
// call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
// call.setUseSOAPAction(true);
// call.setSOAPActionURI(actionURI);
// Object[] aobj = new Object[5];
//
// call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_type"), XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
//
// aobj[0] = new String(compType);
// aobj[1] = new String(compName);
// aobj[2] = new String(tranId);
// aobj[3] = new String(xtraParams);
// aobj[4] = new String(forcedFlag);
//
// System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
// call.setReturnType(XMLType.XSD_STRING);
// retString = (String)call.invoke(aobj);
// System.out.println(">>>>Confirm Complete Return string from NVO is:==>["+retString+"]");
// }
// catch (Exception eX)
// {
// eX.printStackTrace();
// }
// return retString;
// }
/**
* The method update the status
* from table SUPPLIER_BILL
......
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