DBA Data[Home] [Help]

PACKAGE BODY: APPS.AR_RAXINVPR_XMLP_PKG

Source


1 PACKAGE BODY AR_RAXINVPR_XMLP_PKG AS
2 /* $Header: RAXINVPRB.pls 120.0 2007/12/27 14:27:03 abraghun noship $ */
3 
4 function AfterPForm return boolean is
5 begin
6 
7 declare msg AR_LOOKUPS.MEANING%TYPE;
8         out1 varchar2(4096);
9         out2 varchar2(4096);
10         trn  ar_system_parameters.tax_registration_number%TYPE;
11 
12 BEGIN
13 
14 out1 := 'X';
15 end;
16   return (TRUE);
17 end;
18 
19 function BeforeReport return boolean is
20 begin
21 
22 declare where1 varchar2(8096);
23         where2 varchar2(8096);
24         table1 varchar2(8096);
25         table2 varchar2(8096);
26 	--print_option	VARCHAR2(80);
27 	print_option_t	VARCHAR2(80);
28 	--type_id		VARCHAR2(50);
29 	type_id_t		VARCHAR2(50);
30 	--customer_id	VARCHAR2(50);
31 	customer_id_t	VARCHAR2(50);
32 	--batch_id	VARCHAR2(50);
33 	batch_id_t	VARCHAR2(50);
34 	--open_invoices	VARCHAR2(80);
35 	open_invoices_t	VARCHAR2(80);
36 	--invoice_dates	VARCHAR2(50);
37 	invoice_dates_t	VARCHAR2(50);
38 	--invoice_numbers	VARCHAR2(50);
39 	invoice_numbers_t	VARCHAR2(50);
40 	company_name	VARCHAR2(50);
41 	--functional_currency VARCHAR2(15);
42 	functional_currency_t VARCHAR2(15);
43     	l_report_name  VARCHAR2(240);
44 
45 BEGIN
46 
47 BEGIN
48    /*SRW.USER_EXIT('FND SRWINIT');*/null;
49 
50 end;
51 
52 BEGIN
53 
54 if (p_choice = 'BATCH' and p_batch_id is null)
55 then
56    arp_standard.fnd_message('740');
57    /*srw.message('100', arp_standard.fnd_message(arp_standard.md_msg_text +         arp_standard.md_msg_number));*/null;
58 
59    raise_application_error(-20101,null);/*srw.program_abort;*/null;
60 
61 end if;
62 
63 
64 
65 arp_trx_select_control.build_where_clause(
66  p_choice, p_open_invoice, p_cust_trx_type_id,
67  p_cust_trx_class,
68  p_installment_number, p_dates_low, p_dates_high,
69  p_customer_id, p_customer_class_code, p_trx_number_low,
70  p_trx_number_high, p_batch_id, p_customer_trx_id,
71  p_adj_number_low, p_adj_number_high,
72  p_adj_dates_low, p_adj_dates_high,
73  where1, where2, table1, table2 );
74 
75 p_where1 := where1;
76 p_where2 := where2;
77 p_table1 := table1;
78 p_table2 := table2;
79 
80 exception
81 when others
82 then
83    if sqlcode = -20000
84    then
85    begin
86       /*srw.message( '100', arp_standard.fnd_message(arp_standard.md_msg_text + arp_standard.md_msg_number) );*/null;
87 
88       raise_application_error(-20101,null);/*srw.program_abort;*/null;
89 
90    end;
91    else
92    begin
93       /*srw.message( '100', 'Oracle Error in call to ' ||
94                           'Before Report Trigger' ||
95                            to_char(sqlcode, '999999' ) );*/null;
96 
97       raise_application_error(-20101,null);/*srw.program_abort;*/null;
98 
99    end;
100    end if;
101 end;
102 
103 begin
104 
105 
106 
107 select  option_lu.meaning
108 --into    print_option
109 into    print_option_t
110 from    ar_lookups              option_lu
111 where   option_lu.lookup_type(+) = 'INVOICE_PRINTING'
112 and     option_lu.lookup_code(+) = upper(p_choice);
113 
114 --print_option := print_option;
115 print_option := print_option_t;
116 
117 
118 
119 if p_customer_trx_id is not null then
120 	select  name
121 	--into    type_id
122 	into    type_id_t
123 	from    ra_cust_trx_types
124 	where   cust_trx_type_id = p_customer_trx_id;
125 --type_id := type_id;
126 type_id := type_id_t;
127 end if;
128 
129 
130 
131 if p_customer_id is not null then
132 	select  substrb(party.party_name,1,50)
133 	--into    customer_id
134 	into    customer_id_t
135 	from    hz_cust_accounts           cust,
136 		hz_parties		party
137 	where   cust.cust_account_id  = p_customer_id
138           and   cust.party_id = party.party_id;
139 
140 --customer_id := customer_id;
141 customer_id := customer_id_t;
142 
143 end if;
144 
145 
146 
147 if p_batch_id is not null then
148 	select  bat.name
149 	--into    batch_id
150 	into    batch_id_t
151 	from    ra_batches              bat
152 	where   bat.batch_id = p_batch_id;
153 
154 --batch_id := batch_id;
155 batch_id := batch_id_t;
156 end if;
157 
158 
159 if p_open_invoice is not null then
160 	select  open_lu.meaning
161 	--into    open_invoices
162 	into    open_invoices_t
163 	from    ar_lookups              open_lu
164 	where   open_lu.lookup_type = 'YES/NO'
165 	and     open_lu.lookup_code = p_open_invoice;
166 --open_invoices := open_invoices;
167 open_invoices := open_invoices_t;
168 end if;
169 
170 if p_dates_low is not null or p_dates_high is not null then
171 	invoice_dates := nvl(to_char(p_dates_low,'DD-MON-YYYY'),'     ') || ' to ' || nvl(to_char(p_dates_high,'DD-MON-YYYY'),'     ');
172 end if;
173 
174 if p_trx_number_low is not null or p_trx_number_high is not null then
175 	invoice_numbers := nvl(p_trx_number_low,'     ') || ' to ' || nvl(p_trx_number_high,'     ');
176 end if;
177 
178 exception
179 when others then
180 	begin
181       	/*srw.message( '100', 'Oracle Error in call to ' ||
182                           'Before Report Trigger' ||
183                            to_char(sqlcode, '999999' ) );*/null;
184 
185       	raise_application_error(-20101,null);/*srw.program_abort;*/null;
186 
187    	end;
188 
189 end;
190 
191 begin
192         SELECT sob.name   Company_Name,
193                sob.currency_code Functional_Currency
194 	--INTO   company_name, functional_currency
195 	INTO   company_name, functional_currency_t
196 	FROM    gl_sets_of_books sob, ar_system_parameters ar
197 	WHERE   sob.set_of_books_id  = ar.set_of_books_id;
198 
199 	RP_COMPANY_NAME := company_name;
200 	--Functional_Currency := functional_currency;
201 	Functional_Currency := functional_currency_t;
202 
203     SELECT cp.user_concurrent_program_name
204     INTO   l_report_name
205     FROM   FND_CONCURRENT_PROGRAMS_VL cp,
206            FND_CONCURRENT_REQUESTS cr
207     WHERE  cr.request_id = P_CONC_REQUEST_ID
208     AND    cp.application_id = cr.program_application_id
209     AND    cp.concurrent_program_id = cr.concurrent_program_id;
210 
211     RP_Report_Name := l_report_name;
212 
213 EXCEPTION
214     WHEN NO_DATA_FOUND
215     THEN RP_REPORT_NAME := 'Invoice Print Preview Report';
216 END;
217 end;  return (TRUE);
218 end;
219 
220 function AfterReport return boolean is
221 begin
222 
223 /*srw.user_exit( 'FND SRWEXIT' );*/null;
224 
225   return (TRUE);
226 end;
227 
228 function installment_last_print_datefor(sequence_num in number, last_printed_sequence_num in number, printing_pending in varchar2, last_print_date in date) return date is
229 begin
230 
231 if (nvl(sequence_num, 1) > nvl(last_printed_sequence_num, 0))
232 then installment_printing_pending := printing_pending;
233      return('');
234 else installment_printing_pending := '';
235      return(last_print_date);
236 end if;
237 
238 RETURN NULL; end;
239 
240 --Functions to refer Oracle report placeholders--
241 
242  Function INSTALLMENT_PRINTING_PENDING_p return varchar2 is
243 	Begin
244 	 return INSTALLMENT_PRINTING_PENDING;
245 	 END;
246  Function RP_DATA_FOUND_p return varchar2 is
247 	Begin
248 	 return RP_DATA_FOUND;
249 	 END;
250  Function RP_COMPANY_NAME_p return varchar2 is
251 	Begin
252 	 return RP_COMPANY_NAME;
253 	 END;
254  Function RP_REPORT_NAME_p return varchar2 is
255 	Begin
256 	 return RP_REPORT_NAME;
257 	 END;
258  Function Print_option_p return varchar2 is
259 	Begin
260 	 return Print_option;
261 	 END;
262  Function Type_id_p return varchar2 is
263 	Begin
264 	 return Type_id;
265 	 END;
266  Function Customer_id_p return varchar2 is
267 	Begin
268 	 return Customer_id;
269 	 END;
270  Function Batch_id_p return varchar2 is
271 	Begin
272 	 return Batch_id;
273 	 END;
274  Function Open_Invoices_p return varchar2 is
275 	Begin
276 	 return Open_Invoices;
277 	 END;
278  Function Invoice_Dates_p return varchar2 is
279 	Begin
280 	 return Invoice_Dates;
281 	 END;
282  Function Invoice_Numbers_p return varchar2 is
283 	Begin
284 	 return Invoice_Numbers;
285 	 END;
286  Function Functional_Currency_p return varchar2 is
287 	Begin
288 	 return Functional_Currency;
289 	 END;
290 /*added as  a fix*/
291 function D_AmountFormula return VARCHAR2 is
292 begin
293 
294 --srw.reference(:Amount);
295 --srw.reference(:Functional_Currency);
296 RP_DATA_FOUND := '12345';
297 /*srw.user_exit('FND FORMAT_CURRENCY
298 		CODE=":Functional_Currency"
299 		DISPLAY_WIDTH="17"
300 		AMOUNT=":Amount"
301 		DISPLAY=":D_Amount"
302  		MINIMUM_PRECISION=":P_MIN_PRECISION"');
303 	RETURN(:D_Amount);
304 */
305 RETURN NULL;
306 end;
307 
308 /*fix ends*/
309 END AR_RAXINVPR_XMLP_PKG ;
310 
311