Commit 367398ff authored by agaikwad's avatar agaikwad

select from date and to date in period code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106604 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2625b9af
......@@ -5,6 +5,7 @@ Button Name : Process
package ibase.webitm.ejb.gstclient;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.sql.*;
......@@ -26,6 +27,7 @@ import javax.naming.InitialContext;
public class RcpAdvTaxcalcPrc extends ProcessEJB implements RcpAdvTaxcalcPrcLocal,RcpAdvTaxcalcPrcRemote //SessionBean
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
E12GenericUtility genericUtility = new E12GenericUtility();
public String process() throws RemoteException,ITMException
{
return "";
......@@ -337,6 +339,49 @@ public String process(Document dom,Document dom1,String windowName,String xtraPa
date = sdf.parse(toDate);
dateTo = java.sql.Timestamp.valueOf(sdf1.format(date).toString() + " 00:00:00.0");
int cnt=0;
Timestamp frmDatePrdTemp=null,frmDatePrd=null,todatePrd=null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
System.out.println("frDate:"+frDate);
Calendar preCalc = Calendar.getInstance();
System.out.println("preCalc::"+preCalc);
preCalc.setTime( getDateObject( frDate ) );
//preCalc.add( Calendar.MONTH , -1);
preCalc.add( Calendar.DAY_OF_MONTH, 0);
java.util.Date prvDate = preCalc.getTime();
System.out.println("prvDate:"+prvDate);
String trandate = simpleDateFormat.format( prvDate );
String trandate1 = genericUtility.getValidDateString(trandate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
frmDatePrdTemp = java.sql.Timestamp.valueOf(trandate1 + " 00:00:00.00");
System.out.println("trandate:"+trandate);
sql = "SELECT FR_DATE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE " ;
System.out.println("sqlCnt : [" +sql+ "]");
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,frmDatePrdTemp);
rs = pstmt.executeQuery();
if (rs.next())
{
frmDatePrd = rs.getTimestamp("FR_DATE");
System.out.println("frmDatePrd ::::"+frmDatePrd);
sql1 = "SELECT TO_DATE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE " ;
System.out.println("sqlCnt : [" +sql1+ "]");
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setTimestamp(1,frmDatePrd);
rs1 = pstmt1.executeQuery();
if ( rs1.next())
{
todatePrd = rs1.getTimestamp("TO_DATE");
}
pstmt1.close();
pstmt1 = null;
rs1.close();
rs1 = null;
System.out.println("todatePrd::::"+todatePrd);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
sql=" select count(1) from ADV_RCP_TAX where confirmed='N' and tran_date between ? and ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, dateFrom);
......@@ -964,4 +1009,20 @@ private double getAdjust(Double input)
System.out.println("inputTemp["+inputTemp+"]");
return inputTemp;
}
public java.util.Date getDateObject(String date) throws RemoteException,ITMException
{
java.util.Date dat = null;
DateFormat df = null;
try
{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
dat = simpleDateFormat.parse(date);
System.out.println("dat::::"+dat);
}
catch(Exception e)
{
System.out.println("Exception :ValidatorEJB :getDateObject :==>\n"+e.getMessage()); //$NON-NLS-1$
}
return dat;
}
}
\ No newline at end of file
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