Commit 27494337 authored by kdabholkar's avatar kdabholkar

commited new changes of Clear GSTn data

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@163234 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 81f5a0fd
......@@ -112,6 +112,8 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
ResultSet rs = null, rsSelHdr= null, rsSelDet = null;
String period = "", type = "", sql = "",retString = "",prdcode = "";
int newType = 0;
String newtype;
//java.sql.Timestamp currDate = null;
boolean isError = false;
......@@ -122,10 +124,10 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
int cnt = 0;
String monthStr = "",yearStr = "", fromDateStr = "", toDateStr = "", prcType = "";
String monthStr = "",yearStr = "", fromDateStr = "", toDateStr = "", prcType = "", sitecode="" ;
int month = 0, year = 0;
boolean isNumeric = false;
int prdCnt = 0 , synDataCount= 0;
int prdCnt = 0 , synDataCount= 0, siteCnt=0;
try
{
......@@ -133,11 +135,11 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
long startTime = System.currentTimeMillis();
System.out.println("START TIME FOR GST DATA POPULATION PROCESS IN SECONDS:::["+startTime/1000+"]");
connGST = getConnection();
/*connDriverGST = new ConnDriver();
// connGST = getConnection();
connDriverGST = new ConnDriver();
connGST = connDriverGST.getConnectDB("DriverITM"); //will be changed as DriverITM as using stddbtest database for testing temporary
connGST.setAutoCommit(false);
connDriverGST = null;*/
connDriverGST = null;
/*connDriverLocal = new ConnDriver();
connLocal = connDriverLocal.getConnectDB("DriverITM");
......@@ -189,8 +191,9 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
fromDateStr = genericUtility.getColumnValue("from_date",headerDom);
toDateStr = genericUtility.getColumnValue("to_date",headerDom);
prcType = genericUtility.getColumnValue("prc_type",headerDom);
sitecode= genericUtility.getColumnValue("site_code",headerDom);
System.out.println("Login SiteCode["+loginSiteCode+"] PrdCode["+period+"] Type["+type+"] ProcessType[::"+prcType+"]" );
System.out.println("Login SiteCode["+loginSiteCode+"] PrdCode["+period+"] Type["+type+"] ProcessType[::"+prcType+"] sitecode["+sitecode+"]" );
if(period == null || period.trim().length() == 0)
{
......@@ -8082,7 +8085,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" ' ' as DOC_NO, " //changed by kaustubh 27 july 2017
+" ' ' as DOC_DATE, " //changed by kaustubh 27 july 2017
+" i.tran_date as DOC_DATE, " //changed by kaustubh 27 july 2017
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
......@@ -8311,7 +8314,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" ' ' as DOC_NO, " //changed by kaustubh 27 july 2017
+" ' ' as DOC_DATE, " //changed by kaustubh 27 july 2017
+" i.tran_date as DOC_DATE, " //changed by kaustubh 27 july 2017
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
......@@ -8554,7 +8557,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" ' ' as DOC_NO, " //changed by kaustubh 27 july 2017
+" ' ' as DOC_DATE, " // changed by kaustubh 27 july 2017
+" i.tran_date as DOC_DATE, " // changed by kaustubh 27 july 2017
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
......@@ -8819,7 +8822,7 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
+" '' as DOC_CHECKSUM,"
+" 'R' as DOC_TYPE, "
+" ' ' as DOC_NO, " //changed by kaustubh 27 july 2017
+" ' ' as DOC_DATE, " //changed by kaustubh 27 july 2017
+" i.tran_date as DOC_DATE, " //changed by kaustubh 27 july 2017
+" 0 as AMOUNT, "
+" 'N' as REVERSE_CHRG, "
+" ' ' as LR_NO, "
......@@ -14947,11 +14950,67 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
}
//}
}
/*Clear functionality*/
else if("C".equalsIgnoreCase(prcType))
{
sql = "DELETE FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' ";
System.out.println("sitecode::"+sitecode);
if(sitecode == null || sitecode.trim().length() == 0)
{
//retString = itmDBAccessEJB.getErrorString("","INVPRD","","",connLocal);
retString = itmDBAccessEJB.getErrorString("","VTBLNKSIT","","",connGST);
return retString;
}
//sql = "SELECT COUNT(1) AS CNT FROM SITE WHERE SITE_CODE = ?";
sql="SELECT COUNT(1) AS CNT FROM SITEREGNO WHERE REG_NO= ? AND ref_code='OPTNG_SITE' ";
pstmt = connGST.prepareStatement(sql);
pstmt.setString(1, sitecode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCnt = rs.getInt("CNT");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
System.out.println("sitecnt=::"+siteCnt);
if (siteCnt == 0)
{
System.out.println("Site code not found in site master");
retString = itmDBAccessEJB.getErrorString("","CNDSITINV","","",connGST);
return retString;
}
// sql = "delete FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' and rec_type= ? and site_code= ? and doc_date between ? and ? " ; changed on 15 sep 2017
sql = "delete FROM GST_DATA_HDR WHERE rec_type= ? and site_code= ? and doc_date between ? and ? " ;
pstmt = connGST.prepareStatement(sql);
if ("S".equalsIgnoreCase(type))
{
pstmt.setInt(1, 1);
}
else
{
pstmt.setInt(1, 2);
}
pstmt.setString(2,sitecode);
pstmt.setTimestamp(3,fromDate);
pstmt.setTimestamp(4,toDate);
int hdrCount = pstmt.executeUpdate();
......@@ -18790,13 +18849,13 @@ public class GstDataPrc extends ProcessEJB implements GstDataPrcLocal,GstDataPrc
//refDateInv="02-08-2017"
if (! ("11(A.1)".equalsIgnoreCase(tranSer) || "11(A.2)".equalsIgnoreCase(tranSer) || "11(B.1)".equalsIgnoreCase(tranSer) || "11(B.2)".equalsIgnoreCase(tranSer)))
/*if (! ("11(A.1)".equalsIgnoreCase(tranSer) || "11(A.2)".equalsIgnoreCase(tranSer) || "11(B.1)".equalsIgnoreCase(tranSer) || "11(B.2)".equalsIgnoreCase(tranSer)))
{
docDate = rsSelHdr.getTimestamp("DOC_DATE");
}
}*/ /* commented on 15 sep 2017 */
docDate = rsSelHdr.getTimestamp("DOC_DATE");
//gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connLocal) );
gstTranId = ( generateTranId( "w_gstr", loginSiteCode, currDateStr, connGST) );
System.out.println("Tran ID generated for tranSer ["+tranSer+"] ["+gstTranId+"]");
......
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