DBA Data[Home] [Help]

PACKAGE BODY: APPS.MTL_BILLING_LINES_PKG

Source


1 package body mtl_billing_lines_pkg AS
2 /* $Header: INVBLINB.pls 120.1 2010/05/25 10:54:51 damahaja noship $ */
3 
4   procedure INSERT_ROW(
5        x_billing_rule_line_id IN NUMBER ,
6        x_billing_rule_header_id IN NUMBER ,
7        x_client_code IN VARCHAR2 ,
8        x_client_number IN VARCHAR2 ,
9        x_service_agreement_line_id IN NUMBER ,
10        x_inventory_item_id IN NUMBER ,
11        x_billing_source_id IN NUMBER ,
12        x_creation_date IN DATE ,
13        x_created_by IN NUMBER,
14        x_last_update_date IN DATE,
15        x_last_updated_by IN NUMBER ,
16        x_last_update_login IN NUMBER
17   ) AS
18 
19   BEGIN
20 
21          INSERT INTO mtl_billing_rule_lines
22           (   billing_rule_line_id,
23               billing_rule_header_id ,
24               client_code ,
25               client_number  ,
26               service_agreement_line_id ,
27               inventory_item_id,
28               billing_source_id ,
29               creation_date ,
30               created_by ,
31               last_update_date ,
32               last_updated_by ,
33               last_update_login
34           )
35           VALUES
36           (  x_billing_rule_line_id,
37               x_billing_rule_header_id ,
38               x_client_code ,
39               x_client_number  ,
40               x_service_agreement_line_id ,
41               x_inventory_item_id ,
42               x_billing_source_id ,
43               x_last_update_date , -- x_creation_date ,
44               x_last_updated_by ,--x_created_by ,
45               x_last_update_date ,
46               x_last_updated_by ,
47               x_last_update_login
48           );
49 
50 
51         -- commit;
52   END INSERT_ROW;
53 
54 procedure UPDATE_ROW(
55        x_billing_rule_line_id IN NUMBER ,
56        x_billing_rule_header_id IN NUMBER ,
57        x_client_code IN VARCHAR2 ,
58        x_client_number IN VARCHAR2 ,
59        x_service_agreement_line_id IN NUMBER ,
60        x_inventory_item_id IN NUMBER ,
61        x_billing_source_id IN NUMBER ,
62        x_creation_date IN DATE ,
63        x_created_by IN NUMBER,
64        x_last_update_date IN DATE,
65        x_last_updated_by IN NUMBER ,
66        x_last_update_login IN NUMBER
67 
68   ) AS
69 
70   l_billing_rule_line_id NUMBER;
71 
72  BEGIN
73 
74   IF x_billing_rule_line_id IS NULL
75     THEN
76 
77 
78        INSERT INTO mtl_billing_rule_lines
79           (   billing_rule_line_id,
80               billing_rule_header_id ,
81               client_code ,
82               client_number  ,
83               service_agreement_line_id ,
84               inventory_item_id,
85               billing_source_id ,
86               creation_date ,
87               created_by ,
88               last_update_date ,
89               last_updated_by ,
90               last_update_login
91           )
92           VALUES
93           (   x_billing_rule_line_id,
94               x_billing_rule_header_id ,
95               x_client_code ,
96               x_client_number  ,
97               x_service_agreement_line_id ,
98               x_inventory_item_id,
99               x_billing_source_id,
100               x_last_update_date, -- x_creation_date ,
101               x_last_updated_by, --x_created_by ,
102               x_last_update_date ,
103               x_last_updated_by ,
104               x_last_update_login
105           );
106 
107 
108           RETURN;
109 
110    ELSE
111 
112   update mtl_billing_rule_lines set
113              billing_rule_header_id = x_billing_rule_header_id,
114              client_code = x_client_code,
115              client_number = x_client_number,
116              service_agreement_line_id = x_service_agreement_line_id,
117              billing_source_id = x_billing_source_id,
118              last_update_date = x_last_update_date,
119              last_updated_by = x_last_updated_by,
120              last_update_login = x_last_update_login
121     where billing_rule_line_id = x_billing_rule_line_id;
122 
123       if (sql%notfound) then
124           raise no_data_found;
125       end IF;
126 
127     END IF;
128 END UPDATE_ROW;
129 
130 
131 procedure DELETE_ROW (
132   x_billing_rule_line_id in NUMBER
133 ) is
134 BEGIN
135 
136   delete from mtl_billing_rule_lines
137   where billing_rule_line_id = x_billing_rule_line_id;
138 
139   if (sql%notfound) then
140     raise no_data_found;
141   end if;
142 
143 end DELETE_ROW;
144 
145 
146 procedure LOCK_ROW (
147        x_billing_rule_line_id IN NUMBER ,
148        x_billing_rule_header_id IN NUMBER ,
149        x_client_code IN VARCHAR2 ,
150        x_client_number IN VARCHAR2 ,
151        x_service_agreement_line_id IN NUMBER ,
152        x_inventory_item_id IN NUMBER ,
153        x_billing_source_id IN NUMBER ,
154        x_creation_date IN DATE ,
155        x_created_by IN NUMBER,
156        x_last_update_date IN DATE,
157        x_last_updated_by IN NUMBER ,
158        x_last_update_login IN NUMBER
159   ) AS
160 
161    l_billing_rule_line_id NUMBER;
162 
163   cursor c is SELECT
164               billing_rule_line_id,
165               billing_rule_header_id ,
166               client_code ,
167               client_number  ,
168               service_agreement_line_id ,
169               inventory_item_id,
170               billing_source_id  ,
171               creation_date ,
172               created_by ,
173               last_update_date ,
174               last_updated_by ,
175               last_update_login
176     from mtl_billing_rule_lines
177     where billing_rule_line_id = x_billing_rule_line_id
178     for update of billing_rule_line_id nowait;
179 
180   recinfo c%rowtype;
181 
182 BEGIN
183 
184   IF x_billing_rule_line_id IS NULL
185     THEN
186     NULL;
187   ELSE
188       open c;
189       fetch c into recinfo;
190       if (c%notfound) then
191         close c;
192         fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
193         app_exception.raise_exception;
194       end if;
195       close c;
196       if (
197           (recinfo.billing_rule_line_id = x_billing_rule_line_id)
198           AND (recinfo.service_agreement_line_id = X_service_agreement_line_id)
199          )
200           then
201         null;
202         else
203         fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
204         app_exception.raise_exception;
205         end if;
206   END IF;
207 
208 return;
209 end LOCK_ROW;
210 
211 END;