1 PACKAGE BODY AP_WEB_CUS_ACCTG_PKG AS
2 /* $Header: apwcaccb.pls 120.3.12010000.2 2008/08/06 07:44:50 rveliche ship $ */
3
4
5 ---------------------------------------------
6 -- Some global types, constants and cursors
7 ---------------------------------------------
8
9 ---
10 --- Function/procedures
11 ---
12
13 /*========================================================================
14 | PUBLIC FUNCTION GetIsCustomBuildOnly
15 |
16 | DESCRIPTION
17 | This is called by Expenses Entry Allocations page
18 | when user presses Update/Next (only if Online Validation is disabled).
19 |
20 | If you want to enable custom rebuilds in Expenses Entry Allocations page,
21 | when Online Validation is disabled, modify this function to:
22 |
23 | return 1 - if you want to enable custom builds
24 | return 0 - if you do not want to enable custom builds
25 |
26 | If Online Validation is enabled, custom rebuilds can be performed
27 | in BuildAccount (when p_build_mode = C_VALIDATE).
28 |
29 | If Online Validation is disabled, custom rebuilds can be performed
30 | in BuildAccount, as follows:
31 | (1) in Expenses Entry Allocations page (when p_build_mode = C_CUSTOM_BUILD_ONLY)
32 | (2) in Expenses Workflow AP Server Side Validation (when p_build_mode = C_VALIDATE)
33 |
34 | MODIFICATION HISTORY
35 | Date Author Description of Changes
36 | 25-Aug-2005 R Langi Created
37 |
38 *=======================================================================*/
39 FUNCTION GetIsCustomBuildOnly RETURN NUMBER
40 IS
41 BEGIN
42
43 -- if you want to enable custom builds
44 --return 1;
45
46 -- if you do not want to enable custom builds
47 return 0;
48
49 END;
50
51
52 /*========================================================================
53 | PUBLIC FUNCTION BuildAccount
54 |
55 | DESCRIPTION
56 | This function provides a client extension to Internet Expenses
57 | for building account code combinations.
58 |
59 | Internet Expenses builds account code combinations as follows:
60 |
61 | If a CCID is provided then get the segments from the CCID else use the
62 | segments provided. Overlay the segments using the expense type segments.
63 | If the expense type segments are empty then use the employee's default
64 | CCID segments (which is overlaid with the expense report header level
65 | cost center segment). If Expense Type Cost Center segment is empty,
66 | then overlay using line level cost center or header level cost center.
67 |
68 | This procedure returns the built segments and CCID (if validated).
69 |
70 |
71 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
72 |
73 | Always used for default employee accounting
74 | (1) Expenses Workflow AP Server Side Validation
75 |
76 | PARAMETERS
77 | p_report_header_id - NULL in this case
78 | p_report_line_id - NULL in this case
79 | p_employee_id - contains the employee id
80 | p_cost_center - contains the expense report cost center
81 | p_exp_type_parameter_id - NULL in this case
82 | p_segments - NULL in this case
83 | p_ccid - NULL in this case
84 | p_build_mode - AP_WEB_ACCTG_PKG.C_DEFAULT_VALIDATE
85 | p_new_segments - returns the default employee segments
86 | p_new_ccid - returns the default employee code combination id
87 | p_return_error_message - returns any error message if an error occurred
88 |
89 | When Expense Entry Allocations is enabled:
90 | (1) Initial render of Expense Allocations page:
91 | - creates new distributions
92 | or
93 | - rebuilds existing distributions when expense type changed
94 | or
95 | - rebuilds existing distributions when expense report header cost center changed
96 |
97 | PARAMETERS
98 | p_report_header_id - contains report header id
99 | p_report_line_id - contains report line id
100 | p_employee_id - contains the employee id
101 | p_cost_center - contains the expense report cost center
102 | p_exp_type_parameter_id - contains the expense type parameter id
103 | p_segments - contains the expense report line segments
104 | p_ccid - NULL in this case
105 | p_build_mode - AP_WEB_ACCTG_PKG.C_DEFAULT
106 | p_new_segments - returns the new expense report line segments
107 | p_new_ccid - returns the new expense report line code combination id
108 | p_return_error_message - returns any error message if an error occurred
109 |
110 |
111 | When Expense Entry Allocations is enabled with Online Validation:
112 | (1) When user presses Update/Next on Expense Allocations page:
113 | - rebuilds/validates user modified distributions
114 |
115 | PARAMETERS
116 | p_report_header_id - contains report header id
117 | p_report_line_id - contains report line id
118 | p_employee_id - contains the employee id
119 | p_cost_center - NULL in this case
120 | p_exp_type_parameter_id - NULL in this case
121 | p_segments - contains the expense report line segments
122 | p_ccid - NULL in this case
123 | p_build_mode - AP_WEB_ACCTG_PKG.C_VALIDATE
124 | p_new_segments - returns the new expense report line segments
125 | p_new_ccid - returns the new expense report line code combination id
126 | p_return_error_message - returns any error message if an error occurred
127 |
128 |
129 | When Expense Entry Allocations is enabled without Online Validation:
130 | (1) When user presses Update/Next on Expense Allocations page:
131 | - rebuilds user modified distributions
132 |
133 | PARAMETERS
134 | p_report_header_id - contains report header id
135 | p_report_line_id - contains report line id
136 | p_employee_id - contains the employee id
137 | p_cost_center - NULL in this case
138 | p_exp_type_parameter_id - NULL in this case
139 | p_segments - contains the expense report line segments
140 | p_ccid - NULL in this case
141 | p_build_mode - AP_WEB_ACCTG_PKG.C_CUSTOM_BUILD_ONLY
142 | p_new_segments - returns the new expense report line segments
143 | p_new_ccid - returns the new expense report line code combination id
144 | p_return_error_message - returns any error message if an error occurred
145 |
146 | (2) Expenses Workflow AP Server Side Validation
147 | - validates user modified distributions
148 |
149 | PARAMETERS
150 | p_report_header_id - contains report header id
151 | p_report_line_id - contains report line id
152 | p_employee_id - contains the employee id
153 | p_cost_center - contains the expense report cost center
154 | p_exp_type_parameter_id - contains the expense type parameter id
155 | p_segments - contains the expense report line segments
156 | p_ccid - NULL in this case
157 | p_build_mode - AP_WEB_ACCTG_PKG.C_VALIDATE
158 | p_new_segments - returns the new expense report line segments
159 | p_new_ccid - returns the new expense report line code combination id
160 | p_return_error_message - returns any error message if an error occurred
161 |
162 |
163 | When Expense Entry Allocations is disabled:
164 | (1) Expenses Workflow AP Server Side Validation
165 |
166 | PARAMETERS
167 | p_report_header_id - contains report header id
168 | p_report_line_id - contains report line id
169 | p_employee_id - contains the employee id
170 | p_cost_center - contains the expense report cost center
171 | p_exp_type_parameter_id - contains the expense type parameter id
172 | p_segments - NULL in this case
173 | p_ccid - NULL in this case
174 | p_build_mode - AP_WEB_ACCTG_PKG.C_DEFAULT_VALIDATE
175 | p_new_segments - returns the new expense report line segments
176 | p_new_ccid - returns the new expense report line code combination id
177 | p_return_error_message - returns any error message if an error occurred
178 |
179 |
180 | When Expense Type is changed by Auditor:
181 | (1) Expenses Audit
182 |
183 | PARAMETERS
184 | p_report_header_id - contains report header id
185 | p_report_line_id - contains report line id
186 | p_employee_id - contains the employee id
187 | p_cost_center - contains the expense report cost center
188 | p_exp_type_parameter_id - contains the expense type parameter id
189 | p_segments - NULL in this case
190 | p_ccid - contains the expense report line code combination id
191 | p_build_mode - AP_WEB_ACCTG_PKG.C_BUILD_VALIDATE
192 | p_new_segments - returns the new expense report line segments
193 | p_new_ccid - returns the new expense report line code combination id
194 | p_return_error_message - returns any error message if an error occurred
195 |
196 |
197 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
198 |
199 | RETURNS
200 | True if BuildAccount was customized
201 | False if BuildAccount was NOT customized
202 |
203 |
204 | MODIFICATION HISTORY
205 | Date Author Description of Changes
206 | 12-Aug-2005 R Langi Created
207 |
208 *=======================================================================*/
209
210 FUNCTION BuildAccount(
211 p_report_header_id IN NUMBER,
212 p_report_line_id IN NUMBER,
213 p_employee_id IN NUMBER,
214 p_cost_center IN VARCHAR2,
215 p_exp_type_parameter_id IN NUMBER,
216 p_segments IN AP_OIE_KFF_SEGMENTS_T,
217 p_ccid IN NUMBER,
218 p_build_mode IN VARCHAR2,
219 p_new_segments OUT NOCOPY AP_OIE_KFF_SEGMENTS_T,
220 p_new_ccid OUT NOCOPY NUMBER,
221 p_return_error_message OUT NOCOPY VARCHAR2) RETURN BOOLEAN
222 IS
223
224 BEGIN
225
226 /*
227 --
228 -- Insert logic to populate segments here
229 --
230
231 --
232 -- Insert logic to validate segments here
233 --
234
235 --
236 -- Insert logic to generate CCID here
237 --
238
239 return TRUE;
240 */
241 return FALSE;
242
243
244
245 END BuildAccount;
246
247
248 /*========================================================================
249 | PUBLIC FUNCTION BuildDistProjectAccount
250 |
251 | DESCRIPTION
252 | This function provides a client extension to Internet Expenses
253 | for getting account code combinations for projects related expense line.
254 |
255 | Internet Expenses gets account code combinations for projects related
256 | expense line as follows:
257 |
258 | (1) Calls AP_WEB_PROJECT_PKG.ValidatePATransaction
259 | (2) Calls pa_acc_gen_wf_pkg.ap_er_generate_account
260 |
261 | This procedure returns the validated segments and CCID.
262 |
263 |
264 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
265 |
266 | Called from the following for projects related expense lines:
267 | (1) Expenses Workflow AP Server Side Validation
268 |
269 | PARAMETERS
270 | p_report_header_id - contains report header id
271 | p_report_line_id - contains report line id
272 | p_report_distribution_id - contains the expense report distribution identifier
273 | p_exp_type_parameter_id - contains the expense type parameter id
274 | p_new_segments - returns the new expense report line segments
275 | p_new_ccid - returns the new expense report line code combination id
276 | p_return_error_message - returns any error message if an error occurred
277 | p_return_status - returns either 'SUCCESS', 'ERROR', 'VALIDATION_ERROR', 'GENERATION_ERROR'
278 |
279 |
280 | When Expense Type is changed by Auditor:
281 | (1) Expenses Audit
282 |
283 | PARAMETERS
284 | p_report_header_id - contains report header id
285 | p_report_line_id - contains report line id
286 | p_report_distribution_id - contains the expense report distribution identifier
287 | p_exp_type_parameter_id - contains the expense type parameter id
288 | p_new_segments - returns the new expense report line segments
289 | p_new_ccid - returns the new expense report line code combination id
290 | p_return_error_message - returns any error message if an error occurred
291 | p_return_status - returns either 'SUCCESS', 'ERROR', 'VALIDATION_ERROR', 'GENERATION_ERROR'
292 |
293 |
294 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
295 |
296 | RETURNS
297 | True if BuildProjectAccount was customized
298 | False if BuildProjectAccount was NOT customized
299 |
300 |
301 | MODIFICATION HISTORY
302 | Date Author Description of Changes
303 | 12-Aug-2005 R Langi Created
304 |
305 *=======================================================================*/
306 FUNCTION BuildDistProjectAccount(
307 p_report_header_id IN NUMBER,
308 p_report_line_id IN NUMBER,
309 p_report_distribution_id IN NUMBER,
310 p_exp_type_parameter_id IN NUMBER,
311 p_new_segments OUT NOCOPY AP_OIE_KFF_SEGMENTS_T,
312 p_new_ccid OUT NOCOPY NUMBER,
313 p_return_error_message OUT NOCOPY VARCHAR2,
314 p_return_status OUT NOCOPY VARCHAR2) RETURN BOOLEAN
315
316 IS
317
318
319 BEGIN
320
321 /*
322 --
323 -- Insert logic to populate segments here
324 --
325
326 --
327 -- Insert logic to validate segments here
328 --
329
330 --
331 -- Insert logic to generate CCID here
332 --
333
334 return TRUE;
335 */
336 return FALSE;
337
338 END BuildDistProjectAccount;
339
343 | DESCRIPTION
340 /*========================================================================
341 | PUBLIC FUNCTION CustomValidateProjectDist
342 |
344 | This function provides a client extension to Internet Expenses
345 | to validate Project Task and Award. Introduced for fix: 7176464
346 |
347 |
348 | PARAMETERS
349 | p_report_line_id - contains report line id
350 | p_web_parameter_id - contains the expense type parameter id
351 | p_project_id - contains the Id of the Project entered in Allocations
352 | p_task_id - contains the Id of the Task entered in Allocations
353 | p_award_id - contains the Id of the Award entered in Allocations
354 | p_expenditure_org_id - contains the Id of the Project Expenditure Organization entered in Allocations
355 | p_amount - contains the amount entered on the distribution
356 | p_return_error_message - returns any error message if an error occurred
357 |
358 |
359 | RETURNS
360 | True if CustomValidateProjectDist was customized
361 | False if CustomValidateProjectDist was NOT customized
362 |
363 |
364 | MODIFICATION HISTORY
365 | Date Author Description of Changes
366 | 01-JUL-2008 Rajesh Velicheti Created
367 |
368 *=======================================================================*/
369
370 FUNCTION CustomValidateProjectDist(
371 p_report_line_id IN NUMBER,
372 p_web_parameter_id IN NUMBER,
373 p_project_id IN NUMBER,
374 p_task_id IN NUMBER,
375 p_award_id IN NUMBER,
376 p_expenditure_org_id IN NUMBER,
377 p_amount IN NUMBER,
378 p_return_error_message OUT NOCOPY VARCHAR2) RETURN BOOLEAN
379 IS
380
381 BEGIN
382
383 /*
384 -- Insert logic to validate Project, Task and Award.
385 -- Error messages if any should be populated in p_return_error_message
386
387 return TRUE;
388 */
389 return FALSE;
390
391 END CustomValidateProjectDist;
392
393
394 END AP_WEB_CUS_ACCTG_PKG;