EM_FNLLINES_HVW

(SQL View)
Index Back

Invoice Lines/Distributions

This view is used by the operational user to review and approve invoice lines. Lines and Distribs are denormalized in a level 1 grid.

SELECT A.BUSINESS_UNIT ,A.BUSINESS_UNIT , A.VOUCHER_ID ,0 ,0 , A.INVOICE_ID , B.SETID , B.VENDOR_ID , D.VNDR_LOC ,' ' , A.INVOICE_DT , A.GROSS_AMT , D.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,' ' ,' ' ,' ' , B.SETID ,' ' ,' ' ,' ' ,' ' , %Sql(FS_CF_SPACES) ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' , A.DESCR254_MIXED , A.VCHR_LINE_APPR , A.DSCNT_AMT , D.CURRENCY_PYMNT , SUM(D.PAID_AMT) , D.DUE_DT , D.PYMNT_HOLD , D.PYMNT_SELCT_STATUS , A.VOUCHER_STYLE , A.VCHR_SRC , T.SETID , A.PYMNT_TERMS_CD , A.PYMNT_CNT_TOTAL , D.PYMNT_METHOD , D.PAY_CYCLE , D.PAY_CYCLE_SEQ_NUM , A.DOC_TOL_HDR_STATUS , A.BUDGET_HDR_STATUS , A.AP_MATCH_TYPE , A.BUSINESS_UNIT %Concat '/' %Concat A.VOUCHER_ID ,1 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'N' ,' ' FROM PS_VOUCHER A , PS_VENDOR B , PS_PYMNT_VCHR_XREF D , PS_PYMT_TRMS_HDR T , PS_SET_CNTRL_REC REC WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.VOUCHER_ID = D.VOUCHER_ID AND A.VOUCHER_STYLE <> 'TMPL' AND A.CLOSE_STATUS <> 'C' AND T.SETID = REC.SETID AND REC.REC_GROUP_ID = 'FS_14' AND REC.RECNAME = 'PYMT_TRMS_HDR' AND REC.SETCNTRLVALUE = A.BUSINESS_UNIT AND A.PYMNT_TERMS_CD = T.PYMNT_TERMS_CD AND ((A.PROCESS_MAN_CLOSE = 'N' OR A.CLOSE_STATUS = 'O') OR (A.PROCESS_MAN_CLOSE <> 'N' AND D.PYMNT_SELCT_STATUS = 'E')) AND A.ENTRY_STATUS <> 'X' AND D.PYMNT_TYPE <> 'W' AND D.PYMNT_SELCT_STATUS <> 'X' AND ((A.VOUCHER_STYLE='PPAY' AND D.PREPAID_STATUS='P' ) OR A.VOUCHER_STYLE<>'PPAY') AND D.DUE_DT IS NOT NULL GROUP BY A.BUSINESS_UNIT , A.VOUCHER_ID , A.INVOICE_ID , B.SETID, B.VENDOR_ID , D.VNDR_LOC , A.INVOICE_DT , D.TXN_CURRENCY_CD , A.GROSS_AMT , A.DSCNT_AMT , D.CURRENCY_PYMNT , D.DUE_DT , D.PYMNT_HOLD , A.ENTERED_DT , D.PYMNT_SELCT_STATUS , A.APPR_STATUS , A.VCHR_APPRVL_FLG, A.MATCH_STATUS_VCHR , A.VOUCHER_STYLE , A.VCHR_SRC, T.SETID, A.PYMNT_TERMS_CD, A.PYMNT_CNT_TOTAL, D.PYMNT_METHOD, A.DESCR254_MIXED, D.PAY_CYCLE , D.PAY_CYCLE_SEQ_NUM, A.VCHR_LINE_APPR, A.DOC_TOL_HDR_STATUS, A.BUDGET_HDR_STATUS, A.AP_MATCH_TYPE UNION ALL SELECT A.BUSINESS_UNIT ,A.BUSINESS_UNIT , A.VOUCHER_ID , LINE.VOUCHER_LINE_NUM , 0 , A.INVOICE_ID , A.VENDOR_SETID , A.VENDOR_ID , A.VNDR_LOC , LINE.DESCR , A.INVOICE_DT , LINE.MERCHANDISE_AMT , LINE.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR , LINE.APPR_STATUS , ' ' , ' ' , LINE.ITM_SETID , %subrec(EM_INVLINE_FLD, LINE) , ' ' , ' ' ,' ' , %Sql(FS_CF_SPACES) ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' , LINE.DESCR254_MIXED , A.VCHR_LINE_APPR ,0 ,' ' ,0 ,A.INVOICE_DT ,' ' ,' ' ,A.VOUCHER_STYLE ,A.VCHR_SRC ,' ' ,' ' ,0 ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT %Concat '/' %Concat A.VOUCHER_ID ,2 ,0 ,0 ,0 ,'E' ,' ' ,0 , 'N' , ' ' FROM PS_VOUCHER A , PS_VOUCHER_LINE LINE WHERE A.BUSINESS_UNIT = LINE.BUSINESS_UNIT AND A.VOUCHER_ID = LINE.VOUCHER_ID AND ((A.PROCESS_MAN_CLOSE = 'N' OR A.CLOSE_STATUS <> 'C') ) AND A.ENTRY_STATUS NOT IN ('X' ) AND A.VOUCHER_STYLE <> 'TMPL' UNION ALL SELECT A.BUSINESS_UNIT ,A.BUSINESS_UNIT , A.VOUCHER_ID , DIST.VOUCHER_LINE_NUM , DIST.DISTRIB_LINE_NUM , A.INVOICE_ID , A.VENDOR_SETID , A.VENDOR_ID , A.VNDR_LOC , ' ' , A.INVOICE_DT , DIST.MERCHANDISE_AMT , DIST.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,' ' , HVW.APPR_STATUS , DIST.BUSINESS_UNIT_GL , ' ' ,' ' , %subrec(EM_DISTLINE_FLD, DIST) , %subrec(CF16_AN_SBR, DIST) , %subrec(PC_CF1_N_SBR, DIST) , ' ' , A.VCHR_LINE_APPR ,0 ,' ' ,0 ,A.INVOICE_DT ,' ' ,' ' ,A.VOUCHER_STYLE ,A.VCHR_SRC ,' ' ,' ' ,0 ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT || A.VOUCHER_ID ,3 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'N' ,' ' FROM PS_VOUCHER A , PS_DISTRIB_LINE DIST ,PS_EM_INVLN_APRHVW HVW WHERE A.BUSINESS_UNIT = DIST.BUSINESS_UNIT AND A.VOUCHER_ID = DIST.VOUCHER_ID AND ((A.PROCESS_MAN_CLOSE = 'N' OR A.CLOSE_STATUS <> 'C') ) AND A.ENTRY_STATUS NOT IN ('X' ) AND A.VOUCHER_STYLE <> 'TMPL' AND DIST.BUSINESS_UNIT = HVW.BUSINESS_UNIT AND DIST.VOUCHER_ID = HVW.VOUCHER_ID AND DIST.VOUCHER_LINE_NUM = HVW.VOUCHER_LINE_NUM AND DIST.DISTRIB_LINE_NUM = HVW.DISTRIB_LINE_NUM UNION SELECT A.BUSINESS_UNIT ,A.BUSINESS_UNIT , A.VOUCHER_ID , DIST.VOUCHER_LINE_NUM , DIST.DISTRIB_LINE_NUM , A.INVOICE_ID , A.VENDOR_SETID , A.VENDOR_ID , A.VNDR_LOC , ' ' , A.INVOICE_DT , DIST.MERCHANDISE_AMT , DIST.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,' ' , DIST.APPR_STATUS , DIST.BUSINESS_UNIT_GL , ' ' ,' ' , %subrec(EM_DISTLINE_FLD, DIST) , %subrec(CF16_AN_SBR, DIST) , %subrec(PC_CF1_N_SBR, DIST) , ' ' , A.VCHR_LINE_APPR ,0 ,' ' ,0 ,A.INVOICE_DT ,' ' ,' ' ,A.VOUCHER_STYLE ,A.VCHR_SRC ,' ' ,' ' ,0 ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT || A.VOUCHER_ID ,3 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'N' ,' ' FROM PS_VOUCHER A , PS_DISTRIB_LINE DIST WHERE A.BUSINESS_UNIT = DIST.BUSINESS_UNIT AND A.VOUCHER_ID = DIST.VOUCHER_ID AND ((A.PROCESS_MAN_CLOSE = 'N' OR A.CLOSE_STATUS <> 'C') ) AND A.ENTRY_STATUS NOT IN ('X' ) AND A.VOUCHER_STYLE <> 'TMPL' AND NOT EXISTS ( SELECT 'X' FROM PS_EM_INVLINE_APPR APPR WHERE APPR.BUSINESS_UNIT = DIST.BUSINESS_UNIT AND APPR.VOUCHER_ID = DIST.VOUCHER_ID AND APPR.VOUCHER_LINE_NUM = DIST.VOUCHER_LINE_NUM AND APPR.DISTRIB_LINE_NUM = DIST.DISTRIB_LINE_NUM) UNION ALL SELECT DISTINCT A.BUSINESS_UNIT , A.BUSINESS_UNIT , A.VOUCHER_ID ,0 ,0 , A.INVOICE_ID , B.SETID , B.VENDOR_ID , D.VNDR_LOC ,' ' , A.INVOICE_DT , A.GROSS_AMT , D.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,' ' ,' ' , ' ' , B.SETID ,' ' , ' ' , ' ' ,' ' , %Sql(FS_CF_SPACES) ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,A.VCHR_LINE_APPR , A.DSCNT_AMT , ' ' , 0 , D.DUE_DT , D.PYMNT_HOLD , D.PYMNT_SELCT_STATUS , A.VOUCHER_STYLE , A.VCHR_SRC , T.SETID , A.PYMNT_TERMS_CD , A.PYMNT_CNT_TOTAL ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT %Concat '/' %Concat A.VOUCHER_ID ,1 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'P' , CASE WHEN A.VCHR_APPRVL_FLG = 'S' THEN D2.ROLENAME ELSE ' ' END FROM PS_VOUCHER A , PS_VENDOR B , PS_PYMNT_VCHR_XREF D , PS_BUS_UNIT_TBL_FS BU , PS_PYMT_TRMS_HDR T , PS_EM_VCHR_APR_DAT D2 , PS_SET_CNTRL_REC REC WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.VOUCHER_ID = D.VOUCHER_ID AND A.BUSINESS_UNIT = BU.BUSINESS_UNIT AND ((A.BUSINESS_UNIT = D2.BUSINESS_UNIT AND A.VOUCHER_ID = D2.VOUCHER_ID AND D2.CURRENT_STATUS='Y' ) OR ( ((EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN1_A , PS_EOAW_STEPINST CASETHEN1_B WHERE CASETHEN1_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN1_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN1_AA WHERE CASETHEN1_AA.BUSINESS_UNIT = CASETHEN1_A.BUSINESS_UNIT AND CASETHEN1_AA.VOUCHER_ID = CASETHEN1_A.VOUCHER_ID) AND CASETHEN1_A.EOAWTHREAD_ID = CASETHEN1_B.EOAWTHREAD_ID AND CASETHEN1_A.EOAWPRCS_ID = CASETHEN1_B.EOAWPRCS_ID AND CASETHEN1_A.EOAWDEFN_ID = CASETHEN1_B.EOAWDEFN_ID AND CASETHEN1_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN1_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN1_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN1_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN2_A , PS_EOAW_STEPINST CASETHEN2_B , PS_EOAW_USERINST CASETHEN2_C WHERE CASETHEN2_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN2_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN2_AA WHERE CASETHEN2_AA.BUSINESS_UNIT = CASETHEN2_A.BUSINESS_UNIT AND CASETHEN2_AA.VOUCHER_ID = CASETHEN2_A.VOUCHER_ID) AND CASETHEN2_A.EOAWTHREAD_ID = CASETHEN2_B.EOAWTHREAD_ID AND CASETHEN2_A.EOAWPRCS_ID = CASETHEN2_B.EOAWPRCS_ID AND CASETHEN2_A.EOAWDEFN_ID = CASETHEN2_B.EOAWDEFN_ID AND CASETHEN2_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_C.EOAWSTEP_INSTANCE = CASETHEN2_B.EOAWSTEP_INSTANCE AND CASETHEN2_C.EOAWUSER_TYPE = 'A' AND CASETHEN2_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN2_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN2_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN3_A , PS_EOAW_STEPINST CASETHEN3_B WHERE CASETHEN3_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN3_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN3_AA WHERE CASETHEN3_A.BUSINESS_UNIT = CASETHEN3_AA.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = CASETHEN3_AA.VOUCHER_ID) AND CASETHEN3_A.EOAWTHREAD_ID = CASETHEN3_B.EOAWTHREAD_ID AND CASETHEN3_A.EOAWPRCS_ID = CASETHEN3_B.EOAWPRCS_ID AND CASETHEN3_A.EOAWDEFN_ID = CASETHEN3_B.EOAWDEFN_ID AND CASETHEN3_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN3_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN3_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN4_A , PS_EOAW_STEPINST CASETHEN4_B , PS_EOAW_USERINST CASETHEN4_C WHERE CASETHEN4_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN4_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN4_AA WHERE CASETHEN4_AA.BUSINESS_UNIT = CASETHEN4_A.BUSINESS_UNIT AND CASETHEN4_AA.VOUCHER_ID = CASETHEN4_A.VOUCHER_ID) AND CASETHEN4_A.EOAWTHREAD_ID = CASETHEN4_B.EOAWTHREAD_ID AND CASETHEN4_A.EOAWPRCS_ID = CASETHEN4_B.EOAWPRCS_ID AND CASETHEN4_A.EOAWDEFN_ID = CASETHEN4_B.EOAWDEFN_ID AND CASETHEN4_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_C.EOAWSTEP_INSTANCE = CASETHEN4_B.EOAWSTEP_INSTANCE AND CASETHEN4_C.EOAWUSER_TYPE = 'A' AND CASETHEN4_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN4_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN4_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL')))) ) ) AND A.PYMNT_TERMS_CD = T.PYMNT_TERMS_CD AND A.ENTRY_STATUS ='P' AND A.VCHR_APPRVL_FLG IN ('S' ,'W') AND A.MATCH_STATUS_VCHR IN ('M','N','O') AND A.CLOSE_STATUS <> 'C' AND A.PROCESS_MAN_CLOSE <> 'Y' AND T.SETID = REC.SETID AND REC.RECNAME = 'PYMT_TRMS_HDR' AND REC.REC_GROUP_ID = 'FS_14' AND REC.SETCNTRLVALUE = A.BUSINESS_UNIT AND D.DUE_DT IS NOT NULL UNION ALL SELECT DISTINCT A.BUSINESS_UNIT , A.BUSINESS_UNIT , A.VOUCHER_ID ,C1.VOUCHER_LINE_NUM ,0 , A.INVOICE_ID , B.SETID , B.VENDOR_ID , D.VNDR_LOC ,' ' , A.INVOICE_DT , C1.MERCHANDISE_AMT , D.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,C1.APPR_STATUS ,' ' ,' ' , B.SETID ,' ' , ' ' , ' ' ,' ' , %Sql(FS_CF_SPACES) ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,A.VCHR_LINE_APPR , A.DSCNT_AMT , ' ' , 0 , D.DUE_DT , D.PYMNT_HOLD , D.PYMNT_SELCT_STATUS , A.VOUCHER_STYLE , A.VCHR_SRC , T.SETID , A.PYMNT_TERMS_CD , A.PYMNT_CNT_TOTAL ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT %Concat '/' %Concat A.VOUCHER_ID ,2 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'P' , CASE WHEN A.VCHR_APPRVL_FLG = 'S' THEN D2.ROLENAME ELSE ' ' END FROM PS_VOUCHER A ,PS_VOUCHER_LINE C1 , PS_VENDOR B , PS_PYMNT_VCHR_XREF D , PS_BUS_UNIT_TBL_FS BU , PS_PYMT_TRMS_HDR T , PS_EM_VCHR_APR_DAT D2 , PS_SET_CNTRL_REC REC WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.VOUCHER_ID = D.VOUCHER_ID AND A.BUSINESS_UNIT = C1.BUSINESS_UNIT AND A.VOUCHER_ID = C1.VOUCHER_ID AND A.BUSINESS_UNIT = BU.BUSINESS_UNIT AND ((A.BUSINESS_UNIT = D2.BUSINESS_UNIT AND A.VOUCHER_ID = D2.VOUCHER_ID AND D2.CURRENT_STATUS='Y') OR ( ((EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN1_A , PS_EOAW_STEPINST CASETHEN1_B WHERE CASETHEN1_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN1_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN1_AA WHERE CASETHEN1_AA.BUSINESS_UNIT = CASETHEN1_A.BUSINESS_UNIT AND CASETHEN1_AA.VOUCHER_ID = CASETHEN1_A.VOUCHER_ID) AND CASETHEN1_A.EOAWTHREAD_ID = CASETHEN1_B.EOAWTHREAD_ID AND CASETHEN1_A.EOAWPRCS_ID = CASETHEN1_B.EOAWPRCS_ID AND CASETHEN1_A.EOAWDEFN_ID = CASETHEN1_B.EOAWDEFN_ID AND CASETHEN1_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN1_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN1_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN1_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN2_A , PS_EOAW_STEPINST CASETHEN2_B , PS_EOAW_USERINST CASETHEN2_C WHERE CASETHEN2_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN2_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN2_AA WHERE CASETHEN2_AA.BUSINESS_UNIT = CASETHEN2_A.BUSINESS_UNIT AND CASETHEN2_AA.VOUCHER_ID = CASETHEN2_A.VOUCHER_ID) AND CASETHEN2_A.EOAWTHREAD_ID = CASETHEN2_B.EOAWTHREAD_ID AND CASETHEN2_A.EOAWPRCS_ID = CASETHEN2_B.EOAWPRCS_ID AND CASETHEN2_A.EOAWDEFN_ID = CASETHEN2_B.EOAWDEFN_ID AND CASETHEN2_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_C.EOAWSTEP_INSTANCE = CASETHEN2_B.EOAWSTEP_INSTANCE AND CASETHEN2_C.EOAWUSER_TYPE = 'A' AND CASETHEN2_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN2_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN2_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN3_A , PS_EOAW_STEPINST CASETHEN3_B WHERE CASETHEN3_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN3_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN3_AA WHERE CASETHEN3_A.BUSINESS_UNIT = CASETHEN3_AA.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = CASETHEN3_AA.VOUCHER_ID) AND CASETHEN3_A.EOAWTHREAD_ID = CASETHEN3_B.EOAWTHREAD_ID AND CASETHEN3_A.EOAWPRCS_ID = CASETHEN3_B.EOAWPRCS_ID AND CASETHEN3_A.EOAWDEFN_ID = CASETHEN3_B.EOAWDEFN_ID AND CASETHEN3_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN3_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN3_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN4_A , PS_EOAW_STEPINST CASETHEN4_B , PS_EOAW_USERINST CASETHEN4_C WHERE CASETHEN4_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN4_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN4_AA WHERE CASETHEN4_AA.BUSINESS_UNIT = CASETHEN4_A.BUSINESS_UNIT AND CASETHEN4_AA.VOUCHER_ID = CASETHEN4_A.VOUCHER_ID) AND CASETHEN4_A.EOAWTHREAD_ID = CASETHEN4_B.EOAWTHREAD_ID AND CASETHEN4_A.EOAWPRCS_ID = CASETH EN4_B.EOAWPRCS_ID AND CASETHEN4_A.EOAWDEFN_ID = CASETHEN4_B.EOAWDEFN_ID AND CASETHEN4_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_C.EOAWSTEP_INSTANCE = CASETHEN4_B.EOAWSTEP_INSTANCE AND CASETHEN4_C.EOAWUSER_TYPE = 'A' AND CASETHEN4_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN4_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN4_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL')))) ) ) AND A.PYMNT_TERMS_CD = T.PYMNT_TERMS_CD AND A.ENTRY_STATUS ='P' AND A.VCHR_APPRVL_FLG IN ('S', 'W') AND A.MATCH_STATUS_VCHR IN ('M','N','O') AND A.CLOSE_STATUS <> 'C' AND A.PROCESS_MAN_CLOSE <> 'Y' AND T.SETID = REC.SETID AND REC.RECNAME = 'PYMT_TRMS_HDR' AND REC.REC_GROUP_ID = 'FS_14' AND REC.SETCNTRLVALUE = A.BUSINESS_UNIT AND D.DUE_DT IS NOT NULL UNION ALL SELECT DISTINCT A.BUSINESS_UNIT , A.BUSINESS_UNIT , A.VOUCHER_ID ,C1.VOUCHER_LINE_NUM ,C1.DISTRIB_LINE_NUM , A.INVOICE_ID , B.SETID , B.VENDOR_ID , D.VNDR_LOC ,' ' , A.INVOICE_DT , C1.MERCHANDISE_AMT , D.TXN_CURRENCY_CD , A.ENTERED_DT , A.APPR_STATUS , A.VCHR_APPRVL_FLG , A.MATCH_STATUS_VCHR ,' ' , %subrec(EM_DISTLINE_FLD, C1) , %subrec(CF16_AN_SBR, C1) , %subrec(PC_CF1_N_SBR, C1) ,' ' ,' ' , B.SETID ,' ' , ' ' , A.VCHR_LINE_APPR , A.DSCNT_AMT , ' ' , 0 , D.DUE_DT , D.PYMNT_HOLD , D.PYMNT_SELCT_STATUS , A.VOUCHER_STYLE , A.VCHR_SRC , T.SETID , A.PYMNT_TERMS_CD , A.PYMNT_CNT_TOTAL ,' ' ,' ' ,0 ,' ' ,' ' ,' ' , A.BUSINESS_UNIT %Concat '/' %Concat A.VOUCHER_ID ,3 ,0 ,0 ,0 ,'E' ,' ' ,0 ,'P' , CASE WHEN A.VCHR_APPRVL_FLG = 'S' THEN D2.ROLENAME ELSE ' ' END FROM PS_VOUCHER A ,PS_DISTRIB_LINE C1 , PS_VENDOR B , PS_PYMNT_VCHR_XREF D , PS_BUS_UNIT_TBL_FS BU , PS_PYMT_TRMS_HDR T , PS_EM_VCHR_APR_DAT D2 , PS_SET_CNTRL_REC REC WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.VOUCHER_ID = D.VOUCHER_ID AND A.BUSINESS_UNIT = C1.BUSINESS_UNIT AND A.VOUCHER_ID = C1.VOUCHER_ID AND A.BUSINESS_UNIT = BU.BUSINESS_UNIT AND ((A.BUSINESS_UNIT = D2.BUSINESS_UNIT AND A.VOUCHER_ID = D2.VOUCHER_ID AND D2.CURRENT_STATUS = 'Y' ) OR ( ((EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN1_A , PS_EOAW_STEPINST CASETHEN1_B WHERE CASETHEN1_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN1_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN1_AA WHERE CASETHEN1_AA.BUSINESS_UNIT = CASETHEN1_A.BUSINESS_UNIT AND CASETHEN1_AA.VOUCHER_ID = CASETHEN1_A.VOUCHER_ID) AND CASETHEN1_A.EOAWTHREAD_ID = CASETHEN1_B.EOAWTHREAD_ID AND CASETHEN1_A.EOAWPRCS_ID = CASETHEN1_B.EOAWPRCS_ID AND CASETHEN1_A.EOAWDEFN_ID = CASETHEN1_B.EOAWDEFN_ID AND CASETHEN1_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN1_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN1_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN1_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_EMVCH_AF_XREF CASETHEN2_A , PS_EOAW_STEPINST CASETHEN2_B , PS_EOAW_USERINST CASETHEN2_C WHERE CASETHEN2_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN2_AA.EOAWTHREAD_ID) FROM PS_EMVCH_AF_XREF CASETHEN2_AA WHERE CASETHEN2_AA.BUSINESS_UNIT = CASETHEN2_A.BUSINESS_UNIT AND CASETHEN2_AA.VOUCHER_ID = CASETHEN2_A.VOUCHER_ID) AND CASETHEN2_A.EOAWTHREAD_ID = CASETHEN2_B.EOAWTHREAD_ID AND CASETHEN2_A.EOAWPRCS_ID = CASETHEN2_B.EOAWPRCS_ID AND CASETHEN2_A.EOAWDEFN_ID = CASETHEN2_B.EOAWDEFN_ID AND CASETHEN2_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_C.EOAWSTEP_INSTANCE = CASETHEN2_B.EOAWSTEP_INSTANCE AND CASETHEN2_C.EOAWUSER_TYPE = 'A' AND CASETHEN2_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN2_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN2_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN2_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN3_A , PS_EOAW_STEPINST CASETHEN3_B WHERE CASETHEN3_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN3_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN3_AA WHERE CASETHEN3_A.BUSINESS_UNIT = CASETHEN3_AA.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = CASETHEN3_AA.VOUCHER_ID) AND CASETHEN3_A.EOAWTHREAD_ID = CASETHEN3_B.EOAWTHREAD_ID AND CASETHEN3_A.EOAWPRCS_ID = CASETHEN3_B.EOAWPRCS_ID AND CASETHEN3_A.EOAWDEFN_ID = CASETHEN3_B.EOAWDEFN_ID AND CASETHEN3_B.EOAWSTEP_STATUS <> 'A' AND CASETHEN3_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN3_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN3_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL'))) OR (EXISTS( SELECT 'X' FROM PS_VCHR_AF_XREF CASETHEN4_A , PS_EOAW_STEPINST CASETHEN4_B , PS_EOAW_USERINST CASETHEN4_C WHERE CASETHEN4_A.EOAWTHREAD_ID = ( SELECT MAX(CASETHEN4_AA.EOAWTHREAD_ID) FROM PS_VCHR_AF_XREF CASETHEN4_AA WHERE CASETHEN4_AA.BUSINESS_UNIT = CASETHEN4_A.BUSINESS_UNIT AND CASETHEN4_AA.VOUCHER_ID = CASETHEN4_A.VOUCHER_ID) AND CASETHEN4_A.EOAWTHREAD_ID = CASETHEN4_B.EOAWTHREAD_ID AND CASETHEN4_A.EOAWPRCS_ID = CASETHEN4_B.EOAWPRCS_ID AND CASETHEN4_A.EOAWDEFN_ID = CASETHEN4_B.EOAWDEFN_ID AND CASETHEN4_B.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_C.EOAWSTEP_INSTANCE = CASETHEN4_B.EOAWSTEP_INSTANCE AND CASETHEN4_C.EOAWUSER_TYPE = 'A' AND CASETHEN4_C.EOAWSTEP_STATUS IN ('A','D') AND CASETHEN4_A.BUSINESS_UNIT = A.BUSINESS_UNIT AND CASETHEN4_A.VOUCHER_ID = A.VOUCHER_ID AND CASETHEN4_B.EOAWSTEP_STATUS = 'P' AND A.VCHR_APPRVL_FLG = 'W' AND A.VCHR_SRC IN ('SSI','XML','DCM','EXL')))) ) ) AND A.PYMNT_TERMS_CD = T.PYMNT_TERMS_CD AND A.ENTRY_STATUS ='P' AND A.VCHR_APPRVL_FLG IN ('S', 'W' ) AND A.MATCH_STATUS_VCHR IN ('M','N','O') AND A.CLOSE_STATUS <> 'C' AND A.PROCESS_MAN_CLOSE <> 'Y' AND T.SETID = REC.SETID AND REC.RECNAME = 'PYMT_TRMS_HDR' AND REC.REC_GROUP_ID = 'FS_14' AND REC.SETCNTRLVALUE = A.BUSINESS_UNIT AND D.DUE_DT IS NOT NULL

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 EM_BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Buyer
2 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit
3 VOUCHER_ID Character(8) VARCHAR2(8) NOT NULL Voucher ID
4 VOUCHER_LINE_NUM Number(5,0) INTEGER NOT NULL Voucher Line Number
5 DISTRIB_LINE_NUM Number(5,0) INTEGER NOT NULL Distribution Line
6 INVOICE_ID Character(30) VARCHAR2(30) NOT NULL Invoice Number

