[Home] [Help]
PACKAGE BODY: APPS.IGI_IAC_ASSET_BALANCES_PKG
Source
1 PACKAGE BODY igi_iac_asset_balances_pkg AS
2 -- $Header: igiiaabb.pls 120.6.12000000.1 2007/08/01 16:12:34 npandya ship $
3
4 --===========================FND_LOG.START=====================================
5 g_state_level NUMBER := FND_LOG.LEVEL_STATEMENT;
6 g_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
7 g_event_level NUMBER := FND_LOG.LEVEL_EVENT;
8 g_excep_level NUMBER := FND_LOG.LEVEL_EXCEPTION;
9 g_error_level NUMBER := FND_LOG.LEVEL_ERROR;
10 g_unexp_level NUMBER := FND_LOG.LEVEL_UNEXPECTED;
11 g_path VARCHAR2(100) := 'IGI.PLSQL.igiiaabb.igi_iac_asset_balances_pkg.';
12 --===========================FND_LOG.END=====================================
13
14
15 PROCEDURE insert_row (
16 x_rowid IN OUT NOCOPY VARCHAR2,
17 x_asset_id IN NUMBER,
18 x_book_type_code IN VARCHAR2,
19 x_period_counter IN NUMBER,
20 x_net_book_value IN NUMBER,
21 x_adjusted_cost IN NUMBER,
22 x_operating_acct IN NUMBER,
23 x_reval_reserve IN NUMBER,
24 x_deprn_amount IN NUMBER,
25 x_deprn_reserve IN NUMBER,
26 x_backlog_deprn_reserve IN NUMBER,
27 x_general_fund IN NUMBER,
28 x_last_reval_date IN DATE,
29 x_current_reval_factor IN NUMBER,
30 x_cumulative_reval_factor IN NUMBER,
31 x_mode IN VARCHAR2 ) AS
32 /*
33
34 || Created By : Narayanan Iyer
35 || Created On : 14-APR-2002
36 || Purpose : Handles the INSERT DML logic for the table.
37 || Known limitations, enhancements or remarks :
38 || Change History :
39 || Who When What
40 || (reverse chronological order - newest change first)
41 */
42
43
44 x_last_update_date DATE;
45 x_last_updated_by NUMBER;
46 x_last_update_login NUMBER;
47 x_creation_date DATE;
48 x_created_by NUMBER;
49
50
51 CURSOR c IS
52 SELECT rowid
53 FROM igi_iac_asset_balances
54 WHERE asset_id = x_asset_id
55 AND book_type_code = x_book_type_code
56 AND period_counter = x_period_counter;
57
58
59 BEGIN
60
61 IF (x_mode = 'R') THEN
62 x_last_update_date := SYSDATE;
63 x_creation_date := SYSDATE;
64 x_created_by := fnd_global.user_id;
65 IF (x_created_by IS NULL) THEN
66 x_created_by := -1;
67 END IF;
68 x_last_updated_by := fnd_global.user_id;
69 IF (x_last_updated_by IS NULL) THEN
70 x_last_updated_by := -1;
71 END IF;
72 x_last_update_login := fnd_global.login_id;
73 IF (x_last_update_login IS NULL) THEN
74 x_last_update_login := -1;
75 END IF;
76 ELSE
77 fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
78 igi_iac_debug_pkg.debug_other_msg(g_error_level,g_path||'insert_row',FALSE);
79 app_exception.raise_exception;
80 END IF;
81
82
83 INSERT INTO igi_iac_asset_balances (
84 asset_id,
85 book_type_code,
86 period_counter,
87 net_book_value,
88 adjusted_cost,
89 operating_acct,
90 reval_reserve,
91 deprn_amount,
92 deprn_reserve,
93 backlog_deprn_reserve,
94 general_fund,
95 last_reval_date,
96 current_reval_factor,
97 cumulative_reval_factor,
98 creation_date,
99 created_by,
100 last_update_date,
101 last_updated_by,
102 last_update_login
103 ) VALUES (
104 x_asset_id,
105 x_book_type_code,
106
107 x_period_counter,
108 x_net_book_value,
109 x_adjusted_cost,
110 x_operating_acct,
111 x_reval_reserve,
112 x_deprn_amount,
113 x_deprn_reserve,
114 x_backlog_deprn_reserve,
115 x_general_fund,
116 x_last_reval_date,
117 x_current_reval_factor,
118 x_cumulative_reval_factor,
119 x_creation_date,
120 x_created_by,
121 x_last_update_date,
122 x_last_updated_by,
123 x_last_update_login
124 );
125
126 OPEN c;
127 FETCH c INTO x_rowid;
128 IF (c%NOTFOUND) THEN
129 CLOSE c;
130
131 RAISE NO_DATA_FOUND;
132 END IF;
133 CLOSE c;
134
135 END insert_row;
136
137
138 PROCEDURE update_row (
139 -- x_rowid IN VARCHAR2,
140 x_asset_id IN NUMBER,
141 x_book_type_code IN VARCHAR2,
142 x_period_counter IN NUMBER,
143 x_net_book_value IN NUMBER,
144 x_adjusted_cost IN NUMBER,
145 x_operating_acct IN NUMBER,
146 x_reval_reserve IN NUMBER,
147 x_deprn_amount IN NUMBER,
148 x_deprn_reserve IN NUMBER,
149 x_backlog_deprn_reserve IN NUMBER,
150 x_general_fund IN NUMBER,
151 x_last_reval_date IN DATE,
152 x_current_reval_factor IN NUMBER,
153 x_cumulative_reval_factor IN NUMBER,
154
155 x_mode IN VARCHAR2 ) AS
156 /*
157 || Created By :
158 || Created On : 14-APR-2002
159 || Purpose : Handles the UPDATE DML logic for the table.
160 || Known limitations, enhancements or remarks :
161 || Change History :
162 || Who When What
163 || (reverse chronological order - newest change first)
164 */
165 x_last_update_date DATE ;
166 x_last_updated_by NUMBER;
167 x_last_update_login NUMBER;
168
169
170 BEGIN
171
172 x_last_update_date := SYSDATE;
173 IF (x_mode = 'R') THEN
174 x_last_updated_by := fnd_global.user_id;
175
176 IF x_last_updated_by IS NULL THEN
177
178 x_last_updated_by := -1;
179 END IF;
180 x_last_update_login := fnd_global.login_id;
181 IF (x_last_update_login IS NULL) THEN
182 x_last_update_login := -1;
183 END IF;
184 ELSE
185 fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
186 igi_iac_debug_pkg.debug_other_msg(g_error_level,g_path||'update_row',FALSE);
187 app_exception.raise_exception;
188 END IF;
189
190 UPDATE igi_iac_asset_balances
191 SET
192 net_book_value = x_net_book_value,
193 adjusted_cost = x_adjusted_cost,
194 operating_acct = x_operating_acct,
195 reval_reserve = x_reval_reserve,
196 deprn_amount = x_deprn_amount,
197 deprn_reserve = x_deprn_reserve,
198 backlog_deprn_reserve = x_backlog_deprn_reserve,
199 general_fund = x_general_fund,
200 last_reval_date = x_last_reval_date,
201 current_reval_factor = x_current_reval_factor,
202
203 cumulative_reval_factor = x_cumulative_reval_factor,
204 last_update_date = x_last_update_date,
205 last_updated_by = x_last_updated_by,
206 last_update_login = x_last_update_login
207 WHERE asset_id = x_asset_id
208 AND book_type_code = x_book_type_code
209 AND period_counter = x_period_counter;
210
211
212 END update_row;
213
214
215
216 PROCEDURE delete_row (
217 x_asset_id IN NUMBER,
218 x_book_type_code IN VARCHAR2,
219 x_period_counter IN NUMBER
220 ) AS
221 /*
222 || Created By : Narayanan Iyer
223 || Created On : 14-APR-2002
224 || Purpose : Handles the DELETE DML logic for the table.
225 || Known limitations, enhancements or remarks :
226
227 || Change History :
228 || Who When What
229 || (reverse chronological order - newest change first)
230 */
231
232
233 BEGIN
234
235
236 DELETE FROM igi_iac_asset_balances
237 WHERE asset_id = x_asset_id
238 AND book_type_code = x_book_type_code
239 AND period_counter = x_period_counter;
240
241
242 /*
243 IF (SQL%NOTFOUND) THEN
244 RAISE NO_DATA_FOUND;
245 END IF;
246 */
247
248 END delete_row;
249
250
251 END igi_iac_asset_balances_pkg;