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