1 PACKAGE BODY PO_POXKISUM_XMLP_PKG AS
2 /* $Header: POXKISUMB.pls 120.2 2007/12/25 11:02:02 krreddy noship $ */
3
4 USER_EXIT_FAILURE EXCEPTION;
5
6 function BeforeReport return boolean is
7 begin
8
9 DECLARE
10 l_sort po_lookup_codes.displayed_field%type;
11 C_DATE_FORMAT varchar2(20);
12 BEGIN
13 /*SRW.USER_EXIT('FND SRWINIT');*/null;
14 C_DATE_FORMAT := 'DD-MON-YY';
15 CP_CREATION_DATE_FROM :=to_char(P_CREATION_DATE_FROM,C_DATE_FORMAT);
16 CP_CREATION_DATE_TO :=to_char(P_CREATION_DATE_TO,C_DATE_FORMAT);
17
18 P_ORDERBY := P_SORT ;
19
20 IF P_ORDERBY is NOT NULL THEN
21
22 SELECT displayed_field
23 INTO l_sort
24 FROM po_lookup_codes
25 WHERE lookup_code = P_ORDERBY
26 AND lookup_type = 'SRS ORDER BY';
27
28 P_ORDERBY_DISPLAYED := l_sort;
29
30 ELSE
31
32 P_ORDERBY_DISPLAYED := '';
33
34 END IF;
35
36 RETURN TRUE;
37 END; return (TRUE);
38 end;
39
40 function AfterReport return boolean is
41 begin
42
43 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
44
45 return (TRUE);
46 end;
47
48 function return_amt_saved(C_AMOUNT_LIST1 in number, C_AMOUNT_ACTUAL1 in number) return number is
49 begin
50
51 /*srw.reference (C_AMOUNT_LIST1);*/null;
52
53 /*srw.reference (C_AMOUNT_ACTUAL1);*/null;
54
55
56 return C_AMOUNT_LIST1 - C_AMOUNT_ACTUAL1;
57
58 end;
59
60 function orderby_clauseFormula return VARCHAR2 is
61 begin
62
63 if upper(P_ORDERBY) = 'BUYER' then
64 return('ppf.full_name');
65 elsif upper(P_ORDERBY) = 'PO TYPE' then
66 return('plc.displayed_field');
67 elsif upper(P_ORDERBY) = 'PO NUMBER' then
68 return('decode(psp1.manual_po_num_type,''NUMERIC'',
69 null,poh.segment1),
70 decode(psp1.manual_po_num_type,''NUMERIC'',
71 to_number(poh.segment1),null)');
72 end if;
73 RETURN NULL; end;
74
75 function return_amt_act(C_quantity in number, Line_price in number, Rate in number) return number is
76 begin
77
78 /*srw.reference(C_quantity);*/null;
79
80 /*srw.reference(Line_price);*/null;
81
82 /*srw.reference(Rate);*/null;
83
84
85 return(nvl(C_quantity,0)
86 * nvl(Line_price,0)
87 * nvl(Rate,1));
88 end;
89
90 function return_amt_list(C_min_quote in number, Market_price in number, List in number, C_quantity in number, Rate in number) return number is
91 amount number := 0;
92 begin
93 /*srw.reference(C_quantity);*/null;
94
95 /*srw.reference(C_min_quote);*/null;
96
97 /*srw.reference(List);*/null;
98
99 /*srw.reference(Market_price);*/null;
100
101 /*srw.reference(Rate);*/null;
102
103
104 if C_min_quote is not null and C_min_quote <> 0 then
105 amount := C_min_quote;
106 elsif Market_price is not null then
107 amount := Market_price;
108 elsif List is not null then
109 amount := List;
110 end if;
111
112 return (amount)*nvl(C_quantity,0) * nvl(Rate,1);
113
114 end;
115
116 function return_type(C_min_quote in number, Quote_code in varchar2, Market_price in number, Market_code in varchar2, List in number, List_code in varchar2) return varchar2 is
117
118 type_code VARCHAR2(25) := ' ';
119
120 begin
121
122 /*srw.reference (C_min_quote);*/null;
123
124 /*srw.reference (Market_price);*/null;
125
126 /*srw.reference (List);*/null;
127
128
129 if C_min_quote is not NULL and C_min_quote <> 0 then
130 type_code := Quote_code;
131 elsif Market_price is not NULL then
132 type_code := Market_code;
133 elsif List is not NULL then
134 type_code := List_code;
135 end if;
136
137 return type_code;
138
139 end;
140
141 function return_list(C_min_quote in number, Market_price in number, List in number, Rate in number) return number is
142
143 list_price number := 0;
144
145 begin
146 /*srw.reference(Order_type);*/null;
147
148 /*srw.reference(C_min_quote);*/null;
149
150 /*srw.reference(Market_price);*/null;
151
152 /*srw.reference(List);*/null;
153
154 /*srw.reference(Rate);*/null;
155
156
157 if C_min_quote is not null and C_min_quote <> 0 then
158 list_price := C_min_quote;
159 elsif Market_price is not null then
160 list_price := Market_price;
161 elsif List is not null then
162 list_price := List;
163 end if;
164
165 return (list_price * nvl(Rate,1));
166
167 end;
168
169 function return_discount(C_AMOUNT_LIST1 in number, C_AMOUNT_ACTUAL1 in number) return number is
170 begin
171
172 /*srw.reference (C_AMOUNT_LIST1);*/null;
173
174 /*srw.reference (C_AMOUNT_ACTUAL1);*/null;
175
176
177 if (C_AMOUNT_LIST1 - C_AMOUNT_ACTUAL1) <= 0 then
178 return 0;
179 else
180 return ((C_AMOUNT_LIST1 - C_AMOUNT_ACTUAL1) /C_AMOUNT_LIST1) * 100;
181 end if;
182 RETURN NULL; end;
183
184 function get_quantity(Shipment_quantity in number, Shipment_quantity_cancelled in number, Line_quantity in number) return number is
185
186 begin
187 /*srw.reference (Shipment_quantity);*/null;
188
189 /*srw.reference (Shipment_quantity_cancelled);*/null;
190
191 /*srw.reference (Line_quantity);*/null;
192
193 /*srw.reference (P_qty_precision);*/null;
194
195
196 if (Shipment_quantity) is not null then
197 return round((nvl(Shipment_quantity,0) - nvl(Shipment_quantity_cancelled,0)),P_qty_precision);
198 else
199 return round(nvl(Line_quantity,0),P_qty_precision);
200 end if;
201
202 RETURN NULL; end;
203
204 function round_amount_actual_rep(c_amount_actual_rep in number, c_curr_precision in number) return number is
205 begin
206
207 /*srw.reference(c_amount_actual_rep);*/null;
208
209 /*srw.reference(c_curr_precision);*/null;
210
211
212 return(round(c_amount_actual_rep, c_curr_precision));
213 end;
214
215 function round_amount_saved_rep(c_amount_saved_rep in number, c_curr_precision in number) return number is
216 begin
217
218 /*srw.reference(c_amount_saved_rep);*/null;
219
220 /*srw.reference(c_curr_precision);*/null;
221
222
223 return(round(c_amount_saved_rep, c_curr_precision));
224 end;
225
226 function round_amount_list_rep(c_amount_list_rep in number, c_curr_precision in number) return number is
227 begin
228
229 /*srw.reference(c_amount_list_rep);*/null;
230
231 /*srw.reference(c_curr_precision);*/null;
232
233
234 return(round(c_amount_list_rep, c_curr_precision));
235 end;
236
237 function round_amount_list_subtotal_rep(c_amount_list_subtotal in number, c_curr_precision in number) return number is
238 begin
239
240 /*srw.reference(c_amount_list_subtotal);*/null;
241
242 /*srw.reference(c_curr_precision);*/null;
243
244
245 return(round(c_amount_list_subtotal, c_curr_precision));
246 end;
247
248 function round_amount_actual_subtotal(c_amount_actual_subtotal in number, c_curr_precision in number) return number is
249 begin
250
251 /*srw.reference(c_amount_actual_subtotal);*/null;
252
253 /*srw.reference(c_curr_precision);*/null;
254
255
256 return(round(c_amount_actual_subtotal, c_curr_precision));
257 end;
258
259 function round_amount_saved_subtotal(c_amount_saved_subtotal in number, c_curr_precision in number) return number is
260 begin
261
262 /*srw.reference(c_amount_saved_subtotal);*/null;
263
264 /*srw.reference(c_curr_precision);*/null;
265
266
267 return(round(c_amount_saved_subtotal, c_curr_precision));
268 end;
269
270 function round_amount_list1(c_amount_list1 in number, c_curr_precision in number) return number is
271 begin
272
273 /*srw.reference(c_amount_list1);*/null;
274
275 /*srw.reference(c_curr_precision);*/null;
276
277
278 return(round(c_amount_list1, c_curr_precision));
279 end;
280
281 function round_amount_actual1(c_amount_actual1 in number, c_curr_precision in number) return number is
282 begin
283
284 /*srw.reference(c_amount_actual1);*/null;
285
286 /*srw.reference(c_curr_precision);*/null;
287
288
289 return(round(c_amount_actual1, c_curr_precision));
290 end;
291
292 function round_amount_saved(c_amount_saved in number, c_curr_precision in number) return number is
293 begin
294
295 /*srw.reference(c_amount_saved);*/null;
296
297 /*srw.reference(c_curr_precision);*/null;
298
299
300 return(round(c_amount_saved, c_curr_precision));
301 end;
302
303 --Functions to refer Oracle report placeholders--
304
305 END PO_POXKISUM_XMLP_PKG ;
306