Commit 41a494a4 authored by prane's avatar prane

edited line no in select 'NA' instead of ' '

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217971 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c8fa22b7
select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,line_no,tran_ser ,site_code from
(
SELECT independent_demand.tran_id,' ' as line_no, 'I-DEM' as tran_ser,item.item_code__plan as item_code,independent_demand.due_date as due_date,
SELECT independent_demand.tran_id,'NA' as line_no, 'I-DEM' as tran_ser,item.item_code__plan as item_code,independent_demand.due_date as due_date,
sum(case when independent_demand.quantity__std_uom is null then 0 else independent_demand.quantity__std_uom end) as demand,
0 as supply , independent_demand.site_code
FROM independent_demand, item
......@@ -19,7 +19,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT dist_demand.tran_id,' ' as line_no, 'D-DEM' as tran_ser, item.item_code__plan as item_code,dist_demand.due_date as due_date,
SELECT dist_demand.tran_id,'NA' as line_no, 'D-DEM' as tran_ser, item.item_code__plan as item_code,dist_demand.due_date as due_date,
sum(case when dist_demand.qty_required is null then 0 else dist_demand.qty_required end ) as demand ,
0 as supply, dist_demand.site_code
FROM dist_demand, item
......@@ -36,7 +36,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT h.TRAN_ID, ' ' as line_no, '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, 'NA' as line_no, 'S-FST' as tran_ser, item.item_code__plan as item_code,fn_get_prdfrdate(d.PRD_CODE__FOR) as due_date,
sum(case when d.quantity is null then 0 else d.quantity end ) as demand ,
0 as supply, h.SITE_CODE
FROM salesforecast_det d,salesforecast_hdr h, item
......@@ -55,7 +55,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT sales_demand.tran_id, ' ' as line_no, 'S-DEM' as tran_ser, item.item_code__plan as item_code, sales_demand.due_date as due_date,
SELECT sales_demand.tran_id, 'NA' as line_no, 'S-DEM' as tran_ser, 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,
0 as supply, sales_demand.site_code
FROM sales_demand, item
......@@ -115,7 +115,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT IND_NO tran_id, ' ' as line_no, 'IND' as tran_ser ,item.item_code__plan as item_code,indent.req_date as due_date, 0 as demand ,
SELECT IND_NO tran_id, 'NA' as line_no, 'IND' as tran_ser ,item.item_code__plan as item_code,indent.req_date as due_date, 0 as demand ,
sum(case when (case when indent.quantity is null then 0 else indent.quantity end - case when indent.ord_qty is null then 0 else indent.ord_qty end) < 0 then 0 else case
when indent.quantity is null then 0 else indent.quantity end - case when indent.ord_qty is null then 0 else indent.ord_qty end end ) as supply, indent.site_code as site_code
FROM indent,item
......@@ -155,7 +155,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT 'NA' as tran_id, ' ' as line_no, 'STK' as tran_ser, case when d.item_code__plan is null then d.item_code else d.item_code__plan end as item_code, FN_MRP_DUEDATE(to_date('01-JAN-20')) as due_date, 0 as demand,
SELECT 'NA' as tran_id, 'NA' as line_no, 'STK' as tran_ser, case when d.item_code__plan is null then d.item_code else d.item_code__plan end as item_code, FN_MRP_DUEDATE(to_date('01-JAN-20')) as due_date, 0 as demand,
(a.quantity-a.alloc_qty) as supply, a.site_code
FROM STOCK a, INVSTAT b , LOCATION c,item d
WHERE a.loc_code = c.loc_code
......@@ -173,7 +173,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT workorder.work_order as tran_id,' ' as line_no, 'W-ORD' as tran_ser,item.item_code__plan as item_code,
SELECT workorder.work_order as tran_id,'NA' as line_no, 'W-ORD' as tran_ser,item.item_code__plan as item_code,
workorder.due_date as due_date, 0 as demand,
sum((case when workorder.current_batch_qty is null then 0 else workorder.current_batch_qty end * case when workorder.yield_perc is null then 100 else workorder.yield_perc end / 100 ) - case when workorder.quantity__rcvd is null then 0 else workorder.quantity__rcvd end ) as supply, workorder.site_code
FROM workorder, item
......@@ -194,7 +194,7 @@ select item_code, due_date, sum(demand) demand , sum(supply) supply, tran_id,lin
UNION ALL
SELECT workorder_bill.work_order as tran_id,' ' as line_no,case when rtrim(siteitem.supp_sour) = 'M' then 'W-BIL' when rtrim(siteitem.supp_sour) = 'P' then 'Indend' else '???' end as tran_ser, workorder_bill.item_code as item_code, workorder.due_date as due_date,
SELECT workorder_bill.work_order as tran_id,'NA' as line_no,case when rtrim(siteitem.supp_sour) = 'M' then 'W-BIL' when rtrim(siteitem.supp_sour) = 'P' then 'Indend' else '???' end as tran_ser, workorder_bill.item_code as item_code, workorder.due_date as due_date,
sum(case when workorder_bill.QUANTITY is null then 0 else workorder_bill.QUANTITY end - case when (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end - case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end) < 0
then case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end else case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end end ) as demand,
0 as supply, workorder.site_code
......
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