AP Payables Option Report
SELECT Org.Name Op_Unit_Name,
Prm.Org_Id Org_Id,
ASPEV.ASP_WHEN_TO_ACCOUNT_GAIN_LOSS When_Acct_Gain_Loss,
ASPEV.ASP_AUTO_OFFSET_FLAG Auto_Offset,
Prm.Set_Of_Books_Id Ledger_Id,
Lgr.Name Ledger_Name,
Prm.Last_Updated_By Last_Updt_Id,
-- Usr.Description Last_Updt_Name, User name directly stored last_updated_by
TO_CHAR(Prm.Last_Update_Date,'MM/DD/YYYY') Last_Updt_Date,
Prm.When_To_Account_Pmt When_Acct_Payment,
-- Prm.When_To_Account_Gain_Loss When_Acct_Gain_Loss,
-- Prm.Automatic_Offsets_Flag Auto_Offset,--Not Present int table
Prm.Discount_Distribution_Method Discount_Method,
Prm.Build_Prepayment_Accounts_Flag Prepay_Acct_Flag,
-- Prm.Multi_Currency_Flag Use_Multi_Curr,--Not Present in table
Prm.Make_Rate_Mandatory_Flag Require_Rate,
-- Prm.Calc_User_Xrate Calc_User_Rate,--Not Present in table
-- Prm.Default_Exchange_Rate_Type Rate_Type,--Not Present in table
Gc1.Segment1 Gain_Co,
Gc1.Segment3 Gain_Gac,
Gc1.Segment4 Gain_Lac,
Gc2.Segment1 Loss_Co,
Gc2.Segment3 Loss_Gac,
Gc2.Segment4 Loss_Lac,
--Rounding combination id is not present in system parameters
Gc3.Segment1 Round_Co,
Gc3.Segment3 Round_Gac,
Gc3.Segment4 Round_Lac,
-- Prm.Confirm_Date_As_Inv_Num_Flag Date_Inv_Flag,--Not present in table
-- Prm.Approvals_Option Online_Validation,-- Not Present in base table
Prm.Inv_Doc_Category_Override Doc_Catg_Override,
Prm.Allow_Paid_Invoice_Adjust Paid_Inv_Adj,
Prm.Recalc_Pay_Schedule_Flag Recalc_Pay_Sched,
Prm.Allow_Supplier_Bank_Override Remit_Acct_Override,
Prm.Allow_Inv_Third_Party_Ovrd Remit_Vndr_Override,
Prm.Gl_Date_From_Receipt_Flag Gl_Date_Basis,
Prm.Freight_Code_Combination_Id Freight_Ccid,
Trm.Name Prepay_Terms,
Prm.Add_Days_Settlement_Date Settlement_Days,
Prm.Prepay_Tax_Diff_Ccid Prepay_Tax_Ccid,
Prm.Approval_Workflow_Flag Apprv_Workflow,
Prm.Allow_Force_Approval_Flag Force_Approval,
Prm.Validate_Before_Approval_Flag Valid_Bef_Apprv,
Prm.Approval_Timing Acctg_Bef_Apprv,
Prm.Allow_Final_Match_Flag Final_Match,
-- Prm.Allow_Dist_Match_Flag Dist_Match,--Not Present in table
Prm.Allow_Flex_Override_Flag Match_Acct_Override,
Prm.Transfer_Desc_Flex_Flag Xfer_Po_Flex,
Tol.Tolerance_Name Tolerances,
Prm.Auto_Calculate_Interest_Flag Calc_Interest,
-- Exp.Report_Type Dflt_Exp_Template,--cannot join expenses table
-- Prm.Apply_Advances_Default Apply_Advances,--Not Present in table
-- Prm.Create_Employee_Vendor_Flag Create_Empl_Vendor,--Not Present in table
Etm.Name Employee_Terms,
Prm.Employee_Pay_Group_Lookup_Code Empl_Pay_Group,
Prm.Employee_Payment_Priority Empl_Pay_Priority,
-- Prm.Hold_Unmatched_Invoices_Flag Hold_Unmatched_Exp,--Not present in table
Prm.Disc_Is_Inv_Less_Tax_Flag Excl_Tax_From_Disc,
Prm.Post_Dated_Payments_Flag Payment_Pre_Date,
-- Prm.Replace_Check_Flag Allow_Reissue,--Not present in table
Prm.Update_Pay_Site_Flag Allow_Addr_Chg,
Prm.Use_Bank_Charge_Flag Bank_Charges,
Prm.Allow_Pymt_Third_Party_Ovrd Allow_Remit_Override,
Prm.Allow_Awt_Flag Use_Withholding_Tax,
Prm.Allow_Awt_Override Wh_Tax_Override,
Prm.Default_Awt_Group_Id Awt_Group_Id,
Prm.Awt_Include_Discount_Amt Awt_Incl_Discount,
Prm.Awt_Include_Tax_Amt Awt_Incl_Tax,
Prm.Create_Awt_Dists_Type Apply_Wihholding_Tax,
Prm.Create_Awt_Invoices_Type Create_Withhld_Inv
FROM Ap_System_Parameters_All Prm,
AP_SYSTEM_PARAMETERS_EXTRACT_V ASPEV,
Gl_Ledgers Lgr,
-- fnd_users Usr, User name directly stored last_updated_by
Gl_Code_Combinations Gc1,
Gl_Code_Combinations Gc2,
Gl_Code_Combinations Gc3, --Rounding_Error_Ccid is not present in Ap_System_Parameters_All
Hr_All_Organization_Units Org,
Ap_Terms_Tl Trm,
Ap_Terms_Tl Etm,
Ap_Tolerance_Templates Tol
-- Ap.Ap_Expense_Reports_All Exp-- Expense report ID is not present in AP_System_parameters_all table
WHERE Lgr.Ledger_Id = Prm.Set_Of_Books_Id
AND ASPEV.asp_Set_Of_Books_Id = PRM.Set_Of_Books_Id
AND ASPEV.asp_ORG_ID = PRM.ORG_ID
AND Lgr.Short_Name <> 'INACTIVE'
-- AND Usr.username = Prm.Last_Updated_By User name directly stored last_updated_by
AND Gc1.Code_Combination_Id(+) = Prm.Gain_Code_Combination_Id
AND Gc2.Code_Combination_Id(+) = Prm.Loss_Code_Combination_Id
AND Gc3.Code_Combination_Id(+) = aspev.ASP_ROUNDING_ERROR_CCID
AND Org.Organization_Id = Prm.Org_Id
AND Trm.Term_Id(+) = Prm.Prepayment_Terms_Id
AND Trm.Language(+) = 'US'
AND Etm.Term_Id(+) = Prm.Employee_Terms_Id
AND Etm.Language(+) = 'US'
AND Tol.Tolerance_Id(+) = Prm.Tolerance_Id
AND SUBSTR(Org.name,1,3) = NVL(:p_company_code,SUBSTR(Org.name,1,3))
AND TRUNC(prm.last_update_Date) BETWEEN NVL(:p_last_update_from,to_date(TRUNC(prm.last_update_Date),'yyyy-mm-dd')) AND NVL(:p_last_update_to,to_char(TRUNC(prm.last_update_Date),'YYYY-MM-DD'))
No comments:
Post a Comment