DBA Data[Home] [Help]

PACKAGE: APPS.ARP_APP_CALC_PKG

Source


1 PACKAGE ARP_APP_CALC_PKG AS
2 /* $Header: ARAPPRUS.pls 120.2 2006/01/12 14:33:39 vcrisost ship $ */
3 
4 /*===========================================================================+
5  | FUNCTION                                                                  |
6  |   GET_RULE_SET_ID                                                           |
7  | DESCRIPTION                                                               |
8  |   Given the cust_trx_type_id from the payment schedule this function will |
9  |   return the rule_set_id to be used for this transaction                  |
10  |                                                                           |
11  | SCOPE                                                                     |
12  |     -- Public                                                            |
13  |                                                                           |
14  | PARAMETERS                                                                |
15  |   IN -   cust_trx_type_id - this is the transaction type of the item      |
16  |          associated with the payment schedule                             |
17  |   OUT NOCOPY    This function will return the rule_set_id to be used while       |
18  |          calling the calc_applied_and_remaining procedure                 |
19  | MODIFICATION HISTORY                                                      |
20  |   06-25-97  Joan Zaman --  Created                                        |
21  +===========================================================================*/
22 
23  function get_rule_set_id ( p_trx_type_id in number ) return number;
24 
25 /*===========================================================================+
26  | PROCEDURE                                                                 |
27  |   CALC_APPLIED_AND_REMAINING                                              |
28  | DESCRIPTION                                                               |
29  |   Given all the remaining amounts this procedure will calculate the new   |
30  |   applied amounts and remaining amounts based on the amount you want to   |
31  |   apply. The rule used for calculating the applied amounts is the rule    |
32  |   currently active in the system options form.                            |
33  |                                                                           |
34  |                                                                           |
35  | SCOPE                                                                     |
36  |     -- Public                                                             |
37  |                                                                           |
38  | PARAMETERS                                                                |
39  |   IN -   amt   -- This is the mount to be applied to all parts using      |
40  |                   the rule                                                |
41  |          rule_set_id -- Which rule to use
42  |          currency  -- currency the amount is in , used for rounding when  |
43  |                       prorating                                           |
44  |       line_remaining -- Remaining line amt at the time of the applic.     |
45  |       line_tax_remaining -- Remaining tax amt related to the line         |
46  |       freight_remaining -- Remaining line amt at the time of the applic.  |
47  |       freight_tax_remaining -- Remaining tax amt related to the freight   |
48  |       charges_remaining -- Remaining line amt at the time of the applic.  |
49  |       charges_tax_remaining -- Remaining tax amt related to the charges   |
50  |   OUT NOCOPY
51  |       line_applied - Amount applied for this part                         |
52  |       line_tax_applied - Amount applied for this part                     |
53  |       freight_applied - Amount applied for this part                      |
54  |       freight_tax_applied - Amount applied for this part                  |
55  |       charges_applied - Amount applied for this part                      |
56  |       charges_tax_applied - Amount applied for this part                  |
57  |                                                                           |
58  |       Also all the new remaining amounts will be provided back. This is   |
59  |       mainly important for the c-functions                                |
60  |       Most PL/SQL procedures will calculate their own remaining amounts   |
61  | USAGE NOTES                                                               |
62  |       1. Only provide positive values to this procedure                   |
63  |          In case of adjustment provide +ve values and negate afterwards   |
64  |       2. Only Line_Tax_ values will be used for now because tax on        |
65  |          freight and charges does not yet exists. Pass a zero value for it|
66  | MODIFICATION HISTORY                                                      |
67  |   03-11-97  Joan Zaman --  Created                                        |
68  |===========================================================================*/
69 procedure calc_applied_and_remaining ( amt in number
70                                ,rule_set_id number
71                                ,currency in varchar2
72                                ,line_remaining in out NOCOPY number
73                                ,line_tax_remaining in out NOCOPY number
74                                ,freight_remaining in out NOCOPY number
75                                ,freight_tax_remaining in out NOCOPY number
76                                ,charges_remaining in out NOCOPY number
77                                ,charges_tax_remaining in out NOCOPY number
78                                ,line_applied out NOCOPY number
79                                ,line_tax_applied  out NOCOPY number
80                                ,freight_applied  out NOCOPY number
81                                ,freight_tax_applied  out NOCOPY number
82                                ,charges_applied  out NOCOPY number
83                                ,charges_tax_applied  out NOCOPY number);
84 
85 -- This is the simple version and implies that there is no tax on charges
86 -- nor on freight. This is the situation in release 10 and 11 .
87 
88 procedure calc_applied_and_remaining ( p_amt in number
89                                ,p_rule_set_id number
90                                ,p_currency in varchar2
91                                ,p_line_remaining in out NOCOPY number
92                                ,p_line_tax_remaining in out NOCOPY number
93                                ,p_freight_remaining in out NOCOPY number
94                                ,p_charges_remaining in out NOCOPY number
95                                ,p_line_applied out NOCOPY number
96                                ,p_line_tax_applied  out NOCOPY number
97                                ,p_freight_applied  out NOCOPY number
98                                ,p_charges_applied  out NOCOPY number
99                                ,p_created_from in varchar2 DEFAULT NULL
100                                );
101 
102 
103 /*===========================================================================+
104  | PROCEDURE                                                                 |
105  |  COMPILE_RULE ()                                                          |
106  | DESCRIPTION                                                               |
107  |  This procedure will create a long column that will be inserted into      |
108  |  the ar_application_rules table with the according rule                   |
109  |  This compilation makes it possible for the calc_applied_and_remaining    |
110  |  procedure not to select multiple times from app_rule... tables           |
111  |                                                                           |
112  |  This procedure should be called from the application rules set up form   |
113  |  from the post_update trigger when the freeze flag getds set to 'Y'       |
114  |                                                                           |
115  |  Whenever a rule will be frozen a compiled rule will be created and stored|
116  |  in the long column rule_source.                                          |
117  |                                                                           |
118  |  Before creating the long column the procedure will check whether         |
119  |  the rule is valid. Following checks will be made :                       |
120  |    1. Is there one and only one Over Application Block                    |
121  |    2. Are there one or more non-overapplication Blocks                    |
122  |    3. Is every Line type present in one of the non-overapplication blocks |
123  |    4. Has one and only one of the application block lines in every        |
124  |       application block the rounding correction checked                   |
125  |                                                                           |
126  |  SCOPE -- Public -- To be called from the application rules set up form   |
127  |  PARAMETERS                                                               |
128  |     IN -- rule_id -- This is the id from the rule you want to compile.    |
129  |                                                                           |
130  |  MODIFICATION HISTORY                                                     |
131  |   03-11-97 -- Joan Zaman -- Created                                       |
132  +===========================================================================*/
133 
134 
135 procedure COMPILE_RULE ( p_rule_set_id in ar_app_rule_sets.rule_set_id%TYPE);
136 
137 end ARP_APP_CALC_PKG;