Prompt Table: EM_INVOI_USR_VW

7 VENDOR_SETID Character(5) VARCHAR2(5) NOT NULL Vendor SetID
8 VENDOR_ID Character(10) VARCHAR2(10) NOT NULL Vendor Identifier
9 VNDR_LOC Character(10) VARCHAR2(10) NOT NULL Vendor Location
10 DESCR Character(30) VARCHAR2(30) NOT NULL Description
11 INVOICE_DT Date(10) DATE Invoice Date
12 GROSS_AMT Signed Number(28,3) DECIMAL(26,3) NOT NULL Gross Invoice Amount
13 TXN_CURRENCY_CD Character(3) VARCHAR2(3) NOT NULL Transaction Currency
14 ENTERED_DT Date(10) DATE Entered on
15 APPR_STATUS Character(1) VARCHAR2(1) NOT NULL Approval status flag used on appr_inst_log and derived records to track virtual approver status
A=Approved
D=Denied
P=Pending
16 VCHR_APPRVL_FLG Character(1) VARCHAR2(1) NOT NULL Voucher Approval Flag
D=Default from Higher Level
P=Pre-Approved
S=Virtual Approver
W=Approval Framework
17 MATCH_STATUS_VCHR Character(1) VARCHAR2(1) NOT NULL Match Status
C=Overridden - Credit Note
D=Match Dispute
E=Match Exceptions Exist
M=Matched
N=Not Applicable
O=Manually Overridden
T=To Be Matched
18 LINE_STATUS Character(1) VARCHAR2(1) NOT NULL Line Status
A=Active
C=Cancelled
I=Inactive
O=Open
P=Pending
19 DISTRIB_LN_STATUS Character(1) VARCHAR2(1) NOT NULL Distribution Line Status
C=Closed
M=Mass Liquidated
O=Open
P=Unavailable for Sourcing
X=Canceled
20 BUSINESS_UNIT_GL Character(5) VARCHAR2(5) NOT NULL GL Business Unit
21 SETID Character(5) VARCHAR2(5) NOT NULL SetID
22 INV_ITEM_ID Character(18) VARCHAR2(18) NOT NULL Item ID

