DBA Data[Home] [Help]

PACKAGE: APPS.OKL_AM_CALCULATE_QUOTE_PVT

Source


1 PACKAGE      OKL_AM_CALCULATE_QUOTE_PVT  AS
2 /* $Header: OKLRCQUS.pls 120.4 2008/02/07 09:28:10 akrangan noship $ */
3 
4   ---------------------------------------------------------------------------
5   -- GLOBAL DATASTRUCTURES
6   ---------------------------------------------------------------------------
7 
8 --  SECHAWLA - Bug 2680542 - Changed the asset_tbl_type to subtype from OKL_AM_CREATE_QUOTE_PVT.assn_tbl_type
9   SUBTYPE	asset_tbl_type IS OKL_AM_CREATE_QUOTE_PVT.assn_tbl_type;
10 
11   TYPE	qlt_tbl_type IS TABLE OF VARCHAR2(30); -- quote line type
12 
13   SUBTYPE qtev_rec_type	IS okl_trx_quotes_pub.qtev_rec_type;
14   SUBTYPE tqlv_tbl_type	IS okl_txl_quote_lines_pub.tqlv_tbl_type;
15   SUBTYPE rulv_rec_type	IS okl_rule_pub.rulv_rec_type;
16 
17   ---------------------------------------------------------------------------
18   -- GLOBAL VARIABLES
19   ---------------------------------------------------------------------------
20   -- SECHAWLA 24-FEB-03 Bug # 2817025 : Added a global for sysdate
21   G_SYSDATE         DATE;
22 
23   -- Miscellaneous quote line type
24   G_MISC_QLT		CONSTANT VARCHAR2(30)	:= 'AMCMIS';
25 
26   -- Used to store transaction warning messages
27   G_QUOTE_HEADER_TABLE	CONSTANT VARCHAR2(30)	:= 'OKL_TRX_QUOTES_V';
28 
29   -- Used for quote line type validation
30   G_QUOTE_LINE_LOOKUP	CONSTANT VARCHAR2(30)	:= 'OKL_QUOTE_LINE_TYPE';
31 
32   -- Generic proration formula
33   --SECHAWLA 20-FEB-03 Bug # 2757368 : Use CONTRACT_OEC instead of QUOTE_GENERIC_LINE_PRORATION for prorating the
34   --quote line amounts (general proration using TC prorate option)
35   G_GENERIC_PRORATE	CONSTANT VARCHAR2(30) := 'CONTRACT_OEC';
36 
37   -- Element proration formula consists of element rule name plus
38   -- this variable. For example, Purchase Option Formula has a
39   -- rule "AMBPOC". Its proration formula is "AMBPOC Proration".
40   G_PRORATE_SUFFIX	CONSTANT VARCHAR2(30) := '_PRORATION';
41 
42   -- Tax formula
43   G_TAX_FORMULA		CONSTANT VARCHAR2(30)	:= 'QUOTE_TAX_CALCULATION';
44 
45   -- Tax quote line type
46   G_TAX_QLT		CONSTANT VARCHAR2(30)	:= 'AMCTAX';
47 
48   -- Parameter name for the amount to be taxed
49   G_TAX_AMT_PARAM	CONSTANT VARCHAR2(30)	:= 'TAXABLE AMOUNT';
50 
51   -- Financial Asset Line Style
52   G_FIN_ASSET_STYLE	CONSTANT VARCHAR2(30)	:= 'FREE_FORM1';
53 
54   -- Empty tables to be used for defaults in procedure parameters
55   G_EMPTY_TQLV_TBL	tqlv_tbl_type;
56   G_EMPTY_ASSET_TBL	asset_tbl_type;
57 
58   -- SECHAWLA 21-APR-03 - Bug 2925120 : Unbilled Receivebles amounts not getting Unit Prorated.
59   -- Declared a Global variable G_ASSET_TBL to store the original asset table, which has the quoted assets along with the asset and
60   -- quote quantities. Currently, when process_operand is evaluating the first operand (AMBCOC - Contarct Obligation),
61   -- it sends an empty asset table to get_operand_value procedure. This empty table is then passed to process_top_formula
62   -- and process_operand for AMCTUR (stream type) operand. Since process_stream_type_operand procedure gets an empty
63   -- asset table, t_tqlv_tbl (returned by calc_quote_stream API) can not be updated with quantities. l_tqlv_tbl is
64   -- then passed to append_quote_line, which looks for the not null values in asset and quote quantities for doing
65   -- Unit proration. Stored the asset table in the global variable and used it to update quantities in l_tqlv_tbl,
66   -- before it is passed to append_quote_line.
67 
68   G_ASSET_TBL       asset_tbl_type;
69 
70   -- Validation for missing fields
71   G_MISS_NUM		CONSTANT NUMBER		:= OKL_API.G_MISS_NUM;
72   G_MISS_CHAR		CONSTANT VARCHAR2(1)	:= OKL_API.G_MISS_CHAR;
73   G_MISS_DATE		CONSTANT DATE		:= OKL_API.G_MISS_DATE;
74 
75   -- Should a message be logged in case of missing ORG_ID
76   G_ORG_ID_MISSING_MSG	BOOLEAN			:= TRUE;
77 
78   -- Bug 3061765 MDOKAL
79   -- global to hold flag for indicating if contractual fee has been calculated.
80   G_CONT_FEE_CALC_DONE  BOOLEAN         := FALSE;
81   -- Bug 3061765 MDOKAL
82   -- variable to hold flag to indicate if a formula name is found during
83   -- get_operand value, if not found then append_quote_line is not called.
84   G_FORMULA_VALUE_FOUND BOOLEAN         := FALSE;
85   -- Bug 3061765 MDOKAL
86   -- flag to identfiy if the contract fee rule is set against early or EOT
87   -- rule group and then to ensure the new fee lines are not appended
88   -- when processing manaual quote lines. Default processing is to perform
89   -- contract fee calculation
90   G_PERFORM_CONT_FEE_CALC BOOLEAN       := TRUE;
91 
92   ---------------------------------------------------------------------------
93   -- GLOBAL MESSAGE CONSTANTS FOR ERROR HANDLING
94   ---------------------------------------------------------------------------
95 
96   G_APP_NAME		CONSTANT VARCHAR2(3)	:=  OKL_API.G_APP_NAME;
97   G_API_VERSION		CONSTANT NUMBER		:= 1;
98   G_PKG_NAME		CONSTANT VARCHAR2(200)	:=
99 					'OKL_AM_CALCULATE_QUOTE_PVT';
100 
101   G_SQLCODE_TOKEN	CONSTANT VARCHAR2(200)	:= 'SQLCODE';
102   G_SQLERRM_TOKEN	CONSTANT VARCHAR2(200)	:= 'SQLERRM';
103   G_UNEXPECTED_ERROR	CONSTANT VARCHAR2(200)	:=
104 					 'OKL_CONTRACTS_UNEXPECTED_ERROR';
105 
106   G_OKC_APP_NAME	CONSTANT VARCHAR2(3)	:= OKC_API.G_APP_NAME;
107   G_INVALID_VALUE	CONSTANT VARCHAR2(200)	:= OKC_API.G_INVALID_VALUE;
108   G_REQUIRED_VALUE	CONSTANT VARCHAR2(200)	:= OKC_API.G_REQUIRED_VALUE;
109   G_COL_NAME_TOKEN	CONSTANT VARCHAR2(200)	:= OKC_API.G_COL_NAME_TOKEN;
110 --akrangan added for bug 5568328  fix begin
111   -- global variable for proration logic - bug 5568328
112 
113 G_AMBCOC NUMBER :=0;
114 G_AMCQDR NUMBER :=0;
115 G_AMCQFE NUMBER :=0;
116 G_AMCRFE NUMBER :=0;
117 G_AMCRIN NUMBER :=0;
118 G_AMCSDD NUMBER :=0;
119 G_AMCTPE NUMBER :=0;
120 G_AMPRTX NUMBER :=0;
121 G_AMBPOC NUMBER :=0;
122 G_AMBCOC_OPTION VARCHAR2(30) :='LINE_CALCULATION';
123 G_AMCQDR_OPTION VARCHAR2(30) :='LINE_CALCULATION';
124 G_AMCQFE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
125 G_AMCRFE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
126 G_AMCRIN_OPTION VARCHAR2(30) :='LINE_CALCULATION';
127 G_AMCSDD_OPTION VARCHAR2(30) :='LINE_CALCULATION';
128 G_AMCTPE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
129 G_AMPRTX_OPTION VARCHAR2(30) :='LINE_CALCULATION';
130 G_AMBPOC_OPTION VARCHAR2(30) :='LINE_CALCULATION';
131 
132 --akrangan added for bug fix end
133 
134 
135 
136   ---------------------------------------------------------------------------
137   -- Procedures and Functions
138   ---------------------------------------------------------------------------
139 
140   -- The main body of the calculate quote process
141   PROCEDURE generate (
142 		p_api_version	IN  NUMBER,
143 		p_init_msg_list	IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
144 		x_msg_count	OUT NOCOPY NUMBER,
145 		x_msg_data	OUT NOCOPY VARCHAR2,
146 		x_return_status	OUT NOCOPY VARCHAR2,
147 		p_qtev_rec	IN  qtev_rec_type,
148 		p_asset_tbl	IN  asset_tbl_type,
149 		x_tqlv_tbl	OUT NOCOPY tqlv_tbl_type);
150 
151   -- PAGARG Bug 4102565 Brought the procedure into Spec to use it from OKL_AM_TERMNT_QUOTE_PVT
152   PROCEDURE get_operand_value(
153                p_rgd_code        IN VARCHAR2,
154                p_operand         IN VARCHAR2,
155                p_qtev_rec        IN qtev_rec_type,
156                p_rule_cle_id     IN NUMBER,
157                p_formul_cle_id   IN NUMBER,
158                p_head_rgd_code   IN VARCHAR2,
159                p_line_rgd_code   IN VARCHAR2,
160                p_asset_tbl       IN asset_tbl_type,
161                px_sub_tqlv_tbl   IN OUT NOCOPY tqlv_tbl_type,
162                x_operand_value   OUT NOCOPY NUMBER,
163                x_return_status   OUT NOCOPY VARCHAR2,
164                x_min_value       OUT NOCOPY NUMBER,
165                x_max_value       OUT NOCOPY NUMBER);
166 
167 END OKL_AM_CALCULATE_QUOTE_PVT;