Commit a1480d49 authored by vkadam's avatar vkadam

The voucher are selected and confirmed according to entered tran date.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98572 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ba9e0b16
......@@ -9,6 +9,7 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import javax.xml.rpc.ParameterMode;
......@@ -44,17 +45,58 @@ public class ConfVouchChPartnerSch implements Schedule
{
Document dom = null;
String xtraParams = "",siteList="";
int childNodeListLength = 0;
String childNodeName = null;
String voucher_date="",sysDate="";
NodeList parentNodeList = null,childNodeList = null;
Node parentNode = null,childNode = null;
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
Node currDetail = null ;
int noOfParam=0;
System.out.println("@V@ scheduleParamXML["+scheduleParamXML+"]");
userInfo = new ibase.utility.UserInfoBean( scheduleParamXML );
loginSiteCode = userInfo.getSiteCode();
System.out.println("@V@ IntializingLog "+ intializingLog("Chnl_Ptr_VouchConf_log"));
System.out.println("@V@ Log in Site code"+loginSiteCode+"]");
xtraParams = "loginEmpCode="+userInfo.getEmpCode()+"~~loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode;
dom=genericUtility.parseString(scheduleParamXML);
// java.util.Date today=new java.util.Date();
// Calendar cal = Calendar.getInstance();
// cal.setTime(today);
// today = cal.getTime();
// SimpleDateFormat sdf=new SimpleDateFormat(genericUtility.getApplDateFormat());
// sysDate=sdf.format(today);
NodeList paramList = dom.getElementsByTagName( "SCHEDULE" );
noOfParam = paramList.getLength();
parentNodeList = dom.getElementsByTagName("ACTUALPARAMETERS");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("@V@ CshildNodeListLength :-["+childNodeListLength+"]");
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName!=null && !"#text".equalsIgnoreCase(childNodeName))
{
if(ctr==0)
{
voucher_date = childNode.getFirstChild().getNodeValue();
}
}
}
System.out.println("@V@ Voucher_date :-"+voucher_date);
voucherConfirm(xtraParams);
voucherConfirm(voucher_date,xtraParams);
}
catch (Exception e)
......@@ -126,7 +168,7 @@ public class ConfVouchChPartnerSch implements Schedule
}
return input;
}
public void voucherConfirm(String xtraParams) throws ITMException
public void voucherConfirm(String voucher_date,String xtraParams) throws ITMException
{
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
......@@ -136,12 +178,36 @@ public class ConfVouchChPartnerSch implements Schedule
String sql="";
String tranId="",retString="";
int cnt=0;
Timestamp vDt=null;
String tranDate="01/04/15";
try
{
vDt = Timestamp.valueOf(genericUtility.getValidDateString(voucher_date,genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat())+ " 00:00:00.0");
System.out.println("@V@ Tran Date 1:-["+vDt+"]");
} catch (Exception e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Timestamp ts=null;
// Date d=new Date(tranDate);
// if(d!=null){
// ts=new java.sql.Timestamp(d.getTime());
// }
System.out.println("@V@ Tran Date :-["+vDt+"]");
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sql="SELECT DISTINCT A.TRAN_ID FROM VOUCHER A,VOUCHRCP B,PORCP C,SUPPLIER D"
+ " WHERE A.TRAN_ID=B.TRAN_ID AND B.PRCP_ID=C.TRAN_ID"
+ " AND A.TRAN_DATE >= ?"
+ " AND A.SUPP_CODE=D.SUPP_CODE"
+ " AND A.SITE_CODE IN (select site_code from site where site_code__cons LIKE '%__600')"
+ " AND A.SITE_CODE NOT IN(SELECT case when var_value is null then ' ' else var_value END"
......@@ -150,9 +216,19 @@ public class ConfVouchChPartnerSch implements Schedule
+ " AND( ( C.reciept_type ='F' and C.tran_ser='P-RCP' ) or ( C.ret_opt ='C' and C.tran_ser='P-RET') )"
+ " AND D.CHANNEL_PARTNER='Y'";
pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, vDt);
rs=pstmt.executeQuery();
if(!rs.next())
{
System.out.println("@V@ No record found");
fos1.write(("No records found ").getBytes());
}
else
{
System.out.println("@V@ Record found");
while(rs.next())
{
cnt++;
tranId=rs.getString("tran_id");
System.out.println("@V@ Voucher TranId :- ["+tranId+"]");
fos1.write(("Purchase Voucher Tran Id is:: [" + tranId +"]\r\n").getBytes());
......@@ -161,10 +237,13 @@ public class ConfVouchChPartnerSch implements Schedule
System.out.println("@V@ Voucher TranId :-["+tranId+" confirm return string :- ["+retString+"]");
fos1.write(("Status is:: [" + retString +"]\r\n").getBytes());
}
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("@V@ Iteration count :-["+cnt+"]");
}catch(Exception e)
{
e.printStackTrace();
......@@ -290,8 +369,6 @@ public class ConfVouchChPartnerSch implements Schedule
finally
{
try{
if (pstmt != null )
{
pstmt.close();
......
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