DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_FI_SS_CHARGES_API_PVT

Source


1 PACKAGE BODY IGS_FI_SS_CHARGES_API_PVT AS
2 /* $Header: IGSFI71B.pls 120.4 2006/06/27 14:18:00 skharida ship $ */
3   ------------------------------------------------------------------
4   --Known limitations/enhancements and/or remarks:
5   --
6   --Change History:
7   --Who         When            What
8   --skharida  26-Jun-2006      Bug: 5208136 Modified proc create_charge, removed the obsoleted columns from IGS_FI_INV_INT_PKG.update_row
9   --agairola  28-Apr-2006      Bug: 5177774 added callout to Charges TBH
10   --svuppala  09-Sep-2005      Enh#4506599 Added x_waiver_amount as OUT parameter
11   --svuppala  04-AUG-2005      Enh 3392095 - Tution Waivers build
12   --                           Impact of Charges API version Number change
13   --                           Modified igs_fi_charges_api_pvt.create_charge - version 2.0 and x_waiver_amount
14   --vvutukur  15-Nov-2002  Enh#2584986.Modification done in procedure create_charge.
15   --vvutukur  19-Sep-2002  Enh#2564643.Removed references to subaccount_id from procedure create_charge,
16   --                       Also removed DEFAULT clause from package body to avoid File.Pkg.22 gscc
17   --                       warning.
18   ------------------------------------------------------------------
19 
20 PROCEDURE create_charge(
21                         p_api_version                    IN  NUMBER,
22                         p_init_msg_list                  IN  VARCHAR2,
23                         p_commit                         IN  VARCHAR2,
24                         p_validation_level               IN  NUMBER,
25                         p_person_id                      IN  NUMBER,
26                         p_fee_type                       IN  VARCHAR2,
27                         p_fee_cat                        IN  VARCHAR2,
28                         p_fee_cal_type                   IN  VARCHAR2,
29                         p_fee_ci_sequence_number         IN  NUMBER,
30                         p_course_cd                      IN  VARCHAR2,
31                         p_attendance_type                IN  VARCHAR2,
32                         p_attendance_mode                IN  VARCHAR2,
33                         p_invoice_amount                 IN  NUMBER,
34                         p_invoice_creation_date          IN  DATE,
35                         p_invoice_desc                   IN  VARCHAR2,
36                         p_transaction_type               IN  VARCHAR2,
37                         p_currency_cd                    IN  VARCHAR2,
38                         p_exchange_rate                  IN  NUMBER,
39                         p_effective_date                 IN  DATE,
40                         p_waiver_flag                    IN  VARCHAR2,
41                         p_waiver_reason                  IN  VARCHAR2,
42                         p_source_transaction_id          IN  NUMBER,
43                         p_invoice_id                    OUT NOCOPY  NUMBER,
44                         x_return_status                 OUT NOCOPY  VARCHAR2,
45                         x_msg_count                     OUT NOCOPY  NUMBER,
46                         x_msg_data                      OUT NOCOPY  VARCHAR2,
47                         x_waiver_amount                 OUT NOCOPY  NUMBER
48                        ) IS
49 /***********************************************************************************************
50 
51 Created By     :    kkillams
52 
53 Date Created By:    04-02-2002
54 
55 Purpose        : Private charges API for self service application will create header record and
56                  corresponding line record. i.e. one header record and one line record.
57 
58 Known limitations,enhancements,remarks:
59 Change History
60 
61 Who        When       What
62 skharida  26-Jun-2006  Bug 5208136 - Removed the obsoleted columns from IGS_FI_INV_INT_PKG.update_row
63 agairola  28-Apr-2006      Bug: 5177774 added callout to Charges TBH
64 svuppala  04-AUG-2005  Enh 3392095 - Tution Waivers build
65                        Impact of Charges API version Number change
66                        Modified igs_fi_charges_api_pvt.create_charge - version 2.0 and x_waiver_amount
67 vvutukur 15-Nov-2002 Enh#2584986.Passed SYSDATE to the call to charges API for the parameter
68                      l_chg_line_tbl(1).p_gl_date.
69 vvutukur 19-Sep-2002 Enh#2564643.Removed reference to subaccount_id.
70 ********************************************************************************************** */
71 
72     l_chg_rec             IGS_FI_CHARGES_API_PVT.Header_Rec_Type;
73     l_chg_line_tbl        IGS_FI_CHARGES_API_PVT.Line_Tbl_Type;
74     l_line_id_tbl         IGS_FI_CHARGES_API_PVT.Line_Id_Tbl_Type;
75     l_chg_mtd             IGS_FI_F_TYP_CA_INST.s_chg_method_type%TYPE DEFAULT NULL;
76     l_fee_desc            IGS_FI_FEE_TYPE.description%TYPE DEFAULT NULL;
77 
78     CURSOR cur_chg IS SELECT s_chg_method_type FROM igs_fi_f_typ_ca_inst
79                       WHERE fee_type =p_fee_type
80                       AND   fee_cal_type=p_fee_cal_type
81                       AND   fee_ci_sequence_number =p_fee_ci_sequence_number;
82     CURSOR cur_fee_desc IS  SELECT description  FROM   igs_fi_fee_type
83                             WHERE  fee_type = p_fee_type;
84 
85     CURSOR cur_inv(cp_invoice_id    igs_fi_inv_int.invoice_id%TYPE) IS
86       SELECT inv.*
87       FROM   igs_fi_inv_int inv
88       WHERE  invoice_id = cp_invoice_id;
89 
90     l_rec_chg  cur_inv%ROWTYPE;
91   BEGIN
92     --Getting the charge method
93     OPEN cur_chg;
94     FETCH cur_chg INTO l_chg_mtd;
95     CLOSE cur_chg;
96 
97     --Getting the fee type description
98     OPEN cur_fee_desc;
99     FETCH cur_fee_desc INTO l_fee_desc;
100     CLOSE cur_fee_desc;
101 
102     l_chg_rec.p_person_id                := p_person_id;
103     l_chg_rec.p_fee_type                 := p_fee_type;
104     l_chg_rec.p_fee_cat                  := p_fee_cat;
105     l_chg_rec.p_fee_cal_type             := p_fee_cal_type;
106     l_chg_rec.p_fee_ci_sequence_number   := p_fee_ci_sequence_number;
107     l_chg_rec.p_course_cd                := p_course_cd;
108     l_chg_rec.p_attendance_type          := p_attendance_type;
109     l_chg_rec.p_attendance_mode          := p_attendance_mode;
110     l_chg_rec.p_invoice_amount           := p_invoice_amount;
111     l_chg_rec.p_invoice_creation_date    := p_invoice_creation_date;
112     l_chg_rec.p_invoice_desc             := p_invoice_desc;
113     l_chg_rec.p_transaction_type         := p_transaction_type;
114     l_chg_rec.p_currency_cd              := p_currency_cd;
115     l_chg_rec.p_exchange_rate            := p_exchange_rate;
116     l_chg_rec.p_effective_date           := p_effective_date;
117     l_chg_rec.p_waiver_flag              := p_waiver_flag;
118     l_chg_rec.p_waiver_reason            := p_waiver_reason;
119     l_chg_rec.p_source_transaction_id    := p_source_transaction_id;
120 
121     IF p_waiver_flag = 'Y' THEN
122       l_chg_rec.p_reverse_flag             := 'Y';
123     END IF;
124 
125     l_chg_line_tbl(1).p_s_chg_method_type         := l_chg_mtd;
126     l_chg_line_tbl(1).p_description               := l_fee_desc;
127     l_chg_line_tbl(1).p_chg_elements              := '1';
128     l_chg_line_tbl(1).p_amount                    := p_invoice_amount;
129     l_chg_line_tbl(1).p_unit_attempt_status       := NULL;
130     l_chg_line_tbl(1).p_eftsu                     := NULL;
131     l_chg_line_tbl(1).p_credit_points             := NULL;
132     l_chg_line_tbl(1).p_org_unit_cd               := NULL;
133     l_chg_line_tbl(1).p_attribute_category        := NULL;
134     l_chg_line_tbl(1).p_attribute1                := NULL;
135     l_chg_line_tbl(1).p_attribute2                := NULL;
136     l_chg_line_tbl(1).p_attribute3                := NULL;
137     l_chg_line_tbl(1).p_attribute4                := NULL;
138     l_chg_line_tbl(1).p_attribute5                := NULL;
139     l_chg_line_tbl(1).p_attribute6                := NULL;
140     l_chg_line_tbl(1).p_attribute7                := NULL;
141     l_chg_line_tbl(1).p_attribute8                := NULL;
142     l_chg_line_tbl(1).p_attribute9                := NULL;
143     l_chg_line_tbl(1).p_attribute10               := NULL;
144     l_chg_line_tbl(1).p_attribute11               := NULL;
145     l_chg_line_tbl(1).p_attribute12               := NULL;
146     l_chg_line_tbl(1).p_attribute13               := NULL;
147     l_chg_line_tbl(1).p_attribute14               := NULL;
148     l_chg_line_tbl(1).p_attribute15               := NULL;
149     l_chg_line_tbl(1).p_attribute16               := NULL;
150     l_chg_line_tbl(1).p_attribute17               := NULL;
151     l_chg_line_tbl(1).p_attribute18               := NULL;
152     l_chg_line_tbl(1).p_attribute19               := NULL;
153     l_chg_line_tbl(1).p_attribute20               := NULL;
154     l_chg_line_tbl(1).p_override_dr_rec_ccid      := NULL;
155     l_chg_line_tbl(1).p_override_cr_rev_ccid      := NULL;
156     l_chg_line_tbl(1).p_override_dr_rec_account_cd :=NULL;
157     l_chg_line_tbl(1).p_override_cr_rev_account_cd :=NULL;
158     l_chg_line_tbl(1).p_location_cd                :=NULL;
159     l_chg_line_tbl(1).p_uoo_id                     :=NULL;
160     l_chg_line_tbl(1).p_d_gl_date                  :=TRUNC(SYSDATE);
161 
162      -- calling igs_fi_charges_api_pvt.create_charge api
163      igs_fi_charges_api_pvt.create_charge(
164                                            p_api_version           =>p_api_version,
165                                            p_init_msg_list         =>p_init_msg_list,
166                                            p_commit                =>p_commit,
167                                            p_validation_level      =>p_validation_level,
168                                            p_header_rec            =>l_chg_rec,
169                                            p_line_tbl              =>l_chg_line_tbl,
170                                            x_invoice_id            =>p_invoice_id,
171                                            x_line_id_tbl           =>l_line_id_tbl,
172                                            x_return_status         =>x_return_status,
173                                            x_msg_count             =>x_msg_count,
174                                            x_msg_data              =>x_msg_data,
175                                            x_waiver_amount         =>x_waiver_amount
176                                           );
177 
178 -- If the charge is getting reversed and the charges API callout has been successful
179 -- update the charge table with the waiver reason.
180 
181     IF ((p_waiver_flag = 'Y') AND (p_invoice_amount < 0) AND (x_return_status = 'S')) THEN
182       OPEN cur_inv(p_source_transaction_id);
183       FETCH cur_inv INTO l_rec_chg;
184       CLOSE cur_inv;
185 
186       igs_fi_inv_int_pkg.update_row(x_rowid                         => l_rec_chg.row_id,
187                                     x_invoice_id                    => l_rec_chg.invoice_id,
188                                     x_person_id                     => l_rec_chg.person_id,
189                                     x_fee_type                      => l_rec_chg.fee_type,
190                                     x_fee_cat                       => l_rec_chg.fee_cat,
191                                     x_fee_cal_type                  => l_rec_chg.fee_cal_type,
192                                     x_fee_ci_sequence_number        => l_rec_chg.fee_ci_sequence_number,
193                                     x_course_cd                     => l_rec_chg.course_cd,
194                                     x_attendance_mode               => l_rec_chg.attendance_mode,
195                                     x_attendance_type               => l_rec_chg.attendance_type,
196                                     x_invoice_amount_due            => l_rec_chg.invoice_amount_due,
197                                     x_invoice_creation_date         => l_rec_chg.invoice_creation_date,
198                                     x_invoice_desc                  => l_rec_chg.invoice_desc,
199                                     x_transaction_type              => l_rec_chg.transaction_type,
200                                     x_currency_cd                   => l_rec_chg.currency_cd,
201                                     x_status                        => l_rec_chg.status,
202                                     x_attribute_category            => l_rec_chg.attribute_category,
203                                     x_attribute1                    => l_rec_chg.attribute1,
204                                     x_attribute2                    => l_rec_chg.attribute2,
205                                     x_attribute3                    => l_rec_chg.attribute3,
206                                     x_attribute4                    => l_rec_chg.attribute4,
207                                     x_attribute5                    => l_rec_chg.attribute5,
208                                     x_attribute6                    => l_rec_chg.attribute6,
209                                     x_attribute7                    => l_rec_chg.attribute7,
210                                     x_attribute8                    => l_rec_chg.attribute8,
211                                     x_attribute9                    => l_rec_chg.attribute9,
212                                     x_attribute10                   => l_rec_chg.attribute10,
213                                     x_invoice_amount                => l_rec_chg.invoice_amount,
214                                     x_bill_id                       => l_rec_chg.bill_id,
215                                     x_bill_number                   => l_rec_chg.bill_number,
216                                     x_bill_date                     => l_rec_chg.bill_date,
217                                     x_waiver_flag                   => p_waiver_flag,
218                                     x_waiver_reason                 => p_waiver_reason,
219                                     x_effective_date                => l_rec_chg.effective_date,
220                                     x_invoice_number                => l_rec_chg.invoice_number,
221                                     x_exchange_rate                 => l_rec_chg.exchange_rate,
222                                     x_bill_payment_due_date         => l_rec_chg.bill_payment_due_date,
223                                     x_optional_fee_flag             => l_rec_chg.optional_fee_flag,
224                                     x_reversal_gl_date              => sysdate,
225                                     x_tax_year_code                 => l_rec_chg.tax_year_code,
226 				    x_waiver_name                   => l_rec_chg.waiver_name);
227     END IF;
228   EXCEPTION
229     WHEN Others THEN
230       FND_MESSAGE.Set_Name('IGS', 'IGS_GE_UNHANDLED_EXCEPTION');
231       FND_MESSAGE.Set_Token('NAME','IGS_FI_SS_CHARGES_API_PVT.create_charge');
232       IGS_GE_MSG_STACK.Add;
233       APP_EXCEPTION.Raise_Exception;
234 END create_charge;
235 
236 
237 END IGS_FI_SS_CHARGES_API_PVT;