PO_OVERDUE1_VW

(SQL View)
Index Back

PO Overdue Schedules


SELECT S.BUSINESS_UNIT , H.BUYER_ID , D.OPRDEFNDESC , V.NAME1 , S.PO_ID , S.LINE_NBR , S.SCHED_NBR , L.INV_ITEM_ID , L.DESCR254_MIXED , C.CATEGORY_CD , S.DUE_DT , SUM(S.MERCHANDISE_AMT) - %Coalesce(SUM(RS.MERCHANDISE_AMT),0) , S.CURRENCY_CD , S.SHIPTO_ID , COUNT(*) , %Round(%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT), 0) , %Round((%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT)) / 7, 0) , %Round((%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT)) / 30, 0) , %Sql(EOEW_FUNCLIB_DATE_MONTH_UPD, S.DUE_DT) , %Sql(EOEW_FUNCLIB_DATE_YEAR_UPD, S.DUE_DT) FROM PS_PO_LINE_SHIP S JOIN PS_PO_LINE L ON S.BUSINESS_UNIT = L.BUSINESS_UNIT AND S.PO_ID = L.PO_ID AND S.LINE_NBR = L.LINE_NBR JOIN PS_PO_HDR H ON H.BUSINESS_UNIT = L.BUSINESS_UNIT AND H.PO_ID = L.PO_ID JOIN PS_ITM_CAT_TBL C ON L.ITM_SETID = C.SETID AND L.CATEGORY_ID = C.CATEGORY_ID JOIN PS_INSTALLATION_PO I ON C.CATEGORY_TYPE = I.CATEGORY_TYPE JOIN PS_VENDOR V ON H.VENDOR_SETID = V.SETID AND H.VENDOR_ID = V.VENDOR_ID JOIN PSOPRDEFN D ON H.BUYER_ID = D.OPRID LEFT OUTER JOIN PS_RECV_LN_SHIP RS ON RS.BUSINESS_UNIT = S.BUSINESS_UNIT AND RS.PO_ID = S.PO_ID AND RS.LINE_NBR = S.LINE_NBR AND RS.SCHED_NBR = S.SCHED_NBR AND RS.RECV_SHIP_STATUS <> 'X' WHERE S.DUE_DT < %CurrentDateIn AND L.RECV_REQ = 'Y' AND (H.PO_STATUS = 'D' OR H.CHNG_ORD_BATCH > 0 ) AND H.BUDGET_HDR_STATUS NOT IN ('N', 'E') AND H.MID_ROLL_STATUS = 'N' AND L.CANCEL_STATUS = 'A' AND S.CANCEL_STATUS = 'A' AND S.SHIP_TO_CUST_ID = ' ' AND L.RECV_REQ <> 'X' AND C.EFFDT = ( SELECT MAX(C2.EFFDT) FROM PS_ITM_CAT_TBL C2 WHERE C.SETID = C2.SETID AND C.CATEGORY_TYPE = C2.CATEGORY_TYPE AND C.CATEGORY_ID = C2.CATEGORY_ID AND C2.EFFDT <= %CurrentDateIn) AND ((L.AMT_ONLY_FLG = 'N' AND (S.QTY_PO > ( SELECT SUM(D.QTY_SH_NETRCV_VUOM) FROM PS_RECV_LN_SHIP D WHERE S.BUSINESS_UNIT = D.BUSINESS_UNIT_PO AND S.PO_ID = D.PO_ID AND S.LINE_NBR = D.LINE_NBR AND S.SCHED_NBR = D.SCHED_NBR AND D.RECV_SHIP_STATUS <> 'X'))) OR (L.AMT_ONLY_FLG = 'Y' AND (%Abs(S.MERCHANDISE_AMT) > ( SELECT %Abs(SUM(E.MERCHANDISE_AMT)) FROM PS_RECV_LN_SHIP E WHERE S.BUSINESS_UNIT = E.BUSINESS_UNIT_PO AND S.PO_ID = E.PO_ID AND S.LINE_NBR = E.LINE_NBR AND S.SCHED_NBR = E.SCHED_NBR AND E.RECV_SHIP_STATUS <> 'X'))) OR NOT EXISTS ( SELECT 'X'FROM PS_RECV_LN_SHIP D WHERE S.BUSINESS_UNIT = D.BUSINESS_UNIT_PO AND S.PO_ID = D.PO_ID AND S.LINE_NBR = D.LINE_NBR AND S.SCHED_NBR = D.SCHED_NBR AND D.RECV_SHIP_STATUS <> 'X')) AND NOT EXISTS ( SELECT 'X' FROM PS_PO_LN_SHIP_EXS IL WHERE S.BUSINESS_UNIT = IL.BUSINESS_UNIT AND S.PO_ID = IL.PO_ID AND S.LINE_NBR = IL.LINE_NBR AND S.SCHED_NBR = IL.SCHED_NBR AND IL.EXS_TAX_TXN_TYPE = 'DIMP') GROUP BY S.BUSINESS_UNIT , H.BUYER_ID , D.OPRDEFNDESC , V.NAME1 , S.PO_ID , S.LINE_NBR , S.SCHED_NBR , L.INV_ITEM_ID , L.DESCR254_MIXED , C.CATEGORY_CD , S.DUE_DT , S.CURRENCY_CD , S.SHIPTO_ID , %Round(%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT), 0) , %Round((%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT)) / 7, 0) , %Round((%Sql(EOEW_FUNCLIB_DATE_DAYDIFF_UPD, %CurrentDateIn, S.DUE_DT)) / 30, 0), %Sql(EOEW_FUNCLIB_DATE_MONTH_UPD, S.DUE_DT) , %Sql(EOEW_FUNCLIB_DATE_YEAR_UPD, S.DUE_DT)

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit

