DBA Data[Home] [Help]

APPS.AP_INTEREST_INVOICE_PKG dependencies on AP_INVOICE_DISTRIBUTIONS

Line 164: * Step 5. Create ap_invoice_distributions line

160: * Step 1. Call ap_int_inv_get_info to get some required fields
161: * Step 2. Create interest ap_invoices line
162: * Step 3. Create ap_invoice_relationships line
163: * Step 4. Create ap_invoice_lines line
164: * Step 5. Create ap_invoice_distributions line
165: * Step 6. Create ap_payment_schedules line
166: * Step 7. Create ap_invoice_payemnts line (Call ap_pay_invoice_pkg.ap_pay_
167: insert_invoice_payments)
168:

Line 423: -- Call ap_int_inv_insert_ap_inv_dist: Insert AP_INVOICE_DISTRIBUTIONS

419: P_calling_sequence);
420:
421: ---------------------------------------------------------------------------
422: -- Step 5: Case for Pay : for Pay interest invoice only
423: -- Call ap_int_inv_insert_ap_inv_dist: Insert AP_INVOICE_DISTRIBUTIONS
424: ---------------------------------------------------------------------------
425:
426: AP_INTEREST_INVOICE_PKG.ap_int_inv_insert_ap_inv_dist(
427: P_int_invoice_id,

Line 1268: Insert AP_INVOICE_DISTRIBUTIONS

1264: END ap_int_inv_insert_ap_inv_line;
1265:
1266:
1267: /*==========================================================================
1268: Insert AP_INVOICE_DISTRIBUTIONS
1269: *=====================================================================*/
1270:
1271: PROCEDURE ap_int_inv_insert_ap_inv_dist(
1272: P_int_invoice_id IN NUMBER,

Line 1305: ap_invoice_distributions.invoice_distribution_id%TYPE;

1301:
1302: debug_info VARCHAR2(100);
1303: current_calling_sequence VARCHAR2(2000);
1304: l_invoice_distribution_id
1305: ap_invoice_distributions.invoice_distribution_id%TYPE;
1306: l_proration_divisor number;
1307: l_inv_distribution_line_number number;
1308: l_distribution_total number;
1309: l_distribution_base_total number;

Line 1335: FROM ap_invoice_distributions_all AID --bug 9328384

1331: P_base_currency_code) prorated_dist_base_amt,
1332: dist_code_combination_id,
1333: type_1099,
1334: income_tax_region
1335: FROM ap_invoice_distributions_all AID --bug 9328384
1336: WHERE AID.invoice_id = P_invoice_id
1337: AND AID.line_type_lookup_code IN ('ITEM', 'IPV','ACCRUAL')
1338: ORDER BY AID.invoice_distribution_id;
1339:

Line 1358: -- Modify INSERT INTO AP_INVOICE_DISTRIBUTIONS:

1354: -- 2. Round interest amount before using it in calculating the base
1355: -- currency interest amount.
1356: -- 3. Add 'IPV' type along with 'ITEM' type distributions.
1357: -- Modify SELECT nvl(sum(AID.amount),0) to include 'IPV' type.
1358: -- Modify INSERT INTO AP_INVOICE_DISTRIBUTIONS:
1359: -- Add invoice_line_number, Remove exchange columns, Add a few
1360: -- other Columns.
1361:
1362: -- In 11ix we will always prorate distributions. We will not have

Line 1403: INSERT INTO AP_INVOICE_DISTRIBUTIONS_ALL --bug 9328384

1399:
1400: debug_info := 'inserting tax distribution using system defined account in ap_system_parameters';
1401: l_inv_distribution_line_number :=
1402: NVL(l_inv_distribution_line_number,0) + 1;
1403: INSERT INTO AP_INVOICE_DISTRIBUTIONS_ALL --bug 9328384
1404: (INVOICE_ID,
1405: DIST_CODE_COMBINATION_ID,
1406: INVOICE_DISTRIBUTION_ID,
1407: INVOICE_LINE_NUMBER,

Line 1458: ap_invoice_distributions_s.NEXTVAL,

1454: RCV_CHARGE_ADDITION_FLAG)
1455: VALUES (
1456: P_int_invoice_id,
1457: l_system_interest_account ,
1458: ap_invoice_distributions_s.NEXTVAL,
1459: 1,
1460: SYSDATE,
1461: P_last_updated_by,
1462: SYSDATE,

Line 1513: FROM ap_invoice_distributions_all AID --bug 9328384

1509:
1510: debug_info := 'Selecting distribution for proration';
1511: SELECT nvl(sum(AID.amount),0)
1512: INTO l_proration_divisor
1513: FROM ap_invoice_distributions_all AID --bug 9328384
1514: WHERE AID.invoice_id = P_invoice_id
1515: AND AID.line_type_lookup_code IN ('ITEM', 'IPV','ACCRUAL');
1516:
1517: debug_info := 'Opening the prorate cursor';

Line 1535: INSERT INTO AP_INVOICE_DISTRIBUTIONS_ALL --bug 9328384

1531: rec_prorate_int_inv.prorated_dist_base_amt;
1532:
1533:
1534: debug_info := 'Inserting invoice ditsributions';
1535: INSERT INTO AP_INVOICE_DISTRIBUTIONS_ALL --bug 9328384
1536: (INVOICE_ID,
1537: DIST_CODE_COMBINATION_ID,
1538: INVOICE_DISTRIBUTION_ID,
1539: INVOICE_LINE_NUMBER,

Line 1590: ap_invoice_distributions_s.NEXTVAL,

1586: RCV_CHARGE_ADDITION_FLAG)
1587: VALUES (
1588: P_int_invoice_id,
1589: rec_prorate_int_inv.dist_code_combination_id,
1590: ap_invoice_distributions_s.NEXTVAL,
1591: 1,
1592: SYSDATE,
1593: P_last_updated_by,
1594: SYSDATE,

Line 1645: (p_table_name => 'AP_INVOICE_DISTRIBUTIONS',

1641:
1642: debug_info := 'Calling DBI Pkg';
1643: --Bug 4539462 DBI logging
1644: AP_DBI_PKG.Maintain_DBI_Summary
1645: (p_table_name => 'AP_INVOICE_DISTRIBUTIONS',
1646: p_operation => 'I',
1647: p_key_value1 => P_int_invoice_id,
1648: p_key_value2 => l_invoice_distribution_id,
1649: p_calling_sequence => current_calling_sequence);

Line 1656: -- ap_invoice_distributions is equal to the invoice_amount

1652: CLOSE c_prorate_int_inv;
1653: END IF ;
1654:
1655: -- Make sure that the total of amount and base amount in
1656: -- ap_invoice_distributions is equal to the invoice_amount
1657: -- and base_amount of ap_invoices table
1658:
1659: IF (p_interest_amount <> l_distribution_total OR
1660: p_interest_base_amount <> l_distribution_base_total ) THEN

Line 1662: debug_info := 'Update AP_INVOICE_DISTRIBUTIONS_ALL (invoice_id = '||

1658:
1659: IF (p_interest_amount <> l_distribution_total OR
1660: p_interest_base_amount <> l_distribution_base_total ) THEN
1661:
1662: debug_info := 'Update AP_INVOICE_DISTRIBUTIONS_ALL (invoice_id = '||
1663: p_int_invoice_id||')';
1664:
1665:
1666: -- Perf Bug 5059000

Line 1667: UPDATE ap_invoice_distributions_all aid

1663: p_int_invoice_id||')';
1664:
1665:
1666: -- Perf Bug 5059000
1667: UPDATE ap_invoice_distributions_all aid
1668: set amount = amount - l_distribution_total + p_interest_amount,
1669: base_amount = base_amount - l_distribution_base_total
1670: + p_interest_base_amount
1671: WHERE aid.rowid =(

Line 1677: from ap_invoice_distributions_all aid3 --bug 9328384

1673: (
1674: select rowid row_id,
1675: rank() over(order by abs(aid3.amount) desc,
1676: aid3.distribution_line_number desc) r
1677: from ap_invoice_distributions_all aid3 --bug 9328384
1678: WHERE aid3.invoice_id = p_int_invoice_id
1679: )
1680: where r=1 )
1681: RETURNING aid.invoice_distribution_id

Line 1685: UPDATE ap_invoice_distributions aid1

1681: RETURNING aid.invoice_distribution_id
1682: BULK COLLECT INTO l_dbi_key_value_list; -- bug 4539462
1683:
1684: /* -- Perf Bug 5059000 - commented older UPDATE below
1685: UPDATE ap_invoice_distributions aid1
1686: SET amount = amount -
1687: l_distribution_total +
1688: p_interest_amount,
1689: base_amount = base_amount -

Line 1695: FROM ap_invoice_distributions aid2

1691: p_interest_base_amount
1692: WHERE invoice_id = p_int_invoice_id
1693: AND distribution_line_number =
1694: (SELECT MAX(distribution_line_number)
1695: FROM ap_invoice_distributions aid2
1696: WHERE aid2.invoice_id = p_int_invoice_id
1697: AND ABS(aid2.amount) =
1698: (SELECT MAX(ABS(aid3.amount))
1699: FROM ap_invoice_distributions aid3

Line 1699: FROM ap_invoice_distributions aid3

1695: FROM ap_invoice_distributions aid2
1696: WHERE aid2.invoice_id = p_int_invoice_id
1697: AND ABS(aid2.amount) =
1698: (SELECT MAX(ABS(aid3.amount))
1699: FROM ap_invoice_distributions aid3
1700: WHERE aid3.invoice_id = p_int_invoice_id))
1701: RETURNING aid1.invoice_distribution_id
1702: BULK COLLECT INTO l_dbi_key_value_list; -- bug 4539462
1703: */

Line 1706: (p_table_name => 'AP_INVOICE_DISTRIBUTIONS',

1702: BULK COLLECT INTO l_dbi_key_value_list; -- bug 4539462
1703: */
1704: --Bug 4539462 DBI logging
1705: AP_DBI_PKG.Maintain_DBI_Summary
1706: (p_table_name => 'AP_INVOICE_DISTRIBUTIONS',
1707: p_operation => 'U',
1708: p_key_value1 => p_int_invoice_id,
1709: p_key_value_list => l_dbi_key_value_list,
1710: p_calling_sequence => current_calling_sequence);

Line 1934: ap_invoice_distributions_s.NEXTVAL Invoice_Distribution_Id,

1930:
1931: CURSOR C_Interest_Inv_Cur is
1932: SELECT AID.invoice_id Invoice_Id,
1933: AID.dist_code_combination_id Dist_Code_Combination_Id,
1934: ap_invoice_distributions_s.NEXTVAL Invoice_Distribution_Id,
1935: AID.invoice_line_number Invoice_Line_Number,
1936: AID.set_of_books_id Set_Of_Books_Id,
1937: 0-AID.amount Amount,
1938: AID.line_type_lookup_code Line_Type_Lookup_code,

Line 1944: FROM ap_invoice_distributions AID,

1940: ALC.displayed_field || ' '||AID.description Description,
1941: DECODE(GL.account_type, 'A', 'Y', 'N') Assets_Tracking_Flag,
1942: AID.accts_pay_code_combination_id Accts_Pay_Code_Combination_Id,
1943: AID.org_id Org_Id
1944: FROM ap_invoice_distributions AID,
1945: gl_code_combinations GL,
1946: ap_invoice_payments AIP,
1947: ap_invoice_relationships AIR,
1948: ap_lookup_codes ALC

Line 1971: -- Modify INSERT INTO AP_INVOICE_DISTRIBUTIONS

1967: -- Add cursor C_Interest_Inv_Cur and define Interest_Inv_Cur of rowtype
1968: -- Use cursor to loop and insert an equivalent number of distributions
1969: -- to the original interest invoice in order to cancel them all. It used
1970: -- insert only one distribution which is wrong.
1971: -- Modify INSERT INTO AP_INVOICE_DISTRIBUTIONS
1972:
1973:
1974: l_Curr_Calling_Sequence := 'AP_INTEREST_INVOICE_PKG.AP_REVERSE_INTEREST_INVOICE<-'||
1975: P_Calling_Sequence;

Line 2077: FROM ap_invoice_distributions aid,

2073: l_Debug_Info := 'Reverse related invoice distributions';
2074:
2075: SELECT max(aid.distribution_line_number)
2076: INTO l_max_dist_line_num
2077: FROM ap_invoice_distributions aid,
2078: gl_code_combinations gl,
2079: ap_invoice_payments aip,
2080: ap_invoice_relationships air,
2081: ap_lookup_codes alc

Line 2098: INSERT INTO ap_invoice_distributions(

2094: EXIT WHEN C_Interest_Inv_Cur%NOTFOUND;
2095:
2096: l_max_dist_line_num := l_max_dist_line_num + 1;
2097:
2098: INSERT INTO ap_invoice_distributions(
2099: INVOICE_ID,
2100: DIST_CODE_COMBINATION_ID,
2101: INVOICE_DISTRIBUTION_ID,
2102: INVOICE_LINE_NUMBER,

Line 2830: l_login_id ap_invoice_distributions.last_update_login%TYPE;

2826:
2827:
2828: rec_select_int_invoices c_select_interest_invoices%rowtype;
2829: debug_info VARCHAR2(100);
2830: l_login_id ap_invoice_distributions.last_update_login%TYPE;
2831:
2832: BEGIN
2833:
2834: -- Interest Invoices project - Invoice Lines