Commit 3e4bb0d1 authored by pshinde's avatar pshinde

Source code for post save for Period Table Generation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100086 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1d5a0737
...@@ -1224,13 +1224,20 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P ...@@ -1224,13 +1224,20 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
} }
public boolean getPeriod(String prdCode,String prdTblNo,String frDate, String toDate,String prdClose ,String addDate, Connection conn) throws ITMException public boolean getPeriod(String prdCode,String prdTblNo,String frDate, String toDate,String prdClose ,String addDate, Connection conn) throws ITMException
{ {
System.out.println("Enter in getPeriod "); System.out.println("Enter in getPeriod ");
ResultSet rs=null; ResultSet rs=null;
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
String childNodeName = null;
String errCode = "";
int ctr = 0;
int childNodeListLength=0;
int parentNodeListLength = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
SimpleDateFormat sdf =null; SimpleDateFormat sdf =null;
Timestamp currDate = null,fromDate=null,tooDate=null,addDat=null; Timestamp currDate = null,fromDate=null,tooDate=null,addDat=null;
String sql="",errorString=""; String sql="",errorString="";
...@@ -1245,6 +1252,9 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P ...@@ -1245,6 +1252,9 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
Timestamp frmDateSTr=null,toDateTmstmp=null,frmTimeStamp=null; Timestamp frmDateSTr=null,toDateTmstmp=null,frmTimeStamp=null;
ibase.utility.E12GenericUtility genericUtility = null; ibase.utility.E12GenericUtility genericUtility = null;
genericUtility = new ibase.utility.E12GenericUtility(); genericUtility = new ibase.utility.E12GenericUtility();
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
// String sql="",errorString="";
try try
{ {
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
...@@ -1262,108 +1272,31 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P ...@@ -1262,108 +1272,31 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
System.out.println("Date to be set frmTimeStamp@@@@@@@==="+frmTimeStamp); System.out.println("Date to be set frmTimeStamp@@@@@@@==="+frmTimeStamp);
sql="select count(1) from period_tbl where prd_code= ? and prd_tblno= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, prdTblNo);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
System.out.println("CNT==="+cnt);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("cnt in period_tbl==="+cnt);
if(cnt>0) //if(cnt>0)
{ // {
sql="select fr_date from period_tbl where ? between fr_date and to_date and prd_tblno= ? "; sql="select count(1) from period_tbl where ? between fr_date and to_date and prd_code!= ? and prd_tblno= ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, addDat); pstmt.setTimestamp(1, frmTimeStamp);
pstmt.setString(2, prdTblNo); pstmt.setString(2, prdCode);
pstmt.setString(3, prdTblNo);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
fromDt = rs.getDate("fr_date"); cnt=rs.getInt(1);
System.out.println("fromDt==="+fromDt);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
Date getDate=utilMethod.RelativeDate(fromDt, -1); System.out.println("Cnt====="+cnt);
System.out.println("getDate========"+getDate); if(cnt>0)
{
String dateFrm = sdf.format(getDate); periodStaus= true;;
System.out.println("Due Date Max======"+dateFrm); }
frmDateSTr = Timestamp.valueOf(genericUtility.getValidDateString(dateFrm, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); System.out.println("periodStaus==="+periodStaus);
System.out.println("Date to be set as frmDateSTr@@@@@@@==="+frmDateSTr);
sql="select prd_code from period_tbl where ? between fr_date and to_date and prd_tblno= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateSTr);
pstmt.setString(2, prdTblNo);
rs=pstmt.executeQuery();
if(rs.next())
{
prdCodeNew = rs.getString("prd_code");
System.out.println("prdCodeNew==="+prdCodeNew);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(prdCodeNew!=null && prdCodeNew.trim().length()>0)
{
sql="select to_date from period_tbl where prd_code=? and prd_tblno= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCodeNew);
pstmt.setString(2, prdTblNo);
rs=pstmt.executeQuery();
if(rs.next())
{
toDateNew = rs.getDate("to_date");
System.out.println("prdCodeNew==="+prdCodeNew);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("toDateNew===="+toDateNew);
String dateTo = sdf.format(toDateNew);
System.out.println("dateTo test====="+dateTo);
toDateTmstmp = Timestamp.valueOf(genericUtility.getValidDateString(dateTo, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("Date to be set as toDateTmstmp@@@@@@@==="+toDateTmstmp);
//toDateTmstmp frmDateSTr
// if(tooDate.compareTo(fromDate)<0)
// if(frmDateSTr.compareTo(toDateTmstmp)<0)
if(frmTimeStamp.before(toDateTmstmp))
{
System.out.println("frmDateSTr.compareTo(toDateTmstmp)<0");
periodStaus=true;
}
else
{
System.out.println("ELSE ++++++++");
}
}
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1416,6 +1349,8 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P ...@@ -1416,6 +1349,8 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
} }
} }
......
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