DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKI_DISCO_UTIL_PUB

Source


1 PACKAGE BODY OKI_DISCO_UTIL_PUB AS
2 /* $Header: OKIPDULB.pls 115.2 2002/12/02 22:25:00 rpotnuru noship $ */
3 ----------------------------------------------------------------------------
4 -- The following function derives  the number of periods  based
5 -- on organization, start and end date.
6 ----------------------------------------------------------------------------
7 
8   FUNCTION get_num_periods(
9      p_sob_id IN NUMBER,
10     p_start_date in date,
11     p_end_date in date
12     ) RETURN NUMBER is
13     l_num_periods  NUMBER;
14   begin
15     l_num_periods := OKI_DISCO_UTIL_PVT.get_num_periods(
16                      p_sob_id,
17                      p_start_date,
18                      p_end_date);
19     return l_num_periods;
20   END get_num_periods;
21 
22 ----------------------------------------------------------------------------
23 -- The following function returns the original license order number
24 -- based on the chr_id
25 ----------------------------------------------------------------------------
26   FUNCTION get_order_number(
27     p_chr_id IN NUMBER)
28   RETURN VARCHAR2 IS
29     l_order_number VARCHAR2(120);
30   BEGIN
31     l_order_number := OKI_DISCO_UTIL_PVT.get_order_number(
32                       p_chr_id );
33     return l_order_number;
34   END get_order_number;
35 
36 ----------------------------------------------------------------------------
37 -- The following function derives the most suitable period  based
38 -- on a start and end date.
39 -- This function should be used in conjunction with get_duration function
40 ----------------------------------------------------------------------------
41   FUNCTION get_period(
42       p_start_date IN DATE ,
43       p_end_date IN DATE )
44        RETURN VARCHAR2 IS
45      l_period VARCHAR2(120);
46   BEGIN
47      IF(g_start_date = p_start_date  AND g_end_date = p_end_date)
48      THEN
49         return g_period;
50      ELSE
51         l_period := OKI_DISCO_UTIL_PVT.get_period(p_start_date,p_end_date);
52      END IF;
53      return l_period;
54   END get_period;
55 ----------------------------------------------------------------------------
56 -- The following function derives the most suitable duration based
57 -- on a start and end date.
58 -- This function should be used in conjunction with get_period function
59 ----------------------------------------------------------------------------
60 
61   FUNCTION get_duration(
62       p_start_date IN DATE ,
63       p_end_date IN DATE )
64        RETURN NUMBER IS
65      l_duration NUMBER;
66   BEGIN
67      IF(g_start_date = p_start_date  AND g_end_date = p_end_date)
68      THEN
69         return g_duration;
70      ELSE
71         l_duration := OKI_DISCO_UTIL_PVT.get_duration(p_start_date,p_end_date);
72      END IF;
73      return l_duration;
74   END get_duration;
75 
76 ----------------------------------------------------------------------------
77 -- The following function derives the end date based
78 -- on a start date, period_code and duration
79 ----------------------------------------------------------------------------
80   FUNCTION get_end_date(
81       p_start_date IN DATE ,
82       p_period_code IN VARCHAR2,
83       p_duration IN NUMBER)
84        RETURN DATE IS
85      l_end_date  DATE;
86   BEGIN
87      l_end_date := okc_time_util_pvt.get_enddate(p_start_date,p_period_code,p_duration);
88      return l_end_date;
89   END get_end_date;
90 
91 ----------------------------------------------------------------------------
92 -- The following function derives the aanualized amount based
93 -- on amount, start and end date.
94 ----------------------------------------------------------------------------
95   FUNCTION get_annualized_amount(
96       p_amount IN NUMBER,
97       p_start_date IN DATE,
98       p_end_date IN DATE)
99         RETURN NUMBER IS
100      l_annualized_amount NUMBER;
101   BEGIN
102      l_annualized_amount := oki_disco_util_pvt.get_annualized_amount(
103                                p_amount,
104                                p_start_date,
105                                p_end_date);
106      return l_annualized_amount;
107   END get_annualized_amount;
108 
109 ----------------------------------------------------------------------------
110 -- The following function derives current month revenue  for the given
111 -- chr_id, sob_id, End date.
112 ----------------------------------------------------------------------------
113   FUNCTION get_cur_month_rev(
114          p_chr_id IN NUMBER,
115          p_sob_id IN NUMBER,
116          p_end_date IN DATE)
117            RETURN NUMBER IS
118        l_cur_month_rev NUMBER;
119   BEGIN
120       l_cur_month_rev := oki_disco_util_pvt.get_cur_month_rev(
121                                              p_chr_id,
122                                              p_sob_id,
123                                              p_end_date);
124       return l_cur_month_rev;
125   END get_cur_month_rev;
126 
127 ----------------------------------------------------------------------------
128 -- The following function derives backdated revenue  for the given
129 -- chr_id, sob_id, End date.
130 ----------------------------------------------------------------------------
131   FUNCTION get_backdated_rev(
132          p_chr_id IN NUMBER,
133          p_sob_id IN NUMBER,
134          p_end_date IN DATE)
135            RETURN NUMBER IS
136         l_backdated_rev  NUMBER;
137   BEGIN
138 
139      l_backdated_rev := oki_disco_util_pvt.get_backdated_rev(
140                                              p_chr_id,
141                                              p_sob_id,
142                                              p_end_date);
143      return l_backdated_rev;
144   END get_backdated_rev;
145 
146 END OKI_DISCO_UTIL_PUB;