SELECT DISTINCT V.BUSINESS_UNIT , SEC.OPRID , BUL.LANGUAGE_CD , BUL.DESCRSHORT FROM PS_VOUCHER V , PS_PYMNT_VCHR_XREF P , PS_VCHR_PPAY_XREF PP , PS_RT_RATE_TBL RT , PS_VENDOR_USER SEC , PS_BUS_UNIT_TBL_FS BU , PS_BUS_UNIT_LANG BUL WHERE SEC.SETID=V.VENDOR_SETID AND SEC.VENDOR_ID = V.VENDOR_ID AND V.BUSINESS_UNIT = BU.BUSINESS_UNIT AND V.BUSINESS_UNIT = P.BUSINESS_UNIT AND V.VOUCHER_ID = P.VOUCHER_ID AND V.BUSINESS_UNIT = PP.BUSINESS_UNIT AND V.VOUCHER_ID = PP.VOUCHER_ID AND PP.SEQNUM = 1 AND V.VOUCHER_STYLE = 'PPAY' AND P.PREPAID_STATUS = 'P' AND P.DUE_DT IS NOT NULL AND RT.RT_RATE_INDEX = 'MODEL' AND RT.TERM = 0 AND RT.FROM_CUR = V.TXN_CURRENCY_CD AND RT.EFFDT = ( SELECT MAX(EFFDT) FROM PS_RT_RATE_TBL RT1 WHERE RT1.RT_RATE_INDEX = RT1.RT_RATE_INDEX AND RT1.TERM = RT.TERM AND RT1.RT_TYPE = RT.RT_TYPE AND RT1.FROM_CUR = RT.FROM_CUR AND RT1.TO_CUR = RT.TO_CUR AND RT1.EFFDT <= %CurrentDateIn) AND RT.RATE_DIV <>0 AND BU.BUSINESS_UNIT = BUL.BUSINESS_UNIT
|