Commit 2538ad59 authored by prane's avatar prane

added spaces in sql

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@213515 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 441df9ce
......@@ -8,8 +8,7 @@ select item.item_code, inv_dem_supp.due_date , sum(inv_dem_supp.demand_QTY) dem
sum(case when inv_dem_supp.REF_SER = 'IND' then inv_dem_supp.SUPPLY_QTY else 0 end) pending_indent,
0 pending_dr, inv_dem_supp.ref_id as tran_id, inv_dem_supp.ref_ser as tran_ser, inv_dem_supp.site_code
from inv_dem_supp, item
where
( inv_dem_supp.item_code = item.item_code )
where ( inv_dem_supp.item_code = item.item_code )
and ( inv_dem_supp.site_code in ('@sitecode@') )
AND ( item.item_code__plan = '@itemcode@')
AND ( inv_dem_supp.REF_SER in ('I-DEM','D-DEM','S-DEM','S-FST','IND') )
......@@ -40,7 +39,7 @@ AND ( inv_dem_supp.due_date <= to_date('@todate@'))
group by item.item_code, case when inv_dem_supp.REF_SER in ('W-ORD','W-BIL') then to_date('@fromdate@') else inv_dem_supp.due_date end,
inv_dem_supp.ref_id, inv_dem_supp.ref_ser, inv_dem_supp.site_code
union all
UNION ALL
select item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,
0 demand ,
......@@ -57,7 +56,7 @@ where ( inv_dem_supp.item_code = item.item_code )
and ( inv_dem_supp.site_code in ('@sitecode@') )
AND ( item.item_code__plan = '@itemcode@')
AND ( inv_dem_supp.REF_SER in ('STK') )
group by item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@')), inv_dem_supp.ref_id, inv_dem_supp.ref_ser, inv_dem_supp.site_code
GROUP BY item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@')), inv_dem_supp.ref_id, inv_dem_supp.ref_ser, inv_dem_supp.site_code
UNION ALL
......@@ -76,7 +75,7 @@ SELECT item.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@'))
( invtrace.tran_date <= to_date('@rundate@')) and
( invtrace.ref_ser in ('D-ISS','S-DSP') ) and
trim(nvl((select si.mfg_type from siteitem si where si.site_code = invtrace.site_code and si.item_code = invtrace.item_code ),' ')) not in ('O','D')
Group By item.item_code__plan, invtrace.ref_id||'@'||invtrace.ref_line, invtrace.ref_ser, invtrace.site_code
GROUP BY item.item_code__plan, invtrace.ref_id||'@'||invtrace.ref_line, invtrace.ref_ser, invtrace.site_code
)
group by item_code,due_date,tran_id,tran_ser,site_code
having sum(demand) <> 0 or sum(supply) <> 0
GROUP BY item_code,due_date,tran_id,tran_ser,site_code
HAVING sum(demand) <> 0 or sum(supply) <> 0
......@@ -13,8 +13,7 @@ sum(inv_dem_supp.SUPPLY_QTY) supply,
sum(case when inv_dem_supp.REF_SER = 'IND' then inv_dem_supp.SUPPLY_QTY else 0 end) pending_indent,
0 pending_dr
from inv_dem_supp, item
where
( inv_dem_supp.item_code = item.item_code )
where ( inv_dem_supp.item_code = item.item_code )
and ( inv_dem_supp.site_code in ('@sitecode@') )
AND ( item.item_code__plan = '@itemcode@')
AND ( inv_dem_supp.REF_SER in ('I-DEM','D-DEM','S-DEM','S-FST','IND') )
......@@ -32,7 +31,7 @@ sum(inv_dem_supp.SUPPLY_QTY) supply,
0 stock_qty,
0 oth_supply,
sum(case when inv_dem_supp.REF_SER = 'P-ORD' then inv_dem_supp.SUPPLY_QTY else 0 end) pending_po,
sum(case when inv_dem_supp.REF_SER = 'D-ORDI' then inv_dem_supp.SUPPLY_QTY else 0 end) pending_do,
sum(case when inv_dem_supp.REF_SER = 'D-ORDI' then inv_dem_supp.demand_QTY else 0 end) pending_do,
0 pending_indent,
sum(case when inv_dem_supp.REF_SER = 'D-ORDR' then inv_dem_supp.SUPPLY_QTY else 0 end) pending_dr
from inv_dem_supp, item
......@@ -43,7 +42,7 @@ AND ( inv_dem_supp.REF_SER in ('P-ORD','D-ORDI','D-ORDR','W-ORD','W-BIL') )
AND ( inv_dem_supp.due_date <= to_date('@todate@'))
group by item.item_code, case when inv_dem_supp.REF_SER in ('W-ORD','W-BIL') then to_date('@fromdate@') else inv_dem_supp.due_date end
union all
UNION ALL
select item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,
0 demand ,
......@@ -54,12 +53,12 @@ sum(inv_dem_supp.SUPPLY_QTY) stock_qty,
0 pending_do,
0 pending_indent,
0 pending_dr
from inv_dem_supp, item
where ( inv_dem_supp.item_code = item.item_code )
and ( inv_dem_supp.site_code in ('@sitecode@') )
FROM inv_dem_supp, item
WHERE ( inv_dem_supp.item_code = item.item_code )
AND ( inv_dem_supp.site_code in ('@sitecode@') )
AND ( item.item_code__plan = '@itemcode@')
AND ( inv_dem_supp.REF_SER in ('STK') )
group by item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@'))
GROUP BY item.item_code, FN_MRP_DUEDATE(to_date('@fromdate@'))
UNION ALL
......@@ -77,8 +76,8 @@ SELECT item.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@'))
( invtrace.tran_date <= to_date('@rundate@')) and
( invtrace.ref_ser in ('D-ISS','S-DSP') ) and
trim(nvl((select si.mfg_type from siteitem si where si.site_code = invtrace.site_code and si.item_code = invtrace.item_code ),' ')) not in ('O','D')
Group By item.item_code__plan,invtrace.tran_date
GROUP BY item.item_code__plan,invtrace.tran_date
)
group by item_code,due_date
having sum(demand) <> 0 or sum(supply) <> 0
GROUP BY item_code,due_date
HAVING sum(demand) <> 0 or sum(supply) <> 0
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