[Home] [Help]
PACKAGE BODY: APPS.CSD_ESTIMATE_UTILS_PVT
Source
1 Package BODY Csd_Estimate_utils_Pvt AS
2 /* $Header: csdueutb.pls 120.2.12000000.2 2007/04/18 23:42:28 takwong ship $ */
3
4 -- ---------------------------------------------------------
5 -- Define global variables
6 -- ---------------------------------------------------------
7
8 G_PKG_NAME CONSTANT VARCHAR2(30) := 'CSD_REPAIR_ESTIMATE_PVT';
9 G_FILE_NAME CONSTANT VARCHAR2(12) := 'csduestb.pls';
10 g_debug NUMBER := Csd_Gen_Utility_Pvt.g_debug_level;
11 ----Begin change for 3931317, wrpper aPI forward port
12
13 C_EST_STATUS_ACCEPTED CONSTANT VARCHAR2(30) := 'ACCEPTED';
14 C_EST_STATUS_REJECTED CONSTANT VARCHAR2(30) := 'REJECTED';
15 C_EST_STATUS_NEW CONSTANT VARCHAR2(30) := 'NEW';
16 C_REP_STATUS_APPROVED CONSTANT VARCHAR2(30) := 'A';
17 C_REP_STATUS_REJECTED CONSTANT VARCHAR2(30) := 'R';
18 G_DEBUG_LEVEL CONSTANT NUMBER := TO_NUMBER(NVL(Fnd_Profile.value('CSD_DEBUG_LEVEL'),
19 '0'));
20
21 ------------------------------------------------------------------
22 -----------------------------------------------------------------
23
24 PROCEDURE debug(msg VARCHAR2) IS
25 BEGIN
26 IF (G_DEBUG_LEVEL >= 0) THEN
27 Csd_Gen_Utility_Pvt.ADD(msg);
28 --DBMS_OUTPUT.PUT_LINE(msg);
29 END IF;
30 END DEBUG;
31
32 /*-------------------------------------------------------*/
33 /* function name: validate_estimate_id */
34 /* DEscription: Validates the estimate in the context */
35 /* of repair_line_Id */
36 /* Change History : Created 16th Sep 2004 by Vijay */
37 /*-------------------------------------------------------*/
38 FUNCTION VALIDATE_ESTIMATE_ID(p_estimate_id NUMBER,
39 p_repair_line_id NUMBER) RETURN BOOLEAN IS
40 --Cursor to validate estimate id
41 CURSOR CUR_EST IS
42 SELECT 'x' col1
43 FROM CSD_REPAIR_ESTIMATE_V
44 WHERE repair_estimate_id = p_estimate_id
45 AND repair_line_id = p_repair_line_id
46 AND NVL(ESTIMATE_FREEZE_FLAG, 'N') = 'N';
47
48 l_dummy VARCHAR2(1);
49
50 BEGIN
51
52 l_dummy := ' ';
53 FOR c1_rec IN CUR_EST LOOP
54 l_dummy := c1_rec.col1;
55 END LOOP;
56
57 IF l_dummy = 'x' THEN
58 RETURN TRUE;
59 ELSE
60 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_ESTIMATE');
61 Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', p_estimate_id);
62 Fnd_Msg_Pub.ADD;
63 RETURN FALSE;
64 END IF;
65
66 END VALIDATE_ESTIMATE_ID;
67
68 /*-------------------------------------------------------*/
69 /* procedure name: validate_estiamte_status */
70 /* DEscription: Validates the estimate status */
71 /* Change History : Created 16th Sep 2004 by Vijay */
72 /*-------------------------------------------------------*/
73 FUNCTION VALIDATE_EST_STATUS(p_estimate_status VARCHAR2) RETURN BOOLEAN IS
74 --Cursor to validate estimate status
75 CURSOR CUR_EST_STATUS(p_estimate_status VARCHAR2) IS
76 SELECT 1 col1
77 FROM fnd_lookup_values_vl
78 WHERE lookup_type = 'CSD_ESTIMATE_STATUS'
79 AND enabled_flag = 'Y'
80 AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(start_date_active, SYSDATE)) AND
81 TRUNC(NVL(end_date_active, SYSDATE))
82 AND lookup_code = p_estimate_status;
83
84 l_tmp_count NUMBER;
85
86 BEGIN
87
88 l_tmp_count := 0;
89 FOR c1_rec IN CUR_EST_STATUS(p_estimate_status) LOOP
90 l_tmp_count := c1_rec.col1;
91 END LOOP;
92
93 IF l_tmp_count > 0 THEN
94 RETURN TRUE;
95 ELSE
96 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_EST_STATUS');
97 Fnd_Message.SET_TOKEN('STATUS', p_estimate_status);
98 Fnd_Msg_Pub.ADD;
99 RETURN FALSE;
100 END IF;
101
102 END VALIDATE_EST_STATUS;
103 /*-------------------------------------------------------*/
104 /* function name: validate_Reason */
105 /* DEscription: Validates the estimate reject reason */
106 /* Change History : Created 16th Sep 2004 by Vijay */
107 /* 11/3/04 added status as param */
108 /*-------------------------------------------------------*/
109 FUNCTION VALIDATE_REASON(p_reason_code VARCHAR2,
110 p_status VARCHAR2) RETURN BOOLEAN IS
111 --Cursor to validate estimate status
112 CURSOR CUR_REJECT_REASON IS
113 SELECT 1 col1
114 FROM fnd_lookup_values_vl
115 WHERE lookup_type = DECODE(p_status,
116 C_EST_STATUS_REJECTED,
117 'CSD_REJECT_REASON',
118 C_EST_STATUS_ACCEPTED,
119 'CSD_REASON')
120 AND enabled_flag = 'Y'
121 AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(start_date_active, SYSDATE)) AND
122 TRUNC(NVL(end_date_active, SYSDATE))
123 AND lookup_code = p_reason_code;
124
125 l_tmp_count NUMBER;
126
127 BEGIN
128
129 l_tmp_count := 0;
130 FOR c1_rec IN CUR_REJECT_REASON LOOP
131 l_tmp_count := c1_rec.col1;
132 END LOOP;
133
134 IF l_tmp_count > 0 THEN
135 RETURN TRUE;
136 ELSE
137 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REJECT_REASON');
138 Fnd_Msg_Pub.ADD;
139 RETURN FALSE;
140 END IF;
141 END VALIDATE_REASON;
142
143 /*-------------------------------------------------------*/
144 /* function name: validate_lead_time_uom */
145 /* DEscription: Validates the uom code of the lead time */
146 /* Change History : Created 24th Sep 2004 by Vijay */
147 /*-------------------------------------------------------*/
148 FUNCTION VALIDATE_LEAD_TIME_UOM(p_lead_time_uom VARCHAR2) RETURN BOOLEAN IS
149 --Cursor to validate estimate status
150 CURSOR CUR_LEAD_TIME_UOM IS
151 SELECT 1 col1
152 FROM fnd_lookup_values_vl
153 WHERE lookup_type = 'CSD_UNIT_OF_MEASURE'
154 AND enabled_flag = 'Y'
155 AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(start_date_active, SYSDATE)) AND
156 TRUNC(NVL(end_date_active, SYSDATE))
157 AND lookup_code = p_lead_time_uom;
158
159 l_tmp_count NUMBER;
160
161 BEGIN
162
163 l_tmp_count := 0;
164 FOR c1_rec IN CUR_LEAD_TIME_UOM LOOP
165 l_tmp_count := c1_rec.col1;
166 END LOOP;
167
168 IF l_tmp_count > 0 THEN
169 RETURN TRUE;
170 ELSE
171 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_LEAD_TIME_UOM');
172 Fnd_Msg_Pub.ADD;
173 RETURN FALSE;
174 END IF;
175 END VALIDATE_LEAD_TIME_UOM;
176
177 /*-------------------------------------------------------*/
178 /* function name: validate_uom_Code */
179 /* Description: Validates the uom code */
180 /* Change History : Created 16th Sep 2004 by Vijay */
181 /*-------------------------------------------------------*/
182 FUNCTION VALIDATE_UOM_CODE(p_uom_code VARCHAR2,
183 p_item_id NUMBER) RETURN BOOLEAN IS
184 CURSOR c1 IS
185 SELECT 1 col1
186 FROM mtl_item_uoms_view
187 WHERE inventory_item_id = p_item_id
188 AND organization_id = Cs_Std.get_item_valdn_orgzn_id
189 AND uom_type =
190 (SELECT allowed_units_lookup_code
191 FROM mtl_system_items_b
192 WHERE organization_id = Cs_Std.get_item_valdn_orgzn_id
193 AND inventory_item_id = p_item_id)
194 AND uom_code = p_uom_code;
195 l_tmp_count NUMBER;
196 BEGIN
197
198 l_tmp_count := 0;
199 FOR c1_rec IN c1 LOOP
200 l_tmp_count := c1_rec.col1;
201 END LOOP;
202 IF l_tmp_count > 0 THEN
203 RETURN TRUE;
204 ELSE
205 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_UOM');
206 Fnd_Msg_Pub.ADD;
207 RETURN FALSE;
208
209 END IF;
210
211 END VALIDATE_UOM_CODE;
212
213 /*-------------------------------------------------------*/
214 /* function name: validate_price_list */
215 /* DEscription: Validates price_list */
216 /* Change History : Created 16th Sep 2004 by Vijay */
217 /*-------------------------------------------------------*/
218 FUNCTION VALIDATE_PRICE_LIST(p_price_list_id NUMBER) RETURN BOOLEAN IS
219 CURSOR c1 IS
220 SELECT 1 col1
221 FROM oe_price_lists
222 WHERE price_list_id = p_price_list_id;
223 l_tmp_count NUMBER;
224 BEGIN
225
226 l_tmp_count := 0;
227 FOR c1_rec IN c1 LOOP
228 l_tmp_count := c1_rec.col1;
229 END LOOP;
230 IF l_tmp_count > 0 THEN
231 RETURN TRUE;
232 ELSE
233 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_PRICE_LIST_ID');
234 Fnd_Message.SET_TOKEN('PRICE_LIST_ID', TO_CHAR(p_price_list_id));
235 Fnd_Msg_Pub.ADD;
236 RETURN FALSE;
237
238 END IF;
239
240 END VALIDATE_PRICE_LIST;
241 /*-------------------------------------------------------*/
242 /* function name: validate_Item_pl_uom */
243 /* DEscription: Validates the item/pl/uom code */
244 /* Change History : Created 16th Sep 2004 by Vijay */
245 /*-------------------------------------------------------*/
246 -- FUNCTION VALIDATE_ITEM_PL_UOM
247 -- ( p_item_id NUMBER,
248 -- p_price_list_id NUMBER,
249 -- p_uom VARCHAR2) RETURN BOOLEAN;
250 -- BEGIN
251 -- null;
252 --
253 -- END VALIDATE_ITEM_PL_UOM;
254
255 /*-------------------------------------------------------*/
256 /* function name: validate_order */
257 /* DEscription: Validates the order header and line */
258 /* Change History : Created 16th Sep 2004 by Vijay */
259 /*-------------------------------------------------------*/
260 FUNCTION VALIDATE_ORDER(p_order_header_id NUMBER) RETURN VARCHAR2 IS
261
262 CURSOR c1 IS
263 SELECT A.ORDER_NUMBER
264 FROM oe_order_headers_all A
265 WHERE A.HEADER_ID = p_order_header_id;
266
267 l_order_number VARCHAR2(30);
268 BEGIN
269
270 l_order_number := NULL;
271 FOR c1_rec IN c1 LOOP
272 l_order_number := c1_rec.order_number;
273 END LOOP;
274 IF l_order_number IS NOT NULL THEN
275 RETURN l_order_number;
276 ELSE
277 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_ORDER_HEADER_ID');
278 Fnd_Message.SET_TOKEN('ORDER_HEADER_ID', TO_CHAR(p_order_header_id));
279 Fnd_Msg_Pub.ADD;
280 RETURN NULL;
281
282 END IF;
283 END VALIDATE_ORDER;
284
285 /*-------------------------------------------------------*/
286 /* function name: validate_item_instance */
287 /* DEscription: Validates the item instance and returns */
288 /* the itme instance number */
289 /* Change History : Created 16th Sep 2004 by Vijay */
290 /*-------------------------------------------------------*/
291 FUNCTION VALIDATE_ITEM_INSTANCE(p_instance_id NUMBER) RETURN VARCHAR2 IS
292
293 CURSOR c1 IS
294 SELECT INSTANCE_NUMBER
295 FROM CSI_ITEM_INSTANCES
296 WHERE INSTANCE_ID = p_instance_id;
297
298 l_instance_number VARCHAR2(30);
299 BEGIN
300
301 l_instance_number := NULL;
302 FOR c1_rec IN c1 LOOP
303 l_instance_number := c1_rec.instance_number;
304 END LOOP;
305 IF l_instance_number IS NOT NULL THEN
306 RETURN l_instance_number;
307 ELSE
308 Fnd_Message.SET_NAME('CSD', 'CSD_INVALID_INSTANCE');
309 Fnd_Msg_Pub.ADD;
310 RETURN NULL;
311
312 END IF;
313 END VALIDATE_ITEM_INSTANCE;
314
315 /*-------------------------------------------------------*/
316 /* function name: validate_revision */
317 /* DEscription: Validates the revision */
318 /* Change History : Created 16th Sep 2004 by Vijay */
319 /*-------------------------------------------------------*/
320 FUNCTION VALIDATE_REVISION(p_revision VARCHAR2,
321 p_item_id NUMBER,
322 p_org_id NUMBER) RETURN BOOLEAN IS
323 CURSOR c1 IS
324 SELECT 1 col1
325 FROM mtl_item_revisions
326 WHERE revision = p_revision
327 AND inventory_item_id = p_item_id
328 AND organization_id = p_org_id;
329
330 l_tmp_count NUMBER;
331
332 BEGIN
333
334 l_tmp_count := 0;
335 FOR c1_rec IN c1 LOOP
336 l_tmp_count := c1_rec.col1;
337 END LOOP;
338 IF l_tmp_count > 0 THEN
339 RETURN TRUE;
340 ELSE
341 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REVISION');
342 Fnd_Message.SET_TOKEN('REVISION', p_revision);
343 Fnd_Msg_Pub.ADD;
344 RETURN FALSE;
345 END IF;
346
347 END VALIDATE_REVISION;
348
349 /*-------------------------------------------------------*/
350 /* function name: validate_serial_number */
351 /* DEscription: Validates the serial number */
352 /* Change History : Created 16th Sep 2004 by Vijay */
353 /*-------------------------------------------------------*/
354 FUNCTION VALIDATE_SERIAL_NUMBER(p_serial_number VARCHAR2,
355 p_item_id NUMBER) RETURN BOOLEAN IS
356 CURSOR c1 IS
357 SELECT 1 col1
358 FROM mtl_serial_numbers
359 WHERE serial_number = p_serial_number
360 AND inventory_item_id = p_item_id;
361
362 l_tmp_count NUMBER;
363
364 BEGIN
365
366 l_tmp_count := 0;
367 FOR c1_rec IN c1 LOOP
368 l_tmp_count := c1_rec.col1;
369 END LOOP;
370 IF l_tmp_count > 0 THEN
371 RETURN TRUE;
372 ELSE
373 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_SERIAL_NUMBER');
374 Fnd_Message.SET_TOKEN('SERIAL_NUMBER', p_serial_number);
375 Fnd_Msg_Pub.ADD;
376 RETURN FALSE;
377 END IF;
378
379 END VALIDATE_SERIAL_NUMBER;
380
381 /*-------------------------------------------------------*/
382 /* function name: validate_billing_type */
383 /* DEscription: Validates the billing type from looks */
384 /* table */
385 /* Change History : Created 21st Sep 2004 by Vijay */
386 /*-------------------------------------------------------*/
387 FUNCTION VALIDATE_BILLING_TYPE(p_billing_type VARCHAR2) RETURN BOOLEAN IS
388
389 CURSOR c1 IS
390 SELECT 1 col1
391 FROM fnd_lookup_values
392 WHERE lookup_code = P_BILLING_TYPE
393 AND lookup_type = 'CSD_EST_BILLING_TYPE'
394 AND enabled_flag = 'Y'
395 AND LANGUAGE = 'US'
396 AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(start_date_active, SYSDATE)) AND
397 TRUNC(NVL(end_date_active, SYSDATE));
398
399 l_tmp_count NUMBER;
400
401 BEGIN
402
403 l_tmp_count := 0;
404 FOR c1_rec IN c1 LOOP
405 l_tmp_count := c1_rec.col1;
406 END LOOP;
407 IF l_tmp_count > 0 THEN
408 RETURN TRUE;
409 ELSE
410 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_BILLING_TYPE');
411 Fnd_Message.SET_TOKEN('BILLING_TYPE', p_billing_type);
412 Fnd_Msg_Pub.ADD;
413 RETURN FALSE;
414 END IF;
415
416 END VALIDATE_BILLING_TYPE;
417
418 /*-------------------------------------------------------*/
419 /* function name: validate_rep_line_id */
420 /* DEscription: Validates the repair line id */
421 /* */
422 /* Change History : Created 30th Sep 2004 by Vijay */
423 /*-------------------------------------------------------*/
424 FUNCTION validate_rep_line_id(p_repair_line_id IN NUMBER) RETURN BOOLEAN
425
426 IS
427 l_C_STATUS_CLOSED VARCHAR2(1) := 'C';
428
429 CURSOR c1 IS
430 SELECT 'x' col1
431 FROM csd_repairs
432 WHERE repair_line_id = p_repair_line_id
433 AND status <> l_C_STATUS_CLOSED;
434
435 l_dummy VARCHAR2(1);
436
437 BEGIN
438 l_dummy := ' ';
439 FOR c1_rec IN c1 LOOP
440 l_dummy := c1_rec.col1;
441 END LOOP;
442 IF l_dummy = 'x' THEN
443 RETURN TRUE;
444 ELSE
445 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REP_LINE_ID');
446 Fnd_Message.SET_TOKEN('REPAIR_LINE_ID', p_repair_line_id);
447 Fnd_Msg_Pub.ADD;
448 RETURN FALSE;
449 END IF;
450
451 END Validate_rep_line_id;
452
453 /*-------------------------------------------------------*/
454 /* function name: validate_incident_id */
455 /* DEscription: Validates the incident id */
456 /* */
457 /* Change History : Created 30th Sep 2004 by Vijay */
458 /*-------------------------------------------------------*/
459 FUNCTION validate_incident_id(p_incident_id IN NUMBER) RETURN BOOLEAN IS
460
461 CURSOR c1 IS
462 SELECT 'x' col1
463 FROM cs_incidents_all_b A, cs_incident_statuses_b B
464 WHERE A.incident_id = p_incident_id
465 AND B.INCIDENT_STATUS_ID = A.INCIDENT_STATUS_ID
466 AND B.incident_subtype = 'INC'
467 AND TRUNC(SYSDATE) BETWEEN
468 TRUNC(NVL(B.start_date_active, SYSDATE)) AND
469 TRUNC(NVL(B.end_date_active, SYSDATE))
470 AND B.CLOSE_FLAG = 'Y';
471
472 l_dummy VARCHAR2(1);
473
474 BEGIN
475 l_dummy := ' ';
476 FOR c1_rec IN c1 LOOP
477 l_dummy := c1_rec.col1;
478 END LOOP;
479 IF l_dummy = 'x' THEN
480 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_INC_STATUS');
481 Fnd_Message.SET_TOKEN('INCIDENT_ID', p_incident_id);
482 Fnd_Msg_Pub.ADD;
483 RETURN FALSE;
484 ELSE
485 RETURN TRUE;
486 END IF;
487
488 END validate_incident_id;
489
490 /*-------------------------------------------------------*/
491 /* procedure name: validate_est_hdr_rec */
492 /* DEscription: Validates estimates header record */
493 /* */
494 /* Change History : Created 25th June2005 by Vijay */
495 /*-------------------------------------------------------*/
496
497 PROCEDURE validate_est_hdr_rec(p_estimate_hdr_rec IN Csd_Repair_Estimate_Pub.estimate_hdr_Rec ,
498 p_validation_level IN NUMBER) IS
499 --Cursor definition to check the existing repair estimate header record for the
500 -- given repair order line.
501 CURSOR CUR_ESTIMATE_HDR(p_repair_line_id NUMBER) IS
502 SELECT 1 col1
503 FROM CSD_REPAIR_ESTIMATE
504 WHERE REPAIR_LINE_ID = p_repair_line_id
505 AND ROWNUM = 1;
506
507 l_tmp_count NUMBER;
508 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_EST_HDR_REC';
509
510 BEGIN
511
512 -- Check the required parameters
513 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_hdr_rec.repair_line_id,
514 p_param_name => 'REPAIR_LINE_ID',
515 p_api_name => l_api_name);
516 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_hdr_rec.lead_time,
517 p_param_name => 'LEAD_TIME',
518 p_api_name => l_api_name);
519 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_hdr_rec.lead_time_uom,
520 p_param_name => 'LEAD_TIME_UOM',
521 p_api_name => l_api_name);
522
523 -- Validate repair line id
524 IF (NOT VALIDATE_REP_LINE_ID(p_estimate_hdr_rec.repair_line_id)) THEN
525 debug('Invalid repair order line[' ||
526 p_estimate_hdr_rec.repair_line_id || ']');
527 RAISE Fnd_Api.G_EXC_ERROR;
528 END IF;
529
530 -- Check if the repair line has already an estimate record.
531 -- if so then return failure with warning message.
532 l_tmp_count := 0;
533 FOR c1_rec IN CUR_ESTIMATE_HDR(p_estimate_hdr_rec.repair_line_id) LOOP
534 l_tmp_count := c1_rec.col1;
535 END LOOP;
536
537 IF l_tmp_count > 0 THEN
538 Fnd_Message.SET_NAME('CSD', 'CSD_API_ESTIMATE_EXISTS');
539 Fnd_Message.SET_TOKEN('REPAIR_LINE_ID',
540 p_estimate_hdr_rec.repair_line_id);
541 Fnd_Msg_Pub.ADD;
542 Fnd_Msg_Pub.ADD_DETAIL(p_message_type => Fnd_Msg_Pub.G_WARNING_MSG);
543 debug('Estimate header already exists');
544 RAISE Fnd_Api.G_EXC_ERROR;
545 END IF;
546
547 END VALIDATE_EST_HDR_REC;
548
549 /*------------------------------------------------------------------------*/
550 /* procedure name: DEFAULT_EST_HDR_REC */
551 /* DEscription: DEfault values are set in estimates header record */
552 /* */
553 /* Change History : Created 25th June2005 by Vijay */
554 /*------------------------------------------------------------------------*/
555
556 PROCEDURE DEFAULT_EST_HDR_REC(p_estimate_hdr_rec IN OUT NOCOPY Csd_Repair_Estimate_Pub.estimate_hdr_Rec) IS
557 -- Cursor to get the object version number and repair quantity
558 -- and SR summary
559 CURSOR CUR_REPAIR_LINE(p_Repair_line_id NUMBER) IS
560 SELECT A.QUANTITY, A.OBJECT_VERSION_NUMBER, B.SUMMARY, B.INCIDENT_ID
561 FROM CSD_REPAIRS A, CS_INCIDENTS_ALL_VL B
562 WHERE A.REPAIR_LINE_ID = p_repair_line_id
563 AND A.INCIDENT_ID = B.INCIDENT_ID;
564
565 l_incident_id NUMBER;
566
567 BEGIN
568
569 --------------------------------------------------------------------
570 -- Get the repair line attributes and default into the estimate hdr
571 --------------------------------------------------------------------
572 p_estimate_hdr_rec.ro_object_version_number := -1;
573 p_estimate_hdr_rec.repair_line_quantity := 0;
574 FOR c1_rec IN CUR_REPAIR_LINE(p_estimate_hdr_rec.repair_line_id) LOOP
575 p_estimate_hdr_rec.ro_object_version_number := c1_rec.Object_Version_number;
576 p_estimate_hdr_rec.repair_line_quantity := c1_rec.quantity;
577 l_incident_id := c1_rec.incident_id;
578 IF (p_estimate_hdr_rec.work_summary IS NULL) THEN
579 p_estimate_hdr_rec.work_summary := c1_rec.summary;
580 END IF;
581 END LOOP;
582 debug('summary=[' || p_estimate_hdr_rec.work_summary || ']');
583
584 --------------------------------------------------------------------
585 -- Validate incident id status. Ensure that the SR status is not closed.
586 --------------------------------------------------------------------
587 IF (NOT VALIDATE_INCIDENT_ID(l_incident_id)) THEN
588 debug('Invalid incident id[' || l_incident_id || ']');
589 RAISE Fnd_Api.G_EXC_ERROR;
590 END IF;
591
592 -- Defualt the estiamte date to sysdate if it is null
593 IF (p_estimate_hdr_rec.estimate_date IS NULL) THEN
594 p_estimate_hdr_rec.estimate_date := SYSDATE;
595 END IF;
596
597 -- Defualt the status to 'NEW' if null
598 IF (p_estimate_hdr_rec.estimate_status IS NULL) THEN
599 p_estimate_hdr_rec.estimate_status := C_EST_STATUS_NEW;
600 END IF;
601
602 END DEFAULT_EST_HDR_REC;
603
604 /*------------------------------------------------------------------------*/
605 /* procedure name: VALIDATE_DEFAULTED_EST_HDR */
606 /* DEscription: Validate the defaulted estimates header record */
607 /* */
608 /* Change History : Created 25th June2005 by Vijay */
609 /*------------------------------------------------------------------------*/
610 PROCEDURE VALIDATE_DEFAULTED_EST_HDR(p_estimate_hdr_rec IN Csd_Repair_Estimate_Pub.estimate_hdr_Rec,
611 p_validation_level IN NUMBER) IS
612
613 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_DEFAULTED_EST_HDR';
614
615 BEGIN
616 -- If the summary is null even after SR summary is defaulted, then
617 -- it is an error.
618 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_hdr_rec.work_summary,
619 p_param_name => 'SUMMARY',
620 p_api_name => l_api_name);
621
622 --Validate input status
623 IF (NOT VALIDATE_EST_STATUS(p_estimate_hdr_rec.estimate_status)) THEN
624 debug('Invalid estimate status[' ||
625 p_estimate_hdr_rec.estimate_status || ']');
626 RAISE Fnd_Api.G_EXC_ERROR;
627 END IF;
628
629 -- Validate lead time UOM
630
631 IF (NOT VALIDATE_LEAD_TIME_UOM(p_estimate_hdr_rec.lead_time_uom)) THEN
632 debug('Invalid lead time uom[' || p_estimate_hdr_rec.lead_time_uom || ']');
633 RAISE Fnd_Api.G_EXC_ERROR;
634 END IF;
635
636 END VALIDATE_DEFAULTED_EST_HDR;
637
638 /*------------------------------------------------------------------------*/
639 /* procedure name: COPY_TO_EST_HDR_REC */
640 /* DEscription: Creates the record required for private api */
641 /* */
642 /* Change History : Created 25th June2005 by Vijay */
643 /*------------------------------------------------------------------------*/
644 PROCEDURE COPY_TO_EST_HDR_REC(p_estimate_hdr_rec IN Csd_Repair_Estimate_Pub.estimate_hdr_Rec,
645 x_est_pvt_hdr_rec OUT NOCOPY Csd_Repair_Estimate_Pvt.REPAIR_ESTIMATE_REC) IS
646 BEGIN
647
648 IF (p_estimate_hdr_rec.repair_estimate_id IS NOT NULL) then
649 x_est_pvt_hdr_rec.repair_estimate_id := p_estimate_hdr_rec.repair_estimate_id;
650 END IF;
651
652 IF (p_estimate_hdr_rec.repair_line_id IS NOT NULL) then
653 x_est_pvt_hdr_rec.repair_line_id := p_estimate_hdr_rec.repair_line_id;
654 END IF;
655 IF (p_estimate_hdr_rec.note_id IS NOT NULL) then
656 x_est_pvt_hdr_rec.note_id := p_estimate_hdr_rec.note_id;
657 END IF;
658 IF (p_estimate_hdr_rec.estimate_date IS NOT NULL) then
659 x_est_pvt_hdr_rec.estimate_date := p_estimate_hdr_rec.estimate_date;
660 END IF;
661 IF (p_estimate_hdr_rec.estimate_status IS NOT NULL) then
662 x_est_pvt_hdr_rec.estimate_status := p_estimate_hdr_rec.estimate_status;
663 END IF;
664 IF (p_estimate_hdr_rec.lead_time IS NOT NULL) then
665 x_est_pvt_hdr_rec.lead_time := p_estimate_hdr_rec.lead_time;
666 END IF;
667 IF (p_estimate_hdr_rec.lead_time_uom IS NOT NULL) then
668 x_est_pvt_hdr_rec.lead_time_uom := p_estimate_hdr_rec.lead_time_uom;
669 END IF;
670 IF (p_estimate_hdr_rec.work_summary IS NOT NULL) then
671 x_est_pvt_hdr_rec.work_summary := p_estimate_hdr_rec.work_summary;
672 END IF;
673 IF (p_estimate_hdr_rec.po_number IS NOT NULL) then
674 x_est_pvt_hdr_rec.po_number := p_estimate_hdr_rec.po_number;
675 END IF;
676 IF (p_estimate_hdr_rec.estimate_reason_code IS NOT NULL) then
677 x_est_pvt_hdr_rec.estimate_reason_code := p_estimate_hdr_rec.estimate_reason_code;
678 END IF;
679 IF (p_estimate_hdr_rec.last_update_date IS NOT NULL) then
680 x_est_pvt_hdr_rec.last_update_date := p_estimate_hdr_rec.last_update_date;
681 END IF;
682 IF (p_estimate_hdr_rec.creation_date IS NOT NULL) then
683 x_est_pvt_hdr_rec.creation_date := p_estimate_hdr_rec.creation_date;
684 END IF;
685 IF (p_estimate_hdr_rec.last_updated_by IS NOT NULL) then
686 x_est_pvt_hdr_rec.last_updated_by := p_estimate_hdr_rec.last_updated_by;
687 END IF;
688 IF (p_estimate_hdr_rec.created_by IS NOT NULL) then
689 x_est_pvt_hdr_rec.created_by := p_estimate_hdr_rec.created_by;
690 END IF;
691 IF (p_estimate_hdr_rec.last_update_login IS NOT NULL) then
692 x_est_pvt_hdr_rec.last_update_login := p_estimate_hdr_rec.last_update_login;
693 END IF;
694 IF (p_estimate_hdr_rec.attribute1 IS NOT NULL) then
695 x_est_pvt_hdr_rec.attribute1 := p_estimate_hdr_rec.attribute1;
696 END IF;
697 IF (p_estimate_hdr_rec.attribute2 IS NOT NULL) then
698 x_est_pvt_hdr_rec.attribute2 := p_estimate_hdr_rec.attribute2;
699 END IF;
700 IF (p_estimate_hdr_rec.attribute3 IS NOT NULL) then
701 x_est_pvt_hdr_rec.attribute3 := p_estimate_hdr_rec.attribute3;
702 END IF;
703 IF (p_estimate_hdr_rec.attribute4 IS NOT NULL) then
704 x_est_pvt_hdr_rec.attribute4 := p_estimate_hdr_rec.attribute4;
705 END IF;
706 IF (p_estimate_hdr_rec.attribute5 IS NOT NULL) then
707 x_est_pvt_hdr_rec.attribute5 := p_estimate_hdr_rec.attribute5;
708 END IF;
709 IF (p_estimate_hdr_rec.attribute6 IS NOT NULL) then
710 x_est_pvt_hdr_rec.attribute6 := p_estimate_hdr_rec.attribute6;
711 END IF;
712 IF (p_estimate_hdr_rec.attribute7 IS NOT NULL) then
713 x_est_pvt_hdr_rec.attribute7 := p_estimate_hdr_rec.attribute7;
714 END IF;
715 IF (p_estimate_hdr_rec.attribute8 IS NOT NULL) then
716 x_est_pvt_hdr_rec.attribute8 := p_estimate_hdr_rec.attribute8;
717 END IF;
718 IF (p_estimate_hdr_rec.attribute9 IS NOT NULL) then
719 x_est_pvt_hdr_rec.attribute9 := p_estimate_hdr_rec.attribute9;
720 END IF;
721 IF (p_estimate_hdr_rec.attribute10 IS NOT NULL) then
722 x_est_pvt_hdr_rec.attribute10 := p_estimate_hdr_rec.attribute10;
723 END IF;
724 IF (p_estimate_hdr_rec.attribute11 IS NOT NULL) then
725 x_est_pvt_hdr_rec.attribute11 := p_estimate_hdr_rec.attribute11;
726 END IF;
727 IF (p_estimate_hdr_rec.attribute12 IS NOT NULL) then
728 x_est_pvt_hdr_rec.attribute12 := p_estimate_hdr_rec.attribute12;
729 END IF;
730 IF (p_estimate_hdr_rec.attribute13 IS NOT NULL) then
731 x_est_pvt_hdr_rec.attribute13 := p_estimate_hdr_rec.attribute13;
732 END IF;
733 IF (p_estimate_hdr_rec.attribute14 IS NOT NULL) then
734 x_est_pvt_hdr_rec.attribute14 := p_estimate_hdr_rec.attribute14;
735 END IF;
736 IF (p_estimate_hdr_rec.attribute15 IS NOT NULL) then
737 x_est_pvt_hdr_rec.attribute15 := p_estimate_hdr_rec.attribute15;
738 END IF;
739 IF (p_estimate_hdr_rec.context IS NOT NULL) then
740 x_est_pvt_hdr_rec.context := p_estimate_hdr_rec.context;
741 END IF;
742 IF (p_estimate_hdr_rec.object_version_number IS NOT NULL) then
743 x_est_pvt_hdr_rec.object_version_number := p_estimate_hdr_rec.object_version_number;
744 END IF;
745
746 END COPY_TO_EST_HDR_REC;
747
748 /*------------------------------------------------------------------------*/
749 /* procedure name: COPY_TO_EST_HDR_REC_UPD */
750 /* DEscription: Creates the record required for private update api */
751 /* */
752 /* Change History : Created 25th June2005 by Vijay */
753 /*------------------------------------------------------------------------*/
754 PROCEDURE COPY_TO_EST_HDR_REC_UPD(p_estimate_hdr_rec IN Csd_Repair_Estimate_Pub.estimate_hdr_Rec,
755 x_est_pvt_hdr_rec OUT NOCOPY Csd_Repair_Estimate_Pvt.REPAIR_ESTIMATE_REC) IS
756 BEGIN
757
758 IF (p_estimate_hdr_rec.note_id IS NOT NULL) then
759 x_est_pvt_hdr_rec.note_id := p_estimate_hdr_rec.note_id;
760 END IF;
761 IF (p_estimate_hdr_rec.estimate_date IS NOT NULL) then
762 x_est_pvt_hdr_rec.estimate_date := p_estimate_hdr_rec.estimate_date;
763 END IF;
764 IF (p_estimate_hdr_rec.estimate_status IS NOT NULL) then
765 x_est_pvt_hdr_rec.estimate_status := p_estimate_hdr_rec.estimate_status;
766 END IF;
767 IF (p_estimate_hdr_rec.lead_time IS NOT NULL) then
768 x_est_pvt_hdr_rec.lead_time := p_estimate_hdr_rec.lead_time;
769 END IF;
770 IF (p_estimate_hdr_rec.lead_time_uom IS NOT NULL) then
771 x_est_pvt_hdr_rec.lead_time_uom := p_estimate_hdr_rec.lead_time_uom;
772 END IF;
773 IF (p_estimate_hdr_rec.work_summary IS NOT NULL) then
774 x_est_pvt_hdr_rec.work_summary := p_estimate_hdr_rec.work_summary;
775 END IF;
776 IF (p_estimate_hdr_rec.po_number IS NOT NULL) then
777 x_est_pvt_hdr_rec.po_number := p_estimate_hdr_rec.po_number;
778 END IF;
779 IF (p_estimate_hdr_rec.estimate_reason_code IS NOT NULL) then
780 x_est_pvt_hdr_rec.estimate_reason_code := p_estimate_hdr_rec.estimate_reason_code;
781 END IF;
782 IF (p_estimate_hdr_rec.attribute1 IS NOT NULL) then
783 x_est_pvt_hdr_rec.attribute1 := p_estimate_hdr_rec.attribute1;
784 END IF;
785 IF (p_estimate_hdr_rec.attribute2 IS NOT NULL) then
786 x_est_pvt_hdr_rec.attribute2 := p_estimate_hdr_rec.attribute2;
787 END IF;
788 IF (p_estimate_hdr_rec.attribute3 IS NOT NULL) then
789 x_est_pvt_hdr_rec.attribute3 := p_estimate_hdr_rec.attribute3;
790 END IF;
791 IF (p_estimate_hdr_rec.attribute4 IS NOT NULL) then
792 x_est_pvt_hdr_rec.attribute4 := p_estimate_hdr_rec.attribute4;
793 END IF;
794 IF (p_estimate_hdr_rec.attribute5 IS NOT NULL) then
795 x_est_pvt_hdr_rec.attribute5 := p_estimate_hdr_rec.attribute5;
796 END IF;
797 IF (p_estimate_hdr_rec.attribute6 IS NOT NULL) then
798 x_est_pvt_hdr_rec.attribute6 := p_estimate_hdr_rec.attribute6;
799 END IF;
800 IF (p_estimate_hdr_rec.attribute7 IS NOT NULL) then
801 x_est_pvt_hdr_rec.attribute7 := p_estimate_hdr_rec.attribute7;
802 END IF;
803 IF (p_estimate_hdr_rec.attribute8 IS NOT NULL) then
804 x_est_pvt_hdr_rec.attribute8 := p_estimate_hdr_rec.attribute8;
805 END IF;
806 IF (p_estimate_hdr_rec.attribute9 IS NOT NULL) then
807 x_est_pvt_hdr_rec.attribute9 := p_estimate_hdr_rec.attribute9;
808 END IF;
809 IF (p_estimate_hdr_rec.attribute10 IS NOT NULL) then
810 x_est_pvt_hdr_rec.attribute10 := p_estimate_hdr_rec.attribute10;
811 END IF;
812 IF (p_estimate_hdr_rec.attribute11 IS NOT NULL) then
813 x_est_pvt_hdr_rec.attribute11 := p_estimate_hdr_rec.attribute11;
814 END IF;
815 IF (p_estimate_hdr_rec.attribute12 IS NOT NULL) then
816 x_est_pvt_hdr_rec.attribute12 := p_estimate_hdr_rec.attribute12;
817 END IF;
818 IF (p_estimate_hdr_rec.attribute13 IS NOT NULL) then
819 x_est_pvt_hdr_rec.attribute13 := p_estimate_hdr_rec.attribute13;
820 END IF;
821 IF (p_estimate_hdr_rec.attribute14 IS NOT NULL) then
822 x_est_pvt_hdr_rec.attribute14 := p_estimate_hdr_rec.attribute14;
823 END IF;
824 IF (p_estimate_hdr_rec.attribute15 IS NOT NULL) then
825 x_est_pvt_hdr_rec.attribute15 := p_estimate_hdr_rec.attribute15;
826 END IF;
827 IF (p_estimate_hdr_rec.context IS NOT NULL) then
828 x_est_pvt_hdr_rec.context := p_estimate_hdr_rec.context;
829 END IF;
830
831 x_est_pvt_hdr_rec.object_version_number := p_estimate_hdr_rec.object_version_number;
832
833 END COPY_TO_EST_HDR_REC_UPD;
834
835 /*-------------------------------------------------------*/
836 /* procedure name: validate_est_line_rec */
837 /* DEscription: Validates estimates line record */
838 /* */
839 /* Change History : Created 25th June2005 by Vijay */
840 /*-------------------------------------------------------*/
841
842 PROCEDURE VALIDATE_EST_LINE_REC(p_estimate_line_rec IN Csd_Repair_Estimate_Pub.estimate_line_Rec,
843 p_validation_level IN NUMBER) IS
844
845 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_EST_LINE_REC';
846 l_order_number varchar2(30);
847
848 BEGIN
849 -- Check the required parameters
850 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.repair_line_id,
851 p_param_name => 'REPAIR_LINE_ID',
852 p_api_name => l_api_name);
853 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.repair_estimate_id,
854 p_param_name => 'REPAIR_ESTIMATE_ID',
855 p_api_name => l_api_name);
856 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.inventory_item_id,
857 p_param_name => 'INVENTORY_ITEM_ID',
858 p_api_name => l_api_name);
859 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.price_list_id,
860 p_param_name => 'PRICE_LIST_ID',
861 p_api_name => l_api_name);
862 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.unit_of_measure_code,
863 p_param_name => 'UNIT_OF_MEASURE_CODE',
864 p_api_name => l_api_name);
865 Csd_Process_Util.Check_Reqd_Param(p_param_value => p_estimate_line_rec.estimate_quantity,
866 p_param_name => 'ESTIMATE_QUANTITY',
867 p_api_name => l_api_name);
868
869 --------------------------------------------------------------------
870 -- Validate repair line id
871 --------------------------------------------------------------------
872 IF (NOT VALIDATE_REP_LINE_ID(p_estimate_line_rec.repair_line_id)) THEN
873 debug('Invalid repair order line[' ||
874 p_estimate_line_rec.repair_line_id || ']');
875 RAISE Fnd_Api.G_EXC_ERROR;
876 END IF;
877
878 --------------------------------------------------------------------
879 -- Validate estiamate hdr id repair line id combination
880 --------------------------------------------------------------------
881 IF (NOT VALIDATE_ESTIMATE_ID(p_estimate_line_rec.repair_estimate_id,
882 p_estimate_line_rec.repair_line_id)) THEN
883 debug('Invalid estiamte header, rep line[' ||
884 p_estimate_line_rec.repair_line_id || ']estimate[' ||
885 p_estimate_line_rec.repair_estimate_id || ']');
886 RAISE Fnd_Api.G_EXC_ERROR;
887 END IF;
888
889 --------------------------------------------------------------------
890 -- Validate inventory item id
891 --------------------------------------------------------------------
892 IF (NOT
893 Csd_Process_Util.VALIDATE_INVENTORY_ITEM_ID(p_estimate_line_rec.inventory_item_id)) THEN
894 debug('Invalid Inventory item[' ||
895 p_estimate_line_rec.inventory_item_id || ']');
896 RAISE Fnd_Api.G_EXC_ERROR;
897 END IF;
898
899 --------------------------------------------------------------------
900 -- Validate UOM
901 --------------------------------------------------------------------
902
903 IF (NOT VALIDATE_UOM_CODE(p_estimate_line_rec.unit_of_measure_code,
904 p_estimate_line_rec.inventory_item_id)) THEN
905 debug('Invalid uom[' || p_estimate_line_rec.unit_of_measure_code || ']');
906 RAISE Fnd_Api.G_EXC_ERROR;
907 END IF;
908
909 --------------------------------------------------------------------
910 -- Validate Price list
911 --------------------------------------------------------------------
912
913 IF (NOT VALIDATE_PRICE_LIST(p_estimate_line_rec.price_list_id)) THEN
914 debug('Invalid uom[' || p_estimate_line_rec.price_list_id || ']');
915 RAISE Fnd_Api.G_EXC_ERROR;
916 END IF;
917
918 --------------------------------------------------------------------
919 -- Validate add to order (order _header id and order_line_Id)
920 --------------------------------------------------------------------
921 IF (p_estimate_line_rec.add_to_order_flag = 'Y') THEN
922 l_order_number := VALIDATE_ORDER(p_estimate_line_rec.order_header_id);
923 IF (l_order_number IS NULL OR
924 l_order_number = Fnd_Api.G_MISS_CHAR) THEN
925 debug('Invalid order header id[' ||
926 p_estimate_line_rec.order_header_id || '] ');
927 RAISE Fnd_Api.G_EXC_ERROR;
928 END IF;
929 END IF;
930
931 -- Validate override charge flag.
932 IF (p_estimate_line_rec.override_charge_flag = 'Y') THEN
933 IF (NVL(Fnd_Profile.value('CSD_ALLOW_CHARGE_OVERRIDE'), 'N') <> 'Y') THEN
934 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_OVERRIDE_FLAG');
935 Fnd_Msg_Pub.ADD;
936 RAISE Fnd_Api.G_EXC_ERROR;
937 END IF;
938 END IF;
939
940 END VALIDATE_EST_LINE_REC;
941
942 /*------------------------------------------------------------------------*/
943 /* procedure name: DEFAULT_EST_LINE_REC */
944 /* DEscription: DEfault values are set in estimates line record */
945 /* */
946 /* Change History : Created 25th June2005 by Vijay */
947 /*------------------------------------------------------------------------*/
948
949 PROCEDURE DEFAULT_EST_LINE_REC(px_estimate_line_rec IN OUT NOCOPY Csd_Repair_Estimate_Pub.estimate_line_Rec) IS
950 -- cursor to get nocharge flag, txn_type and validate txn_billing_type
951 CURSOR CUR_NO_CHARGE_FLAG(p_txn_billing_Type_id NUMBER) IS
952 SELECT NVL(ctt.no_charge_flag, 'N') no_charge_flag,
953 ctt.transaction_Type_id
954 FROM cs_txn_billing_types ctbt, cs_transaction_types ctt
955 WHERE ctbt.txn_billing_type_id = p_txn_billing_type_id
956 AND ctbt.transaction_type_id = ctt.transaction_type_id;
957 -- Cursor to get the incident id , repair type, business process
958 CURSOR CUR_REPAIR_LINE(p_Repair_line_id NUMBER) IS
959 SELECT A.INCIDENT_ID,
960 A.CONTRACT_LINE_ID,
961 B.BUSINESS_PROCESS_ID,
962 B.REPAIR_TYPE_ID
963 FROM CSD_REPAIRS A, CSD_REPAIR_TYPES_B B
964 WHERE A.REPAIR_LINE_ID = p_repair_line_id
965 AND A.REPAIR_TYPE_ID = B.REPAIR_TYPE_ID;
966
967 -- Cursor to get the contract_id and contract_number
968 CURSOR CUR_CONTRACT_DETAILS(p_contract_line_id NUMBER) IS
969 SELECT HD.ID CONTRACT_ID, HD.CONTRACT_NUMBER
970 FROM OKC_K_HEADERS_B HD, OKC_K_LINES_B KL
971 WHERE HD.ID = KL.DNZ_CHR_ID
972 AND KL.CLE_ID = p_contract_line_id
973 AND ROWNUM = 1;
974
975 -- Cursor to get the billable_flag
976 CURSOR CUR_BILLING_TYPE(p_item_id NUMBER) IS
977 SELECT material_billable_flag
978 FROM mtl_system_items_b
979 WHERE inventory_item_id = p_item_id
980 AND organization_id = Cs_Std.GET_ITEM_VALDN_ORGZN_ID;
981
982 -- Cursor to get the item cost for a material item
983 -- Service validation org is considered here.
984 CURSOR CUR_MATERIAL_COST(p_item_id NUMBER) IS
985 SELECT item_cost item_cost
986 FROM cst_item_costs a, cst_cost_types b
987 WHERE a.cost_type_id = b.cost_type_id
988 AND UPPER(b.cost_type) = 'FROZEN'
989 AND a.inventory_item_id = p_item_id
990 AND a.organization_id = Cs_Std.GET_ITEM_VALDN_ORGZN_ID;
991
992 -- Cursor to get the txn_billing_Types from the repair type.
993 CURSOR CUR_TXN_BILLING_TYPE(p_repair_type_id NUMBER, p_billing_category VARCHAR2, p_billing_type VARCHAR2) IS
994 SELECT txn_billing_type_id
995 FROM csd_repair_types_sar_vl
996 WHERE repair_type_id = p_repair_type_id
997 AND BILLING_CATEGORY = p_billing_Category
998 AND BILLING_TYPE = p_billing_Type;
999
1000 CURSOR CUR_ITEM_INSTANCE(p_item_id NUMBER, p_serial_number NUMBER) IS
1001 SELECT instance_number, instance_id
1002 FROM csi_item_instances
1003 WHERE inventory_item_id = p_item_id
1004 AND serial_number = p_serial_number;
1005
1006 l_billing_Type VARCHAR2(1);
1007 l_no_charge_flag VARCHAR2(1);
1008 l_repair_Type_id NUMBER;
1009 l_contract_line_id NUMBER;
1010 l_pricing_rec Csd_Process_Util.PRICING_ATTR_REC;
1011 l_return_status varchar2(1);
1012 l_msg_Count NUMBER;
1013 l_msg_data VARCHAR2(4000);
1014
1015 --bug#3875036
1016 l_account_id NUMBER := NULL;
1017
1018
1019 BEGIN
1020 px_estimate_line_rec.source_id := px_estimate_line_rec.repair_line_id;
1021 px_estimate_line_rec.original_source_id := px_estimate_line_rec.repair_line_id;
1022 px_estimate_line_rec.source_code := 'DR';
1023 px_estimate_line_rec.original_source_code := 'DR';
1024
1025 /* bug#3875036 */
1026 l_account_id := CSD_CHARGE_LINE_UTIL.Get_SR_AccountId(px_estimate_line_rec.repair_line_id);
1027
1028 debug('Input No charge flag [' || px_estimate_line_rec.no_charge_flag || ']');
1029 l_no_charge_flag := 'N';
1030 px_estimate_line_rec.transaction_Type_id := -1;
1031 FOR c1_rec IN CUR_NO_CHARGE_FLAG(px_estimate_line_rec.txn_billing_Type_id) LOOP
1032 l_no_charge_flag := c1_rec.no_charge_flag;
1033 px_estimate_line_rec.transaction_Type_id := c1_rec.transaction_Type_id;
1034 END LOOP;
1035 debug('txn_type_id is derived from txn_billing type[' ||
1036 px_estimate_line_rec.transaction_Type_id || ']');
1037 IF (px_estimate_line_rec.transaction_Type_id = -1) THEN
1038 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_TRANSACTION_TYPE');
1039 Fnd_Message.SET_TOKEN('TXN_BILLING_TYPE_ID',
1040 px_estimate_line_rec.txn_billing_Type_id);
1041 Fnd_Msg_Pub.ADD;
1042 RAISE Fnd_Api.G_EXC_ERROR;
1043 END IF;
1044
1045 IF (px_estimate_line_rec.no_charge_flag = 'Y' AND
1046 (px_estimate_line_rec.override_charge_flag IS NULL OR
1047 px_estimate_line_rec.override_charge_flag <> 'Y')) THEN
1048 Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_NOCHARGE_FLAG');
1049 Fnd_Msg_Pub.ADD;
1050 RAISE Fnd_Api.G_EXC_ERROR;
1051 ELSIF (px_estimate_line_rec.no_charge_flag IS NULL OR
1052 px_estimate_line_rec.no_charge_flag <> 'Y') THEN
1053 debug('No charge flag is not Y, deriving from txn_billing_type[' ||
1054 px_estimate_line_rec.txn_billing_Type_id || ']');
1055 px_estimate_line_rec.no_charge_flag := l_no_charge_flag;
1056 debug('No charge flag is derived from txn_billing type[' ||
1057 px_estimate_line_rec.no_charge_flag || ']');
1058
1059 END IF;
1060
1061 --------------------------------------------------------------------
1062 --Get the business process and incident id values from the
1063 -- CSD_REPAIRS table. Since the repair line id is validated
1064 -- there is no need to check for rec not found condition.
1065 --------------------------------------------------------------------
1066 px_estimate_line_rec.business_process_id := -1;
1067 px_estimate_line_rec.incident_id := -1;
1068 FOR c1_rec IN CUR_REPAIR_LINE(px_estimate_line_rec.repair_line_id) LOOP
1069 px_estimate_line_rec.business_process_id := c1_rec.business_process_id;
1070 px_estimate_line_rec.incident_id := c1_rec.incident_id;
1071 l_repair_type_id := c1_rec.repair_type_id;
1072 ---------------------------------------------------------------------
1073 -- Default the repair order contract
1074 ---------------------------------------------------------------------
1075 l_contract_line_id := c1_rec.contract_line_id;
1076 OPEN CUR_CONTRACT_DETAILS(c1_rec.contract_line_id);
1077 FETCH CUR_CONTRACT_DETAILS
1078 INTO px_estimate_line_rec.contract_id, px_estimate_line_rec.contract_number;
1079 CLOSE CUR_CONTRACT_DETAILS;
1080
1081 debug('business_process_id[' || c1_rec.business_process_id || ']' ||
1082 'incident_id[' || c1_rec.incident_id || ']' || 'contract_id[' ||
1083 px_estimate_line_rec.contract_id || ']' || 'contract_number[' ||
1084 px_estimate_line_rec.contract_number || ']');
1085
1086 END LOOP;
1087
1088 --------------------------------------------------------------------
1089 -- Get the operating unit from the incident id.
1090 --------------------------------------------------------------------
1091 px_estimate_line_rec.organization_id := Csd_Process_Util.get_org_id(px_estimate_line_rec.incident_id);
1092 IF (px_estimate_line_rec.organization_id = -1) THEN
1093 debug('incident_id[' || px_estimate_line_rec.incident_id ||
1094 '] is invlaid');
1095 RAISE Fnd_Api.G_EXC_ERROR;
1096 END IF;
1097
1098 -- Get the billing type from the item.
1099 FOR c1_rec IN CUR_BILLING_TYPE(px_estimate_line_rec.inventory_item_id) LOOP
1100 l_billing_type := c1_rec.material_billable_flag;
1101 END LOOP;
1102
1103 -------------------------------------------------------------------
1104 -- Validate resource id if the billing_type = 'L' which is
1105 -- labor. Get the cost for the input reosurce id. If the resource
1106 -- id results in no record then it is an error condition.
1107 -------------------------------------------------------------------
1108 IF (l_billing_type = 'L') THEN
1109
1110 Csd_Cost_Analysis_Pvt.Get_ResItemCost(x_return_status => l_return_status,
1111 x_msg_count => l_msg_count,
1112 x_msg_data => l_msg_data,
1113 p_inventory_item_id => px_estimate_line_rec.inventory_item_id,
1114 p_organization_id => Cs_Std.GET_ITEM_VALDN_ORGZN_ID,
1115 p_bom_resource_id => null,
1116 p_charge_date => SYSDATE,
1117 p_currency_code => px_estimate_line_rec.currency_code,
1118 p_chg_line_uom_code => px_estimate_line_rec.unit_of_measure_code,
1119 x_item_cost => px_estimate_line_rec.item_cost);
1120
1121 -- changed the default to null instead of 0.
1122 -- also if the cost is 0 changed it to null
1123 IF (px_estimate_line_rec.item_cost = 0) THEN
1124 px_estimate_line_rec.item_cost := NULL;
1125 END IF;
1126
1127 ELSE
1128 ---------------------------------------------------------------------
1129 -- Billing type M is material. In the case of material, get the
1130 -- item cost from item costs table.
1131 ---------------------------------------------------------------------
1132 --px_estimate_line_rec.item_cost := 0;
1133 debug('item cost,before =[' || px_estimate_line_rec.item_cost || ']');
1134 FOR c1_rec IN CUR_MATERIAL_COST(px_estimate_line_rec.inventory_item_id) LOOP
1135 px_estimate_line_rec.item_cost := c1_rec.item_cost;
1136 END LOOP;
1137 IF (px_estimate_line_rec.item_cost = 0) THEN
1138 px_estimate_line_rec.item_cost := NULL;
1139 END IF;
1140 debug('item cost, after api call =[' || px_estimate_line_rec.item_cost || ']');
1141
1142 END IF;
1143
1144 ---------------------------------------------------------------------
1145 -- Get selling price if it is null
1146 ---------------------------------------------------------------------
1147 IF (px_estimate_line_rec.selling_price IS NULL) THEN
1148 l_pricing_rec := get_pricing_rec(px_estimate_line_rec);
1149 Csd_Process_Util.GET_CHARGE_SELLING_PRICE(p_inventory_item_id => px_estimate_line_rec.inventory_item_id,
1150
1151 p_price_list_header_id => px_estimate_line_rec.price_list_id,
1152 p_unit_of_measure_code => px_estimate_line_rec.unit_of_measure_code,
1153 p_currency_code => px_estimate_line_rec.currency_code,
1154 p_quantity_required => px_estimate_line_rec.estimate_quantity,
1155 p_account_id => l_account_id, /* bug#3875036 */
1156 p_org_id => px_estimate_line_rec.organization_id , -- Added for R12
1157 p_pricing_rec => l_pricing_rec,
1158 x_selling_price => px_estimate_line_rec.selling_price,
1159 x_return_status => l_return_status,
1160 x_msg_data => l_msg_data,
1161 x_msg_count => l_msg_count);
1162
1163 IF(l_return_status <> Fnd_Api.G_RET_STS_SUCCESS) THEN
1164 RAISE Fnd_Api.G_EXC_ERROR;
1165 END IF;
1166 END IF;
1167
1168 IF (px_estimate_line_rec.override_charge_flag <> 'Y') THEN
1169 IF (l_contract_line_id IS NULL) THEN
1170 px_estimate_line_rec.after_warranty_cost := px_estimate_line_rec.selling_price * px_estimate_line_rec.estimate_quantity;
1171 ELSE
1172 -----------------------------------------------------------------------
1173 -- Get the discounted price by applying the contract defaulted from the
1174 --- repair order
1175 -----------------------------------------------------------------------
1176 Csd_Charge_Line_Util.GET_DISCOUNTEDPRICE(p_api_version => 1.0,
1177 p_init_msg_list => Fnd_Api.G_TRUE,
1178 p_contract_line_id => l_contract_line_id,
1179 p_repair_type_id => l_repair_type_id,
1180 p_txn_billing_type_id => px_estimate_line_rec.txn_billing_Type_id,
1181 p_coverage_txn_grp_id => px_estimate_line_rec.coverage_txn_group_id,
1182 p_extended_price => px_estimate_line_rec.selling_price *
1183 px_estimate_line_rec.estimate_quantity,
1184 p_no_charge_flag => px_estimate_line_rec.no_Charge_flag,
1185 x_discounted_price => px_estimate_line_rec.after_warranty_cost,
1186 x_return_status => l_return_status,
1187 x_msg_count => l_msg_count,
1188 x_msg_data => l_msg_data);
1189
1190 IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS) THEN
1191 Fnd_Message.set_name('CSD', 'CSD_EST_ESTIMATED_CHARGE_ERR');
1192 Fnd_Message.set_token('CONTRACT_NUMBER', px_estimate_line_rec.CONTRACT_NUMBER);
1193 Fnd_Msg_Pub.ADD ;
1194 RAISE Fnd_Api.G_EXC_ERROR;
1195 END IF;
1196 END IF; END IF;
1197
1198 IF (px_estimate_line_rec.no_Charge_flag = 'Y') THEN
1199 px_estimate_line_rec.after_warranty_cost := 0;
1200 END IF;
1201
1202 ----------------------------------------------------------------------------------
1203 -- Default the other fields in the estimate_line_rec
1204 ----------------------------------------------------------------------------------
1205 px_estimate_line_rec.est_line_source_type_code := 'MANUAL';
1206 px_estimate_line_rec.charge_line_type := 'ESTIMATE';
1207 px_estimate_line_rec.apply_contract_discount := 'N';
1208
1209 --------------------------------------------------------------------
1210 -- Validate billing type and derive txn_billing_Type from
1211 -- billing tpye and repair type_id
1212 --------------------------------------------------------------------
1213 IF (NOT VALIDATE_BILLING_TYPE(l_billing_Type)) THEN
1214 debug('Invalid billing_type[' || l_billing_Type || ']');
1215 RAISE Fnd_Api.G_EXC_ERROR;
1216 END IF;
1217 px_estimate_line_rec.txn_billing_type_id := -1;
1218 FOR c1_rec IN CUR_TXN_BILLING_TYPE(l_repair_type_id, px_estimate_line_rec.billing_category, l_billing_type) LOOP
1219 px_estimate_line_rec.txn_billing_type_id := c1_rec.txn_billing_type_id;
1220 END LOOP;
1221 IF (px_estimate_line_rec.txn_billing_type_id = -1) THEN
1222 debug('txn billing_type_id[' || px_estimate_line_rec.txn_billing_type_id || '] is invlaid'); Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_TXN_BILLING_TYPE');
1223 Fnd_Msg_Pub.ADD;
1224 RAISE Fnd_Api.G_EXC_ERROR;
1225 END IF;
1226
1227 -- Get the reference number from
1228 -- csi table and populate the instance_id/customer_product_id
1229 if(px_estimate_line_rec.serial_number is not null and
1230 px_estimate_line_rec.inventory_item_id is not null) then
1231 FOR c2_rec IN CUR_ITEM_INSTANCE(px_estimate_line_rec.serial_number,
1232 px_estimate_line_rec.inventory_item_id) LOOP
1233 debug('instance id from serial number is[' || c2_rec.instance_id || ']');
1234 px_estimate_line_rec.instance_id := c2_rec.instance_id;
1235 px_estimate_line_rec.customer_product_id := c2_rec.instance_id;
1236 END LOOP;
1237 End If;
1238
1239
1240 END DEFAULT_EST_LINE_REC;
1241
1242 /*------------------------------------------------------------------------*/
1243 /* procedure name: VALIDATE_DEFAULTED_EST_LINE */
1244 /* DEscription: Validate the defaulted estimates header record */
1245 /* */
1246 /* Change History : Created 25th June2005 by Vijay */
1247 /*------------------------------------------------------------------------*/
1248 PROCEDURE VALIDATE_DEFAULTED_EST_LINE(p_estimate_line_rec IN Csd_Repair_Estimate_Pub.estimate_line_Rec,
1249 p_validation_level IN NUMBER) IS
1250
1251 -- cursor to get the item attributes.
1252 -- revision control = 'N' when revision control_Code <>2
1253 -- serial_control = 'Y' when the serial_control_Code <>1 and <>6
1254 -- 1==> not serrialized 6 ==> serialized at sales order issue.
1255 CURSOR CUR_ITEM_ATTRIB(p_item_id NUMBER) IS
1256 SELECT DECODE(revision_qty_Control_code, 2, 'Y', 'N') revision_control,
1257 DECODE(serial_number_control_Code, 1, 'N', '6', 'N', 'Y') serial_control,
1258 comms_nl_trackable_Flag ib_control,
1259 primary_uom_code,
1260 material_billable_flag
1261 FROM mtl_system_items_b
1262 WHERE inventory_item_id = p_item_id
1263 AND organization_id = Cs_Std.GET_ITEM_VALDN_ORGZN_ID;
1264
1265
1266 l_revision_control VARCHAR2(1);
1267 l_serial_control VARCHAR2(1);
1268 l_ib_control VARCHAR2(1);
1269 l_billing_Type VARCHAR2(1);
1270 l_uom_code varchar2(10);
1271
1272 BEGIN
1273
1274 --------------------------------------------------------------------
1275 -- Validate incident id status. Ensure that the SR status is not closed.
1276 --------------------------------------------------------------------
1277 IF (NOT VALIDATE_INCIDENT_ID(p_estimate_line_rec.incident_id)) THEN
1278 debug('Invalid incident id[' || p_estimate_line_rec.incident_id || ']');
1279 RAISE Fnd_Api.G_EXC_ERROR;
1280 END IF;
1281
1282 --------------------------------------------------------------------
1283 -- Get the item attributes and validate revision, serial number,
1284 -- and instance number and also get the primary uom if the uom
1285 -- in the input is null.
1286 -- this query gets the billing_type from item attributes.
1287 --------------------------------------------------------------------
1288 l_revision_Control := 'N';
1289 l_serial_control := 'N';
1290 l_ib_control := 'N';
1291 l_uom_code := NULL;
1292 FOR c1_rec IN CUR_ITEM_ATTRIB(p_estimate_line_rec.inventory_item_id) LOOP
1293 l_revision_Control := c1_rec.revision_Control;
1294 l_serial_control := c1_rec.serial_control;
1295 l_ib_control := c1_rec.ib_control;
1296 l_uom_code := c1_rec.primary_uom_code;
1297 l_billing_type := c1_rec.material_billable_flag;
1298 END LOOP;
1299
1300 debug('item[' || p_estimate_line_rec.inventory_item_id ||
1301 ']revision control[' || l_revision_control || ']' ||
1302 ']serial control[' || l_serial_control || ']');
1303
1304 /****
1305 IF (p_estimate_line_rec.unit_of_measure_code IS NULL OR
1306 p_estimate_line_rec.unit_of_measure_code = Fnd_Api.G_MISS_CHAR) THEN
1307 p_estimate_line_rec.unit_of_measure_code := l_uom_Code;
1308 END IF;
1309 ***********/
1310
1311 debug('serial number[' || p_estimate_line_rec.serial_number || ']');
1312 IF (l_revision_control = 'Y') THEN
1313 IF (p_estimate_line_rec.item_revision IS NOT NULL AND
1314 p_estimate_line_rec.item_revision <> Fnd_Api.G_MISS_CHAR AND
1315 NOT VALIDATE_REVISION(p_estimate_line_rec.item_revision,
1316 p_estimate_line_rec.inventory_item_id,
1317 Cs_Std.GET_ITEM_VALDN_ORGZN_ID)) THEN
1318 debug('Invalid revision[' || p_estimate_line_rec.item_revision || ']');
1319 RAISE Fnd_Api.G_EXC_ERROR;
1320 END IF;
1321 END IF;
1322
1323 IF (l_serial_control = 'Y') THEN
1324 IF (p_estimate_line_rec.serial_number IS NOT NULL AND
1325 p_estimate_line_rec.serial_number <> Fnd_Api.G_MISS_CHAR AND NOT
1326 VALIDATE_SERIAL_NUMBER(p_estimate_line_rec.serial_number,
1327 p_estimate_line_rec.inventory_item_id)) THEN
1328 debug('Invalid serial number[' || p_estimate_line_rec.serial_number || ']');
1329 RAISE Fnd_Api.G_EXC_ERROR;
1330 END IF;
1331 END IF;
1332
1333 END VALIDATE_DEFAULTED_EST_LINE;
1334
1335 /*------------------------------------------------------------------------*/
1336 /* procedure name: COPY_EST_HDR_REC */
1337 /* DEscription: Copy the input estimate record */
1338 /* */
1339 /* Change History : Created 25th June2005 by Vijay */
1340 /*------------------------------------------------------------------------*/
1341 --PROCEDURE COPY_EST_HDR_REC(
1342
1343 /*------------------------------------------------------------------------*/
1344 /* procedure name: get_pricing_rec */
1345 /* DEscription: Copy the pricing attributes into a separate rec */
1346 /* */
1347 /* Change History : Created 25th June2005 by Vijay */
1348 /*------------------------------------------------------------------------*/
1349 FUNCTION get_pricing_rec(p_estimate_line_rec IN Csd_Repair_Estimate_Pub.ESTIMATE_LINE_REC)
1350 RETURN Csd_Process_Util.PRICING_ATTR_REC IS
1351 l_pricing_rec Csd_Process_Util.PRICING_ATTR_REC;
1352 BEGIN
1353 l_pricing_rec.pricing_context := p_estimate_line_rec.pricing_context;
1354 l_pricing_rec.pricing_attribute1 := p_estimate_line_rec.pricing_attribute1;
1355 l_pricing_rec.pricing_attribute2 := p_estimate_line_rec.pricing_attribute2;
1356 l_pricing_rec.pricing_attribute3 := p_estimate_line_rec.pricing_attribute3;
1357 l_pricing_rec.pricing_attribute4 := p_estimate_line_rec.pricing_attribute4;
1358 l_pricing_rec.pricing_attribute5 := p_estimate_line_rec.pricing_attribute5;
1359 l_pricing_rec.pricing_attribute6 := p_estimate_line_rec.pricing_attribute6;
1360 l_pricing_rec.pricing_attribute7 := p_estimate_line_rec.pricing_attribute7;
1361 l_pricing_rec.pricing_attribute8 := p_estimate_line_rec.pricing_attribute8;
1362 l_pricing_rec.pricing_attribute9 := p_estimate_line_rec.pricing_attribute9;
1363 l_pricing_rec.pricing_attribute10 := p_estimate_line_rec.pricing_attribute10;
1364 l_pricing_rec.pricing_attribute11 := p_estimate_line_rec.pricing_attribute11;
1365 l_pricing_rec.pricing_attribute12 := p_estimate_line_rec.pricing_attribute12;
1366 l_pricing_rec.pricing_attribute13 := p_estimate_line_rec.pricing_attribute13;
1367 l_pricing_rec.pricing_attribute14 := p_estimate_line_rec.pricing_attribute14;
1368 l_pricing_rec.pricing_attribute15 := p_estimate_line_rec.pricing_attribute15;
1369 l_pricing_rec.pricing_attribute16 := p_estimate_line_rec.pricing_attribute16;
1370 l_pricing_rec.pricing_attribute17 := p_estimate_line_rec.pricing_attribute17;
1371 l_pricing_rec.pricing_attribute18 := p_estimate_line_rec.pricing_attribute18;
1372 l_pricing_rec.pricing_attribute19 := p_estimate_line_rec.pricing_attribute19;
1373 l_pricing_rec.pricing_attribute20 := p_estimate_line_rec.pricing_attribute20;
1374 l_pricing_rec.pricing_attribute21 := p_estimate_line_rec.pricing_attribute21;
1375 l_pricing_rec.pricing_attribute22 := p_estimate_line_rec.pricing_attribute22;
1376 l_pricing_rec.pricing_attribute23 := p_estimate_line_rec.pricing_attribute23;
1377 l_pricing_rec.pricing_attribute24 := p_estimate_line_rec.pricing_attribute24;
1378 l_pricing_rec.pricing_attribute25 := p_estimate_line_rec.pricing_attribute25;
1379 l_pricing_rec.pricing_attribute26 := p_estimate_line_rec.pricing_attribute26;
1380 l_pricing_rec.pricing_attribute27 := p_estimate_line_rec.pricing_attribute27;
1381 l_pricing_rec.pricing_attribute28 := p_estimate_line_rec.pricing_attribute28;
1382 l_pricing_rec.pricing_attribute29 := p_estimate_line_rec.pricing_attribute29;
1383 l_pricing_rec.pricing_attribute30 := p_estimate_line_rec.pricing_attribute30;
1384 l_pricing_rec.pricing_attribute31 := p_estimate_line_rec.pricing_attribute31;
1385 l_pricing_rec.pricing_attribute32 := p_estimate_line_rec.pricing_attribute32;
1386 l_pricing_rec.pricing_attribute33 := p_estimate_line_rec.pricing_attribute33;
1387 l_pricing_rec.pricing_attribute34 := p_estimate_line_rec.pricing_attribute34;
1388 l_pricing_rec.pricing_attribute35 := p_estimate_line_rec.pricing_attribute35;
1389 l_pricing_rec.pricing_attribute36 := p_estimate_line_rec.pricing_attribute36;
1390 l_pricing_rec.pricing_attribute37 := p_estimate_line_rec.pricing_attribute37;
1391 l_pricing_rec.pricing_attribute38 := p_estimate_line_rec.pricing_attribute38;
1392 l_pricing_rec.pricing_attribute39 := p_estimate_line_rec.pricing_attribute39;
1393 l_pricing_rec.pricing_attribute40 := p_estimate_line_rec.pricing_attribute40;
1394 l_pricing_rec.pricing_attribute41 := p_estimate_line_rec.pricing_attribute41;
1395 l_pricing_rec.pricing_attribute42 := p_estimate_line_rec.pricing_attribute42;
1396 l_pricing_rec.pricing_attribute43 := p_estimate_line_rec.pricing_attribute43;
1397 l_pricing_rec.pricing_attribute44 := p_estimate_line_rec.pricing_attribute44;
1398 l_pricing_rec.pricing_attribute45 := p_estimate_line_rec.pricing_attribute45;
1399 l_pricing_rec.pricing_attribute46 := p_estimate_line_rec.pricing_attribute46;
1400 l_pricing_rec.pricing_attribute47 := p_estimate_line_rec.pricing_attribute47;
1401 l_pricing_rec.pricing_attribute48 := p_estimate_line_rec.pricing_attribute48;
1402 l_pricing_rec.pricing_attribute49 := p_estimate_line_rec.pricing_attribute49;
1403 l_pricing_rec.pricing_attribute50 := p_estimate_line_rec.pricing_attribute50;
1404 l_pricing_rec.pricing_attribute51 := p_estimate_line_rec.pricing_attribute51;
1405 l_pricing_rec.pricing_attribute52 := p_estimate_line_rec.pricing_attribute52;
1406 l_pricing_rec.pricing_attribute53 := p_estimate_line_rec.pricing_attribute53;
1407 l_pricing_rec.pricing_attribute54 := p_estimate_line_rec.pricing_attribute54;
1408 l_pricing_rec.pricing_attribute55 := p_estimate_line_rec.pricing_attribute55;
1409 l_pricing_rec.pricing_attribute56 := p_estimate_line_rec.pricing_attribute56;
1410 l_pricing_rec.pricing_attribute57 := p_estimate_line_rec.pricing_attribute57;
1411 l_pricing_rec.pricing_attribute58 := p_estimate_line_rec.pricing_attribute58;
1412 l_pricing_rec.pricing_attribute59 := p_estimate_line_rec.pricing_attribute59;
1413 l_pricing_rec.pricing_attribute60 := p_estimate_line_rec.pricing_attribute60;
1414 l_pricing_rec.pricing_attribute61 := p_estimate_line_rec.pricing_attribute61;
1415 l_pricing_rec.pricing_attribute62 := p_estimate_line_rec.pricing_attribute62;
1416 l_pricing_rec.pricing_attribute63 := p_estimate_line_rec.pricing_attribute63;
1417 l_pricing_rec.pricing_attribute64 := p_estimate_line_rec.pricing_attribute64;
1418 l_pricing_rec.pricing_attribute65 := p_estimate_line_rec.pricing_attribute65;
1419 l_pricing_rec.pricing_attribute66 := p_estimate_line_rec.pricing_attribute66;
1420 l_pricing_rec.pricing_attribute67 := p_estimate_line_rec.pricing_attribute67;
1421 l_pricing_rec.pricing_attribute68 := p_estimate_line_rec.pricing_attribute68;
1422 l_pricing_rec.pricing_attribute69 := p_estimate_line_rec.pricing_attribute69;
1423 l_pricing_rec.pricing_attribute70 := p_estimate_line_rec.pricing_attribute70;
1424 l_pricing_rec.pricing_attribute71 := p_estimate_line_rec.pricing_attribute71;
1425 l_pricing_rec.pricing_attribute72 := p_estimate_line_rec.pricing_attribute72;
1426 l_pricing_rec.pricing_attribute73 := p_estimate_line_rec.pricing_attribute73;
1427 l_pricing_rec.pricing_attribute74 := p_estimate_line_rec.pricing_attribute74;
1428 l_pricing_rec.pricing_attribute75 := p_estimate_line_rec.pricing_attribute75;
1429 l_pricing_rec.pricing_attribute76 := p_estimate_line_rec.pricing_attribute76;
1430 l_pricing_rec.pricing_attribute77 := p_estimate_line_rec.pricing_attribute77;
1431 l_pricing_rec.pricing_attribute78 := p_estimate_line_rec.pricing_attribute78;
1432 l_pricing_rec.pricing_attribute79 := p_estimate_line_rec.pricing_attribute79;
1433 l_pricing_rec.pricing_attribute80 := p_estimate_line_rec.pricing_attribute80;
1434 l_pricing_rec.pricing_attribute81 := p_estimate_line_rec.pricing_attribute81;
1435 l_pricing_rec.pricing_attribute82 := p_estimate_line_rec.pricing_attribute82;
1436 l_pricing_rec.pricing_attribute83 := p_estimate_line_rec.pricing_attribute83;
1437 l_pricing_rec.pricing_attribute84 := p_estimate_line_rec.pricing_attribute84;
1438 l_pricing_rec.pricing_attribute85 := p_estimate_line_rec.pricing_attribute85;
1439 l_pricing_rec.pricing_attribute86 := p_estimate_line_rec.pricing_attribute86;
1440 l_pricing_rec.pricing_attribute87 := p_estimate_line_rec.pricing_attribute87;
1441 l_pricing_rec.pricing_attribute88 := p_estimate_line_rec.pricing_attribute88;
1442 l_pricing_rec.pricing_attribute89 := p_estimate_line_rec.pricing_attribute89;
1443 l_pricing_rec.pricing_attribute90 := p_estimate_line_rec.pricing_attribute90;
1444 l_pricing_rec.pricing_attribute91 := p_estimate_line_rec.pricing_attribute91;
1445 l_pricing_rec.pricing_attribute92 := p_estimate_line_rec.pricing_attribute92;
1446 l_pricing_rec.pricing_attribute93 := p_estimate_line_rec.pricing_attribute93;
1447 l_pricing_rec.pricing_attribute94 := p_estimate_line_rec.pricing_attribute94;
1448 l_pricing_rec.pricing_attribute95 := p_estimate_line_rec.pricing_attribute95;
1449 l_pricing_rec.pricing_attribute96 := p_estimate_line_rec.pricing_attribute96;
1450 l_pricing_rec.pricing_attribute97 := p_estimate_line_rec.pricing_attribute97;
1451 l_pricing_rec.pricing_attribute98 := p_estimate_line_rec.pricing_attribute98;
1452 l_pricing_rec.pricing_attribute99 := p_estimate_line_rec.pricing_attribute99;
1453 l_pricing_rec.pricing_attribute100 := p_estimate_line_rec.pricing_attribute100;
1454
1455 END;
1456
1457 END Csd_Estimate_Utils_Pvt;