DBA Data[Home] [Help]

PACKAGE BODY: APPS.ARP_TRX_SUM_UTIL

Source


1 PACKAGE BODY ARP_TRX_SUM_UTIL AS
2 /* $Header: ARTUSUMB.pls 115.4 2003/10/10 14:29:45 mraymond ship $ */
3 
4 /*===========================================================================+
5  | FUNCTION                                                                  |
6  |    get_batch_summary                                                      |
7  |                                                                           |
8  | DESCRIPTION                                                               |
9  |    Returns the actual count or actual amount of the transactions for      |
10  |    a given batch.                                                         |
11  |                                                                           |
12  |    If p_mode is "SUM" then the sum of the amounts of the transactions     |
13  |    in the batch is returned. Otherwise the count of the transactions is   |
14  |    returned                                                               |
15  |                                                                           |
16  | SCOPE - PUBLIC                                                            |
17  |                                                                           |
18  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
19  |    arp_util.debug                                                         |
20  |                                                                           |
21  | ARGUMENTS  : IN:                                                          |
22  |                    p_batch_id                                             |
23  |                    p_mode      (SUM/COUNT)                                |
24  |              OUT:                                                         |
25  |                    None                                                   |
26  |                                                                           |
27  | RETURNS    : NUMBER    count/amount of transactions in the batch          |
28  |                                                                           |
29  | NOTES                                                                     |
30  |                                                                           |
31  |                                                                           |
32  | MODIFICATION HISTORY                                                      |
33  |     12-NOV-95  Subash C            Created                                |
34  |                                                                           |
35  +===========================================================================*/
36 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
37 
38 FUNCTION get_batch_summary(
39   p_batch_id IN number,
40   p_mode     IN varchar2 ) RETURN number
41 IS
42   l_sum_value  number := null;
43 BEGIN
44 
45    IF (nvl(p_mode, 'SUM') = 'SUM')
46    THEN
47        SELECT nvl(sum(lgd.amount), 0)
48        INTO   l_sum_value
49        FROM   ra_customer_trx ct,
50               ra_cust_trx_line_gl_dist lgd
51        WHERE  ct.customer_trx_id  = lgd.customer_trx_id
52        AND    ct.batch_id         = p_batch_id
53        AND    lgd.account_class   = 'REC'
54        AND    lgd.latest_rec_flag = 'Y';
55    ELSE
56        SELECT count(*)
57        INTO   l_sum_value
58        FROM   ra_customer_trx ct
59        WHERE  ct.batch_id = p_batch_id;
60    END IF;
61 
62    RETURN(l_sum_value);
63 
64 END get_batch_summary;
65 
66 /*===========================================================================+
67  | PROCEDURE                                                                 |
68  |    get_batch_summary_all                                                  |
69  |                                                                           |
70  | DESCRIPTION                                                               |
71  |    Returns the actual count and actual amount of the transactions for     |
72  |    a given batch.                                                         |
73  |                                                                           |
74  |    Will be called in POST-FORMS-COMMIT trigger from transactions WB to    |
75  |    update values  without having to requery the trx batches form.         |
76  |                                                                           |
77  |    implemented as a fix for Enhancement #561984.                          |
78  |                                                                           |
79  | SCOPE - PUBLIC                                                            |
80  |                                                                           |
81  | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
82  |    arp_util.debug                                                         |
83  |                                                                           |
84  | ARGUMENTS  : IN:                                                          |
85  |                    p_batch_id                                             |
86  |              OUT:                                                         |
87  |                    l_actual_count                                         |
88  |                    l_actual_amount                                        |
89  | NOTES                                                                     |
90  |                                                                           |
91  |                                                                           |
92  | MODIFICATION HISTORY                                                      |
93  |     08-OCT-95  Debbie Jancis         Created                              |
94  |                                                                           |
95  +===========================================================================*/
96 PROCEDURE get_batch_summary_all ( p_batch_id IN number,
97                                   l_actual_count OUT NOCOPY number,
98                                   l_actual_amount OUT NOCOPY number )
99 
100 IS
101 BEGIN
102 
103   l_actual_amount := null;
104   l_actual_count  := null;
105 
106        /*  get actual_amount */
107        SELECT nvl(sum(lgd.amount), 0)
108        INTO   l_actual_amount
109        FROM   ra_customer_trx ct,
110               ra_cust_trx_line_gl_dist lgd
111        WHERE  ct.customer_trx_id  = lgd.customer_trx_id
112        AND    ct.batch_id         = p_batch_id
113        AND    lgd.account_class   = 'REC'
114        AND    lgd.latest_rec_flag = 'Y';
115 
116        /* get actual count  */
117        SELECT count(*)
118        INTO   l_actual_count
119        FROM   ra_customer_trx ct
120        WHERE  ct.batch_id = p_batch_id;
121 
122 END get_batch_summary_all;
123 
124 
125 END ARP_TRX_SUM_UTIL;