Commit c2c6f017 authored by prane's avatar prane

sql to consider salesforecast data for demand for Mesmer

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@202644 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1836e868
select distinct item_code from (
select distinct item.item_code__plan as item_code
FROM independent_demand, item ,siteitem
where ( independent_demand.item_code = item.item_code )
and ( independent_demand.site_code in ('@sitecode@') )
and ( item.item_code__plan >= '@itemcodefr@')
and ( item.item_code__plan <= '@itemcodeto@')
and (siteitem.site_code = independent_demand.site_code)
and siteitem.item_code = case when item.item_code__plan is null then item.item_code else item.item_code__plan end
and case when siteitem.master_sch is null then 'Y' else siteitem.master_sch end <> 'N'
and (siteitem.mfg_type not in ('O','D') )
and ( independent_demand.due_date >= to_date('@fromdate@'))
and ( independent_demand.due_date <= to_date('@todate@'))
and ( case when independent_demand.status is null then 'C' else independent_demand.status end <> 'P')
and ( independent_demand.quantity__std_uom <> 0)
union all
SELECT distinct item.item_code__plan as item_code
FROM salesforecast_det d,salesforecast_hdr h, item
WHERE ( h.tran_id = d.tran_id )
and ( d.item_code = item.item_code )
and ( h.site_code in ('@sitecode@') )
and ( item.item_code__plan >= '@itemcodefr@')
and ( item.item_code__plan <= '@itemcodeto@')
and ( (select fr_date from period where code = d.PRD_CODE__FOR) >= to_date('@fromdate@'))
and ( (select to_date from period where code = d.PRD_CODE__FOR) <= to_date('@todate@'))
and ( 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') )
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