26: l_dist_changes PO_AP_DIST_REC_TYPE;
27: rowcount NUMBER;
28: BEGIN
29:
30: IF PO_LOG.d_proc THEN
31: PO_LOG.proc_begin(d_mod,'p_po_distribution_id_tbl',p_po_distribution_id_tbl);
32: END IF;
33:
34: -- Create an empty object first
27: rowcount NUMBER;
28: BEGIN
29:
30: IF PO_LOG.d_proc THEN
31: PO_LOG.proc_begin(d_mod,'p_po_distribution_id_tbl',p_po_distribution_id_tbl);
32: END IF;
33:
34: -- Create an empty object first
35: l_dist_changes := PO_AP_DIST_REC_TYPE (
51: request_id_tbl => po_tbl_number()
52: );
53:
54: d_position := 10;
55: IF PO_LOG.d_stmt THEN
56: PO_LOG.stmt(d_mod,d_position,'Empty table created');
57: END IF;
58:
59: -- Update the values of the object if params were passed in
52: );
53:
54: d_position := 10;
55: IF PO_LOG.d_stmt THEN
56: PO_LOG.stmt(d_mod,d_position,'Empty table created');
57: END IF;
58:
59: -- Update the values of the object if params were passed in
60: -- The values are only populated if distribution ids are provided
64:
65: l_dist_changes.po_distribution_id_tbl := p_po_distribution_id_tbl;
66: rowcount := l_dist_changes.po_distribution_id_tbl.COUNT;
67:
68: IF PO_LOG.d_stmt THEN
69: PO_LOG.stmt(d_mod,d_position,'Updating table values');
70: PO_LOG.stmt(d_mod,d_position,'Rowcount: ' || rowcount);
71: END IF;
72:
65: l_dist_changes.po_distribution_id_tbl := p_po_distribution_id_tbl;
66: rowcount := l_dist_changes.po_distribution_id_tbl.COUNT;
67:
68: IF PO_LOG.d_stmt THEN
69: PO_LOG.stmt(d_mod,d_position,'Updating table values');
70: PO_LOG.stmt(d_mod,d_position,'Rowcount: ' || rowcount);
71: END IF;
72:
73: IF (p_uom_code_tbl IS NOT NULL) THEN
66: rowcount := l_dist_changes.po_distribution_id_tbl.COUNT;
67:
68: IF PO_LOG.d_stmt THEN
69: PO_LOG.stmt(d_mod,d_position,'Updating table values');
70: PO_LOG.stmt(d_mod,d_position,'Rowcount: ' || rowcount);
71: END IF;
72:
73: IF (p_uom_code_tbl IS NOT NULL) THEN
74: l_dist_changes.uom_code_ap_tbl := p_uom_code_tbl;
138: l_dist_changes.request_id_tbl.extend(rowcount);
139: END IF;
140:
141: d_position := 30;
142: IF PO_LOG.d_stmt THEN
143: PO_LOG.stmt(d_mod,d_position,'Table updates completed');
144: END IF;
145:
146: END IF; -- if p_po_distribution_id_tbl is not null
139: END IF;
140:
141: d_position := 30;
142: IF PO_LOG.d_stmt THEN
143: PO_LOG.stmt(d_mod,d_position,'Table updates completed');
144: END IF;
145:
146: END IF; -- if p_po_distribution_id_tbl is not null
147:
144: END IF;
145:
146: END IF; -- if p_po_distribution_id_tbl is not null
147:
148: IF PO_LOG.d_proc THEN
149: PO_LOG.proc_end(d_mod);
150: END IF;
151:
152: RETURN l_dist_changes;
145:
146: END IF; -- if p_po_distribution_id_tbl is not null
147:
148: IF PO_LOG.d_proc THEN
149: PO_LOG.proc_end(d_mod);
150: END IF;
151:
152: RETURN l_dist_changes;
153: END create_object;
176: d_mod CONSTANT VARCHAR2(100) := 'po.plsql.PO_AP_DIST_REC_TYPE';
177: l_api_name CONSTANT VARCHAR2(30) := 'add_change';
178: rowcount NUMBER;
179: BEGIN
180: IF PO_LOG.d_proc THEN
181: PO_LOG.proc_begin(d_mod);
182: END IF;
183:
184: -- First, extend all the member tables
177: l_api_name CONSTANT VARCHAR2(30) := 'add_change';
178: rowcount NUMBER;
179: BEGIN
180: IF PO_LOG.d_proc THEN
181: PO_LOG.proc_begin(d_mod);
182: END IF;
183:
184: -- First, extend all the member tables
185: SELF.po_distribution_id_tbl.extend;
202: -- Get the index number of the new last element
203: d_position := 20;
204: rowcount := SELF.po_distribution_id_tbl.LAST; --bug 4749047
205:
206: IF PO_LOG.d_stmt THEN
207: PO_LOG.stmt(d_mod,d_position,'rowcount: ' || rowcount);
208: END IF;
209:
210: -- Populate the last element with the passed in values
203: d_position := 20;
204: rowcount := SELF.po_distribution_id_tbl.LAST; --bug 4749047
205:
206: IF PO_LOG.d_stmt THEN
207: PO_LOG.stmt(d_mod,d_position,'rowcount: ' || rowcount);
208: END IF;
209:
210: -- Populate the last element with the passed in values
211: SELF.po_distribution_id_tbl(rowcount) := p_po_distribution_id;
221: SELF.last_update_login_tbl(rowcount) := p_last_update_login;
222: SELF.request_id_tbl(rowcount) := p_request_id;
223:
224: d_position := 30;
225: IF PO_LOG.d_proc THEN
226: PO_LOG.proc_end(d_mod);
227: END IF;
228:
229: END add_change;
222: SELF.request_id_tbl(rowcount) := p_request_id;
223:
224: d_position := 30;
225: IF PO_LOG.d_proc THEN
226: PO_LOG.proc_end(d_mod);
227: END IF;
228:
229: END add_change;
230:
244: l_item_id NUMBER;
245: l_uom_rate NUMBER;
246: BEGIN
247:
248: IF PO_LOG.d_proc THEN
249: PO_LOG.proc_begin(d_mod);
250: END IF;
251:
252: d_position := 10;
245: l_uom_rate NUMBER;
246: BEGIN
247:
248: IF PO_LOG.d_proc THEN
249: PO_LOG.proc_begin(d_mod);
250: END IF;
251:
252: d_position := 10;
253: -- Get the UOM from AP (based on the first distribution, since
254: -- all distributions in a particular instance of this object belong
255: -- to the same line location
256: l_uom_code_ap := uom_code_ap_tbl(1);
257:
258: IF PO_LOG.d_stmt THEN
259: PO_LOG.stmt(d_mod,d_position,'l_uom_code_ap: ' || l_uom_code_ap);
260: END IF;
261:
262: d_position := 20;
255: -- to the same line location
256: l_uom_code_ap := uom_code_ap_tbl(1);
257:
258: IF PO_LOG.d_stmt THEN
259: PO_LOG.stmt(d_mod,d_position,'l_uom_code_ap: ' || l_uom_code_ap);
260: END IF;
261:
262: d_position := 20;
263:
275: AND PLL.line_location_id = POD.line_location_id
276: AND PLL.po_line_id = POL.po_line_id;
277: EXCEPTION
278: WHEN OTHERS THEN
279: IF PO_LOG.d_exc THEN
280: PO_LOG.exc(d_mod,d_position,SQLERRM);
281: END IF;
282: RAISE;
283: END;
276: AND PLL.po_line_id = POL.po_line_id;
277: EXCEPTION
278: WHEN OTHERS THEN
279: IF PO_LOG.d_exc THEN
280: PO_LOG.exc(d_mod,d_position,SQLERRM);
281: END IF;
282: RAISE;
283: END;
284:
282: RAISE;
283: END;
284:
285: d_position := 30;
286: IF PO_LOG.d_stmt THEN
287: PO_LOG.stmt(d_mod,d_position,'l_uom_code_po: ' || l_uom_code_po);
288: PO_LOG.stmt(d_mod,d_position,'l_item_id: ' || l_item_id);
289: END IF;
290:
283: END;
284:
285: d_position := 30;
286: IF PO_LOG.d_stmt THEN
287: PO_LOG.stmt(d_mod,d_position,'l_uom_code_po: ' || l_uom_code_po);
288: PO_LOG.stmt(d_mod,d_position,'l_item_id: ' || l_item_id);
289: END IF;
290:
291: d_position := 40;
284:
285: d_position := 30;
286: IF PO_LOG.d_stmt THEN
287: PO_LOG.stmt(d_mod,d_position,'l_uom_code_po: ' || l_uom_code_po);
288: PO_LOG.stmt(d_mod,d_position,'l_item_id: ' || l_item_id);
289: END IF;
290:
291: d_position := 40;
292: IF PO_LOG.d_stmt THEN
288: PO_LOG.stmt(d_mod,d_position,'l_item_id: ' || l_item_id);
289: END IF;
290:
291: d_position := 40;
292: IF PO_LOG.d_stmt THEN
293: PO_LOG.stmt(d_mod,d_position,'Looping through distributions');
294: END IF;
295:
296: FOR i IN 1..po_distribution_id_tbl.COUNT LOOP
289: END IF;
290:
291: d_position := 40;
292: IF PO_LOG.d_stmt THEN
293: PO_LOG.stmt(d_mod,d_position,'Looping through distributions');
294: END IF;
295:
296: FOR i IN 1..po_distribution_id_tbl.COUNT LOOP
297: SELF.uom_code_po_tbl.extend;
313: IF l_uom_code_po is not null and l_uom_code_ap is not null
314: and l_uom_code_po <> l_uom_code_ap THEN
315: -- Do the UOM conversion since AP UOM does not equal PO UOM
316: d_position := 40;
317: IF PO_LOG.d_stmt THEN
318: PO_LOG.stmt(d_mod,d_position,'Before call to UOM conversion');
319: END IF;
320:
321: l_uom_rate := po_uom_s.po_uom_convert(
314: and l_uom_code_po <> l_uom_code_ap THEN
315: -- Do the UOM conversion since AP UOM does not equal PO UOM
316: d_position := 40;
317: IF PO_LOG.d_stmt THEN
318: PO_LOG.stmt(d_mod,d_position,'Before call to UOM conversion');
319: END IF;
320:
321: l_uom_rate := po_uom_s.po_uom_convert(
322: l_uom_code_ap, l_uom_code_po, l_item_id);
321: l_uom_rate := po_uom_s.po_uom_convert(
322: l_uom_code_ap, l_uom_code_po, l_item_id);
323:
324: d_position := 45;
325: IF PO_LOG.d_stmt THEN
326: PO_LOG.stmt(d_mod,d_position,'l_uom_rate: ' || l_uom_rate);
327: END IF;
328:
329: quantity_billed_tbl(i) :=
322: l_uom_code_ap, l_uom_code_po, l_item_id);
323:
324: d_position := 45;
325: IF PO_LOG.d_stmt THEN
326: PO_LOG.stmt(d_mod,d_position,'l_uom_rate: ' || l_uom_rate);
327: END IF;
328:
329: quantity_billed_tbl(i) :=
330: round(quantity_billed_ap_tbl(i) * l_uom_rate, 15);
334: round(quantity_recouped_ap_tbl(i) * l_uom_rate, 15);
335: ELSE
336: -- AP UOM equals PO UOM. No conversion necessary
337: d_position := 50;
338: IF PO_LOG.d_stmt THEN
339: PO_LOG.stmt(d_mod,d_position,'AP UOM equals PO UOM');
340: END IF;
341:
342: quantity_billed_tbl(i) := quantity_billed_ap_tbl(i);
335: ELSE
336: -- AP UOM equals PO UOM. No conversion necessary
337: d_position := 50;
338: IF PO_LOG.d_stmt THEN
339: PO_LOG.stmt(d_mod,d_position,'AP UOM equals PO UOM');
340: END IF;
341:
342: quantity_billed_tbl(i) := quantity_billed_ap_tbl(i);
343: quantity_financed_tbl(i) := quantity_financed_ap_tbl(i);
347:
348: END LOOP; -- Distribution Loop
349: --
350: d_position := 70;
351: IF PO_LOG.d_proc THEN
352: PO_LOG.proc_end(d_mod);
353: END IF;
354:
355: END populate_calculated_fields;
348: END LOOP; -- Distribution Loop
349: --
350: d_position := 70;
351: IF PO_LOG.d_proc THEN
352: PO_LOG.proc_end(d_mod);
353: END IF;
354:
355: END populate_calculated_fields;
356: