Commit 16ddc76d authored by kdabholkar's avatar kdabholkar

changed in delete functionality.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@181108 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b684032f
...@@ -233,39 +233,83 @@ public class GstClearDataPrc extends ProcessEJB implements GstClearDataPrcLocal, ...@@ -233,39 +233,83 @@ public class GstClearDataPrc extends ProcessEJB implements GstClearDataPrcLocal,
return retString; return retString;
} }
} }
/* Changed by Kaustubh on 26 feb 2018 start
* To change the delete query, now delete work on prd_code
* */
//sql = "DELETE FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' and REC_TYPE= ? AND SITE_CODE= ? AND DOC_DATE BETWEEN ? AND ? " ;
sql = "DELETE FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' and REC_TYPE= ? AND SITE_CODE= ? AND DOC_DATE BETWEEN ? AND ? " ; if("0".equalsIgnoreCase(type))
pstmt = connGST.prepareStatement(sql);
if ("S".equalsIgnoreCase(type))
{
pstmt.setString(1, "1");
}
else
{
pstmt.setString(1, "2");
}
pstmt.setString(2,sitecode);
pstmt.setTimestamp(3,fromDate);
pstmt.setTimestamp(4,toDate);
hdrCount = pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(hdrCount > 0)
{ {
errorMessage.append("\n All pending data cleared successfully ! No Of records deleted "+hdrCount);
sql = "DELETE FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' and rec_type <> ? and site_code= ? and prd_code = ? " ;
pstmt = connGST.prepareStatement(sql);
pstmt.setString(1,"4");
pstmt.setString(2,sitecode);
pstmt.setString(3,period);
hdrCount = pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(hdrCount > 0)
{
errorMessage.append("\n All pending data cleared successfully ! No Of records deleted "+hdrCount);
}
else
{
errorMessage.append("\n No Pending Records found for clear operation !!!");
}
} }
else else
{ {
errorMessage.append("\n No Pending Records found for clear operation !!!");
sql = "DELETE FROM GST_DATA_HDR WHERE SUBMIT_STATUS ='P' and rec_type= ? and site_code= ? and prd_code = ? " ;
pstmt = connGST.prepareStatement(sql);
if ("S".equalsIgnoreCase(type))
{
pstmt.setString(1, "1");
}
else if("P".equalsIgnoreCase(type))
{
pstmt.setString(1, "2");
}
else
{
pstmt.setString(1, type);
}
pstmt.setString(2,sitecode);
pstmt.setString(3,period);
hdrCount = pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(hdrCount > 0)
{
errorMessage.append("\n All pending data cleared successfully ! No Of records deleted "+hdrCount);
}
else
{
errorMessage.append("\n No Pending Records found for clear operation !!!");
}
} }
/* Changed by Kaustubh on 26 feb 2018 end */
} }
catch(Exception e) catch(Exception e)
{ {
......
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