1 PACKAGE RCV_AccrualUtilities_GRP AUTHID CURRENT_USER AS
2 /* $Header: RCVGUTLS.pls 120.0 2005/06/01 18:58:03 appldev noship $ */
3
4 ----------------------------------------------------------------------------
5 -- Start of Comments --
6 -- Type definitions for Purge API's for Costing Event Tables --
7 ----------------------------------------------------------------------------
8 TYPE TBL_NUM IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
9
10 TYPE TBL_V1 IS TABLE OF VARCHAR2(1) INDEX BY BINARY_INTEGER;
11
12 TYPE purge_in_rectype IS RECORD(
13
14 entity_ids TBL_NUM
15
16 );
17
18 TYPE purge_out_rectype IS RECORD (
19
20 purge_allowed TBL_V1
21
22 );
23 -----------------------------------------------------------------------------
24 -- Start of comments --
25 -- --
26 -- FUNCTION --
27 -- get_ret_sts_success returns constant G_RET_STS_SUCCESS from--
28 -- fnd_api package --
29 -----------------------------------------------------------------------------
30 FUNCTION get_ret_sts_success return varchar2;
31
32 -----------------------------------------------------------------------------
33 -- Start of comments --
34 -- --
35 -- FUNCTION --
36 -- get_ret_sts_error returns constant G_RET_STS_ERROR from --
37 -- fnd_api package --
38 -----------------------------------------------------------------------------
39 FUNCTION get_ret_sts_error return varchar2;
40
41 -----------------------------------------------------------------------------
42 -- Start of comments --
43 -- --
44 -- FUNCTION --
45 -- get_ret_sts_unexp_error returns constant G_RET_STS_UNEXP_ERROR --
46 -- from fnd_api package --
47 -----------------------------------------------------------------------------
48 FUNCTION get_ret_sts_unexp_error return varchar2;
49
50 -----------------------------------------------------------------------------
51 -- Start of comments --
52 -- --
53 -- FUNCTION --
54 -- get_true returns constant G_TRUE from fnd_api package --
55 -----------------------------------------------------------------------------
56 FUNCTION get_true return varchar2;
57
58 -----------------------------------------------------------------------------
59 -- Start of comments --
60 -- --
61 -- FUNCTION --
62 -- get_false returns constant G_FALSE from fnd_api package--
63 -----------------------------------------------------------------------------
64 FUNCTION get_false return varchar2;
65
66 -----------------------------------------------------------------------------
67 -- Start of comments --
68 -- --
69 -- FUNCTION --
70 -- get_valid_level_none returns constant G_VALID_LEVEL_NONE from --
71 -- fnd_api package --
72 -----------------------------------------------------------------------------
73 FUNCTION get_valid_level_none return NUMBER;
74
75 -----------------------------------------------------------------------------
76 -- Start of comments --
77 -- --
78 -- FUNCTION --
79 -- get_valid_level_full returns constant G_VALID_LEVEL_FULL from --
80 -- fnd_api package --
81 -----------------------------------------------------------------------------
82 FUNCTION get_valid_level_full return NUMBER;
83
84 -----------------------------------------------------------------------------
85 -- Start of comments
86 -- API name : Get_ReceivingUnitPrice
87 -- Type : Group
88 -- Function : To get the average unit price of quantity in Receiving
89 -- Inspection given a parent receive/match transaction
90 -- Pre-reqs :
91 -- Parameters :
92 -- IN : p_api_version IN NUMBER Required
93 -- p_init_msg_list IN VARCHAR2 Optional
94 -- Default = FND_API.G_FALSE
95 -- p_commit IN VARCHAR2 Optional
96 -- Default = FND_API.G_FALSE
97 -- p_validation_level IN NUMBER Optional
98 -- Default = FND_API.G_VALID_LEVEL_FULL
99 -- p_rcv_transaction_id IN NUMBER
100 -- p_valuation_date IN DATE Optional
101 -- Default = NULL
102 --
103 -- OUT : x_unit_price OUT NUMBER
104 -- x_return_status OUT VARCHAR2(1)
105 -- x_msg_count OUT NUMBER
106 -- x_msg_data OUT VARCHAR2(2000)
107 -- Version :
108 -- Initial version 1.0
109 --
110 -- Notes : This procedure is used by the Receving Value Report and the All inventories
111 -- value report to display the value in receiving inspection.
112 -- Earlier, this value was simply calculated as (mtl_supply.primary_quantity
113 -- However, with the introduction of global procurement and drop shipments
114 -- the accounting could be done at transfer price instead of PO price.
115 -- Furthermore, the transfer price itself can change between transactions.
116 -- Mtl_supply contains a summary amount : quantity_recieved + quantity corrected
117 -- - quantity returned. Hence the unit price that should be used by the view
118 -- should be the average of the unit price across these transactions. When
119 -- a valuation date is specified, the unit price is for the quantity in Receiving
120 -- as of that date.
121 --
122 --
123 -- End of comments
124 -------------------------------------------------------------------------------
125 PROCEDURE Get_ReceivingUnitPrice(
126 p_api_version IN NUMBER,
127 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
128 p_commit IN VARCHAR2 := FND_API.G_FALSE,
129 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
130 x_return_status OUT NOCOPY VARCHAR2,
131 x_msg_count OUT NOCOPY NUMBER,
132 x_msg_data OUT NOCOPY VARCHAR2,
133
134 p_rcv_transaction_id IN NUMBER,
135 p_valuation_date IN DATE := NULL,
136 x_unit_price OUT NOCOPY NUMBER
137 );
138
139
140 -----------------------------------------------------------------------------------------------
141 -- Start of comments
142 -- API name : Validate_PO_Purge
143 -- Type : Private
144 -- Function : To Validate if records in RAE and RRS can be
145 -- deleted for a list of PO_HEADER_ID's
146 -- Pre-reqs :
147 -- Parameters :
148 -- p_purge_entity_type IN VARCHAR2
149 -- The table of which the entity is the primary identifier
150 -- Values: PO_HEADERS_ALL, RCV_TRANSACTIONS
151 -- p_purge_in_rec IN RCV_AccrualUtilities_GRP.purge_in_rectype
152 -- Contains the List of PO_HEADER_ID's to be evaluated
153 -- x_purge_out_rec OUT NOCOPY RCV_AccrualUtilities_GRP.purge_out_rectype
154 -- Contains c character ('Y'/'N') indicating whether records
155 -- for corresponding header_id's can be deleted or not
156 ----------------------------------------------------------------------------------------------
157
158 PROCEDURE Validate_PO_Purge (
159 p_api_version IN NUMBER,
160 p_init_msg_list IN VARCHAR2,
161 p_commit IN VARCHAR2,
162 x_return_status OUT NOCOPY VARCHAR2,
163 x_msg_count OUT NOCOPY NUMBER,
164 x_msg_data OUT NOCOPY VARCHAR2,
165 p_purge_entity_type IN VARCHAR2,
166 p_purge_in_rec IN RCV_AccrualUtilities_GRP.purge_in_rectype,
167 x_purge_out_rec OUT NOCOPY RCV_AccrualUtilities_GRP.purge_out_rectype
168 );
169
170 -----------------------------------------------------------------------------------------------
171 -- Start of comments
172 -- API name : Purge
173 -- Type : Private
174 -- Function : To delete the records in RAE and RRS corresponding to po_header_id's
175 -- specified.
176 -- Pre-reqs :
177 -- Parameters :
178 -- p_purge_entity_type IN VARCHAR2
179 -- The table of which the entity is the primary identifier
180 -- Values: PO_HEADERS_ALL, RCV_TRANSACTIONS
181 -- p_purge_in_rec IN RCV_AccrualUtilities_GRP.purge_in_rectype
182 -- Contains the List of PO_HEADER_ID's for which corresponding
183 -- records need to be deleted from RAE and RRS
184 ----------------------------------------------------------------------------------------------
185
186 PROCEDURE Purge (
187 p_api_version IN NUMBER,
188 p_init_msg_list IN VARCHAR2,
189 p_commit IN VARCHAR2,
190 x_return_status OUT NOCOPY VARCHAR2,
191 x_msg_count OUT NOCOPY NUMBER,
192 x_msg_data OUT NOCOPY VARCHAR2,
193 p_purge_entity_type IN VARCHAR2,
194 p_purge_in_rec IN RCV_AccrualUtilities_GRP.purge_in_rectype
195 );
196
197 -----------------------------------------------------------------------------
198 -- Start of comments
199 -- API name : Get_encumReversalAmt
200 -- Type : Group
201 -- Function : To obtain total encumbrance reversal by PO distribution ID
202 -- Pre-reqs :
203 -- Parameters :
204 -- IN : p_po_distribution_id IN NUMBER
205 -- p_start_gl_date IN DATE Optional
206 -- p_end_gl_date IN DATE Optional
207 --
208 -- RETURN : Encumbrance Reversal Amount
209 -- Version : Initial version 1.0
210 -- Notes : This function will be used in the Encumbrance Detail Report
211 -- and active encumbrance summary screen.
212 -- The function will be called only if accrue on receipt is set to Yes
213 --
214 -- For inventory destinations,
215 -- sum(MMT.encumbrance_amount) for deliveries
216 -- against the PO distribution
217 -- For expense destinations,
218 -- sum(RRS.accounted_dr/cr for E rows) for
219 -- deliveries against the PO distribution
220 --
221 -- Encumbrance is not supported currently for Shop Floor
222 -- For Time Zone changes
223 -- Assume that date sent in is server timezone,
224 -- and validate with TxnDate
225 -- End of comments
226 -------------------------------------------------------------------------------
227
228 FUNCTION Get_encumReversalAmt(
229 p_po_distribution_id IN NUMBER,
230 p_start_txn_date IN VARCHAR2,
231 p_end_txn_date IN VARCHAR2
232 )
233
234 RETURN NUMBER;
235
236 END RCV_AccrualUtilities_GRP;