DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_FI_MTRR

Source


1 PACKAGE BODY PAY_FI_MTRR AS
2 /* $Header: pyfimtrr.pkb 120.3.12000000.2 2007/02/28 12:16:21 psingla noship $ */
3 	PROCEDURE GET_DATA (
4 			      p_business_group_id		IN NUMBER,
5 			      p_payroll_action_id       	IN  VARCHAR2 ,
6 			      p_template_name			IN VARCHAR2,
7 			      p_xml 				OUT NOCOPY CLOB
8 			    )
9 
10            	    IS
11 
12            	    					/*  Start of declaration*/
13 
14 
15            	    -- Variables needed for the report
16            	    l_Wage_payment_month	VARCHAR2(30);
17 		    l_none_payment_month	VARCHAR2(30);
18     		    l_no_vat_month		VARCHAR2(30);
19 		    l_due_date			VARCHAR2(30);
20 		    l_sum			VARCHAR2(30);
21 		    l_counter	number := 0;
22 		    l_payroll_action_id   PAY_ACTION_INFORMATION. ACTION_INFORMATION1%TYPE;
23 		    l_x80_code  	VARCHAR2(30);
24     		    l_x81_code  	VARCHAR2(30);
25     		    l_x82_code  	VARCHAR2(30);
26 		    l_sal_subject_wt		VARCHAR2(30);
27 		l_sal_subject_ts		VARCHAR2(30);
28 		l_pay_subject_ts		VARCHAR2(30);
29 		l_pay_subject_wt		VARCHAR2(30);
30 		l_wt_deduction		VARCHAR2(30);
31 		l_adjustment_wt		VARCHAR2(30);
32 		l_employer_ss_fee	VARCHAR2(30);
33 		l_adjustment_ss		VARCHAR2(30);
34 		l_ts_deduction		VARCHAR2(30);
35 		l_adjustment_ts		VARCHAR2(30);
36 		l_vat			VARCHAR2(30);
37 		l_subsidy_tax_source	VARCHAR2(30);
38 		l_subsidy_withhold_tax	VARCHAR2(30);
39 		l_sal_subject_wt_c	VARCHAR2(30);
40 		l_sal_subject_ts_c	VARCHAR2(30);
41 		l_pay_subject_ts_c	VARCHAR2(30);
42 		l_pay_subject_wt_c	VARCHAR2(30);
43 		l_wt_deduction_c	VARCHAR2(30);
44 		l_adjustment_wt_c	VARCHAR2(30);
45 		l_employer_ss_fee_c		VARCHAR2(30);
46 		l_adjustment_ss_c	VARCHAR2(30);
47 		l_ts_deduction_c		VARCHAR2(30);
48 		l_adjustment_ts_c	VARCHAR2(30);
49 		l_vat_c				VARCHAR2(30);
50 		l_subsidy_tax_source_c	VARCHAR2(30);
51 		l_subsidy_withhold_tax_c VARCHAR2(30);
52 		l_ref_number		VARCHAR2(20);
53 		l_data_source_code       xdo_ds_definitions_b.data_source_code%type;
54 
55 
56 
57 
58           	              	    			/* End of declaration*/
59 
60            	     					/* Cursors */
61 		Cursor csr_mtrr_rpt(csr_v_pa_id PAY_ACTION_INFORMATION. ACTION_INFORMATION1%TYPE)
62 			IS
63 				SELECT	  *
64 				FROM	PAY_ACTION_INFORMATION
65 			  	WHERE	 ACTION_CONTEXT_TYPE = 'PA'
66 			  	AND	ACTION_CONTEXT_ID =  csr_v_pa_id
67 				AND ACTION_INFORMATION_CATEGORY='EMEA REPORT INFORMATION' ;
68 
69 				rg_mtrr_rpt  csr_mtrr_rpt%rowtype;
70 
71 	     Cursor csr_get_data_source_name
72 	            is
73 		      select data_source_code
74 		      from   xdo_templates_b
75                       where  template_code = p_template_name
76 		      and    application_short_name = 'PAY';
77 
78 				           	     /* End of Cursors */
79 
80            	    BEGIN
81 
82 				IF p_payroll_action_id  IS NULL THEN
83 
84 				BEGIN
85 
86 
87 
88 					SELECT payroll_action_id
89 					INTO  l_payroll_action_id
90 					FROM pay_payroll_actions ppa,
91 					fnd_conc_req_summary_v fcrs,
92 					fnd_conc_req_summary_v fcrs1
93 					WHERE  fcrs.request_id = FND_GLOBAL.CONC_REQUEST_ID
94 					AND fcrs.priority_request_id = fcrs1.priority_request_id
95 					AND ppa.request_id between fcrs1.request_id  and fcrs.request_id
96 					AND ppa.request_id = fcrs1.request_id;
97 
98 				EXCEPTION
99 				WHEN others THEN
100 				NULL;
101 				END ;
102 
103 				ELSE
104 
105 					l_payroll_action_id  :=p_payroll_action_id;
106 
107 				END IF;
108 
109 				OPEN csr_get_data_source_name;
110 				FETCH csr_get_data_source_name INTO l_data_source_code;
111 				close csr_get_data_source_name;
112 
113 
114 			hr_utility.set_location('Entered Procedure GETDATA',10);
115 
116 				/* Pick up the details belonging to Local Unit */
117 
118 				OPEN  csr_mtrr_rpt( l_payroll_action_id);
119 					FETCH csr_mtrr_rpt INTO rg_mtrr_rpt;
120 				CLOSE csr_mtrr_rpt;
121 
122 				 /* For Audit Report */
123 				 if  l_data_source_code = 'PYFIMTRR' then
124 					 SELECT  trim(rg_mtrr_rpt.action_information4)||'  '||trim(rg_mtrr_rpt.action_information4)
125 					 INTO l_Wage_payment_month
126 					 FROM dual;
127 
128 					IF rg_mtrr_rpt.action_information28 IS NULL THEN
129 						l_due_date:=to_char(to_date('15'||trim(rg_mtrr_rpt.action_information4),'DDMMYYYY') ) ;
130 					ELSE
131 						l_due_date := to_char(fnd_date.canonical_to_date(rg_mtrr_rpt.action_information28)) ;
132 					END IF;
133 
134 					l_ref_number:= rg_mtrr_rpt.action_information29 ;
135 
136 					l_sum := TRIM((TO_CHAR(NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15),0) +
137 							NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17),0) +
138 							NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19),0)
139 							-   (   NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16),0)
140 							+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18),0)
141 							+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20),0) ) ,'999G999G990D99')));
142 
143 					IF  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information21),0) = 0 THEN
144 						 l_no_vat_month:= rg_mtrr_rpt.action_information4||'  '||rg_mtrr_rpt.action_information4;
145 
146 
147 					END IF;
148 
149 					IF  (NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12),0)
150 					+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14),0)
151 					+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16),0)
152 					+   NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18),0)
153 					+     NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20),0)  )
154 					= 0 	THEN
155 
156 						l_none_payment_month := rg_mtrr_rpt.action_information4||'  '||rg_mtrr_rpt.action_information4;
157 
158 					END IF;
159 
160 					l_x80_code := LPAD(TRIM((TO_CHAR(NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15),0) - NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16),0),'999999999D99'))) ,11,'0');
161 					l_x81_code := LPAD(TRIM((TO_CHAR(NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17),0) - NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18),0),'999999999D99'))) ,11,'0');
162 					l_x82_code := LPAD(TRIM((TO_CHAR(NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19),0) - NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20),0),'999999999D99'))) ,11,'0');
163 
164 					l_sal_subject_wt :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11))))) ;
165 					l_sal_subject_ts :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12))))) ;
166 					l_pay_subject_wt :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13))))) ;
167 					l_pay_subject_ts :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14))))) ;
168 					l_wt_deduction :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15))))) ;
169 					l_adjustment_wt :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16))))) ;
170 					l_employer_ss_fee :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17))))) ;
171 					l_adjustment_ss :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18))))) ;
172 					l_ts_deduction :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19))))) ;
173 					l_adjustment_ts :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20))))) ;
174 					l_vat :=  TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information21))))) ;
175 					l_subsidy_tax_source := TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information3))))) ;
176 					l_subsidy_withhold_tax := TRIM((TO_CHAR(FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information30))))) ;
177 
178 					l_sal_subject_wt_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11)),'D99'))),2,2);
179 					l_sal_subject_ts_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12)),'D99'))),2,2);
180 					l_pay_subject_wt_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13)),'D99'))),2,2);
181 					l_pay_subject_ts_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14)),'D99'))),2,2);
182 					l_wt_deduction_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15)),'D99'))),2,2);
183 					l_adjustment_wt_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16)),'D99'))),2,2);
184 					l_employer_ss_fee_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17)),'D99'))),2,2);
185 					l_adjustment_ss_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18)),'D99'))),2,2);
186 					l_ts_deduction_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19)),'D99'))),2,2);
187 					l_adjustment_ts_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20)),'D99'))),2,2);
188 					l_vat_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information21) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information21)),'D99'))),2,2);
189 					l_subsidy_tax_source_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information3) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information3)),'D99'))),2,2);
190 					l_subsidy_withhold_tax_c :=  SUBSTR(TRIM((TO_CHAR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information30) -  FLOOR(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information30)),'D99'))),2,2);
191 
192 
193 
194 					hr_utility.set_location('Before populating pl/sql table',20);
195 
196 					gtagdata(l_counter).TagName := 'TAX_PAYER_NAME';
197 					gtagdata(l_counter).TagValue :=pay_fi_general.xml_parser(rg_mtrr_rpt.action_information5);
198 						l_counter := l_counter + 1;
199 
200 					gtagdata(l_counter).TagName := 'ADDRESS_LINE1';
201 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information6);
202 						l_counter := l_counter + 1;
203 
204 					gtagdata(l_counter).TagName := 'ADDRESS_LINE2';
205 					gtagdata(l_counter).TagValue := pay_fi_general.xml_parser(rg_mtrr_rpt.action_information7);
206 						l_counter := l_counter + 1;
207 
208 					gtagdata(l_counter).TagName := 'ADDRESS_LINE3';
209 					gtagdata(l_counter).TagValue := pay_fi_general.xml_parser(rg_mtrr_rpt.action_information8);
210 						l_counter := l_counter + 1;
211 
212 					gtagdata(l_counter).TagName := 'ADDRESS_LINE4';
213 					gtagdata(l_counter).TagValue := pay_fi_general.xml_parser(rg_mtrr_rpt.action_information9);
214 						l_counter := l_counter + 1;
215 
216 					gtagdata(l_counter).TagName := 'BUSINESS_ID';
217 					gtagdata(l_counter).TagValue := pay_fi_general.xml_parser(rg_mtrr_rpt.action_information10);
218 						l_counter := l_counter + 1;
219 
220 
221 					gtagdata(l_counter).TagName := 'CURRENCY';
222 					gtagdata(l_counter).TagValue := 'euro';
223 						l_counter := l_counter + 1;
224 
225 					gtagdata(l_counter).TagName := 'WAGE_PAYMENT_MONTH';
226 					gtagdata(l_counter).TagValue :=  l_Wage_payment_month ;
227 						l_counter := l_counter + 1;
228 
229 					gtagdata(l_counter).TagName := 'VAT_PAYMENT_MONTH';
230 					gtagdata(l_counter).TagValue := rg_mtrr_rpt.action_information4;
231 						l_counter := l_counter + 1;
232 
233 
234 					gtagdata(l_counter).TagName := 'SAL_SUBJECT_WT';
235 					gtagdata(l_counter).TagValue :=  l_sal_subject_wt;
236 						l_counter := l_counter + 1;
237 
238 					gtagdata(l_counter).TagName := 'S_SUB_WT_C';
239 					gtagdata(l_counter).TagValue :=  l_sal_subject_wt_c;
240 						l_counter := l_counter + 1;
241 
242 
243 					gtagdata(l_counter).TagName := 'SAL_SUBJECT_TS';
244 					gtagdata(l_counter).TagValue :=  l_sal_subject_ts;
245 						l_counter := l_counter + 1;
246 
247 
248 					gtagdata(l_counter).TagName := 'S_SUB_TS_C';
249 					gtagdata(l_counter).TagValue :=  l_sal_subject_ts_c;
250 						l_counter := l_counter + 1;
251 
252 
253 					gtagdata(l_counter).TagName := 'PAY_SUBJECT_WT';
254 					gtagdata(l_counter).TagValue :=  l_pay_subject_wt ;
255 						l_counter := l_counter + 1;
256 
257 				gtagdata(l_counter).TagName := 'P_SUB_WT_C';
258 					gtagdata(l_counter).TagValue :=  l_pay_subject_wt_c ;
259 						l_counter := l_counter + 1;
260 
261 
262 					gtagdata(l_counter).TagName := 'PAY_SUBJECT_TS';
263 					gtagdata(l_counter).TagValue :=  l_pay_subject_ts;
264 						l_counter := l_counter + 1;
265 
266 					gtagdata(l_counter).TagName := 'P_SUB_TS_C';
267 					gtagdata(l_counter).TagValue :=  l_pay_subject_ts_c;
268 						l_counter := l_counter + 1;
269 
270 
271 					gtagdata(l_counter).TagName := 'WT_DEDUCTION';
272 					gtagdata(l_counter).TagValue :=  l_wt_deduction;
273 						l_counter := l_counter + 1;
274 
275 						gtagdata(l_counter).TagName := 'W_DED_C';
276 					gtagdata(l_counter).TagValue :=  l_wt_deduction_c;
277 						l_counter := l_counter + 1;
278 
279 
280 					gtagdata(l_counter).TagName := 'ADJUSTMENT_WT';
281 					gtagdata(l_counter).TagValue :=  l_adjustment_wt;
282 						l_counter := l_counter + 1;
283 
284 					gtagdata(l_counter).TagName := 'ADJ_WT_C';
285 					gtagdata(l_counter).TagValue :=  l_adjustment_wt_c;
286 						l_counter := l_counter + 1;
287 
288 
289 					gtagdata(l_counter).TagName := 'EMPLOYER_SS_FEE';
290 					gtagdata(l_counter).TagValue :=  l_employer_ss_fee;
291 						l_counter := l_counter + 1;
292 
293 					gtagdata(l_counter).TagName := 'E_SS_FEE_C';
294 					gtagdata(l_counter).TagValue :=  l_employer_ss_fee_c;
295 						l_counter := l_counter + 1;
296 
297 						gtagdata(l_counter).TagName := 'ADJUSTMENT_SS';
298 					gtagdata(l_counter).TagValue :=  l_adjustment_ss;
299 						l_counter := l_counter + 1;
300 
301 
302 					gtagdata(l_counter).TagName := 'ADJ_SS_C';
303 					gtagdata(l_counter).TagValue :=  l_adjustment_ss_c;
304 						l_counter := l_counter + 1;
305 
306 					gtagdata(l_counter).TagName := 'TS_DEDUCTION';
307 					gtagdata(l_counter).TagValue :=  l_ts_deduction;
308 						l_counter := l_counter + 1;
309 
310 
311 					gtagdata(l_counter).TagName := 'T_DED_C';
312 					gtagdata(l_counter).TagValue :=  l_ts_deduction_c;
313 						l_counter := l_counter + 1;
314 
315 
316 						gtagdata(l_counter).TagName := 'ADJUSTMENT_TS';
317 					gtagdata(l_counter).TagValue :=  l_adjustment_ts;
318 						l_counter := l_counter + 1;
319 
320 						gtagdata(l_counter).TagName := 'ADJ_TS_C';
321 					gtagdata(l_counter).TagValue :=  l_adjustment_ts_c;
322 						l_counter := l_counter + 1;
323 
324 
325 						IF  l_none_payment_month IS NOT NULL THEN
326 
327 							gtagdata(l_counter).TagName := 'N1';
328 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,1,1);
329 							l_counter := l_counter + 1;
330 
331 							gtagdata(l_counter).TagName := 'N2';
332 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,2,1);
333 							l_counter := l_counter + 1;
334 							gtagdata(l_counter).TagName := 'N3';
335 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,3,1);
336 							l_counter := l_counter + 1;
337 							gtagdata(l_counter).TagName := 'N4';
338 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,4,1);
339 							l_counter := l_counter + 1;
340 							gtagdata(l_counter).TagName := 'N5';
341 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,5,1);
342 							l_counter := l_counter + 1;
343 
344 							gtagdata(l_counter).TagName := 'N6';
345 						gtagdata(l_counter).TagValue := substr(l_none_payment_month,6,1);
346 							l_counter := l_counter + 1;
347 
348 
349 						END IF;
350 
351 						gtagdata(l_counter).TagName := 'VAT';
352 					gtagdata(l_counter).TagValue :=  l_vat;
353 						l_counter := l_counter + 1;
354 
355 						gtagdata(l_counter).TagName := 'VAT_C';
356 					gtagdata(l_counter).TagValue :=  l_vat_c;
357 						l_counter := l_counter + 1;
358 
359 						gtagdata(l_counter).TagName := 'SUB_TAX_SOURCE';
360 					gtagdata(l_counter).TagValue :=  l_subsidy_tax_source;
361 						l_counter := l_counter + 1;
362 
363 						gtagdata(l_counter).TagName := 'SUB_TAX_SOURCE_C';
364 					gtagdata(l_counter).TagValue :=  l_subsidy_tax_source_c;
365 						l_counter := l_counter + 1;
366 
367 						gtagdata(l_counter).TagName := 'SUB_WITHHOLD';
368 					gtagdata(l_counter).TagValue :=  l_subsidy_withhold_tax;
369 						l_counter := l_counter + 1;
370 
371 						gtagdata(l_counter).TagName := 'SUB_WITH_C';
372 					gtagdata(l_counter).TagValue :=  l_subsidy_withhold_tax_c;
373 						l_counter := l_counter + 1;
374 
375 
376 
377 
378 						IF  l_no_vat_month  IS NOT NULL THEN
379 
380 							gtagdata(l_counter).TagName := 'N7';
381 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,1,1);
382 							l_counter := l_counter + 1;
383 
384 							gtagdata(l_counter).TagName := 'N8';
385 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,2,1);
386 							l_counter := l_counter + 1;
387 							gtagdata(l_counter).TagName := 'N9';
388 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,3,1);
389 							l_counter := l_counter + 1;
390 							gtagdata(l_counter).TagName := 'Na';
391 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,4,1);
392 							l_counter := l_counter + 1;
393 							gtagdata(l_counter).TagName := 'Nb';
394 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,5,1);
395 							l_counter := l_counter + 1;
396 
397 							gtagdata(l_counter).TagName := 'Nc';
398 						gtagdata(l_counter).TagValue := substr(l_no_vat_month,6,1);
399 							l_counter := l_counter + 1;
400 
401 
402 						END IF;
403 
404 						gtagdata(l_counter).TagName := 'CONTACT_PERSON';
405 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information22);
406 						l_counter := l_counter + 1;
407 
408 						gtagdata(l_counter).TagName := 'PHONE';
409 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information23);
410 						l_counter := l_counter + 1;
411 
412 						gtagdata(l_counter).TagName := 'FAX';
413 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information24);
414 						l_counter := l_counter + 1;
415 
416 
417 						gtagdata(l_counter).TagName := 'I1';
418 					gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,1,1) ;
419 						l_counter := l_counter + 1;
420 
421 						gtagdata(l_counter).TagName := 'I2';
422 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,2,1) ;
423 						l_counter := l_counter + 1;
424 
425 						gtagdata(l_counter).TagName := 'I3';
426 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,3,1) ;
427 						l_counter := l_counter + 1;
428 
429 						gtagdata(l_counter).TagName := 'I4';
430 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,4,1) ;
431 						l_counter := l_counter + 1;
432 
433 						gtagdata(l_counter).TagName := 'I5';
434 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,5,1) ;
435 						l_counter := l_counter + 1;
436 						gtagdata(l_counter).TagName := 'I6';
437 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,6,1) ;
438 						l_counter := l_counter + 1;
439 						gtagdata(l_counter).TagName := 'I7';
440 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,7,1) ;
441 						l_counter := l_counter + 1;
442 						gtagdata(l_counter).TagName := 'I8';
443 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,8,1) ;
444 						l_counter := l_counter + 1;
445 						gtagdata(l_counter).TagName := 'I9';
446 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information10,9,1) ;
447 						l_counter := l_counter + 1;
448 						gtagdata(l_counter).TagName := 'Ia';
449 						gtagdata(l_counter).TagValue :=  NULL;
450 						l_counter := l_counter + 1;
451 						gtagdata(l_counter).TagName := 'Ib';
452 						gtagdata(l_counter).TagValue :=  NULL ;
453 						l_counter := l_counter + 1;
454 
455 						gtagdata(l_counter).TagName := 'Ic';
456 						gtagdata(l_counter).TagValue :=  NULL ;
457 						l_counter := l_counter + 1;
458 
459 						gtagdata(l_counter).TagName := 'B1';
460 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,1,1) ;
461 						l_counter := l_counter + 1;
462 
463 						gtagdata(l_counter).TagName := 'B2';
464 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,2,1) ;
465 						l_counter := l_counter + 1;
466 
467 						gtagdata(l_counter).TagName := 'B3';
468 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,3,1) ;
469 						l_counter := l_counter + 1;
470 
471 						gtagdata(l_counter).TagName := 'B4';
472 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,4,1) ;
473 						l_counter := l_counter + 1;
474 
475 						gtagdata(l_counter).TagName := 'B5';
476 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,5,1) ;
477 						l_counter := l_counter + 1;
478 						gtagdata(l_counter).TagName := 'B6';
479 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,6,1) ;
480 						l_counter := l_counter + 1;
481 						gtagdata(l_counter).TagName := 'B7';
482 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,8,1) ;
483 						l_counter := l_counter + 1;
484 						gtagdata(l_counter).TagName := 'B8';
485 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,9,1) ;
486 						l_counter := l_counter + 1;
487 						gtagdata(l_counter).TagName := 'B9';
488 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,10,1) ;
489 						l_counter := l_counter + 1;
490 						gtagdata(l_counter).TagName := 'Ba';
491 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,11,1) ;
492 						l_counter := l_counter + 1;
493 						gtagdata(l_counter).TagName := 'Bb';
494 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,12,1) ;
495 						l_counter := l_counter + 1;
496 						gtagdata(l_counter).TagName := 'Bc';
497 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,13,1) ;
498 						l_counter := l_counter + 1;
499 						gtagdata(l_counter).TagName := 'Bd';
500 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,14,1) ;
501 						l_counter := l_counter + 1;
502 
503 						gtagdata(l_counter).TagName := 'Be';
504 						gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information27,15,1) ;
505 						l_counter := l_counter + 1;
506 
507 						gtagdata(l_counter).TagName := 'TAX_OFFICE_NAME';
508 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information26);
509 						l_counter := l_counter + 1;
510 
511 						gtagdata(l_counter).TagName := 'TAX_PAYER_NAME';
512 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information5);
513 						l_counter := l_counter + 1;
514 
515 
516 					gtagdata(l_counter).TagName := 'TAX_OFFICE_BA';
517 					gtagdata(l_counter).TagValue :=  pay_fi_general.xml_parser(rg_mtrr_rpt.action_information25);
518 						l_counter := l_counter + 1;
519 
520 
521 					gtagdata(l_counter).TagName := 'M1';
522 					gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information4,1,1);
523 						l_counter := l_counter + 1;
524 
525 					gtagdata(l_counter).TagName := 'M2';
526 					gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information4,2,1);
527 						l_counter := l_counter + 1;
528 
529 					gtagdata(l_counter).TagName := 'M3';
530 					gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information4,5,1);
531 						l_counter := l_counter + 1;
532 
533 					gtagdata(l_counter).TagName := 'M4';
534 					gtagdata(l_counter).TagValue :=  SUBSTR(rg_mtrr_rpt.action_information4,6,1);
535 						l_counter := l_counter + 1;
536 
537 
538 						gtagdata(l_counter).TagName := 'C1';
539 					gtagdata(l_counter).TagValue := '8';
540 						l_counter := l_counter + 1;
541 
542 						gtagdata(l_counter).TagName := 'W1';
543 					gtagdata(l_counter).TagValue := '0';
544 						l_counter := l_counter + 1;
545 
546 						gtagdata(l_counter).TagName := 'S1';
547 					gtagdata(l_counter).TagValue := '1';
548 						l_counter := l_counter + 1;
549 
550 						gtagdata(l_counter).TagName := 'T1';
551 					gtagdata(l_counter).TagValue := '2';
552 						l_counter := l_counter + 1;
553 
554 
555 					gtagdata(l_counter).TagName := 'W2';
556 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,1,1);
557 						l_counter := l_counter + 1;
558 
559 
560 					gtagdata(l_counter).TagName := 'W3';
561 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,2,1);
562 						l_counter := l_counter + 1;
563 
564 					gtagdata(l_counter).TagName := 'W4';
565 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,3,1);
566 						l_counter := l_counter + 1;
567 
568 					gtagdata(l_counter).TagName := 'W5';
569 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,4,1);
570 						l_counter := l_counter + 1;
571 
572 					gtagdata(l_counter).TagName := 'W6';
573 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,5,1);
574 						l_counter := l_counter + 1;
575 
576 					gtagdata(l_counter).TagName := 'W7';
577 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,6,1);
578 						l_counter := l_counter + 1;
579 
580 					gtagdata(l_counter).TagName := 'W8';
581 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,7,1);
582 						l_counter := l_counter + 1;
583 
584 					gtagdata(l_counter).TagName := 'W9';
585 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,8,1);
586 						l_counter := l_counter + 1;
587 
588 					gtagdata(l_counter).TagName := 'Wa';
589 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,9,1);
590 						l_counter := l_counter + 1;
591 
592 					gtagdata(l_counter).TagName := 'Wb';
593 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,10,1);
594 						l_counter := l_counter + 1;
595 
596 					gtagdata(l_counter).TagName := 'Wc';
597 					gtagdata(l_counter).TagValue := SUBSTR(l_x80_code,11,1);
598 						l_counter := l_counter + 1;
599 
600 
601 						gtagdata(l_counter).TagName := 'S2';
602 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,1,1);
603 						l_counter := l_counter + 1;
604 
605 
606 					gtagdata(l_counter).TagName := 'S3';
607 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,2,1);
608 						l_counter := l_counter + 1;
609 
610 					gtagdata(l_counter).TagName := 'S4';
611 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,3,1);
612 						l_counter := l_counter + 1;
613 
614 					gtagdata(l_counter).TagName := 'S5';
615 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,4,1);
616 						l_counter := l_counter + 1;
617 
618 					gtagdata(l_counter).TagName := 'S6';
619 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,5,1);
620 						l_counter := l_counter + 1;
621 
622 					gtagdata(l_counter).TagName := 'S7';
623 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,6,1);
624 						l_counter := l_counter + 1;
625 
626 					gtagdata(l_counter).TagName := 'S8';
627 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,7,1);
628 						l_counter := l_counter + 1;
629 
630 					gtagdata(l_counter).TagName := 'S9';
631 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,8,1);
632 						l_counter := l_counter + 1;
633 
634 					gtagdata(l_counter).TagName := 'Sa';
635 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,9,1);
636 						l_counter := l_counter + 1;
637 
638 					gtagdata(l_counter).TagName := 'Sb';
639 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,10,1);
640 						l_counter := l_counter + 1;
641 
642 					gtagdata(l_counter).TagName := 'Sc';
643 					gtagdata(l_counter).TagValue := SUBSTR(l_x81_code,11,1);
644 						l_counter := l_counter + 1;
645 
646 
647 					gtagdata(l_counter).TagName := 'T2';
648 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,1,1);
649 						l_counter := l_counter + 1;
650 
651 
652 					gtagdata(l_counter).TagName := 'T3';
653 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,2,1);
654 						l_counter := l_counter + 1;
655 
656 					gtagdata(l_counter).TagName := 'T4';
657 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,3,1);
658 						l_counter := l_counter + 1;
659 
660 					gtagdata(l_counter).TagName := 'T5';
661 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,4,1);
662 						l_counter := l_counter + 1;
663 
664 					gtagdata(l_counter).TagName := 'T6';
665 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,5,1);
666 						l_counter := l_counter + 1;
667 
668 					gtagdata(l_counter).TagName := 'T7';
669 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,6,1);
670 						l_counter := l_counter + 1;
671 
672 					gtagdata(l_counter).TagName := 'T8';
673 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,7,1);
674 						l_counter := l_counter + 1;
675 
676 					gtagdata(l_counter).TagName := 'T9';
677 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,8,1);
678 						l_counter := l_counter + 1;
679 
680 					gtagdata(l_counter).TagName := 'Ta';
681 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,9,1);
682 						l_counter := l_counter + 1;
683 
684 					gtagdata(l_counter).TagName := 'Tb';
685 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,10,1);
686 						l_counter := l_counter + 1;
687 
688 					gtagdata(l_counter).TagName := 'Tc';
689 					gtagdata(l_counter).TagValue := SUBSTR(l_x82_code,11,1);
690 						l_counter := l_counter + 1;
691 
692 
693 						gtagdata(l_counter).TagName := 'REF_NUM';
694 					gtagdata(l_counter).TagValue := l_ref_number;
695 						l_counter := l_counter + 1;
696 
697 						gtagdata(l_counter).TagName := 'DUE_DATE';
698 					gtagdata(l_counter).TagValue := to_char(l_due_date);
699 						l_counter := l_counter + 1;
700 
701 						gtagdata(l_counter).TagName := 'SUM';
702 					gtagdata(l_counter).TagValue := l_sum;
703 						l_counter := l_counter + 1;
704 
705 					hr_utility.set_location('After populating pl/sql table',30);
706 				ELSIF l_data_source_code = 'PYFIMTRREFT' then
707 
708 				   SELECT  trim(rg_mtrr_rpt.action_information4)||'  '||trim(rg_mtrr_rpt.action_information4)
709 					 INTO l_Wage_payment_month
710 					 FROM dual;
711 			           IF  (NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12),0)
712 					+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14),0)
713 					+  NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16),0)
714 					+   NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18),0)
715 					+     NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19),0)  + NVL(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20),0)  )
716 					= 0 	THEN
717 
718 						l_none_payment_month := rg_mtrr_rpt.action_information4||'  '||rg_mtrr_rpt.action_information4;
719 				   END IF;
720 
721 				  --l_none_payment_month := rg_mtrr_rpt.action_information4||'  '||rg_mtrr_rpt.action_information4;
722 
723 				   gtagdata(l_counter).TagName := 'BUSINESS_ID';
724 				   gtagdata(l_counter).TagValue := pay_fi_general.xml_parser(rg_mtrr_rpt.action_information10);
725 					l_counter := l_counter + 1;
726 
727 				   gtagdata(l_counter).TagName := 'CURRENCY';
728 				   gtagdata(l_counter).TagValue := '1';
729 					l_counter := l_counter + 1;
730 
731 				   gtagdata(l_counter).TagName := 'WAGE_PAYMENT_MONTH';
732 				   gtagdata(l_counter).TagValue :=  l_Wage_payment_month ;
733 					l_counter := l_counter + 1;
734 
735 				   gtagdata(l_counter).TagName := 'VAT_PAYMENT_MONTH';
736 				   gtagdata(l_counter).TagValue := rg_mtrr_rpt.action_information4;
737 					l_counter := l_counter + 1;
738 
739 				   gtagdata(l_counter).TagName := 'SAL_SUBJECT_WT';
740 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information11),2) * 100;
741 						l_counter := l_counter + 1;
742 
743 				   gtagdata(l_counter).TagName := 'SAL_SUBJECT_TS';
744 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information12),2) * 100;
745 						l_counter := l_counter + 1;
746 
747 				   gtagdata(l_counter).TagName := 'PAY_SUBJECT_WT';
748 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information13),2) * 100;
749 						l_counter := l_counter + 1;
750 
751                                    gtagdata(l_counter).TagName := 'PAY_SUBJECT_TS';
752 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information14),2) * 100;
753 						l_counter := l_counter + 1;
754 
755                                    gtagdata(l_counter).TagName := 'WT_DEDUCTION';
756 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information15),2) * 100;
757 						l_counter := l_counter + 1;
758 
759                                    gtagdata(l_counter).TagName := 'ADJUSTMENT_WT';
760 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information16),2) * 100;
761 						l_counter := l_counter + 1;
762 
763                                    gtagdata(l_counter).TagName := 'SUB_WITHHOLD';
764 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information30),2) * 100;
765 						l_counter := l_counter + 1;
766 
767                                    gtagdata(l_counter).TagName := 'EMPLOYER_SS_FEE';
768 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information17),2) * 100;
769 						l_counter := l_counter + 1;
770 
771                   	           gtagdata(l_counter).TagName := 'ADJUSTMENT_SS';
772 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information18),2) * 100;
773 						l_counter := l_counter + 1;
774 
775 				   gtagdata(l_counter).TagName := 'TS_DEDUCTION';
776 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information19),2) * 100;
777 						l_counter := l_counter + 1;
778 
779 				   gtagdata(l_counter).TagName := 'ADJUSTMENT_TS';
780 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information20),2) * 100;
781 						l_counter := l_counter + 1;
782 
783 
784 				   gtagdata(l_counter).TagName := 'SUB_TAX_SOURCE';
785 				   gtagdata(l_counter).TagValue :=  ROUND(FND_NUMBER.CANONICAL_TO_NUMBER(rg_mtrr_rpt.action_information3),2) * 100;
786 						l_counter := l_counter + 1;
787 
788 				   if l_none_payment_month is not null then
789 					   gtagdata(l_counter).TagName := 'NO_PAY_MNTH';
790 					   gtagdata(l_counter).TagValue :=  substr(l_none_payment_month,1,6)||'-'||substr(l_none_payment_month,1,6);
791 							l_counter := l_counter + 1;
792 				   end if;
793 				END IF; -- End If for data source checking
794 
795 
796 
797 					WritetoCLOB (p_xml );
798 	           	    END GET_DATA;
799 
800 -----------------------------------------------------------------------------------------------------------------
801 PROCEDURE WritetoCLOB(p_xfdf_clob out nocopy CLOB) is
802 l_xfdf_string clob;
803 l_str1 varchar2(1000);
804 l_str2 varchar2(20);
805 l_str3 varchar2(20);
806 l_str4 varchar2(20);
807 l_str5 varchar2(20);
808 l_str6 varchar2(30);
809 l_str7 varchar2(1000);
810 l_str8 varchar2(240);
811 l_str9 varchar2(240);
812 l_str10 varchar2(20);
813 l_str11 varchar2(20);
814 
815 current_index pls_integer;
816 l_IANA_charset VARCHAR2 (50);
817 
818    BEGIN
819       l_IANA_charset :=hr_fi_utility.get_IANA_charset ;
820 
821 hr_utility.set_location('Entering WritetoCLOB ',70);
822 
823 	l_str1 := '<?xml version="1.0" encoding="'||l_IANA_charset||'"?> <ROOT><MTRR>' ;
824 	l_str2 := '<';
825         l_str3 := '>';
826         l_str4 := '</';
827         l_str5 := '>';
828         l_str6 := '</MTRR></ROOT>';
829 	l_str7 := '<?xml version="1.0" encoding="'||l_IANA_charset||'"?> <ROOT></ROOT>';
830 	l_str10 := '<MTRR>';
831 	l_str11 := '</MTRR>';
832 
833 
834 	dbms_lob.createtemporary(l_xfdf_string,FALSE,DBMS_LOB.CALL);
835 	dbms_lob.open(l_xfdf_string,dbms_lob.lob_readwrite);
836 
837 	current_index := 0;
838 
839               IF gtagdata.count > 0 THEN
840 
841 			dbms_lob.writeAppend( l_xfdf_string, length(l_str1), l_str1 );
842 
843         		FOR table_counter IN gtagdata.FIRST .. gtagdata.LAST LOOP
844 
845         			l_str8 := gtagdata(table_counter).TagName;
846 	        		l_str9 := gtagdata(table_counter).TagValue;
847 
848                                  if l_str9 is not null then
849 
850 	                           dbms_lob.writeAppend(l_xfdf_string, length(l_str2), l_str2);
851                   		   dbms_lob.writeAppend(l_xfdf_string, length(l_str8), l_str8);
852 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str3), l_str3);
853                                    dbms_lob.writeAppend(l_xfdf_string, length(l_str9), l_str9);
854 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str4), l_str4);
855 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str8), l_str8);
856 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str5), l_str5);
857                                  else
858 
859                                    dbms_lob.writeAppend(l_xfdf_string, length(l_str2), l_str2);
860                   		   dbms_lob.writeAppend(l_xfdf_string, length(l_str8), l_str8);
861 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str3), l_str3);
862 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str4), l_str4);
863 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str8), l_str8);
864 				   dbms_lob.writeAppend(l_xfdf_string, length(l_str5), l_str5);
865 
866                                  end if;
867 
868 			END LOOP;
869 
870 			dbms_lob.writeAppend(l_xfdf_string, length(l_str6), l_str6 );
871 		ELSE
872 			dbms_lob.writeAppend(l_xfdf_string, length(l_str7), l_str7 );
873 		END IF;
874 
875 		p_xfdf_clob := l_xfdf_string;
876 
877 		hr_utility.set_location('Leaving WritetoCLOB ',40);
878 
879 	EXCEPTION
880 		WHEN OTHERS then
881 	        HR_UTILITY.TRACE('sqlerrm ' || SQLERRM);
882 	        HR_UTILITY.RAISE_ERROR;
883 END WritetoCLOB;
884 -------------------------------------------------------------------------------------------------------------------------
885 
886 END PAY_FI_MTRR;