Search Results get_target_qty_cal




Overview

OKS_TIME_MEASURES_PUB is a public PL/SQL package in the Oracle E-Business Suite Service Contracts (OKS) module. It provides utility functions for converting, prorating, and validating quantities across units of measure and time periods, which is a core requirement when pricing, billing, and scheduling service contracts. Service agreements are frequently expressed in recurring terms such as per-month, per-year, or per-day, while underlying coverage, usage, and billing lines may be recorded in different quantities and time units. This package bridges those differences so that contract authors, pricing engines, and renewal processes can translate a source quantity into a target unit of measure or into a target time period without externally duplicating the conversion logic.

The package is declared with AUTHID CURRENT_USER, and its declared package name constant (G_PKG_NAME) is set to 'OKC_TIME_UTIL_PVT', reflecting its lineage in the shared time utility layer of the Contracts (OKC) family of APIs. Its functions accept date ranges, price units of measure, period types, and rounding controls, and they return computed numeric quantities or durations. The package falls under the PUB API classification, meaning it is intended for supported external invocation rather than as a purely internal helper.

Key Procedures and Functions

The documented interface exposes eleven procedures and functions. The principal entries relevant to the searched term get_qty_for_days are described below.

  • GET_QTY_FOR_DAYS — Returns a quantity calculated for a given number of days, expressed in a specified target unit of measure, with support for rounding. This is the function most commonly referenced when a caller needs to derive the quantity that corresponds to a specific day count, typically as part of proration or mid-period adjustment calculations.
  • GET_TARGET_QTY — Converts a source quantity expressed in a source unit of measure into a target unit of measure, with an optional start date and rounding control.
  • GET_TARGET_QTY_CAL — Derives a target quantity for a calendar-based period defined by start and end dates, using a price unit of measure and period type.
  • GET_TARGET_QTY_SERVICE — Derives a target quantity for a service-based period defined by start and end dates, using a price unit of measure and period type.
  • GET_PARTIAL_PERIOD_DURATION — Computes the duration of a partial period between two dates for a given price unit of measure, period type, and period start specification.
  • GET_FULL_PERIODS — Returns the number of complete periods between two dates, the end date of the final full period, and a return status through its output parameters.
  • GET_CON_FACTOR — Returns the conversion factor between a source and a target unit of measure.
  • GET_QUANTITY — Returns a computed quantity based on the package's internal time and unit conversion rules.
  • GET_UOM_CODE — Returns the unit of measure code associated with a given input.
  • GET_DURATION_UOM — Returns the unit of measure applicable to a duration value.
  • GET_MONTHS_BETWEEN — Returns the number of months between two dates, supporting period-based proration logic.

Tables Accessed

The package reads reference data through APPS synonyms for MTL_UNITS_OF_MEASURE_TL and OKC_TIME_CODE_UNITS_B. MTL_UNITS_OF_MEASURE_TL supplies unit-of-measure definitions and translated descriptions used during quantity and conversion-factor resolution. OKC_TIME_CODE_UNITS_B provides the time code to unit-of-measure mappings that allow period types such as day, month, or year to be matched to the correct UOM for proration and duration calculations. No direct writes to these reference tables are documented; the package is primarily a computation and lookup utility.

Usage Notes

OKS_TIME_MEASURES_PUB is typically invoked from Service Contracts forms, pricing and billing routines, and concurrent programs that process contract lines, renewals, and usage-based charges. The metadata records that it is referenced by seventeen other packages, indicating that it functions as a shared utility layer for contract time and quantity math rather than as an end-user entry point. Custom code should call these APIs by their documented names to obtain consistent proration behavior, particularly GET_QTY_FOR_DAYS when a day-based quantity is required. Because the functions return scalar values and rely on seeded unit-of-measure and time code data, callers should ensure the relevant UOM and period type values are properly defined before invocation.