1: PACKAGE BODY AP_INVOICE_LINES_UTILITY_PKG AS
2: /* $Header: apilnutb.pls 120.48.12020000.3 2013/02/13 23:28:37 tjbhatt ship $ */
3:
4: /*=============================================================================
5: | FUNCTION - get_encumbered_flag()
1089: Begin
1090: -- Update the calling sequence
1091: --
1092: current_calling_sequence :=
1093: 'AP_INVOICE_LINES_UTILITY_PKG.ALLOCATION_EXISTS<-'||p_Calling_Sequence;
1094:
1095: debug_info := 'Select from ap_allocation_rules';
1096:
1097: Select count(*)
1146: Begin
1147: -- Update the calling sequence
1148: --
1149: current_calling_sequence :=
1150: 'AP_INVOICE_LINES_UTILITY_PKG.Inv_Reverse_Via_Qc<-'||p_Calling_Sequence;
1151:
1152: debug_info := 'Select from ap_invoics_all';
1153:
1154: -- Bug 5261908. Added rownum condition to improve performance
1211: Begin
1212: -- Update the calling sequence
1213: --
1214: current_calling_sequence :=
1215: 'AP_INVOICE_LINES_UTILITY_PKG.IS_LINE_DISTS_TRANS_FA<-'
1216: ||p_Calling_Sequence;
1217:
1218: debug_info := 'Select from ap_invoice_distributions_all';
1219:
1268: Begin
1269: -- Update the calling sequence
1270: --
1271: current_calling_sequence :=
1272: 'AP_INVOICE_LINES_UTILITY_PKG.LINE_DISTS_ACCT_EVENT_CREATED<-'
1273: ||p_Calling_Sequence;
1274:
1275: debug_info := 'Select from ap_invoice_distributions_all';
1276:
1325: Begin
1326: -- Update the calling sequence
1327: --
1328: current_calling_sequence :=
1329: 'AP_INVOICE_LINES_UTILITY_PKG.LINE_REFERRED_BY_CORR<-'
1330: ||p_Calling_Sequence;
1331:
1332: debug_info := 'Select from ap_invoice_lines_all';
1333:
1384: Begin
1385: -- Update the calling sequence
1386: --
1387: current_calling_sequence :=
1388: 'AP_INVOICE_LINES_UTILITY_PKG.Line_Dists_Referred_By_Other <-'||
1389: p_Calling_Sequence;
1390: debug_info := 'Select from ap_invoic_distributions_all';
1391:
1392: Select count(*)
1451: Begin
1452: -- Update the calling sequence
1453: --
1454: current_calling_sequence :=
1455: 'AP_INVOICE_LINES_UTILITY_PKG.Outstanding_Alloc_Exists <-'||
1456: p_Calling_Sequence;
1457: debug_info := 'Select from ap_allocatin_rules';
1458:
1459: Select count(*)
1512: Begin
1513: -- Update the calling sequence
1514: --
1515: current_calling_sequence :=
1516: 'AP_INVOICE_LINES_UTILITY_PKG.Line_Dists_Trans_PA <-'||
1517: p_Calling_Sequence;
1518: debug_info := 'Select from ap_invoic_distributions_all';
1519:
1520: Select count(*)
1566: Begin
1567: -- Update the calling sequence
1568: --
1569: current_calling_sequence :=
1570: 'AP_INVOICE_LINES_UTILITY_PKG.Can_Line_Be_Deleted <-'||
1571: p_Calling_Sequence;
1572:
1573: If (Ap_Invoice_Lines_Utility_Pkg.Line_Dists_Acct_Event_Created
1574: (p_Line_Rec.Invoice_Id,
1569: current_calling_sequence :=
1570: 'AP_INVOICE_LINES_UTILITY_PKG.Can_Line_Be_Deleted <-'||
1571: p_Calling_Sequence;
1572:
1573: If (Ap_Invoice_Lines_Utility_Pkg.Line_Dists_Acct_Event_Created
1574: (p_Line_Rec.Invoice_Id,
1575: p_Line_Rec.Line_Number,
1576: Current_calling_sequence) = TRUE) Then
1577: p_error_code := 'AP_INV_LINE_DELETE_VALIDATED';
1575: p_Line_Rec.Line_Number,
1576: Current_calling_sequence) = TRUE) Then
1577: p_error_code := 'AP_INV_LINE_DELETE_VALIDATED';
1578: return False;
1579: ElsIf (Ap_Invoice_Lines_Utility_Pkg.Line_Referred_By_Corr
1580: (p_Line_Rec.Invoice_Id,
1581: p_Line_Rec.Line_Number,
1582: Current_calling_sequence) = TRUE) Then
1583: p_error_code := 'AP_INV_LINE_DELETE_CORR';
1581: p_Line_Rec.Line_Number,
1582: Current_calling_sequence) = TRUE) Then
1583: p_error_code := 'AP_INV_LINE_DELETE_CORR';
1584: return False;
1585: ElsIf (NVL(Ap_Invoice_Lines_Utility_Pkg.Get_Encumbered_Flag
1586: (p_Line_Rec.Invoice_Id,
1587: p_Line_Rec.Line_Number), 'N')
1588: In ('Y', 'P')) Then
1589: p_error_code := 'AP_INV_LINE_DELETE_ENCUMBERED';
1587: p_Line_Rec.Line_Number), 'N')
1588: In ('Y', 'P')) Then
1589: p_error_code := 'AP_INV_LINE_DELETE_ENCUMBERED';
1590: return False;
1591: ElsIf (Ap_Invoice_Lines_Utility_Pkg.Get_Posting_Status
1592: (p_Line_Rec.Invoice_Id,
1593: p_Line_Rec.Line_Number)
1594: In ('Y', 'P', 'S')) Then
1595: p_error_code := 'AP_INV_LINE_DELETE_ACCOUNTED';
1593: p_Line_Rec.Line_Number)
1594: In ('Y', 'P', 'S')) Then
1595: p_error_code := 'AP_INV_LINE_DELETE_ACCOUNTED';
1596: return False;
1597: ElsIf (Ap_Invoice_Lines_Utility_Pkg.Line_Dists_Trans_PA
1598: (p_Line_Rec.Invoice_Id,
1599: p_Line_Rec.Line_Number,
1600: Current_calling_sequence) = TRUE) Then
1601: p_error_code := 'AP_INV_LINE_DELETE_PA';
1599: p_Line_Rec.Line_Number,
1600: Current_calling_sequence) = TRUE) Then
1601: p_error_code := 'AP_INV_LINE_DELETE_PA';
1602: return False;
1603: ElsIf (Ap_Invoice_Lines_Utility_Pkg.Line_Dists_Referred_By_Other
1604: (p_Line_Rec.Invoice_Id,
1605: p_Line_Rec.Line_Number,
1606: Current_calling_sequence) = TRUE) Then
1607: p_error_code := 'AP_INV_LINE_REF_BY_DISTS';
1605: p_Line_Rec.Line_Number,
1606: Current_calling_sequence) = TRUE) Then
1607: p_error_code := 'AP_INV_LINE_REF_BY_DISTS';
1608: return False;
1609: ElsIf (Ap_Invoice_Lines_Utility_Pkg.Outstanding_Alloc_Exists
1610: (p_Line_Rec.Invoice_Id,
1611: p_Line_Rec.Line_Number,
1612: Current_calling_sequence) = TRUE) Then
1613: p_error_code := 'AP_INV_LINE_HAS_ALLOC_RULE';
1715: l_test_var VARCHAR2(50);
1716:
1717: BEGIN
1718: -------------------------------------------------------------
1719: current_calling_sequence := 'AP_INVOICE_LINES_UTILITY_PKG - Is_Line_Fully_Distributed';
1720: debug_info := 'Is_Line_Fully_Distributed - Open cursor';
1721: -------------------------------------------------------------
1722:
1723: OPEN Dist_Var_Cur;
1800: l_return_var BOOLEAN := FALSE;
1801:
1802:
1803: BEGIN
1804: current_calling_sequence := 'AP_INVOICE_LINES_UTILITY_PKG - Is_PO_RCV_Amount_Exceeded';
1805: -------------------------------------------------------------
1806: debug_info := 'Is_PO_RCV_Amount_Exceeded - Open cursor';
1807: -------------------------------------------------------------
1808:
1909: Begin
1910: -- Update the calling sequence
1911: --
1912: current_calling_sequence :=
1913: 'AP_INVOICE_LINES_UTILITY_PKG.Pending_Alloc_Exists_Chrg_Line <-'||
1914: p_Calling_Sequence;
1915: debug_info := 'Select from ap_allocatin_rules';
1916:
1917: Select count(*)
2202:
2203:
2204: BEGIN
2205:
2206: l_curr_calling_sequence := 'AP_INVOICE_LINES_UTILITY_PKG.'||l_debug_loc;
2207:
2208: SELECT nvl(payment_cross_rate,0), payment_currency_code
2209: INTO l_payment_cross_rate, l_payment_currency_code
2210: FROM ap_invoices_all
2295: WHEN Others THEN
2296: RETURN ('Z');
2297: END get_awt_flag;
2298:
2299: END AP_INVOICE_LINES_UTILITY_PKG;