Prompt Table: %EDITTABLE13

23 ALTACCT Character(10) VARCHAR2(10) NOT NULL Alternate Account

Prompt Table: %EDIT_ALTACCT
Set Control Field: ALTACCT_SETID

24 ACCOUNT Character(10) VARCHAR2(10) NOT NULL Account
25 DEPTID Character(10) VARCHAR2(10) NOT NULL Department

Prompt Table: DEPTID_BUGL_VW

26 OPERATING_UNIT Character(8) VARCHAR2(8) NOT NULL Operating Unit ChartField

Prompt Table: OPERUNT_BUGL_VW

27 PRODUCT Character(6) VARCHAR2(6) NOT NULL Product ChartField

Prompt Table: PRODUCT_BUGL_VW

28 FUND_CODE Character(5) VARCHAR2(5) NOT NULL Fund Code

Prompt Table: FUND_BUGL_VW

29 CLASS_FLD Character(5) VARCHAR2(5) NOT NULL Class Field

Prompt Table: CLASSCF_BUGL_VW

30 PROGRAM_CODE Character(5) VARCHAR2(5) NOT NULL Program Code ChartField

Prompt Table: PROGRAM_BUGL_VW

31 BUDGET_REF Character(8) VARCHAR2(8) NOT NULL Budget Reference

Prompt Table: BUD_REF_BUGL_VW

32 AFFILIATE Character(5) VARCHAR2(5) NOT NULL Affiliate

Prompt Table: AFFILIATE_VW

33 AFFILIATE_INTRA1 Character(10) VARCHAR2(10) NOT NULL IntraUnit Affiliate1

Prompt Table: %EDIT_INTRA01

34 AFFILIATE_INTRA2 Character(10) VARCHAR2(10) NOT NULL Operating Unit Affiliate

Prompt Table: %EDIT_INTRA02

35 CHARTFIELD1 Character(10) VARCHAR2(10) NOT NULL Expansion chartfield 1

Prompt Table: CF1_BUGL_VW

36 CHARTFIELD2 Character(10) VARCHAR2(10) NOT NULL Expansion Chartfield 2

Prompt Table: CF2_BUGL_VW

37 CHARTFIELD3 Character(10) VARCHAR2(10) NOT NULL Expansion Chartfield 3

Prompt Table: CF3_BUGL_VW

38 BUSINESS_UNIT_PC Character(5) VARCHAR2(5) NOT NULL PC Business Unit

Prompt Table: %EDIT_BU_PC

39 PROJECT_ID Character(15) VARCHAR2(15) NOT NULL Project Id ChartField

Prompt Table: %EDIT_PROJECT

40 ACTIVITY_ID Character(15) VARCHAR2(15) NOT NULL Activity ID

Prompt Table: %EDIT_ACTIVITY

41 RESOURCE_TYPE Character(5) VARCHAR2(5) NOT NULL Source Type

Prompt Table: PROJ_RESTYPE_FS
Set Control Field: BUSINESS_UNIT_PC

42 RESOURCE_CATEGORY Character(5) VARCHAR2(5) NOT NULL Category

Prompt Table: %EDIT_RES_CAT
Set Control Field: BUSINESS_UNIT_PC

43 RESOURCE_SUB_CAT Character(5) VARCHAR2(5) NOT NULL Subcategory

Prompt Table: %EDIT_RES_SUB
Set Control Field: BUSINESS_UNIT_PC

44 ANALYSIS_TYPE Character(3) VARCHAR2(3) NOT NULL Analysis Type

Prompt Table: %EDIT_ANALYSIS
Set Control Field: BUSINESS_UNIT_PC

45 DESCR254_MIXED Character(254) VARCHAR2(254) NOT NULL Description
46 VCHR_LINE_APPR Character(1) VARCHAR2(1) NOT NULL Invoice Line Approval Status
0=Line Routing Not Required
1=Completed
2=Routed for Approval
47 DSCNT_AMT Signed Number(28,3) DECIMAL(26,3) NOT NULL Discount Amount
48 CURRENCY_PYMNT Character(3) VARCHAR2(3) NOT NULL Payment Currency
49 PAID_AMT Signed Number(28,3) DECIMAL(26,3) NOT NULL Paid Amount
50 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.
51 PYMNT_HOLD Character(1) VARCHAR2(1) NOT NULL Hold Payment
N=No
Y=Yes
52 PYMNT_SELCT_STATUS Character(1) VARCHAR2(1) NOT NULL Payment Selection Status
C=Closed
D=Negative Voucher Sum
E=Externally Paid
F=Federal Sanctions Error
I=In Process - EFT
N=Not Selected for Payment
O=Financial Sanctions Review
P=Paid
R=Requested for Payment
S=Settlement Payment
V=Convert Error
X=Canceled
Y=Prepaid
53 VOUCHER_STYLE Character(4) VARCHAR2(4) NOT NULL Voucher Style
ADJ=Adjustments
AMR=Amortization Voucher
CLBK=Claim Voucher
CORR=Reversal Voucher
JRNL=Journal Voucher
PPAY=Prepaid Voucher
REG=Regular Voucher
RGTR=Register Voucher
SGLP=Single Payment Voucher
THRD=Third Party Voucher
TMPL=Template Voucher
54 VCHR_SRC Character(4) VARCHAR2(4) NOT NULL Voucher Source
55 SETID_PAYTRMS Character(5) VARCHAR2(5) NOT NULL Payment Terms Setid
56 PYMNT_TERMS_CD Character(5) VARCHAR2(5) NOT NULL Specifies how the payment due date and discount due date are calculated. A payment terms code is associated with various business units bill-to customers vendors as well as sales orders purchase orders and vouchers.
57 PYMNT_CNT_TOTAL Number(5,0) INTEGER NOT NULL Total Payment Count
58 PYMNT_METHOD Character(3) VARCHAR2(3) NOT NULL Payment Method
ACH=Automated Clearing House
BEF=Draft - Customer EFT
BOO=Draft - Customer Initiated
CHK=System Check
D=Deposit
DD=Direct Debit
DFT=Draft - Supplier Initiated
DRA=Draft
EFT=Electronic Funds Transfer
GE=Giro - EFT
GM=Giro - Manual
LC=Letter of Credit
MAN=Manual Check
TRW=Treasury Wire
WIR=Wire Transfer
59 PAY_CYCLE Character(6) VARCHAR2(6) NOT NULL Pay Cycle
60 PAY_CYCLE_SEQ_NUM Number(6,0) INTEGER NOT NULL Pay Cycle Sequence Number
61 DOC_TOL_HDR_STATUS Character(1) VARCHAR2(1) NOT NULL Document Heade Document Tolerance Status
E=Error
N=Not Checked
R=Reset
V=Valid
62 BUDGET_HDR_STATUS Character(1) VARCHAR2(1) NOT NULL Budget Checking Header Status
E=Error in Budget Check
I=Document In Processing
N=Not Budget Checked
P=Provisionally Valid
V=Valid
63 AP_MATCH_TYPE Character(1) VARCHAR2(1) NOT NULL Match Type
C=Matched with Credit Note
D=Matched with Debit Memo
O=Matched with Override
P=Auto - Matched
64 DESCR1 Character(30) VARCHAR2(30) NOT NULL Descr
65 LEVEL_NUM Number(3,0) SMALLINT NOT NULL Level
66 LEVEL1 Number(5,0) INTEGER NOT NULL Level 1
67 LEVEL2 Number(5,0) INTEGER NOT NULL Level 2
68 LEVEL3 Number(5,0) INTEGER NOT NULL Level 3
69 EXPAND_COLL_FLG Character(1) VARCHAR2(1) NOT NULL Expand Row
70 RECORDNAME Character(15) VARCHAR2(15) NOT NULL Record Name
01=MASTER_ITEM_EC
02=INV_ITEMS_EC
03=BU_ITM_INV_EC
04=BU_ITM_WTVL_EC
05=ITEM_SUPPLIER_EC
06=ITM_SUPP_LOC_EC
07=ITM_VNDR_UOM_EC
08=ITM_VND_UMPR_EC
09=INV_ITM_UOM_EC
10=PUR_ITM_ATTR_EC
13=EN_REVISION_EC
14=ITEM_MFG_GPO_EC
15=ITEM_MFG_EC
16=ITEM_CAT_EC
71 SEQ_NBR Number(15,0) DECIMAL(15) NOT NULL Sequence Number
72 FLAG Character(1) VARCHAR2(1) NOT NULL Flag
N=No
Y=Yes
73 ROLENAME Character(30) VARCHAR2(30) NOT NULL The name of a Role in the Role Definition Table (see PSROLEDEFN).