[Home] [Help]
PACKAGE BODY: APPS.PO_RCVTXRTR_NEW_XMLP_PKG
Source
1 PACKAGE BODY PO_RCVTXRTR_NEW_XMLP_PKG AS
2 /* $Header: RCVTXRTRB.pls 120.1 2007/12/25 12:47:08 krreddy noship $ */
3
4 function BeforeReport return boolean is
5
6 l_org org_organization_definitions.organization_name%type;
7 l_INDUSTRY varchar2(100);
8 l_ORACLE_SCHEMA varchar2(100);
9 l_fnd_install boolean;
10 begin
11 begin
12 if P_org_id is not null then
13
14 select organization_name
15 into l_org
16 from org_organization_definitions
17 where organization_id = P_org_id ;
18
19 P_org_displayed := l_org;
20
21 else
22
23 P_org_displayed := '' ;
24
25 end if;
26
27 end;
28 BEGIN
29 if (get_p_struct_num <> TRUE )
30 then /*SRW.MESSAGE('1','P Struct Num Init failed');*/null;
31
32 end if;
33
34 null;
35
36 /*srw.user_exit('FND INSTALLATION OUTPUT_TYPE="STATUS"
37 OUTPUT_FIELD=":P_INV_STATUS"
38 APPS="INV"');*/null;
39
40 l_fnd_install := fnd_installation.GET_APP_INFO('INV',P_INV_STATUS,l_INDUSTRY,l_ORACLE_SCHEMA);
41
42
43 if (P_INV_STATUS = 'I') then
44
45 null;
46 else
47 P_FLEX_LOCATOR := 'TO_CHAR(NULL)';
48 end if;
49
50
51 null;
52
53 null;
54
55 null;
56 /*srw.message( 1003, ' The from ship No is ' || P_ship_num_from );*/null;
57
58 /*srw.message( 1004, ' The To ship Num is '|| P_ship_num_to);*/null;
59
60
61 RETURN TRUE;
62 END;
63 return (TRUE);
64 end;
65
66 function get_p_struct_num return boolean is
67
71 select structure_id
68 l_p_struct_num number;
69
70 begin
72 into l_p_struct_num
73 from mtl_default_sets_view
74 where functional_area_id = 2 ;
75
76 P_STRUCT_NUM1 := l_p_struct_num ;
77
78 return(TRUE) ;
79
80 RETURN NULL; exception
81 when others then return(FALSE) ;
82 end;
83
84 procedure get_precision is
85 begin
86 /*srw.attr.mask := SRW.FORMATMASK_ATTR;*/null;
87
88 if P_qty_precision = 0 then /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0';*/null;
89
90 else
91 if P_qty_precision = 1 then /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0.0';*/null;
92
93 else
94 if P_qty_precision = 3 then /*srw.attr.formatmask := '-NN,NNN,NNN,NN0.000';*/null;
95
96 else
97 if P_qty_precision = 4 then /*srw.attr.formatmask := '-N,NNN,NNN,NN0.0000';*/null;
98
99 else
100 if P_qty_precision = 5 then /*srw.attr.formatmask := '-NNN,NNN,NN0.00000';*/null;
101
102 else
103 if P_qty_precision = 6 then /*srw.attr.formatmask := '-NN,NNN,NN0.000000';*/null;
104
105 else /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0.00';*/null;
106
107 end if; end if; end if; end if; end if; end if;
108 /*srw.set_attr(0,srw.attr);*/null;
109
110 end;
111
112 function G_src_and_typeGroupFilter return boolean is
113 begin
114
115
116 return (TRUE);
117 end;
118
119 function AfterPForm return boolean is
120 begin
121
122 declare
123 req_numbering_type varchar2(240);
124 receipt_numbering_type varchar2(240);
125 po_numbering_type varchar2(240);
126
127 apostrophe_pos_from number;
128 before_apos_from varchar2(240);
129 after_apos_from varchar2(240);
130 vend_length_from varchar2(240);
131
132 apostrophe_pos_to number;
133 before_apos_to varchar2(240);
134 after_apos_to varchar2(240);
135 vend_length_to varchar2(240);
136
137 check_apos_from number;
138 check_apos_to number;
139
140
141 apostrophe_cust_from number;
142 before_cust_from varchar2(240);
143 after_cust_from varchar2(240);
144 cust_length_from varchar2(240);
145
146 apostrophe_cust_to number;
147 before_cust_to varchar2(240);
148 after_cust_to varchar2(240);
149 cust_length_to varchar2(240);
150
151 check_cust_from number;
152 check_cust_to number;
153
154 Begin
155 /*SRW.USER_EXIT('FND SRWINIT');*/null;
156
157
158
159 SELECT manual_po_num_type
160 , manual_req_num_type
161 , manual_receipt_num_type
162 INTO po_numbering_type
163 , req_numbering_type
164 , receipt_numbering_type
165 FROM po_system_parameters;
166
167
168
169 Begin
170
171 SELECT rcvp.manual_receipt_num_type
172 INTO receipt_numbering_type
173 FROM rcv_parameters rcvp
174 WHERE rcvp.organization_id=P_org_id;
175
176 exception
177 When no_data_found Then
178 null;
179 End;
180
181
182
183
184 if (P_org_id is not null) then
185 P_where_org_id := 'hru.organization_id =' || to_char(P_org_id);
186 else
187 P_where_org_id := '1=1';
188 end if;
189
190 if (P_trx_type is not null) then
191 P_where_trx_type := 'rct.transaction_type = :P_trx_type';
192 else
193 P_where_trx_type := '1=1';
194 end if;
195
196
197 if ((P_receipt_num_from is not null) and (receipt_numbering_type = 'ALPHANUMERIC')) then
198 P_where_receipt_num_from := 'rsh.receipt_num >= :P_receipt_num_from';
199 elsif
200 ((P_receipt_num_from is not null) and (receipt_numbering_type = 'NUMERIC')) then
201 P_where_receipt_num_from := 'decode(ltrim(rsh.receipt_num,''0123456789''),NULL,to_number(rsh.receipt_num),-1) >= :P_receipt_num_from ';
202 else
203 P_where_receipt_num_from := '1=1';
204 end if;
205
206 if ((P_receipt_num_to is not null) and (receipt_numbering_type = 'ALPHANUMERIC')) then
207 P_where_receipt_num_to := 'rsh.receipt_num <= :P_receipt_num_to ';
208 elsif
209 ((P_receipt_num_to is not null) and (receipt_numbering_type = 'NUMERIC')) then
210 P_where_receipt_num_to := 'decode(ltrim(rsh.receipt_num,''0123456789''),NULL,to_number(rsh.receipt_num),:P_receipt_num_to +1) <= :P_receipt_num_to';
211 else
212 P_where_receipt_num_to := '1=1';
213 end if;
214
215 if (( P_receipt_num_from is not null)
216 and (P_receipt_num_from = P_receipt_num_to)
217 and (receipt_numbering_type = 'ALPHANUMERIC')) then
218
219 P_where_receipt_num_from := 'rsh.receipt_num = :P_receipt_num_from ';
220 P_where_receipt_num_to := '1=1';
221
222 elsif (( P_receipt_num_from is not null)
223 and (P_receipt_num_from = P_receipt_num_to)
224 and (receipt_numbering_type = 'NUMERIC')) then
225
226 P_where_receipt_num_from := 'decode(ltrim(rsh.receipt_num,''0123456789''),NULL,to_number(rsh.receipt_num),-1) = :P_receipt_num_from ';
227 P_where_receipt_num_to := '1=1';
228 end if;
229
230
231 if ((P_po_num_from is not null) and (po_numbering_type = 'ALPHANUMERIC')) then
232 P_where_po_num_from := 'poh.segment1 >= :P_po_num_from ';
233 elsif
234 ((P_po_num_from is not null) and (po_numbering_type = 'NUMERIC')) then
235 P_where_po_num_from := 'decode(rtrim(poh.segment1,''0123456789''),NULL,to_number(poh.segment1),null) >= :P_po_num_from ';
236 else
237 P_where_po_num_from := '1=1';
238 end if;
239
243 ((P_po_num_to is not null) and (po_numbering_type = 'NUMERIC')) then
240 if ((P_po_num_to is not null) and (po_numbering_type = 'ALPHANUMERIC')) then
241 P_where_po_num_to := 'poh.segment1 <= :P_po_num_to ';
242 elsif
244 P_where_po_num_to := 'decode(rtrim(poh.segment1,''0123456789''),NULL,to_number(poh.segment1),null)
245 <= :P_po_num_to ';
246 else
247 P_where_po_num_to := '1=1';
248 end if;
249
250 if ((P_po_num_to is not null)
251 and (P_po_num_from = P_po_num_to)
252 and (po_numbering_type = 'ALPHANUMERIC')) then
253 P_where_po_num_from := 'poh.segment1 = :P_po_num_from ';
254 P_where_po_num_to := '1=1';
255 elsif
256 ((P_po_num_to is not null)
257 and (P_po_num_from = P_po_num_to)
258 and (po_numbering_type = 'NUMERIC')) then
259 P_where_po_num_from := 'decode(rtrim(poh.segment1,''0123456789''),NULL,to_number(poh.segment1),null)
260 = :P_po_num_from';
261 P_where_po_num_to := '1=1';
262 end if;
263
264
265
266 if (P_buyer is not null) then
267 P_where_buyer := 'p2.full_name = :P_buyer ';
268 else
269 P_where_buyer := '1=1';
270 end if;
271
272
273
274
275 check_apos_from := instr(p_vendor_from,'''',1);
276 check_apos_to := instr(p_vendor_to,'''',1);
277
278
279
280 if check_apos_from > 0 then
281
282 vend_length_from := NVL(length(p_vendor_from), 0);
283 apostrophe_pos_from := instr(p_vendor_from,'''',1);
284 before_apos_from := substr(p_vendor_from,1,apostrophe_pos_from - 1);
285 after_apos_from := substr(p_vendor_from,apostrophe_pos_from + 1,vend_length_from);
286
287 P_where_vendor_from := 'pov.vendor_name >= '||''''||before_apos_from||''''||''''||after_apos_from||'''';
288
289 else
290 if (P_vendor_from is null) then
291 P_where_vendor_from := '1=1';
292 else
293 P_where_vendor_from := 'pov.vendor_name >= :p_vendor_from ';
294 end if;
295 end if;
296
297 if check_apos_to > 0 then
298
299 vend_length_to := NVL(length(p_vendor_to), 0);
300 apostrophe_pos_to := instr(p_vendor_to,'''',1);
301 before_apos_to := substr(p_vendor_to,1,apostrophe_pos_to - 1);
302 after_apos_to := substr(p_vendor_to,apostrophe_pos_to + 1,vend_length_to);
303
304 P_where_vendor_to := 'pov.vendor_name <= ' ||''''||before_apos_to||''''||''''||after_apos_to||'''';
305
306 else
307 if (P_vendor_to is null) then
308 P_where_vendor_to := '1=1';
309 else
310 P_where_vendor_to := 'pov.vendor_name <= :p_vendor_to ';
311 end if;
312 end if;
313
314
315
316
317
318 check_cust_from := instr(p_customer_from,'''',1);
319 check_cust_to := instr(p_customer_to,'''',1);
320
321
322
323 if check_cust_from > 0 then
324
325 cust_length_from := NVL(length(p_customer_from), 0);
326 apostrophe_cust_from := instr(p_customer_from,'''',1);
327 before_cust_from := substr(p_customer_from,1,apostrophe_cust_from - 1);
328 after_cust_from := substr(p_customer_from,apostrophe_cust_from + 1,cust_length_from);
329
330 P_where_customer_from := 'oev.name >= '||''''||before_cust_from||''''||''''||after_cust_from||'''';
331
332 else
333 if (P_customer_from is null) then
334 P_where_customer_from := '1=1';
335 else
336 P_where_customer_from := 'oev.name >= :p_customer_from ';
337 end if;
338 end if;
339
340 if check_apos_to > 0 then
341
342 cust_length_to := NVL(length(p_customer_to), 0);
343 apostrophe_cust_to := instr(p_customer_to,'''',1);
344 before_cust_to := substr(p_customer_to,1,apostrophe_cust_to - 1);
345 after_cust_to := substr(p_customer_to,apostrophe_cust_to + 1,cust_length_to);
346
347 P_where_customer_to := 'oev.name <= ' ||''''||before_cust_to||''''||''''||after_cust_to||'''';
348
349 else
350 if (P_customer_to is null) then
351 P_where_customer_to := '1=1';
352 else
353 P_where_customer_to := 'oev.name <= :p_customer_to ';
354 end if;
355 end if;
356
357
358
359
360
361 if (P_trx_date_from is not null) then
362 P_where_trx_date_from := ' rct.transaction_date >= trunc(:P_trx_date_from)';
363 else
364 P_where_trx_date_from := '1=1';
365 end if;
366
367
368
369 if (P_trx_date_to is not null) then
370 P_where_trx_date_to := ' rct.transaction_date < trunc(:P_trx_date_to)+1';
371 else
372 P_where_trx_date_to := '1=1';
373 end if;
374
375 if (P_ship_num_from is not null) then
376 P_where_ship_num_from := 'rsh.shipment_num >= :P_ship_num_from ';
377 /*srw.message( 10001, ' The from ship No is ' || P_ship_num_from ) ;*/null;
378
379 else
380 P_where_ship_num_from := '1=1';
381 end if;
382
383 if (P_ship_num_to is not null) then
384 P_where_ship_num_to := 'rsh.shipment_num <= :P_ship_num_to ';
385 /*srw.message(1002, ' The to shipment No is '|| P_ship_num_to );*/null;
386
387 else
388 P_where_ship_num_to := '1=1';
389 end if;
390
391 if ((P_ship_num_from is not null) and (P_ship_num_to = P_ship_num_from)) then
392 P_where_ship_num_from := 'rsh.shipment_num = :P_ship_num_from ';
393 P_where_ship_num_to := '1=1';
394 end if;
395
396
397
398 if ((P_req_num_from is not null) and (req_numbering_type = 'ALPHANUMERIC')) then
399 P_where_req_num_from := 'prh.segment1 >= :P_req_num_from ';
403 P_where_req_num_from := '1=1';
400 elsif
401 ((P_req_num_from is not null) and (req_numbering_type = 'NUMERIC')) then
402 P_where_req_num_from := 'decode( ltrim(prh.segment1,''0123456789'') , NULL , to_number(prh.segment1) , null ) >= :P_req_num_from'; else
404 end if;
405
406 if ((P_req_num_to is not null) and (req_numbering_type = 'ALPHANUMERIC')) then
407 P_where_req_num_to := 'prh.segment1 <= :P_req_num_to ';
408 elsif
409 ((P_req_num_to is not null) and (req_numbering_type = 'NUMERIC')) then
410 P_where_req_num_to := 'decode( ltrim(prh.segment1,''0123456789'') , NULL , to_number(prh.segment1) , null ) <= :P_req_num_to';else
411 P_where_req_num_to := '1=1';
412 end if;
413
414 if ((P_req_num_from is not null)
415 and (P_req_num_from = P_req_num_to)
416 and (req_numbering_type IN( 'ALPHANUMERIC','NUMERIC'))) then
417 P_where_req_num_from := 'prh.segment1 = :P_req_num_from ';
418 P_where_req_num_to := '1=1';
419 end if;
420
421
422 if (P_rma_num_from is not null) then
423 P_where_rma_num_from := 'to_number(oeh.order_number) >= :P_rma_num_from';
424 else
425 P_where_rma_num_from := '1=1';
426 end if;
427
428
429 if (P_rma_num_to is not null) then
430 P_where_rma_num_to := 'to_number(oeh.order_number) <= :P_rma_num_to';
431 else
432 P_where_rma_num_to := '1=1';
433 end if;
434
435 if ((P_rma_num_from is not null)
436 and (P_rma_num_from = P_rma_num_to)) then
437 P_where_rma_num_from := 'to_number(oeh.order_number) = :P_rma_num_from';
438 P_where_rma_num_to := '1=1';
439 end if;
440
441
442
443 End; return (TRUE);
444 end;
445
446 function AfterReport return boolean is
447 begin
448
449 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
450 return (TRUE);
451 end;
452
453 function rcv_uom_convertformula(PO_UOM in varchar2, UOM in varchar2, ls_item_id in number, PRICE in number) return number is
454 l_uom_rate number;
455 l_new_price number;
456 BEGIN
457
458
459 IF (PO_UOM IS NOT NULL AND UOM IS NOT NULL) THEN
460 IF (PO_UOM <> UOM) THEN
461 l_uom_rate := po_uom_s.po_uom_convert(uom, po_uom,ls_item_id);
462
463 l_new_price := PRICE * l_uom_rate;
464 l_new_price := round(l_new_price,5);
465 ELSE
466 l_new_price := PRICE;
467
468 END IF;
469 ELSE
470 return(PRICE);
471 END IF;
472
473 return(l_new_price);
474 END;
475
476 --Functions to refer Oracle report placeholders--
477
478 END PO_RCVTXRTR_new_XMLP_PKG ;
479