DBA Data[Home] [Help]

PACKAGE BODY: APPS.ARP_PROCESS_BR_BATCHES

Source


1 PACKAGE BODY ARP_PROCESS_BR_BATCHES AS
2 /* $Header: ARTEBRBB.pls 120.8 2011/07/19 00:38:25 dgaurab ship $ */
3 
4 
5 /*===========================================================================+
6  | PROCEDURE                                                                 |
7  |    Validate_GL_Date 			                                     |
8  |                                                                           |
9  | DESCRIPTION                                                               |
10  |    Validates that GL Date :						     |
11  |	-  Is in an open or future period     	    			     |
12  |      -  Is equal or later than the Issue Date			     |                                                                     |
13  |									     |
14  +===========================================================================*/
15 
16 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
17 
18 PROCEDURE Validate_GL_Date (	p_gl_date	IN  DATE,
19 				p_issue_date	IN  DATE)  IS
20 BEGIN
21 
22    	IF PG_DEBUG in ('Y', 'C') THEN
23    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_GL_Date()+');
24    	END IF;
25 
26    	IF 	NOT (arp_util.is_gl_date_valid (p_gl_date))
27 	THEN
28 		FND_MESSAGE.set_name  ('AR', 'AR_INVALID_APP_GL_DATE');
29 		--Int'l Calendar Project
30 		FND_MESSAGE.set_token ('GL_DATE', fnd_date.date_to_chardate (p_gl_date, calendar_aware=> FND_DATE.calendar_aware_alt));
31         	app_exception.raise_exception;
32 	END IF;
33 
34    	IF 	(p_gl_date <  p_issue_date)
35 	THEN
36      	 	FND_MESSAGE.set_name  ('AR', 'AR_BR_BATCH_GL_DATE');
37 	 	app_exception.raise_exception;
38    	END IF;
39 
40    	IF PG_DEBUG in ('Y', 'C') THEN
41    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_GL_Date()-');
42    	END IF;
43 
44 EXCEPTION
45     WHEN OTHERS THEN
46         IF PG_DEBUG in ('Y', 'C') THEN
47            arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Validate_GL_Date()');
48            arp_util.debug(  '');
49            arp_util.debug('------ parameters for Validate_GL_Date() -------');
50            arp_util.debug(  'p_gl_date          = '|| p_gl_date);
51            arp_util.debug(  'p_issue_date       = '|| p_issue_date);
52         END IF;
53         RAISE;
54 
55 END Validate_GL_Date;
56 
57 
58 
59 /*===========================================================================+
60  | PROCEDURE                                                                 |
61  |    Validate_Maturity_Date		                                     |
62  |                                                                           |
63  | DESCRIPTION                                                               |
64  |    Validates that Maturity Date is equal or later than the Issue Date     |									     |
65  |                                                                           |
66  +===========================================================================*/
67 
68 PROCEDURE Validate_Maturity_Date (	p_maturity_date	IN  DATE,
69 					p_issue_date	IN  DATE)  IS
70 BEGIN
71 
72    	IF PG_DEBUG in ('Y', 'C') THEN
73    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Maturity_Date()+');
74    	END IF;
75 
76    	IF 	(p_maturity_date IS NOT NULL)
77 	THEN
78   		IF 	(p_maturity_date <  p_issue_date)
79 		THEN
80      			FND_MESSAGE.set_name  ('AR', 'AR_BR_MAT_BEFORE_ISSUE_DATE ');
81 			app_exception.raise_exception;
82    		END IF;
83 	END IF;
84 
85    	IF PG_DEBUG in ('Y', 'C') THEN
86    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Maturity_Date()-');
87    	END IF;
88 
89 EXCEPTION
90     WHEN OTHERS THEN
91         IF PG_DEBUG in ('Y', 'C') THEN
92            arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Validate_Maturity_Date()');
93            arp_util.debug(  '');
94            arp_util.debug('------ parameters for Validate_Maturity_Date() -------');
95            arp_util.debug(  'p_maturity_date    = '|| p_maturity_date);
96            arp_util.debug(  'p_issue_date       = '|| p_issue_date);
97         END IF;
98         RAISE;
99 
100 END Validate_Maturity_Date;
101 
102 
103 
104 /*==============================================================================+
105  | PROCEDURE                                                                 	|
106  |    Validate_Batch_Source		                                     	|
107  |                                                                           	|
108  | DESCRIPTION                                                              	|
109  |    Validates that the Batch Source :					     	|
110  |	- is active			     	    			     	|
111  |      - is defined as Manual						     	|
112  |      - has Automatic Transaction Numbering checked  OR 		     	|
113  |            Copy Doc Number to Trx Number checked			     	|
114  |	- Batch Date between Start Date and End Date of the Batch Source     	|
115  |      - Issue Date between Start Date and End Date of the Batch Source    	|
116  |										|
117  |									     	|
118  +=============================================================================*/
119 
120 PROCEDURE Validate_Batch_Source (	p_batch_source_id	IN  NUMBER,
121 					p_batch_date		IN  DATE  ,
122 					p_issue_date		IN  DATE  )  IS
123 
124 l_start_date			DATE;
125 l_end_date			DATE;
126 l_auto_trx_numbering_flag	VARCHAR2(1);
127 l_copy_doc_number_flag		VARCHAR2(1);
128 
129 
130 BEGIN
131 
132    	IF PG_DEBUG in ('Y', 'C') THEN
133    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Batch_Source()+');
134    	END IF;
135 
136    	SELECT 	start_date, end_date, auto_trx_numbering_flag, copy_doc_number_flag
137 	INTO	l_start_date, l_end_date, l_auto_trx_numbering_flag, l_copy_doc_number_flag
138    	FROM	RA_BATCH_SOURCES
139    	WHERE  	batch_source_id 	=  p_batch_source_id
140    	AND	nvl(status, 'A')      	=  'A'
141    	AND    	batch_source_type       =  'INV';
142 
143 
144    	IF     (l_auto_trx_numbering_flag = 'N' AND l_copy_doc_number_flag = 'N')
145 	THEN
146 	  	IF PG_DEBUG in ('Y', 'C') THEN
147 	  	   arp_util.debug('Validate_Batch_Source: ' || 'Invalid Source - Flags');
148 	  	END IF;
149 	  	FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_INVALID_NUMBERING_SOURCE');
150 	  	app_exception.raise_exception;
151    	END IF;
152 
153 
154    	IF  	(p_batch_date	NOT BETWEEN nvl(l_start_date , p_batch_date)
155 	      		    		AND nvl(l_end_date   , p_batch_date))
156 	THEN
157   	  	IF PG_DEBUG in ('Y', 'C') THEN
158   	  	   arp_util.debug('Validate_Batch_Source: ' || 'Invalid Source - batch date');
159   	  	END IF;
160 	  	FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_BAD_BATCH_DATE_SOURCE');
161 	  	app_exception.raise_exception;
162    	END IF;
163 
164 
165    	IF     (p_issue_date NOT BETWEEN nvl(l_start_date , p_issue_date)
166 			 	     AND nvl(l_end_date   , p_issue_date))
167 	THEN
168   	  	IF PG_DEBUG in ('Y', 'C') THEN
169   	  	   arp_util.debug('Validate_Batch_Source: ' || 'Invalid Source - issue date');
170   	  	END IF;
171 	  	FND_MESSAGE.SET_NAME ('AR', 'AR_BR_BAD_DATE_SOURCE');
172 	  	app_exception.raise_exception;
173    	END IF;
174 
175    	IF PG_DEBUG in ('Y', 'C') THEN
176    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Batch_Source()-');
177    	END IF;
178 
179 EXCEPTION
180     WHEN   NO_DATA_FOUND THEN
181 	   FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_INVALID_BATCH_SOURCE');
182 	   app_exception.raise_exception;
183 
184     WHEN OTHERS THEN
185            IF PG_DEBUG in ('Y', 'C') THEN
186               arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Validate_Batch_Source()');
187               arp_util.debug('Validate_Batch_Source: ' || '');
188               arp_util.debug('------ parameters for Validate_Batch_Source() -------');
189               arp_util.debug('Validate_Batch_Source: ' || 'p_batch_source_id          = '|| p_batch_source_id);
190               arp_util.debug('Validate_Batch_Source: ' || 'p_batch_date               = '|| p_batch_date);
191               arp_util.debug('Validate_Batch_Source: ' || 'p_issue_date               = '|| p_issue_date);
192            END IF;
193            RAISE;
194 
195 END Validate_Batch_Source;
196 
197 
198 
199 /*==============================================================================+
200  | PROCEDURE                                                                 	|
201  |    Validate_Currency 		                                     	|
202  |                                                                           	|
203  | DESCRIPTION                                                              	|
204  |    Validates that the Currency :					     	|
205  |	- is active at the Issue Date	     	    			     	|
206  |      - is enabled							     	|
207  |      - belongs to a currency group			 		     	|
208  |										|
209  +=============================================================================*/
210 
211 PROCEDURE Validate_Currency	 (	p_currency_code		IN  VARCHAR2,
212 					p_issue_date		IN  DATE  )  IS
213 l_currency_valid VARCHAR2(1);
214 
215 BEGIN
216 
217    	IF PG_DEBUG in ('Y', 'C') THEN
218    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Currency()+');
219    	END IF;
220 
221   	IF  	(p_currency_code  IS NOT NULL)
222 	THEN
223 
224 	   	SELECT  'Y'
225 	   	INTO	l_currency_valid
226 	   	FROM	FND_CURRENCIES_VL cur
227 	   	WHERE   CURRENCY_CODE     =	  p_currency_code
228 	   	AND	p_issue_date      BETWEEN  nvl(cur.START_DATE_ACTIVE, p_issue_date)
229 				     	      AND  nvl(cur.END_DATE_ACTIVE, p_issue_date)
230 	   	AND	ENABLED_FLAG  = 'Y'
231 	   	AND	CURRENCY_FLAG = 'Y';
232    	END IF;
233 
234    	IF PG_DEBUG in ('Y', 'C') THEN
235    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Currency()-');
236    	END IF;
237 
238 EXCEPTION
239     WHEN   NO_DATA_FOUND THEN
240 	   FND_MESSAGE.SET_NAME  ('AR', 'AR_INVALID_CURRENCY');
241 	   app_exception.raise_exception;
242 
243     WHEN   OTHERS THEN
244            IF PG_DEBUG in ('Y', 'C') THEN
245               arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Validate_Currency()');
246               arp_util.debug('Validate_Currency: ' || '');
247               arp_util.debug('------ parameters for Validate_Currency() -------');
248               arp_util.debug('Validate_Currency: ' || 'p_currency_code            = '|| p_currency_code);
249               arp_util.debug('Validate_Currency: ' || 'p_issue_date               = '|| p_issue_date);
250            END IF;
251            RAISE;
252 
253 END Validate_Currency;
254 
255 
256 /*==============================================================================+
257  | PROCEDURE                                                                 	|
258  |    Validate_Receipt_Method		                                     	|
259  |                                                                           	|
260  | DESCRIPTION                                                              	|
261  |    Validates that the Issue Date is between the Start date and End date of   |
262  |    receipt method								|
263  |									     	|
264  +=============================================================================*/
265 
266 PROCEDURE Validate_Receipt_Method (	p_receipt_method_id	IN  NUMBER,
267 					p_issue_date		IN  DATE  )  IS
268 
269 l_receipt_method_valid	VARCHAR2(1);
270 
271 BEGIN
272 
273    	IF PG_DEBUG in ('Y', 'C') THEN
274    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Receipt_Method()+');
275    	END IF;
276 
277    	IF   (p_receipt_method_id IS NOT NULL)
278 	THEN
279    		SELECT 	'Y'
280 	   	INTO	l_Receipt_Method_valid
281    		FROM	AR_RECEIPT_METHODS  rm
282 	   	WHERE  	rm.receipt_method_id = p_receipt_method_id
283    		AND	p_issue_date 	BETWEEN nvl(rm.start_date , p_issue_date)
284 					AND	nvl(rm.end_date   , p_issue_date);
285    	END IF;
286 
287    	IF PG_DEBUG in ('Y', 'C') THEN
288    	   arp_util.debug('ARP_PROCESS_BR_BATCHES.Validate_Receipt_Method()-');
289    	END IF;
290 
291 EXCEPTION
292     WHEN   NO_DATA_FOUND THEN
293 	   FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_BAD_DATE_RECEIPT_METHOD');
294 	   app_exception.raise_exception;
295 
296     WHEN OTHERS THEN
297            IF PG_DEBUG in ('Y', 'C') THEN
298               arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Validate_Receipt_Method()');
299               arp_util.debug('Validate_Receipt_Method: ' || '');
300               arp_util.debug('------ parameters for Validate_Receipt_Method () -------');
301               arp_util.debug('Validate_Receipt_Method: ' || 'p_receipt_method_id        = '|| p_receipt_method_id);
302               arp_util.debug('Validate_Receipt_Method: ' || 'p_issue_date               = '|| p_issue_date);
303            END IF;
304            RAISE;
305 
306 END Validate_Receipt_Method;
307 
308 
309 /*==============================================================================+
310  | PROCEDURE                                                                 	|
311  |    Check_Mandatory_Data                               			|
312  |                                                                           	|
313  | DESCRIPTION                                                              	|
314  |    Checks that mandatory parameters for the batch are passed	:		|
315  |	-  Bacth Source								|
316  |	-  Batch Date								|
317  |	-  GL Date								|
318  |	-  Issue Date								|
319  |										|
320  +==============================================================================*/
321 
322 
323 PROCEDURE Check_Mandatory_Data ( p_batch_rec  IN    ra_batches%ROWTYPE)
324 IS
325 BEGIN
326 
327 	IF  	(p_batch_rec.batch_source_id IS NULL)
328 	THEN
329 		IF PG_DEBUG in ('Y', 'C') THEN
330 		   arp_util.debug('Check_Mandatory_Data: ' || 'Batch Source Missing');
331 		END IF;
332 		FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_BATCH_SOURCE_NULL');
333 	   	app_exception.raise_exception;
334 	END IF;
335 
336 
337 	IF  	(p_batch_rec.batch_date IS NULL)
338 	THEN
339 		IF PG_DEBUG in ('Y', 'C') THEN
340 		   arp_util.debug('Check_Mandatory_Data: ' || 'Batch Date Missing');
341 		END IF;
342 		FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_BATCH_DATE_NULL');
343 	   	app_exception.raise_exception;
344 	END IF;
345 
346 
347 	IF  	(p_batch_rec.gl_date IS NULL)
348 	THEN
349 		IF PG_DEBUG in ('Y', 'C') THEN
350 		   arp_util.debug('Check_Mandatory_Data: ' || 'GL Date Missing');
351 		END IF;
352 		FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_GL_DATE_NULL');
353 	   	app_exception.raise_exception;
354 	END IF;
355 
356 
357 	IF  	(p_batch_rec.issue_date IS NULL)
358 	THEN
359 		IF PG_DEBUG in ('Y', 'C') THEN
360 		   arp_util.debug('Check_Mandatory_Data: ' || 'Issue Date Missing');
361 		END IF;
362 		FND_MESSAGE.SET_NAME  ('AR', 'AR_BR_ISSUE_DATE_NULL');
363 	   	app_exception.raise_exception;
364 	END IF;
365 
366 EXCEPTION
367     WHEN OTHERS THEN
368            IF PG_DEBUG in ('Y', 'C') THEN
369               arp_util.debug('EXCEPTION:  ARP_PROCESS_BR_BATCHES.Check_Mandatory_Data()');
370               arp_util.debug('Check_Mandatory_Data: ' || '');
371            END IF;
372            RAISE;
373 
374 END Check_Mandatory_Data;
375 
376 
377 /*===========================================================================+
378  | PROCEDURE                                                                 |
379  |    validate_batch			                                     |
380  |                                                                           |
381  | DESCRIPTION                                                               |
382  |    Does validation that is required when a new batch is inserted.	     |
383  |                                                                           |
384  | SCOPE - PRIVATE                                                           |
385  |                                                                           |
386  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
387  |    arp_util.debug                                                         |
388  |                                                                           |
389  | ARGUMENTS  : IN:                                                          |
390  |		      p_batch_rec					     |
391  |              OUT:                                                         |
392  |                    None                                                   |
393  |                                                                           |
394  | RETURNS    : NONE                                                         |
395  |                                                                           |
396  | NOTES                                                                     |
397  |                                                                           |
398  | MODIFICATION HISTORY                                                      |
399  |     17-APR-2000     Tien Tran     	Created                              |
400  |                                                                           |
401  +===========================================================================*/
402 
403 
404 PROCEDURE validate_batch ( p_batch_rec IN ra_batches%rowtype ) IS
405 
406 
407 BEGIN
408 
409    IF PG_DEBUG in ('Y', 'C') THEN
410       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_batch()+');
411    END IF;
412 
413 
414    ARP_PROCESS_BR_BATCHES.Validate_GL_Date
415 		( 	p_batch_rec.gl_date		,
416 			p_batch_rec.issue_date		);
417 
418    ARP_PROCESS_BR_BATCHES.Validate_Maturity_Date
419 		( 	p_batch_rec.maturity_date	,
420  			p_batch_rec.issue_date   	);
421 
422    ARP_PROCESS_BR_BATCHES.Validate_Batch_Source
423 		( 	p_batch_rec.batch_source_id	,
424 			p_batch_rec.batch_date		,
425 			p_batch_rec.issue_date		);
426 
427    ARP_PROCESS_BR_BATCHES.Validate_Currency
428 		( 	p_batch_rec.currency_code	,
429  			p_batch_rec.issue_date   	);
430 
431    IF PG_DEBUG in ('Y', 'C') THEN
432       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_batch()-');
433    END IF;
434 
435 EXCEPTION
436     WHEN OTHERS THEN
437         IF PG_DEBUG in ('Y', 'C') THEN
438            arp_util.debug('EXCEPTION:  arp_process_batch.validate_batch()');
439            arp_util.debug('validate_batch: ' || '');
440            arp_util.debug('------ parameters for validate_batch() -------');
441         END IF;
442         arp_tbat_pkg.display_batch_rec(p_batch_rec);
443         RAISE;
444 
445 END validate_batch;
446 
447 
448 
449 
450 /*===========================================================================+
451  | PROCEDURE                                                                 |
452  |    validate_delete_batch		                                     |
453  |                                                                           |
454  | DESCRIPTION                                                               |
455  |    Does validation that is required when a batch is deleted.	     	     |
456  |                                                                           |
457  | SCOPE - PRIVATE                                                           |
458  |                                                                           |
459  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
460  |    arp_util.debug                                                         |
461  |                                                                           |
462  | ARGUMENTS  : IN:                                                          |
463  |		      p_batch_id					     |
464  |              OUT:                                                         |
465  |                    None                                                   |
466  |                                                                           |
467  | RETURNS    : NONE                                                         |
468  |                                                                           |
469  | NOTES                                                                     |
470  |                                                                           |
471  | MODIFICATION HISTORY                                                      |
472  |     17-APR-2000     Tien Tran     	Created                              |
473  |                                                                           |
474  +===========================================================================*/
475 
476 
477 PROCEDURE validate_delete_batch ( p_batch_id IN ra_batches.batch_id%type ) IS
478 
479 
480 BEGIN
481 
482    IF PG_DEBUG in ('Y', 'C') THEN
483       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_delete_batch()+');
484    END IF;
485 
486    arp_process_batch.ar_empty_batch(p_batch_id);
487 
488    IF PG_DEBUG in ('Y', 'C') THEN
489       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_delete_batch()-');
490    END IF;
491 
492 
493 EXCEPTION
494     WHEN OTHERS THEN
495         IF PG_DEBUG in ('Y', 'C') THEN
496            arp_util.debug('EXCEPTION:  arp_process_batch.validate_delete_batch()');
497            arp_util.debug('validate_delete_batch: ' || '');
498            arp_util.debug('------ parameters for validate_delete_batch() -------');
499            arp_util.debug('validate_delete_batch: ' || 'p_batch_id               = '|| p_batch_id);
500         END IF;
501         RAISE;
502 
503 END validate_delete_batch;
504 
505 
506 
507 /*===========================================================================+
508  | PROCEDURE                                                                 |
509  |    validate_selection		                                     |
510  |                                                                           |
511  | DESCRIPTION                                                               |
512  |    Does validation that is required when Selection Criteria are inserted  |
513  |    or updated                                                             |
514  |                                                                           |
515  | SCOPE - PRIVATE                                                           |
516  |                                                                           |
517  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
518  |    arp_util.debug                                                         |
519  |                                                                           |
520  | ARGUMENTS  : IN:                                                          |
521  |		      p_sel_rec					     	     |
522  |              OUT:                                                         |
523  |                    None                                                   |
524  |                                                                           |
525  | RETURNS    : NONE                                                         |
526  |                                                                           |
527  | NOTES                                                                     |
528  |                                                                           |
529  | MODIFICATION HISTORY                                                      |
530  |     17-APR-2000     Tien Tran     	Created                              |
531  |                                                                           |
532  +===========================================================================*/
533 
534 
535 PROCEDURE validate_selection (  p_sel_rec 	IN  ar_selection_criteria%rowtype,
536 			  	p_issue_date 	IN  ra_batches.issue_date%type   ) IS
537 
538 
539 BEGIN
540 
541    IF PG_DEBUG in ('Y', 'C') THEN
542       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_selection()+');
543    END IF;
544 
545    Validate_Receipt_Method ( 	p_sel_rec.receipt_method_id, p_issue_date);
546 
547    IF PG_DEBUG in ('Y', 'C') THEN
548       arp_util.debug('ARP_PROCESS_BR_BATCHES.validate_selection()-');
549    END IF;
550 
551 EXCEPTION
552     WHEN OTHERS THEN
553         IF PG_DEBUG in ('Y', 'C') THEN
554            arp_util.debug('EXCEPTION:  arp_process_batch.validate_selection()');
555            arp_util.debug('validate_selection: ' || '');
556            arp_util.debug('------ parameters for validate_selection() -------');
557         END IF;
558         arp_selection_criteria_pkg.display_selection_rec(p_sel_rec);
559         RAISE;
560 
561 END validate_selection;
562 
563 
564 
565 /*===========================================================================+
566  | FUNCTION                                                                  |
567  |    Is_Selection_Entered                                     		     |
568  |                                                                           |
569  | DESCRIPTION                                                               |
570  |    This function determines if Selection Criteria have been entered or not|
571  |                                                                           |
572  +===========================================================================*/
573 
574 FUNCTION Is_Selection_Entered (p_sel_rec  IN  ar_selection_criteria%rowtype ) RETURN BOOLEAN IS
575 BEGIN
576 
577    IF PG_DEBUG in ('Y', 'C') THEN
578       arp_util.debug('ARP_PROCESS_BR_BATCHES.Is_Selection_Entered()');
579    END IF;
580 
581    	IF 	(p_sel_rec.due_date_low  	 	IS NULL)	AND
582    		(p_sel_rec.due_date_high 	 	IS NULL)	AND
583    		(p_sel_rec.trx_date_low		 	IS NULL)	AND
584    		(p_sel_rec.trx_date_high	 	IS NULL)	AND
585    		(p_sel_rec.cust_trx_type_id	 	IS NULL)	AND
586    		(p_sel_rec.receipt_method_id	 	IS NULL)	AND
587    		(p_sel_rec.bank_branch_id	 	IS NULL)	AND
588    		(p_sel_rec.trx_number_low	 	IS NULL)	AND
589    		(p_sel_rec.trx_number_high	 	IS NULL)	AND
590    		(p_sel_rec.customer_class_code	 	IS NULL)	AND
591   		(p_sel_rec.customer_category_code 	IS NULL)	AND
592    		(p_sel_rec.customer_id		 	IS NULL)	AND
593    		(p_sel_rec.site_use_id		 	IS NULL)
594    	THEN
595 		return(false);
596    	ELSE
597 		return(true);
598    	END IF;
599 
600 EXCEPTION
601     WHEN OTHERS THEN
602         IF PG_DEBUG in ('Y', 'C') THEN
603            arp_util.debug('EXCEPTION:  arp_process_batches.Is_Selection_Entered ()');
604            arp_util.debug('Is_Selection_Entered: ' || '');
605            arp_util.debug('Is_Selection_Entered: ' || '------ parameters for validate_selection() -------');
606         END IF;
607         arp_selection_criteria_pkg.display_selection_rec(p_sel_rec);
608         RAISE;
609 
610 END Is_Selection_Entered;
611 
612 
613 
614 /*===========================================================================+
615  | PROCEDURE                                                                 |
616  |    insert_batch                                                           |
617  |                                                                           |
618  | DESCRIPTION                                                               |
619  |    Cover for calling the batch entity handler insert_batch                |
620  |                                                                           |
621  | SCOPE - PRIVATE                                                           |
622  |                                                                           |
623  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
624  |    arp_util.debug                                                         |
625  |                                                                           |
626  | ARGUMENTS  : IN:                                                          |
627  |                    p_form_name                                            |
628  |                    p_form_version                                         |
629  |                    p_batch_source_id                                      |
630  |                    p_batch_date                                           |
631  |                    p_gl_date                                              |
632  |                    p_type                                                 |
633  |                    p_currency_code                                        |
634  |                    p_comments                                             |
635  |                    p_attribute_category                                   |
636  |                    p_attribute1 - 15                                      |
637  |                    p_issue_date					     |
638  |                    p_maturity_date                                        |
639  |                    p_special_instructions                                 |
640  |                    p_batch_process_status                                 |
641  |		      p_due_date_low					     |
642  |		      p_due_date_high				  	     |
643  |		      p_trx_date_low					     |
644  |		      p_trx_date_high					     |
645  |		      p_cust_trx_type_id				     |
646  |		      p_receipt_method_id				     |
647  |		      p_bank_branch_id			  	     	     |
648  |		      p_trx_number_low				     	     |
649  |		      p_trx_number_high				     	     |
650  |		      p_customer_class_code				     |
651  |		      p_customer_category_code		  	             |
652  |		      p_customer_id					     |
653  |		      p_site_use_id		 			     |
654  |              OUT:                                                         |
655  |                    p_batch_id    					     |
656  |		      p_selection_criteria_id                                |
657  |          IN  OUT:                                                         |
658  |                    p_name                                                 |
659  |                                                                           |
660  | RETURNS    : NONE                                                         |
661  |                                                                           |
662  | NOTES                                                                     |
663  |                                                                           |
664  | MODIFICATION HISTORY                                                      |
665  |     17-APR-2000     Tien Tran     	Created                              |
666  |                                                                           |
667  +===========================================================================*/
668 
669 PROCEDURE insert_batch (
670 	p_form_name              	IN  	varchar2				,
671 	p_form_version           	IN  	number					,
672 	p_batch_source_id        	IN  	ra_batches.batch_source_id%TYPE		,
673 	p_batch_date             	IN  	ra_batches.batch_date%TYPE		,
674 	p_gl_date                	IN  	ra_batches.gl_date%TYPE			,
675 	p_TYPE                   	IN  	ra_batches.TYPE%TYPE			,
676   	p_currency_code          	IN  	ra_batches.currency_code%TYPE		,
677   	p_comments               	IN  	ra_batches.comments%TYPE		,
678   	p_attribute_category     	IN  	ra_batches.attribute_category%TYPE	,
679 	p_attribute1             	IN  	ra_batches.attribute1%TYPE		,
680  	p_attribute2             	IN  	ra_batches.attribute2%TYPE		,
681   	p_attribute3             	IN  	ra_batches.attribute3%TYPE		,
682   	p_attribute4             	IN  	ra_batches.attribute4%TYPE		,
683   	p_attribute5             	IN  	ra_batches.attribute5%TYPE		,
684   	p_attribute6             	IN  	ra_batches.attribute6%TYPE		,
685   	p_attribute7             	IN  	ra_batches.attribute7%TYPE		,
686   	p_attribute8            	IN  	ra_batches.attribute8%TYPE		,
687   	p_attribute9            	IN  	ra_batches.attribute9%TYPE		,
688   	p_attribute10            	IN  	ra_batches.attribute10%TYPE		,
689   	p_attribute11            	IN  	ra_batches.attribute11%TYPE		,
690   	p_attribute12            	IN  	ra_batches.attribute12%TYPE		,
691   	p_attribute13            	IN  	ra_batches.attribute13%TYPE		,
692   	p_attribute14            	IN  	ra_batches.attribute14%TYPE		,
693   	p_attribute15            	IN  	ra_batches.attribute15%TYPE		,
694   	p_issue_date		   	IN  	ra_batches.issue_date%TYPE		,
695   	p_maturity_date   	   	IN  	ra_batches.maturity_date%TYPE		,
696   	p_special_instructions   	IN  	ra_batches.special_instructions%TYPE	,
697   	p_batch_process_status   	IN  	ra_batches.batch_process_status%TYPE	,
698   	p_due_date_low  	   	IN  	ar_selection_criteria.due_date_low%TYPE	,
699   	p_due_date_high	   		IN  	ar_selection_criteria.due_date_high%TYPE,
700   	p_trx_date_low	   		IN  	ar_selection_criteria.trx_date_low%TYPE	,
701   	p_trx_date_high	   		IN  	ar_selection_criteria.trx_date_high%TYPE,
702   	p_cust_trx_TYPE_id	   	IN  	ar_selection_criteria.cust_trx_TYPE_id%TYPE	,
703   	p_receipt_method_id	   	IN  	ar_selection_criteria.receipt_method_id%TYPE	,
704   	p_bank_branch_id	   	IN  	ar_selection_criteria.bank_branch_id%TYPE	,
705   	p_trx_number_low	   	IN  	ar_selection_criteria.trx_number_low%TYPE	,
706   	p_trx_number_high	   	IN  	ar_selection_criteria.trx_number_high%TYPE	,
707   	p_customer_class_code	   	IN  	ar_selection_criteria.customer_class_code%TYPE	,
708   	p_customer_category_code 	IN  	ar_selection_criteria.customer_category_code%TYPE,
709   	p_customer_id		   	IN  	ar_selection_criteria.customer_id%TYPE	,
710   	p_site_use_id		   	IN 	ar_selection_criteria.site_use_id%TYPE	,
711   	p_selection_criteria_id  	OUT NOCOPY 	ra_batches.selection_criteria_id%TYPE	,
712   	p_batch_id               	OUT NOCOPY 	ra_batches.batch_id%TYPE		,
713   	p_name               	   	IN OUT NOCOPY 	ra_batches.name%TYPE			)
714 
715 IS
716   	l_batch_rec     ra_batches%rowtype		;
717   	l_batch_id      ra_batches.batch_id%type	;
718   	l_name          ra_batches.name%type		;
719   	l_sel_rec       ar_selection_criteria%rowtype	;
720   	l_sel_id	ar_selection_criteria.selection_criteria_id%type;
721 
722 BEGIN
723 
724    	arp_util.debug('arp_process_br_batch.insert_batch()+');
725 
726      	/*-------------------------------------------------------------+
727 	|  Check the form version to determine if it is compatible     |
728      	|  with the entity handler                                     |
729      	+-------------------------------------------------------------*/
730 
731     	arp_trx_validate.ar_entity_version_check (p_form_name, p_form_version);
732 
733    	/*----------------------------------------------------------------+
734     	|                 Batch Information                              |
735     	+----------------------------------------------------------------*/
736 
737     	l_batch_rec.batch_source_id      	:= 	p_batch_source_id	;
738     	l_batch_rec.batch_date           	:= 	p_batch_date		;
739     	l_batch_rec.gl_date              	:= 	p_gl_date		;
740     	l_batch_rec.type                 	:= 	p_type			;
741     	l_batch_rec.currency_code        	:= 	p_currency_code		;
742     	l_batch_rec.comments             	:= 	p_comments		;
743     	l_batch_rec.attribute_category   	:= 	p_attribute_category	;
744     	l_batch_rec.attribute1           	:= 	p_attribute1		;
745     	l_batch_rec.attribute2           	:= 	p_attribute2		;
746     	l_batch_rec.attribute3           	:= 	p_attribute3		;
747     	l_batch_rec.attribute4           	:= 	p_attribute4		;
748     	l_batch_rec.attribute5           	:= 	p_attribute5		;
749     	l_batch_rec.attribute6           	:= 	p_attribute6		;
750     	l_batch_rec.attribute7           	:= 	p_attribute7		;
751     	l_batch_rec.attribute8           	:= 	p_attribute8		;
752     	l_batch_rec.attribute9           	:= 	p_attribute9		;
753     	l_batch_rec.attribute10          	:= 	p_attribute10		;
754     	l_batch_rec.attribute11          	:= 	p_attribute11		;
755     	l_batch_rec.attribute12          	:= 	p_attribute12		;
756     	l_batch_rec.attribute13          	:= 	p_attribute13		;
757     	l_batch_rec.attribute14          	:= 	p_attribute14		;
758     	l_batch_rec.attribute15          	:= 	p_attribute15		;
759     	l_batch_rec.issue_date	     		:= 	p_issue_date		;
760     	l_batch_rec.maturity_date        	:= 	p_maturity_date		;
761    	l_batch_rec.special_instructions 	:= 	p_special_instructions	;
762     	l_batch_rec.batch_process_status 	:= 	p_batch_process_status	;
763     	l_batch_rec.selection_criteria_id  	:= 	null			;
764     	l_batch_rec.name                 	:= 	p_name			;
765 
766 	l_batch_rec.status			:=	'A'			;
767 
768     	check_mandatory_data (l_batch_rec);
769 
770 
771      	/*-------------------------------------------------------------+
772      	|  Do required validation for the batch                        |
773      	+-------------------------------------------------------------*/
774 
775        	ARP_PROCESS_BR_BATCHES.validate_batch (l_batch_rec);
776 
777 
778      	/*---------------------------------------------------------------+
779      	|  Call Table Handler to insert the batch                        |
780      	+---------------------------------------------------------------*/
781 
782     	arp_tbat_pkg.insert_p (l_batch_rec, p_batch_id, p_name);
783 
784 
785      	/*---------------------------------------------------------------+
786      	|                 Selection Criteria Information                 |
787      	+---------------------------------------------------------------*/
788 
789      	l_sel_rec.due_date_low			:= 	p_due_date_low		;
790      	l_sel_rec.due_date_high			:= 	p_due_date_high		;
791      	l_sel_rec.trx_date_low			:= 	p_trx_date_low		;
792      	l_sel_rec.trx_date_high			:= 	p_trx_date_high		;
793      	l_sel_rec.cust_trx_type_id		:= 	p_cust_trx_type_id	;
794      	l_sel_rec.receipt_method_id		:= 	p_receipt_method_id	;
795      	l_sel_rec.bank_branch_id		:= 	p_bank_branch_id	;
796      	l_sel_rec.trx_number_low		:= 	p_trx_number_low	;
797      	l_sel_rec.trx_number_high		:= 	p_trx_number_high	;
798      	l_sel_rec.customer_class_code		:= 	p_customer_class_code	;
799      	l_sel_rec.customer_category_code	:= 	p_customer_category_code;
800     	l_sel_rec.customer_id			:= 	p_customer_id		;
801      	l_sel_rec.site_use_id			:= 	p_site_use_id		;
802 
803     	p_selection_criteria_id			:= 	NULL			;
804 
805 
806 	IF  (Is_Selection_Entered (l_sel_rec)) THEN
807 
808 		/*-------------------------------------------------------------+
809        		|  Do required validation for the selection criteria           |
810        		+-------------------------------------------------------------*/
811 
812 		ARP_PROCESS_BR_BATCHES.validate_selection (l_sel_rec, p_issue_date);
813 
814 
815 		/*-------------------------------------------------------------+
816      		|  Call Table Handler to insert the selection                  |
817      		+-------------------------------------------------------------*/
818 
819      		arp_selection_criteria_pkg.insert_p (l_sel_rec, p_selection_criteria_id);
820 
821 
822      		/*-------------------------------------------------------------+
823      		|  Update the Batch information with the Selection Criteria ID |
824      		+-------------------------------------------------------------*/
825 
826 		UPDATE  RA_BATCHES
827 		SET	selection_criteria_id = p_selection_criteria_id
828 		WHERE	batch_id = p_batch_id;
829 
830 
831      	END IF;
832 
833      	arp_util.debug('ARP_PROCESS_BR_BATCHES.insert_batch()-');
834 
835 EXCEPTION
836   WHEN OTHERS THEN
837     arp_util.debug('EXCEPTION : ARP_PROCESS_BR_BATCHES.insert_batch');
838     arp_util.debug('p_batch_source_id       : ' || p_batch_source_id);
839     arp_util.debug('p_batch_date            : ' || p_batch_date);
840     arp_util.debug('p_gl_date               : ' || p_gl_date);
841     arp_util.debug('p_type                  : ' || p_type);
842     arp_util.debug('p_currency_code         : ' || p_currency_code);
843     arp_util.debug('p_comments              : ' || p_comments);
844     arp_util.debug('p_attribute_category    : ' || p_attribute_category);
845     arp_util.debug('p_attribute1            : ' || p_attribute1);
846     arp_util.debug('p_attribute2            : ' || p_attribute2);
847     arp_util.debug('p_attribute3            : ' || p_attribute3);
848     arp_util.debug('p_attribute4            : ' || p_attribute4);
849     arp_util.debug('p_attribute5            : ' || p_attribute5);
850     arp_util.debug('p_attribute6            : ' || p_attribute6);
851     arp_util.debug('p_attribute7            : ' || p_attribute7);
852     arp_util.debug('p_attribute8            : ' || p_attribute8);
853     arp_util.debug('p_attribute9            : ' || p_attribute9);
854     arp_util.debug('p_attribute10           : ' || p_attribute10);
855     arp_util.debug('p_attribute11           : ' || p_attribute11);
856     arp_util.debug('p_attribute12           : ' || p_attribute12);
857     arp_util.debug('p_attribute13           : ' || p_attribute13);
858     arp_util.debug('p_attribute14           : ' || p_attribute14);
859     arp_util.debug('p_attribute15           : ' || p_attribute15);
860     arp_util.debug('p_issue_date            : ' || p_issue_date);
861     arp_util.debug('p_maturity_date         : ' || p_maturity_date);
862     arp_util.debug('p_special_instructions  : ' || p_special_instructions);
863     arp_util.debug('p_batch_process_status  : ' || p_batch_process_status);
864     arp_util.debug('p_name                  : ' || p_name);
865     arp_util.debug('p_selection_criteria_id : ' || p_selection_criteria_id);
866     arp_util.debug('p_due_date_low          : ' || p_due_date_low);
867     arp_util.debug('p_due_date_high         : ' || p_due_date_high);
868     arp_util.debug('p_trx_date_low          : ' || p_trx_date_low);
869     arp_util.debug('p_trx_date_high         : ' || p_trx_date_high);
870     arp_util.debug('p_cust_trx_type_id      : ' || p_cust_trx_type_id);
871     arp_util.debug('p_receipt_method_id     : ' || p_receipt_method_id);
872     arp_util.debug('p_bank_branch_id        : ' || p_bank_branch_id);
873     arp_util.debug('p_trx_number_low        : ' || p_trx_number_low);
874     arp_util.debug('p_trx_number_high       : ' || p_trx_number_high);
875     arp_util.debug('p_customer_class_code   : ' || p_customer_class_code);
876     arp_util.debug('p_customer_category_code: ' || p_customer_category_code);
877     arp_util.debug('p_customer_id	    : ' || p_customer_id);
878     arp_util.debug('p_site_use_id           : ' || p_site_use_id);
879     RAISE;
880 END;
881 
882 
883 /*===========================================================================+
884  | PROCEDURE                                                                 |
885  |    update_batch                                                           |
886  |                                                                           |
887  | DESCRIPTION                                                               |
888  |    Call the table handlers of RA_BATCHES and AR_SELECTION_CRITERIA        |
889  |    to update BR Batch information                                         |
890  |                                                                           |
891  | SCOPE - PRIVATE                                                           |
892  |                                                                           |
893  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
894  |    arp_util.debug                                                         |
895  |                                                                           |
896  | ARGUMENTS  : IN:                                                          |
897  |                    p_form_name                                            |
898  |                    p_form_version                                         |
899  |		      p_batch_id					     |
900  |                    p_name                                                 |
901  |                    p_batch_source_id                                      |
902  |                    p_batch_date                                           |
903  |                    p_gl_date                                              |
904  |                    p_type                                                 |
905  |                    p_currency_code                                        |
906  |                    p_comments                                             |
907  |                    p_attribute_category                                   |
908  |                    p_attribute1 - 15                                      |
909  |                    p_issue_date					     |
910  |                    p_maturity_date                                        |
911  |                    p_special_instructions                                 |
912  |                    p_batch_process_status                                 |
913  |		      p_due_date_low					     |
914  |		      p_due_date_high				  	     |
915  |		      p_trx_date_low					     |
916  |		      p_trx_date_high					     |
917  |		      p_cust_trx_type_id				     |
918  |		      p_receipt_method_id				     |
919  |		      p_bank_branch_id			  	     	     |
920  |		      p_trx_number_low				     	     |
921  |		      p_trx_number_high				     	     |
922  |		      p_customer_class_code				     |
923  |		      p_customer_category_code		  	             |
924  |		      p_customer_id					     |
925  |		      p_site_use_id		 			     |
926  |      								     |
927  |              IN OUT NOCOPY :						     |
928  |		      p_selection_criteria_id				     |
929  |                                                                           |
930  | RETURNS    : NONE                                                         |
931  |                                                                           |
932  | NOTES                                                                     |
933  |                                                                           |
934  | MODIFICATION HISTORY                                                      |
935  |     17-APR-2000     Tien Tran     	Created                              |
936  |                                                                           |
937  +===========================================================================*/
938 
939 PROCEDURE update_batch (
940   	p_form_name              	IN  	varchar2				,
941 	p_form_version           	IN  	number					,
942   	p_batch_id               	IN  	ra_batches.batch_id%TYPE		,
943   	p_name                 	  	IN  	ra_batches.name%TYPE			,
944   	p_batch_source_id        	IN  	ra_batches.batch_source_id%TYPE		,
945   	p_batch_date             	IN  	ra_batches.batch_date%TYPE		,
946   	p_gl_date                	IN  	ra_batches.gl_date%TYPE			,
947   	p_TYPE                   	IN  	ra_batches.TYPE%TYPE			,
948   	p_currency_code          	IN  	ra_batches.currency_code%TYPE		,
949   	p_comments               	IN  	ra_batches.comments%TYPE		,
950   	p_attribute_category     	IN  	ra_batches.attribute_category%TYPE	,
951   	p_attribute1             	IN  	ra_batches.attribute1%TYPE		,
952   	p_attribute2             	IN  	ra_batches.attribute2%TYPE		,
953   	p_attribute3             	IN  	ra_batches.attribute3%TYPE		,
954   	p_attribute4            	IN  	ra_batches.attribute4%TYPE		,
955   	p_attribute5             	IN 	ra_batches.attribute5%TYPE		,
956   	p_attribute6             	IN  	ra_batches.attribute6%TYPE		,
957   	p_attribute7             	IN  	ra_batches.attribute7%TYPE		,
958   	p_attribute8             	IN  	ra_batches.attribute8%TYPE		,
959   	p_attribute9             	IN  	ra_batches.attribute9%TYPE		,
960   	p_attribute10            	IN  	ra_batches.attribute10%TYPE		,
961   	p_attribute11            	IN  	ra_batches.attribute11%TYPE		,
962   	p_attribute12            	IN  	ra_batches.attribute12%TYPE		,
963   	p_attribute13            	IN  	ra_batches.attribute13%TYPE		,
964   	p_attribute14            	IN  	ra_batches.attribute14%TYPE		,
965   	p_attribute15            	IN  	ra_batches.attribute15%TYPE		,
966   	p_issue_date		   	IN  	ra_batches.issue_date%TYPE		,
967   	p_maturity_date   	   	IN  	ra_batches.maturity_date%TYPE		,
968   	p_special_instructions   	IN  	ra_batches.special_instructions%TYPE	,
969   	p_batch_process_status   	IN  	ra_batches.batch_process_status%TYPE	,
970   	p_request_id		   	IN  	ra_batches.request_id%TYPE		,
971   	p_due_date_low  	   	IN  	ar_selection_criteria.due_date_low%TYPE	,
972   	p_due_date_high	   		IN  	ar_selection_criteria.due_date_high%TYPE,
973   	p_trx_date_low	   		IN  	ar_selection_criteria.trx_date_low%TYPE	,
974   	p_trx_date_high	   		IN  	ar_selection_criteria.trx_date_high%TYPE,
975   	p_cust_trx_TYPE_id	   	IN  	ar_selection_criteria.cust_trx_TYPE_id%TYPE	,
976   	p_receipt_method_id	   	IN  	ar_selection_criteria.receipt_method_id%TYPE	,
977   	p_bank_branch_id	   	IN  	ar_selection_criteria.bank_branch_id%TYPE	,
978   	p_trx_number_low	   	IN  	ar_selection_criteria.trx_number_low%TYPE	,
979   	p_trx_number_high	   	IN  	ar_selection_criteria.trx_number_high%TYPE	,
980   	p_customer_class_code	   	IN  	ar_selection_criteria.customer_class_code%TYPE	,
981   	p_customer_category_code 	IN  	ar_selection_criteria.customer_category_code%TYPE,
982   	p_customer_id		   	IN  	ar_selection_criteria.customer_id%TYPE	,
983   	p_site_use_id		   	IN  	ar_selection_criteria.site_use_id%TYPE	,
984   	p_selection_criteria_id  	IN  OUT NOCOPY ar_selection_criteria.selection_criteria_id%TYPE)
985 
986 IS
987   l_batch_rec     ra_batches%rowtype;
988   l_sel_rec       ar_selection_criteria%rowtype;
989 
990 
991 BEGIN
992     	IF PG_DEBUG in ('Y', 'C') THEN
993     	   arp_util.debug('ARP_PROCESS_BR_BATCHES.update_batch()+');
994     	END IF;
995 
996 
997      	/*-------------------------------------------------------------+
998      	|  Check the form version to determine if it is compatible     |
999      	|  with the entity handler                                     |
1000      	+-------------------------------------------------------------*/
1001 
1002     	arp_trx_validate.ar_entity_version_check (p_form_name, p_form_version);
1003 
1004 
1005    	/*----------------------------------------------------------------+
1006     	|                 Batch Information                              |
1007     	+----------------------------------------------------------------*/
1008 
1009     	arp_tbat_pkg.set_to_dummy(l_batch_rec);
1010 
1011     	l_batch_rec.batch_id			:=  	p_batch_id		;
1012     	l_batch_rec.name			:=  	p_name			;
1013     	l_batch_rec.batch_source_id      	:=  	p_batch_source_id	;
1014     	l_batch_rec.batch_date           	:=  	p_batch_date		;
1015     	l_batch_rec.gl_date              	:=  	p_gl_date		;
1016     	l_batch_rec.type                 	:=  	p_type			;
1017     	l_batch_rec.currency_code        	:=  	p_currency_code		;
1018     	l_batch_rec.comments             	:=  	p_comments		;
1019     	l_batch_rec.attribute_category   	:=  	p_attribute_category	;
1020     	l_batch_rec.attribute1           	:=  	p_attribute1		;
1021     	l_batch_rec.attribute2           	:=  	p_attribute2		;
1022    	l_batch_rec.attribute3           	:=  	p_attribute3		;
1023     	l_batch_rec.attribute4           	:=  	p_attribute4		;
1024     	l_batch_rec.attribute5           	:=  	p_attribute5		;
1025     	l_batch_rec.attribute6           	:=  	p_attribute6		;
1026     	l_batch_rec.attribute7           	:=  	p_attribute7		;
1027     	l_batch_rec.attribute8           	:=  	p_attribute8		;
1028     	l_batch_rec.attribute9           	:=  	p_attribute9		;
1029     	l_batch_rec.attribute10          	:=  	p_attribute10		;
1030     	l_batch_rec.attribute11          	:=  	p_attribute11		;
1031     	l_batch_rec.attribute12          	:=  	p_attribute12		;
1032     	l_batch_rec.attribute13          	:=  	p_attribute13		;
1033     	l_batch_rec.attribute14          	:=  	p_attribute14		;
1034     	l_batch_rec.attribute15          	:=  	p_attribute15		;
1035     	l_batch_rec.issue_date	     		:=  	p_issue_date		;
1036     	l_batch_rec.maturity_date        	:=  	p_maturity_date		;
1037     	l_batch_rec.special_instructions 	:=  	p_special_instructions	;
1038     	l_batch_rec.batch_process_status 	:=  	p_batch_process_status	;
1039     	l_batch_rec.selection_criteria_id   	:=  	p_selection_criteria_id	;
1040 
1041 
1042     	check_mandatory_data (l_batch_rec);
1043 
1044      	/*-------------------------------------------------------------+
1045      	|  Do required validation for the batch                        |
1046      	+-------------------------------------------------------------*/
1047 
1048       	ARP_PROCESS_BR_BATCHES.validate_batch (l_batch_rec);
1049 
1050 
1051      	/*---------------------------------------------------------------+
1052      	|  Call Table Handler to update the batch                        |
1053      	+---------------------------------------------------------------*/
1054 
1055     	arp_tbat_pkg.update_p (l_batch_rec, p_batch_id);
1056 
1057 
1058     	IF  	(p_request_id IS NOT NULL)
1059 	THEN
1060 		UPDATE  ra_batches
1061 		SET	request_id 	= 	p_request_id
1062 		WHERE	batch_id	=	p_batch_id;
1063     	END IF;
1064 
1065 
1066      	/*---------------------------------------------------------------+
1067      	|                 Selection Criteria Information                 |
1068      	+---------------------------------------------------------------*/
1069 
1070 	IF  	(p_selection_criteria_id  IS NOT NULL)
1071 	THEN
1072 	     	arp_selection_criteria_pkg.set_to_dummy(l_sel_rec);
1073 	END IF;
1074 
1075      	l_sel_rec.due_date_low			:= 	p_due_date_low		;
1076      	l_sel_rec.due_date_high			:= 	p_due_date_high		;
1077      	l_sel_rec.trx_date_low			:= 	p_trx_date_low		;
1078      	l_sel_rec.trx_date_high			:= 	p_trx_date_high		;
1079      	l_sel_rec.cust_trx_type_id		:= 	p_cust_trx_type_id	;
1080      	l_sel_rec.receipt_method_id		:= 	p_receipt_method_id	;
1081      	l_sel_rec.bank_branch_id		:= 	p_bank_branch_id	;
1082      	l_sel_rec.trx_number_low		:= 	p_trx_number_low	;
1083      	l_sel_rec.trx_number_high		:= 	p_trx_number_high	;
1084      	l_sel_rec.customer_class_code		:= 	p_customer_class_code	;
1085      	l_sel_rec.customer_category_code	:= 	p_customer_category_code;
1086      	l_sel_rec.customer_id			:= 	p_customer_id		;
1087      	l_sel_rec.site_use_id			:= 	p_site_use_id		;
1088 
1089 
1090      	IF  (Is_Selection_Entered (l_sel_rec))
1091 	THEN
1092 
1093 		/*-------------------------------------------------------------+
1094        		|  Do required validation for the selection criteria           |
1095        		+-------------------------------------------------------------*/
1096 
1097 		ARP_PROCESS_BR_BATCHES.validate_selection (l_sel_rec, p_issue_date);
1098 
1099 
1100 		IF  	(p_selection_criteria_id  IS NULL)
1101 		THEN
1102 
1103 			/*-------------------------------------------------------------+
1104 	     		|  Call Table Handler to insert the selection                  |
1105      			+-------------------------------------------------------------*/
1106 
1107 		     	arp_selection_criteria_pkg.insert_p ( l_sel_rec, p_selection_criteria_id);
1108 
1109 	     		/*-------------------------------------------------------------+
1110      			|  Update the Batch information with the Selection Criteria ID |
1111      			+-------------------------------------------------------------*/
1112 
1113 			UPDATE  RA_BATCHES
1114 			SET	selection_criteria_id = p_selection_criteria_id
1115 			WHERE	batch_id = p_batch_id;
1116 
1117 		ELSE
1118 
1119 			/*-------------------------------------------------------------+
1120      			|  Call Table Handler to update the selection                  |
1121      			+-------------------------------------------------------------*/
1122 
1123 	     		arp_selection_criteria_pkg.update_p (l_sel_rec, p_selection_criteria_id);
1124 
1125 		END IF;
1126 
1127      	END IF;
1128 
1129      	IF PG_DEBUG in ('Y', 'C') THEN
1130      	   arp_util.debug('ARP_PROCESS_BR_BATCHES.update_batch()-');
1131      	END IF;
1132 
1133 EXCEPTION
1134   WHEN OTHERS THEN
1135     IF PG_DEBUG in ('Y', 'C') THEN
1136        arp_util.debug('EXCEPTION : ARP_PROCESS_BR_BATCHES.update_batch');
1137        arp_util.debug('update_batch: ' || 'p_batch_source_id       : ' || p_batch_source_id);
1138        arp_util.debug('update_batch: ' || 'p_batch_date            : ' || p_batch_date);
1139        arp_util.debug('update_batch: ' || 'p_gl_date               : ' || p_gl_date);
1140        arp_util.debug('update_batch: ' || 'p_type                  : ' || p_type);
1141        arp_util.debug('update_batch: ' || 'p_currency_code         : ' || p_currency_code);
1142        arp_util.debug('update_batch: ' || 'p_comments              : ' || p_comments);
1143        arp_util.debug('update_batch: ' || 'p_attribute_category    : ' || p_attribute_category);
1144        arp_util.debug('update_batch: ' || 'p_attribute1            : ' || p_attribute1);
1145        arp_util.debug('update_batch: ' || 'p_attribute2            : ' || p_attribute2);
1146        arp_util.debug('update_batch: ' || 'p_attribute3            : ' || p_attribute3);
1147        arp_util.debug('update_batch: ' || 'p_attribute4            : ' || p_attribute4);
1148        arp_util.debug('update_batch: ' || 'p_attribute5            : ' || p_attribute5);
1149        arp_util.debug('update_batch: ' || 'p_attribute6            : ' || p_attribute6);
1150        arp_util.debug('update_batch: ' || 'p_attribute7            : ' || p_attribute7);
1151        arp_util.debug('update_batch: ' || 'p_attribute8            : ' || p_attribute8);
1152        arp_util.debug('update_batch: ' || 'p_attribute9            : ' || p_attribute9);
1153        arp_util.debug('update_batch: ' || 'p_attribute10           : ' || p_attribute10);
1154        arp_util.debug('update_batch: ' || 'p_attribute11           : ' || p_attribute11);
1155        arp_util.debug('update_batch: ' || 'p_attribute12           : ' || p_attribute12);
1156        arp_util.debug('update_batch: ' || 'p_attribute13           : ' || p_attribute13);
1157        arp_util.debug('update_batch: ' || 'p_attribute14           : ' || p_attribute14);
1158        arp_util.debug('update_batch: ' || 'p_attribute15           : ' || p_attribute15);
1159        arp_util.debug('update_batch: ' || 'p_issue_date            : ' || p_issue_date);
1160        arp_util.debug('update_batch: ' || 'p_maturity_date         : ' || p_maturity_date);
1161        arp_util.debug('update_batch: ' || 'p_special_instructions  : ' || p_special_instructions);
1162        arp_util.debug('update_batch: ' || 'p_batch_process_status  : ' || p_batch_process_status);
1163        arp_util.debug('update_batch: ' || 'p_name                  : ' || p_name);
1164        arp_util.debug('update_batch: ' || 'p_selection_criteria_id : ' || p_selection_criteria_id);
1165        arp_util.debug('update_batch: ' || 'p_due_date_low          : ' || p_due_date_low);
1166        arp_util.debug('update_batch: ' || 'p_due_date_high         : ' || p_due_date_high);
1167        arp_util.debug('update_batch: ' || 'p_trx_date_low          : ' || p_trx_date_low);
1168        arp_util.debug('update_batch: ' || 'p_trx_date_high         : ' || p_trx_date_high);
1169        arp_util.debug('update_batch: ' || 'p_cust_trx_type_id      : ' || p_cust_trx_type_id);
1170        arp_util.debug('update_batch: ' || 'p_receipt_method_id     : ' || p_receipt_method_id);
1171        arp_util.debug('update_batch: ' || 'p_bank_branch_id        : ' || p_bank_branch_id);
1172        arp_util.debug('update_batch: ' || 'p_trx_number_low        : ' || p_trx_number_low);
1173        arp_util.debug('update_batch: ' || 'p_trx_number_high       : ' || p_trx_number_high);
1174        arp_util.debug('update_batch: ' || 'p_customer_class_code   : ' || p_customer_class_code);
1175        arp_util.debug('update_batch: ' || 'p_customer_category_code: ' || p_customer_category_code);
1176        arp_util.debug('update_batch: ' || 'p_customer_id	    : ' || p_customer_id);
1177        arp_util.debug('update_batch: ' || 'p_site_use_id           : ' || p_site_use_id);
1178     END IF;
1179     RAISE;
1180 END Update_Batch;
1181 
1182 
1183 /*===========================================================================+
1184  | PROCEDURE                                                                 |
1185  |    delete_batch                                                           |
1186  |                                                                           |
1187  | DESCRIPTION                                                               |
1188  |									     |
1189  |    Call the table handlers of RA_BATCHES and AR_SELECTION_CRITERIA        |
1190  |    to delete BR Batch information                                         |
1191  |                                                                           |
1192  | SCOPE - PRIVATE                                                           |
1193  |                                                                           |
1194  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
1195  |    arp_util.debug                                                         |
1196  |                                                                           |
1197  | ARGUMENTS  : IN:                                                          |
1198  |                    p_form_name                                            |
1199  |                    p_form_version                                         |
1200  |                    p_batch_id                                             |
1201  |              OUT:                                                         |
1202  |                    None                                                   |
1203  |          IN  OUT:                                                         |
1204  |                    None                                                   |
1205  |                                                                           |
1206  | RETURNS    : NONE                                                         |
1207  |                                                                           |
1208  | NOTES                                                                     |
1209  |                                                                           |
1210  | MODIFICATION HISTORY                                                      |
1211  |     17-APR-2000    Tien Tran            Created                           |
1212  |                                                                           |
1213  +===========================================================================*/
1214 
1215 PROCEDURE delete_batch (
1216   	p_form_name              	IN 	varchar2				,
1217   	p_form_version           	IN 	number					,
1218   	p_batch_id               	IN 	ra_batches.batch_id%TYPE		,
1219   	p_selection_criteria_id  	IN 	ar_selection_criteria.selection_criteria_id%TYPE)
1220 
1221 IS
1222 
1223 BEGIN
1224     	arp_util.debug('ARP_PROCESS_BR_BATCHES.delete_batch()+');
1225 
1226      	/*-------------------------------------------------------------+
1227     	|  Check the form version to determine if it is compatible     |
1228      	|  with the entity handler                                     |
1229      	+-------------------------------------------------------------*/
1230 
1231     	arp_trx_validate.ar_entity_version_check (p_form_name, p_form_version);
1232 
1233 
1234      	/*-------------------------------------------------------------+
1235      	|  Do required validation  	                            |
1236      	+-------------------------------------------------------------*/
1237 
1238      	ARP_PROCESS_BR_BATCHES.validate_delete_batch (p_batch_id);
1239 
1240 
1241      	/*---------------------------------------------------------------+
1242      	|  Delete the selection Criteria if they exist                   |
1243      	+---------------------------------------------------------------*/
1244 
1245      	IF  (p_selection_criteria_id IS NOT NULL)
1246 	THEN
1247          	arp_selection_criteria_pkg.delete_p (p_selection_criteria_id);
1248      	END IF;
1249 
1250 
1251      	/*---------------------------------------------------------------+
1252      	|  Call Table Handler to delete the batch                        |
1253      	+---------------------------------------------------------------*/
1254 
1255      	arp_tbat_pkg.delete_p (p_batch_id);
1256 
1257 
1258     	arp_util.debug('ARP_PROCESS_BR_BATCHES.delete_batch()-');
1259 
1260 EXCEPTION
1261   WHEN OTHERS THEN
1262     arp_util.debug('EXCEPTION : ARP_PROCESS_BR_BATCHES.delete_batch');
1263 
1264     arp_util.debug('p_form_name             : '|| p_form_name);
1265     arp_util.debug('p_form_version          : '|| p_form_version);
1266     arp_util.debug('p_batch_id              : '|| p_batch_id);
1267     arp_util.debug('p_selection_criteria_id : '|| p_selection_criteria_id);
1268 
1269     RAISE;
1270 END;
1271 
1272 
1273 
1274 
1275 /*===========================================================================+
1276  | PROCEDURE                                                                 |
1277  |    lock_compare_batch                                                             |
1278  |                                                                           |
1279  | DESCRIPTION                                                               |
1280  |    Call the table handlers of RA_BATCHES and AR_SELECTION_CRITERIA        |
1281  |    to lock BR Batch information                                           |
1282  |                                                                           |
1283  | SCOPE -                                                           |
1284  |                                                                           |
1285  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
1286  |    arp_util.debug                                                         |
1287  |                                                                           |
1288  | ARGUMENTS  : IN:                                                          |
1289  |                    p_form_name                                            |
1290  |                    p_form_version                                         |
1291  |                    p_batch_id                                             |
1292  |                    p_name                                                 |
1293  |                    p_batch_source_id                                      |
1294  |                    p_batch_date                                           |
1295  |                    p_gl_date                                              |
1296  |                    p_type                                                 |
1297  |                    p_currency_code                                        |
1298  |                    p_comments                                             |
1299  |                    p_attribute_category                                   |
1300  |                    p_attribute1 - 15                                      |
1301  |                    p_issue_date					     |
1302  |                    p_maturity_date                                        |
1303  |                    p_special_instructions                                 |
1304  |                    p_batch_process_status                                 |
1305  |                    p_selection_criteria_id                                |
1306  |		      p_due_date_low					     |
1307  |		      p_due_date_high				  	     |
1308  |		      p_trx_date_low					     |
1309  |		      p_trx_date_high					     |
1310  |		      p_cust_trx_type_id				     |
1311  |		      p_receipt_method_id				     |
1312  |		      p_bank_branch_id			  	     	     |
1313  |		      p_trx_number_low				     	     |
1314  |		      p_trx_number_high				     	     |
1315  |		      p_customer_class_code				     |
1316  |		      p_customer_category_code		  	             |
1317  |		      p_customer_id					     |
1318  |		      p_site_use_id		 			     |
1319  |              OUT:                                                         |
1320  |                    None                                                   |
1321  |          IN  OUT:                                                         |
1322  |                    None                                                   |
1323  |                                                                           |
1324  | RETURNS    : NONE                                                         |
1325  |                                                                           |
1326  | NOTES                                                                     |
1327  |                                                                           |
1328  | MODIFICATION HISTORY                                                      |
1329  |     17-APR-2000    Tien Tran            Created                           |
1330  |									     |
1331  |                                                                           |
1332  +===========================================================================*/
1333 
1334 PROCEDURE lock_compare_batch (
1335   	p_form_name              	IN  	varchar2			,
1336   	p_form_version           	IN  	number				,
1337   	p_batch_id               	IN  	ra_batches.batch_id%TYPE	,
1338   	p_name                   	IN  	ra_batches.name%TYPE		,
1339   	p_batch_source_id        	IN  	ra_batches.batch_source_id%TYPE	,
1340   	p_batch_date            	IN  	ra_batches.batch_date%TYPE	,
1341   	p_gl_date                	IN  	ra_batches.gl_date%TYPE		,
1342   	p_TYPE                   	IN  	ra_batches.TYPE%TYPE		,
1343   	p_currency_code          	IN  	ra_batches.currency_code%TYPE	,
1344   	p_comments               	IN  	ra_batches.comments%TYPE	,
1345   	p_attribute_category     	IN  	ra_batches.attribute_category%TYPE,
1346   	p_attribute1             	IN  	ra_batches.attribute1%TYPE	,
1347   	p_attribute2             	IN  	ra_batches.attribute2%TYPE	,
1348   	p_attribute3             	IN  	ra_batches.attribute3%TYPE	,
1349   	p_attribute4             	IN  	ra_batches.attribute4%TYPE	,
1350   	p_attribute5             	IN  	ra_batches.attribute5%TYPE	,
1351   	p_attribute6             	IN  	ra_batches.attribute6%TYPE	,
1352   	p_attribute7             	IN  	ra_batches.attribute7%TYPE	,
1353   	p_attribute8             	IN  	ra_batches.attribute8%TYPE	,
1354   	p_attribute9             	IN  	ra_batches.attribute9%TYPE	,
1355   	p_attribute10            	IN  	ra_batches.attribute10%TYPE	,
1356   	p_attribute11            	IN  	ra_batches.attribute11%TYPE	,
1357   	p_attribute12            	IN  	ra_batches.attribute12%TYPE	,
1358   	p_attribute13            	IN  	ra_batches.attribute13%TYPE	,
1359   	p_attribute14            	IN  	ra_batches.attribute14%TYPE	,
1360   	p_attribute15            	IN  	ra_batches.attribute15%TYPE	,
1361   	p_issue_date		   	IN  	ra_batches.issue_date%TYPE	,
1362   	p_maturity_date   	   	IN  	ra_batches.maturity_date%TYPE	,
1363   	p_special_instructions   	IN  	ra_batches.special_instructions%TYPE		,
1364   	p_batch_process_status   	IN  	ra_batches.batch_process_status%TYPE		,
1365   	p_selection_criteria_id  	IN  	ar_selection_criteria.selection_criteria_id%TYPE,
1366   	p_due_date_low  	   	IN  	ar_selection_criteria.due_date_low%TYPE		,
1367   	p_due_date_high	   		IN  	ar_selection_criteria.due_date_high%TYPE	,
1368  	p_trx_date_low	   		IN  	ar_selection_criteria.trx_date_low%TYPE		,
1369   	p_trx_date_high	   		IN  	ar_selection_criteria.trx_date_high%TYPE	,
1370   	p_cust_trx_TYPE_id	   	IN  	ar_selection_criteria.cust_trx_TYPE_id%TYPE	,
1371   	p_receipt_method_id	   	IN  	ar_selection_criteria.receipt_method_id%TYPE	,
1372   	p_bank_branch_id	   	IN  	ar_selection_criteria.bank_branch_id%TYPE	,
1373   	p_trx_number_low	   	IN  	ar_selection_criteria.trx_number_low%TYPE	,
1374   	p_trx_number_high	   	IN  	ar_selection_criteria.trx_number_high%TYPE	,
1375   	p_customer_class_code	   	IN  	ar_selection_criteria.customer_class_code%TYPE	,
1376   	p_customer_category_code 	IN  	ar_selection_criteria.customer_category_code%TYPE,
1377   	p_customer_id		   	IN  	ar_selection_criteria.customer_id%TYPE		,
1378   	p_site_use_id		   	IN  	ar_selection_criteria.site_use_id%TYPE		)
1379 
1380 IS
1381   	l_batch_rec        ra_batches%rowtype		;
1382   	l_sel_rec          ar_selection_criteria%rowtype;
1383 
1384 BEGIN
1385     	IF PG_DEBUG in ('Y', 'C') THEN
1386     	   arp_util.debug('ARP_PROCESS_BR_BATCHES.lock_compare_batch ()+');
1387     	END IF;
1388 
1389      	/*-------------------------------------------------------------+
1390      	|  Check the form version to determine if it is compatible     |
1391      	|  with the entity handler                                     |
1392      	+-------------------------------------------------------------*/
1393 
1394     	arp_trx_validate.ar_entity_version_check (p_form_name, p_form_version);
1395 
1396 
1397 
1398      	/*---------------------------------------------------------------+
1399      	| Call Table Handler to lock the Selection Criteria if they exist|
1400      	+---------------------------------------------------------------*/
1401 
1402     	IF	(p_selection_criteria_id IS NOT NULL)
1403 	THEN
1404 		ARP_SELECTION_CRITERIA_PKG.set_to_dummy(l_sel_rec);
1405 
1406     		l_sel_rec.selection_criteria_id := p_selection_criteria_id;
1407 	    	l_sel_rec.due_date_low		:= p_due_date_low;
1408     		l_sel_rec.due_date_high		:= p_due_date_high;
1409 	    	l_sel_rec.trx_date_low		:= p_trx_date_low;
1410 	    	l_sel_rec.trx_date_high		:= p_trx_date_high;
1411     		l_sel_rec.cust_trx_type_id	:= p_cust_trx_type_id;
1412 	    	l_sel_rec.receipt_method_id	:= p_receipt_method_id;
1413     		l_sel_rec.bank_branch_id	:= p_bank_branch_id;
1414 	    	l_sel_rec.trx_number_low	:= p_trx_number_low;
1415     		l_sel_rec.trx_number_high	:= p_trx_number_high;
1416 	    	l_sel_rec.customer_class_code	:= p_customer_class_code;
1417     		l_sel_rec.customer_category_code:= p_customer_category_code;
1418 	    	l_sel_rec.customer_id		:= p_customer_id;
1419     		l_sel_rec.site_use_id		:= p_site_use_id;
1420 
1421 		arp_selection_criteria_pkg.display_selection_rec (l_sel_rec);
1422 
1423     		ARP_SELECTION_CRITERIA_PKG.lock_compare_p(l_sel_rec,p_selection_criteria_id);
1424 
1425      	END IF;
1426 
1427 
1428 
1429      	/*---------------------------------------------------------------+
1430      	|  Call Table Handler to lock the batch                          |
1431      	+---------------------------------------------------------------*/
1432 
1433     	arp_tbat_pkg.set_to_dummy(l_batch_rec);
1434 
1435     	l_batch_rec.batch_id             	:= 	p_batch_id		;
1436     	l_batch_rec.name                 	:= 	p_name			;
1437 	l_batch_rec.batch_source_id      	:= 	p_batch_source_id	;
1438     	l_batch_rec.batch_date           	:= 	trunc(p_batch_date)	;
1439     	l_batch_rec.gl_date              	:= 	trunc(p_gl_date)	;
1440     	l_batch_rec.type                 	:= 	p_type			;
1441     	l_batch_rec.currency_code        	:= 	p_currency_code		;
1442     	l_batch_rec.comments             	:= 	p_comments		;
1443     	l_batch_rec.attribute_category   	:= 	p_attribute_category	;
1444     	l_batch_rec.attribute1           	:= 	p_attribute1		;
1445     	l_batch_rec.attribute2           	:= 	p_attribute2		;
1446     	l_batch_rec.attribute3           	:= 	p_attribute3		;
1447     	l_batch_rec.attribute4           	:= 	p_attribute4		;
1448     	l_batch_rec.attribute5           	:= 	p_attribute5		;
1449     	l_batch_rec.attribute6           	:= 	p_attribute6		;
1450     	l_batch_rec.attribute7           	:= 	p_attribute7		;
1451     	l_batch_rec.attribute8           	:= 	p_attribute8		;
1452     	l_batch_rec.attribute9           	:= 	p_attribute9		;
1453     	l_batch_rec.attribute10          	:= 	p_attribute10		;
1454     	l_batch_rec.attribute11          	:= 	p_attribute11		;
1455     	l_batch_rec.attribute12          	:= 	p_attribute12		;
1456     	l_batch_rec.attribute13          	:= 	p_attribute13		;
1457     	l_batch_rec.attribute14          	:= 	p_attribute14		;
1458     	l_batch_rec.attribute15          	:= 	p_attribute15		;
1459     	l_batch_rec.issue_date	     		:= 	trunc(p_issue_date)	;
1460     	l_batch_rec.maturity_date        	:= 	trunc(p_maturity_date)	;
1461     	l_batch_rec.special_instructions 	:= 	p_special_instructions	;
1462     	l_batch_rec.batch_process_status 	:= 	p_batch_process_status	;
1463     	l_batch_rec.selection_criteria_id  	:= 	p_selection_criteria_id	;
1464 
1465     	arp_tbat_pkg.display_batch_rec (l_batch_rec);
1466 
1467     	arp_tbat_pkg.lock_compare_p(l_batch_rec, p_batch_id);
1468 
1469 
1470     	IF PG_DEBUG in ('Y', 'C') THEN
1471     	   arp_util.debug('ARP_PROCESS_BR_BATCHES.lock_compare_batch()-');
1472     	END IF;
1473 
1474 EXCEPTION
1475   WHEN OTHERS THEN
1476     IF PG_DEBUG in ('Y', 'C') THEN
1477        arp_util.debug('EXCEPTION : ARP_PROCESS_BR_BATCHES.lock_compare_batch');
1478     END IF;
1479 
1480     RAISE;
1481 END lock_compare_batch;
1482 
1483 
1484 /*===========================================================================+
1485  | PROCEDURE                                                                 |
1486  |    submit_print                                                           |
1487  |                                                                           |
1488  | DESCRIPTION                                                               |
1489  |    Call the format program						     |
1490  |                                                                           |
1491  | SCOPE -                                                           	     |
1492  |                                                                           |
1493  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
1494  |    arp_util.debug                                                         |
1495  |                                                                           |
1496  | ARGUMENTS  : IN:                                                          |
1497  |                    p_format                                               |
1498  |		      p_BR_ID	  	 			     	     |
1499  |              OUT:                                                         |
1500  |                    p_request_id                                           |
1501  |                                                                           |
1502  | RETURNS    : NONE                                                         |
1503  |                                                                           |
1504  | NOTES                                                                     |
1505  |                                                                           |
1506  | MODIFICATION HISTORY                                                      |
1507  |     13-JUL-2000    Tien Tran            Created                           |
1508  |									     |
1509  |                                                                           |
1510  +===========================================================================*/
1511 
1512 PROCEDURE submit_print ( p_format			IN	varchar2	,
1513 			 p_BR_ID			IN	number		,
1514 			 p_request_id			OUT NOCOPY	number		)
1515 
1516 
1517 IS
1518 l_org_id number;
1519 BEGIN
1520 /* Bug 10388858
1521    Org id of the concurrent request is mot set causing issue in submit of child request. */
1522 begin
1523 If p_br_id is not null then
1524    select org_id into l_org_id from ra_batches where batch_id=p_br_id;
1525    fnd_request.set_org_id(l_org_id);
1526 end if;
1527 exception when others then
1528 null;
1529 end;
1530 
1531 	p_request_id := FND_REQUEST.submit_request   (	'AR'				,
1532                                          		'ARBRFMTW'      		,
1533 							NULL				,
1534 					 		NULL				,
1535                                          		NULL				,
1536                                          		p_format			,
1537                                          		p_BR_ID				,
1538                                          		NULL				,
1539                                          		NULL				,
1540                                          		arp_global.set_of_books_id	);
1541 
1542 
1543 EXCEPTION
1544 	WHEN OTHERS THEN
1545 		IF PG_DEBUG in ('Y', 'C') THEN
1546 		   arp_util.debug('>>>>>>>>>> EXCEPTION : ARP_PROCESS_BR_BATCHES.Submit_Print () ');
1547 		END IF;
1548 		RAISE;
1549 
1550 END submit_print;
1551 
1552 
1553 /*----------------------------------------------------------------------------------------
1554  | PROCEDURE
1555  |    br_create
1556  |
1557  | DESCRIPTION
1558  |    Procedure called during the process to create bills receivable
1559  |    to submit the BR Creation concurrent program
1560  |
1561  | SCOPE - PUBLIC
1562  |
1563  |
1564  | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED - NONE
1565  |
1566  | ARGUMENTS : IN :
1567  |
1568  | RETURNS   : NONE
1569  |
1570  | NOTES
1571  |
1572  | MODIFICATION HISTORY - Created by O Charni - 10/08/2000
1573  |
1574  +===========================================================================*/
1575 
1576 PROCEDURE br_create(
1577 	p_call                   	IN  	NUMBER					,
1578 	p_draft_mode             	IN  	VARCHAR2 				,
1579 	p_print_flag             	IN  	VARCHAR2				,
1580 	p_batch_id               	IN  	RA_BATCHES.batch_id%TYPE 		,
1581 	p_batch_source_id        	IN  	RA_BATCHES.batch_source_id%TYPE	        ,
1582 	p_batch_date             	IN  	RA_BATCHES.batch_date%TYPE		,
1583 	p_gl_date                	IN  	RA_BATCHES.gl_date%TYPE			,
1584 	p_issue_date             	IN  	RA_BATCHES.issue_date%TYPE		,
1585 	p_maturity_date          	IN  	RA_BATCHES.maturity_date%TYPE 		,
1586 	p_currency_code          	IN  	RA_BATCHES.currency_code%TYPE 		,
1587 	p_comments               	IN  	RA_BATCHES.comments%TYPE 		,
1588 	p_special_instructions   	IN  	RA_BATCHES.special_instructions%TYPE	,
1589 	p_attribute_category     	IN  	RA_BATCHES.attribute_category%TYPE	,
1590 	p_attribute1             	IN  	VARCHAR2				,
1591 	p_attribute2             	IN  	VARCHAR2				,
1592 	p_attribute3             	IN  	VARCHAR2				,
1593 	p_attribute4             	IN  	VARCHAR2				,
1594 	p_attribute5             	IN  	VARCHAR2				,
1595 	p_attribute6             	IN  	VARCHAR2				,
1596 	p_attribute7             	IN  	VARCHAR2				,
1597 	p_attribute8             	IN  	VARCHAR2				,
1598 	p_attribute9             	IN  	VARCHAR2				,
1599 	p_attribute10            	IN  	VARCHAR2				,
1600 	p_attribute11            	IN  	VARCHAR2				,
1601 	p_attribute12            	IN  	VARCHAR2				,
1602 	p_attribute13            	IN  	VARCHAR2				,
1603 	p_attribute14            	IN  	VARCHAR2				,
1604 	p_attribute15            	IN  	VARCHAR2				,
1605 	p_due_date_low           	IN  	AR_PAYMENT_SCHEDULES.due_date%TYPE	,
1606 	p_due_date_high          	IN  	AR_PAYMENT_SCHEDULES.due_date%TYPE	,
1607 	p_trx_date_low           	IN  	RA_CUSTOMER_TRX.trx_date%TYPE		,
1608 	p_trx_date_high          	IN  	RA_CUSTOMER_TRX.trx_date%TYPE		,
1609 	p_trx_type_id            	IN  	RA_CUST_TRX_TYPES.cust_trx_type_id%TYPE	,
1610 	p_rcpt_meth_id           	IN  	AR_RECEIPT_METHODS.receipt_method_id%TYPE,
1611 	p_cust_bank_branch_id    	IN  	CE_BANK_BRANCHES_V.branch_party_id%TYPE	,
1612 	p_trx_number_low         	IN  	RA_CUSTOMER_TRX.trx_number%TYPE 	,
1613 	p_trx_number_high        	IN  	RA_CUSTOMER_TRX.trx_number%TYPE 	,
1614 	p_cust_class             	IN  	AR_LOOKUPS.lookup_code%TYPE		,
1615 	p_cust_category          	IN  	AR_LOOKUPS.lookup_code%TYPE 		,
1616 	p_customer_id            	IN  	HZ_CUST_ACCOUNTS.cust_account_id%TYPE 		,
1617 	p_site_use_id            	IN  	HZ_CUST_SITE_USES.site_use_id%TYPE		,
1618 	p_req_id                 	OUT NOCOPY 	NUMBER					,
1619 	p_batch_process_status   	OUT NOCOPY 	VARCHAR2 				)
1620 
1621 IS
1622 	l_request_id 		RA_BATCHES.request_id%TYPE ;
1623 	l_batch_process_status 	RA_BATCHES.batch_process_status%TYPE ;
1624         l_org_id                RA_BATCH_SOURCES_ALL.ORG_ID%TYPE;
1625 
1626 BEGIN
1627 
1628 	IF PG_DEBUG in ('Y', 'C') THEN
1629 	   arp_util.debug('ARP_PROCESS_BR_BATCHES.br_create(+)');
1630 	END IF;
1631 
1632         --Bug 5051673
1633         SELECT org_id
1634         INTO  l_org_id
1635         FROM RA_BATCH_SOURCES
1636         WHERE batch_source_id = p_batch_source_id;
1637 
1638        FND_REQUEST.set_org_id(l_org_id);
1639 
1640 	l_request_id := FND_REQUEST.submit_request(
1641 		application  	=> 'AR'
1642 	, 	program     	=> 'ARBRBRCP'
1643 	,	description  	=> NULL
1644 	,	start_time    	=> NULL
1645 	, 	sub_request 	=> NULL
1646 	, 	argument1   	=> p_call
1647 	, 	argument2   	=> p_draft_mode
1648 	, 	argument3   	=> p_print_flag
1649 	, 	argument4   	=> p_batch_id
1650 	,	argument5   	=> p_batch_source_id
1651 	, 	argument6    	=> fnd_date.date_to_canonical(p_batch_date)
1652 	, 	argument7    	=> fnd_date.date_to_canonical(p_gl_date)
1653 	, 	argument8   	=> fnd_date.date_to_canonical(p_issue_date)
1654 	, 	argument9    	=> fnd_date.date_to_canonical(p_maturity_date)
1655 	, 	argument10   	=> p_currency_code
1656 	, 	argument11  	=> p_comments
1657 	, 	argument12  	=> p_special_instructions
1658 	, 	argument13  	=> p_attribute_category
1659 	, 	argument14  	=> p_attribute1
1660 	, 	argument15  	=> p_attribute2
1661 	, 	argument16  	=> p_attribute3
1662 	, 	argument17  	=> p_attribute4
1663 	, 	argument18  	=> p_attribute5
1664 	, 	argument19  	=> p_attribute6
1665 	, 	argument20  	=> p_attribute7
1666 	, 	argument21  	=> p_attribute8
1667 	, 	argument22  	=> p_attribute9
1668 	, 	argument23  	=> p_attribute10
1669 	, 	argument24  	=> p_attribute11
1670 	, 	argument25  	=> p_attribute12
1671 	, 	argument26  	=> p_attribute13
1672 	, 	argument27  	=> p_attribute14
1673 	, 	argument28  	=> p_attribute15
1674 	, 	argument29  	=> fnd_date.date_to_canonical(p_due_date_low)
1675 	, 	argument30  	=> fnd_date.date_to_canonical(p_due_date_high)
1676 	, 	argument31  	=> fnd_date.date_to_canonical(p_trx_date_low)
1677 	, 	argument32  	=> fnd_date.date_to_canonical(p_trx_date_high)
1678 	, 	argument33  	=> p_trx_type_id
1679 	, 	argument34  	=> p_rcpt_meth_id
1680 	, 	argument35  	=> p_cust_bank_branch_id
1681 	, 	argument36  	=> p_trx_number_low
1682 	, 	argument37  	=> p_trx_number_high
1683 	, 	argument38  	=> p_cust_class
1684 	, 	argument39  	=> p_cust_category
1685 	, 	argument40  	=> p_customer_id
1686 	, 	argument41  	=> p_site_use_id ) ;
1687 
1688 
1689 
1690 	p_req_id               	:= l_request_id;
1691 	p_batch_process_status 	:= l_batch_process_status;
1692 
1693 
1694 	COMMIT;
1695 
1696 	IF PG_DEBUG in ('Y', 'C') THEN
1697 	   arp_util.debug('ARP_PROCESS_BR_BATCHES.br_create(-)');
1698 	END IF;
1699 
1700 EXCEPTION
1701      	WHEN OTHERS THEN
1702       		IF PG_DEBUG in ('Y', 'C') THEN
1703       		   arp_util.debug('>>>>>>>>>>> EXCEPTION : ARP_PROCESS_BR_BATCHES.br_create() ');
1704       		END IF;
1705 
1706 END br_create ;
1707 
1708 
1709 END ARP_PROCESS_BR_BATCHES;