[Home] [Help]
PACKAGE BODY: APPS.FA_MASSADD_DIST_PKG
Source
1 PACKAGE BODY FA_MASSADD_DIST_PKG as
2 /* $Header: faxmadtb.pls 120.4 2009/03/27 03:59:04 bridgway ship $ */
3
4 PROCEDURE DIST_SET (X_name varchar2,
5 X_total_units number,
6 X_mass_addition_id number,
7 X_success out nocopy boolean, p_log_level_rec IN FA_API_TYPES.log_level_rec_type) IS
8
9 h_unit_percentage number;
10 h_dist_units number;
11 h_ccid number;
12 h_location_id number;
13 h_employee_id number;
14 h_massadd_dist_id number;
15
16 cursor dist_defaults is
17 select dd.unit_percentage, dd.deprn_expense_ccid,
18 dd.location_id, dd.employee_id
19 from fa_distribution_sets ds, fa_distribution_defaults dd
20 where ds.name = X_name
21 and ds.dist_set_id = dd.dist_set_id;
22
23 begin
24 X_success := FALSE;
25
26 delete from fa_massadd_distributions
27 where mass_addition_id = X_mass_addition_id;
28
29 open dist_defaults;
30 loop
31 fetch dist_defaults into
32 h_unit_percentage, h_ccid, h_location_id, h_employee_id;
33
34 if (dist_defaults%NOTFOUND) then exit; end if;
35
36 h_dist_units := X_total_units * h_unit_percentage / 100;
37
38 select fa_massadd_distributions_s.nextval
39 into h_massadd_dist_id from dual;
40
41 insert into fa_massadd_distributions (
42 massadd_dist_id, mass_addition_id, units,
43 deprn_expense_ccid, location_id, employee_id) values (
44 h_massadd_dist_id, X_mass_addition_id, h_dist_units,
45 h_ccid, h_location_id, h_employee_id);
46 end loop;
47 -- commit;
48 X_success := TRUE;
49
50 exception when others then
51 app_exception.raise_exception;
52
53 end dist_set;
54
55
56 PROCEDURE SAVEPT IS
57 begin
58 savepoint distset;
59 end savept;
60
61 PROCEDURE ROLLBK IS
62 begin
63
64 rollback to savepoint distset;
65
66 end rollbk;
67
68 END FA_MASSADD_DIST_PKG;