[Home] [Help]
PACKAGE BODY: APPS.ARP_RW_ICR_PKG
Source
1 PACKAGE BODY ARP_RW_ICR_PKG AS
2 /* $Header: ARERICRB.pls 120.7.12010000.3 2009/02/02 16:46:38 mpsingh ship $ */
3 --
4 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
5
6 PROCEDURE validate_args_insert_row(
7 p_row_id IN VARCHAR2,
8 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
9 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
10 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
11 p_receipt_date IN ar_interim_cash_receipts.receipt_date%TYPE,
12 p_gl_date IN ar_interim_cash_receipts.gl_date%TYPE,
13 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
14 p_pay_from_customer IN
15 ar_interim_cash_receipts.pay_from_customer%TYPE,
16 p_site_use_id IN
17 ar_interim_cash_receipts.site_use_id%TYPE,
18 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
19 p_payment_schedule_id IN
20 ar_payment_schedules.payment_schedule_id%TYPE,
21 p_currency_code IN ar_interim_cash_receipts.currency_code%TYPE,
22 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
23 p_receipt_method_id IN
24 ar_interim_cash_receipts.receipt_method_id%TYPE,
25 p_remittance_bank_account_id IN
26 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE );
27 --
28 PROCEDURE validate_args_update_row(
29 p_row_id IN VARCHAR2,
30 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
31 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
32 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
33 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
34 p_pay_from_customer IN
35 ar_interim_cash_receipts.pay_from_customer%TYPE,
36 p_site_use_id IN
37 ar_interim_cash_receipts.site_use_id%TYPE,
38 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
39 p_payment_schedule_id IN
40 ar_payment_schedules.payment_schedule_id%TYPE,
41 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
42 p_receipt_method_id IN
43 ar_interim_cash_receipts.receipt_method_id%TYPE,
44 p_remittance_bank_account_id IN
45 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE );
46 --
47 PROCEDURE validate_special_type(
48 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
49 p_pay_from_customer IN
50 ar_interim_cash_receipts.pay_from_customer%TYPE,
51 p_site_use_id IN
52 ar_interim_cash_receipts.site_use_id%TYPE,
53 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
54 p_payment_schedule_id IN
55 ar_payment_schedules.payment_schedule_id%TYPE );
56 --
57 PROCEDURE val_args_applied_amount_total(
58 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE );
59 PROCEDURE val_args_check_unique_receipt(
60 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
61 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
62 p_customer_id IN hz_cust_accounts.cust_account_id%TYPE,
63 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE );
64 --
65 PROCEDURE update_bank_account_uses(
66 p_customer_id IN hz_cust_accounts.cust_account_id%TYPE,
67 p_bank_account_id IN ar_batches.remit_bank_acct_use_id%TYPE );
68 --
69 /*===========================================================================+
70 | PROCEDURE |
71 | update_row - Update a row in the AR_ICR table after checking for|
72 | uniqueness |
73 | |
74 | DESCRIPTION |
75 | This function updates a row in AR_ICR table after checking for |
76 | uniqueness for items of the receipt |
77 | |
78 | SCOPE - PUBLIC |
79 | |
80 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
81 | arp_util.debug - debug procedure |
82 | |
83 | ARGUMENTS : IN: |
84 | p_row_id - Row ID |
85 | p_cr_id - Cash receipt Id |
86 | p_receipt_number - Receipt Number |
87 | p_gl_date - GL Date |
88 | p_customer_id - Customer ID |
89 | p_receipt_amount - Receipt Amount |
90 | p_module_name - Module that called this procedure |
91 | p_module_version - Version of the module that called this |
92 | procedure |
93 | OUT: |
94 | |
95 | RETURNS : NONE |
96 | |
97 | NOTES - This procedure calls the check_unique_receipt procedure |
98 | |
99 | MODIFICATION HISTORY - 08/08/95 - Created by Ganesh Vaidee |
100 | |
101 | 10-21-96 OSTEINME Added new parameters p_factor_discount_amount|
102 | and p_customer_bank_account_id for Japan |
103 | project. |
104 | Also added new parameter |
105 | p_anticipated_clearing_date for bug 371373 |
106 | 10-28-96 OSTEINME added new parameter customer_bank_branch_id |
107 | 08-25-97 KLAWRANC Bug fix #462056. |
108 | Uncommented out NOCOPY call to update_bank_uses. |
109 | Changed call to pass |
110 | p_customer_bank_account_id. |
111 | 10-28-98 K.Murphy Cross Currency Lockbox. Added amount_applied |
112 | and trans_to_receipt_rate as parameters and updated|
113 | columns. |
114 | 12-24-98 D.Jancis Bug 750400: Added GL_DATE as it was not |
115 | being passed in thus not getting updated |
116 | 05-01-02 D.Jancis Enh 2074220: added application notes |
117 | procedures. |
118 | 12-24-02 K.Dhaliwal Bug 2707190 Added |
119 | application_ref_type,customer_reference and|
120 | customer_reason to update and insert |
121 | procedures. |
122 +===========================================================================*/
123
124 -- Bug fix: 597519 12/18/97
125 -- Problem: rate information is not being passed to server on commit
126 -- Changes: passing parameters exchange date, exchange rate and
127 -- exchange rate type to PROCEDURE update_row
128 --
129
130 PROCEDURE update_row(
131 p_row_id IN VARCHAR2,
132 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
133 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
134 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
135 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
136 p_amount_applied IN
137 ar_interim_cash_receipts.amount_applied%TYPE,
138 p_trans_to_receipt_rate IN
139 ar_interim_cash_receipts.trans_to_receipt_rate%TYPE,
140 p_factor_discount_amount IN
141 ar_interim_cash_receipts.factor_discount_amount%TYPE,
142 p_receipt_method_id IN
143 ar_interim_cash_receipts.receipt_method_id%TYPE,
144 p_remittance_bank_account_id IN
145 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE,
146 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
147 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
148 p_payment_schedule_id IN
149 ar_payment_schedules.payment_schedule_id%TYPE,
150 p_pay_from_customer IN
151 ar_interim_cash_receipts.pay_from_customer%TYPE,
152 p_customer_bank_account_id IN
153 ar_interim_cash_receipts.customer_bank_account_id%TYPE,
154 p_customer_bank_branch_id IN
155 ar_interim_cash_receipts.customer_bank_branch_id%TYPE,
156 p_site_use_id IN ar_interim_cash_receipts.site_use_id%TYPE,
157 p_ussgl_transaction_code IN
158 ar_interim_cash_receipts.ussgl_transaction_code%TYPE,
159 p_doc_sequence_id IN ar_interim_cash_receipts.doc_sequence_id%TYPE,
160 p_doc_sequence_value IN
161 ar_interim_cash_receipts.doc_sequence_value%TYPE,
162 p_anticipated_clearing_date IN
163 ar_interim_cash_receipts.anticipated_clearing_date%TYPE,
164 p_attribute_category IN
165 ar_interim_cash_receipts.attribute_category%TYPE,
166 p_attribute1 IN ar_interim_cash_receipts.attribute1%TYPE,
167 p_attribute2 IN ar_interim_cash_receipts.attribute2%TYPE,
168 p_attribute3 IN ar_interim_cash_receipts.attribute3%TYPE,
169 p_attribute4 IN ar_interim_cash_receipts.attribute4%TYPE,
170 p_attribute5 IN ar_interim_cash_receipts.attribute5%TYPE,
171 p_attribute6 IN ar_interim_cash_receipts.attribute6%TYPE,
172 p_attribute7 IN ar_interim_cash_receipts.attribute7%TYPE,
173 p_attribute8 IN ar_interim_cash_receipts.attribute8%TYPE,
174 p_attribute9 IN ar_interim_cash_receipts.attribute9%TYPE,
175 p_attribute10 IN ar_interim_cash_receipts.attribute10%TYPE,
176 p_attribute11 IN ar_interim_cash_receipts.attribute11%TYPE,
177 p_attribute12 IN ar_interim_cash_receipts.attribute12%TYPE,
178 p_attribute13 IN ar_interim_cash_receipts.attribute13%TYPE,
179 p_attribute14 IN ar_interim_cash_receipts.attribute14%TYPE,
180 p_attribute15 IN ar_interim_cash_receipts.attribute15%TYPE,
181 -- Bug fix: 597519 12/18/97
182 p_exchange_date IN ar_interim_cash_receipts.exchange_date%TYPE,
183 p_exchange_rate IN ar_interim_cash_receipts.exchange_rate%TYPE,
184 p_exchange_rate_type IN
185 ar_interim_cash_receipts.exchange_rate_type%TYPE,
186 -- Bug fix: 750400 12/24/98
187 p_gl_date IN ar_interim_cash_receipts.gl_date%TYPE,
188 -- enh 2074220
189 p_application_notes IN
190 ar_interim_cash_receipts.application_notes%TYPE,
191 p_application_ref_type IN
192 ar_interim_cash_receipts.application_ref_type%TYPE,
193 p_customer_reference IN
194 ar_interim_cash_receipts.customer_reference%TYPE,
195 p_customer_reason IN ar_interim_cash_receipts.customer_reason%TYPE,
196 p_automatch_set_id IN ar_interim_cash_receipts.automatch_set_id%TYPE,
197 p_autoapply_flag IN ar_interim_cash_receipts.autoapply_flag%TYPE,
198 p_module_name IN VARCHAR2,
199 p_module_version IN VARCHAR2 ) IS
200 --
201 l_icr_rec ar_interim_cash_receipts%ROWTYPE;
202 BEGIN
203 IF PG_DEBUG in ('Y', 'C') THEN
204 arp_util.debug( 'arp_rw_icr_pkg.update_row()+' );
205 arp_util.debug( 'Special Type : '||p_special_type );
206 arp_util.debug( 'Receipt Id : '||p_cr_id );
207 arp_util.debug( 'Row Id : '||p_row_id );
208 arp_util.debug( 'Receipt Number : '||p_receipt_number );
209 arp_util.debug( 'Received Amount : '||TO_CHAR( p_receipt_amount ) );
210 arp_util.debug( 'Amount Applied : '||TO_CHAR( p_amount_applied ) );
211 arp_util.debug( 'Cross Currency Rate: '||TO_CHAR( p_trans_to_receipt_rate) );
212 arp_util.debug( 'Bank Charges : '||TO_CHAR( p_factor_discount_amount ) );
213 END IF;
214 arp_util.debug( 'Receipt Amount : ' ||TO_CHAR( p_receipt_amount +
215 p_factor_discount_amount) );
216 IF PG_DEBUG in ('Y', 'C') THEN
217 arp_util.debug( 'Method Id : '||p_receipt_method_id );
218 arp_util.debug( 'Bank Account Use Id : '||p_remittance_bank_account_id );
219 arp_util.debug( 'Receipt Amount : '||p_receipt_amount );
220 arp_util.debug( 'Batch Id : '||p_batch_id );
221 arp_util.debug( 'Pay From Customer : '||p_pay_from_customer );
222 arp_util.debug( 'Cust. Bank Acct. ID: ' || p_customer_bank_account_id );
223 arp_util.debug( 'Cust. Bank Branch ID: ' || p_customer_bank_branch_id);
224 arp_util.debug( 'Site Use ID : '||p_site_use_id );
225 arp_util.debug( 'Anticipated Clearing Date: ' || p_anticipated_clearing_date);
226 arp_util.debug( 'Automatch set id : '|| p_automatch_set_id );
227 arp_util.debug( 'Autoapply flag: ' || p_autoapply_flag);
228 END IF;
229 --
230 arp_cr_icr_pkg.set_to_dummy( l_icr_rec );
231 --
232 -- Populate ICR record structure
233 --
234 l_icr_rec.cash_receipt_id := p_cr_id;
235 l_icr_rec.amount := p_receipt_amount;
236 l_icr_rec.amount_applied := p_amount_applied;
237 l_icr_rec.trans_to_receipt_rate := p_trans_to_receipt_rate;
238 l_icr_rec.factor_discount_amount := p_factor_discount_amount;
239 l_icr_rec.receipt_method_id := p_receipt_method_id;
240 l_icr_rec.remit_bank_acct_use_id := p_remittance_bank_account_id;
241 l_icr_rec.batch_id := p_batch_id;
242 l_icr_rec.customer_trx_id := p_customer_trx_id;
243 l_icr_rec.payment_schedule_id := p_payment_schedule_id;
244 -- Bug fix: 597519 12/18/97
245 l_icr_rec.exchange_date := p_exchange_date;
246 l_icr_rec.exchange_rate := p_exchange_rate;
247 l_icr_rec.exchange_rate_type := p_exchange_rate_type;
248 -- Bug fix: 750400 12/24/98
249 l_icr_rec.gl_date := p_gl_date;
250 --
251 l_icr_rec.pay_from_customer := p_pay_from_customer;
252 l_icr_rec.customer_bank_account_id := p_customer_bank_account_id;
253 l_icr_rec.customer_bank_branch_id := p_customer_bank_branch_id;
254 l_icr_rec.receipt_number := p_receipt_number;
255 l_icr_rec.site_use_id := p_site_use_id;
256 l_icr_rec.special_type := p_special_type;
257 l_icr_rec.anticipated_clearing_date := p_anticipated_clearing_date;
258 --
259 l_icr_rec.status := 'UNAPP';
260 l_icr_rec.type := 'CASH';
261 --
262 l_icr_rec.ussgl_transaction_code := p_ussgl_transaction_code;
263 l_icr_rec.attribute_category := p_attribute_category;
264 l_icr_rec.attribute1 := p_attribute1;
265 l_icr_rec.attribute2 := p_attribute2;
266 l_icr_rec.attribute3 := p_attribute3;
267 l_icr_rec.attribute4 := p_attribute4;
268 l_icr_rec.attribute5 := p_attribute5;
269 l_icr_rec.attribute6 := p_attribute6;
270 l_icr_rec.attribute7 := p_attribute7;
271 l_icr_rec.attribute8 := p_attribute8;
272 l_icr_rec.attribute9 := p_attribute9;
273 l_icr_rec.attribute10 := p_attribute10;
274 l_icr_rec.attribute11 := p_attribute11;
275 l_icr_rec.attribute12 := p_attribute12;
276 l_icr_rec.attribute13 := p_attribute13;
277 l_icr_rec.attribute14 := p_attribute14;
278 l_icr_rec.attribute15 := p_attribute15;
279 l_icr_rec.doc_sequence_id := p_doc_sequence_id;
280 l_icr_rec.doc_sequence_value := p_doc_sequence_value;
281 l_icr_rec.application_notes := p_application_notes;
282 -- Bug 2707190 additions
283 l_icr_rec.application_ref_type := p_application_ref_type;
284 l_icr_rec.customer_reference := p_customer_reference;
285 l_icr_rec.customer_reason := p_customer_reason;
286 l_icr_rec.automatch_set_id := p_automatch_set_id;
287 l_icr_rec.autoapply_flag := p_autoapply_flag;
288 --
289 -- Validate arguments
290 --
291 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
292 validate_args_update_row( p_row_id, l_icr_rec.cash_receipt_id,
293 l_icr_rec.special_type,
294 l_icr_rec.receipt_number,
295 l_icr_rec.batch_id,
296 l_icr_rec.pay_from_customer,
297 l_icr_rec.site_use_id,
298 l_icr_rec.customer_trx_id,
299 l_icr_rec.payment_schedule_id,
300 l_icr_rec.amount,
301 l_icr_rec.receipt_method_id,
302 l_icr_rec.remit_bank_acct_use_id );
303 END IF;
304 --
305 -- Call Check Unique Batch Name procedure
306 --
307 arp_rw_icr_pkg.check_unique_receipt( p_row_id, l_icr_rec.cash_receipt_id,
308 l_icr_rec.special_type,
309 l_icr_rec.receipt_number,
310 l_icr_rec.pay_from_customer,
311 l_icr_rec.amount,
312 l_icr_rec.factor_discount_amount,
313 NULL, NULL );
314 --
315 -- Call update table handler
316 --
317 arp_cr_icr_pkg.update_p( l_icr_rec, l_icr_rec.cash_receipt_id );
318 --
319 -- Update batch table to set status
320 --
321 IF ( p_batch_id IS NOT NULL ) THEN
322 arp_rw_batches_check_pkg.update_batch_status( p_batch_id );
323 END IF;
324
325 IF PG_DEBUG in ('Y', 'C') THEN
326 arp_util.debug( 'arp_rw_icr_pkg.update_row()-' );
327 END IF;
328 --
329 EXCEPTION
330 WHEN OTHERS THEN
331 IF PG_DEBUG in ('Y', 'C') THEN
332 arp_util.debug( 'EXCEPTION: arp_rw_icr_pkg.update_row' );
333 END IF;
334 RAISE;
335 END update_row;
336 --
337 /*===========================================================================+
338 | PROCEDURE |
339 | validate_args_update_row |
340 | |
341 | DESCRIPTION |
342 | Validate arguments passed to update_row procedure |
343 | |
344 | SCOPE - PRIVATE |
345 | |
346 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE |
347 | arp_util.debug - debug procedure |
348 | |
349 | ARGUMENTS : IN: |
350 | p_receipt_number - Receipt Number |
351 | p_gl_date - GL Date |
352 | p_customer_id - Customer ID |
353 | p_receipt_amount - Receipt Amount |
354 | OUT: |
355 | |
356 | RETURNS : NONE |
357 | |
358 | NOTES - |
359 | |
360 | MODIFICATION HISTORY - Created by Ganesh Vaidee - 08/08/95 |
361 | |
362 +===========================================================================*/
363 PROCEDURE validate_args_update_row(
364 p_row_id IN VARCHAR2,
365 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
366 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
367 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
368 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
369 p_pay_from_customer IN
370 ar_interim_cash_receipts.pay_from_customer%TYPE,
371 p_site_use_id IN
372 ar_interim_cash_receipts.site_use_id%TYPE,
373 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
374 p_payment_schedule_id IN
375 ar_payment_schedules.payment_schedule_id%TYPE,
376 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
377 p_receipt_method_id IN
378 ar_interim_cash_receipts.receipt_method_id%TYPE,
379 p_remittance_bank_account_id IN
380 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE ) IS
381 BEGIN
382 IF PG_DEBUG in ('Y', 'C') THEN
383 arp_util.debug( 'arp_rw_icr_pkg.validate_args_update_row()+' );
384 END IF;
385 --
386 IF ( p_row_id IS NULL OR p_cr_id IS NULL OR
387 p_receipt_number IS NULL OR p_receipt_amount IS NULL OR
388 p_batch_id IS NULL OR p_remittance_bank_account_id IS NULL OR
389 p_receipt_method_id IS NULL ) THEN
390 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
391 APP_EXCEPTION.raise_exception;
392 END IF;
393 --
394 validate_special_type( p_special_type, p_pay_from_customer,
395 p_site_use_id, p_customer_trx_id,
396 p_payment_schedule_id );
397 --
398 IF PG_DEBUG in ('Y', 'C') THEN
399 arp_util.debug( 'arp_rw_icr_pkg.validate_args_update_row()-' );
400 END IF;
401 --
402 EXCEPTION
403 WHEN OTHERS THEN
404 IF PG_DEBUG in ('Y', 'C') THEN
405 arp_util.debug(
406 'EXCEPTION: arp_rw_icr_pkg.validate_args_update_row' );
407 END IF;
408 RAISE;
409 END validate_args_update_row;
410 --
411 /*===========================================================================+
412 | PROCEDURE |
413 | insert_row - Inserts a row into the QRC_ICR table after checking for|
414 | uniqueness |
415 | |
416 | DESCRIPTION |
417 | This function Inserts a row into the QRC_ICR table after checking for |
418 | uniqueness for items such of the receipt number |
419 | |
420 | SCOPE - PUBLIC |
421 | |
422 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
423 | arp_util.debug - debug procedure |
424 | |
425 | ARGUMENTS : IN: |
426 | p_receipt_number - Receipt Number |
427 | p_gl_date - GL Date |
428 | p_customer_id - Customer ID |
429 | p_receipt_amount - Receipt Amount |
430 | p_module_name - Module that called this procedure |
431 | p_module_version - Version of the module that called this |
432 | procedure |
433 | OUT: |
434 | p_row_id - Row ID |
435 | p_cr_id - Cash receipt Id |
436 | |
437 | RETURNS : NONE |
438 | |
439 | NOTES - This procedure calls the check_unique_receipt procedure |
440 | |
441 | MODIFICATION HISTORY - 08/08/95 - Created by Ganesh Vaidee |
442 | 10-21-96 OSTEINME Added new parameters p_factor_discount_amount|
443 | and p_customer_bank_account_id for Japan |
444 | project. |
445 | Also added new parameter |
446 | p_anticipated_clearing_date for bug 371373 |
447 | 10-28-96 OSTEINME added parameter customer_bank_branch_id |
448 | 10-28-98 K.Murphy Cross Currency Lockbox. Added amount_applied |
449 | and trans_to_receipt_rate as parameters and created|
450 | columns. |
451 | 05-01-02 D.Jancis Enh 2074220: added application notes |
452 | 12-24-02 K.Dhaliwal Bug 2707190 Added |
453 | application_ref_type,customer_reference and|
454 | customer_reason to update and insert |
455 | procedures. |
456 +===========================================================================*/
457 PROCEDURE insert_row(
458 p_row_id IN OUT NOCOPY VARCHAR2,
459 p_cr_id IN OUT NOCOPY ar_interim_cash_receipts.cash_receipt_id%TYPE,
460 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
461 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
462 p_currency_code IN ar_interim_cash_receipts.currency_code%TYPE,
463 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
464 p_amount_applied IN
465 ar_interim_cash_receipts.amount_applied%TYPE,
466 p_trans_to_receipt_rate IN
467 ar_interim_cash_receipts.trans_to_receipt_rate%TYPE,
468 p_factor_discount_amount
469 IN ar_interim_cash_receipts.factor_discount_amount%TYPE,
470 p_receipt_method_id IN
471 ar_interim_cash_receipts.receipt_method_id%TYPE,
472 p_remittance_bank_account_id IN
473 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE,
474 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
475 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
476 p_payment_schedule_id IN
477 ar_payment_schedules.payment_schedule_id%TYPE,
478 p_exchange_date IN ar_interim_cash_receipts.exchange_date%TYPE,
479 p_exchange_rate IN ar_interim_cash_receipts.exchange_rate%TYPE,
480 p_exchange_rate_type IN
481 ar_interim_cash_receipts.exchange_rate_type%TYPE,
482 p_gl_date IN ar_interim_cash_receipts.gl_date%TYPE,
483 p_anticipated_clearing_date IN
484 ar_interim_cash_receipts.anticipated_clearing_date%TYPE,
485 p_pay_from_customer IN
486 ar_interim_cash_receipts.pay_from_customer%TYPE,
487 p_customer_bank_account_id IN
488 ar_interim_cash_receipts.customer_bank_account_id%TYPE,
489 p_customer_bank_branch_id IN
490 ar_interim_cash_receipts.customer_bank_branch_id%TYPE,
491 p_receipt_date IN ar_interim_cash_receipts.receipt_date%TYPE,
492 p_site_use_id IN ar_interim_cash_receipts.site_use_id%TYPE,
493 p_ussgl_transaction_code IN
494 ar_interim_cash_receipts.ussgl_transaction_code%TYPE,
495 p_doc_sequence_id IN ar_interim_cash_receipts.doc_sequence_id%TYPE,
496 p_doc_sequence_value IN
497 ar_interim_cash_receipts.doc_sequence_value%TYPE,
498 p_attribute_category IN
499 ar_interim_cash_receipts.attribute_category%TYPE,
500 p_attribute1 IN ar_interim_cash_receipts.attribute1%TYPE,
501 p_attribute2 IN ar_interim_cash_receipts.attribute2%TYPE,
502 p_attribute3 IN ar_interim_cash_receipts.attribute3%TYPE,
503 p_attribute4 IN ar_interim_cash_receipts.attribute4%TYPE,
504 p_attribute5 IN ar_interim_cash_receipts.attribute5%TYPE,
505 p_attribute6 IN ar_interim_cash_receipts.attribute6%TYPE,
506 p_attribute7 IN ar_interim_cash_receipts.attribute7%TYPE,
507 p_attribute8 IN ar_interim_cash_receipts.attribute8%TYPE,
508 p_attribute9 IN ar_interim_cash_receipts.attribute9%TYPE,
509 p_attribute10 IN ar_interim_cash_receipts.attribute10%TYPE,
510 p_attribute11 IN ar_interim_cash_receipts.attribute11%TYPE,
511 p_attribute12 IN ar_interim_cash_receipts.attribute12%TYPE,
512 p_attribute13 IN ar_interim_cash_receipts.attribute13%TYPE,
513 p_attribute14 IN ar_interim_cash_receipts.attribute14%TYPE,
514 p_attribute15 IN ar_interim_cash_receipts.attribute15%TYPE,
515 p_application_notes IN
516 ar_interim_cash_receipts.application_notes%TYPE,
517 p_application_ref_type IN
518 ar_interim_cash_receipts.application_ref_type%TYPE,
519 p_customer_reference IN
520 ar_interim_cash_receipts.customer_reference%TYPE,
521 p_customer_reason IN ar_interim_cash_receipts.customer_reason%TYPE,
522 p_automatch_set_id IN ar_interim_cash_receipts.automatch_set_id%TYPE,
523 p_autoapply_flag IN ar_interim_cash_receipts.autoapply_flag%TYPE,
524 p_module_name IN VARCHAR2,
525 p_module_version IN VARCHAR2 ) IS
526 --
527 l_row_id VARCHAR2(30);
528 l_cr_id ar_interim_cash_receipts.cash_receipt_id%TYPE;
529 l_icr_rec ar_interim_cash_receipts%ROWTYPE;
530 --
531 BEGIN
532 IF PG_DEBUG in ('Y', 'C') THEN
533 arp_util.debug( 'arp_rw_icr_pkg.insert_row()+' );
534 arp_util.debug( 'Special Type : '||p_special_type );
535 arp_util.debug( 'Receipt Number : '||p_receipt_number );
536 arp_util.debug( 'Receipt Date : '||TO_CHAR( p_receipt_date ) );
537 arp_util.debug( 'GL Date : '||TO_CHAR( p_gl_date ) );
538 arp_util.debug( 'Received Amount : '||TO_CHAR( p_receipt_amount ) );
539 arp_util.debug( 'Amount Applied : '||TO_CHAR( p_amount_applied ) );
540 arp_util.debug( 'Cross Currency Rate: '||TO_CHAR( p_trans_to_receipt_rate) );
541 arp_util.debug( 'Bank Charges : '||TO_CHAR( p_factor_discount_amount ));
542 arp_util.debug( 'currency_code : '||p_currency_code );
543 arp_util.debug( 'Method Id : '||p_receipt_method_id );
544 arp_util.debug( 'Bank Account Id : '||p_remittance_bank_account_id );
545 arp_util.debug( 'Receipt Amount : '||p_receipt_amount );
546 arp_util.debug( 'Batch Id : '||p_batch_id );
547 arp_util.debug( 'Pay From Customer : '||p_pay_from_customer );
548 arp_util.debug( 'Cust Bank Acct ID : '||p_customer_bank_account_id );
549 arp_util.debug( 'Cust Bank Branch ID : '||p_customer_bank_branch_id );
550 arp_util.debug( 'Site Use ID : '||p_site_use_id );
551 arp_util.debug( 'Automatch set id : '|| p_automatch_set_id );
552 arp_util.debug( 'Autoapply flag: ' || p_autoapply_flag);
553 END IF;
554 --
555 l_icr_rec.amount := p_receipt_amount;
556 l_icr_rec.amount_applied := p_amount_applied;
557 l_icr_rec.trans_to_receipt_rate := p_trans_to_receipt_rate;
558 l_icr_rec.factor_discount_amount := p_factor_discount_amount;
559 l_icr_rec.currency_code := p_currency_code;
560 l_icr_rec.receipt_method_id := p_receipt_method_id;
561 l_icr_rec.remit_bank_acct_use_id := p_remittance_bank_account_id;
562 l_icr_rec.batch_id := p_batch_id;
563 l_icr_rec.customer_trx_id := p_customer_trx_id;
564 l_icr_rec.exchange_date := p_exchange_date;
565 l_icr_rec.exchange_rate := p_exchange_rate;
566 l_icr_rec.exchange_rate_type := p_exchange_rate_type;
567 l_icr_rec.gl_date := p_gl_date;
568 l_icr_rec.payment_schedule_id := p_payment_schedule_id;
569 l_icr_rec.pay_from_customer := p_pay_from_customer;
570 l_icr_rec.customer_bank_account_id := p_customer_bank_account_id;
571 l_icr_rec.customer_bank_branch_id := p_customer_bank_branch_id;
572 l_icr_rec.receipt_date := p_receipt_date;
573 l_icr_rec.anticipated_clearing_date := p_anticipated_clearing_date;
574 l_icr_rec.receipt_number := p_receipt_number;
575 l_icr_rec.site_use_id := p_site_use_id;
576 l_icr_rec.special_type := p_special_type;
577 --
578 l_icr_rec.status := 'UNAPP';
579 l_icr_rec.type := 'CASH';
580 --
581 l_icr_rec.ussgl_transaction_code := p_ussgl_transaction_code;
582 l_icr_rec.attribute_category := p_attribute_category;
583 l_icr_rec.attribute1 := p_attribute1;
584 l_icr_rec.attribute2 := p_attribute2;
585 l_icr_rec.attribute3 := p_attribute3;
586 l_icr_rec.attribute4 := p_attribute4;
587 l_icr_rec.attribute5 := p_attribute5;
588 l_icr_rec.attribute6 := p_attribute6;
589 l_icr_rec.attribute7 := p_attribute7;
590 l_icr_rec.attribute8 := p_attribute8;
591 l_icr_rec.attribute9 := p_attribute9;
592 l_icr_rec.attribute10 := p_attribute10;
593 l_icr_rec.attribute11 := p_attribute11;
594 l_icr_rec.attribute12 := p_attribute12;
595 l_icr_rec.attribute13 := p_attribute13;
596 l_icr_rec.attribute14 := p_attribute14;
597 l_icr_rec.attribute15 := p_attribute15;
598 l_icr_rec.doc_sequence_id := p_doc_sequence_id;
599 l_icr_rec.doc_sequence_value := p_doc_sequence_value;
600
601 --
602 -- enh 2074220
603 --
604 l_icr_rec.application_notes := p_application_notes;
605
606 --
607 -- Bug 2707190 Deductions Enhancement
608 --
609
610 l_icr_rec.application_ref_type := p_application_ref_type;
611 l_icr_rec.customer_reference := p_customer_reference;
612 l_icr_rec.customer_reason := p_customer_reason;
613 l_icr_rec.automatch_set_id := p_automatch_set_id;
614 l_icr_rec.autoapply_flag := p_autoapply_flag;
615
616 --
617 -- Validate arguments
618 --
619 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
620 validate_args_insert_row( p_row_id, p_cr_id,
621 l_icr_rec.special_type,
622 l_icr_rec.receipt_number,
623 l_icr_rec.receipt_date,
624 l_icr_rec.gl_date,
625 l_icr_rec.batch_id,
626 l_icr_rec.pay_from_customer,
627 l_icr_rec.site_use_id,
628 l_icr_rec.customer_trx_id,
629 l_icr_rec.payment_schedule_id,
630 l_icr_rec.currency_code,
631 l_icr_rec.amount,
632 l_icr_rec.receipt_method_id,
633 l_icr_rec.remit_bank_acct_use_id );
634 END IF;
635 --
636 --
637 -- Call Check Unique Batch Name procedure
638 --
639 arp_rw_icr_pkg.check_unique_receipt( l_row_id, l_cr_id,
640 l_icr_rec.special_type,
641 l_icr_rec.receipt_number,
642 l_icr_rec.pay_from_customer,
643 l_icr_rec.amount,
644 l_icr_rec.factor_discount_amount,
645 NULL, NULL );
646 --
647 -- Check for valid GL date
648 --
649 arp_util.validate_gl_date( l_icr_rec.gl_date, NULL,
650 NULL );
651
652
653 -- Do the actual Insertion
654 --
655 arp_cr_icr_pkg.insert_p( l_row_id, l_cr_id, l_icr_rec );
656 --
657 p_row_id := l_row_id;
658 p_cr_id := l_cr_id;
659
660 --
661 -- Update batch table to set status
662 --
663
664 IF PG_DEBUG in ('Y', 'C') THEN
665 arp_util.debug( 'Batch ID is : '|| l_icr_rec.batch_id );
666 END IF;
667
668 arp_rw_batches_check_pkg.update_batch_status( l_icr_rec.batch_id );
669
670
671 --
672 IF PG_DEBUG in ('Y', 'C') THEN
673 arp_util.debug( 'arp_rw_icr_pkg.insert_row()-' );
674 END IF;
675 --
676 EXCEPTION
677 WHEN OTHERS THEN
678 IF PG_DEBUG in ('Y', 'C') THEN
679 arp_util.debug( 'EXCEPTION: arp_rw_icr_pkg.insert_row' );
680 END IF;
681 RAISE;
682 END insert_row;
683 --
684 /*===========================================================================+
685 | PROCEDURE |
686 | validate_args_insert_row |
687 | |
688 | DESCRIPTION |
689 | Validate arguments passed to insert_row procedure |
690 | |
691 | SCOPE - PRIVATE |
692 | |
693 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE |
694 | arp_util.debug - debug procedure |
695 | |
696 | ARGUMENTS : IN: |
697 | p_receipt_number - Receipt Number |
698 | p_gl_date - GL Date |
699 | p_pay_from_customer - Customer ID |
700 | p_receipt_amount - Receipt Amount |
701 | OUT: |
702 | |
703 | RETURNS : NONE |
704 | |
705 | NOTES - |
706 | |
707 | MODIFICATION HISTORY - Created by Ganesh Vaidee - 08/08/95 |
708 | |
709 +===========================================================================*/
710 PROCEDURE validate_args_insert_row(
711 p_row_id IN VARCHAR2,
712 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
713 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
714 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
715 p_receipt_date IN ar_interim_cash_receipts.receipt_date%TYPE,
716 p_gl_date IN ar_interim_cash_receipts.gl_date%TYPE,
717 p_batch_id IN ar_interim_cash_receipts.batch_id%TYPE,
718 p_pay_from_customer IN
719 ar_interim_cash_receipts.pay_from_customer%TYPE,
720 p_site_use_id IN
721 ar_interim_cash_receipts.site_use_id%TYPE,
722 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
723 p_payment_schedule_id IN
724 ar_payment_schedules.payment_schedule_id%TYPE,
725 p_currency_code IN ar_interim_cash_receipts.currency_code%TYPE,
726 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
727 p_receipt_method_id IN
728 ar_interim_cash_receipts.receipt_method_id%TYPE,
729 p_remittance_bank_account_id IN
730 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE ) IS
731 BEGIN
732 IF PG_DEBUG in ('Y', 'C') THEN
733 arp_util.debug( 'arp_rw_icr_pkg.validate_args_insert_row()+' );
734 END IF;
735 --
736 IF ( p_row_id IS NOT NULL OR p_cr_id IS NOT NULL ) THEN
737 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
738 APP_EXCEPTION.raise_exception;
739 END IF;
740 --
741 IF ( p_receipt_date IS NULL OR p_gl_date IS NULL OR
742 p_receipt_number IS NULL OR p_receipt_amount IS NULL OR
743 p_batch_id IS NULL OR p_currency_code IS NULL OR
744 p_remittance_bank_account_id IS NULL OR
745 p_receipt_method_id IS NULL ) THEN
746 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
747 APP_EXCEPTION.raise_exception;
748 END IF;
749 --
750 validate_special_type( p_special_type, p_pay_from_customer,
751 p_site_use_id, p_customer_trx_id,
752 p_payment_schedule_id );
753 --
754 IF PG_DEBUG in ('Y', 'C') THEN
755 arp_util.debug( 'arp_rw_icr_pkg.validate_args_insert_row()-' );
756 END IF;
757 --
758 EXCEPTION
759 WHEN OTHERS THEN
760 IF PG_DEBUG in ('Y', 'C') THEN
761 arp_util.debug(
762 'EXCEPTION: arp_rw_icr_pkg.validate_args_insert_row' );
763 END IF;
764 RAISE;
765 END validate_args_insert_row;
766 --
767 /*===========================================================================+
768 | PROCEDURE |
769 | validate_special_type |
770 | |
771 | DESCRIPTION |
772 | Validate special type and related fields |
773 | |
774 | SCOPE - PRIVATE |
775 | |
776 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE |
777 | arp_util.debug - debug procedure |
778 | |
779 | ARGUMENTS : IN: |
780 | p_special_type - Type of the receipt |
781 | pay_from_custmer - Customer Id |
782 | Site_use_id - Billing lication Id |
783 | Customer_trx_id - Transaction Id |
784 | Payment_schedule_id - PS ID |
785 | OUT: |
786 | |
787 | RETURNS : NONE |
788 | |
789 | NOTES - |
790 | |
791 | MODIFICATION HISTORY - Created by Ganesh Vaidee - 08/08/95 |
792 | Modified by Shintaro Okuda - 07/23/97 |
793 | Bug fix for 510395: |
794 | Evaluation of site_required_flag is added |
795 | in p_site_use_id validation. |
796 | |
797 +===========================================================================*/
798 PROCEDURE validate_special_type(
799 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
800 p_pay_from_customer IN
801 ar_interim_cash_receipts.pay_from_customer%TYPE,
802 p_site_use_id IN
803 ar_interim_cash_receipts.site_use_id%TYPE,
804 p_customer_trx_id IN ar_interim_cash_receipts.customer_trx_id%TYPE,
805 p_payment_schedule_id IN
806 ar_payment_schedules.payment_schedule_id%TYPE ) IS
807 BEGIN
808 --
809 -- If no special type entered, then transaction details should exist
810 --
811 IF ( p_special_type IS NULL ) THEN
812 IF ( p_customer_trx_id IS NULL OR p_pay_from_customer IS NULL OR
813 p_site_use_id IS NULL OR p_payment_schedule_id IS NULL ) THEN
814 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
815 APP_EXCEPTION.raise_exception;
816 END IF;
817 ELSIF ( p_special_type = 'UNIDENTIFIED' ) THEN
818 IF ( p_pay_from_customer IS NOT NULL OR p_site_use_id IS NOT NULL ) THEN
819 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
820 APP_EXCEPTION.raise_exception;
821 END IF;
822 ELSE
823 IF ( p_pay_from_customer IS NULL OR
824 (arp_global.sysparam.site_required_flag = 'Y' AND
825 p_site_use_id IS NULL )) THEN
826 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
827 APP_EXCEPTION.raise_exception;
828 END IF;
829 END IF;
830 END validate_special_type;
831
832 /*===========================================================================+
833 | PROCEDURE |
834 | get_applied_amount_total - Get the total of applied amounts from |
835 | ICR_LINES |
836 | |
837 | DESCRIPTION |
838 | Get the total of applied amounts if the special type of the Quick |
839 | Receipt is 'MULTIPLE' |
840 | |
841 | SCOPE - PUBLIC |
842 | |
843 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
844 | arp_util.debug - debug procedure |
845 | |
846 | ARGUMENTS : IN: |
847 | p_cr_id - Interim Cash reveipt ID |
848 | p_module_name - Module that called this procedure |
849 | p_module_version - Version of the module that called this |
850 | procedure |
851 | OUT: |
852 | p_applied_amount_total - Output applied amount total |
853 | |
854 | RETURNS : NONE |
855 | |
856 | NOTES - |
857 | |
858 | MODIFICATION HISTORY - 07/12/95 - Created by Ganesh Vaidee |
859 | 10/14/1998 K.Murphy Cross Currency Lockbox. |
860 | Modified selection of the total applied |
861 | amount. This needs to consider the amount |
862 | applied from which will hold the amount in |
863 | receipt currency for cross currency apps. |
864 +===========================================================================*/
865 PROCEDURE get_applied_amount_total(
866 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
867 p_applied_amount_total OUT NOCOPY ar_interim_cash_receipts.amount%TYPE,
868 p_applied_count_total OUT NOCOPY NUMBER,
869 p_module_name IN VARCHAR2,
870 p_module_version IN VARCHAR2 ) IS
871 BEGIN
872 IF PG_DEBUG in ('Y', 'C') THEN
873 arp_util.debug( 'arp_rw_icr_pkg.get_applied_amount_total()+' );
874 arp_util.debug('get_applied_amount_total: ' || 'Icr Id : '||p_cr_id );
875 END IF;
876 --
877 -- Validate args.
878 --
879 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
880 val_args_applied_amount_total( p_cr_id );
881 END IF;
882 --
883 SELECT sum(nvl(amount_applied_from, nvl(payment_amount,0))), count(*)
884 INTO p_applied_amount_total,
885 p_applied_count_total
886 FROM ar_interim_cash_receipt_lines
887 WHERE cash_receipt_id = p_cr_id;
888 --
889 IF PG_DEBUG in ('Y', 'C') THEN
890 arp_util.debug( 'arp_rw_icr_pkg.get_applied_amount_total()-' );
891 END IF;
892 --
893 EXCEPTION
894 WHEN OTHERS THEN
895 IF PG_DEBUG in ('Y', 'C') THEN
896 arp_util.debug('get_applied_amount_total: ' ||
897 'EXCEPTION: arp_rw_icr_pkg.get_applied_amount_total' );
898 END IF;
899 RAISE;
900 END get_applied_amount_total;
901 --
902 /*===========================================================================+
903 | PROCEDURE |
904 | val_args_applied_amount_total |
905 | |
906 | DESCRIPTION |
907 | Validate arguments passed to get_applied_amount_total procedure |
908 | |
909 | SCOPE - PRIVATE |
910 | |
911 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE |
912 | arp_util.debug - debug procedure |
913 | |
914 | ARGUMENTS : IN: |
915 | p_cr_id - ICR_ID |
916 | OUT: |
917 | |
918 | RETURNS : NONE |
919 | |
920 | NOTES - |
921 | |
922 | MODIFICATION HISTORY - Created by Ganesh Vaidee - 08/08/95 |
923 | |
924 +===========================================================================*/
925 PROCEDURE val_args_applied_amount_total(
926 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE ) IS
927 BEGIN
928 IF PG_DEBUG in ('Y', 'C') THEN
929 arp_util.debug( 'arp_rw_icr_pkg.val_args_applied_amount_total()+' );
930 END IF;
931 --
932 IF ( p_cr_id is NULL ) THEN
933 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
934 APP_EXCEPTION.raise_exception;
935 END IF;
936 --
937 IF PG_DEBUG in ('Y', 'C') THEN
938 arp_util.debug( 'arp_rw_icr_pkg.val_args_applied_amount_total()-' );
939 END IF;
940 --
941 EXCEPTION
942 WHEN OTHERS THEN
943 IF PG_DEBUG in ('Y', 'C') THEN
944 arp_util.debug('val_args_applied_amount_total: ' ||
945 'EXCEPTION: arp_rw_icr_pkg.val_args_applied_amount_total' );
946 END IF;
947 RAISE;
948 END val_args_applied_amount_total;
949 --
950 /*===========================================================================+
951 | PROCEDURE |
952 | check_unique_receipt - Check that the entered receipt is unique |
953 | |
954 | DESCRIPTION |
955 | Check that the entered receipt is unique |
956 | |
957 | SCOPE - PUBLIC |
958 | |
959 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
960 | arp_util.debug - debug procedure |
961 | |
962 | ARGUMENTS : IN: |
963 | p_cr_id - Cash receipt Id |
964 | p_receipt_number - Receipt Number |
965 | p_customer_id - Customer ID |
966 | p_receipt_amount - Receipt Amount |
967 | p_module_name - Module that called this procedure |
968 | p_module_version - Version of the module that called this |
969 | procedure |
970 | |
971 | RETURNS : NONE |
972 | |
973 | NOTES - |
974 | |
975 | MODIFICATION HISTORY - 08/08/95 - Created by Ganesh Vaidee |
976 | |
977 +===========================================================================*/
978 PROCEDURE check_unique_receipt(
979 p_row_id IN VARCHAR2,
980 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
981 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
982 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
983 p_customer_id IN hz_cust_accounts.cust_account_id%TYPE,
984 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE,
985 p_factor_discount_amount
986 IN ar_interim_cash_receipts.factor_discount_amount%TYPE,
987 p_module_name IN VARCHAR2,
988 p_module_version IN VARCHAR2 ) IS
989 l_count NUMBER := 0;
990 BEGIN
991 IF PG_DEBUG in ('Y', 'C') THEN
992 arp_util.debug( 'arp_rw_icr_pkg.check_unique_receipt()+' );
993 arp_util.debug( 'Row Id : '||p_row_id );
994 arp_util.debug( 'Icr Id : '||p_cr_id );
995 arp_util.debug( 'Receipt Number : '||p_receipt_number );
996 arp_util.debug( 'Customer ID : '||p_customer_id );
997 arp_util.debug( 'Receipt Amount : '||p_receipt_amount );
998 END IF;
999 --
1000 -- Validate args. Note: Cash Receipt Id can be null
1001 --
1002 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
1003 val_args_check_unique_receipt( p_special_type,
1004 p_receipt_number, p_customer_id,
1005 p_receipt_amount );
1006 END IF;
1007 --
1008 -- Check ICR table to see if the receipt exists
1009 --
1010 SELECT COUNT(*)
1011 INTO l_count
1012 FROM ar_interim_cash_receipts icr
1013 WHERE ( p_row_id IS NULL
1014 OR icr.rowid <> p_row_id )
1015 AND ( p_cr_id IS NULL
1016 OR icr.cash_receipt_id <> p_cr_id )
1017 AND icr.receipt_number = p_receipt_number
1018 AND icr.pay_from_customer = p_customer_id
1019 AND icr.amount = p_receipt_amount
1020 AND icr.factor_discount_amount = p_factor_discount_amount;
1021 --
1022 IF ( l_count <> 0 ) THEN
1023 FND_MESSAGE.set_name( 'AR', 'AR_DUP_PYMNT' );
1024 APP_EXCEPTION.raise_exception;
1025 END IF;
1026 l_count := 0;
1027 --
1028 -- Check Cash Receipts table to see if the receipt exists
1029 --
1030 SELECT COUNT(*)
1031 INTO l_count
1032 FROM ar_cash_receipts cr
1033 WHERE ( p_cr_id IS NULL
1034 OR cr.cash_receipt_id <> p_cr_id )
1035 AND cr.receipt_number = p_receipt_number
1036 AND cr.pay_from_customer = p_customer_id
1037 AND cr.amount = p_receipt_amount+p_factor_discount_amount
1038 AND cr.reversal_category IS NULL;
1039 IF ( l_count <> 0 ) THEN
1040 FND_MESSAGE.set_name( 'AR', 'AR_DUP_PYMNT' );
1041 APP_EXCEPTION.raise_exception;
1042 END IF;
1043 --
1044 IF PG_DEBUG in ('Y', 'C') THEN
1045 arp_util.debug( 'arp_rw_icr_pkg.check_unique_receipt()-' );
1046 END IF;
1047 --
1048 EXCEPTION
1049 WHEN OTHERS THEN
1050 IF PG_DEBUG in ('Y', 'C') THEN
1051 arp_util.debug(
1052 'EXCEPTION: arp_rw_icr_pkg.check_unique_receipt' );
1053 END IF;
1054 RAISE;
1055 END check_unique_receipt;
1056 --
1057 /*===========================================================================+
1058 | PROCEDURE |
1059 | val_args_check_unique_receipt |
1060 | |
1061 | DESCRIPTION |
1062 | Validate arguments passed to check_unique_receipt procedure |
1063 | |
1064 | SCOPE - PRIVATE |
1065 | |
1066 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE |
1067 | arp_util.debug - debug procedure |
1068 | |
1069 | ARGUMENTS : IN: |
1070 | p_receipt_number - Receipt Number |
1071 | p_customer_id - Customer ID |
1072 | p_receipt_amount - Receipt Amount |
1073 | OUT: |
1074 | |
1075 | RETURNS : NONE |
1076 | |
1077 | NOTES - |
1078 | |
1079 | MODIFICATION HISTORY - Created by Ganesh Vaidee - 08/08/95 |
1080 | |
1081 +===========================================================================*/
1082 PROCEDURE val_args_check_unique_receipt(
1083 p_special_type IN ar_interim_cash_receipts.special_type%TYPE,
1084 p_receipt_number IN ar_interim_cash_receipts.receipt_number%TYPE,
1085 p_customer_id IN hz_cust_accounts.cust_account_id%TYPE,
1086 p_receipt_amount IN ar_interim_cash_receipts.amount%TYPE ) IS
1087 BEGIN
1088 IF PG_DEBUG in ('Y', 'C') THEN
1089 arp_util.debug( 'arp_rw_icr_pkg.val_args_check_unique_receipt()+' );
1090 END IF;
1091 --
1092 --
1093 -- Note: Special type can be NULL
1094 --
1095 IF ( p_receipt_number is NULL OR p_receipt_amount IS NULL ) THEN
1096 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
1097 APP_EXCEPTION.raise_exception;
1098 END IF;
1099 --
1100 IF( ( p_special_type <> 'UNIDENTIFIED' ) AND
1101 ( p_customer_id IS NULL ) ) THEN
1102 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
1103 APP_EXCEPTION.raise_exception;
1104 END IF;
1105 IF PG_DEBUG in ('Y', 'C') THEN
1106 arp_util.debug( 'arp_rw_icr_pkg.val_args_check_unique_receipt()-' );
1107 END IF;
1108 --
1109 EXCEPTION
1110 WHEN OTHERS THEN
1111 IF PG_DEBUG in ('Y', 'C') THEN
1112 arp_util.debug('val_args_check_unique_receipt: ' ||
1113 'EXCEPTION: arp_rw_icr_pkg.val_args_check_unique_receipt' );
1114 END IF;
1115 RAISE;
1116 END val_args_check_unique_receipt;
1117 --
1118 /*===========================================================================+
1119 | FUNCTION |
1120 | lines_exists - - Check if lines exist for the given Cash Receipt |
1121 | ID. |
1122 | |
1123 | DESCRIPTION |
1124 | Check if rows exists in ICR table for the given cash receipt id
1125 | |
1126 | SCOPE - PUBLIC |
1127 | |
1128 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
1129 | arp_util.debug - debug procedure |
1130 | |
1131 | ARGUMENTS : IN: |
1132 | p_cr_id - Cash receipt Id |
1133 | p_module_name - Module that called this procedure |
1134 | p_module_version - Version of the module that called this |
1135 | procedure |
1136 | |
1137 | RETURNS : BOOLEAN - True If lines exists, else false
1138 | |
1139 | NOTES - |
1140 | |
1141 | MODIFICATION HISTORY - 08/09/95 - Created by Ganesh Vaidee |
1142 | |
1143 +===========================================================================*/
1144 FUNCTION lines_exists(
1145 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
1146 p_module_name IN VARCHAR2,
1147 p_module_version IN VARCHAR2 ) RETURN BOOLEAN IS
1148 l_count NUMBER;
1149 BEGIN
1150 --
1151 IF PG_DEBUG in ('Y', 'C') THEN
1152 arp_util.debug( 'arp_rw_icr_pkg.lines_exists()+' );
1153 END IF;
1154 --
1155 -- Do argument validation, Note: No separate procedure used
1156 --
1157 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
1158 IF ( p_cr_id is NULL ) THEN
1159 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
1160 APP_EXCEPTION.raise_exception;
1161 END IF;
1162 END IF;
1163 --
1164 SELECT count(*)
1165 INTO l_count
1166 FROM ar_interim_cash_receipt_lines icr
1167 WHERE icr.cash_receipt_id = p_cr_id;
1168 --
1169 IF ( l_count = 0 ) THEN
1170 RETURN FALSE;
1171 ELSE
1172 RETURN TRUE;
1173 END IF;
1174 --
1175 IF PG_DEBUG in ('Y', 'C') THEN
1176 arp_util.debug( 'arp_rw_icr_pkg.lines_exists()-' );
1177 END IF;
1178 --
1179 EXCEPTION
1180 WHEN OTHERS THEN
1181 IF PG_DEBUG in ('Y', 'C') THEN
1182 arp_util.debug('lines_exists: ' ||
1183 'EXCEPTION: arp_rw_icr_pkg.lines_exists' );
1184 END IF;
1185 RAISE;
1186 END lines_exists;
1187 --
1188 /*===========================================================================+
1189 | PROCEDURE |
1190 | check_no_lines_exists- Check if lines exist for the given Cash Receipt |
1191 | ID. |
1192 | |
1193 | DESCRIPTION |
1194 | Check if rows exists in ICR table for the given cash receipt id
1195 | |
1196 | SCOPE - PUBLIC |
1197 | |
1198 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
1199 | arp_util.debug - debug procedure |
1200 | |
1201 | ARGUMENTS : IN: |
1202 | p_cr_id - Cash receipt Id |
1203 | p_module_name - Module that called this procedure |
1204 | p_module_version - Version of the module that called this |
1205 | procedure |
1206 | |
1207 | RETURNS : NONE
1208 | |
1209 | NOTES - |
1210 | |
1211 | MODIFICATION HISTORY - 08/09/95 - Created by Ganesh Vaidee |
1212 | |
1213 +===========================================================================*/
1214 PROCEDURE check_no_lines_exists (
1215 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
1216 p_module_name IN VARCHAR2,
1217 p_module_version IN VARCHAR2 ) IS
1218 BEGIN
1219 IF PG_DEBUG in ('Y', 'C') THEN
1220 arp_util.debug( 'arp_rw_icr_pkg.check_no_lines_exists()-' );
1221 END IF;
1222 --
1223 -- Do argument validation, Note: No separate procedure used
1224 --
1225 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
1226 IF ( p_cr_id is NULL ) THEN
1227 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
1228 APP_EXCEPTION.raise_exception;
1229 END IF;
1230 END IF;
1231 --
1232 IF ( arp_rw_icr_pkg.lines_exists( p_cr_id, NULL, NULL ) = TRUE ) THEN
1233 FND_MESSAGE.set_name( 'AR', 'AR_UPDNA_APP_TYPE' );
1234 APP_EXCEPTION.raise_exception;
1235 END IF;
1236 --
1237 IF PG_DEBUG in ('Y', 'C') THEN
1238 arp_util.debug( 'arp_rw_icr_pkg.check_no_lines_exists()-' );
1239 END IF;
1240 --
1241 EXCEPTION
1242 WHEN OTHERS THEN
1243 IF PG_DEBUG in ('Y', 'C') THEN
1244 arp_util.debug('check_no_lines_exists: ' ||
1245 'EXCEPTION: arp_rw_icr_pkg.check_no_lines_exists' );
1246 END IF;
1247 RAISE;
1248 END check_no_lines_exists;
1249 --
1250 /*===========================================================================+
1251 | PROCEDURE |
1252 | update_bank_account_uses - Update ap_bank_account_uses table |
1253 | |
1254 | DESCRIPTION |
1255 | Update ap_bank_account_uses table with passed in customer_id |
1256 | |
1257 | SCOPE - PRIVATE |
1258 | |
1259 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
1260 | arp_util.debug - debug procedure |
1261 | |
1262 | ARGUMENTS : IN: |
1263 | p_customer_id - customer id |
1264 | p_bank_account_id - bank_account Id |
1265 | |
1266 | RETURNS : NONE |
1267 | |
1268 | NOTES - This procedure will be called by update_row procedure |
1269 | |
1270 | MODIFICATION HISTORY - 08/09/95 - Created by Ganesh Vaidee |
1271 | |
1272 +===========================================================================*/
1273 PROCEDURE update_bank_account_uses(
1274 p_customer_id IN hz_cust_accounts.cust_account_id%TYPE,
1275 p_bank_account_id IN ar_batches.remit_bank_acct_use_id%TYPE ) IS
1276 BEGIN
1277 IF PG_DEBUG in ('Y', 'C') THEN
1278 arp_util.debug( 'arp_rw_icr_pkg.update_bank_account_uses()+' );
1279 arp_util.debug('update_bank_account_uses: ' || 'Customer ID : '||p_customer_id );
1280 arp_util.debug('update_bank_account_uses: ' || 'Bank Account Id : '||p_bank_account_id );
1281 END IF;
1282 --
1283 IF PG_DEBUG in ('Y', 'C') THEN
1284 arp_util.debug( 'arp_rw_icr_pkg.update_bank_account_uses()-' );
1285 END IF;
1286 --
1287 END update_bank_account_uses;
1288 --
1289 /*===========================================================================+
1290 | PROCEDURE |
1291 | delete_row - Deletes a row from the QRC_ICR table |
1292 | |
1293 | |
1294 | DESCRIPTION |
1295 | This function deletes a row from AR_INTERIM_CASH_RECEIPTS. |
1296 | |
1297 | |
1298 | SCOPE - PUBLIC |
1299 | |
1300 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
1301 | arp_util.debug - debug procedure |
1302 | |
1303 | ARGUMENTS : IN: |
1304 | p_cr_id - Cash Receipt ID |
1305 | p_row_id - Row Id |
1306 | p_module_name - Module that called this procedure |
1307 | p_module_version - Version of the module that called this |
1308 | procedure |
1309 | OUT: |
1310 | |
1311 | RETURNS : NONE |
1312 | |
1313 | NOTES - |
1314 | |
1315 | MODIFICATION HISTORY - 08/08/95 - Created by Ganesh Vaidee |
1316 | 10-21-96 OSTEINME updated comments |
1317 +===========================================================================*/
1318 PROCEDURE delete_row(
1319 p_row_id IN VARCHAR2,
1320 p_cr_id IN ar_interim_cash_receipts.cash_receipt_id%TYPE,
1321 p_module_name IN VARCHAR2,
1322 p_module_version IN VARCHAR2 ) IS
1323 BEGIN
1324 IF PG_DEBUG in ('Y', 'C') THEN
1325 arp_util.debug( 'arp_rw_icr_pkg.delete_row()+' );
1326 END IF;
1327 --
1328 IF ( p_module_name IS NOT NULL AND p_module_version IS NOT NULL ) THEN
1329 IF ( p_cr_id is NULL OR p_row_id IS NULL ) THEN
1330 FND_MESSAGE.set_name ('AR', 'AR_ARGUEMENTS_FAIL' );
1331 APP_EXCEPTION.raise_exception;
1332 END IF;
1333 END IF;
1334 --
1335 -- Call delete table handler, first delete all lines
1336 --
1337 arp_cr_icr_lines_pkg.delete_fk( p_cr_id );
1338 arp_cr_icr_pkg.delete_p( p_cr_id );
1339 --
1340 IF PG_DEBUG in ('Y', 'C') THEN
1341 arp_util.debug( 'arp_rw_icr_pkg.delete_row()-' );
1342 END IF;
1343 --
1344 EXCEPTION
1345 WHEN OTHERS THEN
1346 IF PG_DEBUG in ('Y', 'C') THEN
1347 arp_util.debug('delete_row: ' ||
1348 'EXCEPTION: arp_rw_icr_pkg.delete_row' );
1349 END IF;
1350 RAISE;
1351 END delete_row;
1352 --
1353 /*===========================================================================+
1354 | PROCEDURE |
1355 | lock_row - Lock a row in the AR_ICR table |
1356 | |
1357 | DESCRIPTION |
1358 | |
1359 | SCOPE - PUBLIC |
1360 | |
1361 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED |
1362 | |
1363 | ARGUMENTS : IN: |
1364 | OUT: |
1365 | |
1366 | RETURNS : NONE |
1367 | |
1368 | NOTES - This procedure calls the check_unique_receipt procedure |
1369 | |
1370 | MODIFICATION HISTORY - 08/08/95 - Created by Ganesh Vaidee |
1371 | |
1372 | 10-21-96 OSTEINME Added new parameters p_factor_discount_amount|
1373 | and p_customer_bank_account_id for Japan |
1374 | project. |
1375 | Also added new parameter |
1376 | p_anticipated_clearing_date for bug 371373 |
1377 | 10-28-96 OSTEINME added new parameter customer_bank_branch_id |
1378 +===========================================================================*/
1379 PROCEDURE lock_row(
1380 p_row_id VARCHAR2,
1381 p_cr_id ar_interim_cash_receipts.cash_receipt_id%TYPE,
1382 p_special_type ar_interim_cash_receipts.special_type%TYPE,
1383 p_receipt_number ar_interim_cash_receipts.receipt_number%TYPE,
1384 p_currency_code ar_interim_cash_receipts.currency_code%TYPE,
1385 p_receipt_amount ar_interim_cash_receipts.amount%TYPE,
1386 p_factor_discount_amount IN
1387 ar_interim_cash_receipts.factor_discount_amount%TYPE,
1388 p_receipt_method_id
1389 ar_interim_cash_receipts.receipt_method_id%TYPE,
1390 p_remittance_bank_account_id
1391 ar_interim_cash_receipts.remit_bank_acct_use_id%TYPE,
1392 p_batch_id ar_interim_cash_receipts.batch_id%TYPE,
1393 p_customer_trx_id ar_interim_cash_receipts.customer_trx_id%TYPE,
1394 p_payment_schedule_id
1395 ar_payment_schedules.payment_schedule_id%TYPE,
1396 p_exchange_date ar_interim_cash_receipts.exchange_date%TYPE,
1397 p_exchange_rate ar_interim_cash_receipts.exchange_rate%TYPE,
1398 p_exchange_rate_type
1399 ar_interim_cash_receipts.exchange_rate_type%TYPE,
1400 p_gl_date IN
1401 ar_interim_cash_receipts.gl_date%TYPE,
1402 p_anticipated_clearing_date IN
1403 ar_interim_cash_receipts.anticipated_clearing_date%TYPE,
1404 p_pay_from_customer
1405 ar_interim_cash_receipts.pay_from_customer%TYPE,
1406 p_customer_bank_account_id IN
1407 ar_interim_cash_receipts.customer_bank_account_id%TYPE,
1408 p_customer_bank_branch_id IN
1409 ar_interim_cash_receipts.customer_bank_branch_id%TYPE,
1410 p_receipt_date ar_interim_cash_receipts.receipt_date%TYPE,
1411 p_site_use_id ar_interim_cash_receipts.site_use_id%TYPE,
1412 p_ussgl_transaction_code
1413 ar_interim_cash_receipts.ussgl_transaction_code%TYPE,
1414 p_doc_sequence_id ar_interim_cash_receipts.doc_sequence_id%TYPE,
1415 p_doc_sequence_value
1416 ar_interim_cash_receipts.doc_sequence_value%TYPE,
1417 p_attribute_category
1418 ar_interim_cash_receipts.attribute_category%TYPE,
1419 p_attribute1 ar_interim_cash_receipts.attribute1%TYPE,
1420 p_attribute2 ar_interim_cash_receipts.attribute2%TYPE,
1421 p_attribute3 ar_interim_cash_receipts.attribute3%TYPE,
1422 p_attribute4 ar_interim_cash_receipts.attribute4%TYPE,
1423 p_attribute5 ar_interim_cash_receipts.attribute5%TYPE,
1424 p_attribute6 ar_interim_cash_receipts.attribute6%TYPE,
1425 p_attribute7 ar_interim_cash_receipts.attribute7%TYPE,
1426 p_attribute8 ar_interim_cash_receipts.attribute8%TYPE,
1427 p_attribute9 ar_interim_cash_receipts.attribute9%TYPE,
1428 p_attribute10 ar_interim_cash_receipts.attribute10%TYPE,
1429 p_attribute11 ar_interim_cash_receipts.attribute11%TYPE,
1430 p_attribute12 ar_interim_cash_receipts.attribute12%TYPE,
1431 p_attribute13 ar_interim_cash_receipts.attribute13%TYPE,
1432 p_attribute14 ar_interim_cash_receipts.attribute14%TYPE,
1433 p_attribute15 ar_interim_cash_receipts.attribute15%TYPE
1434 ) IS
1435 CURSOR C IS
1436 SELECT *
1437 FROM ar_interim_cash_receipts
1438 WHERE rowid = p_row_id
1439 FOR UPDATE of CASH_RECEIPT_ID NOWAIT;
1440 Recinfo C%ROWTYPE;
1441 --
1442 BEGIN
1443
1444 IF PG_DEBUG in ('Y', 'C') THEN
1445 arp_util.debug('lock_row: ' || 'Made it to lock row' );
1446 END IF;
1447
1448 OPEN C;
1449 FETCH C INTO Recinfo;
1450 if (C%NOTFOUND) then
1451 CLOSE C;
1452 FND_MESSAGE.Set_Name( 'FND', 'FORM_RECORD_DELETED');
1453 APP_EXCEPTION.Raise_Exception;
1454 end if;
1455 CLOSE C;
1456 if(
1457 (Recinfo.cash_receipt_id = p_cr_id )
1458 AND ( (NVL(Recinfo.special_type, 'SINGLE') = p_special_type)
1459 OR ( (Recinfo.special_type IS NULL)
1460 AND (p_special_type IS NULL)))
1461 AND ( (Recinfo.receipt_number = p_receipt_number)
1462 OR ( (Recinfo.receipt_number IS NULL)
1463 AND (p_receipt_number IS NULL)))
1464 AND (Recinfo.currency_code = p_currency_code)
1465 AND (Recinfo.amount = p_receipt_amount)
1466 AND (Recinfo.receipt_method_id = p_receipt_method_id)
1467 AND (Recinfo.remit_bank_acct_use_id = p_remittance_bank_account_id)
1468 AND ( (Recinfo.batch_id = p_batch_id)
1469 OR ( (Recinfo.batch_id IS NULL)
1470 AND (p_batch_id IS NULL)))
1471 AND ( (Recinfo.customer_trx_id = p_customer_trx_id)
1472 OR ( (Recinfo.customer_trx_id IS NULL)
1473 AND (p_customer_trx_id IS NULL)))
1474 AND ( (Recinfo.payment_schedule_id = p_payment_schedule_id)
1475 OR ( (Recinfo.payment_schedule_id IS NULL)
1476 AND (p_payment_schedule_id IS NULL)))
1477 AND ( (Recinfo.exchange_date = p_exchange_date)
1478 OR ( (Recinfo.exchange_date IS NULL)
1479 AND (p_exchange_date IS NULL)))
1480 AND ( (Recinfo.exchange_rate = p_exchange_rate)
1481 OR ( (Recinfo.exchange_rate IS NULL)
1482 AND (p_exchange_rate IS NULL)))
1483 AND ( (Recinfo.exchange_rate_type = p_exchange_rate_type)
1484 OR ( (Recinfo.exchange_rate_type IS NULL)
1485 AND (p_exchange_rate_type IS NULL)))
1486 AND (Recinfo.gl_date = p_gl_date)
1487 AND ( (Recinfo.pay_from_customer = p_pay_from_customer)
1488 OR ( (Recinfo.pay_from_customer IS NULL)
1489 AND (p_pay_from_customer IS NULL)))
1490 AND ( (Recinfo.receipt_date = p_receipt_date)
1491 OR ( (Recinfo.receipt_date IS NULL)
1492 AND (p_receipt_date IS NULL)))
1493 AND ( (Recinfo.site_use_id = p_site_use_id)
1494 OR ( (Recinfo.site_use_id IS NULL)
1495 AND (p_site_use_id IS NULL)))
1496 AND ( (Recinfo.ussgl_transaction_code = p_ussgl_transaction_code)
1497 OR ( (Recinfo.ussgl_transaction_code IS NULL)
1498 AND (p_ussgl_transaction_code IS NULL)))
1499 AND ( (Recinfo.doc_sequence_id = p_doc_sequence_id)
1500 OR ( (Recinfo.doc_sequence_id IS NULL)
1501 AND (p_doc_sequence_id IS NULL)))
1502 AND ( (Recinfo.doc_sequence_value = p_doc_sequence_value)
1503 OR ( (Recinfo.doc_sequence_value IS NULL)
1504 AND (p_doc_sequence_value IS NULL)))
1505 AND ( (Recinfo.attribute_category = p_attribute_category)
1506 OR ( (Recinfo.attribute_category IS NULL)
1507 AND (p_attribute_category IS NULL)))
1508 AND ( (Recinfo.attribute1 = p_attribute1)
1509 OR ( (Recinfo.attribute1 IS NULL)
1510 AND (p_attribute1 IS NULL)))
1511 AND ( (Recinfo.attribute2 = p_attribute2)
1512 OR ( (Recinfo.attribute2 IS NULL)
1513 AND (p_attribute2 IS NULL)))
1514 AND ( (Recinfo.attribute3 = p_attribute3)
1515 OR ( (Recinfo.attribute3 IS NULL)
1516 AND (p_attribute3 IS NULL)))
1517 AND ( (Recinfo.attribute4 = p_attribute4)
1518 OR ( (Recinfo.attribute4 IS NULL)
1519 AND (p_attribute4 IS NULL)))
1520 AND ( (Recinfo.attribute5 = p_attribute5)
1521 OR ( (Recinfo.attribute5 IS NULL)
1522 AND (p_attribute5 IS NULL)))
1523 AND ( (Recinfo.attribute6 = p_attribute6)
1524 OR ( (Recinfo.attribute6 IS NULL)
1525 AND (p_attribute6 IS NULL)))
1526 AND ( (Recinfo.attribute7 = p_attribute7)
1527 OR ( (Recinfo.attribute7 IS NULL)
1528 AND (p_attribute7 IS NULL)))
1529 AND ( (Recinfo.attribute8 = p_attribute8)
1530 OR ( (Recinfo.attribute8 IS NULL)
1531 AND (p_attribute8 IS NULL)))
1532 AND ( (Recinfo.attribute9 = p_attribute9)
1533 OR ( (Recinfo.attribute9 IS NULL)
1534 AND (p_attribute9 IS NULL)))
1535 AND ( (Recinfo.attribute10 = p_attribute10)
1536 OR ( (Recinfo.attribute10 IS NULL)
1537 AND (p_attribute10 IS NULL)))
1538 AND ( (Recinfo.attribute11 = p_attribute11)
1539 OR ( (Recinfo.attribute11 IS NULL)
1540 AND (p_attribute11 IS NULL)))
1541 AND ( (Recinfo.attribute12 = p_attribute12)
1542 OR ( (Recinfo.attribute12 IS NULL)
1543 AND (p_attribute12 IS NULL)))
1544 AND ( (Recinfo.attribute13 = p_attribute13)
1545 OR ( (Recinfo.attribute13 IS NULL)
1546 AND (p_attribute13 IS NULL)))
1547 AND ( (Recinfo.attribute14 = p_attribute14)
1548 OR ( (Recinfo.attribute14 IS NULL)
1549 AND (p_attribute14 IS NULL)))
1550 AND ( (Recinfo.attribute15 = p_attribute15)
1551 OR ( (Recinfo.attribute15 IS NULL)
1552 AND (p_attribute15 IS NULL)))
1553 AND ( (Recinfo.factor_discount_amount
1554 = p_factor_discount_amount)
1555 OR ( (Recinfo.factor_discount_amount IS NULL)
1556 AND (p_factor_discount_amount IS NULL)))
1557 AND ( (Recinfo.customer_bank_account_id =
1558 p_customer_bank_account_id)
1559 OR ( (Recinfo.customer_bank_account_id IS NULL)
1560 AND (p_customer_bank_account_id IS NULL)))
1561 AND ( (Recinfo.customer_bank_branch_id =
1562 p_customer_bank_branch_id)
1563 OR ( (Recinfo.customer_bank_branch_id IS NULL)
1564 AND (p_customer_bank_branch_id IS NULL)))
1565 AND ( (Recinfo.anticipated_clearing_date =
1566 p_anticipated_clearing_date)
1567 OR ( (Recinfo.anticipated_clearing_date IS NULL)
1568 AND (p_anticipated_clearing_date IS NULL)))
1569 ) then
1570 return;
1571 else
1572 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
1573 APP_EXCEPTION.Raise_Exception;
1574 end if;
1575 END lock_row;
1576 --
1577 END ARP_RW_ICR_PKG;