You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.5 KiB
Plaintext
69 lines
1.5 KiB
Plaintext
Select
|
|
T.Contract Site
|
|
,T.ACCOUNTING_GROUP
|
|
,T.C_RESIN_TYPE Resin
|
|
,T.PART_NO
|
|
,T.PART_UOM "UOM"
|
|
,T.PART_DESC
|
|
,round(sum(T.TOTAL_USE),0) "Usage"
|
|
,round(sum(T.TOTAL_SCRAP),0) "Scrap"
|
|
,round(sum(T.TOTAL_USE),0)+round(sum(T.TOTAL_SCRAP),0) "Usage and Scrap"
|
|
|
|
from
|
|
(
|
|
Select
|
|
IPL.CONTRACT
|
|
,IP.ACCOUNTING_GROUP
|
|
,IP.C_RESIN_TYPE
|
|
,IPL.PART_NO
|
|
,IPL.PART_UOM
|
|
,IPL.PART_DESC
|
|
,IPL.TOTAL_USE
|
|
,0 "TOTAL_SCRAP"
|
|
|
|
From
|
|
IFSINFO.IPL_SHOP_MATERIAL_USE IPL
|
|
inner join Inventory_Part IP on IPL.Contract=IP.Contract and IPL.PART_NO=IP.PART_NO
|
|
|
|
Where
|
|
(IPL.CONTRACT LIKE '%&Site%' )
|
|
and IPL.DATED between TO_DATE('&DATE_FROM','YYYY-MM-DD') AND TO_DATE ('&DATE_TO','YYYY-MM-DD') +1
|
|
and IFSAPP.Technical_Object_Reference_API.Get_Technical_Class_With_Key('PartCatalog','PART_NO=' || IPL.PART_NO || '^') in ('00005','00001')
|
|
|
|
UNION ALL
|
|
|
|
Select
|
|
S.CONTRACT
|
|
,IP2.ACCOUNTING_GROUP
|
|
,IP2.C_RESIN_TYPE
|
|
,S.PART_NO
|
|
,S.PART_UOM
|
|
,S.PART_DESC
|
|
,0 "TOTAL_USE"
|
|
,S.TOTAL_SCRAP
|
|
|
|
From
|
|
IFSINFO.IPL_SHOP_MATERIAL_SCRAP S
|
|
inner join Inventory_Part IP2 on S.Contract=IP2.Contract and S.PART_NO=IP2.PART_NO
|
|
|
|
Where
|
|
|
|
S.CONTRACT LIKE '%&Site%'
|
|
|
|
and S.DATED between TO_DATE('&DATE_FROM','YYYY-MM-DD') AND TO_DATE ('&DATE_TO','YYYY-MM-DD') +1
|
|
and IFSAPP.Technical_Object_Reference_API.Get_Technical_Class_With_Key('PartCatalog','PART_NO=' || S.PART_NO || '^') in ('00005','00001')
|
|
) T
|
|
|
|
Group By
|
|
T.Contract
|
|
,T.ACCOUNTING_GROUP
|
|
,T.C_RESIN_TYPE
|
|
,T.PART_NO
|
|
,T.PART_UOM
|
|
,T.PART_DESC
|
|
|
|
Order by
|
|
T.ACCOUNTING_GROUP desc
|
|
,T.C_RESIN_TYPE
|
|
,round(sum(T.TOTAL_USE),0)+round(sum(T.TOTAL_SCRAP),0) desc
|
|
,T.PART_NO |