1: PACKAGE BODY PO_DRAFT_APPR_STATUS_PVT AS
2: /* $Header: PO_DRAFT_APPR_STATUS_PVT.plb 120.7.12020000.3 2013/05/27 15:36:11 srpantha ship $ */
3:
4: d_pkg_name CONSTANT varchar2(50) :=
5: PO_LOG.get_package_base('PO_DRAFT_APPR_STATUS_PVT');
6:
7: -------------------------------------------------------
8: ----------- PRIVATE PROCEDURES PROTOTYPE --------------
9: -------------------------------------------------------
91:
92: x_rebuild_attribs := FALSE; --Bug#5264722
93: d_position := 0;
94:
95: IF (PO_LOG.d_proc) THEN
96: PO_LOG.proc_begin(d_module);
97: END IF;
98:
99: IF (p_draft_info.new_document = FND_API.G_TRUE) THEN
92: x_rebuild_attribs := FALSE; --Bug#5264722
93: d_position := 0;
94:
95: IF (PO_LOG.d_proc) THEN
96: PO_LOG.proc_begin(d_module);
97: END IF;
98:
99: IF (p_draft_info.new_document = FND_API.G_TRUE) THEN
100: RETURN;
112: WHERE po_header_id = p_draft_info.po_header_id;
113:
114: d_position := 20;
115:
116: IF (PO_LOG.d_stmt) THEN
117: PO_LOG.stmt(d_module, d_position, 'orig_auth_status', l_orig_auth_status);
118: PO_LOG.stmt(d_module, d_position, 'orig_approved_flag',
119: l_orig_approved_flag);
120: END IF;
113:
114: d_position := 20;
115:
116: IF (PO_LOG.d_stmt) THEN
117: PO_LOG.stmt(d_module, d_position, 'orig_auth_status', l_orig_auth_status);
118: PO_LOG.stmt(d_module, d_position, 'orig_approved_flag',
119: l_orig_approved_flag);
120: END IF;
121:
114: d_position := 20;
115:
116: IF (PO_LOG.d_stmt) THEN
117: PO_LOG.stmt(d_module, d_position, 'orig_auth_status', l_orig_auth_status);
118: PO_LOG.stmt(d_module, d_position, 'orig_approved_flag',
119: l_orig_approved_flag);
120: END IF;
121:
122: IF (l_orig_auth_status = 'INCOMPLETE') THEN
185: l_new_approved_flag := 'R';
186: l_new_auth_status := 'REQUIRES REAPPROVAL';
187: END IF;
188:
189: IF (PO_LOG.d_stmt) THEN
190: PO_LOG.stmt(d_module, d_position, 'new_auth_status',
191: l_new_auth_status);
192: PO_LOG.stmt(d_module, d_position, 'new_approved_flag',
193: l_new_approved_flag);
186: l_new_auth_status := 'REQUIRES REAPPROVAL';
187: END IF;
188:
189: IF (PO_LOG.d_stmt) THEN
190: PO_LOG.stmt(d_module, d_position, 'new_auth_status',
191: l_new_auth_status);
192: PO_LOG.stmt(d_module, d_position, 'new_approved_flag',
193: l_new_approved_flag);
194: END IF;
188:
189: IF (PO_LOG.d_stmt) THEN
190: PO_LOG.stmt(d_module, d_position, 'new_auth_status',
191: l_new_auth_status);
192: PO_LOG.stmt(d_module, d_position, 'new_approved_flag',
193: l_new_approved_flag);
194: END IF;
195:
196: d_position := 90;
292:
293: BEGIN
294:
295: d_position := 0;
296: IF (PO_LOG.d_proc) THEN
297: PO_LOG.proc_begin(d_module);
298: END IF;
299:
300: val_auth_status_line_loc
293: BEGIN
294:
295: d_position := 0;
296: IF (PO_LOG.d_proc) THEN
297: PO_LOG.proc_begin(d_module);
298: END IF;
299:
300: val_auth_status_line_loc
301: ( p_draft_info => p_draft_info,
305:
306: d_position := 10;
307: IF (l_line_loc_list1 IS NOT NULL) THEN
308:
309: IF (PO_LOG.d_stmt) THEN
310: PO_LOG.stmt(d_module, d_position,
311: 'Update shipment approved flag for shipment changes');
312: END IF;
313:
306: d_position := 10;
307: IF (l_line_loc_list1 IS NOT NULL) THEN
308:
309: IF (PO_LOG.d_stmt) THEN
310: PO_LOG.stmt(d_module, d_position,
311: 'Update shipment approved flag for shipment changes');
312: END IF;
313:
314: FORALL i IN 1..l_line_loc_list1.COUNT
329: d_position := 30;
330: IF (l_line_loc_list2 IS NOT NULL) THEN
331: d_position := 40;
332:
333: IF (PO_LOG.d_stmt) THEN
334: PO_LOG.stmt(d_module, d_position,
335: 'Update shipment approved flag for distribution changes');
336: END IF;
337:
330: IF (l_line_loc_list2 IS NOT NULL) THEN
331: d_position := 40;
332:
333: IF (PO_LOG.d_stmt) THEN
334: PO_LOG.stmt(d_module, d_position,
335: 'Update shipment approved flag for distribution changes');
336: END IF;
337:
338: FORALL i IN 1..l_line_loc_list2.COUNT
399: l_different VARCHAR2(1);
400:
401: BEGIN
402: d_position := 0;
403: IF (PO_LOG.d_proc) THEN
404: PO_LOG.proc_begin(d_module);
405: END IF;
406:
407: IF (p_draft_info.headers_changed = FND_API.G_FALSE) THEN
400:
401: BEGIN
402: d_position := 0;
403: IF (PO_LOG.d_proc) THEN
404: PO_LOG.proc_begin(d_module);
405: END IF;
406:
407: IF (p_draft_info.headers_changed = FND_API.G_FALSE) THEN
408: RETURN;
450:
451: d_position := 20;
452: IF (l_different = FND_API.G_TRUE) THEN
453:
454: IF (PO_LOG.d_stmt) THEN
455: PO_LOG.stmt(d_module, d_position, 'header causes approval change');
456: END IF;
457:
458: x_change_status := TRUE;
451: d_position := 20;
452: IF (l_different = FND_API.G_TRUE) THEN
453:
454: IF (PO_LOG.d_stmt) THEN
455: PO_LOG.stmt(d_module, d_position, 'header causes approval change');
456: END IF;
457:
458: x_change_status := TRUE;
459: END IF;
504: l_different VARCHAR2(1);
505: BEGIN
506:
507: d_position := 0;
508: IF (PO_LOG.d_proc) THEN
509: PO_LOG.proc_begin(d_module);
510: END IF;
511:
512: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
505: BEGIN
506:
507: d_position := 0;
508: IF (PO_LOG.d_proc) THEN
509: PO_LOG.proc_begin(d_module);
510: END IF;
511:
512: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
513: RETURN;
529: FROM po_lines_all PL
530: WHERE PLD.po_line_id = PL.po_line_id));
531:
532: IF (l_has_new_records = FND_API.G_TRUE) THEN
533: IF (PO_LOG.d_stmt) THEN
534: PO_LOG.stmt(d_module, d_position, 'new reocrds at line - approval change');
535: END IF;
536:
537: x_change_status := TRUE;
530: WHERE PLD.po_line_id = PL.po_line_id));
531:
532: IF (l_has_new_records = FND_API.G_TRUE) THEN
533: IF (PO_LOG.d_stmt) THEN
534: PO_LOG.stmt(d_module, d_position, 'new reocrds at line - approval change');
535: END IF;
536:
537: x_change_status := TRUE;
538: RETURN;
592: );
593:
594: d_position := 20;
595: IF (l_different = FND_API.G_TRUE) THEN
596: IF (PO_LOG.d_stmt) THEN
597: PO_LOG.stmt(d_module, d_position, 'Line causes approval change');
598: END IF;
599:
600: x_change_status := TRUE;
593:
594: d_position := 20;
595: IF (l_different = FND_API.G_TRUE) THEN
596: IF (PO_LOG.d_stmt) THEN
597: PO_LOG.stmt(d_module, d_position, 'Line causes approval change');
598: END IF;
599:
600: x_change_status := TRUE;
601: END IF;
652:
653: BEGIN
654:
655: d_position := 0;
656: IF (PO_LOG.d_proc) THEN
657: PO_LOG.proc_begin(d_module);
658: END IF;
659:
660: IF (p_draft_info.line_locations_changed = FND_API.G_FALSE) THEN
653: BEGIN
654:
655: d_position := 0;
656: IF (PO_LOG.d_proc) THEN
657: PO_LOG.proc_begin(d_module);
658: END IF;
659:
660: IF (p_draft_info.line_locations_changed = FND_API.G_FALSE) THEN
661: RETURN;
677: FROM po_line_locations_all PLL
678: WHERE PLLD.line_location_id = PLL.line_location_id));
679:
680: IF (l_has_new_records = FND_API.G_TRUE) THEN
681: IF (PO_LOG.d_stmt) THEN
682: PO_LOG.stmt(d_module, d_position, 'New shipments - approval change');
683: END IF;
684:
685: x_change_status := TRUE;
678: WHERE PLLD.line_location_id = PLL.line_location_id));
679:
680: IF (l_has_new_records = FND_API.G_TRUE) THEN
681: IF (PO_LOG.d_stmt) THEN
682: PO_LOG.stmt(d_module, d_position, 'New shipments - approval change');
683: END IF;
684:
685: x_change_status := TRUE;
686: END IF;
717: );
718:
719: d_position := 20;
720: IF (x_changed_line_loc_list.COUNT > 0) THEN
721: IF (PO_LOG.d_stmt) THEN
722: PO_LOG.stmt(d_module, d_position, 'Shipment causes approval change');
723: END IF;
724:
725: x_change_status := TRUE;
718:
719: d_position := 20;
720: IF (x_changed_line_loc_list.COUNT > 0) THEN
721: IF (PO_LOG.d_stmt) THEN
722: PO_LOG.stmt(d_module, d_position, 'Shipment causes approval change');
723: END IF;
724:
725: x_change_status := TRUE;
726: END IF;
775:
776: BEGIN
777:
778: d_position := 0;
779: IF (PO_LOG.d_proc) THEN
780: PO_LOG.proc_begin(d_module);
781: END IF;
782:
783: IF (p_draft_info.distributions_changed = FND_API.G_FALSE) THEN
776: BEGIN
777:
778: d_position := 0;
779: IF (PO_LOG.d_proc) THEN
780: PO_LOG.proc_begin(d_module);
781: END IF;
782:
783: IF (p_draft_info.distributions_changed = FND_API.G_FALSE) THEN
784: RETURN;
800: FROM po_distributions_all PD
801: WHERE PDD.po_distribution_id = PD.po_distribution_id));
802:
803: IF (l_has_new_records = FND_API.G_TRUE) THEN
804: IF (PO_LOG.d_stmt) THEN
805: PO_LOG.stmt(d_module, d_position, 'New distribution: approval change');
806: END IF;
807:
808: x_change_status := TRUE;
801: WHERE PDD.po_distribution_id = PD.po_distribution_id));
802:
803: IF (l_has_new_records = FND_API.G_TRUE) THEN
804: IF (PO_LOG.d_stmt) THEN
805: PO_LOG.stmt(d_module, d_position, 'New distribution: approval change');
806: END IF;
807:
808: x_change_status := TRUE;
809: END IF;
835: );
836:
837: d_position := 30;
838: IF (x_changed_line_loc_list.COUNT > 0) THEN
839: IF (PO_LOG.d_stmt) THEN
840: PO_LOG.stmt(d_module, d_position,
841: 'Distribution changes cause approval change');
842: END IF;
843:
836:
837: d_position := 30;
838: IF (x_changed_line_loc_list.COUNT > 0) THEN
839: IF (PO_LOG.d_stmt) THEN
840: PO_LOG.stmt(d_module, d_position,
841: 'Distribution changes cause approval change');
842: END IF;
843:
844: x_change_status := TRUE;
888:
889: BEGIN
890:
891: d_position := 0;
892: IF (PO_LOG.d_proc) THEN
893: PO_LOG.proc_begin(d_module);
894: END IF;
895:
896: IF (p_draft_info.ga_org_assign_changed = FND_API.G_TRUE) THEN
889: BEGIN
890:
891: d_position := 0;
892: IF (PO_LOG.d_proc) THEN
893: PO_LOG.proc_begin(d_module);
894: END IF;
895:
896: IF (p_draft_info.ga_org_assign_changed = FND_API.G_TRUE) THEN
897: IF (PO_LOG.d_stmt) THEN
893: PO_LOG.proc_begin(d_module);
894: END IF;
895:
896: IF (p_draft_info.ga_org_assign_changed = FND_API.G_TRUE) THEN
897: IF (PO_LOG.d_stmt) THEN
898: PO_LOG.stmt(d_module, d_position, 'Org assign change - approval changes');
899: END IF;
900:
901: x_change_status := TRUE;
894: END IF;
895:
896: IF (p_draft_info.ga_org_assign_changed = FND_API.G_TRUE) THEN
897: IF (PO_LOG.d_stmt) THEN
898: PO_LOG.stmt(d_module, d_position, 'Org assign change - approval changes');
899: END IF;
900:
901: x_change_status := TRUE;
902: END IF;
945:
946: BEGIN
947:
948: d_position := 0;
949: IF (PO_LOG.d_proc) THEN
950: PO_LOG.proc_begin(d_module);
951: END IF;
952:
953: IF (p_draft_info.price_diff_changed = FND_API.G_TRUE) THEN
946: BEGIN
947:
948: d_position := 0;
949: IF (PO_LOG.d_proc) THEN
950: PO_LOG.proc_begin(d_module);
951: END IF;
952:
953: IF (p_draft_info.price_diff_changed = FND_API.G_TRUE) THEN
954: IF (PO_LOG.d_stmt) THEN
950: PO_LOG.proc_begin(d_module);
951: END IF;
952:
953: IF (p_draft_info.price_diff_changed = FND_API.G_TRUE) THEN
954: IF (PO_LOG.d_stmt) THEN
955: PO_LOG.stmt(d_module, d_position,
956: 'price diff changes cause approval change');
957: END IF;
958:
951: END IF;
952:
953: IF (p_draft_info.price_diff_changed = FND_API.G_TRUE) THEN
954: IF (PO_LOG.d_stmt) THEN
955: PO_LOG.stmt(d_module, d_position,
956: 'price diff changes cause approval change');
957: END IF;
958:
959: x_change_status := TRUE;