5: G_PKG_NAME CONSTANT VARCHAR2(30) := 'PO_CHARGES_GRP';
6: G_LOG_MODULE CONSTANT VARCHAR2(40) := 'po.plsql.' || G_PKG_NAME;
7: G_CONC_LOG VARCHAR2(32767);
8:
9: g_asn_debug VARCHAR2(1) := asn_debug.is_debug_on; -- Bug 9152790: rcv debug enhancement
10: g_fte_cost_factor_details pon_price_element_types_vl%ROWTYPE:= pon_cf_type_grp.get_cost_factor_details('ORACLE_FTE_COST');
11: g_dummy_rci_tbl RCV_CHARGES_GRP.charge_interface_table_type;
12: g_charge_numbers NUMBER;
13:
12: g_charge_numbers NUMBER;
13:
14: -- Private support procedures
15:
16: -- wrapper for asn_debug
17: PROCEDURE string
18: ( log_level IN number
19: , module IN varchar2
20: , message IN varchar2
20: , message IN varchar2
21: ) IS
22: BEGIN
23: -- add to fnd_log_messages
24: asn_debug.put_line(module||': '||message,log_level);
25: END string;
26:
27: -- helper function for testing if a line has been rated in FTE
28: FUNCTION shipment_line_fte_rated(p_shipment_line_id NUMBER) RETURN BOOLEAN IS
58: l_cost_factor_details PON_PRICE_ELEMENT_TYPES_VL%ROWTYPE;
59: k NUMBER;
60: BEGIN
61:
62: IF (g_asn_debug = 'Y') THEN
63: asn_debug.put_line('Entering Capture_QP_Charges() for group_id:' || p_group_id
64: || ' and request_id:'|| p_request_id);
65: END IF;
66: k := 1;
59: k NUMBER;
60: BEGIN
61:
62: IF (g_asn_debug = 'Y') THEN
63: asn_debug.put_line('Entering Capture_QP_Charges() for group_id:' || p_group_id
64: || ' and request_id:'|| p_request_id);
65: END IF;
66: k := 1;
67: x_return_status := FND_API.G_RET_STS_SUCCESS;
98: AND rsh.receipt_source_code = 'VENDOR'
99: AND rsh.ship_to_org_id = rp.organization_id
100: AND rp.advanced_pricing = 'Y');
101:
102: IF (g_asn_debug = 'Y') THEN
103: asn_debug.put_line('Number of shipment headers retrieved for QP:' || l_rsh_id_table.count);
104: END IF;
105:
106: IF l_rsh_id_table.count < 1 THEN
99: AND rsh.ship_to_org_id = rp.organization_id
100: AND rp.advanced_pricing = 'Y');
101:
102: IF (g_asn_debug = 'Y') THEN
103: asn_debug.put_line('Number of shipment headers retrieved for QP:' || l_rsh_id_table.count);
104: END IF;
105:
106: IF l_rsh_id_table.count < 1 THEN
107: IF (g_asn_debug = 'Y') THEN
103: asn_debug.put_line('Number of shipment headers retrieved for QP:' || l_rsh_id_table.count);
104: END IF;
105:
106: IF l_rsh_id_table.count < 1 THEN
107: IF (g_asn_debug = 'Y') THEN
108: asn_debug.put_line('No shipment found for QP charges -> Return.');
109: END IF;
110: RETURN;
111: END IF;
104: END IF;
105:
106: IF l_rsh_id_table.count < 1 THEN
107: IF (g_asn_debug = 'Y') THEN
108: asn_debug.put_line('No shipment found for QP charges -> Return.');
109: END IF;
110: RETURN;
111: END IF;
112:
111: END IF;
112:
113: FOR i IN l_rsh_id_table.FIRST..l_rsh_id_table.LAST LOOP --{
114:
115: IF (g_asn_debug = 'Y') THEN
116: asn_debug.put_line('Inside QP rsh loop for rsh_id_tbl('||i||'): '|| l_rsh_id_table(i));
117: END IF;
118:
119: DECLARE
112:
113: FOR i IN l_rsh_id_table.FIRST..l_rsh_id_table.LAST LOOP --{
114:
115: IF (g_asn_debug = 'Y') THEN
116: asn_debug.put_line('Inside QP rsh loop for rsh_id_tbl('||i||'): '|| l_rsh_id_table(i));
117: END IF;
118:
119: DECLARE
120: l_header_rec PO_ADVANCED_PRICE_PVT.Header_Rec_Type;
135: l_line_level_charge VARCHAR2(1) := 'N'; --Bug 8551844
136: BEGIN
137: l_rsh_id := l_rsh_id_table(i);
138:
139: IF (g_asn_debug = 'Y') THEN
140: asn_debug.put_line('Populating l_header_rec');
141: END IF;
142: -- populate l_header_rec
143: SELECT PO_MOAC_UTILS_PVT.get_current_org_id,
136: BEGIN
137: l_rsh_id := l_rsh_id_table(i);
138:
139: IF (g_asn_debug = 'Y') THEN
140: asn_debug.put_line('Populating l_header_rec');
141: END IF;
142: -- populate l_header_rec
143: SELECT PO_MOAC_UTILS_PVT.get_current_org_id,
144: NULL, --p_order_header_id
165: INTO l_header_rec
166: FROM rcv_shipment_headers
167: WHERE shipment_header_id = l_rsh_id;
168:
169: IF (g_asn_debug = 'Y') THEN
170: asn_debug.put_line('Populating l_line_rec');
171: END IF;
172: -- populate l_line_rec_table
173: -- Passing Vendor_id and vendor_site_id so that line level modifiers with qualifiers will be applied.
166: FROM rcv_shipment_headers
167: WHERE shipment_header_id = l_rsh_id;
168:
169: IF (g_asn_debug = 'Y') THEN
170: asn_debug.put_line('Populating l_line_rec');
171: END IF;
172: -- populate l_line_rec_table
173: -- Passing Vendor_id and vendor_site_id so that line level modifiers with qualifiers will be applied.
174: --Bug 8731760, Acquisiton costs are not correct when PO UOM is different from receipt UOM.
210: AND nvl(plla.lcm_flag,'N') = 'N'; -- lcm changes
211:
212: -- lcm changes
213: IF (l_line_rec_table.COUNT = 0) THEN
214: IF (g_asn_debug = 'Y') THEN
215: asn_debug.put_line('No shipment line found for QP charges -> Return.');
216: END IF;
217: RETURN;
218: END IF;
211:
212: -- lcm changes
213: IF (l_line_rec_table.COUNT = 0) THEN
214: IF (g_asn_debug = 'Y') THEN
215: asn_debug.put_line('No shipment line found for QP charges -> Return.');
216: END IF;
217: RETURN;
218: END IF;
219:
220:
221: -- Bug 4776006: Use the currency_code of the first receipt line
222: -- if there is no currency defined on receipt header level.
223: IF l_header_rec.currency_code IS NULL THEN
224: IF (g_asn_debug = 'Y') THEN
225: asn_debug.put_line('Use first receipt line currency_code: '
226: || l_line_rec_table(1).currency_code);
227: END IF;
228: l_header_rec.currency_code := l_line_rec_table(1).currency_code;
221: -- Bug 4776006: Use the currency_code of the first receipt line
222: -- if there is no currency defined on receipt header level.
223: IF l_header_rec.currency_code IS NULL THEN
224: IF (g_asn_debug = 'Y') THEN
225: asn_debug.put_line('Use first receipt line currency_code: '
226: || l_line_rec_table(1).currency_code);
227: END IF;
228: l_header_rec.currency_code := l_line_rec_table(1).currency_code;
229: END IF;
227: END IF;
228: l_header_rec.currency_code := l_line_rec_table(1).currency_code;
229: END IF;
230:
231: IF (g_asn_debug = 'Y') THEN
232: asn_debug.put_line('Calling PO_ADVANCED_PRICE_PVT.get_advanced_price');
233: END IF;
234:
235: --PO_LOG.enable_logging();
228: l_header_rec.currency_code := l_line_rec_table(1).currency_code;
229: END IF;
230:
231: IF (g_asn_debug = 'Y') THEN
232: asn_debug.put_line('Calling PO_ADVANCED_PRICE_PVT.get_advanced_price');
233: END IF;
234:
235: --PO_LOG.enable_logging();
236:
244: ,p_return_freight_flag => TRUE
245: ,x_price_tbl => l_qp_cost_table
246: ,x_return_status => l_return_status);
247:
248: IF (g_asn_debug = 'Y') THEN
249: asn_debug.put_line('l_return_status: '|| l_return_status);
250: END IF;
251:
252: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
245: ,x_price_tbl => l_qp_cost_table
246: ,x_return_status => l_return_status);
247:
248: IF (g_asn_debug = 'Y') THEN
249: asn_debug.put_line('l_return_status: '|| l_return_status);
250: END IF;
251:
252: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
253: RAISE l_qp_api_exception;
256: IF l_qp_cost_table.count < 1 THEN
257: RAISE l_no_qp_charge;
258: END IF;
259:
260: IF (g_asn_debug = 'Y') THEN
261: asn_debug.put_line('Number of lines in l_qp_cost_table: ' ||l_qp_cost_table.count);
262: END IF;
263:
264: l_currency_code := l_header_rec.currency_code;
257: RAISE l_no_qp_charge;
258: END IF;
259:
260: IF (g_asn_debug = 'Y') THEN
261: asn_debug.put_line('Number of lines in l_qp_cost_table: ' ||l_qp_cost_table.count);
262: END IF;
263:
264: l_currency_code := l_header_rec.currency_code;
265:
268: l_line_quantities(l_line_rec_table(l).shipment_line_id) := NVL(l_line_rec_table(l).quantity, 1);
269: END LOOP;
270:
271: FOR j IN l_qp_cost_table.FIRST..l_qp_cost_table.LAST LOOP --{
272: IF (g_asn_debug = 'Y') THEN
273: asn_debug.put_line('Retrieving freight charges from l_qp_cost_table('||j||').'
274: ||' with line_id = '|| l_qp_cost_table(j).line_id);
275: END IF;
276:
269: END LOOP;
270:
271: FOR j IN l_qp_cost_table.FIRST..l_qp_cost_table.LAST LOOP --{
272: IF (g_asn_debug = 'Y') THEN
273: asn_debug.put_line('Retrieving freight charges from l_qp_cost_table('||j||').'
274: ||' with line_id = '|| l_qp_cost_table(j).line_id);
275: END IF;
276:
277: BEGIN --{ line loop block
303: IF l_qp_cost_table(j).line_id <> l_rsh_id OR
304: (l_qp_cost_table(j).line_id = l_rsh_id AND l_line_level_charge = 'Y'
305: AND l_qp_cost_table(j).base_unit_price IS NOT null ) THEN
306: l_rsl_id := l_qp_cost_table(j).line_id;
307: IF (g_asn_debug = 'Y') THEN
308: asn_debug.put_line('This is a line level charge.');
309: END IF;
310: ELSE
311: l_rsl_id :=NULL;
304: (l_qp_cost_table(j).line_id = l_rsh_id AND l_line_level_charge = 'Y'
305: AND l_qp_cost_table(j).base_unit_price IS NOT null ) THEN
306: l_rsl_id := l_qp_cost_table(j).line_id;
307: IF (g_asn_debug = 'Y') THEN
308: asn_debug.put_line('This is a line level charge.');
309: END IF;
310: ELSE
311: l_rsl_id :=NULL;
312: IF (g_asn_debug = 'Y') THEN
308: asn_debug.put_line('This is a line level charge.');
309: END IF;
310: ELSE
311: l_rsl_id :=NULL;
312: IF (g_asn_debug = 'Y') THEN
313: asn_debug.put_line('This is a header level charge.');
314: END IF;
315: END IF;
316:
309: END IF;
310: ELSE
311: l_rsl_id :=NULL;
312: IF (g_asn_debug = 'Y') THEN
313: asn_debug.put_line('This is a header level charge.');
314: END IF;
315: END IF;
316:
317: l_freight_charge_tbl := l_qp_cost_table(j).freight_charge_rec_tbl;
315: END IF;
316:
317: l_freight_charge_tbl := l_qp_cost_table(j).freight_charge_rec_tbl;
318: FOR n IN l_freight_charge_tbl.FIRST..l_freight_charge_tbl.LAST LOOP --{
319: IF (g_asn_debug = 'Y') THEN
320: asn_debug.put_line('Getting cost factor detail for cost_factor_id '
321: ||l_freight_charge_tbl(n).charge_type_code);
322: END IF;
323: l_cost_factor_details :=
316:
317: l_freight_charge_tbl := l_qp_cost_table(j).freight_charge_rec_tbl;
318: FOR n IN l_freight_charge_tbl.FIRST..l_freight_charge_tbl.LAST LOOP --{
319: IF (g_asn_debug = 'Y') THEN
320: asn_debug.put_line('Getting cost factor detail for cost_factor_id '
321: ||l_freight_charge_tbl(n).charge_type_code);
322: END IF;
323: l_cost_factor_details :=
324: pon_cf_type_grp.get_cost_factor_details(TO_NUMBER(l_freight_charge_tbl(n).charge_type_code));
326: SELECT po_rcv_charges_s.NEXTVAL
327: INTO l_charge_table(k).charge_id
328: FROM dual;
329:
330: IF (g_asn_debug = 'Y') THEN
331: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
332: END IF;
333:
334: l_charge_table(k).creation_date := SYSDATE;
327: INTO l_charge_table(k).charge_id
328: FROM dual;
329:
330: IF (g_asn_debug = 'Y') THEN
331: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
332: END IF;
333:
334: l_charge_table(k).creation_date := SYSDATE;
335: l_charge_table(k).created_by := FND_GLOBAL.user_id;
360: l_charge_table(k).cost_component_class_id := l_cost_factor_details.cost_component_class_id;
361: l_charge_table(k).cost_analysis_code := l_cost_factor_details.cost_analysis_code;
362: l_charge_table(k).include_in_acquisition_cost := l_cost_factor_details.cost_acquisition_code;--Bug#6821589
363:
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
361: l_charge_table(k).cost_analysis_code := l_cost_factor_details.cost_analysis_code;
362: l_charge_table(k).include_in_acquisition_cost := l_cost_factor_details.cost_acquisition_code;--Bug#6821589
363:
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
362: l_charge_table(k).include_in_acquisition_cost := l_cost_factor_details.cost_acquisition_code;--Bug#6821589
363:
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
363:
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
365: asn_debug.put_line('After populating charge_table(:' || k || ')');
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
366: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
374: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
367: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
374: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
375: END IF;
368: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
374: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
375: END IF;
376: k := k + 1; --increment k for every new charge record
369: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
374: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
375: END IF;
376: k := k + 1; --increment k for every new charge record
377: END LOOP; --} end of l_freight_charge_tbl loop
370: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
371: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
372: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
373: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
374: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
375: END IF;
376: k := k + 1; --increment k for every new charge record
377: END LOOP; --} end of l_freight_charge_tbl loop
378: EXCEPTION
376: k := k + 1; --increment k for every new charge record
377: END LOOP; --} end of l_freight_charge_tbl loop
378: EXCEPTION
379: WHEN l_no_freight_charge THEN
380: IF (g_asn_debug = 'Y') THEN
381: asn_debug.put_line('No QP charge for the line : ' ||l_qp_cost_table(j).line_id);
382: END IF;
383: END; --} end of line loop block
384: END LOOP; --} end of qp_cost_table loop
377: END LOOP; --} end of l_freight_charge_tbl loop
378: EXCEPTION
379: WHEN l_no_freight_charge THEN
380: IF (g_asn_debug = 'Y') THEN
381: asn_debug.put_line('No QP charge for the line : ' ||l_qp_cost_table(j).line_id);
382: END IF;
383: END; --} end of line loop block
384: END LOOP; --} end of qp_cost_table loop
385: EXCEPTION
383: END; --} end of line loop block
384: END LOOP; --} end of qp_cost_table loop
385: EXCEPTION
386: WHEN l_no_qp_charge THEN
387: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('No QP charge for shipment header: ' ||l_rsh_id_table(i) );
389: END IF;
390: WHEN l_qp_api_exception THEN
391: x_return_status := FND_API.G_RET_STS_ERROR;
384: END LOOP; --} end of qp_cost_table loop
385: EXCEPTION
386: WHEN l_no_qp_charge THEN
387: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('No QP charge for shipment header: ' ||l_rsh_id_table(i) );
389: END IF;
390: WHEN l_qp_api_exception THEN
391: x_return_status := FND_API.G_RET_STS_ERROR;
392: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('No QP charge for shipment header: ' ||l_rsh_id_table(i) );
389: END IF;
390: WHEN l_qp_api_exception THEN
391: x_return_status := FND_API.G_RET_STS_ERROR;
392: IF (g_asn_debug = 'Y') THEN
393: asn_debug.put_line('QP API returned error for shipment_id: ' ||l_rsh_id_table(i) );
394: END IF;
395: WHEN others THEN
396: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
389: END IF;
390: WHEN l_qp_api_exception THEN
391: x_return_status := FND_API.G_RET_STS_ERROR;
392: IF (g_asn_debug = 'Y') THEN
393: asn_debug.put_line('QP API returned error for shipment_id: ' ||l_rsh_id_table(i) );
394: END IF;
395: WHEN others THEN
396: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
397: x_msg_data := sqlerrm;
394: END IF;
395: WHEN others THEN
396: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
397: x_msg_data := sqlerrm;
398: IF (g_asn_debug = 'Y') THEN
399: asn_debug.put_line('Unexpected exception occured in QP loop: '|| x_msg_data);
400: END IF;
401:
402: END;
395: WHEN others THEN
396: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
397: x_msg_data := sqlerrm;
398: IF (g_asn_debug = 'Y') THEN
399: asn_debug.put_line('Unexpected exception occured in QP loop: '|| x_msg_data);
400: END IF;
401:
402: END;
403: END LOOP; --} end of rsh_id_table loop
401:
402: END;
403: END LOOP; --} end of rsh_id_table loop
404:
405: IF (g_asn_debug = 'Y') THEN
406: asn_debug.put_line('Total number of QP charges retrieved: ' || l_charge_table.COUNT );
407: END IF;
408:
409: -- Allocate all the QP charges
402: END;
403: END LOOP; --} end of rsh_id_table loop
404:
405: IF (g_asn_debug = 'Y') THEN
406: asn_debug.put_line('Total number of QP charges retrieved: ' || l_charge_table.COUNT );
407: END IF;
408:
409: -- Allocate all the QP charges
410: -- QP charges can be header level or line level
414: FORALL i IN INDICES OF l_charge_table
415: INSERT INTO po_rcv_charges
416: VALUES l_charge_table(i);
417:
418: IF (g_asn_debug = 'Y') THEN
419: asn_debug.put_line(sql%rowcount || ' rows inserted into po_rcv_charges');
420: END IF;
421:
422: -- bulk insert po_rcv_charge_allocations from the charge table
415: INSERT INTO po_rcv_charges
416: VALUES l_charge_table(i);
417:
418: IF (g_asn_debug = 'Y') THEN
419: asn_debug.put_line(sql%rowcount || ' rows inserted into po_rcv_charges');
420: END IF;
421:
422: -- bulk insert po_rcv_charge_allocations from the charge table
423: FORALL i IN INDICES OF l_charge_alloc_table
423: FORALL i IN INDICES OF l_charge_alloc_table
424: INSERT INTO po_rcv_charge_allocations
425: VALUES l_charge_alloc_table(i);
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line(sql%rowcount || ' rows inserted into po_rcv_charge_allocations');
429: END IF;
430:
431: EXCEPTION
424: INSERT INTO po_rcv_charge_allocations
425: VALUES l_charge_alloc_table(i);
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line(sql%rowcount || ' rows inserted into po_rcv_charge_allocations');
429: END IF;
430:
431: EXCEPTION
432: WHEN OTHERS THEN
431: EXCEPTION
432: WHEN OTHERS THEN
433: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
434: x_msg_data := sqlerrm;
435: IF (g_asn_debug = 'Y') THEN
436: asn_debug.put_line('Unexpected exception occured in Capture_QP_Charges(): '|| x_msg_data);
437: END IF;
438: END Capture_QP_Charges; --}
439:
432: WHEN OTHERS THEN
433: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
434: x_msg_data := sqlerrm;
435: IF (g_asn_debug = 'Y') THEN
436: asn_debug.put_line('Unexpected exception occured in Capture_QP_Charges(): '|| x_msg_data);
437: END IF;
438: END Capture_QP_Charges; --}
439:
440: PROCEDURE Capture_FTE_Estimated_Charges
457: k NUMBER;
458:
459: BEGIN
460:
461: IF (g_asn_debug = 'Y') THEN
462: asn_debug.put_line('Entering Capture_FTE_Estimated_Charges for group_id:' || p_group_id
463: || ' and request_id:'|| p_request_id);
464: END IF;
465:
458:
459: BEGIN
460:
461: IF (g_asn_debug = 'Y') THEN
462: asn_debug.put_line('Entering Capture_FTE_Estimated_Charges for group_id:' || p_group_id
463: || ' and request_id:'|| p_request_id);
464: END IF;
465:
466: k := 1;
480: AND rp.transportation_execution = 'Y'
481: AND rt.po_line_location_id = pll.line_location_id
482: AND nvl(pll.lcm_flag, 'N') = 'N';
483:
484: IF (g_asn_debug = 'Y') THEN
485: asn_debug.put_line('Number of shipment headers retreived:' || l_rsh_id_table.COUNT);
486: END IF;
487:
488: IF l_rsh_id_table.count < 1 THEN
481: AND rt.po_line_location_id = pll.line_location_id
482: AND nvl(pll.lcm_flag, 'N') = 'N';
483:
484: IF (g_asn_debug = 'Y') THEN
485: asn_debug.put_line('Number of shipment headers retreived:' || l_rsh_id_table.COUNT);
486: END IF;
487:
488: IF l_rsh_id_table.count < 1 THEN
489: IF (g_asn_debug = 'Y') THEN
485: asn_debug.put_line('Number of shipment headers retreived:' || l_rsh_id_table.COUNT);
486: END IF;
487:
488: IF l_rsh_id_table.count < 1 THEN
489: IF (g_asn_debug = 'Y') THEN
490: asn_debug.put_line('No shipment found for FTE charges -> Return.');
491: END IF;
492: RETURN;
493: END IF;
486: END IF;
487:
488: IF l_rsh_id_table.count < 1 THEN
489: IF (g_asn_debug = 'Y') THEN
490: asn_debug.put_line('No shipment found for FTE charges -> Return.');
491: END IF;
492: RETURN;
493: END IF;
494:
493: END IF;
494:
495: FOR i IN 1..l_rsh_id_table.COUNT LOOP --{
496:
497: IF (g_asn_debug = 'Y') THEN
498: asn_debug.put_line('Inside FTE rsh loop for rsh_id_tbl('||i||'): '|| l_rsh_id_table(i));
499: END IF;
500:
501: DECLARE
494:
495: FOR i IN 1..l_rsh_id_table.COUNT LOOP --{
496:
497: IF (g_asn_debug = 'Y') THEN
498: asn_debug.put_line('Inside FTE rsh loop for rsh_id_tbl('||i||'): '|| l_rsh_id_table(i));
499: END IF;
500:
501: DECLARE
502: l_return_status VARCHAR2(1);
518: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
519: RAISE l_fte_exception;
520: END IF;
521:
522: IF (g_asn_debug = 'Y') THEN
523: asn_debug.put_line('Numbers of FTE charges fetched for this rsh: '|| l_fte_cost_table.count);
524: END IF;
525:
526: IF l_fte_cost_table.count < 1 THEN
519: RAISE l_fte_exception;
520: END IF;
521:
522: IF (g_asn_debug = 'Y') THEN
523: asn_debug.put_line('Numbers of FTE charges fetched for this rsh: '|| l_fte_cost_table.count);
524: END IF;
525:
526: IF l_fte_cost_table.count < 1 THEN
527: RAISE l_no_fte_charge;
530: -- l_fte_cost_table is indexed by rsl_id
531: j:= l_fte_cost_table.FIRST;
532: WHILE j IS NOT NULL
533: LOOP --{
534: IF (g_asn_debug = 'Y') THEN
535: asn_debug.put_line('Processing charge for shipment line: ' ||j);
536: END IF;
537:
538: -- get the precision for rounding
531: j:= l_fte_cost_table.FIRST;
532: WHILE j IS NOT NULL
533: LOOP --{
534: IF (g_asn_debug = 'Y') THEN
535: asn_debug.put_line('Processing charge for shipment line: ' ||j);
536: END IF;
537:
538: -- get the precision for rounding
539: DECLARE
552: -- the amount is differnt than that on the original charge.
553: -- This handles partial receipt and add to receipt, where
554: -- currency and vendor remains the same as previous receipt.
555:
556: IF (g_asn_debug = 'Y') THEN
557: asn_debug.put_line('FTE charge exists for shipment_line: ' || j);
558: END IF;
559:
560: UPDATE po_rcv_charges
553: -- This handles partial receipt and add to receipt, where
554: -- currency and vendor remains the same as previous receipt.
555:
556: IF (g_asn_debug = 'Y') THEN
557: asn_debug.put_line('FTE charge exists for shipment_line: ' || j);
558: END IF;
559:
560: UPDATE po_rcv_charges
561: SET estimated_amount = ROUND(l_fte_cost_table(j).total_cost, l_precision)
561: SET estimated_amount = ROUND(l_fte_cost_table(j).total_cost, l_precision)
562: WHERE shipment_line_id = j
563: AND estimated_amount <> ROUND(l_fte_cost_table(j).total_cost, l_precision);
564:
565: IF (g_asn_debug = 'Y') THEN
566: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charges');
567: END IF;
568:
569: UPDATE po_rcv_charge_allocations
562: WHERE shipment_line_id = j
563: AND estimated_amount <> ROUND(l_fte_cost_table(j).total_cost, l_precision);
564:
565: IF (g_asn_debug = 'Y') THEN
566: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charges');
567: END IF;
568:
569: UPDATE po_rcv_charge_allocations
570: SET estimated_amount = ROUND(l_fte_cost_table(j).total_cost, l_precision)
570: SET estimated_amount = ROUND(l_fte_cost_table(j).total_cost, l_precision)
571: WHERE shipment_line_id = j
572: AND estimated_amount <> ROUND(l_fte_cost_table(j).total_cost, l_precision);
573:
574: IF (g_asn_debug = 'Y') THEN
575: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charge_allocations');
576: END IF;
577: ELSE
578: IF (g_asn_debug = 'Y') THEN
571: WHERE shipment_line_id = j
572: AND estimated_amount <> ROUND(l_fte_cost_table(j).total_cost, l_precision);
573:
574: IF (g_asn_debug = 'Y') THEN
575: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charge_allocations');
576: END IF;
577: ELSE
578: IF (g_asn_debug = 'Y') THEN
579: asn_debug.put_line('Populating charge_table (' || k ||')');
574: IF (g_asn_debug = 'Y') THEN
575: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charge_allocations');
576: END IF;
577: ELSE
578: IF (g_asn_debug = 'Y') THEN
579: asn_debug.put_line('Populating charge_table (' || k ||')');
580: END IF;
581:
582: SELECT po_rcv_charges_s.NEXTVAL
575: asn_debug.put_line('updated ' || sql%rowcount || ' row in po_rcv_charge_allocations');
576: END IF;
577: ELSE
578: IF (g_asn_debug = 'Y') THEN
579: asn_debug.put_line('Populating charge_table (' || k ||')');
580: END IF;
581:
582: SELECT po_rcv_charges_s.NEXTVAL
583: INTO l_charge_table(k).charge_id
582: SELECT po_rcv_charges_s.NEXTVAL
583: INTO l_charge_table(k).charge_id
584: FROM dual;
585:
586: IF (g_asn_debug = 'Y') THEN
587: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
588: END IF;
589:
590: l_charge_table(k).creation_date := SYSDATE;
583: INTO l_charge_table(k).charge_id
584: FROM dual;
585:
586: IF (g_asn_debug = 'Y') THEN
587: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
588: END IF;
589:
590: l_charge_table(k).creation_date := SYSDATE;
591: l_charge_table(k).created_by := FND_GLOBAL.user_id;
603: l_charge_table(k).cost_analysis_code := g_fte_cost_factor_details.cost_analysis_code;
604: l_charge_table(k).include_in_acquisition_cost := g_fte_cost_factor_details.cost_acquisition_code;--Bug#6821589
605: l_charge_table(k).estimated_amount := ROUND(l_fte_cost_table(j).total_cost, l_precision);
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
604: l_charge_table(k).include_in_acquisition_cost := g_fte_cost_factor_details.cost_acquisition_code;--Bug#6821589
605: l_charge_table(k).estimated_amount := ROUND(l_fte_cost_table(j).total_cost, l_precision);
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
605: l_charge_table(k).estimated_amount := ROUND(l_fte_cost_table(j).total_cost, l_precision);
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
608: asn_debug.put_line('currency_precision: ' || l_precision);
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
609: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
610: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
611: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
612: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
613: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
621:
614: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
621:
622: IF (g_asn_debug = 'Y') THEN
615: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
616: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
617: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
621:
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('Done populating charge_table (' || k || ')');
618: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
621:
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('Done populating charge_table (' || k || ')');
624: END IF;
625:
626: k := k + 1;
619: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
620: END IF;
621:
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('Done populating charge_table (' || k || ')');
624: END IF;
625:
626: k := k + 1;
627: END IF;
628: j := l_fte_cost_table.NEXT(j);
629: END LOOP; --} end of fte_cost_table loop
630: EXCEPTION
631: WHEN l_no_fte_charge THEN
632: IF (g_asn_debug = 'Y') THEN
633: asn_debug.put_line('No FTE charges retreived for shipment_id: '||l_rsh_id_table(i));
634: END IF;
635: WHEN l_fte_exception THEN
636: x_return_status := FND_API.G_RET_STS_ERROR;
629: END LOOP; --} end of fte_cost_table loop
630: EXCEPTION
631: WHEN l_no_fte_charge THEN
632: IF (g_asn_debug = 'Y') THEN
633: asn_debug.put_line('No FTE charges retreived for shipment_id: '||l_rsh_id_table(i));
634: END IF;
635: WHEN l_fte_exception THEN
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: x_msg_data := l_msg_data;
634: END IF;
635: WHEN l_fte_exception THEN
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: x_msg_data := l_msg_data;
638: IF (g_asn_debug = 'Y') THEN
639: asn_debug.put_line('FTE API failed for shipment_id: '||l_rsh_id_table(i)||'. msg_data: '|| l_msg_data );
640: END IF;
641: WHEN others THEN
642: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
635: WHEN l_fte_exception THEN
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: x_msg_data := l_msg_data;
638: IF (g_asn_debug = 'Y') THEN
639: asn_debug.put_line('FTE API failed for shipment_id: '||l_rsh_id_table(i)||'. msg_data: '|| l_msg_data );
640: END IF;
641: WHEN others THEN
642: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
643: x_msg_data := sqlerrm;
640: END IF;
641: WHEN others THEN
642: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
643: x_msg_data := sqlerrm;
644: IF (g_asn_debug = 'Y') THEN
645: asn_debug.put_line('Unexpected exception occured in FTE loop: '|| x_msg_data);
646: END IF;
647: END;
648: END LOOP; --} end of rsh_id_table loop
641: WHEN others THEN
642: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
643: x_msg_data := sqlerrm;
644: IF (g_asn_debug = 'Y') THEN
645: asn_debug.put_line('Unexpected exception occured in FTE loop: '|| x_msg_data);
646: END IF;
647: END;
648: END LOOP; --} end of rsh_id_table loop
649:
646: END IF;
647: END;
648: END LOOP; --} end of rsh_id_table loop
649:
650: IF (g_asn_debug = 'Y') THEN
651: asn_debug.put_line('Total number of FTE charges retrieved: ' || l_charge_table.COUNT );
652: END IF;
653:
654: -- Allocate all the FTE charges
647: END;
648: END LOOP; --} end of rsh_id_table loop
649:
650: IF (g_asn_debug = 'Y') THEN
651: asn_debug.put_line('Total number of FTE charges retrieved: ' || l_charge_table.COUNT );
652: END IF;
653:
654: -- Allocate all the FTE charges
655: -- FTE charges are always line level charges
659: FORALL i IN INDICES OF l_charge_table
660: INSERT INTO po_rcv_charges
661: VALUES l_charge_table(i);
662:
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('Done bulk insert into po_rcv_charges');
665: END IF;
666:
667: -- bulk insert po_rcv_charge_allocations from the charge table
660: INSERT INTO po_rcv_charges
661: VALUES l_charge_table(i);
662:
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('Done bulk insert into po_rcv_charges');
665: END IF;
666:
667: -- bulk insert po_rcv_charge_allocations from the charge table
668: FORALL i IN INDICES OF l_charge_alloc_table
668: FORALL i IN INDICES OF l_charge_alloc_table
669: INSERT INTO po_rcv_charge_allocations
670: VALUES l_charge_alloc_table(i);
671:
672: IF (g_asn_debug = 'Y') THEN
673: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
674: END IF;
675:
676: IF (g_asn_debug = 'Y') THEN
669: INSERT INTO po_rcv_charge_allocations
670: VALUES l_charge_alloc_table(i);
671:
672: IF (g_asn_debug = 'Y') THEN
673: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
674: END IF;
675:
676: IF (g_asn_debug = 'Y') THEN
677: asn_debug.put_line('Exit Capture_FTE_Estimated_Charges()');
672: IF (g_asn_debug = 'Y') THEN
673: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
674: END IF;
675:
676: IF (g_asn_debug = 'Y') THEN
677: asn_debug.put_line('Exit Capture_FTE_Estimated_Charges()');
678: END IF;
679: EXCEPTION
680: WHEN OTHERS THEN
673: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
674: END IF;
675:
676: IF (g_asn_debug = 'Y') THEN
677: asn_debug.put_line('Exit Capture_FTE_Estimated_Charges()');
678: END IF;
679: EXCEPTION
680: WHEN OTHERS THEN
681: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
679: EXCEPTION
680: WHEN OTHERS THEN
681: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
682: x_msg_data := sqlerrm;
683: IF (g_asn_debug = 'Y') THEN
684: asn_debug.put_line('Unexpected exception occured in Capture_FTE_Estimated_Charges(): ' || x_msg_data);
685: END IF;
686: END Capture_FTE_Estimated_Charges;
687:
680: WHEN OTHERS THEN
681: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
682: x_msg_data := sqlerrm;
683: IF (g_asn_debug = 'Y') THEN
684: asn_debug.put_line('Unexpected exception occured in Capture_FTE_Estimated_Charges(): ' || x_msg_data);
685: END IF;
686: END Capture_FTE_Estimated_Charges;
687:
688: -- capture the actual freight charge for each shipment_line upon bill approval
701: l_fte_actual_charge_allocs CHARGE_ALLOCATION_TABLE_TYPE;
702: l_invalid_shipment EXCEPTION;
703:
704: BEGIN
705: IF (g_asn_debug = 'Y') THEN
706: asn_debug.put_line('Entering Capture_FTE_Actual_Charges()');
707: END IF;
708:
709: SAVEPOINT PO_FTE_ACTUAL;
702: l_invalid_shipment EXCEPTION;
703:
704: BEGIN
705: IF (g_asn_debug = 'Y') THEN
706: asn_debug.put_line('Entering Capture_FTE_Actual_Charges()');
707: END IF;
708:
709: SAVEPOINT PO_FTE_ACTUAL;
710:
713: THEN
714: FND_MSG_PUB.initialize;
715: END IF;
716:
717: IF (g_asn_debug = 'Y') THEN
718: asn_debug.put_line('Initialized FND message');
719: END IF;
720:
721: x_return_status := FND_API.G_RET_STS_SUCCESS;
714: FND_MSG_PUB.initialize;
715: END IF;
716:
717: IF (g_asn_debug = 'Y') THEN
718: asn_debug.put_line('Initialized FND message');
719: END IF;
720:
721: x_return_status := FND_API.G_RET_STS_SUCCESS;
722: x_msg_count := 0;
721: x_return_status := FND_API.G_RET_STS_SUCCESS;
722: x_msg_count := 0;
723: x_msg_data := '';
724:
725: IF (g_asn_debug = 'Y') THEN
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
722: x_msg_count := 0;
723: x_msg_data := '';
724:
725: IF (g_asn_debug = 'Y') THEN
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
723: x_msg_data := '';
724:
725: IF (g_asn_debug = 'Y') THEN
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
724:
725: IF (g_asn_debug = 'Y') THEN
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
732: asn_debug.put_line('cost_factor_id: ' || g_fte_cost_factor_details.price_element_type_id);
725: IF (g_asn_debug = 'Y') THEN
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
732: asn_debug.put_line('cost_factor_id: ' || g_fte_cost_factor_details.price_element_type_id);
733: END IF;
726: asn_debug.put_line('Data passed in by FTE');
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
732: asn_debug.put_line('cost_factor_id: ' || g_fte_cost_factor_details.price_element_type_id);
733: END IF;
734:
727: asn_debug.put_line('shipment_line_id: ' || p_fte_actual_charge.shipment_line_id );
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
732: asn_debug.put_line('cost_factor_id: ' || g_fte_cost_factor_details.price_element_type_id);
733: END IF;
734:
735: -- The actual charge is a previously FTE-estimated charge if:
728: asn_debug.put_line('actual_amount: ' || p_fte_actual_charge.actual_amount );
729: asn_debug.put_line('currency_code: ' || p_fte_actual_charge.currency_code );
730: asn_debug.put_line('vendor_id: ' || p_fte_actual_charge.vendor_id);
731: asn_debug.put_line('vendor_site_id: ' || p_fte_actual_charge.vendor_site_id);
732: asn_debug.put_line('cost_factor_id: ' || g_fte_cost_factor_details.price_element_type_id);
733: END IF;
734:
735: -- The actual charge is a previously FTE-estimated charge if:
736: -- shipment_line_id matches an existing FTE charge
747: AND NVL(vendor_site_id, p_fte_actual_charge.vendor_site_id)
748: = p_fte_actual_charge.vendor_site_id;
749:
750:
751: IF (g_asn_debug = 'Y') THEN
752: asn_debug.put_line('New FTE Charge? : ' || l_new_fte_charge);
753: END IF;
754:
755: -- For existing FTE charges, update the charge with the actual cost.
748: = p_fte_actual_charge.vendor_site_id;
749:
750:
751: IF (g_asn_debug = 'Y') THEN
752: asn_debug.put_line('New FTE Charge? : ' || l_new_fte_charge);
753: END IF;
754:
755: -- For existing FTE charges, update the charge with the actual cost.
756: IF l_new_fte_charge = 'N' THEN
754:
755: -- For existing FTE charges, update the charge with the actual cost.
756: IF l_new_fte_charge = 'N' THEN
757:
758: IF (g_asn_debug = 'Y') THEN
759: asn_debug.put_line('Updating PO_RCV_CHARGES with actual amount: '
760: || p_fte_actual_charge.actual_amount);
761: END IF;
762:
755: -- For existing FTE charges, update the charge with the actual cost.
756: IF l_new_fte_charge = 'N' THEN
757:
758: IF (g_asn_debug = 'Y') THEN
759: asn_debug.put_line('Updating PO_RCV_CHARGES with actual amount: '
760: || p_fte_actual_charge.actual_amount);
761: END IF;
762:
763: UPDATE po_rcv_charges
765: , vendor_id = NVL(vendor_id, p_fte_actual_charge.vendor_id)
766: , vendor_site_id = NVL(vendor_site_id, p_fte_actual_charge.vendor_site_id)
767: WHERE shipment_line_id = p_fte_actual_charge.shipment_line_id;
768:
769: IF (g_asn_debug = 'Y') THEN
770: asn_debug.put_line('Updating PO_RCV_CHARGE_ALLOCATIONS with actual amount'||
771: p_fte_actual_charge.actual_amount);
772: END IF;
773:
766: , vendor_site_id = NVL(vendor_site_id, p_fte_actual_charge.vendor_site_id)
767: WHERE shipment_line_id = p_fte_actual_charge.shipment_line_id;
768:
769: IF (g_asn_debug = 'Y') THEN
770: asn_debug.put_line('Updating PO_RCV_CHARGE_ALLOCATIONS with actual amount'||
771: p_fte_actual_charge.actual_amount);
772: END IF;
773:
774: UPDATE po_rcv_charge_allocations
774: UPDATE po_rcv_charge_allocations
775: SET actual_amount = p_fte_actual_charge.actual_amount
776: WHERE shipment_line_id = p_fte_actual_charge.shipment_line_id;
777:
778: IF (g_asn_debug = 'Y') THEN
779: asn_debug.put_line('Done updating actual amounts for existing charge');
780: END IF;
781: -- For new charges, populate new rows in po_rcv_charges and po_rcv_charge_allocations.
782: ELSE
775: SET actual_amount = p_fte_actual_charge.actual_amount
776: WHERE shipment_line_id = p_fte_actual_charge.shipment_line_id;
777:
778: IF (g_asn_debug = 'Y') THEN
779: asn_debug.put_line('Done updating actual amounts for existing charge');
780: END IF;
781: -- For new charges, populate new rows in po_rcv_charges and po_rcv_charge_allocations.
782: ELSE
783: IF (g_asn_debug = 'Y') THEN
779: asn_debug.put_line('Done updating actual amounts for existing charge');
780: END IF;
781: -- For new charges, populate new rows in po_rcv_charges and po_rcv_charge_allocations.
782: ELSE
783: IF (g_asn_debug = 'Y') THEN
784: asn_debug.put_line('This is a new charge');
785: END IF;
786:
787: l_fte_actual_charges(1) := p_fte_actual_charge;
780: END IF;
781: -- For new charges, populate new rows in po_rcv_charges and po_rcv_charge_allocations.
782: ELSE
783: IF (g_asn_debug = 'Y') THEN
784: asn_debug.put_line('This is a new charge');
785: END IF;
786:
787: l_fte_actual_charges(1) := p_fte_actual_charge;
788:
809: l_fte_actual_charges(1).cost_component_class_id := g_fte_cost_factor_details.cost_component_class_id;
810: l_fte_actual_charges(1).cost_analysis_code := g_fte_cost_factor_details.cost_analysis_code;
811: l_fte_actual_charges(1).include_in_acquisition_cost := g_fte_cost_factor_details.cost_acquisition_code;--Bug#6821589
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
810: l_fte_actual_charges(1).cost_analysis_code := g_fte_cost_factor_details.cost_analysis_code;
811: l_fte_actual_charges(1).include_in_acquisition_cost := g_fte_cost_factor_details.cost_acquisition_code;--Bug#6821589
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
811: l_fte_actual_charges(1).include_in_acquisition_cost := g_fte_cost_factor_details.cost_acquisition_code;--Bug#6821589
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
814: asn_debug.put_line('shipment_header_id: ' || l_fte_actual_charges(1).shipment_header_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
815: asn_debug.put_line('shipment_line_id: ' || l_fte_actual_charges(1).shipment_line_id );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
816: asn_debug.put_line('actual_amount: ' || l_fte_actual_charges(1).actual_amount );
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
824: asn_debug.put_line('include_in_acquisition_cost: ' || l_fte_actual_charges(1).include_in_acquisition_cost );--Bug#6821589
817: asn_debug.put_line('currency_code: ' || l_fte_actual_charges(1).currency_code );
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
824: asn_debug.put_line('include_in_acquisition_cost: ' || l_fte_actual_charges(1).include_in_acquisition_cost );--Bug#6821589
825: END IF;
818: asn_debug.put_line('vendor_id: ' || l_fte_actual_charges(1).vendor_id);
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
824: asn_debug.put_line('include_in_acquisition_cost: ' || l_fte_actual_charges(1).include_in_acquisition_cost );--Bug#6821589
825: END IF;
826:
819: asn_debug.put_line('vendor_site_id: ' || l_fte_actual_charges(1).vendor_site_id);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
824: asn_debug.put_line('include_in_acquisition_cost: ' || l_fte_actual_charges(1).include_in_acquisition_cost );--Bug#6821589
825: END IF;
826:
827: RCV_CHARGES_GRP.Allocate_charges(l_fte_actual_charges, l_fte_actual_charge_allocs, g_dummy_rci_tbl);
820: asn_debug.put_line('cost_factor_id: ' || l_fte_actual_charges(1).cost_factor_id );
821: asn_debug.put_line('allocation_method: ' ||l_fte_actual_charges(1).allocation_method );
822: asn_debug.put_line('cost_component_class_id: ' || l_fte_actual_charges(1).cost_component_class_id );
823: asn_debug.put_line('cost_analysis_code: ' || l_fte_actual_charges(1).cost_analysis_code );
824: asn_debug.put_line('include_in_acquisition_cost: ' || l_fte_actual_charges(1).include_in_acquisition_cost );--Bug#6821589
825: END IF;
826:
827: RCV_CHARGES_GRP.Allocate_charges(l_fte_actual_charges, l_fte_actual_charge_allocs, g_dummy_rci_tbl);
828:
831: FORALL i in 1..l_fte_actual_charges.COUNT
832: INSERT INTO po_rcv_charges
833: VALUES l_fte_actual_charges(i);
834:
835: IF (g_asn_debug = 'Y') THEN
836: asn_debug.put_line('Done bulk insert into po_rcv_charges');
837: END IF;
838:
839: -- bulk insert po_rcv_charge_allocations from the charge table
832: INSERT INTO po_rcv_charges
833: VALUES l_fte_actual_charges(i);
834:
835: IF (g_asn_debug = 'Y') THEN
836: asn_debug.put_line('Done bulk insert into po_rcv_charges');
837: END IF;
838:
839: -- bulk insert po_rcv_charge_allocations from the charge table
840: FORALL i IN 1..l_fte_actual_charge_allocs.COUNT
840: FORALL i IN 1..l_fte_actual_charge_allocs.COUNT
841: INSERT INTO po_rcv_charge_allocations
842: VALUES l_fte_actual_charge_allocs(i);
843:
844: IF (g_asn_debug = 'Y') THEN
845: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
846: END IF;
847:
848: END IF;
841: INSERT INTO po_rcv_charge_allocations
842: VALUES l_fte_actual_charge_allocs(i);
843:
844: IF (g_asn_debug = 'Y') THEN
845: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
846: END IF;
847:
848: END IF;
849:
857: EXCEPTION
858: WHEN l_invalid_shipment THEN
859: x_msg_data := 'Invalid Shipment';
860: x_return_status:= FND_API.G_RET_STS_ERROR;
861: IF (g_asn_debug = 'Y') THEN
862: asn_debug.put_line('Invalid shipment.' );
863: END IF;
864: WHEN OTHERS THEN
865: ROLLBACK TO PO_FTE_ACTUAL;
858: WHEN l_invalid_shipment THEN
859: x_msg_data := 'Invalid Shipment';
860: x_return_status:= FND_API.G_RET_STS_ERROR;
861: IF (g_asn_debug = 'Y') THEN
862: asn_debug.put_line('Invalid shipment.' );
863: END IF;
864: WHEN OTHERS THEN
865: ROLLBACK TO PO_FTE_ACTUAL;
866: x_msg_data := sqlerrm;
864: WHEN OTHERS THEN
865: ROLLBACK TO PO_FTE_ACTUAL;
866: x_msg_data := sqlerrm;
867: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
868: IF (g_asn_debug = 'Y') THEN
869: asn_debug.put_line('Unexpected error in Capture_FTE_Actual_Charges(), err_msg:'
870: || x_msg_data);
871: END IF;
872: END Capture_FTE_Actual_Charges;
865: ROLLBACK TO PO_FTE_ACTUAL;
866: x_msg_data := sqlerrm;
867: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
868: IF (g_asn_debug = 'Y') THEN
869: asn_debug.put_line('Unexpected error in Capture_FTE_Actual_Charges(), err_msg:'
870: || x_msg_data);
871: END IF;
872: END Capture_FTE_Actual_Charges;
873:
886: G_CONC_LOG := '';
887: g_charge_numbers := 0;
888: k := 1;
889:
890: IF (g_asn_debug = 'Y') THEN
891: asn_debug.put_line('Entering extract AP charges program.');
892: END IF;
893:
894:
887: g_charge_numbers := 0;
888: k := 1;
889:
890: IF (g_asn_debug = 'Y') THEN
891: asn_debug.put_line('Entering extract AP charges program.');
892: END IF;
893:
894:
895: FOR l_ap_po_charge_distribution in po_charges_grp.ap_po_charge_distributions_csr LOOP --{
893:
894:
895: FOR l_ap_po_charge_distribution in po_charges_grp.ap_po_charge_distributions_csr LOOP --{
896:
897: IF (g_asn_debug = 'Y') THEN
898: asn_debug.put_line('Inside the cursor loop.');
899: asn_debug.put_line('Charge cursor has '||
900: po_charges_grp.ap_po_charge_distributions_csr%rowcount||' rows.');
901: END IF;
894:
895: FOR l_ap_po_charge_distribution in po_charges_grp.ap_po_charge_distributions_csr LOOP --{
896:
897: IF (g_asn_debug = 'Y') THEN
898: asn_debug.put_line('Inside the cursor loop.');
899: asn_debug.put_line('Charge cursor has '||
900: po_charges_grp.ap_po_charge_distributions_csr%rowcount||' rows.');
901: END IF;
902:
895: FOR l_ap_po_charge_distribution in po_charges_grp.ap_po_charge_distributions_csr LOOP --{
896:
897: IF (g_asn_debug = 'Y') THEN
898: asn_debug.put_line('Inside the cursor loop.');
899: asn_debug.put_line('Charge cursor has '||
900: po_charges_grp.ap_po_charge_distributions_csr%rowcount||' rows.');
901: END IF;
902:
903: Process_AP_Actual_Charges(l_ap_po_charge_distribution,l_charge_table,
905:
906: g_charge_numbers := g_charge_numbers + 1;
907: END LOOP; --}
908:
909: IF (g_asn_debug = 'Y') THEN
910: asn_debug.put_line('After Loop ' || g_charge_numbers||
911: ' AP charges after l_ap_po_charge_distribution, '
912: ||l_charge_table.COUNT||' of them are new charges');
913: END IF;
906: g_charge_numbers := g_charge_numbers + 1;
907: END LOOP; --}
908:
909: IF (g_asn_debug = 'Y') THEN
910: asn_debug.put_line('After Loop ' || g_charge_numbers||
911: ' AP charges after l_ap_po_charge_distribution, '
912: ||l_charge_table.COUNT||' of them are new charges');
913: END IF;
914:
914:
915:
916: FOR l_ap_rcv_charge_distribution in po_charges_grp.ap_rcv_charge_distr_csr LOOP --{
917:
918: IF (g_asn_debug = 'Y') THEN
919: asn_debug.put_line('Inside the cursor loop.');
920: asn_debug.put_line('Charge cursor has '||
921: po_charges_grp.ap_rcv_charge_distr_csr%rowcount||' rows.');
922: END IF;
915:
916: FOR l_ap_rcv_charge_distribution in po_charges_grp.ap_rcv_charge_distr_csr LOOP --{
917:
918: IF (g_asn_debug = 'Y') THEN
919: asn_debug.put_line('Inside the cursor loop.');
920: asn_debug.put_line('Charge cursor has '||
921: po_charges_grp.ap_rcv_charge_distr_csr%rowcount||' rows.');
922: END IF;
923:
916: FOR l_ap_rcv_charge_distribution in po_charges_grp.ap_rcv_charge_distr_csr LOOP --{
917:
918: IF (g_asn_debug = 'Y') THEN
919: asn_debug.put_line('Inside the cursor loop.');
920: asn_debug.put_line('Charge cursor has '||
921: po_charges_grp.ap_rcv_charge_distr_csr%rowcount||' rows.');
922: END IF;
923:
924: Process_AP_Actual_Charges(l_ap_rcv_charge_distribution,
927: g_charge_numbers := g_charge_numbers + 1;
928: END LOOP; --}
929:
930:
931: IF (g_asn_debug = 'Y') THEN
932: asn_debug.put_line('After Loop ' || g_charge_numbers||
933: ' AP charges after l_ap_rcv_charge_distribution, '
934: ||l_charge_table.COUNT||' of them are new charges');
935: END IF;
928: END LOOP; --}
929:
930:
931: IF (g_asn_debug = 'Y') THEN
932: asn_debug.put_line('After Loop ' || g_charge_numbers||
933: ' AP charges after l_ap_rcv_charge_distribution, '
934: ||l_charge_table.COUNT||' of them are new charges');
935: END IF;
936:
939: FORALL i IN 1..l_charge_table.COUNT
940: INSERT INTO po_rcv_charges
941: VALUES l_charge_table(i);
942:
943: IF (g_asn_debug = 'Y') THEN
944: asn_debug.put_line('Done bulk insert into po_rcv_charges');
945: END IF;
946:
947: -- bulk insert po_rcv_charge_allocations from the charge table
940: INSERT INTO po_rcv_charges
941: VALUES l_charge_table(i);
942:
943: IF (g_asn_debug = 'Y') THEN
944: asn_debug.put_line('Done bulk insert into po_rcv_charges');
945: END IF;
946:
947: -- bulk insert po_rcv_charge_allocations from the charge table
948: FORALL i IN 1..l_charge_alloc_table.COUNT
948: FORALL i IN 1..l_charge_alloc_table.COUNT
949: INSERT INTO po_rcv_charge_allocations
950: VALUES l_charge_alloc_table(i);
951:
952: IF (g_asn_debug = 'Y') THEN
953: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
954: END IF;
955:
956: -- generate summary report
949: INSERT INTO po_rcv_charge_allocations
950: VALUES l_charge_alloc_table(i);
951:
952: IF (g_asn_debug = 'Y') THEN
953: asn_debug.put_line('Done bulk insert into po_rcv_charge_allocations');
954: END IF;
955:
956: -- generate summary report
957: G_CONC_LOG := G_CONC_LOG || 'Summary information: ' ||
962: -- send output to concurrent log
963: errbuf := G_CONC_LOG;
964: retcode := 0;
965:
966: IF (g_asn_debug = 'Y') THEN
967: asn_debug.put_line('AP extracting completed');
968: END IF;
969: EXCEPTION
970: WHEN OTHERS THEN
963: errbuf := G_CONC_LOG;
964: retcode := 0;
965:
966: IF (g_asn_debug = 'Y') THEN
967: asn_debug.put_line('AP extracting completed');
968: END IF;
969: EXCEPTION
970: WHEN OTHERS THEN
971: string( log_level => FND_LOG.LEVEL_UNEXPECTED
996: l_new_ap_charge VARCHAR2(1) := 'Y';
997:
998: BEGIN
999:
1000: IF (g_asn_debug = 'Y') THEN
1001: asn_debug.put_line('Entering Process AP charges program.');
1002: END IF;
1003:
1004: select sum(amount)
997:
998: BEGIN
999:
1000: IF (g_asn_debug = 'Y') THEN
1001: asn_debug.put_line('Entering Process AP charges program.');
1002: END IF;
1003:
1004: select sum(amount)
1005: into l_ap_charge_distribution.rec_tax
1013: line_type_lookup_code = 'NONREC_TAX' and
1014: charge_applicable_to_dist_id = l_ap_charge_distribution.invoice_distribution_id;
1015:
1016:
1017: IF (g_asn_debug = 'Y') THEN
1018: asn_debug.put_line('costfactor id '||l_ap_charge_distribution.cost_factor_id);
1019: END IF;
1020:
1021: If (l_ap_charge_distribution.cost_factor_id = 0 ) then
1014: charge_applicable_to_dist_id = l_ap_charge_distribution.invoice_distribution_id;
1015:
1016:
1017: IF (g_asn_debug = 'Y') THEN
1018: asn_debug.put_line('costfactor id '||l_ap_charge_distribution.cost_factor_id);
1019: END IF;
1020:
1021: If (l_ap_charge_distribution.cost_factor_id = 0 ) then
1022: l_cost_factor_details := pon_cf_type_grp.get_cost_factor_details( l_ap_charge_distribution.cost_factor_code );
1023: else
1024: l_cost_factor_details := pon_cf_type_grp.get_cost_factor_details( l_ap_charge_distribution.cost_factor_id );
1025: end if;
1026:
1027: IF (g_asn_debug = 'Y') THEN
1028: asn_debug.put_line('price_element_type_id id '||l_cost_factor_details.price_element_type_id);
1029: END IF;
1030:
1031: SELECT decode(count(*), 0, 'Y', 'N')
1024: l_cost_factor_details := pon_cf_type_grp.get_cost_factor_details( l_ap_charge_distribution.cost_factor_id );
1025: end if;
1026:
1027: IF (g_asn_debug = 'Y') THEN
1028: asn_debug.put_line('price_element_type_id id '||l_cost_factor_details.price_element_type_id);
1029: END IF;
1030:
1031: SELECT decode(count(*), 0, 'Y', 'N')
1032: INTO l_new_ap_charge
1037: = l_ap_charge_distribution.vendor_id
1038: AND NVL(vendor_site_id, l_ap_charge_distribution.vendor_site_id)
1039: = l_ap_charge_distribution.vendor_site_id;
1040:
1041: IF (g_asn_debug = 'Y') THEN
1042: asn_debug.put_line('Is it a new AP charge? : ' || l_new_ap_charge);
1043: END IF;
1044:
1045: IF l_new_ap_charge = 'N' THEN --{
1038: AND NVL(vendor_site_id, l_ap_charge_distribution.vendor_site_id)
1039: = l_ap_charge_distribution.vendor_site_id;
1040:
1041: IF (g_asn_debug = 'Y') THEN
1042: asn_debug.put_line('Is it a new AP charge? : ' || l_new_ap_charge);
1043: END IF;
1044:
1045: IF l_new_ap_charge = 'N' THEN --{
1046:
1043: END IF;
1044:
1045: IF l_new_ap_charge = 'N' THEN --{
1046:
1047: IF (g_asn_debug = 'Y') THEN
1048: asn_debug.put_line('Updating charge amount for existing charge');
1049: END IF;
1050:
1051: UPDATE po_rcv_charges
1044:
1045: IF l_new_ap_charge = 'N' THEN --{
1046:
1047: IF (g_asn_debug = 'Y') THEN
1048: asn_debug.put_line('Updating charge amount for existing charge');
1049: END IF;
1050:
1051: UPDATE po_rcv_charges
1052: SET actual_amount = nvl(actual_amount, 0) + l_ap_charge_distribution.amount
1057: WHERE cost_factor_id = l_cost_factor_details.price_element_type_id
1058: AND shipment_line_id = l_ap_charge_distribution.shipment_line_id
1059: RETURNING charge_id INTO l_charge_id;
1060:
1061: IF (g_asn_debug = 'Y') THEN
1062: asn_debug.put_line('Updated PRC (charge_id=' || l_charge_id || ') with amount'||l_ap_charge_distribution.amount);
1063: END IF;
1064:
1065: UPDATE po_rcv_charge_allocations
1058: AND shipment_line_id = l_ap_charge_distribution.shipment_line_id
1059: RETURNING charge_id INTO l_charge_id;
1060:
1061: IF (g_asn_debug = 'Y') THEN
1062: asn_debug.put_line('Updated PRC (charge_id=' || l_charge_id || ') with amount'||l_ap_charge_distribution.amount);
1063: END IF;
1064:
1065: UPDATE po_rcv_charge_allocations
1066: SET actual_amount = nvl(actual_amount,0) + l_ap_charge_distribution.amount
1068: , act_non_recoverable_tax = l_ap_charge_distribution.nonrec_tax
1069: WHERE shipment_line_id = l_ap_charge_distribution.shipment_line_id
1070: AND charge_id = l_charge_id;
1071:
1072: IF (g_asn_debug = 'Y') THEN
1073: asn_debug.put_line('Updated corresponding PRCA with amount '||l_ap_charge_distribution.amount);
1074: END IF;
1075: ELSE --}{
1076: IF (g_asn_debug = 'Y') THEN
1069: WHERE shipment_line_id = l_ap_charge_distribution.shipment_line_id
1070: AND charge_id = l_charge_id;
1071:
1072: IF (g_asn_debug = 'Y') THEN
1073: asn_debug.put_line('Updated corresponding PRCA with amount '||l_ap_charge_distribution.amount);
1074: END IF;
1075: ELSE --}{
1076: IF (g_asn_debug = 'Y') THEN
1077: asn_debug.put_line('Populating charge_table (' || k ||') for a new charge');
1072: IF (g_asn_debug = 'Y') THEN
1073: asn_debug.put_line('Updated corresponding PRCA with amount '||l_ap_charge_distribution.amount);
1074: END IF;
1075: ELSE --}{
1076: IF (g_asn_debug = 'Y') THEN
1077: asn_debug.put_line('Populating charge_table (' || k ||') for a new charge');
1078: END IF;
1079:
1080: SELECT po_rcv_charges_s.NEXTVAL
1073: asn_debug.put_line('Updated corresponding PRCA with amount '||l_ap_charge_distribution.amount);
1074: END IF;
1075: ELSE --}{
1076: IF (g_asn_debug = 'Y') THEN
1077: asn_debug.put_line('Populating charge_table (' || k ||') for a new charge');
1078: END IF;
1079:
1080: SELECT po_rcv_charges_s.NEXTVAL
1081: INTO l_charge_table(k).charge_id
1080: SELECT po_rcv_charges_s.NEXTVAL
1081: INTO l_charge_table(k).charge_id
1082: FROM dual;
1083:
1084: IF (g_asn_debug = 'Y') THEN
1085: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
1086: END IF;
1087:
1088: l_charge_table(k).creation_date := SYSDATE;
1081: INTO l_charge_table(k).charge_id
1082: FROM dual;
1083:
1084: IF (g_asn_debug = 'Y') THEN
1085: asn_debug.put_line('charge_id: ' ||l_charge_table(k).charge_id);
1086: END IF;
1087:
1088: l_charge_table(k).creation_date := SYSDATE;
1089: l_charge_table(k).created_by := FND_GLOBAL.user_id;
1105:
1106: l_charge_table(k).actual_tax :=
1107: l_ap_charge_distribution.rec_tax + l_ap_charge_distribution.nonrec_tax;
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1106: l_charge_table(k).actual_tax :=
1107: l_ap_charge_distribution.rec_tax + l_ap_charge_distribution.nonrec_tax;
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1107: l_ap_charge_distribution.rec_tax + l_ap_charge_distribution.nonrec_tax;
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1110: asn_debug.put_line('shipment_header_id: ' || l_charge_table(k).shipment_header_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1111: asn_debug.put_line('shipment_line_id: ' || l_charge_table(k).shipment_line_id );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1112: asn_debug.put_line('estimated_amount: ' || l_charge_table(k).estimated_amount );
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1113: asn_debug.put_line('currency_code: ' || l_charge_table(k).currency_code );
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1114: asn_debug.put_line('vendor_id: ' || l_charge_table(k).vendor_id);
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1122:
1115: asn_debug.put_line('vendor_site_id: ' || l_charge_table(k).vendor_site_id);
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1122:
1123: IF (g_asn_debug = 'Y') THEN
1116: asn_debug.put_line('cost_factor_id: ' || l_charge_table(k).cost_factor_id );
1117: asn_debug.put_line('allocation_method: ' ||l_charge_table(k).allocation_method );
1118: asn_debug.put_line('cost_component_class_id: ' || l_charge_table(k).cost_component_class_id );
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1122:
1123: IF (g_asn_debug = 'Y') THEN
1124: asn_debug.put_line('Done populating charge_table (' || k || ')');
1119: asn_debug.put_line('cost_analysis_code: ' || l_charge_table(k).cost_analysis_code );
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1122:
1123: IF (g_asn_debug = 'Y') THEN
1124: asn_debug.put_line('Done populating charge_table (' || k || ')');
1125: END IF;
1126:
1127: SELECT po_rcv_charge_allocations_s.NEXTVAL
1120: asn_debug.put_line('include_in_acquisition_cost: ' || l_charge_table(k).include_in_acquisition_cost );--Bug#6821589
1121: END IF;
1122:
1123: IF (g_asn_debug = 'Y') THEN
1124: asn_debug.put_line('Done populating charge_table (' || k || ')');
1125: END IF;
1126:
1127: SELECT po_rcv_charge_allocations_s.NEXTVAL
1128: INTO l_charge_alloc_table(k).charge_allocation_id
1139:
1140: l_charge_alloc_table(k).act_recoverable_tax := l_ap_charge_distribution.rec_tax;
1141: l_charge_alloc_table(k).act_non_recoverable_tax := l_ap_charge_distribution.nonrec_tax;
1142:
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('charge_allocation_id: ' || l_charge_alloc_table(k).charge_allocation_id);
1145: asn_debug.put_line('act_recoverable_tax: ' || l_charge_alloc_table(k).act_recoverable_tax);
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1140: l_charge_alloc_table(k).act_recoverable_tax := l_ap_charge_distribution.rec_tax;
1141: l_charge_alloc_table(k).act_non_recoverable_tax := l_ap_charge_distribution.nonrec_tax;
1142:
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('charge_allocation_id: ' || l_charge_alloc_table(k).charge_allocation_id);
1145: asn_debug.put_line('act_recoverable_tax: ' || l_charge_alloc_table(k).act_recoverable_tax);
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1148:
1141: l_charge_alloc_table(k).act_non_recoverable_tax := l_ap_charge_distribution.nonrec_tax;
1142:
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('charge_allocation_id: ' || l_charge_alloc_table(k).charge_allocation_id);
1145: asn_debug.put_line('act_recoverable_tax: ' || l_charge_alloc_table(k).act_recoverable_tax);
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1148:
1149: IF (g_asn_debug = 'Y') THEN
1142:
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('charge_allocation_id: ' || l_charge_alloc_table(k).charge_allocation_id);
1145: asn_debug.put_line('act_recoverable_tax: ' || l_charge_alloc_table(k).act_recoverable_tax);
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1148:
1149: IF (g_asn_debug = 'Y') THEN
1150: asn_debug.put_line('Done populating charge_alloc_table (' || k || ')');
1145: asn_debug.put_line('act_recoverable_tax: ' || l_charge_alloc_table(k).act_recoverable_tax);
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1148:
1149: IF (g_asn_debug = 'Y') THEN
1150: asn_debug.put_line('Done populating charge_alloc_table (' || k || ')');
1151: END IF;
1152:
1153: k := k + 1;
1146: asn_debug.put_line('act_non_recoverable_tax: ' || l_charge_alloc_table(k).act_non_recoverable_tax);
1147: END IF;
1148:
1149: IF (g_asn_debug = 'Y') THEN
1150: asn_debug.put_line('Done populating charge_alloc_table (' || k || ')');
1151: END IF;
1152:
1153: k := k + 1;
1154:
1151: END IF;
1152:
1153: k := k + 1;
1154:
1155: IF (g_asn_debug = 'Y') THEN
1156: asn_debug.put_line('Created new charge and allocation record for new charge');
1157: END IF;
1158:
1159: END IF; --}
1152:
1153: k := k + 1;
1154:
1155: IF (g_asn_debug = 'Y') THEN
1156: asn_debug.put_line('Created new charge and allocation record for new charge');
1157: END IF;
1158:
1159: END IF; --}
1160:
1163: SET rcv_charge_addition_flag = 'Y'
1164: WHERE invoice_distribution_id = l_ap_charge_distribution.invoice_distribution_id;
1165:
1166:
1167: IF (g_asn_debug = 'Y') THEN
1168: asn_debug.put_line('Exit Process AP extracting completed');
1169: END IF;
1170:
1171: EXCEPTION
1164: WHERE invoice_distribution_id = l_ap_charge_distribution.invoice_distribution_id;
1165:
1166:
1167: IF (g_asn_debug = 'Y') THEN
1168: asn_debug.put_line('Exit Process AP extracting completed');
1169: END IF;
1170:
1171: EXCEPTION
1172: WHEN OTHERS THEN