Commit efe9b5aa authored by prane's avatar prane

added spcaes

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@202704 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bc889ac9
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
( sales_demand.due_date >= to_date('@fromdate@')) AND ( sales_demand.due_date >= to_date('@fromdate@')) AND
( sales_demand.due_date <= to_date('@todate@')) AND ( sales_demand.due_date <= to_date('@todate@')) AND
( 0 = @madetostock@ ) ( 0 = @madetostock@ )
Group By sales_demand.tran_id,'S-FCT',item.item_code__plan,sales_demand.due_date Group By sales_demand.tran_id,'S-FCT',item.item_code__plan,sales_demand.due_date
UNION ALL
UNION ALL
SELECT h.tran_id, 'S-FST' as tran_ser, item.item_code__plan as item_code,fn_get_prdfrdate(d.PRD_CODE__FOR) as due_date, SELECT h.tran_id, 'S-FST' as tran_ser, item.item_code__plan as item_code,fn_get_prdfrdate(d.PRD_CODE__FOR) as due_date,
sum(fn_get_avgpotency('@itemcode@' ,'@sitecode@',case when d.quantity is null then 0 else d.quantity end )) as demand , sum(fn_get_avgpotency('@itemcode@' ,'@sitecode@',case when d.quantity is null then 0 else d.quantity end )) as demand ,
0 as supply 0 as supply
...@@ -37,8 +39,9 @@ UNION ALL ...@@ -37,8 +39,9 @@ UNION ALL
( (select to_date from period where code = d.PRD_CODE__FOR) <= to_date('@todate@')) AND ( (select to_date from period where code = d.PRD_CODE__FOR) <= to_date('@todate@')) AND
( 0 = @madetostock@ ) ( 0 = @madetostock@ )
and trim(nvl((select si.mfg_type from siteitem si where si.site_code = h.site_code and si.item_code = item.item_code ),' ')) not in ('O','D') and trim(nvl((select si.mfg_type from siteitem si where si.site_code = h.site_code and si.item_code = item.item_code ),' ')) not in ('O','D')
Group By h.TRAN_ID, 'S-FST', item.item_code__plan,fn_get_prdfrdate(d.PRD_CODE__FOR) Group By h.TRAN_ID, 'S-FST', item.item_code__plan,fn_get_prdfrdate(d.PRD_CODE__FOR)
UNION ALL UNION ALL
SELECT distorder.dist_order||'@'||distorder_det.line_no tran_id, 'Dist Order' as tran_ser, item.item_code__plan as item_code,distorder_det.due_date as due_date, SELECT distorder.dist_order||'@'||distorder_det.line_no tran_id, 'Dist Order' as tran_ser, item.item_code__plan as item_code,distorder_det.due_date as due_date,
sum(case when qty_confirm is null then 0 else qty_confirm end - case when qty_shipped is null then 0 else qty_shipped end) as demand, sum(case when qty_confirm is null then 0 else qty_confirm end - case when qty_shipped is null then 0 else qty_shipped end) as demand,
0 as supply 0 as supply
...@@ -90,7 +93,7 @@ UNION ALL ...@@ -90,7 +93,7 @@ UNION ALL
Group By porder.purc_order||'@'||porddet.line_no,'Purchase Order',item.item_code__plan,porddet.dlv_date Group By porder.purc_order||'@'||porddet.line_no,'Purchase Order',item.item_code__plan,porddet.dlv_date
UNION ALL UNION ALL
SELECT '' as tran_id, '' as tran_ser, item.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date, SELECT '' as tran_id, '' as tran_ser, item.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,
0 as demand , 0 as demand ,
DDF_INV_CLSTK_MRP('@sitecode@',item.item_code,to_date(fn_sysdate())) as supply DDF_INV_CLSTK_MRP('@sitecode@',item.item_code,to_date(fn_sysdate())) as supply
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
( independent_demand.due_date >= to_date('@fromdate@')) AND ( independent_demand.due_date >= to_date('@fromdate@')) AND
( independent_demand.due_date <= to_date('@todate@')) and ( independent_demand.due_date <= to_date('@todate@')) and
( case when independent_demand.status is null then 'C' else independent_demand.status end <> 'P') ( case when independent_demand.status is null then 'C' else independent_demand.status end <> 'P')
Group By item.item_code__plan,independent_demand.due_date Group By item.item_code__plan,independent_demand.due_date
UNION ALL UNION ALL
SELECT item.item_code__plan as item_code,sales_demand.due_date as due_date, SELECT item.item_code__plan as item_code,sales_demand.due_date as due_date,
sum(case when sales_demand.quantity__std_uom is null then 0 else sales_demand.quantity__std_uom end - case when sales_demand.consumed_qty is null then 0 else sales_demand.consumed_qty end ) as demand, sum(case when sales_demand.quantity__std_uom is null then 0 else sales_demand.quantity__std_uom end - case when sales_demand.consumed_qty is null then 0 else sales_demand.consumed_qty end ) as demand,
0 as supply 0 as supply
...@@ -25,6 +27,7 @@ ...@@ -25,6 +27,7 @@
Group By item.item_code__plan,sales_demand.due_date Group By item.item_code__plan,sales_demand.due_date
UNION ALL UNION ALL
SELECT item.item_code__plan as item_code,fn_get_prdfrdate(d.PRD_CODE__FOR) as due_date, SELECT item.item_code__plan as item_code,fn_get_prdfrdate(d.PRD_CODE__FOR) as due_date,
sum(fn_get_avgpotency('@itemcode@' ,'@sitecode@',case when d.quantity is null then 0 else d.quantity end )) as demand , sum(fn_get_avgpotency('@itemcode@' ,'@sitecode@',case when d.quantity is null then 0 else d.quantity end )) as demand ,
0 as supply 0 as supply
......
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