Search Results get_rounded_amount




Overview

OKL_AUTO_CASH_APPL_RULES_PVT is a private PL/SQL package body owned by APPS within the Oracle E-Business Suite Contracts (OKL/OKC) module, specifically supporting the lease and finance management (ETRM) cash application functionality. The package encapsulates the business rules that govern how cash receipts are automatically applied against Oracle Receivables (AR) invoices and lease contracts. Its central purpose is to determine the distribution of a receipt amount across one or more invoices or contract lines, based on the grouping of contracts under an AR invoice and on configurable cash allocation rules.

The package operates in a private (PVT) capacity, meaning it is not intended for direct invocation by external consumers but rather acts as a supporting engine called by other packages and programs within the ETRM stack. The documented metadata indicates that the package comprises seven procedures or functions and is referenced by four other packages. The header comment reflects a build dated 2008 and a 120.34 revision, consistent with the code lineage that ships in both EBS 12.1.1 and 12.2.2.

Key Procedures and Functions

The package exposes the following documented procedures and functions:

  • GET_DEFAULT_CASH_APP_RULE — Retrieves the default cash application rule to be used when no explicit rule is supplied, establishing the baseline behavior for automatic application.
  • AUTO_CASHAPP_FOR_ARINV — Drives cash application based on an AR invoice number, processing the application rule logic according to how contracts are grouped under that invoice.
  • GET_APPLICATIONS — Determines the set of invoice or contract lines to which a receipt amount should be applied.
  • AUTO_CASHAPP_FOR_CONTRACT — Performs automatic cash application at the contract level rather than the AR invoice level.
  • RECEIPT_MISMATCH — Handles or reports situations where the receipt amount and the applicable balances do not reconcile, supporting exception processing.
  • AUTO_CASHAPP_FOR_CONSINV — Applies cash against consolidated invoices, reflecting the consolidation structures maintained in the lease module.
  • GET_ROUNDED_AMOUNT — Returns a rounded monetary amount, used to normalize computed application values so that allocations balance to the receipt total without residual fractions.

Tables Accessed

The package reads and writes several core EBS tables through APPS synonyms. Receipt and application data are drawn from AR_CASH_RECEIPTS_ALL, AR_RECEIVABLE_APPLICATIONS_ALL, and AR_PAYMENTS_INTERFACE_ALL. Customer information is resolved via HZ_CUST_ACCOUNTS and RA_CUSTOMER_TRX_ALL / RA_CUSTOMER_TRX_LINES_ALL supply invoice header and line details.

Contract-side data is sourced from OKC_K_HEADERS_ALL_B, OKC_K_HEADERS_B, OKC_RULES_B, and OKC_RULE_GROUPS_B. Cash allocation rules and their line-level detail are held in OKL_CASH_ALLCTN_RLS, OKL_CASH_ALLCTN_RLS_ALL, and OKL_CSH_ALLCTN_RL_HDR. Consolidated AR header information is obtained from OKL_CNSLD_AR_HDRS_B, and streaming/type allocation references come from OKL_STRM_TYP_ALLOCS.

Usage Notes

Because OKL_AUTO_CASH_APPL_RULES_PVT is a private package, it is invoked indirectly by higher-level ETRM processes rather than directly by end users. It is referenced by four other packages, which call its procedures during receipt application, contract cash processing, and consolidated invoice handling. Typical invocation occurs during the automatic cash application workflow, when a receipt is received and must be allocated across invoices or contracts. Callers pass the API version, initialization message flag, and the output return status, message count, and message data parameters, along with inputs such as customer number, AR invoice number, currency code, and receipt application ranges. The GET_ROUNDED_AMOUNT helper is called internally wherever computed application amounts require rounding. Customizations should not call this package directly; instead, the supported public APIs and the automatic cash application concurrent programs should be used, with any rule configuration maintained in the OKL cash allocation rule tables.