Commit b0b54255 authored by smestry's avatar smestry

Changed the sql for Stock Schedule.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100388 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7be1d705
......@@ -146,6 +146,10 @@ public class DDUpdStockSchedule implements Schedule
ResultSet rs = null;
PreparedStatement pstmt = null;
String sql="";
// Changed by Sneha on 11-03-2016, added try, catch and finally block [Start]
try
{
// Changed by Sneha on 11-03-2016, added try, catch and finally block [End]
File newFile = new File(sFileName);
if(newFile.exists())
newFile.createNewFile();
......@@ -164,6 +168,8 @@ public class DDUpdStockSchedule implements Schedule
pstmt.setString(2, "GRL");
pstmt.setString(3, "PGRL");*/
// Changed by Sneha on 11-03-2016, Change the sql [Start]
/*
sql="SELECT S.ITEM_CODE,SUM(S.QUANTITY) - (CASE WHEN SUM(S.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(S.ALLOC_QTY) END + CASE WHEN SUM(S.HOLD_QTY) IS NULL THEN 0 ELSE SUM(S.HOLD_QTY) END) AS QUANTITY "
+ "FROM STOCK S,ITEM I WHERE INV_STAT NOT IN (?,?,?,?) AND S.ITEM_CODE = I.ITEM_CODE "
+ "AND I.ACTIVE = 'Y' GROUP BY I.ACTIVE, S.ITEM_CODE";
......@@ -172,9 +178,25 @@ public class DDUpdStockSchedule implements Schedule
pstmt.setString(2, "ISTAG");
pstmt.setString(3, "NOSL");
pstmt.setString(4, "INTR");
*/
sql = " select A.Item_code, A.stk_qty- Nvl(H.Order_QTY,0) FinStk from (select stk.Item_code, sum(quantity-Alloc_Qty-Hold_qty) stk_qty "
+ " from stock Stk group by stk.Item_code) A left outer join (select G.item_code,G.Order_QTY from (select item_code, Sum(Quantity) Order_QTY, "
+ " (select sum(quantity) from stock Stk where stk.Item_code = S.Item_code) as Stock_Qty from sorddet S, Sorder SO "
+ " where SO.Sale_order=S.Sale_order and SO.Confirmed = ? and SO.Status not in (?, ?) and "
+ " (select count(1) from sordalloc a where a.sale_order = s.sale_order and Trim(s.line_no) = Trim(a.line_no)) = 0 and S.status not in (?, ?) "
+ " group by item_code) G ) H on A.Item_code = H.Item_code ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setString(2, "X");
pstmt.setString(3, "C");
pstmt.setString(4, "X");
pstmt.setString(5, "C");
// Changed by Sneha on 11-03-2016, Change the sql [End]
//Changed by Samadhan D15IKAT004 on 10/12/2015 for getting Record Not in 'DOCK','ISTAG','NOSL','INTR' as per nilay and shailesh sir End
rs = pstmt.executeQuery();
while(rs.next())
{
//Changed by Samadhan D14HKAT002 on 10/06/2015 from upload file on katdev.com. start
......@@ -203,8 +225,29 @@ public class DDUpdStockSchedule implements Schedule
writer.flush();
writer.close();
// Changed by Sneha on 11-03-2016, added try, catch and finally block [Start]
}
catch(Exception e)
{
System.out.println("Exception in generateCsvFile ::::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
// Changed by Sneha on 11-03-2016, added try, catch and finally block [End]
}
//Changed by Samadhan D14HKAT002 on 10/06/2015 from upload file on katdev.com. start
......
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