DBA Data[Home] [Help]

APPS.PAAPIMP_PKG dependencies on AP_INVOICE_DISTRIBUTIONS

Line 883: UPDATE ap_invoice_distributions_all DIST

879: write_log(LOG, '......Paapimp is not running, do cleanup');
880: end if;
881: G_err_stage := 'UPDATING INVOICE DISTRIBUTIONS';
882:
883: UPDATE ap_invoice_distributions_all DIST
884: SET DIST.pa_addition_flag = 'N'
885: , DIST.request_id = G_REQUEST_ID
886: WHERE DIST.pa_addition_flag IN ('O','W')
887: AND DIST.posted_flag||''= 'Y'

Line 1083: p_invoice_distribution_id IN ap_invoice_distributions.invoice_distribution_id%TYPE)

1079:
1080: FUNCTION create_new_org_transref (
1081: p_batch_name IN pa_transaction_interface.batch_name%TYPE,
1082: p_invoice_id IN ap_invoices.invoice_id%TYPE,
1083: p_invoice_distribution_id IN ap_invoice_distributions.invoice_distribution_id%TYPE)
1084: RETURN pa_transaction_interface.orig_transaction_reference%TYPE IS
1085:
1086: BEGIN
1087:

Line 1337: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist

1333: G_err_stage := 'Updating the expense reports to Z for project ';
1334: write_log(LOG, G_err_stage);
1335: End If;
1336: /* Modified the hint on following update statement for bug 6920705 */
1337: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist
1338: SET dist.pa_addition_flag = 'Z',
1339: request_id = G_REQUEST_ID,
1340: last_update_date = SYSDATE, --bug 3905111
1341: last_updated_by = G_USER_ID,

Line 1360: FROM ap_invoice_distributions dist1

1356: WHERE inv.invoice_id = DIST.invoice_id
1357: AND inv.invoice_type_lookup_code = 'EXPENSE REPORT')
1358: AND ( nvl(dist.encumbered_flag,'N') = 'R' )
1359: AND NOT EXISTS (SELECT NULL
1360: FROM ap_invoice_distributions dist1
1361: WHERE dist.parent_reversal_id is not null
1362: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1363: AND dist1.pa_addition_flag = 'T'
1364: AND dist1.encumbered_flag = 'R')

Line 1389: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/

1385: write_log(LOG, G_err_stage);
1386: End If;
1387:
1388:
1389: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/
1390: SET dist.pa_addition_flag = 'Z',
1391: request_id = G_REQUEST_ID,
1392: last_update_date = SYSDATE, --bug 3905111
1393: last_updated_by = G_USER_ID,

Line 1417: FROM ap_invoice_distributions dist1

1413: WHERE inv.invoice_id = DIST.invoice_id
1414: AND inv.invoice_type_lookup_code = 'EXPENSE REPORT')
1415: AND ( nvl(dist.encumbered_flag,'N') = 'R' )
1416: AND NOT EXISTS (SELECT NULL
1417: FROM ap_invoice_distributions dist1
1418: WHERE dist.parent_reversal_id is not null
1419: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1420: AND dist1.pa_addition_flag = 'T'
1421: AND dist1.encumbered_flag = 'R')

Line 1461: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist

1457: G_err_stage := 'Updating invoice distributions to Z for project';
1458: write_log(LOG, G_err_stage);
1459: End If;
1460: /* Modified the hint on following update statement for bug 6920705 */
1461: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist
1462: SET dist.pa_addition_flag = 'Z',
1463: request_id = G_REQUEST_ID,
1464: last_update_date=SYSDATE, --bug 3905111
1465: last_updated_by= G_USER_ID,

Line 1479: FROM ap_invoice_distributions dist1

1475: AND ( nvl(dist.encumbered_flag,'N') = 'R' )
1476: --Update historical data for Cash Based Acctng
1477: AND (G_ACCTNG_METHOD = 'A' OR (G_ACCTNG_METHOD = 'C' AND dist.historical_flag = 'Y'))
1478: AND NOT EXISTS (SELECT NULL
1479: FROM ap_invoice_distributions dist1
1480: WHERE dist.parent_reversal_id is not null
1481: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1482: AND dist1.pa_addition_flag = 'T'
1483: AND dist1.encumbered_flag = 'R')

Line 1508: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/

1504: G_err_stage := 'Updating invoice distributions to Z for all';
1505: write_log(LOG, G_err_stage);
1506: End If;
1507:
1508: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/
1509: SET dist.pa_addition_flag = 'Z',
1510: request_id = G_REQUEST_ID,
1511: last_update_date = SYSDATE, --bug 3905111
1512: last_updated_by = G_USER_ID,

Line 1531: FROM ap_invoice_distributions dist1

1527: AND (nvl(dist.encumbered_flag,'N') = 'R' )
1528: --Update historical data for Cash Based Acctng
1529: AND (G_ACCTNG_METHOD = 'A' OR (G_ACCTNG_METHOD = 'C' AND dist.historical_flag = 'Y'))
1530: AND NOT EXISTS (SELECT NULL
1531: FROM ap_invoice_distributions dist1
1532: WHERE dist.parent_reversal_id is not null
1533: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1534: AND dist1.pa_addition_flag = 'T'
1535: AND dist1.encumbered_flag = 'R')

Line 1578: FROM ap_invoice_distributions_All

1574: BEGIN
1575:
1576: SELECT prepay_amount_remaining
1577: INTO l_prepay_rem_amt
1578: FROM ap_invoice_distributions_All
1579: WHERE invoice_distribution_id = p_prepay_dist_id;
1580:
1581: -- ==================================================================================
1582: -- Bug: 5393523

Line 1645: UPDATE AP_Invoice_distributions DIST

