[Home] [Help]
PACKAGE BODY: APPS.PO_POXRCPPV_XMLP_PKG
Source
1 PACKAGE BODY PO_POXRCPPV_XMLP_PKG AS
2 /* $Header: POXRCPPVB.pls 120.1.12010000.2 2008/11/30 10:17:57 mpuranik ship $ */
3
4 function BeforeReport return boolean is
5 begin
6
7 declare
8 l_org org_organization_definitions.organization_name%type;
9 l_sort po_lookup_codes.displayed_field%type ;
10 l_cr_installed boolean;
11 begin
12
13
14 if P_org_id is not null then
15
16 select organization_name
17 into l_org
18 from org_organization_definitions
19 where organization_id = P_org_id ;
20
21 P_org_displayed := l_org;
22
23 else
24
25 P_org_displayed := '' ;
26
27 end if;
28
29 if P_Trans_Date_to is not null then
30 SELECT trunc(P_Trans_Date_to) +1 - .00001
31 INTO P_Trans_Date_to
32 FROM DUAL;
33 end if;
34
35 /*SRW.USER_EXIT('FND SRWINIT');*/null;
36
37
38 /*srw.user_exit('FND INSTALLATION OUTPUT_TYPE="STATUS"
39 OUTPUT_FIELD=":P_WIP_STATUS"
40 APPS="WIP"') ;*/null;
41
42
43
44 /*srw.message(1,'Wip Installation status is ' || P_WIP_STATUS) ;*/null;
45
46
47
48 null;
49
50
51 null;
52
53
54 null;
55
56
57 null;
58
59
60 null;
61
62
63
64 RETURN TRUE;
65 END; return (TRUE);
66 end;
67
68 function from_std_unitcost return character is
69 wip_status VARCHAR2(1);
70 begin
71
72
73 if P_wip_status = 'I' then
74 return (', wip_transactions wt');
75 end if;
76 --RETURN NULL;
77 RETURN ' ';
78 end;
79
80 function where_std_unit_cost return character is
81 wip_status VARCHAR2(1);
82 begin
83
84
85 if P_wip_status = 'I' then
86 return(
87 'AND rct.transaction_id=wt.rcv_transaction_id
88 AND wt.standard_rate_flag=1
89 AND wt.transaction_type = 3
90 AND exists (select 1 from wip_transaction_accounts wta
91 where wta.transaction_id = wt.transaction_id
92 and wta.accounting_line_type = 6)' );
93
94 end if;
95
96 --RETURN NULL;
97 RETURN ' ';
98 end;
99
100 function get_std_unit_cost return character is
101 wip_status VARCHAR2(1);
102 begin
103 if P_wip_status = 'I' then
104 return(
105 'wt.standard_resource_rate * decode(msi.outside_operation_uom_type,'||'''ASSEMBLY'''||', decode(wt.usage_rate_or_amount,0,1,wt.usage_rate_or_amount), 1)');
106 end if;
107
108 --RETURN NULL;
109 RETURN null;
110 end;
111
112 function c_price_varianceformula(PO_Functional_Price in number, STD_UNIT_COST in number, moh_absorbed_per_unit in number, Quantity_received in number, c_precision in number) return number is
113 begin
114 return ( round(( PO_Functional_Price - STD_UNIT_COST + moh_absorbed_per_unit ) * Quantity_received,c_precision));
115 end;
116
117 /* Support for landed cost management */
118 function c_price_varianceformula_lcm(functional_landed_cost in number, prior_landed_cost in number, quantity_received in number, c_precision in number) return number is
119 begin
120 return ( round(( functional_landed_cost - prior_landed_cost) * Quantity_received,c_precision));
121 end;
122
123
124 function orderby_clauseFormula return VARCHAR2 is
125 begin
126
127 if P_ORDERBY = 'CATEGORY' then
128 return(P_ORDERBY_CAT);
129 elsif P_ORDERBY = 'ITEM' then
130 return(P_ORDERBY_ITEM);
131 elsif P_ORDERBY = 'VENDOR' then
132 return('pov.vendor_name');
133 elsif P_ORDERBY = 'BUYER' then
134 return('papf.full_name');
135 end if;
136 RETURN NULL; end;
137
138 procedure get_precision is
139 begin
140 /*srw.attr.mask := SRW.FORMATMASK_ATTR;*/null;
141
142 if P_qty_precision = 0 then /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0';*/null;
143
144 else
145 if P_qty_precision = 1 then /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0.0';*/null;
146
147 else
148 if P_qty_precision = 3 then /*srw.attr.formatmask := '-NN,NNN,NNN,NN0.000';*/null;
149
150 else
151 if P_qty_precision = 4 then /*srw.attr.formatmask := '-N,NNN,NNN,NN0.0000';*/null;
152
153 else
154 if P_qty_precision = 5 then /*srw.attr.formatmask := '-NNN,NNN,NN0.00000';*/null;
155
156 else
157 if P_qty_precision = 6 then /*srw.attr.formatmask := '-NN,NNN,NN0.000000';*/null;
158
159 else /*srw.attr.formatmask := '-NNN,NNN,NNN,NN0.00';*/null;
160
161 end if; end if; end if; end if; end if; end if;
162 /*srw.set_attr(0,srw.attr);*/null;
163
164 end;
165
166 function c_price_variance1formula(PO_Functional_Price1 in number, STD_UNIT_COST1 in number, moh_absorbed_per_unit1 in number, Quantity_received1 in number, c_precision in number) return number is
167 begin
168 return ( round(( PO_Functional_Price1 - STD_UNIT_COST1 + moh_absorbed_per_unit1 ) * Quantity_received1,c_precision));
169 end;
170
171 function AfterPForm return boolean is
172 begin
173 If (P_Trans_Date_From is null and P_Trans_Date_to is null) then
174 P_TX_DATE_WHERE := 'AND 1=1';
175
176 elsif (P_Trans_Date_from is not null and P_Trans_Date_to is null) then
177 P_TX_DATE_WHERE := 'AND rct.transaction_date >= :P_Trans_Date_from';
178
179 elsif (P_Trans_Date_from is null and P_Trans_Date_to is not null) then
180 P_TX_DATE_WHERE := 'AND rct.transaction_date <= :P_Trans_Date_to';
181
182 elsif(P_Trans_Date_from is not null and P_Trans_Date_to is not null) then
183 P_TX_DATE_WHERE := 'AND rct.transaction_date between :P_Trans_Date_from and :P_Trans_Date_to';
184
185 end if;
186
187 return (TRUE);
188 end;
189
190 function std_unit_cost_fformula(inventory_item_id in number, organization_id in varchar2, receipt_date in date, process_enabled_flag in varchar2, std_unit_cost in number, c_ext_precision in number) return number is
191 l_result_code VARCHAR2(30);
192 l_return_status VARCHAR2(30);
193 l_msg_count NUMBER;
194 l_msg_data VARCHAR2(2000);
195 l_inventory_item_id NUMBER := inventory_item_id;
196 l_organization_id NUMBER := organization_id;
197 l_transaction_date DATE := receipt_date;
198 l_cost_mthd VARCHAR2(15);
199 l_cmpntcls NUMBER;
200 l_analysis_code VARCHAR2(15);
201 l_item_cost NUMBER;
202 l_no_of_rows NUMBER;
203 begin
204 IF process_enabled_flag = 'Y' THEN
205 l_result_code := GMF_CMCOMMON.Get_Process_Item_Cost
206 ( p_api_version => 1
207 , p_init_msg_list => 'F'
208 , x_return_status => l_return_status
209 , x_msg_count => l_msg_count
210 , x_msg_data => l_msg_data
211 , p_inventory_item_id => l_inventory_item_id
212 , p_organization_id => l_organization_id
213 , p_transaction_date => l_transaction_date
214 , p_detail_flag => 1
215 , p_cost_method => l_cost_mthd
216 , p_cost_component_class_id => l_cmpntcls
217 , p_cost_analysis_code => l_analysis_code
218 , x_total_cost => l_item_cost
219 , x_no_of_rows => l_no_of_rows
220 );
221
222 IF l_result_code <> 1 THEN
223 l_item_cost := 0;
224 END IF;
225 ELSE
226 l_item_cost := std_unit_cost;
227 END IF;
228
229 return round(l_item_cost, c_ext_precision);
230 end;
231
232 function AfterReport return boolean is
233 begin
234 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
235
236 return (TRUE);
237 end;
238
239 --Functions to refer Oracle report placeholders--
240
241 END PO_POXRCPPV_XMLP_PKG ;
242