1: package body jg_zz_vat_rep_entities_pkg as
2: /*$Header: jgzzvreb.pls 120.3.12010000.2 2008/12/01 13:49:59 rshergil ship $*/
3: /* CHANGE HISTORY ------------------------------------------------------------------------------------------
4: DATE AUTHOR VERSION BUG NO. DESCRIPTION
5: (DD/MM/YYYY) (UID)
4: DATE AUTHOR VERSION BUG NO. DESCRIPTION
5: (DD/MM/YYYY) (UID)
6: ------------------------------------------------------------------------------------------------------------
7: 23/3/2006 BRATHOD 120.1 As per the change in approach new columns are
8: added to jg_zz_vat_rep_entities table. API is
9: modified to support these new columns
10:
11: 23/6/2006 BRATHOD 120.2 5166688 Modified the signature of INSERT_ROW procedure in
12: to return rowid to caller of API by adding out
16: Date code as well.Refer Bug # 5398572 for details.
17: -----------------------------------------------------------------------------------------------------------*/
18:
19: procedure insert_row
20: ( x_record in jg_zz_vat_rep_entities%rowtype
21: , x_vat_reporting_entity_id out nocopy jg_zz_vat_rep_entities.vat_reporting_entity_id%type
22: , x_row_id out nocopy rowid
23: )
24: is
17: -----------------------------------------------------------------------------------------------------------*/
18:
19: procedure insert_row
20: ( x_record in jg_zz_vat_rep_entities%rowtype
21: , x_vat_reporting_entity_id out nocopy jg_zz_vat_rep_entities.vat_reporting_entity_id%type
22: , x_row_id out nocopy rowid
23: )
24: is
25:
24: is
25:
26: cursor c_gen_vat_reporting_entity_id
27: is
28: select jg_zz_vat_rep_entities_s.nextval
29: from dual;
30:
31: lv_entity_type_code jg_zz_vat_rep_entities.entity_type_code%type;
32:
27: is
28: select jg_zz_vat_rep_entities_s.nextval
29: from dual;
30:
31: lv_entity_type_code jg_zz_vat_rep_entities.entity_type_code%type;
32:
33: begin
34:
35: if x_record.vat_reporting_entity_id is null then
57: /* Use entity_type_code available in API argument */
58: lv_entity_type_code := x_record.entity_type_code ;
59: end if;
60:
61: insert into jg_zz_vat_rep_entities
62: ( vat_reporting_entity_id
63: , legal_entity_id
64: , party_id
65: , tax_regime_code
108: , x_record.driving_date_code
109: ) returning rowid into x_row_id ;
110:
111: if x_record.entity_identifier is null then
112: jg_zz_vat_rep_entities_pkg.update_entity_identifier
113: ( pn_vat_reporting_entity_id => x_vat_reporting_entity_id
114: , pv_entity_level_code => null
115: , pn_ledger_id => null
116: , pv_balancing_segment_value => null
128: /*------------------------------------------------------------------------------------------------------------*/
129:
130: procedure lock_row
131: ( x_row_id in rowid
132: , x_record in jg_zz_vat_rep_entities%rowtype
133: )
134: is
135:
136: cursor c_locked_row is
134: is
135:
136: cursor c_locked_row is
137: select jzvrc.*
138: from jg_zz_vat_rep_entities jzvrc
139: where rowid = x_row_id
140: for update nowait;
141:
142: lr_locked_row JG_ZZ_VAT_REP_ENTITIES%rowtype;
138: from jg_zz_vat_rep_entities jzvrc
139: where rowid = x_row_id
140: for update nowait;
141:
142: lr_locked_row JG_ZZ_VAT_REP_ENTITIES%rowtype;
143:
144: begin
145:
146: open c_locked_row;
180: end lock_row;
181:
182: /*------------------------------------------------------------------------------------------------------------*/
183:
184: procedure update_row( x_record in jg_zz_vat_rep_entities%rowtype
185: )
186: is
187:
188: le_no_rows_updated exception;
188: le_no_rows_updated exception;
189:
190: begin
191:
192: update jg_zz_vat_rep_entities
193: set legal_entity_id = x_record.legal_entity_id
194: , party_id = x_record.party_id
195: , tax_regime_code = x_record.tax_regime_code
196: , tax_registration_number = x_record.tax_registration_number
218: end update_row;
219:
220: /*------------------------------------------------------------------------------------------------------------*/
221:
222: procedure delete_row(x_vat_reporting_entity_id in jg_zz_vat_rep_entities.vat_reporting_entity_id%type)
223: is
224: le_no_rows_deleted exception;
225: begin
226:
223: is
224: le_no_rows_deleted exception;
225: begin
226:
227: delete from jg_zz_vat_rep_entities
228: where vat_reporting_entity_id = x_vat_reporting_entity_id;
229:
230: end delete_row;
231:
231:
232: /*------------------------------------------------------------------------------------------------------------*/
233:
234: procedure update_entity_identifier
235: ( pn_vat_reporting_entity_id in jg_zz_vat_rep_entities.vat_reporting_entity_id%type
236: , pv_entity_level_code in jg_zz_vat_rep_entities.entity_level_code%type default null
237: , pn_ledger_id in jg_zz_vat_rep_entities.ledger_id%type default null
238: , pv_balancing_segment_value in jg_zz_vat_rep_entities.balancing_segment_value%type default null
239: , pv_called_from in varchar2
232: /*------------------------------------------------------------------------------------------------------------*/
233:
234: procedure update_entity_identifier
235: ( pn_vat_reporting_entity_id in jg_zz_vat_rep_entities.vat_reporting_entity_id%type
236: , pv_entity_level_code in jg_zz_vat_rep_entities.entity_level_code%type default null
237: , pn_ledger_id in jg_zz_vat_rep_entities.ledger_id%type default null
238: , pv_balancing_segment_value in jg_zz_vat_rep_entities.balancing_segment_value%type default null
239: , pv_called_from in varchar2
240: )
233:
234: procedure update_entity_identifier
235: ( pn_vat_reporting_entity_id in jg_zz_vat_rep_entities.vat_reporting_entity_id%type
236: , pv_entity_level_code in jg_zz_vat_rep_entities.entity_level_code%type default null
237: , pn_ledger_id in jg_zz_vat_rep_entities.ledger_id%type default null
238: , pv_balancing_segment_value in jg_zz_vat_rep_entities.balancing_segment_value%type default null
239: , pv_called_from in varchar2
240: )
241: is
234: procedure update_entity_identifier
235: ( pn_vat_reporting_entity_id in jg_zz_vat_rep_entities.vat_reporting_entity_id%type
236: , pv_entity_level_code in jg_zz_vat_rep_entities.entity_level_code%type default null
237: , pn_ledger_id in jg_zz_vat_rep_entities.ledger_id%type default null
238: , pv_balancing_segment_value in jg_zz_vat_rep_entities.balancing_segment_value%type default null
239: , pv_called_from in varchar2
240: )
241: is
242:
239: , pv_called_from in varchar2
240: )
241: is
242:
243: lv_entity_identifier jg_zz_vat_rep_entities.entity_identifier%type;
244:
245: begin
246: /* Calling utility package to generate entity identifier */
247: lv_entity_identifier := jg_zz_vat_rep_utility.get_reporting_identifier
251: , pv_balancing_segment_value => pv_balancing_segment_value
252: , pv_called_from => pv_called_from
253: );
254:
255: update jg_zz_vat_rep_entities
256: set entity_identifier = lv_entity_identifier
257: where vat_reporting_entity_id = pn_vat_reporting_entity_id;
258:
259: end update_entity_identifier;
257: where vat_reporting_entity_id = pn_vat_reporting_entity_id;
258:
259: end update_entity_identifier;
260:
261: end jg_zz_vat_rep_entities_pkg;
262: