[Home] [Help]
TYPE BODY: APPS.PO_AP_LINE_LOC_REC_TYPE
Source
1 TYPE BODY PO_AP_LINE_LOC_REC_TYPE AS
2
3 -- Name: create_object
4 -- Function: Constructor method
5 -- Creates a PO_AP_LINE_LOC_REC_TYPE object based on the given
6 -- input values.
7 STATIC FUNCTION create_object (
8 p_po_line_location_id NUMBER,
9 p_uom_code VARCHAR2 DEFAULT NULL,
10 p_quantity_billed NUMBER DEFAULT NULL,
11 p_amount_billed NUMBER DEFAULT NULL,
12 p_quantity_financed NUMBER DEFAULT NULL,
13 p_amount_financed NUMBER DEFAULT NULL,
14 p_quantity_recouped NUMBER DEFAULT NULL,
15 p_amount_recouped NUMBER DEFAULT NULL,
16 p_retainage_withheld_amt NUMBER DEFAULT NULL,
17 p_retainage_released_amt NUMBER DEFAULT NULL,
18 p_last_update_login NUMBER DEFAULT NULL,
19 p_request_id NUMBER DEFAULT NULL
20 ) RETURN PO_AP_LINE_LOC_REC_TYPE
21 IS
22 d_position NUMBER := 0;
23 d_mod CONSTANT VARCHAR2(100) := 'po.plsql.PO_AP_LINE_LOC_REC_TYPE';
24 l_api_name CONSTANT VARCHAR2(30) := 'create_object';
25 l_line_loc_changes PO_AP_LINE_LOC_REC_TYPE;
26 BEGIN
27
28 IF PO_LOG.d_proc THEN
29 PO_LOG.proc_begin(d_mod,'p_po_line_location_id',p_po_line_location_id);
30 END IF;
31
32 l_line_loc_changes := PO_AP_LINE_LOC_REC_TYPE (
33 po_line_location_id => p_po_line_location_id,
34 uom_code_ap => p_uom_code,
35 quantity_billed_ap => p_quantity_billed,
36 amount_billed => p_amount_billed,
37 quantity_financed_ap => p_quantity_financed,
38 amount_financed => p_amount_financed,
39 quantity_recouped_ap => p_quantity_recouped,
40 amount_recouped => p_amount_recouped,
41 retainage_withheld_amt => p_retainage_withheld_amt,
42 retainage_released_amt => p_retainage_released_amt,
43 last_update_login => p_last_update_login,
44 request_id => p_request_id,
45 uom_code_po => null,
46 quantity_billed => null,
47 quantity_financed => null,
48 quantity_recouped => null
49 );
50
51 IF PO_LOG.d_proc THEN
52 PO_LOG.proc_end(d_mod);
53 END IF;
54
55 RETURN l_line_loc_changes;
56 END create_object;
57
58
59 --<Complex Work R12 TODO>: arusingh
60 -- 1. populate the WHO columns from org context if they are null
61 -- 2. remove nvl around PLL.unit_meas_lookup_code once UOM upgrade is done
62 -- Name: populate_calculated_fields
63 MEMBER PROCEDURE populate_calculated_fields
64 IS
65 d_position NUMBER := 0;
66 d_mod CONSTANT VARCHAR2(100) := 'po.plsql.PO_AP_LINE_LOC_REC_TYPE';
67 l_api_name CONSTANT VARCHAR2(30) := 'populate_calculated_fields';
68 l_uom_rate number;
69 l_item_id number;
70 BEGIN
71
72 IF PO_LOG.d_proc THEN
73 PO_LOG.proc_begin(d_mod,'po_line_location_id', po_line_location_id);
74 PO_LOG.proc_begin(d_mod,'uom_code_ap', uom_code_ap);
75 END IF;
76
77 d_position := 10;
78
79 -- Get the UOM from the PO
80 BEGIN
81 SELECT nvl(PLL.unit_meas_lookup_code, POL.unit_meas_lookup_code),
82 POL.item_id
83 INTO uom_code_po, l_item_id
84 FROM PO_LINE_LOCATIONS_ALL PLL, PO_LINES_ALL POL
85 WHERE PLL.line_location_id = po_line_location_id
86 AND PLL.po_line_id = POL.po_line_id;
87 EXCEPTION
88 WHEN OTHERS THEN
89 IF PO_LOG.d_exc THEN
90 PO_LOG.exc(d_mod,d_position,SQLERRM);
91 END IF;
92 RAISE;
93 END;
94
95 d_position := 20;
96 IF PO_LOG.d_stmt THEN
97 PO_LOG.stmt(d_mod,d_position,'uom_code_po: ' || uom_code_po);
98 PO_LOG.stmt(d_mod,d_position,'l_item_id: ' || l_item_id);
99 END IF;
100
101 -- Do the UOM conversion if necessary
102
103 --<bug#5339961 START>
104 --UOM will be NULL for Fixed Price or Rate-based Line Locations,
105 --and we can ignore the conversion logic in those cases
106 --We would want to convert UOMs only if the uom_code_ap is
107 --populated and if the uom_code_ap is different from uom_code_po.
108 --As on date both uom_code_ap and uom_code_po would be the same.
109 --The code below would handle any future requirements of AP to convert.
110
111 IF (uom_code_ap IS NOT NULL and uom_code_po is not null and uom_code_po <> uom_code_ap)THEN
112 d_position := 30;
113
114 -- Fetch the conversion rate
115 l_uom_rate := po_uom_s.po_uom_convert(
116 uom_code_ap, uom_code_po, l_item_id);
117 IF PO_LOG.d_stmt THEN
118 PO_LOG.stmt(d_mod,d_position,'l_uom_rate: ' || l_uom_rate);
119 END IF;
120
121 quantity_billed := round(quantity_billed_ap * l_uom_rate, 15);
122 quantity_financed := round(quantity_financed_ap * l_uom_rate, 15);
123 quantity_recouped := round(quantity_recouped_ap * l_uom_rate, 15);
124
125 ELSE
126 -- No UOM conversion necessary
127 d_position := 40;
128 IF PO_LOG.d_stmt THEN
129 PO_LOG.stmt(d_mod,d_position,'No UOM conversion necessary');
130 END IF;
131
132 quantity_billed := quantity_billed_ap;
133 quantity_financed := quantity_financed_ap;
134 quantity_recouped := quantity_recouped_ap;
135
136 END IF; -- IF (uom_code_ap IS NOT NULL and (uom_code_po <> uom_code_ap) )THEN
137 --<bug#5339961 END>
138
139 d_position := 50;
140 IF PO_LOG.d_stmt THEN
141 PO_LOG.stmt(d_mod,d_position,'quantity_billed: ' || quantity_billed);
142 PO_LOG.stmt(d_mod,d_position,'quantity_financed: '||quantity_financed);
143 PO_LOG.stmt(d_mod,d_position,'quantity_recouped: '||quantity_recouped);
144 END IF;
145
146 d_position := 60;
147 IF PO_LOG.d_proc THEN
148 PO_LOG.proc_end(d_mod);
149 END IF;
150
151 END populate_calculated_fields;
152
153
154 -- Name: dump_to_log
155 -- Function: writes the contents of this object to the FND log.
156 -- Notes: This procedure is for debugging purposes only.
157 MEMBER PROCEDURE dump_to_log
158 IS
159 l_msg VARCHAR2(2000);
160 BEGIN
161 l_msg := 'Line Location Row: ';
162 l_msg := substrb(l_msg || 'po_line_location_id ' || po_line_location_id , 1, 2000);
163 l_msg := substrb(l_msg || '; uom_code_ap ' || uom_code_ap , 1, 2000);
164 l_msg := substrb(l_msg || '; uom_code_po ' || uom_code_po , 1, 2000);
165 l_msg := substrb(l_msg || '; quantity_billed_ap ' || quantity_billed_ap , 1, 2000);
166 l_msg := substrb(l_msg || '; quantity_billed ' || quantity_billed , 1, 2000);
167 l_msg := substrb(l_msg || '; amount_billed ' || amount_billed , 1, 2000);
168 l_msg := substrb(l_msg || '; quantity_financed_ap ' || quantity_financed_ap , 1, 2000);
169 l_msg := substrb(l_msg || '; quantity_financed ' || quantity_financed , 1, 2000);
170 l_msg := substrb(l_msg || '; amount_financed ' || amount_financed , 1, 2000);
171 l_msg := substrb(l_msg || '; quantity_recouped_ap ' || quantity_recouped_ap , 1, 2000);
172 l_msg := substrb(l_msg || '; quantity_recouped ' || quantity_recouped , 1, 2000);
173 l_msg := substrb(l_msg || '; amount_recouped ' || amount_recouped , 1, 2000);
174 l_msg := substrb(l_msg || '; retainage_withheld_amt ' || retainage_withheld_amt , 1, 2000);
175 l_msg := substrb(l_msg || '; retainage_released_amt ' || retainage_released_amt , 1, 2000);
176 l_msg := substrb(l_msg || '; last_update_login ' || last_update_login , 1, 2000);
177 l_msg := substrb(l_msg || '; request_id ' || request_id , 1, 2000);
178
179 FND_LOG.string( FND_LOG.LEVEL_STATEMENT,
180 'po.plsql.PO_AP_LINE_LOC_REC_TYPE.dump_to_log',
181 l_msg );
182 END dump_to_log;
183
184
185 END;