1641: IF G_ACCTNG_METHOD = 'C' THEN --CAsh BAsed Accounting
1642:
1643: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
1644:
1645: UPDATE AP_Invoice_distributions DIST
1646: SET DIST.Pa_Addition_Flag ='O',
1647: request_id = G_REQUEST_ID,
1648: last_update_date=SYSDATE,
1649: last_updated_by=G_USER_ID,

Line 1662: AP_Invoice_distributions DIST1,

1658: AND dist.line_type_lookup_code <> 'REC_TAX' -- do not proces recoverable tax
1659: AND ((
1660: exists (SELECT NULL
1661: FROM AP_INVOICES inv,
1662: AP_Invoice_distributions DIST1,
1663: PO_VENDORS vend
1664: WHERE inv.invoice_id = DIST1.invoice_id
1665: AND DIST1.invoice_distribution_id = DIST.invoice_distribution_id
1666: AND INV.payment_status_flag = 'Y' -- Flag indicated FULLY paid inv

Line 1680: ap_invoice_distributions dist2

1676: OR
1677: (EXISTS ( SELECT NULL
1678: FROM PO_VENDORS vend1,
1679: ap_invoices inv1,
1680: ap_invoice_distributions dist2
1681: WHERE inv1.invoice_id = dist2.invoice_id
1682: AND inv1.invoice_id = dist.invoice_id
1683: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )
1684: AND dist2.invoice_distribution_id = dist.parent_reversal_id --Process Historical data reversals as Invoices in Cash based

Line 1708: UPDATE ap_invoice_distributions_all dist

1704: Pre Rel12 Upgrade should also be brought into Projects */
1705:
1706: write_log(LOG, 'Marking Historical Prepayments for processing...');
1707:
1708: UPDATE ap_invoice_distributions_all dist
1709: SET dist.pa_addition_flag = 'O',
1710: request_id = G_REQUEST_ID,
1711: last_update_date=SYSDATE,
1712: last_updated_by= G_USER_ID,

Line 1740: AP_Invoice_Distributions_all aid

1736: AND inv.source in ('CREDIT CARD','Both Pay')
1737: AND nvl(inv.PAID_ON_BEHALF_EMPLOYEE_ID,0) > 0)))
1738: AND exists(SELECT inv.invoice_id
1739: FROM AP_INVOICES inv,
1740: AP_Invoice_Distributions_all aid
1741: WHERE aid.invoice_id = inv.invoice_id
1742: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
1743: AND aid.historical_flag = 'Y'
1744: AND aid.pa_addition_flag = 'Y'

Line 1755: UPDATE AP_Invoice_distributions DIST

1751: ELSE --Accounting Method is Accrual
1752:
1753: write_log(LOG, 'Marking Expense Report type invoices for processing - Accrual Acct');
1754:
1755: UPDATE AP_Invoice_distributions DIST
1756: SET DIST.Pa_Addition_Flag ='O',
1757: request_id = G_REQUEST_ID,
1758: last_update_date=SYSDATE,
1759: last_updated_by=G_USER_ID,

Line 1795: UPDATE AP_Invoice_distributions DIST

1791: IF G_ACCTNG_METHOD = 'C' THEN
1792:
1793: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
1794:
1795: UPDATE AP_Invoice_distributions DIST
1796: SET DIST.Pa_Addition_Flag ='O',
1797: request_id = G_REQUEST_ID,
1798: last_update_date=SYSDATE,
1799: last_updated_by=G_USER_ID,

Line 1812: AP_Invoice_distributions DIST1,

1808: AND dist.line_type_lookup_code <> 'REC_TAX' -- do not proces recoverable tax
1809: AND (
1810: (exists (SELECT NULL
1811: FROM AP_INVOICES inv,
1812: AP_Invoice_distributions DIST1,
1813: PO_VENDORS vend
1814: WHERE inv.invoice_id = DIST1.invoice_id
1815: AND DIST1.invoice_distribution_id = DIST.invoice_distribution_id
1816: AND INV.payment_status_flag = 'Y' -- Flag indicated FULLY paid inv

Line 1829: ap_invoices inv1, ap_invoice_distributions dist2

1825: AND nvl(inv.PAID_ON_BEHALF_EMPLOYEE_ID,0) > 0))))
1826: OR
1827: (EXISTS ( SELECT NULL
1828: FROM PO_VENDORS vend1,
1829: ap_invoices inv1, ap_invoice_distributions dist2
1830: WHERE inv1.invoice_id = dist2.invoice_id
1831: AND inv1.invoice_id = dist.invoice_id
1832: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )
1833: AND dist2.invoice_distribution_id = dist.parent_reversal_id --Process Historical data reversals as Invoices in Cash based

Line 1855: UPDATE ap_invoice_distributions dist

1851: Pre Rel12 Upgrade should also be brought into Projects */
1852:
1853: write_log(LOG, 'Marking Historical Prepayments for processing...');
1854:
1855: UPDATE ap_invoice_distributions dist
1856: SET dist.pa_addition_flag = 'O',
1857: request_id = G_REQUEST_ID,
1858: last_update_date=SYSDATE,
1859: last_updated_by= G_USER_ID,

Line 1886: AP_Invoice_Distributions_all aid

1882: AND inv.source in ('CREDIT CARD','Both Pay')
1883: AND nvl(inv.PAID_ON_BEHALF_EMPLOYEE_ID,0) > 0)))
1884: AND exists(SELECT inv.invoice_id
1885: FROM AP_INVOICES_ALL inv,
1886: AP_Invoice_Distributions_all aid
1887: WHERE aid.invoice_id = inv.invoice_id
1888: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
1889: AND aid.historical_flag = 'Y'
1890: AND aid.pa_addition_flag = 'Y'

Line 1901: UPDATE /*+ index(DIST AP_INVOICE_DISTRIBUTIONS_N14)*/ AP_Invoice_distributions DIST /*Added for bug 6327185*/

1897: ELSE --Accounting Method is Accrual
1898:
1899: write_log(LOG, 'Marking Expense Report type invoices for processing - Accrual Acct');
1900:
1901: UPDATE /*+ index(DIST AP_INVOICE_DISTRIBUTIONS_N14)*/ AP_Invoice_distributions DIST /*Added for bug 6327185*/
1902: SET DIST.Pa_Addition_Flag ='O', /*Bug#2168903*/
1903: request_id = G_REQUEST_ID,
1904: last_update_date=SYSDATE, --bug 3905111
1905: last_updated_by=G_USER_ID,

Line 1964: UPDATE AP_Invoice_Distributions DIST

1960: IF G_ACCTNG_METHOD = 'C' THEN
1961:
1962: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
1963:
1964: UPDATE AP_Invoice_Distributions DIST
1965: SET DIST.Pa_Addition_Flag = 'O',
1966: request_id = G_REQUEST_ID,
1967: last_update_date=SYSDATE,
1968: last_updated_by=G_USER_ID,

Line 1986: ap_invoice_distributions_all dist2

1982: EXISTS (
1983: SELECT NULL
1984: FROM ap_invoices_all inv,
1985: po_distributions_all PO,
1986: ap_invoice_distributions_all dist2
1987: WHERE inv.invoice_id = dist2.invoice_id
1988: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
1989: AND dist2.invoice_id = DIST.invoice_id
1990: AND dist2.invoice_distribution_id = DIST.invoice_distribution_id

Line 2006: ap_invoice_distributions_all dist3

2002: OR
2003: EXISTS (
2004: SELECT NULL
2005: FROM ap_invoices_all inv1,
2006: ap_invoice_distributions_all dist3
2007: WHERE inv1.invoice_id = dist3.invoice_id
2008: AND inv1.invoice_id = dist.invoice_id
2009: AND inv1.invoice_type_lookup_code <> 'EXPENSE REPORT'
2010: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )

Line 2027: ap_invoice_distributions apdist,

2023: AND si.organization_id = pod.org_id
2024: )
2025: AND NOT EXISTS (SELECT 'X'
2026: FROM
2027: ap_invoice_distributions apdist,
2028: po_distributions pod,
2029: mtl_system_items si,
2030: po_lines_all pol
2031: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2052: UPDATE ap_invoice_distributions_all dist

2048: Pre Rel12 Upgrade should also be brought into Projects */
2049:
2050: write_log(LOG, 'Marking PREPAYMENT invoices in Cash Based Acctng');
2051:
2052: UPDATE ap_invoice_distributions_all dist
2053: SET dist.pa_addition_flag = 'O',
2054: request_id = G_REQUEST_ID,
2055: last_update_date=SYSDATE,
2056: last_updated_by= G_USER_ID,

Line 2080: AP_Invoice_Distributions_all aid

2076: AND nvl(INV.source, 'xx' ) NOT IN ('Oracle Project Accounting',
2077: 'PA_IC_INVOICES','PA_COST_ADJUSTMENTS') )
2078: AND exists(SELECT inv.invoice_id
2079: FROM AP_INVOICES inv,
2080: AP_Invoice_Distributions_all aid
2081: WHERE aid.invoice_id = inv.invoice_id
2082: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
2083: AND aid.historical_flag = 'Y'
2084: AND aid.pa_addition_flag = 'Y'

Line 2100: ap_invoice_distributions apdist,

2096: AND si.organization_id = pod.org_id
2097: )
2098: AND NOT EXISTS (SELECT 'X'
2099: FROM
2100: ap_invoice_distributions apdist,
2101: po_distributions pod,
2102: mtl_system_items si,
2103: po_lines_all pol
2104: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2123: UPDATE AP_Invoice_Distributions DIST

2119: ELSE -- Accrual BAsed Acctng
2120:
2121: write_log(LOG, 'Marking invoices in Accrual based Acctng');
2122:
2123: UPDATE AP_Invoice_Distributions DIST
2124: SET DIST.Pa_Addition_Flag = 'O',
2125: request_id = G_REQUEST_ID,
2126: last_update_date=SYSDATE,
2127: last_updated_by=G_USER_ID,

Line 2145: ap_invoice_distributions_all dist2

2141: AND EXISTS (
2142: SELECT NULL
2143: FROM ap_invoices_all inv,
2144: po_distributions_all PO,
2145: ap_invoice_distributions_all dist2
2146: WHERE inv.invoice_id = dist2.invoice_id
2147: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
2148: AND dist2.invoice_id = DIST.invoice_id
2149: /*credit card txn enhancement, make sure this update doesn't pick tehm */

Line 2174: ap_invoice_distributions apdist,

2170: AND si.organization_id = pod.org_id
2171: )
2172: AND NOT EXISTS (SELECT 'X'
2173: FROM
2174: ap_invoice_distributions apdist,
2175: po_distributions pod,
2176: mtl_system_items si,
2177: po_lines_all pol
2178: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2204: UPDATE AP_Invoice_Distributions DIST

2200: IF G_ACCTNG_METHOD = 'C' THEN
2201:
2202: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
2203:
2204: UPDATE AP_Invoice_Distributions DIST
2205: SET DIST.Pa_Addition_Flag = 'O',
2206: request_id = G_REQUEST_ID,
2207: last_update_date=SYSDATE,
2208: last_updated_by=G_USER_ID,

Line 2226: ap_invoice_distributions_all dist2

2222: EXISTS (
2223: SELECT NULL
2224: FROM ap_invoices_all inv,
2225: po_distributions_all PO,
2226: ap_invoice_distributions_all dist2
2227: WHERE inv.invoice_id = dist2.invoice_id
2228: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
2229: AND dist2.invoice_id = DIST.invoice_id
2230: AND dist2.invoice_distribution_id = DIST.invoice_distribution_id

Line 2245: ap_invoice_distributions dist3

2241: OR
2242: EXISTS (
2243: SELECT NULL
2244: FROM ap_invoices inv1,
2245: ap_invoice_distributions dist3
2246: WHERE inv1.invoice_id = dist3.invoice_id
2247: AND inv1.invoice_id = dist.invoice_id
2248: AND inv1.invoice_type_lookup_code <> 'EXPENSE REPORT'
2249: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )

Line 2266: ap_invoice_distributions apdist,

2262: AND si.organization_id = pod.org_id
2263: )
2264: AND NOT EXISTS (SELECT 'X'
2265: FROM
2266: ap_invoice_distributions apdist,
2267: po_distributions pod,
2268: mtl_system_items si,
2269: po_lines_all pol
2270: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2291: UPDATE ap_invoice_distributions_all dist

2287: Pre Rel12 Upgrade should also be brought into Projects */
2288:
2289: write_log(LOG, 'Marking Historical Prepayments for processing...');
2290:
2291: UPDATE ap_invoice_distributions_all dist
2292: SET dist.pa_addition_flag = 'O',
2293: request_id = G_REQUEST_ID,
2294: last_update_date=SYSDATE,
2295: last_updated_by= G_USER_ID,

Line 2318: AP_Invoice_Distributions_all aid

2314: AND nvl(INV.source, 'xx' ) NOT IN ('Oracle Project Accounting',
2315: 'PA_IC_INVOICES','PA_COST_ADJUSTMENTS') )
2316: AND exists(SELECT inv.invoice_id
2317: FROM AP_INVOICES_all inv,
2318: AP_Invoice_Distributions_all aid
2319: WHERE aid.invoice_id = inv.invoice_id
2320: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
2321: AND aid.historical_flag = 'Y'
2322: AND aid.pa_addition_flag = 'Y'

Line 2338: ap_invoice_distributions apdist,

2334: AND si.organization_id = pod.org_id
2335: )
2336: AND NOT EXISTS (SELECT 'X'
2337: FROM
2338: ap_invoice_distributions apdist,
2339: po_distributions pod,
2340: mtl_system_items si,
2341: po_lines_all pol
2342: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2362: UPDATE AP_Invoice_Distributions DIST

2358:
2359: -- Update pa-addition-flag to O for all valid ap distributions that should be interfaced to Projects
2360: write_log(LOG, 'Marking invoices in Accrual based Acctng');
2361:
2362: UPDATE AP_Invoice_Distributions DIST
2363: SET DIST.Pa_Addition_Flag = 'O',
2364: request_id = G_REQUEST_ID,
2365: last_update_date=SYSDATE,
2366: last_updated_by=G_USER_ID,

Line 2383: ap_invoice_distributions_all dist2

2379: AND EXISTS (
2380: SELECT NULL
2381: FROM ap_invoices_all inv,
2382: po_distributions_all PO,
2383: ap_invoice_distributions_all dist2
2384: WHERE inv.invoice_id = dist2.invoice_id
2385: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
2386: AND dist2.invoice_id = DIST.invoice_id
2387: /* credit card txn enhancement, make sure this update doesn't pick tehm */

Line 2413: ap_invoice_distributions apdist,

2409: AND si.organization_id = pod.org_id
2410: )
2411: AND NOT EXISTS (SELECT 'X'
2412: FROM
2413: ap_invoice_distributions apdist,
2414: po_distributions pod,
2415: mtl_system_items si,
2416: po_lines_all pol
2417: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2506: FROM ap_invoice_distributions

2502: l_ip_inv_flag VARCHAR2(1):= 'N';
2503:
2504: CURSOR Num_Dist_Marked_O (p_invoice_id IN NUMBER) IS
2505: SELECT count(*)
2506: FROM ap_invoice_distributions
2507: WHERE invoice_id = p_invoice_id
2508: AND pa_addition_flag = 'O';
2509:
2510: l_prev_cr_ccid NUMBER;

Line 2617: UPDATE ap_invoice_distributions_all dist

2613: write_log(LOG,'Before bulk update of prepayment invoices');
2614:
2615: FORALL i IN l_invoice_id_tbl.FIRST..l_invoice_id_tbl.LAST
2616:
2617: UPDATE ap_invoice_distributions_all dist
2618: SET dist.pa_addition_flag = decode(l_insert_flag_tbl(i),'F','G','P','N')
2619: WHERE dist.invoice_id = l_invoice_id_tbl(i)
2620: AND dist.invoice_distribution_id = l_invoice_dist_id_tbl(i)
2621: AND dist.pa_addition_flag = 'O'

Line 3162: FROM ap_invoice_distributions

3158: G_err_stage := 'GET MAX EXPENDITURE ENDING DATE';
3159: write_log(LOG, G_err_stage);
3160: SELECT pa_utils.getweekending(MAX(expenditure_item_date))
3161: INTO G_EXPENDITURE_ENDING_DATE
3162: FROM ap_invoice_distributions
3163: WHERE invoice_id = l_invoice_id_tbl(i);
3164:
3165: G_err_stage := ('Getting bus group id');
3166: write_log(LOG, G_err_stage);

Line 3341: FROM ap_invoice_distributions_all

3337:
3338: IF l_prepay_dist_id_tbl(i) is not null THEN
3339: SELECT nvl(historical_flag,'N')
3340: INTO l_prepay_hist_flag
3341: FROM ap_invoice_distributions_all
3342: WHERE invoice_distribution_id = l_prepay_dist_id_tbl(i);
3343:
3344: ELSIF l_parent_rev_id_tbl(i) is not null THEN --Bug#5444174
3345: SELECT nvl(historical_flag,'N')

Line 3347: FROM ap_invoice_distributions_all

3343:
3344: ELSIF l_parent_rev_id_tbl(i) is not null THEN --Bug#5444174
3345: SELECT nvl(historical_flag,'N')
3346: INTO l_prepay_hist_flag
3347: FROM ap_invoice_distributions_all
3348: WHERE invoice_distribution_id = l_parent_rev_id_tbl(i);
3349: END IF;
3350:
3351: EXCEPTION

Line 3434: FROM ap_invoice_distributions_all

3430: End If;
3431:
3432: SELECT nvl(historical_flag,'N')
3433: INTO l_historical_flag
3434: FROM ap_invoice_distributions_all
3435: WHERE invoice_id = l_invoice_id_tbl(i)
3436: AND invoice_distribution_id = l_parent_rev_id_tbl(i); --check the index on this table
3437:
3438: EXCEPTION

Line 4145: UPDATE ap_invoice_distributions_all dist

4141: write_log(LOG, G_err_stage);
4142:
4143: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
4144:
4145: UPDATE ap_invoice_distributions_all dist
4146: SET dist.pa_addition_flag = l_pa_addflag_tbl(i)
4147: ,dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
4148: WHERE dist.invoice_id = l_sys_ref2_tbl(i)
4149: AND dist.invoice_distribution_id = l_sys_ref5_tbl(i)

Line 4160: from ap_invoice_distributions_all dist

4156: SET historical_flag = 'Y'
4157: WHERE document_header_id = l_sys_ref2_tbl(i)
4158: AND document_distribution_id = l_sys_ref5_tbl(i)
4159: AND exists (select 'exist'
4160: from ap_invoice_distributions_all dist
4161: where dist.invoice_id =l_sys_ref2_tbl(i)
4162: and dist.invoice_distribution_id = l_sys_ref5_tbl(i)
4163: and dist.pa_addition_flag = 'Y'
4164: and dist.historical_flag = 'Y');

Line 4190: AP_Invoice_Distributions_all aid,

4186: WHERE hist.payment_history_id = dist.payment_history_id
4187: AND hist.posted_flag = 'Y')
4188: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
4189: FROM AP_INVOICES_ALL inv,
4190: AP_Invoice_Distributions_all aid,
4191: ap_invoice_payments_all aip
4192: WHERE inv.invoice_id = aip.invoice_id
4193: AND aid.invoice_id = inv.invoice_id
4194: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 4267: PROCEDURE lock_rcv_txn (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS

4263:
4264: END tieback_AP_ER;
4265:
4266:
4267: PROCEDURE lock_rcv_txn (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS
4268:
4269: l_num_rows NUMBER;
4270:
4271: BEGIN

Line 4456: AP_Invoice_Distributions_all aid,

4452: WHERE hist.payment_history_id = dist.payment_history_id
4453: AND hist.posted_flag = 'Y')
4454: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
4455: FROM AP_INVOICES_ALL inv,
4456: AP_Invoice_Distributions_all aid,
4457: ap_invoice_payments_all aip
4458: WHERE inv.invoice_id = aip.invoice_id
4459: AND aid.invoice_id = inv.invoice_id
4460: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 4495: AP_Invoice_Distributions_all aid,

4491: AND hist.posted_flag = 'Y')
4492: AND exists(SELECT/*+ no_unnest */ inv.invoice_id
4493: FROM AP_INVOICES_ALL inv,
4494: PO_Distributions_all PO,
4495: AP_Invoice_Distributions_all aid,
4496: ap_invoice_payments_all aip
4497: WHERE inv.invoice_id = aip.invoice_id
4498: AND aid.invoice_id = inv.invoice_id
4499: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 4552: AP_Invoice_Distributions_all aid,

4548: WHERE hist.payment_history_id = dist.payment_history_id
4549: AND hist.posted_flag = 'Y')
4550: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
4551: FROM AP_INVOICES_ALL inv,
4552: AP_Invoice_Distributions_all aid,
4553: ap_invoice_payments_all aip
4554: WHERE inv.invoice_id = aip.invoice_id
4555: AND aid.invoice_id = inv.invoice_id
4556: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 4587: AP_Invoice_Distributions_all aid,

4583: AND hist.posted_flag = 'Y')
4584: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
4585: FROM AP_INVOICES_ALL inv,
4586: PO_Distributions_all PO,
4587: AP_Invoice_Distributions_all aid,
4588: ap_invoice_payments_all aip
4589: WHERE inv.invoice_id = aip.invoice_id
4590: AND aid.invoice_id = inv.invoice_id
4591: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5167: FROM ap_invoice_distributions

5163: write_log(LOG, G_err_stage);
5164: /* Bug 5051103 - replace expnediture_item_date with l_ei_date_tbl(i) */
5165: SELECT pa_utils.getweekending(MAX(l_ei_date_tbl(i)))
5166: INTO G_EXPENDITURE_ENDING_DATE
5167: FROM ap_invoice_distributions
5168: WHERE invoice_id = l_invoice_id_tbl(i);
5169:
5170: G_err_stage := ('Before getting business group id');
5171: write_log(LOG, G_err_stage);

Line 7374: PROCEDURE lock_ap_invoice (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS

7370: RAISE;
7371:
7372: END check_failed_receipts;
7373:
7374: PROCEDURE lock_ap_invoice (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS
7375:
7376: l_num_rows NUMBER;
7377:
7378: BEGIN

Line 7383: UPDATE ap_invoice_distributions_all dist

7379:
7380: G_err_stage := 'Within calling lock_ap_invoice';
7381: write_log(LOG, G_err_stage);
7382:
7383: UPDATE ap_invoice_distributions_all dist
7384: SET dist.pa_addition_flag = 'L'
7385: WHERE dist.po_distribution_id = p_po_distribution_id
7386: AND dist.pa_addition_flag = 'N';
7387:

Line 7412: UPDATE ap_invoice_distributions_all dist

7408:
7409: G_err_stage := 'Within calling tieback_locked_invoice';
7410: write_log(LOG, G_err_stage);
7411:
7412: UPDATE ap_invoice_distributions_all dist
7413: SET dist.pa_addition_flag = 'N'
7414: WHERE dist.pa_addition_flag = 'L';
7415:
7416: l_num_rows := SQL%ROWCOUNT;

Line 7473: UPDATE ap_invoice_distributions_all apdist

7469: If g_body_debug_mode = 'Y' Then
7470: write_log(LOG, 'Updating empty invoice variance lines pa addtion flag to G for a project');
7471: End if;
7472:
7473: UPDATE ap_invoice_distributions_all apdist
7474: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
7475: request_id = G_REQUEST_ID,
7476: last_update_date=SYSDATE,
7477: last_updated_by=G_USER_ID,

Line 7484: FROM ap_invoices inv, ap_invoice_distributions_all dist

7480: program_application_id= G_PROG_APPL_ID,
7481: program_update_date=SYSDATE
7482: WHERE rowid IN (
7483: SELECT dist.rowid
7484: FROM ap_invoices inv, ap_invoice_distributions_all dist
7485: WHERE inv.invoice_id = dist.invoice_id
7486: AND (dist.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
7487: OR ( pa_nl_installed.is_nl_installed = 'Y' --EIB trackable items
7488: AND EXISTS (SELECT 'X'

Line 7501: FROM ap_invoice_distributions_all apdist2

7497: AND si.organization_id = po_dist1.org_id)
7498: )
7499: ) --Bug#5399352. Added this here to take care of IPV/TIPV records matched to EIB item PO.
7500: AND NOT EXISTS (SELECT NULL
7501: FROM ap_invoice_distributions_all apdist2
7502: WHERE apdist2.pa_addition_flag = 'Y'
7503: AND apdist2.po_distribution_id = dist.po_distribution_id
7504: AND apdist2.line_type_lookup_code = dist.line_type_lookup_code
7505: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')

Line 7508: FROM ap_invoice_distributions_all apdist1

7504: AND apdist2.line_type_lookup_code = dist.line_type_lookup_code
7505: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
7506: )
7507: AND ( EXISTS (SELECT NULL
7508: FROM ap_invoice_distributions_all apdist1
7509: WHERE apdist1.pa_addition_flag IN ('F', 'G')
7510: AND apdist1.po_distribution_id = dist.po_distribution_id
7511: )
7512: OR EXISTS ( SELECT rcv_txn.po_distribution_id

Line 7549: UPDATE ap_invoice_distributions_all apdist

7545: pulled from Payables. The pa_addition_flag for such invoice ITEM distribution lines is updated to G to prevent
7546: further processing into Projects.
7547: However, if there is an amount variance on such invoice, it needs to be processed as W to releive variance commitment */
7548:
7549: UPDATE ap_invoice_distributions_all apdist
7550: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
7551: request_id = G_REQUEST_ID,
7552: last_update_date=SYSDATE,
7553: last_updated_by=G_USER_ID,

Line 7562: ap_invoice_distributions_all dist

7558: WHERE rowid in (
7559: SELECT dist.rowid
7560: FROM ap_invoices inv,
7561: po_distributions po,
7562: ap_invoice_distributions_all dist
7563: WHERE inv.invoice_id = dist.invoice_id
7564: AND po.po_distribution_id = dist.po_distribution_id
7565: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT' -- bug 7192304, added nvl
7566: AND NVL(po.destination_type_code, 'EXPENSE') = 'EXPENSE'

Line 7603: UPDATE ap_invoice_distributions_all apdist

7599: If g_body_debug_mode = 'Y' Then
7600: write_log(LOG, 'Updating empty invoice variance lines pa addtion flag to G for all');
7601: End if;
7602:
7603: UPDATE ap_invoice_distributions_all apdist
7604: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
7605: request_id = G_REQUEST_ID,
7606: last_update_date=SYSDATE,
7607: last_updated_by=G_USER_ID,

Line 7614: FROM ap_invoices inv, ap_invoice_distributions_all dist

7610: program_application_id= G_PROG_APPL_ID,
7611: program_update_date=SYSDATE
7612: WHERE rowid IN (
7613: SELECT dist.rowid
7614: FROM ap_invoices inv, ap_invoice_distributions_all dist
7615: WHERE inv.invoice_id = dist.invoice_id
7616: AND ( dist.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
7617: OR ( pa_nl_installed.is_nl_installed = 'Y' --EIB trackable items
7618: AND EXISTS (SELECT 'X'

Line 7631: FROM ap_invoice_distributions_all apdist2

7627: AND si.organization_id = po_dist1.org_id)
7628: )
7629: ) --Bug#5399352. Added this here to take care of IPV/TIPV records matched to EIB item PO.
7630: AND NOT EXISTS (SELECT NULL
7631: FROM ap_invoice_distributions_all apdist2
7632: WHERE apdist2.pa_addition_flag = 'Y'
7633: AND apdist2.po_distribution_id = dist.po_distribution_id
7634: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
7635: )

Line 7637: FROM ap_invoice_distributions_all apdist1

7633: AND apdist2.po_distribution_id = dist.po_distribution_id
7634: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
7635: )
7636: AND ( EXISTS (SELECT NULL
7637: FROM ap_invoice_distributions_all apdist1
7638: WHERE apdist1.pa_addition_flag IN ('F', 'G')
7639: AND apdist1.po_distribution_id = dist.po_distribution_id
7640: )
7641: OR EXISTS ( SELECT rcv_txn.po_distribution_id

Line 7678: UPDATE ap_invoice_distributions_all apdist

7674: pulled from Payables. The pa_addition_flag for such invoice ITEM distribution lines is updated to G to prevent
7675: further processing into Projects.
7676: However, if there is an amount variance on such invoice, it needs to be processed as W to releive variance commitment */
7677:
7678: UPDATE ap_invoice_distributions_all apdist
7679: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
7680: request_id = G_REQUEST_ID,
7681: last_update_date=SYSDATE,
7682: last_updated_by=G_USER_ID,

Line 7691: ap_invoice_distributions_all dist

7687: WHERE rowid in (
7688: SELECT dist.rowid
7689: FROM ap_invoices inv,
7690: po_distributions po,
7691: ap_invoice_distributions_all dist
7692: WHERE inv.invoice_id = dist.invoice_id
7693: AND po.po_distribution_id = dist.po_distribution_id
7694: AND NVL(po.destination_type_code, 'EXPENSE') = 'EXPENSE'
7695: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT' -- bug 7192304, added nvl

Line 8169: FROM ap_invoice_distributions

8165: G_err_stage := 'GET MAX EXPENDITURE ENDING DATE';
8166: write_log(LOG, G_err_stage);
8167: SELECT pa_utils.getweekending(MAX(expenditure_item_date))
8168: INTO G_EXPENDITURE_ENDING_DATE
8169: FROM ap_invoice_distributions
8170: WHERE invoice_id = l_invoice_id_tbl(i);
8171:
8172: If g_body_debug_mode = 'Y' Then
8173: G_err_stage := ('Getting bus group id');

Line 8265: FROM ap_invoice_distributions_all

8261: BEGIN
8262:
8263: SELECT nvl(historical_flag,'N') --check if this flag can be used
8264: INTO l_historical_flag
8265: FROM ap_invoice_distributions_all
8266: WHERE invoice_id = l_invoice_id_tbl(i)
8267: AND invoice_distribution_id = l_parent_rev_id_tbl(i); --check the index on this table
8268:
8269: EXCEPTION

Line 8620: UPDATE ap_invoice_distributions_all dist

8616: write_log(LOG, G_err_stage);
8617:
8618: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
8619:
8620: UPDATE ap_invoice_distributions_all dist
8621: SET dist.pa_addition_flag = l_pa_addflag_tbl(i)
8622: ,dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
8623: WHERE dist.invoice_id = l_sys_ref2_tbl(i)
8624: AND dist.invoice_distribution_id = l_sys_ref5_tbl(i)

Line 8739: FROM AP_invoice_distributions aid

8735: FROM ap_payment_history_all hist
8736: WHERE hist.payment_history_id = dist.payment_history_id
8737: AND hist.posted_flag = 'Y')
8738: AND EXISTS (SELECT invoice_id
8739: FROM AP_invoice_distributions aid
8740: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
8741: AND aid.project_id = G_PROJECT_ID
8742: AND ( nvl(aid.encumbered_flag,'N') = 'R' )) ;
8743:

Line 8772: FROM AP_invoice_distributions aid

8768: FROM ap_payment_history_all hist
8769: WHERE hist.payment_history_id = dist.payment_history_id
8770: AND hist.posted_flag = 'Y')
8771: AND EXISTS (SELECT aid.invoice_id
8772: FROM AP_invoice_distributions aid
8773: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
8774: AND aid.project_id > 0
8775: AND nvl(aid.encumbered_flag,'N') = 'R' ) ;
8776:

Line 8811: FROM AP_invoice_distributions aid

8807: FROM ap_payment_history_all hist
8808: WHERE hist.payment_history_id = dist.payment_history_id
8809: AND hist.posted_flag = 'Y')
8810: AND EXISTS (SELECT aid.invoice_id
8811: FROM AP_invoice_distributions aid
8812: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
8813: AND aid.project_id = G_PROJECT_ID
8814: AND ( nvl(aid.encumbered_flag,'N') = 'R' )) ;
8815:

Line 8843: FROM AP_invoice_distributions aid

8839: FROM ap_payment_history_all hist
8840: WHERE hist.payment_history_id = dist.payment_history_id
8841: AND hist.posted_flag = 'Y')
8842: AND EXISTS (SELECT aid.invoice_id
8843: FROM AP_invoice_distributions aid
8844: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
8845: AND aid.project_id > 0
8846: AND ( nvl(aid.encumbered_flag,'N') = 'R' )) ;
8847:

Line 8915: AP_Invoice_Distributions_all aid,

8911: AND hist.posted_flag = 'Y')
8912: AND exists (SELECT inv.invoice_id
8913: FROM AP_INVOICES inv,
8914: PO_VENDORS vend,
8915: AP_Invoice_Distributions_all aid,
8916: ap_invoice_payments_all aip
8917: WHERE inv.invoice_id = aid.invoice_id
8918: AND inv.vendor_id = vend.vendor_id
8919: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 8956: AP_Invoice_Distributions_all aid, --STD INV DIST LINE

8952: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
8953: FROM AP_INVOICES_ALL inv,
8954: PO_VENDORS vend,
8955: PO_Distributions_all PO,
8956: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
8957: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
8958: WHERE aid.invoice_id = inv.invoice_id
8959: AND inv.vendor_id = vend.vendor_id
8960: AND inv.org_id = G_ORG_ID

Line 8957: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

8953: FROM AP_INVOICES_ALL inv,
8954: PO_VENDORS vend,
8955: PO_Distributions_all PO,
8956: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
8957: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
8958: WHERE aid.invoice_id = inv.invoice_id
8959: AND inv.vendor_id = vend.vendor_id
8960: AND inv.org_id = G_ORG_ID
8961: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 9005: AP_Invoice_Distributions_all aid,

9001: AND hist.posted_flag = 'Y')
9002: AND exists (SELECT inv.invoice_id
9003: FROM AP_INVOICES_ALL inv,
9004: PO_VENDORS vend,
9005: AP_Invoice_Distributions_all aid,
9006: ap_invoice_payments_all aip
9007: WHERE inv.vendor_id = vend.vendor_id
9008: AND aid.invoice_id = inv.invoice_id
9009: AND inv.org_id = G_ORG_ID

Line 9047: AP_Invoice_Distributions_all aid, --STD INV DIST LINE

9043: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9044: FROM AP_INVOICES_ALL inv,
9045: PO_VENDORS vend,
9046: PO_Distributions_all PO,
9047: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9048: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9049: WHERE aid.invoice_id = inv.invoice_id
9050: AND inv.vendor_id = vend.vendor_id
9051: AND inv.org_id = G_ORG_ID

Line 9048: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

9044: FROM AP_INVOICES_ALL inv,
9045: PO_VENDORS vend,
9046: PO_Distributions_all PO,
9047: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9048: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9049: WHERE aid.invoice_id = inv.invoice_id
9050: AND inv.vendor_id = vend.vendor_id
9051: AND inv.org_id = G_ORG_ID
9052: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 9110: AP_Invoice_Distributions_all aid,

9106: AND hist.posted_flag = 'Y')
9107: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9108: FROM AP_INVOICES_ALL inv,
9109: PO_Distributions_all PO,
9110: AP_Invoice_Distributions_all aid,
9111: ap_invoice_payments_all aip
9112: WHERE inv.invoice_id = aip.invoice_id
9113: AND aid.invoice_id = inv.invoice_id
9114: AND inv.org_id = G_ORG_ID

Line 9157: AP_Invoice_Distributions_all aid, --STD INV DIST LINE

9153: AND dist.amount <> 0
9154: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9155: FROM AP_INVOICES_ALL inv,
9156: PO_Distributions_all PO,
9157: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9158: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9159: WHERE aid.invoice_id = inv.invoice_id
9160: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
9161: AND inv.org_id = G_ORG_ID

Line 9158: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

9154: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9155: FROM AP_INVOICES_ALL inv,
9156: PO_Distributions_all PO,
9157: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9158: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9159: WHERE aid.invoice_id = inv.invoice_id
9160: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
9161: AND inv.org_id = G_ORG_ID
9162: AND aid2.invoice_id = aid.invoice_id

Line 9212: AP_Invoice_Distributions_all aid,

9208: AND hist.posted_flag = 'Y')
9209: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9210: FROM AP_INVOICES_ALL inv,
9211: PO_Distributions_all PO,
9212: AP_Invoice_Distributions_all aid,
9213: ap_invoice_payments_all aip
9214: WHERE inv.invoice_id = aip.invoice_id
9215: AND aid.invoice_id = inv.invoice_id
9216: AND inv.org_id = G_ORG_ID

Line 9259: AP_Invoice_Distributions_all aid, --STD INV DIST LINE

9255: AND dist.amount <> 0
9256: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9257: FROM AP_INVOICES_ALL inv,
9258: PO_Distributions_all PO,
9259: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9260: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9261: WHERE aid.invoice_id = inv.invoice_id
9262: AND inv.org_id = G_ORG_ID
9263: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 9260: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

9256: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
9257: FROM AP_INVOICES_ALL inv,
9258: PO_Distributions_all PO,
9259: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
9260: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
9261: WHERE aid.invoice_id = inv.invoice_id
9262: AND inv.org_id = G_ORG_ID
9263: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
9264: AND aid2.invoice_id = aid.invoice_id

Line 9948: FROM ap_invoice_distributions

9944: write_log(LOG, G_err_stage);
9945: /* Bug 5051103 - replace expnediture_item_date with l_ei_date_tbl(i) */
9946: SELECT pa_utils.getweekending(MAX(l_ei_date_tbl(i)))
9947: INTO G_EXPENDITURE_ENDING_DATE
9948: FROM ap_invoice_distributions
9949: WHERE invoice_id = l_invoice_id_tbl(i);
9950:
9951: G_err_stage := ('Getting bus group id');
9952: write_log(LOG, G_err_stage);

Line 10932: UPDATE ap_invoice_distributions_all dist

10928:
10929: IF l_batch <> 'APDISC' THEN --Payment Discount batch
10930:
10931: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
10932: UPDATE ap_invoice_distributions_all dist
10933: SET dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
10934: WHERE dist.invoice_distribution_id = l_sys_ref5_tbl(i) ;
10935: END IF;
10936:

Line 11363: FROM ap_invoice_distributions apdist

11359: AND rcv_txn2.po_distribution_id = P_Po_Distribution_Id
11360: AND rcv_sub2.pa_addition_flag = 'G'
11361: UNION ALL
11362: SELECT null
11363: FROM ap_invoice_distributions apdist
11364: WHERE apdist.po_distribution_id = P_Po_Distribution_Id
11365: AND apdist.line_type_lookup_code in ('ITEM','ACCRUAL','NONREC_TAX')
11366: AND apdist.pa_addition_flag = 'Y');
11367: