DBA Data[Home] [Help]

PACKAGE: APPS.JAI_BOE_MIGRATION_PKG

Source


1 PACKAGE jai_boe_migration_pkg  AUTHID CURRENT_USER AS
2 /* $Header: jai_boe_migrate.pls 120.1 2011/03/24 06:46:20 wenzhou noship $ */
3 
4   TYPE dedicate_dtls_summary_type IS RECORD(
5      BOE_ID                    NUMBER
6     ,total_tax_amount          NUMBER
7     ,customs                   NUMBER
8     ,additional_customs_duty   NUMBER
9     ,surcharge_duty            NUMBER
10     ,cvd_education_cess        NUMBER
11     ,customs_edu_cess          NUMBER
12     ,additional_CVD            NUMBER
13     ,customs_sh_education_cess NUMBER
14     ,cvd_sh_edu_cess           NUMBER);
15 
16   invalid_tax_category_tax_type EXCEPTION;
17 
18   --==========================================================================
19 
20   --  FUNCTION NAME:
21 
22   --
23 
24   --    boe_batch_migration                         Public
25 
26   --
27 
28   --  DESCRIPTION:
29   --
30 
31   --    This procedure will be called by the concurrent to do batch migration
32   --for dedicate BOEs.
33   --
34 
35   --  PARAMETERS:
36 
37   --      In: pv_migration_type  migration type, 'All', 'Unapplied' or 'None'
38 
39   --      In: pd_migration_date GL date for create accounting entry.
40 
41   --     Out: errbuf  used for concurrent
42 
43   --     Out: retcode used for concurrent
44 
45   --  DESIGN REFERENCES:
46 
47   --
48 
49   --  CHANGE HISTORY:
50 
51   --
52 
53   --=========================================================================
54   PROCEDURE boe_batch_migration
55   (
56     errbuf OUT NOCOPY VARCHAR2
57    ,retcode OUT NOCOPY VARCHAR2
58    ,pv_migration_type IN VARCHAR2
59    ,pv_migration_date IN VARCHAR2
60   );
61   --==========================================================================
62 
63   --  FUNCTION NAME:
64 
65   --
66 
67   --    boe_migration                         Private
68 
69   --
70 
71   --  DESCRIPTION:
72   --
73 
74   --    This procedure will process the BOE migration for one BOE record.
75   --
76 
77   --  PARAMETERS:
78 
79   --      In: pn_boe_id  The BOE_ID that need to be processed.
80 
81   --      In: pn_tax_category Tax category id which cover all the tax
82   --          types in dedicate BOE dtls.
83 
84   --      In: pv_migration_type  migration type, 'All', 'Unapplied' or 'None'
85 
86   --      In: pd_migration_date GL date for create accounting entry.
87 
88   --  DESIGN REFERENCES:
89 
90   --
91 
92   --  CHANGE HISTORY:
93 
94   --
95 
96   --=========================================================================
97   PROCEDURE boe_migration
98   (
99     pn_org_id         IN NUMBER
100    ,pn_boe_id         IN NUMBER
101    ,pn_tax_category   IN NUMBER
102    ,pv_migration_type IN VARCHAR2
103    ,pd_migration_date IN DATE
104   );
105     --==========================================================================
106 
107   --  PROCEDURE NAME:
108 
109   --
110 
111   --    update_boe_hdr                         Private
112 
113   --
114 
115   --  DESCRIPTION:
116   --
117 
118   --    This procedure will process the BOE migration for one BOE record.
119   --
120 
121   --  PARAMETERS:
122 
123   --      In: pn_boe_id  The BOE_ID that need to be updated.
124 
125   --      In: pn_amount_applied The applied amount of this BOE.
126 
127   --      In: pv_invoice_num  The BOE invoice num of this BOE.
128 
129   --  DESIGN REFERENCES:
130 
131   --
132 
133   --  CHANGE HISTORY:
134 
135   --
136 
137   --=========================================================================
138   PROCEDURE update_boe_hdr
139   (
140     pn_boe_id         IN NUMBER
141    ,pn_org_id         IN NUMBER
142    ,pn_amount_applied IN NUMBER
143    ,pv_invoice_num    IN VARCHAR2
144   );
145    --==========================================================================
146 
147   --  PROCEDURE NAME:
148 
149   --
150 
151   --    merge_boe_details                         Private
152 
153   --
154 
155   --  DESCRIPTION:
156   --
157 
158   --    This procedure will process the dedicate BOE details and merge them
159   --    dependends on the consolidate flag.
160 
161   --  PARAMETERS:
162 
163   --      In: pn_boe_id  The BOE_ID that need to be updated.
164 
165   --      In: pn_tax_category_id The applied amount of this BOE.
166 
167   --      In: pv_consolidate_flag  'Y': item independent BOE
168 
169   --                               'N': item based BOE
170 
171   --      in pn_percentage     The percentage of applied amount in total BOE amount.
172 
173   --  DESIGN REFERENCES:
174 
175   --
176 
177   --  CHANGE HISTORY:
178 
179   --
180 
181   --=========================================================================
182   PROCEDURE merge_boe_details
183   (
184     pn_boe_id           IN NUMBER
185    ,pn_tax_category_id  IN NUMBER
186    ,pv_consolidate_flag IN VARCHAR2
187    ,pn_percentage       NUMBER
188   );
189   --==========================================================================
190 
191   --  PROCEDURE NAME:
192 
193   --
194 
195   --    merge_consolidate_boe_details                         Private
196 
197   --
198 
199   --  DESCRIPTION:
200   --
201 
202   --    This procedure will process the item independent BOE details
203   --    and merge them into one BOE detail line.
204 
205   --  PARAMETERS:
206 
207   --      In: pn_boe_id  The BOE_ID that need to be updated.
208 
209   --      In: pn_tax_category_id The applied amount of this BOE.
210 
211   --      in pn_percentage   The percentage of applied amount in total BOE amount.
212 
213   --  DESIGN REFERENCES:
214 
215   --
216 
217   --  CHANGE HISTORY:
218 
219   --
220 
221   --=========================================================================
222   PROCEDURE merge_consolidate_boe_details
223   (
224     pn_boe_id          IN NUMBER
225    ,pn_tax_category_id IN NUMBER
226    ,pn_percentage      IN NUMBER
227   );
228   --==========================================================================
229 
230   --  PROCEDURE NAME:
231 
232   --
233 
234   --    merge_item_boe_details                         Private
235 
236   --
237 
238   --  DESCRIPTION:
239   --
240 
241   --    This procedure will process the item based BOE details
242   --    group by item_id and merge the same items into one BOE detail line.
243 
244   --  PARAMETERS:
245 
246   --      In: pn_boe_id  The BOE_ID that need to be updated.
247 
248   --      In: pn_tax_category_id The applied amount of this BOE.
249 
250   --      in pn_percentage   The percentage of applied amount in total BOE amount.
251 
252   --  DESIGN REFERENCES:
253 
254   --
255 
256   --  CHANGE HISTORY:
257 
258   --
259 
260   --=========================================================================
261   PROCEDURE merge_item_boe_details
262   (
263     pn_boe_id          IN NUMBER
264    ,pn_tax_category_id IN NUMBER
265    ,pn_percentage      IN NUMBER
266   );
267  --==========================================================================
268 
269   --  PROCEDURE NAME:
270 
271   --
272 
273   --    insert_boe_detail                         Private
274 
275   --
276 
277   --  DESCRIPTION:
278   --
279 
280   --    This procedure will insert a record into jai_boe_details table.
281 
282   --  PARAMETERS:
283 
284   --      In: p_boe_detail_rec  The BOE Detail line that need to be inserted.
285 
286 
287   --  DESIGN REFERENCES:
288 
289   --
290 
291   --  CHANGE HISTORY:
292 
293   --
294 
295   --=========================================================================
296   PROCEDURE insert_boe_detail(p_boe_detail_rec IN JAI_BOE_DETAILS%ROWTYPE);
297 --==========================================================================
298 
299   --  PROCEDURE NAME:
300 
301   --
302 
303   --    insert_boe_detail_tax                         Private
304 
305   --
306 
307   --  DESCRIPTION:
308   --
309 
310   --    This procedure will insert a record into JAI_BOE_DETAIL_TAXES table.
311 
312   --  PARAMETERS:
313 
314   --      In: p_boe_detail_tax_rec  The BOE Detail Tax that need to be inserted.
315 
316 
317   --  DESIGN REFERENCES:
318 
319   --
320 
321   --  CHANGE HISTORY:
322 
323   --
324 
325   --=========================================================================
326   PROCEDURE insert_boe_detail_tax(p_boe_detail_tax_rec IN JAI_BOE_DETAIL_TAXES%ROWTYPE);
327  --==========================================================================
328 
329   --  PROCEDURE NAME:
330 
331   --
332 
333   --    insert_boe_rounding                         Private
334 
335   --
336 
337   --  DESCRIPTION:
338   --
339 
340   --    This procedure will insert a record into JAI_BOE_ROUNDINGS table.
341 
342   --  PARAMETERS:
343 
344   --      In: pn_boe_id  The BOE id which need insert boe rounding records.
345 
346 
347   --  DESIGN REFERENCES:
348 
349   --
350 
351   --  CHANGE HISTORY:
352 
353   --
354 
355   --=========================================================================
356   PROCEDURE insert_boe_rounding(pn_boe_id IN NUMBER);
357  --==========================================================================
358 
359   --  PROCEDURE NAME:
360 
361   --
362 
363   --    get_tax_id                         Private
364 
365   --
366 
367   --  DESCRIPTION:
368   --
369 
370   --    This procedure will get tax id based on the tax_category_id and tax_type.
371 
372   --  PARAMETERS:
373 
374   --      In: pn_tax_category_id  The tax category id.
375 
376   --      In: pv_tax_type  The tax type code.
377 
378   --      Out: pn_tax_id  tax id that based on the input parameters.
379 
380 
381   --  DESIGN REFERENCES:
382 
383   --
384 
385   --  CHANGE HISTORY:
386 
387   --
388 
389   --=========================================================================
390   PROCEDURE get_tax_id
391   (
392     pn_tax_category_id IN NUMBER
393    ,pv_tax_type        IN VARCHAR2
394    ,xn_tax_id          OUT NOCOPY NUMBER
395   );
396   --==========================================================================
397 
398   --  PROCEDURE NAME:
399 
400   --
401 
402   --    insert_tax_wise_data                         Private
403 
404   --
405 
406   --  DESCRIPTION:
407   --
408 
409   --    This procedure will insert tax wise data into DB.
410 
411   --  PARAMETERS:
412 
413   --      In: pn_tax_category_id  The tax category id.
414 
415   --      In: pv_tax_type  The tax type code.
416 
417   --      In: pn_boe_detail_id  The boe detail id that the taxes data associated.
418 
419   --      In: pn_boe_tax_line_num The boe tax line number.
420 
421   --      In: pn_tax_amount The tax amount of this tax id.
422 
423   --      In: pn_tax_applied_amount  The applied tax amount of this tax id.
424 
425   --  DESIGN REFERENCES:
426 
427   --
428 
429   --  CHANGE HISTORY:
430 
431   --
432 
433   --=========================================================================
434   PROCEDURE insert_tax_wise_data
435   (
436     pn_tax_category_id    IN NUMBER
437    ,pv_tax_type           IN VARCHAR2
438    ,pn_boe_detail_id      IN NUMBER
439    ,pn_boe_tax_line_num   IN NUMBER
440    ,pn_tax_amount         IN NUMBER
441    ,pn_tax_applied_amount IN NUMBER
442   );
443  --==========================================================================
444 
445   --  PROCEDURE NAME:
446 
447   --
448 
449   --    details_split                         Private
450 
451   --
452 
453   --  DESCRIPTION:
454   --
455 
456   --    This procedure will split the dedicate BOE dettails into serveral
457   --    detail taxes based on the tax amount the dedicate details have.
458 
459   --  PARAMETERS:
460 
461   --      In: dedicate_dtl_rec  The dedicate detail record.
462 
463   --      In: pn_tax_category_id  The tax category id.
464 
465   --      In: pn_boe_detail_id  The boe detail id that the taxes data associated.
466 
467   --      In: pn_applied_percentage The percentage of applied amount.
468 
469   --  DESIGN REFERENCES:
470 
471   --
472 
473   --  CHANGE HISTORY:
474 
475   --
476 
477   --=========================================================================
478   PROCEDURE details_split
479   (
480     dedicate_dtl_rec      dedicate_dtls_summary_type
481    ,pn_tax_category_id    NUMBER
482    ,pn_boe_detail_id      NUMBER
483    ,pn_applied_percentage NUMBER
484   );
485 --==========================================================================
486 
487   --  PROCEDURE NAME:
488 
489   --
490 
491   --    validation_boe                         Private
492 
493   --
494 
495   --  DESCRIPTION:
496   --
497 
498   --    This procedure will do validation for the input parameters.
499 
500 
501   --  PARAMETERS:
502 
503   --      In: pn_boe_id  The Id of dedicate BOE.
504 
505   --      In: pn_tax_category_id  The tax category id.
506 
507   --      In: pv_migration_type  migration type for indicating if process accounting.
508 
509   --      In: pd_migration_date The GL date for creating accounting entries.
510 
511   --      Out: xv_valid_flag Indicate that whether the parameters are valid.
512 
513   --  DESIGN REFERENCES:
514 
515   --
516 
517   --  CHANGE HISTORY:
518 
519   --
520 
521   --=========================================================================
522   PROCEDURE validation_boe
523   (
524     pn_org_id          IN NUMBER
525    ,pn_boe_id          IN NUMBER
526    ,pn_tax_category_id IN NUMBER
527    ,xv_valid_flag      OUT NOCOPY VARCHAR2
528   );
529 
530    --==========================================================================
531 
532   --  PROCEDURE NAME:
533 
534   --
535 
536   --    is_boe_tax_category                         Private
537 
538   --
539 
540   --  DESCRIPTION:
541   --
542 
543   --    This procedure will check if the tax codes that the cateogry covered are BOE taxes,
544 
545   --    and only one tax code for each tax type.
546 
547 
548   --  PARAMETERS:
549 
550   --      In: pn_tax_category_id  The tax category id.
551 
552   --      Out: xv_valid_flag Indicate that whether the tax category id is valid.
553 
554   --  DESIGN REFERENCES:
555 
556   --
557 
558   --  CHANGE HISTORY:
559 
560   --
561 
562   --=========================================================================
563   PROCEDURE IS_BOE_TAX_Category
564   (
565     pn_tax_category_id IN NUMBER
566    ,xv_valid_flag      OUT NOCOPY VARCHAR2
567   );
568 --==========================================================================
569 
570   --  PROCEDURE NAME:
571 
572   --
573 
574   --    is_boe_tax_category                         Private
575 
576   --
577 
578   --  DESCRIPTION:
579   --
580 
581   --    This procedure will check if the provided date is in open period.
582 
583 
584 
585   --  PARAMETERS:
586 
587   --      In: pd_date  The GL date to be checked.
588 
589   --      In: pn_ou_id  The org id of the BOE.
590 
591   --      Out: xv_open_flag Indicate that whether the GL date is in open period.
592 
593   --  DESIGN REFERENCES:
594 
595   --
596 
597   --  CHANGE HISTORY:
598 
599   --
600 
601   --=========================================================================
602   PROCEDURE is_in_open_period
603   (
604     pd_date      DATE
605    ,pn_ou_id     NUMBER
606    ,xv_open_flag OUT NOCOPY VARCHAR2
607   );
608 --==========================================================================
609 
610   --  PROCEDURE NAME:
611 
612   --
613 
614   --    accounting_migration                         Private
615 
616   --
617 
618   --  DESCRIPTION:
619   --
620 
621   --    This procedure will migrate accounting entries for the BOE..
622 
623 
624 
625   --  PARAMETERS:
626 
627   --      In: pn_boe_id  The BOE_ID that need to do accounting migration.
628 
629   --      In: pn_availabe_boe_amount  The available BOE amount that need to be migrated.
630 
631   --      Out: pd_migration_date The GL date for creating GL entries.
632 
633   --  DESIGN REFERENCES:
634 
635   --
636 
637   --  CHANGE HISTORY:
638 
639   --
640 
641   --=========================================================================
642   PROCEDURE accounting_migration
643   (
644     pn_boe_id              NUMBER
645    ,pn_availabe_boe_amount NUMBER
646    ,pd_migration_date      DATE
647   );
648 END jai_boe_migration_pkg;