Compare commits
14 Commits
29a2840f58
...
addac381af
| Author | SHA1 | Date |
|---|---|---|
|
|
addac381af | 6 months ago |
|
|
f573dfd4aa | 6 months ago |
|
|
ee931b2b3d | 6 months ago |
|
|
2f00307c9b | 6 months ago |
|
|
ee75b95d1d | 6 months ago |
|
|
3eef6b6611 | 6 months ago |
|
|
11121375c1 | 6 months ago |
|
|
713cb81bb4 | 6 months ago |
|
|
4e5154792b | 6 months ago |
|
|
b343184028 | 6 months ago |
|
|
e6978e28cc | 6 months ago |
|
|
78c5698012 | 6 months ago |
|
|
e35bd9cb2c | 6 months ago |
|
|
32c8f0a8f6 | 6 months ago |
@ -0,0 +1,58 @@
|
||||
SELECT CF$_SITE as "Plant",
|
||||
CF$_YEAR as "Year",
|
||||
CF$_PERIOD as "Month",
|
||||
CF$_CUSTOMER as "Customer Number",
|
||||
Customer_Group_API.Get_Description(CUST_ORD_CUSTOMER_API.Get_Cust_Grp(CF$_CUSTOMER)) "Cust Stat Group",
|
||||
CUSTOMER_INFO_API.Get_Name(CF$_CUSTOMER) as "Customer Name",
|
||||
CF$_SALES_PART_NO as "Part Number",
|
||||
Sales_Part_API.Get_Catalog_Desc(CF$_SITE, CF$_SALES_PART_NO) as "Part Description",
|
||||
CF$_BUDGETED_QUANTITY as "Budget Sales (qty)",
|
||||
CF$_BUDGETED_SALES_REVENUE as "Budget Sales ($)",
|
||||
|
||||
(SELECT SUM(INVOICED_QTY)
|
||||
from CUST_ORD_INVO_STAT stat
|
||||
where EXTRACT(YEAR FROM TO_DATE(INVOICE_DATE)) = CF$_YEAR
|
||||
AND EXTRACT(MONTH FROM TO_DATE(INVOICE_DATE)) = CF$_PERIOD
|
||||
AND CUSTOMER_NO = CF$_CUSTOMER
|
||||
AND PART_NO = CF$_SALES_PART_NO) "Invoiced Sales (Qty)",
|
||||
|
||||
(SELECT SUM(NET_AMOUNT)
|
||||
from CUST_ORD_INVO_STAT stat
|
||||
where EXTRACT(YEAR FROM TO_DATE(INVOICE_DATE)) = CF$_YEAR
|
||||
AND EXTRACT(MONTH FROM TO_DATE(INVOICE_DATE)) = CF$_PERIOD
|
||||
AND CUSTOMER_NO = CF$_CUSTOMER
|
||||
AND PART_NO = CF$_SALES_PART_NO) "Invoiced Sales ($)",
|
||||
|
||||
(SELECT SUM(BUY_QTY_DUE)
|
||||
from CUSTOMER_ORDER_JOIN stat
|
||||
where EXTRACT(YEAR FROM TO_DATE(PLANNED_DELIVERY_DATE)) = CF$_YEAR
|
||||
AND EXTRACT(MONTH FROM TO_DATE(PLANNED_DELIVERY_DATE)) =
|
||||
CF$_PERIOD
|
||||
AND CUSTOMER_NO = CF$_CUSTOMER
|
||||
AND STATE NOT IN ('Cancelled', 'Invoiced/Closed')
|
||||
AND PART_NO = CF$_SALES_PART_NO) "Open Orders (Qty)",
|
||||
|
||||
(SELECT SUM(Customer_Order_Line_API.Get_Base_Sale_Price_Total(ORDER_NO,
|
||||
LINE_NO,
|
||||
REL_NO,
|
||||
LINE_ITEM_NO))
|
||||
from CUSTOMER_ORDER_JOIN stat
|
||||
where EXTRACT(YEAR FROM TO_DATE(PLANNED_DELIVERY_DATE)) = CF$_YEAR
|
||||
AND EXTRACT(MONTH FROM TO_DATE(PLANNED_DELIVERY_DATE)) =
|
||||
CF$_PERIOD
|
||||
AND CUSTOMER_NO = CF$_CUSTOMER
|
||||
AND STATE NOT IN ('Cancelled', 'Invoiced/Closed')
|
||||
AND PART_NO = CF$_SALES_PART_NO) "Open Orders ($)"
|
||||
|
||||
FROM IPL_SALES_BUDGET_CLV sbc
|
||||
WHERE to_date(CF$_PERIOD || '/' || '01' || '/' || CF$_YEAR, 'MM/DD/YYYY') between
|
||||
TO_DATE('&Valid_From', 'MM/DD/YYYY') and
|
||||
TO_DATE('&Valid_To', 'MM/DD/YYYY')
|
||||
AND sbc.cf$_Site LIKE NVL('&COMPANY', '%')
|
||||
AND CUST_ORD_CUSTOMER_API.Get_Cust_Grp(sbc.CF$_CUSTOMER) LIKE
|
||||
NVL('&CUST_GRP', '%')
|
||||
AND sbc.CF$_CUSTOMER LIKE nvl('&CUSTOMER_NO', '%')
|
||||
AND sbc.CF$_SALES_PART_NO LIKE
|
||||
NVL('&CATALOG_NO', '%')
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,104 @@
|
||||
SELECT s.contract,
|
||||
s.DEPARTMENT_NO AS "DEPARTMENT",
|
||||
s.MACHINE_NO AS "MACHINE",
|
||||
s.PART_NO AS "PART NO",
|
||||
ifsapp.Inventory_Part_API.Get_Description(s.contract, s.part_no) AS "ITEM DESCRIPTION",
|
||||
s.ORDER_NO || '-' || s.Release_no || '-' || s.Sequence_no || '-1' AS "LOT BATCH",
|
||||
ifsapp.Shop_Order_Operation_API.Get_Remaining_Qty(s.order_no,
|
||||
s.release_no,
|
||||
s.sequence_no,
|
||||
s.operation_no) AS "SO REMAINING QTY",
|
||||
CASE
|
||||
WHEN HU.max_quantity_capacity IS NOT NULL THEN
|
||||
round(ifsapp.Shop_Order_Operation_API.Get_Remaining_Qty(s.order_no,
|
||||
s.release_no,
|
||||
s.sequence_no,
|
||||
s.operation_no) /
|
||||
HU.max_quantity_capacity,
|
||||
1)
|
||||
ELSE
|
||||
0
|
||||
END AS "SO REMAINING HU",
|
||||
HU.Handling_Unit_type_id AS "HANDLING UNIT"
|
||||
--,ifsapp.Shop_Order_Operation_API.Get_Remaining_Mach_Hours(s.Order_no,s.Release_no,s.Sequence_no,s.Operation_no) Remaning_Hrs
|
||||
,
|
||||
m.PART_NO AS "COMPONENT",
|
||||
i.Description AS "COMPONENT DESCRIPTION",
|
||||
ROUND(nvl(inv.Inv_Floor_Stock, 0), 3) AS "INV FLOOR STOCK",
|
||||
ROUND(m.Qty_Remaining, 3) AS "REMAINING QTY REQUIRED PER LOT/BATCH",
|
||||
ROUND(ifsapp.Shop_Order_Operation_API.Get_Remaining_Mach_Hours(s.Order_no,
|
||||
s.Release_no,
|
||||
s.Sequence_no,
|
||||
s.Operation_no),
|
||||
3) AS "TOTAL SO HOURS",
|
||||
CASE
|
||||
WHEN &Begin_within_x_hours >=
|
||||
ifsapp.Shop_Order_Operation_API.Get_Remaining_Mach_Hours(s.Order_no,
|
||||
s.Release_no,
|
||||
s.Sequence_no,
|
||||
s.Operation_no) THEN
|
||||
ROUND(m.Qty_Remaining, 3)
|
||||
ELSE
|
||||
ROUND(&Begin_within_x_hours * m.Qty_per_assembly *
|
||||
s.mach_run_factor,
|
||||
3) -- check this line for the error
|
||||
END AS "ESTIMATED REQUIRED INVENTORY FOR TIME PERIOD",
|
||||
ROUND(NVL(qty.total_remaining_qty_component, 0), 3) AS "REMAIN QTY REQUIRED PER COMPONENT",
|
||||
round(qty.total_remaining_qty_component -
|
||||
nvl(inv.Inv_Floor_Stock, 0),
|
||||
3) AS "TOTAL QTY TO STAGE PER COMPONENT"
|
||||
/*,m.QTY_Per_Assembly AS "QTY REQUIRED COMPONENT" */,
|
||||
to_char(s.OP_START_DATE, 'YYYY-MM-DD') AS "OP START DATE",
|
||||
to_char(s.OP_FINISH_DATE, 'YYYY-MM-DD') AS "OP FINISH DATE",
|
||||
i.type_Code AS "TYPE CODE",
|
||||
i.ACCOUNTING_GROUP AS "ACCOUNTING CODE",
|
||||
i.PART_PRODUCT_CODE AS "PRODUCT CODE",
|
||||
i.PART_PRODUCT_FAMILY AS " PROD FAMILY",
|
||||
i.CF$_PURCHASE_CAT2 AS "CAT2"
|
||||
|
||||
From ifsapp.SHOP_ORDER_OPERATION_JOIN_cfv s
|
||||
--left join ifsapp.PART_HANDLING_UNIT h on s.part_no=h.part_no and (h.HANDLING_UNIT_TYPE_ID like 'PALLET%' or h.HANDLING_UNIT_TYPE_ID ='BULK-VQR' )
|
||||
inner join ifsapp.SHOP_MATERIAL_ALLOC_UIV m
|
||||
on s.Order_no = m.order_no
|
||||
and s.Release_no = m.release_no
|
||||
and s.Sequence_no = m.sequence_no
|
||||
left join ifsapp.inventory_part_cfv i
|
||||
on i.part_no = m.part_no
|
||||
and i.contract = m.contract
|
||||
left join (Select part_no, contract, sum(qty_onhand) Inv_Floor_Stock
|
||||
from ifsapp.INVENTORY_PART_IN_STOCK_UIV
|
||||
where LOCATION_TYPE in ('Floor stock')
|
||||
group by part_no, contract) inv
|
||||
on inv.contract = i.contract
|
||||
and inv.part_no = i.part_no
|
||||
left join (Select part_no,
|
||||
contract,
|
||||
sum(Qty_Remaining) AS total_remaining_qty_component
|
||||
from ifsapp.SHOP_MATERIAL_ALLOC_UIV
|
||||
where STATE in ('Started', 'Released', 'Reserved')
|
||||
group by part_no, contract) qty
|
||||
ON qty.part_no = m.part_no
|
||||
AND qty.contract = m.contract
|
||||
|
||||
OUTER apply (SELECT *
|
||||
FROM ifsapp.PART_HANDLING_UNIT
|
||||
WHERE Part_no = s.part_no
|
||||
and rownum < 2
|
||||
AND Handling_unit_type_id <> 'CARTON') HU
|
||||
Where s.OPERATION_NO = '10'
|
||||
and s.STATE in ('Started', 'Released', 'Reserved')
|
||||
and i.type_code_db not in ('6')
|
||||
and ifsapp.Shop_Order_Operation_API.Get_Remaining_Qty(s.order_no,
|
||||
s.release_no,
|
||||
s.sequence_no,
|
||||
s.operation_no) > 0
|
||||
and s.Contract = '&[MC--L]Contract'
|
||||
and s.department_no = UPPER('&[MC--L]Department')
|
||||
and s.OP_START_DATE < (sysdate + (&Begin_within_x_hours) / 24)
|
||||
and i.ACCOUNTING_GROUP like nvl('&Accounting_Group', '%')
|
||||
and i.CF$_PURCHASE_CAT2 like nvl('&CAT2', '%')
|
||||
Order By m.part_no,
|
||||
s.DEPARTMENT_NO,
|
||||
s.WORK_CENTER_NO,
|
||||
s.MACHINE_NO,
|
||||
s.OP_START_DATE
|
||||
@ -0,0 +1,364 @@
|
||||
Select *
|
||||
from (Select Customer_No,
|
||||
"Customer Name",
|
||||
Company,
|
||||
Site,
|
||||
E1.Part_No,
|
||||
Label_1,
|
||||
Label_2,
|
||||
Description,
|
||||
Status,
|
||||
Cat1,
|
||||
Cat2,
|
||||
Decoration,
|
||||
Inventory,
|
||||
Incoming_Qty,
|
||||
"Oldest Lot",
|
||||
"Open Order",
|
||||
Safety,
|
||||
"SO Qty",
|
||||
Qty_Not_Reserved "Qty Not Reserved",
|
||||
Remaining_Issue "Rem_Issue",
|
||||
PO "PO Qty",
|
||||
Next_Receipt_Date "PO Next Receipt Date",
|
||||
X_Ref,
|
||||
"X Ref Description",
|
||||
E1.Supersedes,
|
||||
E1.Superseded_By,
|
||||
Related_Supersedes,
|
||||
Related_Superseded
|
||||
from (Select D.Customer_No,
|
||||
CI.Name "Customer Name",
|
||||
D.Contract Site,
|
||||
D.Company,
|
||||
D.Part_No,
|
||||
pc.Description,
|
||||
Inventory_Part_Status_Par_API.Get_Description(i.part_status) Status,
|
||||
D.Cat1,
|
||||
Cat2.Cat2,
|
||||
Deco.Decoration,
|
||||
X.X_Ref,
|
||||
X.CATALOG_DESC "X Ref Description",
|
||||
Q.QTY Inventory,
|
||||
Q.Qty - Q.Qty_Reserved Qty_Not_Reserved,
|
||||
Incoming_Qty,
|
||||
i.supersedes,
|
||||
INVENTORY_PART_API.Get_Superseded_By(i.CONTRACT,
|
||||
i.PART_NO) Superseded_By,
|
||||
Q.Last_Receipt_Date "Oldest Lot",
|
||||
CO.Open_Order "Open Order",
|
||||
IPP.Safety_Stock Safety,
|
||||
WO.QTY "SO Qty",
|
||||
Remaining_Issue,
|
||||
D.Label_1,
|
||||
D.Label_2,
|
||||
PO.PO,
|
||||
PO.Next_Receipt_Date,
|
||||
D.Parent,
|
||||
ROW_NUMBER() over(Partition by D.Contract, D.Part_No Order By D.Cat1) as Row_Num
|
||||
From (Select C.Company,
|
||||
i.Contract,
|
||||
i.Part_No Parent,
|
||||
i.Part_No,
|
||||
C6.Label_1,
|
||||
C6.Label_2,
|
||||
ID.Customer_No,
|
||||
'FG' as Cat1
|
||||
From Inventory_Part i
|
||||
inner join COMPANY_SITE CS
|
||||
on i.Contract = CS.Contract
|
||||
inner join Company_Finance C
|
||||
on C.Company = CS.Company
|
||||
inner join (Select PART_NO,
|
||||
CONTRACT,
|
||||
ATTR_VALUE_ALPHA Customer_No
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE = '00032'
|
||||
and ATTR_VALUE_ALPHA = '&Customer_ID') ID
|
||||
on i.Contract = ID.Contract
|
||||
and i.Part_No = ID.Part_No
|
||||
|
||||
left join (Select ms.Part_No,
|
||||
ms.Contract,
|
||||
Min(COMPONENT_PART) Label_1,
|
||||
Decode(Min(COMPONENT_PART),
|
||||
Max(Component_Part),
|
||||
'',
|
||||
Max(Component_Part)) Label_2
|
||||
From MANUF_STRUCTURE MS
|
||||
inner join INVENTORY_PART_CHAR_ALL c
|
||||
on ms.contract = c.contract
|
||||
and ms.component_part = c.part_no
|
||||
|
||||
where MANUF_STRUCT_ALTERNATE_API.Get_State(ms.contract,
|
||||
ms.part_no,
|
||||
ms.eng_chg_level,
|
||||
ms.bom_type,
|
||||
ms.alternative_no) =
|
||||
'Buildable'
|
||||
and ms.ALTERNATIVE_NO = '*'
|
||||
and ms.EFF_PHASE_OUT_DATE is null
|
||||
and ms.BOM_TYPE_DB = 'M'
|
||||
and c.CHARACTERISTIC_CODE = '00006'
|
||||
and c.ATTR_VALUE_ALPHA in
|
||||
('IML',
|
||||
'PAPER INSERT',
|
||||
'HEAT TRANSFER',
|
||||
'PSL')
|
||||
group by ms.Part_No, ms.Contract) C6
|
||||
on i.contract = c6.contract
|
||||
and i.part_no = c6.part_no
|
||||
|
||||
Where i.ENG_ATTRIBUTE in ('00008', '00010')
|
||||
and i.PART_STATUS in ('A', 'D', 'Q')
|
||||
|
||||
UNION
|
||||
|
||||
Select A.Company,
|
||||
A.Contract,
|
||||
B.Part_No Parent,
|
||||
B.Component_Part Part_No,
|
||||
B.Component_Part Label_1,
|
||||
'' as Label_2,
|
||||
A.Customer_No,
|
||||
'RM' as Cat1
|
||||
from (Select C.Company,
|
||||
i.Contract,
|
||||
i.Part_No,
|
||||
ID.Customer_No,
|
||||
'FG' as Cat1
|
||||
From Inventory_Part i
|
||||
inner join COMPANY_SITE CS
|
||||
on i.Contract = CS.Contract
|
||||
inner join Company_Finance C
|
||||
on C.Company = CS.Company
|
||||
inner join (Select PART_NO,
|
||||
CONTRACT,
|
||||
ATTR_VALUE_ALPHA Customer_No
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE =
|
||||
'00032'
|
||||
and ATTR_VALUE_ALPHA =
|
||||
'&Customer_ID') ID
|
||||
on i.Contract = ID.Contract
|
||||
and i.Part_No = ID.Part_No
|
||||
|
||||
Where i.ENG_ATTRIBUTE in ('00008', '00010')
|
||||
and i.PART_STATUS in ('A', 'D', 'Q')) A
|
||||
|
||||
inner join (Select Contract, Part_No, COMPONENT_PART
|
||||
from MANUF_STRUCTURE M
|
||||
Where M.BOM_TYPE_db = 'M'
|
||||
and M.ALTERNATIVE_NO = '*'
|
||||
and M.EFF_PHASE_OUT_DATE is null
|
||||
and OPERATION_NO = '10'
|
||||
and MANUF_STRUCT_ALTERNATE_API.Get_State(M.contract,
|
||||
M.part_no,
|
||||
M.eng_chg_level,
|
||||
M.bom_type,
|
||||
M.alternative_no) =
|
||||
'Buildable') B
|
||||
on A.Company = B.Contract
|
||||
and A.Part_No = B.Part_No
|
||||
|
||||
inner join (Select Contract, PART_NO, ATTR_VALUE_ALPHA
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE = '00006'
|
||||
and ATTR_VALUE_ALPHA in
|
||||
('IML',
|
||||
'PAPER INSERT',
|
||||
'HEAT TRANSFER',
|
||||
'PSL')) C
|
||||
on B.Contract = C.Contract
|
||||
and B.Component_Part = C.Part_No
|
||||
|
||||
UNION
|
||||
Select ic.Contract Company,
|
||||
ic.Contract,
|
||||
ic.Part_No Parent,
|
||||
ic.Part_No,
|
||||
'' as Label_1,
|
||||
'' as Label_2,
|
||||
ic.ATTR_VALUE_ALPHA Customer_No,
|
||||
'XX' as Cat1
|
||||
from INVENTORY_PART_CHAR_ALL ic
|
||||
inner join Inventory_Part i
|
||||
on ic.Contract = i.Contract
|
||||
and ic.Part_No = i.Part_No
|
||||
where CHARACTERISTIC_CODE = '00032'
|
||||
and ATTR_VALUE_ALPHA = '&Customer_ID'
|
||||
and i.Part_Status in ('A', 'D', 'Q')
|
||||
|
||||
) D
|
||||
|
||||
inner join CUSTOMER_INFO CI
|
||||
on D.Customer_No = CI.Customer_ID
|
||||
inner join Inventory_part i
|
||||
on D.Contract = i.Contract
|
||||
and D.Part_No = i.Part_No
|
||||
inner join Part_Catalog pc
|
||||
on D.Part_No = pc.Part_No
|
||||
inner join Inventory_Part_Planning IPP
|
||||
on D.Contract = IPP.Contract
|
||||
and D.Part_NO = IPP.Part_No
|
||||
|
||||
left join (Select Contract,
|
||||
Catalog_No,
|
||||
CUSTOMER_PART_NO X_Ref,
|
||||
CATALOG_DESC
|
||||
from SALES_PART_CROSS_REFERENCE) x
|
||||
on D.Contract = X.Contract
|
||||
and D.Part_No = X.Catalog_No
|
||||
|
||||
left join (Select C.Part_No,
|
||||
C.Contract,
|
||||
sum(C.BUY_QTY_DUE - C.QTY_SHIPPED) Open_Order
|
||||
From customer_order_join_cfv C
|
||||
Where C.objstate in
|
||||
('Released',
|
||||
'Blocked',
|
||||
'Reserved',
|
||||
'Picked',
|
||||
'PartiallyDelivered')
|
||||
and C.Customer_No not like ('W%')
|
||||
Group By C.Part_No, C.Contract) CO
|
||||
on D.Part_No = CO.Part_No
|
||||
and D.Contract = CO.Contract
|
||||
|
||||
left join (Select S.Contract,
|
||||
S.Part_No,
|
||||
sum(S.QTY_ONHAND) QTY,
|
||||
sum(S.QTY_RESERVED) Qty_Reserved,
|
||||
TO_CHAR(min(S.RECEIPT_DATE), 'yyyy-mm-dd') Last_Receipt_Date
|
||||
From Inventory_part_in_stock_UIV S
|
||||
inner join Inventory_Part i
|
||||
on S.Contract = i.Contract
|
||||
and S.Part_No = i.Part_No
|
||||
Where S.QTY_ONHAND > 0
|
||||
Group by S.Contract, S.Part_No) Q
|
||||
on D.Part_NO = Q.Part_NO
|
||||
and D.Contract = Q.Contract
|
||||
|
||||
left join (Select SOURCE_PART_NO,
|
||||
CONTRACT,
|
||||
sum(DISPATCH_SOURCE_QTY) Incoming_Qty
|
||||
From RECEIVABLE_DISPATCH_ADV_LINE
|
||||
Where STATE = 'Created'
|
||||
Group by SOURCE_PART_NO, CONTRACT) r
|
||||
on r.contract = d.contract
|
||||
and r.SOURCE_PART_NO = d.part_no
|
||||
|
||||
left join (Select Contract,
|
||||
Part_No,
|
||||
sum(REMAINING_NET_SUPPLY_QTY) QTY
|
||||
from Shop_Ord
|
||||
where State in ('Released',
|
||||
'Started',
|
||||
'Parked',
|
||||
'Reserved')
|
||||
and order_code_db = 'M'
|
||||
Group By Contract, Part_No) WO
|
||||
on D.Contract = WO.Contract
|
||||
and D.Part_No = WO.Part_No
|
||||
|
||||
left join (Select Contract,
|
||||
Part_No,
|
||||
sum(qty_remain_to_issue) Remaining_Issue
|
||||
from SHOP_MATERIAL_ALLOC_UIV
|
||||
where SOSTATE in ('Released',
|
||||
'Started',
|
||||
'Parked',
|
||||
'Reserved')
|
||||
and order_code_db = 'M'
|
||||
Group By Contract, Part_No) SM
|
||||
on D.Contract = SM.Contract
|
||||
and D.Part_No = SM.Part_No
|
||||
|
||||
left join (Select distinct Contract,
|
||||
Part_No,
|
||||
CHARACTERISTIC_TEMPLATE_API.GET_DESCRIPTION(INVENTORY_PART_API.Get_Eng_Attribute(contract,
|
||||
PART_NO)) Cat2
|
||||
from INVENTORY_PART_CHAR_ALL) Cat2
|
||||
on Cat2.Contract = D.Contract
|
||||
and Cat2.Part_No = D.Part_No
|
||||
|
||||
left join (Select distinct Contract,
|
||||
Part_No,
|
||||
ATTR_VALUE_ALPHA Decoration
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE = '00034') Deco
|
||||
on Deco.Contract = D.Contract
|
||||
and Deco.Part_No = D.Part_No
|
||||
|
||||
left join (SELECT Contract,
|
||||
part_No,
|
||||
sum(CF$_REM_QTY_RECEIVE) PO,
|
||||
TO_CHAR(min(PLANNED_RECEIPT_DATE),
|
||||
'yyyy-mm-dd') Next_Receipt_Date
|
||||
FROM purchase_order_line_all_cfv
|
||||
WHERE state in ('Released', 'Confirmed')
|
||||
GROUP BY Contract, Part_No) PO
|
||||
on PO.Contract = D.Contract
|
||||
and PO.Part_No = D.Part_No
|
||||
|
||||
) E1
|
||||
|
||||
left join (Select Q1.*, PS2.Part_No Related_Supersedes
|
||||
from (Select PS.Contract,
|
||||
PS.Part_No,
|
||||
PS.COMPONENT_PART,
|
||||
IP.SUPERSEDES,
|
||||
INVENTORY_PART_API.Get_Superseded_By(IP.CONTRACT,
|
||||
IP.PART_NO) Superseded_By_Comp
|
||||
From PROD_STRUCTURE PS
|
||||
inner join Inventory_part_cfv IP
|
||||
on PS.Contract = IP.Contract
|
||||
and PS.COMPONENT_PART = IP.Part_No
|
||||
Where PS.EFF_PHASE_OUT_DATE is null
|
||||
and PS.BOM_TYPE_db = 'M'
|
||||
and IP.CF$_PURCHASE_CAT2 in
|
||||
('RM07A - IML Label',
|
||||
'RM04P - CARDBOARD INSERT - NO COST',
|
||||
'RM07B - PSL Label')) Q1
|
||||
|
||||
inner join PROD_STRUCTURE PS2
|
||||
on Q1.Contract = PS2.Contract
|
||||
and Q1.Superseded_By_Comp = PS2.Component_Part
|
||||
|
||||
where PS2.EFF_PHASE_OUT_DATE is null
|
||||
and PS2.BOM_TYPE_db = 'M') S1
|
||||
on E1.Part_No = S1.Part_No
|
||||
and E1.Site = S1.Contract
|
||||
|
||||
left join (Select Q1.*, PS2.Part_No Related_Superseded
|
||||
from (Select PS.Contract,
|
||||
PS.Part_No,
|
||||
PS.COMPONENT_PART,
|
||||
IP.SUPERSEDES,
|
||||
INVENTORY_PART_API.Get_Superseded_By(IP.CONTRACT,
|
||||
IP.PART_NO) Superseded_By_Comp
|
||||
|
||||
from PROD_STRUCTURE PS
|
||||
inner join Inventory_part_cfv IP
|
||||
on PS.Contract = IP.Contract
|
||||
and PS.COMPONENT_PART = IP.Part_No
|
||||
|
||||
Where PS.EFF_PHASE_OUT_DATE is null
|
||||
and PS.BOM_TYPE_db = 'M'
|
||||
and IP.CF$_PURCHASE_CAT2 in
|
||||
('RM07A - IML Label',
|
||||
'RM04P - CARDBOARD INSERT - NO COST',
|
||||
'RM07B - PSL Label')) Q1
|
||||
inner join PROD_STRUCTURE PS2
|
||||
on Q1.Contract = PS2.Contract
|
||||
and Q1.Supersedes = PS2.Component_Part
|
||||
where PS2.EFF_PHASE_OUT_DATE is null
|
||||
and PS2.BOM_TYPE_db = 'M') S2
|
||||
on E1.Part_No = S2.Part_No
|
||||
and E1.Site = S2.Contract
|
||||
|
||||
Where Row_Num = 1
|
||||
and COMPANY LIKE NVL('&COMPANY', '%')
|
||||
Order By Parent, Label_1, Cat1, Site)
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,253 @@
|
||||
select top.*
|
||||
from (SELECT a.company_id,
|
||||
ifsapp.Company_API.Get_Name(a.company_id) AS "Company Name",
|
||||
a.emp_no,
|
||||
a.employee_status,
|
||||
ifsapp.Company_Employee_Property_API.Get_Property_Value(a.COMPANY_ID,
|
||||
a.emp_no,
|
||||
'EMPNO') AS "Payroll Number",
|
||||
a.employee_name AS "Employee Name",
|
||||
a.fname AS "First Name",
|
||||
a.lname AS "Last Name",
|
||||
ifsapp.Person_Info_API.GET_TITLE(ifsapp.COMPANY_PERSON_API.Get_Person_Id(a.company_id,
|
||||
a.EMP_NO)) AS "Title",
|
||||
a.POS_CODE as "Position Id",
|
||||
a.FREE_FIELD1 as "Job Title",
|
||||
ifsapp.COMPANY_POSITION_API.Get_Position_Title(a.COMPANY_ID,
|
||||
a.POS_CODE) as "Position Title",
|
||||
ifsapp.COMPANY_WORK_LOCATION_API.Get_Country(a.COMPANY_ID,
|
||||
ifsapp.Employee_Work_Location_API.Get_Current_Work_Location(a.company_id,
|
||||
a.EMP_NO)) AS "Work Country",
|
||||
ifsapp.Employee_Work_Location_API.Get_Current_Work_Location(a.company_id,
|
||||
a.EMP_NO) as "Work Location",
|
||||
a.CF$_REGION as "Region",
|
||||
a.CF$_DIVISION as "Division",
|
||||
a.company_id AS "Employing Entity",
|
||||
a.EMP_CAT_NAME as "Function",
|
||||
-- a.POS_CODE as "Manager Position ID",
|
||||
ifsapp.company_pers_assign_api.get_sup_pos_code(a.company_id,
|
||||
a.emp_no,
|
||||
sysdate,
|
||||
ifsapp.company_pers_assign_api.get_pos_code(a.company_id,
|
||||
a.emp_no,
|
||||
sysdate)) as "Manager Position ID",
|
||||
ifsapp.COMPANY_POSITION_API.Get_Position_Title(a.company_id,
|
||||
ifsapp.company_pers_assign_api.get_sup_pos_code(a.company_id,
|
||||
a.emp_no,
|
||||
sysdate,
|
||||
company_pers_assign_api.get_pos_code(a.company_id,
|
||||
a.emp_no,
|
||||
sysdate))) as "Manager Title",
|
||||
-- a.FREE_FIELD1 as "Manager Title",
|
||||
--a.employee_name AS "Manager name",
|
||||
a.sup_name AS "Manager name",
|
||||
|
||||
TO_CHAR(ifsapp.PERS_API.Get_Date_Of_Birth(ifsapp.COMPANY_PERSON_API.Get_Person_Id(a.company_id,
|
||||
a.EMP_NO)),
|
||||
'MM/DD/YYYY') AS "Date of birth",
|
||||
floor(months_between(sysdate,
|
||||
(ifsapp.PERS_API.Get_Date_Of_Birth(ifsapp.COMPANY_PERSON_API.Get_Person_Id(a.company_id,
|
||||
a.EMP_NO)))) / 12) As "Age",
|
||||
TO_CHAR(ifsapp.EMP_EMPLOYED_TIME_API.Get_Date_Of_Employment(a.company_id,
|
||||
a.EMP_NO),
|
||||
'MM/DD/YYYY') AS "Hire Date",
|
||||
|
||||
ROUND((months_between(trunc(sysdate),
|
||||
ifsapp.EMP_EMPLOYED_TIME_API.Get_Date_Of_Employment(a.company_id,
|
||||
a.EMP_NO)) / 12),
|
||||
2) As "Service",
|
||||
/*((trunc(sysdate) -
|
||||
ifsapp.EMP_EMPLOYED_TIME_API.Get_Date_Of_Employment(a.company_id,
|
||||
a.EMP_NO))/365) As "Service",*/
|
||||
|
||||
to_NUMBER(pf5.property_field1) as "Notice Period in weeks",
|
||||
a.CF$_EXEMPT as "Exempt / Non-exempt (NA)",
|
||||
DECODE(ifsapp.EMPLOYEE_SALARY_API.Get_Salary_Period_Per(a.company_id,
|
||||
a.emp_no,
|
||||
SYSDATE),
|
||||
'Annually',
|
||||
'Salaried',
|
||||
'Hourly') "Salaried or Hourly",
|
||||
ROUND(ifsapp.EMPLOYEE_SALARY_API.Get_RATE(a.company_id,
|
||||
a.emp_no,
|
||||
'Hourly'),
|
||||
2) as "Hourly Rate (Base Currency)",
|
||||
ifsapp.Emp_Employed_Time_API.Get_Employment_Type(a.company_id,
|
||||
a.emp_no,
|
||||
ifsapp.Emp_Employed_Time_API.Get_Person_Date_Of_Employment(a.PERSON_ID)) As "Full Time/Part Time",
|
||||
ifsapp.Company_Employee_Property_API.Get_Property_Value(a.COMPANY_ID,
|
||||
a.emp_no,
|
||||
'BANDS') AS "Bands",
|
||||
null as "Level",
|
||||
ifsapp.Company_Employee_Property_API.Get_Property_Value(a.COMPANY_ID,
|
||||
a.emp_no,
|
||||
'GRADE') AS "Grade",
|
||||
ifsapp.EMP_EMPLOYED_TIME_API.Get_Degree_Of_Occupation(a.COMPANY_ID,
|
||||
a.emp_no,
|
||||
sysdate) * 100 as "% FTE",
|
||||
ifsapp.Employee_Salary_API.Get_Currency_Code_Per(a.company_id,
|
||||
a.emp_no,
|
||||
sysdate) AS "Currency Code",
|
||||
ifsapp.Employee_Salary_API.Get_Rate(a.company_id,
|
||||
a.emp_no,
|
||||
'Annually') as "Annual Base Salary Local Currency",
|
||||
IFSAPP.CURRENCY_RATE_API.Get_Currency_Rate(a.company_id,
|
||||
'USD',
|
||||
'3',
|
||||
SYSDATE) AS "Exchange Rate USD",
|
||||
((ifsapp.Currency_Rate_API.Get_Currency_Rate(a.company_id,
|
||||
'USD',
|
||||
'3',
|
||||
SYSDATE)) *
|
||||
ifsapp.Employee_Salary_API.Get_Rate(a.company_id,
|
||||
a.emp_no,
|
||||
'Annually')) AS "Annual Base in USD",
|
||||
ROUND(ifsapp.EMPLOYEE_SALARY_API.Get_RATE(a.company_id,
|
||||
a.emp_no,
|
||||
'Hourly'),
|
||||
2) as "Hourly rate (Local)",
|
||||
b.CHANGE_PERCENTAGE AS "Last salary increase Amount %",
|
||||
TO_CHAR(b.VALID_FROM, 'MM/DD/YYYY') AS "Last salary increase Date",
|
||||
--b.SALARY_REASON_ID AS "Last salary increase Reason",
|
||||
ifsapp.REASON_FOR_SALARY_CHANGE_API.Get_Salary_Change_Description(b.COMPANY_ID,
|
||||
b.SALARY_REASON_ID) AS "Last salary increase Reason",
|
||||
pf1.property_field1 AS "Bonus Plan",
|
||||
pf1.property_field2 AS "Bonus Target As % Salary",
|
||||
pf2.property_field1 AS "Commission % Salary",
|
||||
pf2.property_field2 AS "Commission Number - Target Value",
|
||||
a.CF$_LIFE_ELIGIBILITY as "Life Eligibility",
|
||||
a.CF$_VACATION_ENTITLE_DAYS as "Vacation Per Annum",
|
||||
a.CF$_DISABILITY_INCOME as "Disability Income continuance eligibility (Yes / No)",
|
||||
a.CF$_PRIVATE_MEDICAL_ELG as "Private Medical Eligible",
|
||||
pf4.property_field1 AS "Private Medical Coverage",
|
||||
a.CF$_EAP_ELIGIBILITY as "EAP Eligibility",
|
||||
a.CF$_COMPANY_CAR_ELIGIBLE as "Company car eligibility (Yes/No)",
|
||||
a.CF$_ON_MOBILITY as "On Mobility",
|
||||
a.CF$_UNION_MEMBER as "Union Member",
|
||||
IFSAPP.EMP_EMPLOYED_TIME_API.Get_Agreement_Id(a.COMPANY_ID,
|
||||
a.emp_no,
|
||||
SYSDATE) as "Agreement ID",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'ACTING-UP'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Acting Up Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'CAR'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "CAR Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'COLA'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Cost of Living Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'HEALTH'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Health Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'HOUSING'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Housing Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'MOBILITY'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Mobility Allowance",
|
||||
|
||||
(select DECODE(t.PAY_TYPE_PERIOD,
|
||||
'Monthly',
|
||||
t.planned_amount * 12,
|
||||
t.planned_amount) ANNUALLY_AMOUNT
|
||||
from ifsapp.EMP_ADDITIONAL_PAY t
|
||||
where t.company_id = a.company_id
|
||||
and t.emp_no = a.emp_no
|
||||
and t.pay_type = 'PHONE'
|
||||
AND SYSDATE between t.start_date and t.end_date) AS "Phone Allowance",
|
||||
|
||||
a.CF$_DISABILITY_INCOME as "Disability Income",
|
||||
a.CF$_PENSION_ELIGIBLE as "Pension eligibility",
|
||||
pf3.property_field1 as "Pension Plan Max Employer Contr. As %",
|
||||
pf3.property_field2 as "Pension Employee Actual Contr. As %",
|
||||
pf3.property_field3 as "Pension Employeer Actual Contr. As %",
|
||||
a.FREE_FIELD2 as "Legacy Number"
|
||||
|
||||
FROM company_person_all_cfv a
|
||||
left join employee_salary b
|
||||
on a.company_id = b. COMPANY_ID
|
||||
and a.emp_no = b.EMP_NO
|
||||
and b.valid_to >= SYSDATE
|
||||
and b.valid_from <= SYSDATE
|
||||
left join ifsapp.COMPANY_EMP_PROPERTY_FIELD_ALL pf1
|
||||
on pf1.emp_no = a.emp_no
|
||||
and pf1.company_id = a.company_id
|
||||
and pf1.property_code = 'BONUS'
|
||||
and pf1.valid_to >= SYSDATE
|
||||
and pf1.valid_from <= SYSDATE
|
||||
left join ifsapp.COMPANY_EMP_PROPERTY_FIELD_ALL pf2
|
||||
on pf2.emp_no = a.emp_no
|
||||
and pf2.company_id = a.company_id
|
||||
and pf2.property_code = 'COMMISSION'
|
||||
and pf2.valid_to >= SYSDATE
|
||||
and pf2.valid_from <= SYSDATE
|
||||
left join ifsapp.COMPANY_EMP_PROPERTY_FIELD_ALL pf3
|
||||
on pf3.emp_no = a.emp_no
|
||||
and pf3.company_id = a.company_id
|
||||
and pf3.property_code = 'PENSION'
|
||||
and pf3.valid_to >= SYSDATE
|
||||
and pf3.valid_from <= SYSDATE
|
||||
left join ifsapp.COMPANY_EMP_PROPERTY_FIELD_ALL pf4
|
||||
on pf4.emp_no = a.emp_no
|
||||
and pf4.company_id = a.company_id
|
||||
and pf4.property_code = 'PRIVATEMED'
|
||||
and pf4.valid_to >= SYSDATE
|
||||
and pf4.valid_from <= SYSDATE
|
||||
left join ifsapp.COMPANY_EMP_PROPERTY_FIELD_ALL pf5
|
||||
on pf5.emp_no = a.emp_no
|
||||
and pf5.company_id = a.company_id
|
||||
and pf5.property_code = 'NOTICE'
|
||||
and pf5.valid_to >= SYSDATE
|
||||
and pf5.valid_from <= SYSDATE
|
||||
ORDER BY a.company_id, a.emp_no) top
|
||||
WHERE top.COMPANY_ID =
|
||||
NVL('&Company_ID',
|
||||
ifsapp.user_access_api.is_user_company_id(top.COMPANY_ID))
|
||||
AND NVL(top."Function", '%') LIKE
|
||||
NVL('&EMP_CAT_NAME', '%')
|
||||
AND NVL(top."Division", '%') LIKE NVL('&Division', '%')
|
||||
AND NVL(top."Work Country", '%') LIKE NVL('&Country', '%')
|
||||
|
||||
-- Lov referance is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,50 @@
|
||||
Select PP.cf$_purchase_cat1_desc Purch_Category1_Desc,
|
||||
IP.Part_NO,
|
||||
IP.Note_Text Legacy,
|
||||
IP.DESCRIPTION,
|
||||
IP.Contract Site,
|
||||
INV.Warehouse,
|
||||
sum(SMA.QTY_REQUIRED) Qty_required,
|
||||
nvl(INV.QtyOnHand, 0) "Qty on Hand",
|
||||
nvl(INV.QtyAvailable, 0) "Qty Available"
|
||||
|
||||
From SHOP_MATERIAL_ALLOC_uiv SMA
|
||||
inner join INVENTORY_PART IP
|
||||
on SMA.PART_NO = IP.PART_NO
|
||||
and SMA.CONTRACT = IP.CONTRACT
|
||||
left join PURCHASE_PART_cfv PP
|
||||
on IP.Part_No = PP.Part_No
|
||||
and IP.Contract = PP.Contract
|
||||
|
||||
left join (select PART_NO,
|
||||
CONTRACT,
|
||||
Warehouse,
|
||||
sum(QTY_ONHAND) QtyOnHand,
|
||||
sum(QTY_ONHAND) - sum(QTY_RESERVED) QtyAvailable
|
||||
from Inventory_Part_in_Stock_uiv
|
||||
where AVAILABILITY_CONTROL_ID is null
|
||||
Group By Contract, PART_NO, CONTRACT, Warehouse) INV
|
||||
on SMA.Part_No = INV.PART_NO
|
||||
and SMA.Contract = INV.Contract
|
||||
|
||||
Where IP.CONTRACT LIKE '%&CONTRACT%'
|
||||
and report_sys.parse_parameter(PP.cf$_purchase_part_cat_1,
|
||||
'&[-C-BL]PurchasedCategory') = 'TRUE'
|
||||
and SMA.State not in ('Cancelled', 'Closed', 'Planned')
|
||||
and trunc(SMA.DATE_REQUIRED) between TO_DATE('&DATE_FROM', 'YYYY-MM-DD') AND
|
||||
TO_DATE('&DATE_TO', 'YYYY-MM-DD')
|
||||
|
||||
Group by IP.Part_NO,
|
||||
PP.cf$_purchase_cat1_desc,
|
||||
IP.Note_Text,
|
||||
IP.Contract,
|
||||
INV.Warehouse,
|
||||
IP.DESCRIPTION,
|
||||
INV.QtyOnHand,
|
||||
INV.QtyAvailable
|
||||
|
||||
Having sum(SMA.QTY_REQUIRED) > 0
|
||||
|
||||
Order by IP.Part_NO
|
||||
|
||||
-- -- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,82 @@
|
||||
select *
|
||||
from (Select PP.cf$_purchase_cat1_desc Purch_Category1_Desc,
|
||||
IP.Part_NO,
|
||||
IP.Note_Text Legacy,
|
||||
IP.Contract Site,
|
||||
IP.DESCRIPTION,
|
||||
sum(SMA.QTY_REQUIRED) Qty_required,
|
||||
sum(SMA.QTY_ISSUED) Qty_Issued,
|
||||
sum(SMA.QTY_REMAIN_TO_ISSUE) Qty_Remaining_to_Issue,
|
||||
nvl(TFS.QtyOnHand, 0) Floor_Stock,
|
||||
nvl(TP.QtyOnHand, 0) Picking,
|
||||
sum(SMA.QTY_REMAIN_TO_ISSUE) - nvl(TFS.QtyOnHand, 0) Qty_To_Move,
|
||||
TL.Warehouse,
|
||||
TL.Location_No,
|
||||
TL.HANDLING_UNIT_ID HU,
|
||||
TL.Receipt_Date,
|
||||
TL.Location_Qty,
|
||||
sum(TL.Location_Qty) over(PARTITION BY IP.Part_No ORDER BY IP.Part_NO, TL.HANDLING_UNIT_ID rows UNBOUNDED PRECEDING) TTL
|
||||
From SHOP_MATERIAL_ALLOC_uiv SMA
|
||||
inner join INVENTORY_PART IP
|
||||
on SMA.PART_NO = IP.PART_NO
|
||||
and SMA.CONTRACT = IP.CONTRACT
|
||||
left join PURCHASE_PART_cfv PP
|
||||
on IP.Part_No = PP.Part_No
|
||||
and IP.Contract = PP.Contract
|
||||
left join (select PART_NO, CONTRACT, sum(QTY_ONHAND) QtyOnHand
|
||||
from Inventory_Part_in_Stock_uiv
|
||||
where AVAILABILITY_CONTROL_ID is null
|
||||
and LOCATION_TYPE_db = 'F'
|
||||
Group By Contract, PART_NO) TFS
|
||||
on SMA.Part_No = TFS.PART_NO
|
||||
and SMA.Contract = TFS.Contract
|
||||
left join (select PART_NO, CONTRACT, sum(QTY_ONHAND) QtyOnHand
|
||||
from Inventory_Part_in_Stock_uiv
|
||||
where AVAILABILITY_CONTROL_ID is null
|
||||
and LOCATION_TYPE_db = 'PICKING'
|
||||
Group By Contract, PART_NO) TP
|
||||
on SMA.Part_No = TP.PART_NO
|
||||
and SMA.Contract = TP.Contract
|
||||
left join (select PART_NO,
|
||||
CONTRACT,
|
||||
Location_No,
|
||||
Warehouse,
|
||||
RECEIPT_DATE,
|
||||
HANDLING_UNIT_ID,
|
||||
sum(QTY_ONHAND) Location_Qty
|
||||
from Inventory_Part_in_Stock_uiv
|
||||
where AVAILABILITY_CONTROL_ID is null
|
||||
and LOCATION_TYPE_db = 'PICKING'
|
||||
and WAREHOUSE like nvl('&FromWarehouse', '%')
|
||||
Group By Contract,
|
||||
PART_NO,
|
||||
Location_No,
|
||||
Warehouse,
|
||||
HANDLING_UNIT_ID,
|
||||
RECEIPT_DATE) TL
|
||||
on TL.Part_No = SMA.PART_NO
|
||||
and TL.Contract = SMA.Contract
|
||||
Where IP.CONTRACT LIKE
|
||||
'%' || '&CONTRACT' || '%'
|
||||
and report_sys.parse_parameter(PP.cf$_purchase_part_cat_1,
|
||||
'&[-C-BL]PurchasedCategory') =
|
||||
'TRUE'
|
||||
and SMA.State not in ('Cancelled', 'Closed', 'Planned')
|
||||
and trunc(SMA.DATE_REQUIRED) between
|
||||
to_date('&FROM', 'YYYY-MM-DD') and
|
||||
to_date('&TO', 'YYYY-MM-DD')
|
||||
Group by IP.Part_NO,
|
||||
PP.cf$_purchase_cat1_desc,
|
||||
IP.Note_Text,
|
||||
IP.Contract,
|
||||
IP.DESCRIPTION,
|
||||
TFS.QtyOnHand,
|
||||
TP.QtyOnHand,
|
||||
TL.Location_No,
|
||||
TL.HANDLING_UNIT_ID,
|
||||
TL.Warehouse,
|
||||
TL.Receipt_Date,
|
||||
TL.Location_Qty
|
||||
Having(sum(SMA.QTY_REMAIN_TO_ISSUE) - nvl(TFS.QtyOnHand, 0)) > 0 and TL.Location_Qty > 0) d
|
||||
where (d.TTL - d.Location_Qty) < d.Qty_To_Move
|
||||
Order by d.Part_NO, d.HU, d.Receipt_Date, d.Location_No
|
||||
@ -0,0 +1,23 @@
|
||||
SELECT NVL(logat.new_value, logat.old_value) IFS_USER,
|
||||
ifsapp.Fnd_User_API.Get_Description(NVL(logat.new_value,
|
||||
logat.old_value)) User_Name,
|
||||
hist.Username,
|
||||
|
||||
DECODE(history_type, 'Insert', 'Log On', 'Delete', 'Log Off') AS Action,
|
||||
hist.time_stamp
|
||||
|
||||
FROM ifsapp.history_log_attribute logat, ifsapp.history_log hist
|
||||
|
||||
WHERE hist.log_id = logat.log_id
|
||||
|
||||
AND column_name = 'DIRECTORY_ID'
|
||||
|
||||
AND ifsapp.Report_SYS.Parse_Parameter(NVL(logat.new_value,
|
||||
logat.old_value),
|
||||
NVL('&Identity',
|
||||
'%')) = 'TRUE'
|
||||
|
||||
AND hist.time_stamp >= to_date('&DATE_FROM', 'YYYY-MM-DD')
|
||||
ORDER BY NVL(logat.new_value, logat.old_value), hist.time_stamp ASC
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,187 @@
|
||||
SELECT c.Order_id AS "Order Type",
|
||||
TO_CHAR(c.REAL_SHIP_DATE, 'YYYY-MM-DD') AS "Last Actual Ship Date",
|
||||
TO_CHAR(c.PLANNED_DUE_DATE, 'YYYY-MM-DD') AS "Planned Due Date",
|
||||
c.Contract AS "Site",
|
||||
c.Order_no AS "Order",
|
||||
c.line_no AS "Line No",
|
||||
c.Rel_no AS "Rel No",
|
||||
c.Line_item_no AS "Line Item No",
|
||||
c.SUPPLY_CODE AS "Supply Code",
|
||||
c.Vendor_no AS "Supplier",
|
||||
c.Customer_no AS "Customer",
|
||||
c.customer_name as "Customer Name",
|
||||
c.SHIP_ADDR_NO as "Delivery Address",
|
||||
IFSAPP.CUSTOMER_INFO_ADDRESS_API.Get_Name(c.CUSTOMER_NO,
|
||||
c.SHIP_ADDR_NO) as "Delivery Customer Name",
|
||||
IFSAPP.CUSTOMER_ORDER_API.GET_CUSTOMER_PO_NO(c.ORDER_NO) as "Customer PO No",
|
||||
c.order_state as "Order Status",
|
||||
c.state as "Status",
|
||||
to_char(c.date_entered, 'YYYY-MM-DD') as "Date Entered",
|
||||
TRUNC(c.WANTED_DELIVERY_DATE) as "Wanted Delivery Date",
|
||||
to_char(c.PLANNED_SHIP_DATE, 'YYYY-MM-DD') as "Planned Ship Date",
|
||||
to_char(c.PROMISED_DELIVERY_DATE, 'YYYY-MM-DD') as "Promised Delivery Date",
|
||||
TRUNC((c.DELIVERY_LEADTIME + sysdate) - 1) -
|
||||
TRUNC(c.PROMISED_DELIVERY_DATE) as "Days Late",
|
||||
c.catalog_no as "Part",
|
||||
c.catalog_desc as "Part Description",
|
||||
|
||||
C.CUSTOMER_PART_NO "Customer Part No",
|
||||
|
||||
c.buy_qty_due as "Sales Qty",
|
||||
c.QTY_ASSIGNED as "Reserved Qty",
|
||||
c.QTY_ON_ORDER as "Pegged Qty",
|
||||
|
||||
USABLE.QTY_ONHAND "Usable Qty",
|
||||
|
||||
IFSAPP.Inventory_Part_In_Stock_API.Get_Inventory_Qty_Onhand(c.CONTRACT,
|
||||
c.PART_NO,
|
||||
NULL) as "Qty on Hand By Site ",
|
||||
|
||||
NVL(ONHAND.QTY_ONHAND, 0) AS "Qty On Hand by Company",
|
||||
co.CF$_INCOMING_DISPATCH_QTY as "Incoming dispatch Qty",
|
||||
/* c.BUY_QTY_DUE - DECODE(c.CATALOG_TYPE_DB, 'INV', c.QTY_SHIPPED, NULL) as "Qty to Deliver", */
|
||||
co.CF$_REMAINING AS "Qty to Deliver",
|
||||
/* ROUND((c.BUY_QTY_DUE / IFSAPP.PART_HANDLING_UNIT_API.Get_Max_Quantity_Capacity(c.catalog_no, 'PALLET', 'EA')),2) as "No of Pallets", */
|
||||
ROUND(co.CF$_NO_OF_PALLETS, 2) as "No of Pallets",
|
||||
ROUND(co.CF$_REMAINING / NVL(co.CF$_MAX_CAP_PER_PALLET, 1), 2) AS "Remaining Pallets",
|
||||
c.LINE_TOTAL_WEIGHT as "Weight (KG)",
|
||||
c.LINE_TOTAL_WEIGHT * co.CF$_REMAINING / c.BUY_QTY_DUE as "Remaining Weight (KG)",
|
||||
|
||||
IFSAPP.Reserve_Customer_Order_API.Get_Available_Qty(NVL(c.supply_site,
|
||||
c.contract),
|
||||
NVL(NVL(c.supply_site_part_no,
|
||||
c.part_no),
|
||||
c.catalog_no),
|
||||
c.configuration_id,
|
||||
c.order_no,
|
||||
c.line_no,
|
||||
c.rel_no,
|
||||
c.line_item_no,
|
||||
c.supply_code_db,
|
||||
c.part_ownership_db,
|
||||
c.owning_customer_no,
|
||||
c.project_id,
|
||||
c.condition_code,
|
||||
NULL,
|
||||
'TRUE') as "Available Qty",
|
||||
IFSAPP.Inventory_Part_In_Stock_API.Get_Inventory_Qty_Onhand(c.CONTRACT,
|
||||
c.PART_NO,
|
||||
NULL) -
|
||||
sum(c.BUY_QTY_DUE -
|
||||
DECODE(c.CATALOG_TYPE_DB, 'INV', c.QTY_SHIPPED, NULL)) over(PARTITION BY c.catalog_no ORDER BY c.catalog_no, c.PLANNED_SHIP_DATE rows UNBOUNDED PRECEDING) "Projected on Hand",
|
||||
|
||||
NVL(USABLE.QTY_ONHAND, 0) -
|
||||
sum(c.BUY_QTY_DUE -
|
||||
DECODE(c.CATALOG_TYPE_DB, 'INV', c.QTY_SHIPPED, NULL)) over(PARTITION BY c.catalog_no ORDER BY c.catalog_no, c.PLANNED_SHIP_DATE rows UNBOUNDED PRECEDING) "Projected Usable Qty",
|
||||
|
||||
IFSAPP.Customer_Order_Line_API.Get_Base_Sale_Price_Total(C.ORDER_NO,
|
||||
c.LINE_NO,
|
||||
c.REL_NO,
|
||||
c.LINE_ITEM_NO) as "Value (curr)",
|
||||
c.Currency_code as "Currency",
|
||||
c.DELIVERY_TERMS as "Del Terms",
|
||||
IFSAPP.Order_Delivery_Term_API.Get_Description(c.DELIVERY_TERMS) as "Del Term Desc",
|
||||
IFSAPP.ORDER_COORDINATOR_API.Get_Name(IFSAPP.CUSTOMER_ORDER_API.Get_Authorize_Code(c.order_no)) as "Coordinator",
|
||||
IFSAPP.PERSON_INFO_API.Get_Name(IFSAPP.CRM_CUST_INFO_API.Get_Main_Representative_Id(c.customer_no)) as "Main Rep",
|
||||
IFSAPP.Customer_Group_API.Get_Description(IFSAPP.CUST_ORD_CUSTOMER_API.get_cust_grp(c.customer_no)) as "Cust Stat Group",
|
||||
IFSAPP.SALES_DISTRICT_API.get_description(c.DISTRICT_CODE) as "Sales District",
|
||||
c.CF$_COORDINATOR as "Coordinator ID",
|
||||
c.CF$_next_prod_due_Date as "Next Production Due Date",
|
||||
c.CF$_open_qty_shop_order as "Open Qty Shop Order",
|
||||
c.CF$_BACKORDER_OPTION as "Backorder Option",
|
||||
a.ADDRESS1,
|
||||
a.ADDRESS2,
|
||||
a.ZIP_CODE,
|
||||
a.CITY,
|
||||
a.COUNTY,
|
||||
a.COUNTRY,
|
||||
co.CF$_IML AS "IML",
|
||||
co.CF$_IML_AVAILABLE AS "IML QTY",
|
||||
IMP.IML_IN_ORDER AS "IML ON ORDER",
|
||||
to_Char(ND.Next_Date, 'YYYY-MM-DD HH24:MI') AS "Next date",
|
||||
ch.attr_value AS "Mold",
|
||||
cd.attr_value AS "Decoration"
|
||||
|
||||
FROM IFSAPP.Site s
|
||||
INNER JOIN IFSAPP.Customer_order_line_cfv co
|
||||
ON co.contract = s.contract
|
||||
INNER JOIN IFSAPP.Customer_order_join_cfv c
|
||||
ON c.Order_no = co.Order_no
|
||||
AND c.Line_no = co.Line_no
|
||||
and c.Rel_no = co.Rel_no
|
||||
AND c.Contract = co.Contract
|
||||
|
||||
LEFT JOIN IFSAPP.Customer_info_address a
|
||||
ON c.Customer_No = a.Customer_ID
|
||||
AND c.SHIP_ADDR_NO = a.Address_ID
|
||||
INNER JOIN IFSAPP.Inventory_part_cfv inv
|
||||
ON inv.Contract = c.Contract
|
||||
AND inv.Part_no = c.Part_no
|
||||
LEFT JOIN IFSAPP.Inventory_part_char_all ch
|
||||
ON ch.Contract = inv.Contract
|
||||
AND ch.Part_no = inv.Part_no
|
||||
AND ch.CHARACTERISTIC_CODE = '00150'
|
||||
LEFT JOIN IFSAPP.Inventory_part_char_all cd
|
||||
ON cd.Contract = inv.Contract
|
||||
AND cd.Part_no = inv.Part_no
|
||||
AND cd.CHARACTERISTIC_CODE = '00034'
|
||||
|
||||
OUTER APPLY (SELECT SUM(QTY_ONHAND) AS QTY_ONHAND
|
||||
from IFSAPP.Inventory_Part_in_Stock st
|
||||
inner join ifsapp.site site
|
||||
on site.company = s.company
|
||||
and site.contract = st.contract
|
||||
and st.Part_No = co.Part_no
|
||||
group by st.Part_no) ONHAND
|
||||
|
||||
left join (Select Contract, Part_No, SUM(QTY_ONHAND) AS QTY_ONHAND
|
||||
from IFSAPP.Inventory_Part_in_Stock
|
||||
where AVAILABILITY_CONTROL_ID is null
|
||||
or AVAILABILITY_CONTROL_ID in
|
||||
('WAREHOUSE_LOCK_RES',
|
||||
'BACKFLUSH_BLOCK',
|
||||
'PARTIALS_AUTO_BLOCK',
|
||||
'HANDL_UNIT_ON_SHOP_ORDER',
|
||||
'RESERVE_BLOCK')
|
||||
group by Part_no, contract) USABLE
|
||||
on USABLE.Contract = inv.Contract
|
||||
and USABLE.Part_No = inv.Part_No
|
||||
|
||||
OUTER APPLY (SELECT sum(CF$_REM_QTY_RECEIVE) AS IML_IN_ORDER
|
||||
FROM IFSAPP.Purchase_Order_line_cfv pp
|
||||
WHERE pp.PART_NO = co.CF$_IML
|
||||
AND s.contract = pp.Contract
|
||||
AND State NOT IN ('Closed', 'Cancelled')
|
||||
AND CF$_REM_QTY_RECEIVE > 0
|
||||
GROUP BY Part_No) IMP
|
||||
|
||||
OUTER APPLY (SELECT MIN(Planned_receipt_date) AS Next_date
|
||||
FROM IFSAPP.Purchase_Order_line_cfv pp
|
||||
WHERE pp.Part_no = co.CF$_IML
|
||||
AND s.contract = pp.Contract
|
||||
AND State NOT IN ('Closed', 'Cancelled')
|
||||
AND CF$_REM_QTY_RECEIVE > 0
|
||||
AND Part_no IS NOT NULL
|
||||
GROUP BY Part_No) ND
|
||||
|
||||
WHERE s.Company = '&[MC--L]Company'
|
||||
AND (s.Contract in
|
||||
(SELECT REGEXP_SUBSTR(d__.str, '[^;]+', 1, LEVEL) AS val_
|
||||
FROM (SELECT '&[-C--L]Site' AS str FROM DUAL) d__
|
||||
CONNECT BY LEVEL <= REGEXP_COUNT(d__.str, ';') + 1) OR
|
||||
s.Contract LIKE NVL('&[-C--L]Site', '%'))
|
||||
AND c.Customer_no LIKE NVL('&Customer', '%')
|
||||
AND c.SHIP_ADDR_NO LIKE NVL('&Ship_To', '%')
|
||||
AND (ch.attr_value LIKE NVL('&Mold', '%') OR '&Mold' is null)
|
||||
AND c.CF$_COORDINATOR LIKE
|
||||
NVL('%&AUTHORIZE_CODE%', '%')
|
||||
AND c.State not in ('Cancelled', 'Delivered', 'Invoiced/Closed')
|
||||
AND c.Customer_no NOT LIKE 'W00%'
|
||||
ORDER BY c.contract,
|
||||
c.PLANNED_SHIP_DATE,
|
||||
c.promised_delivery_date,
|
||||
c.order_no,
|
||||
c.line_no,
|
||||
c.Rel_no
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,33 @@
|
||||
SELECT DATE_CREATED,
|
||||
Site,
|
||||
Parts as Count_of_Parts,
|
||||
Quantity as Quantity_Shipped,
|
||||
(NVL((SELECT COUNT(DISTINCT HANDLING_UNIT_ID)
|
||||
FROM INVENTORY_TRANSACTION_HIST2 i
|
||||
WHERE TRANSACTION_CODE = 'OESHIP'
|
||||
AND HANDLING_UNIT_ID > 0
|
||||
AND (TRUNC(DATE_CREATED) = A.DATE_CREATED)
|
||||
AND CONTRACT = A.site
|
||||
AND Handling_Unit_API.Get_Top_Parent_Handl_Unit_Id(HANDLING_UNIT_ID) IS NULL
|
||||
group by TRUNC(DATE_CREATED), contract),
|
||||
0) + (NVL(Parent_Skids, 0))) Skids,
|
||||
|
||||
ifsapp.Ipl_Label_Util_API.Get_Value_Ship_Per_Day(DATE_CREATED, site) as Value,
|
||||
Count_of_Orders as No_of_Customer_Orders_Shipped
|
||||
FROM (select TRUNC(DATE_CREATED) DATE_CREATED,
|
||||
contract as Site,
|
||||
COUNT(DISTINCT PART_NO) as Parts,
|
||||
COUNT(DISTINCT
|
||||
Handling_Unit_API.Get_Top_Parent_Handl_Unit_Id(HANDLING_UNIT_ID)) as Parent_Skids,
|
||||
COUNT(DISTINCT SOURCE_REF1) as Count_of_Orders,
|
||||
SUM(QUANTITY) as Quantity
|
||||
FROM INVENTORY_TRANSACTION_HIST2 i
|
||||
WHERE TRANSACTION_CODE = 'OESHIP'
|
||||
AND HANDLING_UNIT_ID > 0
|
||||
AND (TRUNC(DATE_CREATED) >= TO_DATE('&Valid_From', 'MM/DD/YYYY') AND
|
||||
TRUNC(DATE_CREATED) <= TO_DATE('&Valid_To', 'MM/DD/YYYY'))
|
||||
AND CONTRACT LIKE '%&CONTRACT%'
|
||||
group by TRUNC(DATE_CREATED), contract
|
||||
ORDER BY DATE_CREATED, CONTRACT) A
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,46 @@
|
||||
Select Inventory_Product_Code_API.Get_Description(IP.PART_PRODUCT_CODE) Product_Code,
|
||||
RO.Part_No,
|
||||
INVENTORY_PART_API.Get_Description(RO.contract, RO.PART_NO) Description,
|
||||
RO.Contract Site,
|
||||
RO.Alternative_No Alt,
|
||||
RO.BOM_Type,
|
||||
RO.WORK_CENTER_NO Work_Center,
|
||||
RO.MACHINE_NO Machine,
|
||||
ROT.tool_id Tool,
|
||||
RO.EFFICIENCY_FACTOR Efficiency,
|
||||
RO.RUN_TIME_CODE,
|
||||
RO.MACH_RUN_FACTOR Run_Factor,
|
||||
RO.CREW_SIZE,
|
||||
to_char(RO.PHASE_IN_DATE, 'yyyy-mm-dd') Phase_In,
|
||||
to_Char(RO.PHASE_OUT_DATE, 'yyyy-mm-dd') Phase_Out,
|
||||
IP.C_RESIN_TYPE Resin_Type,
|
||||
IP.C_RESIN_WEIGHT Resin_Weight
|
||||
|
||||
From Routing_Operation_Tool ROT,
|
||||
MANUF_TOOL MT,
|
||||
ROUTING_OPERATION RO,
|
||||
Inventory_Part_cfv IP
|
||||
|
||||
Where MT.Tool_Type = 'MOLD'
|
||||
and ROT.Tool_id = MT.Tool_ID
|
||||
and ROT.contract = MT.contract
|
||||
and ROT.Contract = RO.Contract
|
||||
and ROT.Part_No = RO.Part_No
|
||||
and ROT.BOM_Type = RO.BOM_Type
|
||||
and ROT.Alternative_No = RO.Alternative_No
|
||||
and ROT.Operation_No = RO.Operation_No
|
||||
and ROT.Routing_Revision = RO.Routing_Revision
|
||||
and IP.CONTRACT LIKE '%&CONTRACT%'
|
||||
and RO.Operation_No = '10'
|
||||
and RO.Contract = IP.Contract
|
||||
and RO.Part_No = IP.Part_No
|
||||
and IP.PART_STATUS = 'A'
|
||||
and (RO.PHASE_OUT_DATE is null or
|
||||
to_Char(RO.PHASE_OUT_DATE, 'yyyy-mm-dd') >=
|
||||
to_char(Sysdate, 'yyyy-mm-dd'))
|
||||
|
||||
Order by Inventory_Product_Code_API.Get_Description(IP.PART_PRODUCT_CODE),
|
||||
ROT.tool_id,
|
||||
RO.Part_No
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,171 @@
|
||||
Select INV.Company,
|
||||
Company.Name,
|
||||
SS.Acct_Currency_Code as "Curr Company",
|
||||
INV.Contract "Site",
|
||||
INV.Catalog_No as "Part No",
|
||||
INV.Description,
|
||||
TO_CHAR(INV.Invoice_Date, 'YYYY-MM-DD') "Date Trans",
|
||||
TO_CHAR(INV.Invoice_Date, 'YYYY-MM') "YYYY-MM",
|
||||
Case
|
||||
when Inv.Price_Adjustment = 'TRUE' then
|
||||
0
|
||||
else
|
||||
Inv.Invoiced_Qty
|
||||
End "Invoiced Qty",
|
||||
INV.Sale_Um UoM,
|
||||
STOCK.Part_Product_Family "Product Family",
|
||||
STOCK.Part_Product_Code "Product Code",
|
||||
STOCK.Type_Designation "Type Designation",
|
||||
INV.Identity "Customer No",
|
||||
CUST.Name "Customer Name",
|
||||
CUST.Category "Customer Type",
|
||||
IPP.CF$_QTY_ON_HAND "Qty on Hand",
|
||||
IPP.Safety_Stock "Safety Stock",
|
||||
IPP.MIN_ORDER_QTY "Min Lot Size",
|
||||
IPP.CF$_MIN_SALES_QTY "Min Sales Qty",
|
||||
STOCK.CF$_HU_QTY "HU Qty",
|
||||
SS.Price_Source "Price Source",
|
||||
SS.Price_Source_Id "Price Source ID",
|
||||
customer_order.order_id "Order Type",
|
||||
INV.Order_No "Order No",
|
||||
INV.Line_No "Line No",
|
||||
INV.Release_No "Rel No",
|
||||
INV.Invoice_No "Invoice No",
|
||||
cust_order_inv_head_uiv_all.DELIVERY_ADDRESS_ID "Address ID",
|
||||
SHIP.Name "Ship Name",
|
||||
SHIP.Country "Ship Ctry",
|
||||
SHIP.State "Ship State",
|
||||
SHIP.City "Ship City",
|
||||
SS.Cf$_Main_Rep "Main Rep",
|
||||
SS.Market_Desc "Market Desc",
|
||||
SS.Region_Code "Region Code",
|
||||
SS.Country_Code "Ctry Code",
|
||||
Case
|
||||
when customer_order.District_Code is null then
|
||||
SS.District_Code
|
||||
else
|
||||
customer_order.District_Code
|
||||
end as "District Code",
|
||||
Case
|
||||
when customer_order.District_Code is null then
|
||||
SS.District_Desc
|
||||
else
|
||||
SALES_DISTRICT.Description
|
||||
end as "District Description",
|
||||
customer_order.Delivery_Terms "Delivery Terms",
|
||||
INV.Customer_Po_No "Customer PO NO",
|
||||
cust_order_inv_head_uiv_all.Shipment_Id "Shipment ID",
|
||||
shipment_cfv.Cf$_Freight_Charge "Ttl Freight Cost",
|
||||
STOCK.C_Resin_Type "Resin Type",
|
||||
STOCK.C_Resin_Weight "Resin Weight",
|
||||
Case
|
||||
when Inv.Price_Adjustment = 'TRUE' then
|
||||
0
|
||||
else
|
||||
(INV.Invoiced_Qty * STOCK.C_Resin_Weight * Sales_Part.CONV_FACTOR)
|
||||
End "Ttl Resin Weight",
|
||||
INV.Sale_Unit_Price "Sales Unit Price",
|
||||
INV.Currency_Code "Currency Code",
|
||||
INV.Net_Curr_Amount "Net Amount Curr",
|
||||
INV.Net_Dom_Amount "Net Amount Co",
|
||||
SS.Cost,
|
||||
Sales_Part.CONV_FACTOR "Factor UoM",
|
||||
COJ.Supply_Code "Supply Code",
|
||||
COJ.Supply_Site "Supply Site",
|
||||
X.CUSTOMER_PART_NO "Customer Part No",
|
||||
Color.ATTR_VALUE_ALPHA "Color",
|
||||
Pant.ATTR_VALUE_ALPHA "Pantone",
|
||||
IML.Component_Part "IML"
|
||||
|
||||
from CUSTOMER_ORDER_INV_ITEM_JOIN INV
|
||||
inner join company
|
||||
on INV.Company = Company.Company
|
||||
inner join inventory_part_cfv STOCK
|
||||
on INV.Catalog_No = STOCK.Part_No
|
||||
and INV.Contract = STOCK.Contract
|
||||
left join cust_ord_cust1 CUST
|
||||
on INV.Identity = CUST.Customer_No
|
||||
left join cust_ord_invo_stat_cfv SS
|
||||
on INV.Invoice_id = SS.Invoice_id
|
||||
and INV.Item_id = SS.Item_id
|
||||
left join customer_order
|
||||
on INV.Order_No = customer_order.Order_No
|
||||
left join cust_order_inv_head_uiv_all
|
||||
on INV.Invoice_No = cust_order_inv_head_uiv_all.Invoice_No
|
||||
and INV.Series_ID = cust_order_inv_head_uiv_all.Series_Id
|
||||
left join shipment_cfv
|
||||
on cust_order_inv_head_uiv_all.shipment_Id = shipment_cfv.shipment_Id
|
||||
left join SALES_DISTRICT
|
||||
on customer_order.District_Code = SALES_DISTRICT.District_Code
|
||||
inner join SALES_PART
|
||||
on INV.Contract = SALES_PART.Contract
|
||||
and INV.Catalog_No = SALES_PART.Part_no
|
||||
inner join CUSTOMER_INFO_ADDRESS SHIP
|
||||
on INV.Identity = SHIP.Customer_Id
|
||||
and cust_order_inv_head_uiv_all.DELIVERY_ADDRESS_ID = SHIP.Address_Id
|
||||
left join CUSTOMER_ORDER_JOIN COJ
|
||||
on INV.Order_No = COJ.Order_No
|
||||
and INV.Line_No = COJ.Line_No
|
||||
and INV.Release_No = COJ.Rel_No
|
||||
left join (Select contract,
|
||||
part_no,
|
||||
CASE
|
||||
WHEN substr(ATTR_VALUE_ALPHA, 1, 3) = 'DRY' THEN
|
||||
'OFFFSET'
|
||||
else
|
||||
ATTR_VALUE_ALPHA
|
||||
end Decoration
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE = '00034') C34
|
||||
on INV.Contract = C34.Contract
|
||||
and INV.Catalog_No = C34.Part_No
|
||||
inner join INVENTORY_PART_PLANNING_cfv IPP
|
||||
on IPP.Contract = INV.Contract
|
||||
and IPP.Part_No = INV.Catalog_No
|
||||
left join SALES_PART_CROSS_REFERENCE X
|
||||
on X.Contract = INV.Contract
|
||||
and X.Catalog_No = INV.Catalog_No
|
||||
and X.CUSTOMER_NO = INV.Identity
|
||||
left join (Select contract, part_no, ATTR_VALUE_ALPHA
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE in ('00025', '00028')) Color
|
||||
on Color.Contract = INV.Contract
|
||||
and Color.PArt_No = INV.Catalog_No
|
||||
left join (Select contract, part_no, ATTR_VALUE_ALPHA
|
||||
from INVENTORY_PART_CHAR_ALL
|
||||
where CHARACTERISTIC_CODE in ('00079')) Pant
|
||||
on Pant.Contract = INV.Contract
|
||||
and Pant.PArt_No = INV.Catalog_No
|
||||
left join (Select MS.Contract,
|
||||
MS.Part_No,
|
||||
LISTAGG(MS.COMPONENT_PART, ' + ') WITHIN GROUP(Order By MS.Component_Part) Component_Part
|
||||
From MANUF_STRUCTURE MS
|
||||
inner join Purchase_Part_Cfv PP
|
||||
on MS.Contract = PP.Contract
|
||||
and MS.Component_Part = PP.Part_No
|
||||
|
||||
Where PP.CF$_PURCHASE_PART_CAT_2 = 'RM07A'
|
||||
and MS.Alternative_No = '*'
|
||||
and MS.BOM_TYPE_DB = 'M'
|
||||
and MANUF_STRUCT_ALTERNATE_API.Get_State(MS.contract,
|
||||
MS.part_no,
|
||||
MS.eng_chg_level,
|
||||
MS.bom_type,
|
||||
MS.alternative_no) =
|
||||
'Buildable'
|
||||
and MS.EFF_PHASE_OUT_DATE is null
|
||||
|
||||
Group By MS.Contract, MS.Part_No) IML
|
||||
on IML.Contract = INV.Contract
|
||||
and IML.Part_No = INV.Catalog_No
|
||||
|
||||
where INV.Series_ID <> 'PR'
|
||||
and INV.COMPANY LIKE NVL('&COMPANY', '%')
|
||||
and INV.CONTRACT LIKE NVL('%CONTRACT%', '%')
|
||||
and TO_DATE(TO_CHAR(INV.Invoice_Date, 'YYYY-MM-DD'), 'YYYY-MM-DD') between
|
||||
to_date('&BeginDate', 'YYYY-MM-DD') and
|
||||
to_date('&EndDate', 'YYYY-MM-DD')
|
||||
and INV.Identity like NVL('&Customer_No', '%')
|
||||
and STOCK.Type_Designation like NVL('&Type_Designation', '%')
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,19 @@
|
||||
SELECT CUSTOMER_NO AS Customer,
|
||||
CUSTOMER_NAME,
|
||||
ACCT_CURRENCY_CODE AS Currency,
|
||||
SUM(NET_AMOUNT) AS Sales,
|
||||
SUM(INVOICED_QTY) AS Quantity
|
||||
|
||||
FROM CUST_ORD_INVO_STAT t
|
||||
|
||||
Where (TRUNC(INVOICE_DATE) >= TO_DATE('&Valid_From', 'MM/DD/YYYY') AND
|
||||
TRUNC(INVOICE_DATE) <= TO_DATE('&Valid_To', 'MM/DD/YYYY'))
|
||||
AND COMPANY LIKE '%&COMPANY%'
|
||||
AND AUTHORIZE_CODE LIKE '%&AUTHORIZE_CODE%'
|
||||
AND CUST_GRP LIKE '%&CUST_GRP%'
|
||||
|
||||
GROUP BY CUSTOMER_NO, CUSTOMER_NAME, ACCT_CURRENCY_CODE
|
||||
ORDER BY Sales DESC, Quantity DESC
|
||||
FETCH NEXT 10 ROWS ONLY
|
||||
|
||||
-- Lov reference is removed due to limitations in IFS cloud
|
||||
@ -0,0 +1,34 @@
|
||||
SELECT Year,
|
||||
Period,
|
||||
Company,
|
||||
Coordinator,
|
||||
Coordinator_Name,
|
||||
count(distinct Order_No) "No of Orders",
|
||||
count(distinct Order_No || line_no || REL_NO) "No of Lines",
|
||||
SUM(Revenue) as "Sales Value (CURR)"
|
||||
|
||||
from (SELECT EXTRACT(YEAR FROM cs.DATE_ENTERED) Year,
|
||||
EXTRACT(MONTH FROM cs.DATE_ENTERED) Period,
|
||||
cs.company,
|
||||
CUSTOMER_ORDER_API.Get_Authorize_Code(cs.ORDER_NO) Coordinator,
|
||||
ORDER_COORDINATOR_API.Get_Name(CUSTOMER_ORDER_API.Get_Authorize_Code(cs.ORDER_NO)) Coordinator_Name,
|
||||
cs.ORDER_NO,
|
||||
ol.line_no,
|
||||
ol.REL_NO,
|
||||
Customer_Order_Line_API.Get_Sale_Price_Incl_Tax_Total(ol.ORDER_NO,
|
||||
ol.LINE_NO,
|
||||
ol.REL_NO,
|
||||
ol.LINE_ITEM_NO) as Revenue
|
||||
|
||||
FROM CUSTOMER_ORDER cs
|
||||
INNER JOIN CUSTOMER_ORDER_LINE ol
|
||||
ON cs.order_no = ol.order_no
|
||||
|
||||
WHERE (TRUNC(cs.DATE_ENTERED) >=
|
||||
TO_DATE('&Valid_From', 'MM/DD/YYYY') AND
|
||||
TRUNC(cs.DATE_ENTERED) <= TO_DATE('&Valid_To', 'MM/DD/YYYY'))
|
||||
AND cs.CONTRACT like NVL('&CONTRACT', '%')
|
||||
AND CUST_ORD_CUSTOMER_API.Get_Cust_Grp(cs.CUSTOMER_NO) LIKE
|
||||
NVL('&CUST_GRP', '%')) it
|
||||
GROUP BY year, Period, Company, Coordinator, Coordinator_Name
|
||||
ORDER BY year, Period
|
||||
Loading…
Reference in New Issue