DBA Data[Home] [Help]

PACKAGE: APPS.OKL_AM_CALCULATE_QUOTE_PVT

Source


1 PACKAGE OKL_AM_CALCULATE_QUOTE_PVT AUTHID CURRENT_USER AS
2 /* $Header: OKLRCQUS.pls 120.5 2009/05/11 17:52:06 sechawla ship $ */
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   --sechawla 30-apr-09 7575939 : begin
93   G_FIN_FEE_CALC_DONE   BOOLEAN              := FALSE;
94   G_ABS_FEE_CALC_DONE   BOOLEAN              := FALSE;
95   G_EXP_FEE_CALC_DONE   BOOLEAN              := FALSE;
96   G_GEN_FEE_CALC_DONE   BOOLEAN              := FALSE;
97   G_IN_FEE_CALC_DONE    BOOLEAN              := FALSE;
98   G_MISC_FEE_CALC_DONE  BOOLEAN              := FALSE;
99   G_PASS_FEE_CALC_DONE  BOOLEAN              := FALSE;
100   G_ROLL_FEE_CALC_DONE  BOOLEAN              := FALSE;
101   --sechawla 30-apr-09 7575939 : end
102 
103   ---------------------------------------------------------------------------
104   -- GLOBAL MESSAGE CONSTANTS FOR ERROR HANDLING
105   ---------------------------------------------------------------------------
106 
107   G_APP_NAME		CONSTANT VARCHAR2(3)	:=  OKL_API.G_APP_NAME;
108   G_API_VERSION		CONSTANT NUMBER		    :=  1;
109   G_PKG_NAME		CONSTANT VARCHAR2(200)	:=	'OKL_AM_CALCULATE_QUOTE_PVT';
110 
111   G_SQLCODE_TOKEN	CONSTANT VARCHAR2(200)	:= 'SQLCODE';
112   G_SQLERRM_TOKEN	CONSTANT VARCHAR2(200)	:= 'SQLERRM';
113   G_UNEXPECTED_ERROR	CONSTANT VARCHAR2(200)	:= 'OKL_CONTRACTS_UNEXPECTED_ERROR';
114 
115   G_OKC_APP_NAME	CONSTANT VARCHAR2(3)	:= OKC_API.G_APP_NAME;
116   G_INVALID_VALUE	CONSTANT VARCHAR2(200)	:= OKC_API.G_INVALID_VALUE;
117   G_REQUIRED_VALUE	CONSTANT VARCHAR2(200)	:= OKC_API.G_REQUIRED_VALUE;
118   G_COL_NAME_TOKEN	CONSTANT VARCHAR2(200)	:= OKC_API.G_COL_NAME_TOKEN;
119 --akrangan added for bug 5568328  fix begin
120   -- global variable for proration logic - bug 5568328
121 
122 G_AMBCOC NUMBER :=0;
123 G_AMCQDR NUMBER :=0;
124 G_AMCQFE NUMBER :=0;
125 G_AMCRFE NUMBER :=0;
126 G_AMCRIN NUMBER :=0;
127 G_AMCSDD NUMBER :=0;
128 G_AMCTPE NUMBER :=0;
129 G_AMPRTX NUMBER :=0;
130 G_AMBPOC NUMBER :=0;
131 G_AMBCOC_OPTION VARCHAR2(30) :='LINE_CALCULATION';
132 G_AMCQDR_OPTION VARCHAR2(30) :='LINE_CALCULATION';
133 G_AMCQFE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
134 G_AMCRFE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
135 G_AMCRIN_OPTION VARCHAR2(30) :='LINE_CALCULATION';
136 G_AMCSDD_OPTION VARCHAR2(30) :='LINE_CALCULATION';
137 G_AMCTPE_OPTION VARCHAR2(30) :='LINE_CALCULATION';
138 G_AMPRTX_OPTION VARCHAR2(30) :='LINE_CALCULATION';
139 G_AMBPOC_OPTION VARCHAR2(30) :='LINE_CALCULATION';
140 
141 --akrangan added for bug fix end
142 
143 
144 
145   ---------------------------------------------------------------------------
146   -- Procedures and Functions
147   ---------------------------------------------------------------------------
148 
149   -- The main body of the calculate quote process
150   PROCEDURE generate (
151 		p_api_version	IN  NUMBER,
152 		p_init_msg_list	IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
153 		x_msg_count	OUT NOCOPY NUMBER,
154 		x_msg_data	OUT NOCOPY VARCHAR2,
155 		x_return_status	OUT NOCOPY VARCHAR2,
156 		p_qtev_rec	IN  qtev_rec_type,
157 		p_asset_tbl	IN  asset_tbl_type,
158 		x_tqlv_tbl	OUT NOCOPY tqlv_tbl_type);
159 
160   -- PAGARG Bug 4102565 Brought the procedure into Spec to use it from OKL_AM_TERMNT_QUOTE_PVT
161   PROCEDURE get_operand_value(
162                p_rgd_code        IN VARCHAR2,
163                p_operand         IN VARCHAR2,
164                p_qtev_rec        IN qtev_rec_type,
165                p_rule_cle_id     IN NUMBER,
166                p_formul_cle_id   IN NUMBER,
167                p_head_rgd_code   IN VARCHAR2,
168                p_line_rgd_code   IN VARCHAR2,
169                p_asset_tbl       IN asset_tbl_type,
170                px_sub_tqlv_tbl   IN OUT NOCOPY tqlv_tbl_type,
171                x_operand_value   OUT NOCOPY NUMBER,
172                x_return_status   OUT NOCOPY VARCHAR2,
173                x_min_value       OUT NOCOPY NUMBER,
174                x_max_value       OUT NOCOPY NUMBER);
175 
176 END OKL_AM_CALCULATE_QUOTE_PVT;