Commit 726e2baf authored by smanohar's avatar smanohar

Changes for existence of demand for item

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@196145 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4fc5cf70
select item_code,due_date, round(sum(demand)+ fn_get_sampleqty(item_code ,'@sitecode@' ),0) demand , sum(supply) supply, sum(stock_qty) stock_qty, sum(oth_supply) oth_supply, sum(pending_po) pending_po ,sum(pending_do) pending_do, sum(pending_indent) pending_indent, sum(pending_dr) pending_dr from select distinct item.item_code__plan as item_code
( FROM independent_demand, item ,siteitem
SELECT item.item_code__plan as item_code,independent_demand.due_date as due_date, where ( independent_demand.item_code = item.item_code )
sum(fn_get_avgpotency('@itemcode@' ,'@sitecode@' ,case when independent_demand.quantity__std_uom is null then 0 else independent_demand.quantity__std_uom end)) as demand , and ( independent_demand.site_code in ('@sitecode@') )
0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr and ( item.item_code__plan >= '@itemcodefr@')
FROM independent_demand, item and ( item.item_code__plan <= '@itemcodeto@')
WHERE ( independent_demand.item_code = item.item_code ) and and (siteitem.site_code = independent_demand.site_code))
( independent_demand.site_code in ('@sitecode@') ) AND and siteitem.item_code = case when item.item_code__plan is null then item.item_code else item.item_code__plan end
( item.item_code__plan = '@itemcode@') AND and case when siteitem.master_sch is null then 'Y' else siteitem.master_sch end <> 'N'
( independent_demand.due_date >= to_date('@fromdate@')) AND and (siteitem.mfg_type not in ('O','D') )
( independent_demand.due_date <= to_date('@todate@')) and and ( independent_demand.due_date >= to_date('@fromdate@'))
( case when independent_demand.status is null then 'C' else independent_demand.status end <> 'P') and ( independent_demand.due_date <= to_date('@todate@'))
Group By item.item_code__plan,independent_demand.due_date and ( case when independent_demand.status is null then 'C' else independent_demand.status end <> 'P')
) and ( independent_demand.quantity__std_uom <> 0)
group by item_code,due_date
having sum(demand) <> 0 or sum(supply) <> 0 \ No newline at end of file
select sale_order,line_no,item_code,due_date, demand, 0 supply, 0 stock_qty, 0 oth_supply, select distinct CASE WHEN item.item_code__plan is null then item.item_code else item.item_code__plan end as item_code
0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr,site_code from FROM sorder,sorditem, item, siteitem
( WHERE ( sorditem.item_code = item.item_code )
SELECT sorditem.sale_order,sorditem.line_no,item.item_code__plan as item_code,sorditem.due_date as due_date, and (sorder.sale_order = sorditem.sale_order )
((case when sorditem.quantity is null then 0 else sorditem.quantity end - case when sorditem.qty_alloc is null then 0 else sorditem.qty_alloc end - case when sorditem.qty_desp is null then 0 else sorditem.qty_desp end ) * case when sorditem.conv__qty_stdqty is null then 1 else sorditem.conv__qty_stdqty end ) as demand, and (case when sorder.confirmed is null then 'N' else sorder.confirmed end = 'Y' )
0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr , sorditem.site_code and (case when sorditem.consume_fc is null then 'Y' else sorditem.consume_fc end = 'N' )
FROM sorder,sorditem, item and (sorditem.site_code in ('@sitecode@') )
WHERE ( sorditem.item_code = item.item_code ) and
(sorder.sale_order = sorditem.sale_order ) and and (item.item_code__plan >= '@itemcodefr@')
(case when sorder.confirmed is null then 'N' else sorder.confirmed end = 'Y' ) and and (item.item_code__plan <= '@itemcodeto@')
(case when sorditem.consume_fc is null then 'Y' else sorditem.consume_fc end = 'N' ) and and (siteitem.site_code = sorditem.site_code)
(sorditem.site_code in ('@sitecode@') ) AND and siteitem.item_code = case when item.item_code__plan is null then item.item_code else item.item_code__plan end
(item.item_code__plan = '@itemcode@') AND and case when siteitem.master_sch is null then 'Y' else siteitem.master_sch end <> 'N'
(sorditem.due_date >= to_date('@fromdate@')) and and (siteitem.mfg_type in ('O','D'))
(sorditem.due_date <= to_date('@todate@')) and and (sorditem.due_date >= to_date('@fromdate@'))
( case when sorder.status is null then 'P' else sorder.status end = 'P') and and (sorditem.due_date <= to_date('@todate@'))
( sorder.order_type not in ('S') ) and ( case when sorder.status is null then 'P' else sorder.status end = 'P')
and trim(nvl((select si.mfg_type from siteitem si where si.site_code = sorditem.site_code and si.item_code = item.item_code ),' ')) in ('O','D') and ( sorder.order_type not in (@ordtypes@) )
and ((CASE WHEN SORDITEM.QUANTITY IS NULL THEN 0 ELSE SORDITEM.QUANTITY END and trim(nvl((select si.mfg_type from siteitem si where si.site_code = sorditem.site_code and si.item_code = item.item_code ),' ')) in ('O','D')
- CASE WHEN SORDITEM.QTY_ALLOC IS NULL THEN 0 ELSE SORDITEM.QTY_ALLOC END and ((CASE WHEN SORDITEM.QUANTITY IS NULL THEN 0 ELSE SORDITEM.QUANTITY END - CASE WHEN SORDITEM.QTY_ALLOC IS NULL THEN 0 ELSE SORDITEM.QTY_ALLOC END - CASE WHEN SORDITEM.QTY_DESP IS NULL THEN 0 ELSE SORDITEM.QTY_DESP END ) * CASE WHEN SORDITEM.CONV__QTY_STDQTY IS NULL THEN 1 ELSE SORDITEM.CONV__QTY_STDQTY END ) > 0 ;
- CASE WHEN SORDITEM.QTY_DESP IS NULL THEN 0 ELSE SORDITEM.QTY_DESP END )
* CASE WHEN SORDITEM.CONV__QTY_STDQTY IS NULL THEN 1 ELSE SORDITEM.CONV__QTY_STDQTY END ) >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