Prompt Table: SP_BU_PM_NONVW

2 BUYER_ID Character(30) VARCHAR2(30) NOT NULL Buyer
3 BUYER_DESCR Character(30) VARCHAR2(30) NOT NULL Buyer Desc
4 NAME1 Character(40) VARCHAR2(40) NOT NULL Name 1
5 PO_ID Character(10) VARCHAR2(10) NOT NULL Purchase Order
6 LINE_NBR Number(5,0) INTEGER NOT NULL Line Number: 11/24/08 - Added TARGET label [PC product]
7 SCHED_NBR Number(3,0) SMALLINT NOT NULL Schedule Number
8 INV_ITEM_ID Character(18) VARCHAR2(18) NOT NULL Item ID
9 DESCR254_MIXED Character(254) VARCHAR2(254) NOT NULL Description
10 CATEGORY_CD Character(18) VARCHAR2(18) NOT NULL Category Code
11 DUE_DT Date(10) DATE Specifies the date that a transaction is due. It is a generic field used in multiple PeopleSoft applications including Receivables Payables and Purchasing. For example it represents the date that payment is due for a voucher or the date that a scheduled shipment is due to be received.
12 TOTAL_AMOUNT Signed Number(16,4) DECIMAL(14,4) NOT NULL Total Amount
13 CURRENCY_CD Character(3) VARCHAR2(3) NOT NULL Currency Code
14 SHIPTO_ID Character(10) VARCHAR2(10) NOT NULL Ship To Location
15 COUNT_ORDERS Number(15,0) DECIMAL(15) NOT NULL Order Count
16 DAYS_NUM Number(6,0) INTEGER NOT NULL Days Late
17 WEEK_NUM Number(6,0) INTEGER NOT NULL This is the week number
18 MONTH_NUM Number(6,0) INTEGER NOT NULL Months Late
19 MONTH_CHAR Character(15) VARCHAR2(15) NOT NULL Month
20 YEAR Character(4) VARCHAR2(4) NOT NULL Year
1=NONE