DBA Data[Home] [Help]

PACKAGE: APPS.OKL_PRICING_UTILS_PVT

Source


1 PACKAGE OKL_PRICING_UTILS_PVT AS
2 /* $Header: OKLRPIUS.pls 120.8 2006/04/13 10:06:57 rgooty noship $ */
3 
4   -----------------------------------------------------------------------------
5   -- Constants Declaration
6   -----------------------------------------------------------------------------
7   G_PKG_NAME             CONSTANT VARCHAR2(30)  := 'OKL_PRICING_UTILS_PVT';
8   G_APP_NAME             CONSTANT VARCHAR2(3)   := OKL_API.G_APP_NAME;
9   G_API_VERSION          CONSTANT NUMBER        := 1;
10   G_INVALID_VALUE        CONSTANT  VARCHAR2(200) := OKL_API.G_INVALID_VALUE;
11   G_COL_NAME_TOKEN       CONSTANT  VARCHAR2(200) := OKL_API.G_COL_NAME_TOKEN;
12   G_API_TYPE             CONSTANT VARCHAR2(4)    := '_PVT';
13   G_FALSE                CONSTANT VARCHAR2(1)   := OKL_API.G_FALSE;
14   G_TRUE                 CONSTANT VARCHAR2(1)   := OKL_API.G_TRUE;
15   G_DB_ERROR             CONSTANT VARCHAR2(12)  := 'OKL_DB_ERROR';
16   G_PROG_NAME_TOKEN      CONSTANT VARCHAR2(9)   := 'PROG_NAME';
17   G_SQLCODE_TOKEN        CONSTANT VARCHAR2(7)   := 'SQLCODE';
18   G_SQLERRM_TOKEN        CONSTANT VARCHAR2(7)   := 'SQLERRM';
19   G_RET_STS_SUCCESS      CONSTANT VARCHAR2(1)   := OKL_API.G_RET_STS_SUCCESS;
20   G_RET_STS_UNEXP_ERROR  CONSTANT VARCHAR2(1)   := OKL_API.G_RET_STS_UNEXP_ERROR;
21   G_RET_STS_ERROR        CONSTANT VARCHAR2(1)   := OKL_API.G_RET_STS_ERROR;
22   -- Constants representing the Quick Quote Financial Adjustments
23   G_DOWNPAYMENT_TYPE  CONSTANT VARCHAR2(30) := 'DOWN_PAYMENT';
24   G_SUBSIDY_TYPE      CONSTANT VARCHAR2(30) := 'SUBSIDY';
25   G_TRADEIN_TYPE      CONSTANT VARCHAR2(30) := 'TRADEIN';
26   G_ITEMCATEGORY_TYPE CONSTANT VARCHAR2(30) := 'ITEM_CATEGORY';
27   -- Constants representing the Quick Quote Fees and Services Details
28   G_QQ_FEE_EXPENSE       CONSTANT VARCHAR2(30) := 'FEE_EXPENSE';
29   G_QQ_FEE_PAYMENT       CONSTANT VARCHAR2(30) := 'FEE_PAYMENT';
30   G_QQ_INSURANCE         CONSTANT VARCHAR2(30) := 'INSURANCE';
31   G_QQ_SERVICE           CONSTANT VARCHAR2(30) := 'SERVICE';
32   G_QQ_TAX              CONSTANT VARCHAR2(30) := 'TAX';
33   -- Constants representing the possible Basis types for Quick Quotes
34   G_QQ_ASSET_COST_BASIS  CONSTANT VARCHAR2(30) := 'ASSET_COST';
35   G_QQ_RENT_BASIS        CONSTANT VARCHAR2(30) := 'RENT';
36   G_FIXED_BASIS       CONSTANT VARCHAR2(30)    := 'FIXED';
37   G_QQ_SRT_RATE_TYPE     CONSTANT VARCHAR2(30) := 'INDEX_RATE';
38   -- Constants representing the various source types for Cash flows
39   G_CF_SOURCE_QQ         CONSTANT VARCHAR2(30) := 'OKL_QUICK_QUOTES_B';
40   G_CF_SOURCE_LQ         CONSTANT VARCHAR2(30) := 'OKL_LEASE_QUOTES_B';
41   G_CF_SOURCE_LQ_ASS     CONSTANT VARCHAR2(30) := 'OKL_ASSETS_B';
42   G_CF_SOURCE_LQ_FEE     CONSTANT VARCHAR2(30) := 'OKL_FEES_B';
43   -----------------------------------------------------------------------------
44   -- Global Data Structures Declaration
45   -----------------------------------------------------------------------------
46   TYPE interim_interest_rec_type IS RECORD (cf_days NUMBER, cf_amount NUMBER, cf_dpp NUMBER);
47   TYPE interim_interest_tbl_type IS TABLE OF interim_interest_rec_type
48     INDEX BY BINARY_INTEGER;
49 
50   -- Record to store the Header level information
51   TYPE so_hdr_rec_type IS RECORD
52   (
53     so_type                  VARCHAR2(30), -- Quick Quote/Standard Quote ...
54     id                       NUMBER       ,
55     reference_number         VARCHAR2(150),
56     expected_start_date      DATE         ,
57     currency_code            VARCHAR2(15) ,
58     term                     NUMBER       ,
59     sales_territory_id       NUMBER       ,
60     end_of_term_option_id    NUMBER       ,
61     pricing_method           VARCHAR2(30),
62     structured_pricing       VARCHAR2(30),
63     line_level_pricing       VARCHAR2(30),
64     lease_rate_factor        NUMBER,
65     rate_card_id             NUMBER,
66     rate_template_id         NUMBER,
67     target_rate_type         VARCHAR2(30),
68     target_rate              NUMBER,
69     target_amount            NUMBER,
70     target_frequency         VARCHAR2(30),
71     target_arrears           VARCHAR2(3),
72     target_periods           NUMBER
73   );
74   TYPE subsidy_basis_tbl_type IS TABLE OF VARCHAR2(30)
75     INDEX BY BINARY_INTEGER;
76   TYPE subsidy_value_tbl_type IS TABLE OF NUMBER
77     INDEX BY BINARY_INTEGER;
78 
79   -- Record to store the Down Payment, Subsidy, Trade in, Item Category Costs .. Amounts
80   -- Note: As per the FDD, QQ can have more than one subsidy financial adjustment defined !
81   TYPE so_amt_details_rec_type IS RECORD
82   (
83     down_payment_amount      NUMBER,
84     subsidy_amount           NUMBER,
85     tradein_amount           NUMBER,
86     down_payment_basis       VARCHAR2(30),
87     down_payment_value       NUMBER,
88     tradein_basis            VARCHAR2(30),
89     tradein_value            NUMBER,
90     subsidy_basis_tbl        subsidy_basis_tbl_type,
91     subsidy_value_tbl        subsidy_value_tbl_type
92   );
93 
94   -- Record to store the Item Category Cost and the Residual Value
95   TYPE so_asset_details_rec_type IS RECORD
96   (
97     asset_cost                NUMBER,
98     end_of_term_amount        NUMBER,
99     basis                     VARCHAR2(30),
100     value                     NUMBER,
101     percentage_of_total_cost  NUMBER
102   );
103   -- Table representing the Item Category Details entered by user for the Quick Quote
104   TYPE so_asset_details_tbl_type IS TABLE OF so_asset_details_rec_type
105     INDEX BY BINARY_INTEGER;
106 
107   -- Record representing the Cash Flow
108   TYPE so_cash_flows_rec_type IS RECORD
109   (
110     caf_id                     NUMBER,
111     khr_id                     NUMBER,
112     qte_id                     NUMBER,
113     cfo_id                     NUMBER,
114     sts_code                   VARCHAR2(30),
115     sty_id                     NUMBER,
116     cft_code                   VARCHAR2(30),
117     due_arrears_yn             VARCHAR2(3),
118     start_date                 DATE,
119     number_of_advance_periods  NUMBER
120   );
121 
122   -- Record representing cash flow level object
123   TYPE so_cash_flow_details_rec_type IS RECORD
124   (
125     cfl_id                  NUMBER,
126     caf_id                  NUMBER,
127     fqy_code                VARCHAR2(30),
128     rate                    NUMBER,
129     stub_days               NUMBER,
130     stub_amount             NUMBER,
131     number_of_periods       NUMBER,
132     amount                  NUMBER,
133     start_date              DATE,
134     is_stub                 VARCHAR2(1) DEFAULT 'N',
135     locked_amt              VARCHAR2(1) DEFAULT 'N',
136     ratio                   NUMBER
137   );
138   -- Cash Flow Levels Table
139   TYPE so_cash_flow_details_tbl_type IS TABLE OF so_cash_flow_details_rec_type
140     INDEX BY BINARY_INTEGER;
141 
142   -- Record structure representing the Financial Adjustments like
143   --  Expenses, Fee Payments, Services
144   TYPE item_cat_cf_rec_type IS RECORD
145   (
146     line_id                 NUMBER,
147     item_category_id        NUMBER,
148     financed_amount         NUMBER,
149     subsidy                 NUMBER,
150     down_payment            NUMBER,
151     trade_in                NUMBER,
152     eot_amount              NUMBER,
153     cash_flow_rec           so_cash_flows_rec_type,
154     cash_flow_level_tbl     so_cash_flow_details_tbl_type
155   );
156   -- Table representing the various financial adjustment line types
157   -- along with the Cash flow and Cash flow details table
158   TYPE item_cat_cf_tbl_type IS TABLE OF item_cat_cf_rec_type
159     INDEX BY BINARY_INTEGER;
160 
161   -- Record structure representing the Financial Adjustments like
162   --  Expenses, Fee Payments, Services
163   TYPE so_fee_srv_rec_type IS RECORD
164   (
165     type                    VARCHAR2(30),
166     basis                   VARCHAR2(30),
167     value                   NUMBER,
168     amount                  NUMBER,
169     cash_flow_rec           so_cash_flows_rec_type,
170     cash_flow_level_tbl     so_cash_flow_details_tbl_type
171   );
172   -- Table representing the various financial adjustment line types
173   -- along with the Cash flow and Cash flow details table
174   TYPE so_fee_srv_tbl_type IS TABLE OF so_fee_srv_rec_type
175     INDEX BY BINARY_INTEGER;
176 
177   TYPE cash_inflows_rec_type IS RECORD
178   (
179     line_number                  NUMBER,
180     cf_amount                    NUMBER,
181     cf_date                      DATE,
182     cf_purpose                   VARCHAR2(10),
183     cf_dpp                       NUMBER,
184     cf_ppy                       NUMBER,
185     cf_days                      NUMBER,
186     cf_rate                      NUMBER,       -- Can be used as cf_iir
187     cf_miss_pay                  VARCHAR2(30),
188     is_stub                      VARCHAR2(1),  -- Stub Flag
189     is_arrears                   VARCHAR2(1),  -- Arrears Flag
190     cf_period_start_end_date     DATE,         -- Can be useful in compute_irr
191     locked_amt                   VARCHAR2(1) DEFAULT 'N', -- Useful in compute_irr TR pricing
192     cf_ratio                     NUMBER
193   );
194   TYPE cash_inflows_tbl_type IS TABLE OF cash_inflows_rec_type
195     INDEX BY BINARY_INTEGER;
196 
197   TYPE pricing_parameter_rec_type IS RECORD
198   (
199     line_type               VARCHAR2(256),
200     line_start_date         DATE,  -- Start date of the corresponding line ..
201     line_end_date           DATE,  -- End date of the corresponding line ..
202     payment_type            VARCHAR2(256),
203     financed_amount         NUMBER,
204     trade_in                NUMBER,
205     down_payment            NUMBER,
206     subsidy                 NUMBER,
207     residual_inflows        cash_inflows_tbl_type,
208     cash_inflows            cash_inflows_tbl_type,
209     cap_fee_amount          NUMBER
210   );
211 
212   TYPE pricing_parameter_tbl_type IS TABLE OF pricing_parameter_rec_type
213     INDEX BY BINARY_INTEGER;
214 
215   TYPE pricing_results_rec_type IS RECORD
216   (
217     line_type               VARCHAR2(256),
218     line_id                  NUMBER,
219     item_category_id        NUMBER,
220     financed_amount         NUMBER,
221     trade_in                NUMBER,
222     down_payment            NUMBER,
223     subsidy                 NUMBER,
224     cash_flow_rec           so_cash_flows_rec_type,
225     cash_flow_level_tbl     so_cash_flow_details_tbl_type
226   );
227   TYPE pricing_results_tbl_type IS TABLE OF pricing_results_rec_type
228     INDEX BY BINARY_INTEGER;
229 
230   -- Lease Rate Factors Header n Version Details Record
231   TYPE lrs_details_rec_type IS RECORD (
232     header_id                      NUMBER,
233     version_id                     NUMBER,
234     name                           okl_ls_rt_fctr_sets_v.name%type,
235     lrs_type_code                  okl_ls_rt_fctr_sets_v.lrs_type_code%type,
236     frq_code                       okl_ls_rt_fctr_sets_v.frq_code%type,
237     currency_code                  okl_ls_rt_fctr_sets_v.currency_code%type,
238     sts_code                       okl_fe_rate_set_versions_v.sts_code%type,
239     effective_from_date            okl_fe_rate_set_versions_v.effective_from_date%type,
240     effective_to_date              okl_fe_rate_set_versions_v.effective_to_date%type,
241     arrears_yn                     okl_fe_rate_set_versions_v.arrears_yn%type,
242     end_of_term_ver_id             NUMBER,
243     std_rate_tmpl_ver_id           NUMBER,
244     adj_mat_version_id             NUMBER,
245     version_number                 okl_fe_rate_set_versions_v.version_number%type,
246     lrs_version_rate               NUMBER,
247     rate_tolerance                 NUMBER,
248     residual_tolerance             NUMBER,
249     deferred_pmts                  NUMBER,
250     advance_pmts                   NUMBER);
251 
252   -- Lease Rate Factors Record Type
253   TYPE lrs_factor_rec_type IS RECORD (
254     factor_id                     NUMBER,
255     term_in_months                NUMBER,
256     residual_value_percent        NUMBER );
257 
258   -- Lease Rate Factor Levels Record Type
259   TYPE lrs_levels_rec_type IS RECORD (
260     sequence_number               NUMBER, -- order by seq_num ascending
261     periods                       NUMBER,
262     lease_rate_factor             NUMBER);
263 
264   TYPE lrs_levels_tbl_type IS TABLE OF lrs_levels_rec_type
265     INDEX BY BINARY_INTEGER;
266 
267   TYPE srt_details_rec_type IS RECORD (
268     srt_header_id                NUMBER,
269     srt_version_id               NUMBER,
270     template_name                OKL_FE_STD_RT_TMP_V.TEMPLATE_NAME%TYPE,
271     currency_code                OKL_FE_STD_RT_TMP_V.CURRENCY_CODE%TYPE,
272     version_number               OKL_FE_STD_RT_TMP_VERS.VERSION_NUMBER%TYPE,
273     effective_from_date          OKL_FE_STD_RT_TMP_VERS.EFFECTIVE_FROM_DATE%TYPE,
274     effective_to_date            OKL_FE_STD_RT_TMP_VERS.EFFECTIVE_TO_DATE%TYPE,
275     sts_code                     OKL_FE_STD_RT_TMP_VERS.STS_CODE%TYPE,
276     pricing_engine_code          OKL_FE_STD_RT_TMP_V.PRICING_ENGINE_CODE%TYPE,
277     rate_type_code               OKL_FE_STD_RT_TMP_V.RATE_TYPE_CODE%TYPE,
278     srt_rate                     NUMBER,
279     index_id                     NUMBER,
280     spread                       NUMBER,
281     day_convention_code          OKL_FE_STD_RT_TMP_VERS.DAY_CONVENTION_CODE%TYPE,
282     frequency_code               OKL_FE_STD_RT_TMP_V.FREQUENCY_CODE%TYPE,
283     adj_mat_version_id           NUMBER,
284     min_adj_rate                 OKL_FE_STD_RT_TMP_VERS.MIN_ADJ_RATE%TYPE,
285     max_adj_rate                 OKL_FE_STD_RT_TMP_VERS.MAX_ADJ_RATE%TYPE);
286 
287   TYPE adj_mat_cat_rec  IS RECORD (
288     target_eff_from       date,
289     term                  number,
290     territory             varchar2(240),
291     deal_size             number,
292     customer_credit_class varchar2(240)
293   );
294 
295 
296   -- Record representing the Yields
297   TYPE yields_rec IS RECORD (
298     pre_tax_irr                 NUMBER,
299     after_tax_irr               NUMBER,
300     bk_yield                    NUMBER,
301     iir                         NUMBER,
302     pre_tax_irr_flag            VARCHAR2(1) DEFAULT 'N',
303     after_tax_irr_flag          VARCHAR2(1) DEFAULT 'N',
304     bk_yield_flag               VARCHAR2(1) DEFAULT 'N',
305     iir_flag                    VARCHAR2(1) DEFAULT 'N'
306   );
307 
308   --------------------------------------------------------------------------------
309   -- Start of Commnets
310   -- Procedure Name       : get_so_hdr
311   -- Description          : Wrapper API to fetch the Header level information
312   -- Business Rules       :
313   -- Parameters           :
314   --       p_so_id      - Id of Qucik Quote/Standard Quote
315   --       p_so_type    - QQ for Quick Quote/ SQ for Lease Quotes
316   -- Version              : 1.0
317   -- History              : rgooty 15-May-2005 - created
318   -- End of Commnets
319   --------------------------------------------------------------------------------
320   PROCEDURE  get_so_hdr(
321               p_api_version       IN  NUMBER,
322               p_init_msg_list     IN  VARCHAR2,
323               x_return_status     OUT NOCOPY VARCHAR2,
324               x_msg_count         OUT NOCOPY NUMBER,
325               x_msg_data          OUT NOCOPY VARCHAR2,
326               p_so_id             IN  NUMBER,
327               p_so_type           IN  VARCHAR2,
328               x_so_hdr_rec        OUT NOCOPY so_hdr_rec_type);
329 
330   --------------------------------------------------------------------------------
331   -- Start of Commnets
332   -- Procedure Name       : get_qq_fin_adjustments
333   -- Description          : API to fetch the Financial Adjustments Information like
334   --                        Down Payment, Subsidy, Trade in, Item Category Amount
335   -- Business Rules       :
336   -- Parameters           : p_qq_id - Id of the Quick Quote
337   -- Version              : 1.0
338   -- History              : rgooty 15-May-2005 - created
339   -- End of Commnets
340   --------------------------------------------------------------------------------
341   PROCEDURE  get_qq_fin_adj_details(
342               p_api_version          IN  NUMBER,
343               p_init_msg_list        IN  VARCHAR2,
344               x_return_status        OUT NOCOPY VARCHAR2,
345               x_msg_count            OUT NOCOPY NUMBER,
349               p_item_category_amount IN  NUMBER,
346               x_msg_data             OUT NOCOPY VARCHAR2,
347               p_qq_id                IN  NUMBER,
348               p_pricing_method       IN  VARCHAR2,
350               x_all_amounts_rec      OUT NOCOPY so_amt_details_rec_type);
351 
352   --------------------------------------------------------------------------------
353   -- Start of Commnets
354   -- Procedure Name       : get_qq_sgt_day_convention
355   -- Description          : API to fetch the day convention from the SGT assosiated
356   -- Business Rules       :
357   -- Parameters           : p_qq_id - Id of the Quick Quote
358   -- Version              : 1.0
359   -- History              : rgooty 15-May-2005 - created
360   -- End of Commnets
361   --------------------------------------------------------------------------------
362   PROCEDURE get_qq_sgt_day_convention(
363                 p_api_version       IN  NUMBER,
364                 p_init_msg_list     IN  VARCHAR2,
365                 x_return_status     OUT NOCOPY VARCHAR2,
366                 x_msg_count         OUT NOCOPY NUMBER,
367                 x_msg_data          OUT NOCOPY VARCHAR2,
368                 p_qq_id                IN NUMBER,
369                 x_days_in_month        OUT NOCOPY VARCHAR2,
370                 x_days_in_year         OUT NOCOPY VARCHAR2);
371 
372   --------------------------------------------------------------------------------
373   -- Start of Commnets
374   -- Procedure Name       : get_qq_cash_flows
375   -- Description          : API to fetch the Cash Flows, Cash Flow during
376   --                         Structured Pricing !
377   -- Business Rules       :
378   -- Parameters           : p_qq_id - Id of the Quick Quote
379   -- Version              : 1.0
380   -- History              : rgooty 8-June-2005 - created
381   -- End of Commnets
382   --------------------------------------------------------------------------------
383   PROCEDURE  get_qq_cash_flows(
384               p_api_version          IN  NUMBER,
385               p_init_msg_list        IN  VARCHAR2,
386               x_return_status        OUT NOCOPY VARCHAR2,
387               x_msg_count            OUT NOCOPY NUMBER,
388               x_msg_data             OUT NOCOPY VARCHAR2,
389               p_cf_source_type       IN  VARCHAR2,
390               p_qq_id                IN  NUMBER,
391               x_days_in_month        OUT NOCOPY VARCHAR2,
392               x_days_in_year         OUT NOCOPY VARCHAR2,
393               x_cash_flow_rec        OUT NOCOPY so_cash_flows_rec_type,
394               x_cash_flow_det_tbl    OUT NOCOPY so_cash_flow_details_tbl_type);
395 
396   --------------------------------------------------------------------------------
397   -- Start of Commnets
398   -- Procedure Name       : get_qq_cash_flows
399   -- Description          : API to fetch/build the Cash Flows, Cash Flow Levels
400   --                         during Structured Pricing/LRS/SRT !
401   -- Business Rules       :
402   -- Parameters           : p_qq_id - Id of the Quick Quote
403   -- Version              : 1.0
404   -- History              : rgooty 8-June-2005 - created
405   -- End of Commnets
406   --------------------------------------------------------------------------------
407   PROCEDURE get_qq_cash_flows(
408              p_api_version          IN            NUMBER,
409              p_init_msg_list        IN            VARCHAR2,
410              x_return_status           OUT NOCOPY VARCHAR2,
411              x_msg_count               OUT NOCOPY NUMBER,
412              x_msg_data                OUT NOCOPY VARCHAR2,
413              p_qq_hdr_rec           IN            so_hdr_rec_type,
414              p_eot_percentage       IN            NUMBER,
415              p_oec                  IN            NUMBER,
416              x_days_in_month           OUT NOCOPY VARCHAR2,
417              x_days_in_year            OUT NOCOPY VARCHAR2,
418              x_cash_flow_rec           OUT NOCOPY so_cash_flows_rec_type,
419              x_cash_flow_det_tbl       OUT NOCOPY so_cash_flow_details_tbl_type);
420 
421  --------------------------------------------------------------------------------
422   -- Start of Commnets
423   -- Procedure Name       : gen_so_cash_inflows_strms
424   -- Description          : API to generate Cash inflows based on the Cash Flows
425   --                         inputted.
426   -- Business Rules       :
427   -- Parameters           : p_qq_id - Id of the Quick Quote
428   -- Version              : 1.0
429   -- History              : rgooty 15-May-2005 - created
430   -- End of Commnets
431   --------------------------------------------------------------------------------
432   PROCEDURE  gen_so_cf_strms(
433               p_api_version            IN              NUMBER,
434               p_init_msg_list          IN              VARCHAR2,
435               x_return_status          OUT NOCOPY      VARCHAR2,
436               x_msg_count              OUT NOCOPY      NUMBER,
437               x_msg_data               OUT NOCOPY      VARCHAR2,
438               p_cash_flow_rec          IN              so_cash_flows_rec_type,
439               p_cf_details_tbl         IN              so_cash_flow_details_tbl_type,
440               x_cash_inflow_strms_tbl  OUT NOCOPY      cash_inflows_tbl_type);
441 
442   --------------------------------------------------------------------------------
443   -- Start of Commnets
444   -- Procedure Name       : get_day_count
445   -- Description          : Counts the number of days between start and end Dates.
446   -- Business Rules       : Based on a profile, the months are treated either normal
450   --                        p_arrears    - Arrears/Advance Flag
447   --                        or 30 days month.
448   -- Parameters           : p_start_date - Start Date
449   --                        p_end_date   - End Date
451   -- Version              : 1.0
452   -- History              : rgooty 15-May-2005 - created
453   -- End of Commnets
454   --------------------------------------------------------------------------------
455   FUNCTION GET_DAY_COUNT(
456           p_days_in_month     IN      VARCHAR2,
457           p_days_in_year      IN      VARCHAR2,
458           p_start_date        IN      DATE,
459           p_end_date          IN      DATE,
460           p_arrears           IN      VARCHAR2,
461           x_return_status     OUT     NOCOPY VARCHAR2)
462       RETURN NUMBER;
463 
464   --------------------------------------------------------------------------------
465   -- Start of Commnets
466   -- Procedure Name       : get_day_convention
467   -- Description          : Get the day convention either from OKL_K_RATE_PARAMS or
468   --                          reach the SGT and fetch the day conventions
469   -- Business Rules       :
470   -- Parameters           :
471   -- Version              : 1.0
472   -- History              : rgooty - created
473   -- End of Commnets
474   --------------------------------------------------------------------------------
475   PROCEDURE  get_day_convention(
476                p_id              IN          NUMBER,   -- ID of the contract/quote
477                p_source          IN          VARCHAR2, -- 'ESG'/'ISG' are acceptable values
478                x_days_in_month   OUT NOCOPY  VARCHAR2,
479                x_days_in_year    OUT NOCOPY  VARCHAR2,
480                x_return_status   OUT NOCOPY  VARCHAR2);
481 
482   --------------------------------------------------------------------------------
483   -- Start of Commnets
484   -- Procedure Name       : compute_irr
485   -- Description          :
486   -- Business Rules       :
487   -- Parameters           :
488   -- Version              : 1.0
489   -- History              : rgooty 15-May-2005 - created
490   -- End of Commnets
491   --------------------------------------------------------------------------------
492   PROCEDURE compute_irr(
493               p_api_version             IN              NUMBER,
494               p_init_msg_list           IN              VARCHAR2,
495               x_return_status           OUT NOCOPY      VARCHAR2,
496               x_msg_count               OUT NOCOPY      NUMBER,
497               x_msg_data                OUT NOCOPY      VARCHAR2,
498               p_start_date              IN              DATE,
499               p_day_count_method        IN              VARCHAR2,
500               p_currency_code           IN              VARCHAR2,
501               p_pricing_method          IN              VARCHAR2,
502               p_initial_guess           IN              NUMBER,
503               px_pricing_parameter_tbl  IN  OUT NOCOPY  pricing_parameter_tbl_type,
504               px_irr                    IN  OUT NOCOPY  NUMBER,
505               x_payment                 OUT     NOCOPY  NUMBER);
506 
507   --------------------------------------------------------------------------------
508   -- Start of Commnets
509   -- Procedure Name       : compute_iir
510   -- Description          :
511   -- Business Rules       :
512   -- Parameters           :
513   -- Version              : 1.0
514   -- History              : rgooty 15-May-2005 - created
515   -- End of Commnets
516   --------------------------------------------------------------------------------
517   PROCEDURE compute_iir(
518               p_api_version             IN             NUMBER,
519               p_init_msg_list           IN             VARCHAR2,
520               x_return_status           OUT     NOCOPY VARCHAR2,
521               x_msg_count               OUT     NOCOPY NUMBER,
522               x_msg_data                OUT     NOCOPY VARCHAR2,
523               p_start_date              IN             DATE,
524               p_day_count_method        IN             VARCHAR2,
525               p_pricing_method          IN             VARCHAR2,
526               p_initial_guess           IN             NUMBER,
527               px_pricing_parameter_rec  IN  OUT NOCOPY pricing_parameter_rec_type,
528               px_iir                    IN  OUT NOCOPY NUMBER,
529               x_payment                 OUT     NOCOPY NUMBER);
530 
531   --------------------------------------------------------------------------------
532   -- Start of Commnets
533   -- Procedure Name       : compute_iir
534   -- Description          :
535   -- Business Rules       :
536   -- Parameters           :
537   -- Version              : 1.0
538   -- History              : rgooty 18-FEB-2006 Created
539   -- End of Commnets
540   --------------------------------------------------------------------------------
541   PROCEDURE compute_iir_sfp(
542               p_api_version             IN             NUMBER,
543               p_init_msg_list           IN             VARCHAR2,
544               x_return_status           OUT     NOCOPY VARCHAR2,
545               x_msg_count               OUT     NOCOPY NUMBER,
546               x_msg_data                OUT     NOCOPY VARCHAR2,
547               p_start_date              IN             DATE,
548               p_day_count_method        IN             VARCHAR2,
549               p_pricing_method          IN             VARCHAR2,
550               p_initial_guess           IN             NUMBER,
554               x_residual_percent        OUT     NOCOPY NUMBER,
551               px_pricing_parameter_rec  IN  OUT NOCOPY pricing_parameter_rec_type,
552               px_iir                    IN  OUT NOCOPY NUMBER,
553               x_closing_balance         OUT     NOCOPY NUMBER,
555               x_residual_int_factor     OUT     NOCOPY NUMBER);
556   --------------------------------------------------------------------------------
557   -- Start of Commnets
558   -- Procedure Name       : get_lease_rate_factors
559   -- Description          :
560   -- Business Rules       :
561   -- Parameters           :
562   -- Version              : 1.0
563   -- History              : rgooty 6-June-2005 - created
564   -- End of Commnets
565   --------------------------------------------------------------------------------
566   PROCEDURE get_lease_rate_factors(
567               p_api_version            IN              NUMBER,
568               p_init_msg_list          IN              VARCHAR2,
569               x_return_status          OUT NOCOPY      VARCHAR2,
570               x_msg_count              OUT NOCOPY      NUMBER,
571               x_msg_data               OUT NOCOPY      VARCHAR2,
572               p_lrt_id                 IN              NUMBER, -- Assuming LRS Version ID
573               p_start_date             IN              DATE,
574               p_term_in_months         IN              NUMBER,
575               p_eot_percentage         IN              NUMBER,
576               x_lrs_details            OUT NOCOPY      lrs_details_rec_type,
577               x_lrs_factor             OUT NOCOPY      lrs_factor_rec_type,
578               x_lrs_levels             OUT NOCOPY      lrs_levels_tbl_type);
579 
580   --------------------------------------------------------------------------------
581   -- Start of Commnets
582   -- Procedure Name       : get_standard_rates
583   -- Description          :
584   -- Business Rules       :
585   -- Parameters           :
586   -- Version              : 1.0
587   -- History              : rgooty 6-June-2005 - created
588   -- End of Commnets
589   --------------------------------------------------------------------------------
590   PROCEDURE get_standard_rates(
591               p_api_version            IN              NUMBER,
592               p_init_msg_list          IN              VARCHAR2,
593               x_return_status          OUT NOCOPY      VARCHAR2,
594               x_msg_count              OUT NOCOPY      NUMBER,
595               x_msg_data               OUT NOCOPY      VARCHAR2,
596               p_srt_id                 IN              NUMBER,  -- Version ID
597               p_start_date             IN              DATE,
598               x_srt_details            OUT NOCOPY      srt_details_rec_type);
599 
600 
601   --------------------------------------------------------------------------------
602   -- Start of Commnets
603   -- Procedure Name       : compute_bk_yield
604   -- Description          :
605   -- Business Rules       :
606   -- Parameters           :
607   -- Version              : 1.0
608   -- History              : rgooty 20-June-2005 - created
609   -- End of Commnets
610   --------------------------------------------------------------------------------
611   PROCEDURE compute_bk_yield(
612               p_api_version            IN              NUMBER,
613               p_init_msg_list          IN              VARCHAR2,
614               x_return_status          OUT NOCOPY      VARCHAR2,
615               x_msg_count              OUT NOCOPY      NUMBER,
616               x_msg_data               OUT NOCOPY      VARCHAR2,
617               p_start_date              IN             DATE,
618               p_day_count_method        IN             VARCHAR2,
619               p_pricing_method          IN             VARCHAR2,
620               p_initial_guess           IN             NUMBER,
621               p_term                    IN             NUMBER,
622               px_pricing_parameter_rec  IN  OUT NOCOPY pricing_parameter_rec_type,
623               x_bk_yield                IN  OUT NOCOPY NUMBER,
624               x_termination_tbl             OUT NOCOPY cash_inflows_tbl_type,
625               x_pre_tax_inc_tbl             OUT NOCOPY cash_inflows_tbl_type);
626 
627   --------------------------------------------------------------------------------
628   -- Start of Commnets
629   -- Procedure Name       : price_quick_quote
630   -- Description          :
631   -- Business Rules       :
632   -- Parameters           :
633   -- Version              : 1.0
634   -- History              : rgooty 6-June-2005 - created
635   -- End of Commnets
636   --------------------------------------------------------------------------------
637   PROCEDURE price_quick_quote(
638              p_api_version              IN              NUMBER,
639              p_init_msg_list            IN              VARCHAR2,
640              x_return_status            OUT      NOCOPY VARCHAR2,
641              x_msg_count                OUT      NOCOPY NUMBER,
642              x_msg_data                 OUT      NOCOPY VARCHAR2,
643              p_qq_id                    IN              NUMBER,
644              x_yileds_rec               OUT      NOCOPY yields_rec,
645              x_subsidized_yileds_rec    OUT      NOCOPY yields_rec,
646              x_pricing_results_tbl      OUT      NOCOPY pricing_results_tbl_type);
647   --------------------------------------------------------------------------------
648   -- Start of Commnets
649   -- Procedure Name       : get_days_per_annum
653   -- Version              : 1.0
650   -- Description          :
651   -- Business Rules       :
652   -- Parameters           :
654   -- History              : rgooty 6-June-2005 - created
655   -- End of Commnets
656   --------------------------------------------------------------------------------
657   FUNCTION get_days_per_annum(
658              p_day_convention   IN            VARCHAR2,
659              p_start_date       IN            DATE,
660              p_cash_inflow_date IN            DATE,
661              x_return_status      OUT NOCOPY VARCHAR2 )
662     RETURN NUMBER;
663 
664  --------------------------------------------------------------------------------
665   -- Start of Commnets
666   -- Procedure Name       : get_qq_asset_oec
667   -- Description          : Calculates the OEC
668   -- Business Rules       :
669   -- Parameters           :
670   -- Version              : 1.0
671   -- History              : rgooty 26-July-2005 - created
672   -- End of Commnets
673   --------------------------------------------------------------------------------
674   PROCEDURE get_qq_asset_oec (
675               p_api_version          IN  NUMBER,
676               p_init_msg_list        IN  VARCHAR2,
677               x_return_status        OUT NOCOPY VARCHAR2,
678               x_msg_count            OUT NOCOPY NUMBER,
679               x_msg_data             OUT NOCOPY VARCHAR2,
680               p_asset_cost           IN  NUMBER,
681               p_fin_adj_det_rec      IN  so_amt_details_rec_type,
682               x_oec                  OUT NOCOPY NUMBER);
683 
684   --------------------------------------------------------------------------------
685   -- Start of Commnets
686   -- Procedure Name       : get_lq_cash_flows
687   -- Description          :
688   -- Business Rules       :
689   -- Parameters           :
690   -- Version              : 1.0
691   -- History              : rgooty 3-Aug-2005 - created
692   -- End of Commnets
693   --------------------------------------------------------------------------------
694   PROCEDURE get_lq_cash_flows(
695              p_api_version          IN            NUMBER,
696              p_init_msg_list        IN            VARCHAR2,
697              x_return_status           OUT NOCOPY VARCHAR2,
698              x_msg_count               OUT NOCOPY NUMBER,
699              x_msg_data                OUT NOCOPY VARCHAR2,
700              p_id                   IN            NUMBER,
701              p_lq_srt_id            IN            NUMBER,
702              p_cf_source            IN            VARCHAR2,
703              p_adj_mat_cat_rec      IN            adj_mat_cat_rec,
704              p_pricing_method       IN            VARCHAR2,
705              x_days_in_month           OUT NOCOPY VARCHAR2,
706              x_days_in_year            OUT NOCOPY VARCHAR2,
707              x_cash_flow_rec           OUT NOCOPY so_cash_flows_rec_type,
708              x_cash_flow_det_tbl       OUT NOCOPY so_cash_flow_details_tbl_type);
709 
710   --------------------------------------------------------------------------------
711   -- Start of Commnets
712   -- Procedure Name       : distribute_fin_amount_lq
713   -- Description          :
714   -- Business Rules       :
715   -- Parameters           :
716   -- Version              : 1.0
717   -- History              : rgooty 13-Aug-2005 - created
718   -- End of Commnets
719   --------------------------------------------------------------------------------
720   FUNCTION is_asset_overriding( p_qte_id                IN NUMBER,
721                                 p_ast_id                IN NUMBER,
722                                 p_lq_line_level_pricing IN VARCHAR2,
723                                 p_lq_srt_id             IN NUMBER,
724                                 p_ast_srt_id            IN NUMBER,
725                                 p_lq_struct_pricing     IN VARCHAR2,
726                                 p_ast_struct_pricing    IN VARCHAR2,
727                                 p_lq_arrears_yn         IN VARCHAR2,
728                                 p_ast_arrears_yn        IN VARCHAR2,
729                                 x_return_status         OUT NOCOPY VARCHAR2)
730    RETURN BOOLEAN;
731 
732   --------------------------------------------------------------------------------
733   -- Start of Commnets
734   -- Procedure Name       : distribute_fin_amount_lq
735   -- Description          :
736   -- Business Rules       :
737   -- Parameters           :
738   -- Version              : 1.0
739   -- History              : rgooty 13-Aug-2005 - created
740   -- End of Commnets
741   --------------------------------------------------------------------------------
742   PROCEDURE distribute_fin_amount_lq(
743              p_api_version          IN            NUMBER,
744              p_init_msg_list        IN            VARCHAR2,
745              x_return_status           OUT NOCOPY VARCHAR2,
746              x_msg_count               OUT NOCOPY NUMBER,
747              x_msg_data                OUT NOCOPY VARCHAR2,
748              p_lq_id                   IN         NUMBER,
749              p_tot_fin_amount          IN         NUMBER);
750 
751   --------------------------------------------------------------------------------
752   -- Start of Commnets
753   -- Procedure Name       : Price_Standard_Quote
754   -- Description          :
755   -- Business Rules       :
756   -- Parameters           :
757   -- Version              : 1.0
758   -- History              : ssiruvol 22-May-2005 - created
759   -- End of Commnets
760   --------------------------------------------------------------------------------
761  PROCEDURE price_standard_quote_asset(
762               x_return_status             OUT NOCOPY  VARCHAR2,
763               x_msg_count                 OUT NOCOPY  NUMBER,
764               x_msg_data                  OUT NOCOPY  VARCHAR2,
765               p_api_version            IN             NUMBER,
766               p_init_msg_list          IN             VARCHAR2,
767               p_qte_id                 IN             NUMBER,
768               p_ast_id                 IN             NUMBER,
769               p_price_at_lq_level      IN             BOOLEAN,
770               p_target_rate            IN             NUMBER,
771               x_pricing_parameter_rec  IN  OUT NOCOPY pricing_parameter_rec_type);
772   --------------------------------------------------------------------------------
773   -- Start of Commnets
774   -- Procedure Name       : Price_Standard_Quote
775   -- Description          :
776   -- Business Rules       :
777   -- Parameters           :
778   -- Version              : 1.0
779   -- History              : ssiruvol 22-May-2005 - created
780   -- End of Commnets
781   --------------------------------------------------------------------------------
782   PROCEDURE price_standard_quote(x_return_status                  OUT NOCOPY  VARCHAR2,
783                                  x_msg_count                      OUT NOCOPY  NUMBER,
784                                  x_msg_data                       OUT NOCOPY  VARCHAR2,
785                                  p_api_version                 IN             NUMBER,
786                                  p_init_msg_list               IN             VARCHAR2,
787                                  p_qte_id                      IN             NUMBER);
788 END OKL_PRICING_UTILS_PVT;