DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_SL_ROUNDOFF_DIGITS_PKG

Source


1 PACKAGE BODY igf_sl_roundoff_digits_pkg AS
2 /* $Header: IGFSL14B.pls 115.13 2003/12/04 15:48:14 sjadhav ship $ */
3 
4 --
5 --  Created By : prchandr
6 --  Created On :06-APR-2001
7 --  Purpose : Rounding off Logic implemented
8 --  Known limitations, enhancements or remarks :
9 --  Change History :
10 -----------------------------------------------------------------
11 --  Who           When            What
12 -----------------------------------------------------------------
13 --  sjadhav       4-Dec-2003      Removed p_curr_disb_num
14 -----------------------------------------------------------------
15 --  sjadhav       3-Dec-2003      Removed fee perct from
16 --                                cl round off
17 -----------------------------------------------------------------
18 --  sjadhav       3-Dec-2003      Corrected lp_disb_num additions
19 -----------------------------------------------------------------
20 --  sjadhav       28-Nov-2003     Use Disb Numbers instead
21 --                                of % as the % may not total
22 --                                to 100% all the time
23 -----------------------------------------------------------------
24 -- avenkatr       20-Apr-01       1. Assigned values to the OUT
25 --                                NOCOPY parameters of procedure
26 --                                gross_fees_roundoff.
27 -----------------------------------------------------------------
28 --
29 
30 PROCEDURE gross_fees_roundoff ( p_last_disb_num      IN            NUMBER,
31                                 p_offered_amt        IN            NUMBER,
32                                 p_fee_perct          IN            NUMBER,
33                                 p_disb_gross_amt     IN OUT NOCOPY NUMBER,
34                                 p_disb_net_amt          OUT NOCOPY NUMBER,
35                                 p_fee                   OUT NOCOPY NUMBER )  IS
36 
37 BEGIN
38 --
39 -- Rounding off Process for Gross Amount. The logic is that
40 -- if there are n disbursement amounts then the disbursement
41 -- gross amount for n-1 disb amts is calculated as
42 -- offered amount by the number of disbursements and the resule
43 -- is rounded off. Whereas the nth disb amts logic is that
44 -- rounded off gross amt is multiplied with the no of disbursements
45 -- and if it greater than offered amt then it is subtracted from the
46 -- roundedoff disbursement gross amount else it is added with
47 -- the amount.
48 --
49 
50   IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
51      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','In Param : p_last_disb_num '||p_last_disb_num);
52      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','In Param : p_offered_amt '||p_offered_amt);
53      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','In Param : p_fee_perct '||p_fee_perct);
54      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','In Param : p_disb_gross_amt '||p_disb_gross_amt);
55      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Spec lp_disb_number 1: lp_disb_number '||lp_disb_number);
56   END IF;
57 
58   lp_disb_number  := NVL(lp_disb_number,0)  + 1;
59 
60   IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
61      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Spec lp_disb_number 2: lp_disb_number '||lp_disb_number);
62   END IF;
63 
64   IF lp_disb_number <> p_last_disb_num THEN
65     --
66     -- Not the last disbursement
67     --
68 
69     p_disb_gross_amt  := ROUND( p_disb_gross_amt );
70     lp_current_amt    := NVL(lp_current_amt,0) + NVL(p_disb_gross_amt,0);
71 
72     IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
73        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Disb <> Last : p_disb_gross_amt '||p_disb_gross_amt);
74        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Disb <> Last : lp_current_amt '||lp_current_amt);
75     END IF;
76 
77 
78   ELSE
79     --
80     -- This is the last disbursement
81     --
82 
83     p_disb_gross_amt   := NVL(p_offered_amt,0) - NVL(lp_current_amt,0);
84     p_disb_gross_amt   := ROUND(p_disb_gross_amt);
85     lp_current_amt     := 0;
86     lp_disb_number     := 0;
87 
88     IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
89        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Disb = Last : p_disb_gross_amt '||p_disb_gross_amt);
90        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Disb = Last : lp_current_amt '||lp_current_amt);
91        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Disb = Last : lp_disb_number '||lp_disb_number);
92     END IF;
93 
94   END IF;
95 
96   p_fee               := TRUNC( NVL(p_disb_gross_amt,0) * ((NVL(p_fee_perct,0))/100));
97   p_disb_net_amt      := NVL(p_disb_gross_amt,0) - NVL(p_fee,0);
98 
99   IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
100      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Out Param : p_disb_gross_amt '||p_disb_gross_amt);
101      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','OutParam : p_disb_net_amt '||p_disb_net_amt);
102      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.dl_round.debug','Out Param : p_fee '||p_fee);
103   END IF;
104 
105 
106 END gross_fees_roundoff ;
107 
108 
109 
110 PROCEDURE cl_gross_fees_roundoff ( p_last_disb_num      IN              NUMBER,
111                                    p_offered_amt        IN              NUMBER,
112                                    p_disb_gross_amt     IN OUT NOCOPY   NUMBER  )  IS
113 
114 BEGIN
115 
116 --
117 -- Rounding off Process for Gross Amount. The logic is that
118 -- if there are n disbursement amounts then the disbursement
119 -- gross amount for n-1 disb amts is calculated as
120 -- offered amount by the number of disbursements and the resule
121 -- is rounded off. Whereas the nth disb amts logic is that
122 -- rounded off gross amt is multiplied with the no of disbursements
123 -- and if it greater than offered amt then it is subtracted from the
124 -- roundedoff disbursement gross amount else it is added with
125 -- the amount.
126 --
127   IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
128      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','In Param : p_last_disb_num '||p_last_disb_num);
129      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','In Param : p_offered_amt '||p_offered_amt);
130      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','In Param : p_disb_gross_amt '||p_disb_gross_amt);
131      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Spec lp_disb_number 1: lp_disb_number '||lp_disb_number);
132   END IF;
133 
134   lp_disb_number  := NVL(lp_disb_number,0)  + 1;
135 
136   IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
137      fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Spec lp_disb_number 2: lp_disb_number '||lp_disb_number);
138   END IF;
139 
140   IF lp_disb_number <> p_last_disb_num THEN
141     --
142     -- Not the last disbursement
143     --
144     p_disb_gross_amt  := ROUND( p_disb_gross_amt );
145     lp_current_amt    := NVL(lp_current_amt,0) + NVL(p_disb_gross_amt,0);
146 
147     IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
148        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Disb <> Last : p_disb_gross_amt '||p_disb_gross_amt);
149        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Disb <> Last : lp_current_amt '||lp_current_amt);
150     END IF;
151 
152   ELSE
153     --
154     -- This is the last disbursement
155     --
156 
157     p_disb_gross_amt  := NVL(p_offered_amt,0) - NVL(lp_current_amt,0);
158     p_disb_gross_amt  := ROUND(p_disb_gross_amt);
159     lp_current_amt    := 0;
160     lp_disb_number    := 0;
161     IF fnd_log.level_statement >= fnd_log.g_current_runtime_level THEN
162        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Disb = Last : p_disb_gross_amt '||p_disb_gross_amt);
163        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Disb = Last : lp_current_amt '||lp_current_amt);
164        fnd_log.string(fnd_log.level_statement,'igf.plsql.igf_sl_roundoff_digits_pkg.cl_round.debug','Disb = Last : lp_disb_number '||lp_disb_number);
165     END IF;
166 
167   END IF;
168 
169 END cl_gross_fees_roundoff ;
170 
171 
172 END igf_sl_roundoff_digits_pkg;
173