DBA Data[Home] [Help]

APPS.PAAPIMP_PKG dependencies on AP_INVOICE_DISTRIBUTIONS

Line 885: UPDATE ap_invoice_distributions_all DIST

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

Line 1101: p_invoice_distribution_id IN ap_invoice_distributions.invoice_distribution_id%TYPE)

1097:
1098: FUNCTION create_new_org_transref (
1099: p_batch_name IN pa_transaction_interface.batch_name%TYPE,
1100: p_invoice_id IN ap_invoices.invoice_id%TYPE,
1101: p_invoice_distribution_id IN ap_invoice_distributions.invoice_distribution_id%TYPE)
1102: RETURN pa_transaction_interface.orig_transaction_reference%TYPE IS
1103:
1104: BEGIN
1105:

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

1351: G_err_stage := 'Updating the expense reports to Z for project ';
1352: write_log(LOG, G_err_stage);
1353: End If;
1354: /* Modified the hint on following update statement for bug 6920705 */
1355: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist
1356: SET dist.pa_addition_flag = 'Z',
1357: request_id = G_REQUEST_ID,
1358: last_update_date = SYSDATE, --bug 3905111
1359: last_updated_by = G_USER_ID,

Line 1385: FROM ap_invoice_distributions dist1

1381: AND inv.invoice_type_lookup_code = 'EXPENSE REPORT')
1382: AND ( --( nvl(dist.encumbered_flag,'N') = 'R' ) OR /* Coomented for bug#13940879 */
1383: (dist.line_type_lookup_code ='NONREC_TAX' AND nvl(dist.base_amount,dist.amount)=0)) /*Added for bug:7622893*/
1384: AND NOT EXISTS (SELECT NULL
1385: FROM ap_invoice_distributions dist1
1386: WHERE dist.parent_reversal_id is not null
1387: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1388: AND dist1.pa_addition_flag = 'T'
1389: AND dist1.encumbered_flag = 'R'

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

1445: write_log(LOG, G_err_stage);
1446: End If;
1447:
1448:
1449: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/
1450: SET dist.pa_addition_flag = 'Z',
1451: request_id = G_REQUEST_ID,
1452: last_update_date = SYSDATE, --bug 3905111
1453: last_updated_by = G_USER_ID,

Line 1486: FROM ap_invoice_distributions dist1

1482: AND inv.invoice_type_lookup_code = 'EXPENSE REPORT')
1483: AND ( --( nvl(dist.encumbered_flag,'N') = 'R' ) OR /* Commented for bug#13940879 */
1484: (dist.line_type_lookup_code ='NONREC_TAX' AND nvl(dist.base_amount,dist.amount)=0)) /*Added for bug:7622893*/
1485: AND NOT EXISTS (SELECT NULL
1486: FROM ap_invoice_distributions dist1
1487: WHERE dist.parent_reversal_id is not null
1488: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1489: AND dist1.pa_addition_flag = 'T'
1490: AND dist1.encumbered_flag = 'R'

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

1568: G_err_stage := 'Updating invoice distributions to Z for project';
1569: write_log(LOG, G_err_stage);
1570: End If;
1571: /* Modified the hint on following update statement for bug 6920705 */
1572: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14) */ ap_invoice_distributions dist
1573: SET dist.pa_addition_flag = 'Z',
1574: request_id = G_REQUEST_ID,
1575: last_update_date=SYSDATE, --bug 3905111
1576: last_updated_by= G_USER_ID,

Line 1597: FROM ap_invoice_distributions dist1

1593: (dist.line_type_lookup_code ='NONREC_TAX' AND nvl(dist.base_amount,dist.amount)=0)) /*Added for bug:7622893*/
1594: --Update historical data for Cash Based Acctng
1595: AND (G_ACCTNG_METHOD = 'A' OR (G_ACCTNG_METHOD = 'C' AND dist.historical_flag = 'Y'))
1596: AND NOT EXISTS (SELECT NULL
1597: FROM ap_invoice_distributions dist1
1598: WHERE dist.parent_reversal_id is not null
1599: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1600: AND dist1.pa_addition_flag = 'T'
1601: AND dist1.encumbered_flag = 'R'

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

1665: G_err_stage := 'Updating invoice distributions to Z for all';
1666: write_log(LOG, G_err_stage);
1667: End If;
1668:
1669: UPDATE /*+ index(dist AP_INVOICE_DISTRIBUTIONS_N14)*/ ap_invoice_distributions dist /*Added for bug 6327185*/
1670: SET dist.pa_addition_flag = 'Z',
1671: request_id = G_REQUEST_ID,
1672: last_update_date = SYSDATE, --bug 3905111
1673: last_updated_by = G_USER_ID,

Line 1701: FROM ap_invoice_distributions dist1

1697: (dist.line_type_lookup_code ='NONREC_TAX' AND nvl(dist.base_amount,dist.amount)=0)) /*Added for bug:7622893*/
1698: --Update historical data for Cash Based Acctng
1699: AND (G_ACCTNG_METHOD = 'A' OR (G_ACCTNG_METHOD = 'C' AND dist.historical_flag = 'Y'))
1700: AND NOT EXISTS (SELECT NULL
1701: FROM ap_invoice_distributions dist1
1702: WHERE dist.parent_reversal_id is not null
1703: AND dist.parent_reversal_id = dist1.invoice_distribution_id
1704: AND dist1.pa_addition_flag = 'T'
1705: AND dist1.encumbered_flag = 'R'

Line 1792: FROM ap_invoice_distributions_All

1788:
1789: If is_self_assessed_tax = 'N' then
1790: SELECT prepay_amount_remaining
1791: INTO l_prepay_rem_amt
1792: FROM ap_invoice_distributions_All
1793: WHERE invoice_distribution_id = p_prepay_dist_id;
1794: else
1795: SELECT prepay_amount_remaining
1796: INTO l_prepay_rem_amt

Line 1864: UPDATE AP_Invoice_distributions DIST

1860: IF G_ACCTNG_METHOD = 'C' THEN --CAsh BAsed Accounting
1861:
1862: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
1863: --code changes for bug 14769043
1864: UPDATE AP_Invoice_distributions DIST
1865: SET DIST.Pa_Addition_Flag ='O',
1866: request_id = G_REQUEST_ID,
1867: last_update_date=SYSDATE,
1868: last_updated_by=G_USER_ID,

Line 1881: AP_Invoice_distributions DIST1,

1877: AND dist.line_type_lookup_code <> 'REC_TAX' -- do not proces recoverable tax
1878: AND ((
1879: exists (SELECT NULL
1880: FROM AP_INVOICES inv,
1881: AP_Invoice_distributions DIST1,
1882: PO_VENDORS vend
1883: WHERE inv.invoice_id = DIST1.invoice_id
1884: AND DIST1.invoice_distribution_id = DIST.invoice_distribution_id
1885: AND INV.payment_status_flag = 'Y' -- Flag indicated FULLY paid inv

Line 1908: ap_invoice_distributions dist2

1904: OR
1905: (EXISTS ( SELECT NULL
1906: FROM PO_VENDORS vend1,
1907: ap_invoices inv1,
1908: ap_invoice_distributions dist2
1909: WHERE inv1.invoice_id = dist2.invoice_id
1910: AND inv1.invoice_id = dist.invoice_id
1911: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )
1912: AND dist2.invoice_distribution_id = dist.parent_reversal_id --Process Historical data reversals as Invoices in Cash based

Line 2023: UPDATE ap_invoice_distributions_all dist

2019: Pre Rel12 Upgrade should also be brought into Projects */
2020:
2021: write_log(LOG, 'Marking Historical Prepayments for processing...');
2022:
2023: UPDATE ap_invoice_distributions_all dist
2024: SET dist.pa_addition_flag = 'O',
2025: request_id = G_REQUEST_ID,
2026: last_update_date=SYSDATE,
2027: last_updated_by= G_USER_ID,

Line 2064: AP_Invoice_Distributions_all aid

2060: and PTYPE.SYSTEM_PERSON_TYPE in ('OTHER','CWK')))
2061: ))
2062: AND exists(SELECT inv.invoice_id
2063: FROM AP_INVOICES inv,
2064: AP_Invoice_Distributions_all aid
2065: WHERE aid.invoice_id = inv.invoice_id
2066: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
2067: AND aid.historical_flag = 'Y'
2068: AND aid.pa_addition_flag = 'Y'

Line 2131: UPDATE AP_Invoice_distributions DIST

2127: ELSE --Accounting Method is Accrual
2128:
2129: write_log(LOG, 'Marking Expense Report type invoices for processing - Accrual Acct');
2130:
2131: UPDATE AP_Invoice_distributions DIST
2132: SET DIST.Pa_Addition_Flag ='O',
2133: request_id = G_REQUEST_ID,
2134: last_update_date=SYSDATE,
2135: last_updated_by=G_USER_ID,

Line 2226: UPDATE AP_Invoice_distributions DIST

2222: IF G_ACCTNG_METHOD = 'C' THEN
2223:
2224: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
2225:
2226: UPDATE AP_Invoice_distributions DIST
2227: SET DIST.Pa_Addition_Flag ='O',
2228: request_id = G_REQUEST_ID,
2229: last_update_date=SYSDATE,
2230: last_updated_by=G_USER_ID,

Line 2243: AP_Invoice_distributions DIST1,

2239: AND dist.line_type_lookup_code <> 'REC_TAX' -- do not proces recoverable tax
2240: AND (
2241: (exists (SELECT NULL
2242: FROM AP_INVOICES inv,
2243: AP_Invoice_distributions DIST1,
2244: PO_VENDORS vend
2245: WHERE inv.invoice_id = DIST1.invoice_id
2246: AND DIST1.invoice_distribution_id = DIST.invoice_distribution_id
2247: AND INV.payment_status_flag = 'Y' -- Flag indicated FULLY paid inv

Line 2269: ap_invoices inv1, ap_invoice_distributions dist2

2265: )))
2266: OR
2267: (EXISTS ( SELECT NULL
2268: FROM PO_VENDORS vend1,
2269: ap_invoices inv1, ap_invoice_distributions dist2
2270: WHERE inv1.invoice_id = dist2.invoice_id
2271: AND inv1.invoice_id = dist.invoice_id
2272: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )
2273: AND dist2.invoice_distribution_id = dist.parent_reversal_id --Process Historical data reversals as Invoices in Cash based

Line 2344: ap_invoices inv1, ap_invoice_distributions dist2

2340: )))
2341: OR
2342: (EXISTS ( SELECT NULL
2343: FROM PO_VENDORS vend1,
2344: ap_invoices inv1, ap_invoice_distributions dist2
2345: WHERE inv1.invoice_id = dist2.invoice_id
2346: AND inv1.invoice_id = dist.invoice_id
2347: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )
2348: AND dist2.invoice_distribution_id = dist.parent_reversal_id --Process Historical data reversals as Invoices in Cash based

Line 2380: UPDATE ap_invoice_distributions dist

2376: Pre Rel12 Upgrade should also be brought into Projects */
2377:
2378: write_log(LOG, 'Marking Historical Prepayments for processing...');
2379:
2380: UPDATE ap_invoice_distributions dist
2381: SET dist.pa_addition_flag = 'O',
2382: request_id = G_REQUEST_ID,
2383: last_update_date=SYSDATE,
2384: last_updated_by= G_USER_ID,

Line 2420: AP_Invoice_Distributions_all aid

2416: and PTYPE.SYSTEM_PERSON_TYPE in ('OTHER','CWK')))
2417: ))
2418: AND exists(SELECT inv.invoice_id
2419: FROM AP_INVOICES_ALL inv,
2420: AP_Invoice_Distributions_all aid
2421: WHERE aid.invoice_id = inv.invoice_id
2422: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
2423: AND aid.historical_flag = 'Y'
2424: AND aid.pa_addition_flag = 'Y'

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

2482: ELSE --Accounting Method is Accrual
2483:
2484: write_log(LOG, 'Marking Expense Report type invoices for processing - Accrual Acct');
2485:
2486: UPDATE /*+ index(DIST AP_INVOICE_DISTRIBUTIONS_N14)*/ AP_Invoice_distributions DIST /*Added for bug 6327185*/
2487: SET DIST.Pa_Addition_Flag ='O', /*Bug#2168903*/
2488: request_id = G_REQUEST_ID,
2489: last_update_date=SYSDATE, --bug 3905111
2490: last_updated_by=G_USER_ID,

Line 2600: UPDATE AP_Invoice_Distributions DIST

2596: IF G_ACCTNG_METHOD = 'C' THEN
2597:
2598: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
2599:
2600: UPDATE AP_Invoice_Distributions DIST
2601: SET DIST.Pa_Addition_Flag = 'O',
2602: request_id = G_REQUEST_ID,
2603: last_update_date=SYSDATE,
2604: last_updated_by=G_USER_ID,

Line 2622: ap_invoice_distributions_all dist2

2618: EXISTS (
2619: SELECT NULL
2620: FROM ap_invoices_all inv,
2621: po_distributions_all PO,
2622: ap_invoice_distributions_all dist2
2623: WHERE inv.invoice_id = dist2.invoice_id
2624: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
2625: AND dist2.invoice_id = DIST.invoice_id
2626: AND dist2.invoice_distribution_id = DIST.invoice_distribution_id

Line 2643: ap_invoice_distributions_all dist3

2639: OR
2640: EXISTS (
2641: SELECT NULL
2642: FROM ap_invoices_all inv1,
2643: ap_invoice_distributions_all dist3
2644: WHERE inv1.invoice_id = dist3.invoice_id
2645: AND inv1.invoice_id = dist.invoice_id
2646: AND inv1.invoice_type_lookup_code <> 'EXPENSE REPORT'
2647: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )

Line 2669: ap_invoice_distributions apdist,

2665: )
2666: )
2667: AND NOT EXISTS (SELECT 'X'
2668: FROM
2669: ap_invoice_distributions apdist,
2670: po_distributions pod,
2671: mtl_system_items si,
2672: po_lines_all pol
2673: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2707: UPDATE ap_invoice_distributions_all dist

2703: Pre Rel12 Upgrade should also be brought into Projects */
2704:
2705: write_log(LOG, 'Marking PREPAYMENT invoices in Cash Based Acctng');
2706:
2707: UPDATE ap_invoice_distributions_all dist
2708: SET dist.pa_addition_flag = 'O',
2709: request_id = G_REQUEST_ID,
2710: last_update_date=SYSDATE,
2711: last_updated_by= G_USER_ID,

Line 2736: AP_Invoice_Distributions_all aid

2732: AND nvl(INV.source, 'xx' ) NOT IN (
2733: 'PA_IC_INVOICES','PA_COST_ADJUSTMENTS') ) /* Removed 'Oracle Project Accounting' */
2734: AND exists(SELECT inv.invoice_id
2735: FROM AP_INVOICES inv,
2736: AP_Invoice_Distributions_all aid
2737: WHERE aid.invoice_id = inv.invoice_id
2738: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
2739: AND aid.historical_flag = 'Y'
2740: AND aid.pa_addition_flag = 'Y'

Line 2761: ap_invoice_distributions apdist,

2757: )
2758: )
2759: AND NOT EXISTS (SELECT 'X'
2760: FROM
2761: ap_invoice_distributions apdist,
2762: po_distributions pod,
2763: mtl_system_items si,
2764: po_lines_all pol
2765: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 2872: UPDATE AP_Invoice_Distributions DIST

2868: ELSE -- Accrual BAsed Acctng
2869:
2870: write_log(LOG, 'Marking invoices in Accrual based Acctng');
2871:
2872: UPDATE AP_Invoice_Distributions DIST
2873: SET DIST.Pa_Addition_Flag = 'O',
2874: request_id = G_REQUEST_ID,
2875: last_update_date=SYSDATE,
2876: last_updated_by=G_USER_ID,

Line 2894: ap_invoice_distributions_all dist2

2890: AND EXISTS (
2891: SELECT NULL
2892: FROM ap_invoices_all inv,
2893: po_distributions_all PO,
2894: ap_invoice_distributions_all dist2
2895: WHERE inv.invoice_id = dist2.invoice_id
2896: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
2897: AND dist2.invoice_id = DIST.invoice_id
2898: /*credit card txn enhancement, make sure this update doesn't pick tehm */

Line 2929: ap_invoice_distributions apdist,

2925: )
2926: )
2927: AND NOT EXISTS (SELECT 'X'
2928: FROM
2929: ap_invoice_distributions apdist,
2930: po_distributions pod,
2931: mtl_system_items si,
2932: po_lines_all pol
2933: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 3045: UPDATE AP_Invoice_Distributions DIST

3041: IF G_ACCTNG_METHOD = 'C' THEN
3042:
3043: write_log(LOG, 'Marking invoices to O for Historical Data interface in Cash Based Acctng');
3044:
3045: UPDATE AP_Invoice_Distributions DIST
3046: SET DIST.Pa_Addition_Flag = 'O',
3047: request_id = G_REQUEST_ID,
3048: last_update_date=SYSDATE,
3049: last_updated_by=G_USER_ID,

Line 3067: ap_invoice_distributions_all dist2

3063: EXISTS (
3064: SELECT NULL
3065: FROM ap_invoices_all inv,
3066: po_distributions_all PO,
3067: ap_invoice_distributions_all dist2
3068: WHERE inv.invoice_id = dist2.invoice_id
3069: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
3070: AND dist2.invoice_id = DIST.invoice_id
3071: AND dist2.invoice_distribution_id = DIST.invoice_distribution_id

Line 3087: ap_invoice_distributions dist3

3083: OR
3084: EXISTS (
3085: SELECT NULL
3086: FROM ap_invoices inv1,
3087: ap_invoice_distributions dist3
3088: WHERE inv1.invoice_id = dist3.invoice_id
3089: AND inv1.invoice_id = dist.invoice_id
3090: AND inv1.invoice_type_lookup_code <> 'EXPENSE REPORT'
3091: AND (dist.reversal_flag = 'Y' or dist.cancellation_flag = 'Y' )

Line 3113: ap_invoice_distributions apdist,

3109: )
3110: )
3111: AND NOT EXISTS (SELECT 'X'
3112: FROM
3113: ap_invoice_distributions apdist,
3114: po_distributions pod,
3115: mtl_system_items si,
3116: po_lines_all pol
3117: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 3151: UPDATE ap_invoice_distributions_all dist

3147: Pre Rel12 Upgrade should also be brought into Projects */
3148:
3149: write_log(LOG, 'Marking Historical Prepayments for processing...');
3150:
3151: UPDATE ap_invoice_distributions_all dist
3152: SET dist.pa_addition_flag = 'O',
3153: request_id = G_REQUEST_ID,
3154: last_update_date=SYSDATE,
3155: last_updated_by= G_USER_ID,

Line 3179: AP_Invoice_Distributions_all aid

3175: AND nvl(INV.source, 'xx' ) NOT IN (
3176: 'PA_IC_INVOICES','PA_COST_ADJUSTMENTS') ) /* Removed 'Oracle Project Accounting' */
3177: AND exists(SELECT inv.invoice_id
3178: FROM AP_INVOICES_all inv,
3179: AP_Invoice_Distributions_all aid
3180: WHERE aid.invoice_id = inv.invoice_id
3181: AND inv.invoice_type_lookup_code = 'PREPAYMENT'
3182: AND aid.historical_flag = 'Y'
3183: AND aid.pa_addition_flag = 'Y'

Line 3204: ap_invoice_distributions apdist,

3200: )
3201: )
3202: AND NOT EXISTS (SELECT 'X'
3203: FROM
3204: ap_invoice_distributions apdist,
3205: po_distributions pod,
3206: mtl_system_items si,
3207: po_lines_all pol
3208: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 3314: UPDATE /*+ index(DIST AP_INVOICE_DISTRIBUTIONS_N14) */ AP_Invoice_Distributions DIST

3310:
3311: -- Update pa-addition-flag to O for all valid ap distributions that should be interfaced to Projects
3312: write_log(LOG, 'Marking invoices in Accrual based Acctng');
3313: --bug 14489723
3314: UPDATE /*+ index(DIST AP_INVOICE_DISTRIBUTIONS_N14) */ AP_Invoice_Distributions DIST
3315: SET DIST.Pa_Addition_Flag = 'O',
3316: request_id = G_REQUEST_ID,
3317: last_update_date=SYSDATE,
3318: last_updated_by=G_USER_ID,

Line 3335: ap_invoice_distributions_all dist2

3331: AND EXISTS (
3332: SELECT NULL
3333: FROM ap_invoices_all inv,
3334: po_distributions_all PO,
3335: ap_invoice_distributions_all dist2
3336: WHERE inv.invoice_id = dist2.invoice_id
3337: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT'
3338: AND dist2.invoice_id = DIST.invoice_id
3339: /* credit card txn enhancement, make sure this update doesn't pick tehm */

Line 3372: ap_invoice_distributions apdist,

3368: )
3369: )
3370: AND NOT EXISTS (SELECT 'X'
3371: FROM
3372: ap_invoice_distributions apdist,
3373: po_distributions pod,
3374: mtl_system_items si,
3375: po_lines_all pol
3376: where DIST.CHARGE_APPLICABLE_TO_DIST_ID

Line 3550: FROM ap_invoice_distributions

3546: CURSOR Num_Dist_Marked_O (p_invoice_id IN NUMBER) IS
3547: SELECT count(*) from
3548: (
3549: select 1
3550: FROM ap_invoice_distributions
3551: WHERE invoice_id = p_invoice_id
3552: AND pa_addition_flag = 'O'
3553: union
3554: select 1

Line 3669: UPDATE ap_invoice_distributions_all dist

3665: write_log(LOG,'Before bulk update of prepayment invoices');
3666:
3667: FORALL i IN l_invoice_id_tbl.FIRST..l_invoice_id_tbl.LAST
3668:
3669: UPDATE ap_invoice_distributions_all dist
3670: SET dist.pa_addition_flag = decode(l_insert_flag_tbl(i),'F','G','P','N')
3671: WHERE dist.invoice_id = l_invoice_id_tbl(i)
3672: AND dist.invoice_distribution_id = l_invoice_dist_id_tbl(i)
3673: AND dist.pa_addition_flag = 'O'

Line 4264: FROM ap_invoice_distributions

4260: G_err_stage := 'GET MAX EXPENDITURE ENDING DATE';
4261: write_log(LOG, G_err_stage);
4262: SELECT pa_utils.getweekending(MAX(expenditure_item_date))
4263: INTO G_EXPENDITURE_ENDING_DATE
4264: FROM ap_invoice_distributions
4265: WHERE invoice_id = l_invoice_id_tbl(i);
4266:
4267: G_err_stage := ('Getting bus group id');
4268: write_log(LOG, G_err_stage);

Line 4449: FROM ap_invoice_distributions_all

4445:
4446: IF l_is_self_assessed_tax_tbl(i) = 'N' then --Bug 13602288: Self Assessed Tax Changes
4447: SELECT nvl(historical_flag,'N')
4448: INTO l_prepay_hist_flag
4449: FROM ap_invoice_distributions_all
4450: WHERE invoice_distribution_id = l_prepay_dist_id_tbl(i);
4451: ELSE
4452: l_prepay_hist_flag := 'N';
4453: END IF;

Line 4460: FROM ap_invoice_distributions_all

4456:
4457: IF l_is_self_assessed_tax_tbl(i) = 'N' then --Bug 13602288: Self Assessed Tax Changes
4458: SELECT nvl(historical_flag,'N')
4459: INTO l_prepay_hist_flag
4460: FROM ap_invoice_distributions_all
4461: WHERE invoice_distribution_id = l_parent_rev_id_tbl(i);
4462: ELSE
4463: l_prepay_hist_flag := 'N';
4464: END IF;

Line 4566: FROM ap_invoice_distributions_all

4562: else
4563:
4564: SELECT nvl(historical_flag,'N')
4565: INTO l_historical_flag
4566: FROM ap_invoice_distributions_all
4567: WHERE invoice_id = l_invoice_id_tbl(i)
4568: AND invoice_distribution_id = l_parent_rev_id_tbl(i); --check the index on this table
4569:
4570: end if;

Line 5285: UPDATE ap_invoice_distributions_all dist

5281: write_log(LOG, G_err_stage);
5282:
5283: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
5284:
5285: UPDATE ap_invoice_distributions_all dist
5286: SET dist.pa_addition_flag = l_pa_addflag_tbl(i)
5287: ,dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
5288: WHERE dist.invoice_id = l_sys_ref2_tbl(i)
5289: AND dist.invoice_distribution_id = l_sys_ref5_tbl(i)

Line 5315: from ap_invoice_distributions_all dist

5311: WHERE document_header_id = l_sys_ref2_tbl(i)
5312: AND document_distribution_id = l_sys_ref5_tbl(i)
5313: AND document_distribution_type <> 'SELF_ASSESSED_TAX' /*Bug 13602288: Self Assessed Tax Changes*/
5314: AND exists (select 'exist'
5315: from ap_invoice_distributions_all dist
5316: where dist.invoice_id =l_sys_ref2_tbl(i)
5317: and dist.invoice_distribution_id = l_sys_ref5_tbl(i)
5318: and dist.pa_addition_flag = 'Y'
5319: and dist.historical_flag = 'Y');

Line 5345: AP_Invoice_Distributions_all aid,

5341: WHERE hist.payment_history_id = dist.payment_history_id
5342: AND hist.posted_flag = 'Y')
5343: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
5344: FROM AP_INVOICES_ALL inv,
5345: AP_Invoice_Distributions_all aid,
5346: ap_invoice_payments_all aip
5347: WHERE inv.invoice_id = aip.invoice_id
5348: AND aid.invoice_id = inv.invoice_id
5349: AND aip.invoice_payment_id = dist.invoice_payment_id

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

5419:
5420: END tieback_AP_ER;
5421:
5422:
5423: PROCEDURE lock_rcv_txn (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS
5424:
5425: l_num_rows NUMBER;
5426:
5427: BEGIN

Line 5612: AP_Invoice_Distributions_all aid,

5608: WHERE hist.payment_history_id = dist.payment_history_id
5609: AND hist.posted_flag = 'Y')
5610: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5611: FROM AP_INVOICES_ALL inv,
5612: AP_Invoice_Distributions_all aid,
5613: ap_invoice_payments_all aip
5614: WHERE inv.invoice_id = aip.invoice_id
5615: AND aid.invoice_id = inv.invoice_id
5616: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5654: AP_Invoice_Distributions_all aid,

5650: AND hist.posted_flag = 'Y')
5651: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5652: FROM AP_INVOICES_ALL inv,
5653: PO_Distributions_all PO,
5654: AP_Invoice_Distributions_all aid,
5655: ap_invoice_payments_all aip
5656: WHERE inv.invoice_id = aip.invoice_id
5657: AND aid.invoice_id = inv.invoice_id
5658: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5713: AP_Invoice_Distributions_all aid,

5709: AND hist.posted_flag = 'Y')
5710: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5711: FROM AP_INVOICES_ALL inv,
5712: PO_Distributions_all PO,
5713: AP_Invoice_Distributions_all aid,
5714: ap_invoice_payments_all aip
5715: WHERE inv.invoice_id = aip.invoice_id
5716: AND aid.invoice_id = inv.invoice_id
5717: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5769: AP_Invoice_Distributions_all aid,

5765: WHERE hist.payment_history_id = dist.payment_history_id
5766: AND hist.posted_flag = 'Y')
5767: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5768: FROM AP_INVOICES_ALL inv,
5769: AP_Invoice_Distributions_all aid,
5770: ap_invoice_payments_all aip
5771: WHERE inv.invoice_id = aip.invoice_id
5772: AND aid.invoice_id = inv.invoice_id
5773: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5807: AP_Invoice_Distributions_all aid,

5803: AND hist.posted_flag = 'Y')
5804: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5805: FROM AP_INVOICES_ALL inv,
5806: PO_Distributions_all PO,
5807: AP_Invoice_Distributions_all aid,
5808: ap_invoice_payments_all aip
5809: WHERE inv.invoice_id = aip.invoice_id
5810: AND aid.invoice_id = inv.invoice_id
5811: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 5865: AP_Invoice_Distributions_all aid,

5861: AND hist.posted_flag = 'Y')
5862: AND exists(SELECT inv.invoice_id -- 11658939 hint del no_unnest
5863: FROM AP_INVOICES_ALL inv,
5864: PO_Distributions_all PO,
5865: AP_Invoice_Distributions_all aid,
5866: ap_invoice_payments_all aip
5867: WHERE inv.invoice_id = aip.invoice_id
5868: AND aid.invoice_id = inv.invoice_id
5869: AND aip.invoice_payment_id = dist.invoice_payment_id

Line 6485: FROM ap_invoice_distributions

6481: write_log(LOG, G_err_stage);
6482: /* Bug 5051103 - replace expnediture_item_date with l_ei_date_tbl(i) */
6483: SELECT pa_utils.getweekending(MAX(l_ei_date_tbl(i)))
6484: INTO G_EXPENDITURE_ENDING_DATE
6485: FROM ap_invoice_distributions
6486: WHERE invoice_id = l_invoice_id_tbl(i);
6487:
6488: G_err_stage := ('Before getting business group id');
6489: write_log(LOG, G_err_stage);

Line 6545: select count(1) into l_dis_count from ap_invoice_distributions

6541: l_dis_count := 0;
6542:
6543: Begin
6544:
6545: select count(1) into l_dis_count from ap_invoice_distributions
6546: where invoice_distribution_id = l_invoice_dist_id_tbl(i)
6547: and line_type_lookup_code ='NONREC_TAX';
6548:
6549: exception

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

8863: RAISE;
8864:
8865: END check_failed_receipts;
8866:
8867: PROCEDURE lock_ap_invoice (p_po_distribution_id IN ap_invoice_distributions.po_distribution_id%TYPE) IS
8868:
8869: l_num_rows NUMBER;
8870:
8871: BEGIN

Line 8876: UPDATE ap_invoice_distributions_all dist

8872:
8873: G_err_stage := 'Within calling lock_ap_invoice';
8874: write_log(LOG, G_err_stage);
8875:
8876: UPDATE ap_invoice_distributions_all dist
8877: SET dist.pa_addition_flag = 'L'
8878: WHERE dist.po_distribution_id = p_po_distribution_id
8879: AND dist.pa_addition_flag = 'N';
8880:

Line 8905: UPDATE ap_invoice_distributions_all dist

8901:
8902: G_err_stage := 'Within calling tieback_locked_invoice';
8903: write_log(LOG, G_err_stage);
8904:
8905: UPDATE ap_invoice_distributions_all dist
8906: SET dist.pa_addition_flag = 'N'
8907: WHERE dist.pa_addition_flag = 'L';
8908:
8909: l_num_rows := SQL%ROWCOUNT;

Line 8966: UPDATE ap_invoice_distributions_all apdist

8962: If g_body_debug_mode = 'Y' Then
8963: write_log(LOG, 'Updating empty invoice variance lines pa addtion flag to G for a project');
8964: End if;
8965:
8966: UPDATE ap_invoice_distributions_all apdist
8967: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
8968: request_id = G_REQUEST_ID,
8969: last_update_date=SYSDATE,
8970: last_updated_by=G_USER_ID,

Line 8977: FROM ap_invoices inv, ap_invoice_distributions_all dist

8973: program_application_id= G_PROG_APPL_ID,
8974: program_update_date=SYSDATE
8975: WHERE rowid IN (
8976: SELECT dist.rowid
8977: FROM ap_invoices inv, ap_invoice_distributions_all dist
8978: WHERE inv.invoice_id = dist.invoice_id
8979: AND (dist.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL','NONREC_TAX')
8980: OR ( pa_nl_installed.is_nl_installed = 'Y' --EIB trackable items
8981: AND EXISTS (SELECT 'X'

Line 8999: FROM ap_invoice_distributions_all apdist2

8995: ))
8996: )
8997: ) --Bug#5399352. Added this here to take care of IPV/TIPV records matched to EIB item PO.
8998: AND NOT EXISTS (SELECT NULL
8999: FROM ap_invoice_distributions_all apdist2
9000: WHERE apdist2.pa_addition_flag = 'Y'
9001: AND apdist2.po_distribution_id = dist.po_distribution_id
9002: AND (apdist2.line_type_lookup_code = dist.line_type_lookup_code
9003: or (apdist2.historical_flag = 'Y' and

Line 9008: FROM ap_invoice_distributions_all apdist1,

9004: dist.line_type_lookup_code = 'ACCRUAL')) /* Modified for bug 14003230 */
9005: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL','NONREC_TAX')
9006: )
9007: AND ( EXISTS (SELECT NULL
9008: FROM ap_invoice_distributions_all apdist1,
9009: ap_invoices_all ap1 /*Changes for bug 7650946 -- Start */
9010: WHERE apdist1.pa_addition_flag IN ('F', 'G')
9011: AND ap1.invoice_id = apdist1.invoice_id /*Added for bug 7650946 */
9012: AND apdist1.po_distribution_id = dist.po_distribution_id

Line 9128: UPDATE ap_invoice_distributions_all apdist

9124: pulled from Payables. The pa_addition_flag for such invoice ITEM distribution lines is updated to G to prevent
9125: further processing into Projects.
9126: However, if there is an amount variance on such invoice, it needs to be processed as W to releive variance commitment */
9127:
9128: UPDATE ap_invoice_distributions_all apdist
9129: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
9130: request_id = G_REQUEST_ID,
9131: last_update_date=SYSDATE,
9132: last_updated_by=G_USER_ID,

Line 9141: ap_invoice_distributions_all dist

9137: WHERE rowid in (
9138: SELECT dist.rowid
9139: FROM ap_invoices inv,
9140: po_distributions po,
9141: ap_invoice_distributions_all dist
9142: WHERE inv.invoice_id = dist.invoice_id
9143: AND po.po_distribution_id = dist.po_distribution_id
9144: AND dist.po_distribution_id >0 /*Added the condition for bug#12922795 */
9145: AND nvl(po.distribution_type,'XXX') <> 'PREPAYMENT' -- bug 7192304, added nvl

Line 9187: UPDATE ap_invoice_distributions_all apdist

9183: If g_body_debug_mode = 'Y' Then
9184: write_log(LOG, 'Updating empty invoice variance lines pa addtion flag to G for all');
9185: End if;
9186:
9187: UPDATE ap_invoice_distributions_all apdist
9188: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
9189: request_id = G_REQUEST_ID,
9190: last_update_date=SYSDATE,
9191: last_updated_by=G_USER_ID,

Line 9198: FROM ap_invoices inv, ap_invoice_distributions_all dist

9194: program_application_id= G_PROG_APPL_ID,
9195: program_update_date=SYSDATE
9196: WHERE rowid IN (
9197: SELECT dist.rowid
9198: FROM ap_invoices inv, ap_invoice_distributions_all dist
9199: WHERE inv.invoice_id = dist.invoice_id
9200: AND ( dist.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL','NONREC_TAX')
9201: OR ( pa_nl_installed.is_nl_installed = 'Y' --EIB trackable items
9202: AND EXISTS (SELECT 'X'

Line 9220: FROM ap_invoice_distributions_all apdist2

9216: ))
9217: )
9218: ) --Bug#5399352. Added this here to take care of IPV/TIPV records matched to EIB item PO.
9219: AND NOT EXISTS (SELECT NULL
9220: FROM ap_invoice_distributions_all apdist2
9221: WHERE apdist2.pa_addition_flag = 'Y'
9222: AND apdist2.po_distribution_id = dist.po_distribution_id
9223: AND (apdist2.line_type_lookup_code = dist.line_type_lookup_code
9224: or (apdist2.historical_flag = 'Y' and

Line 9229: FROM ap_invoice_distributions_all apdist1,

9225: dist.line_type_lookup_code = 'ACCRUAL')) /* Modified for bug 14003230 */
9226: AND apdist2.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL','NONREC_TAX')
9227: )
9228: AND ( EXISTS (SELECT NULL
9229: FROM ap_invoice_distributions_all apdist1,
9230: ap_invoices_all ap1 /*Changes for bug 7650946 -- Start */
9231: WHERE apdist1.pa_addition_flag IN ('F', 'G')
9232: AND ap1.invoice_id = apdist1.invoice_id
9233: AND apdist1.po_distribution_id = dist.po_distribution_id

Line 9349: UPDATE ap_invoice_distributions_all apdist

9345: pulled from Payables. The pa_addition_flag for such invoice ITEM distribution lines is updated to G to prevent
9346: further processing into Projects.
9347: However, if there is an amount variance on such invoice, it needs to be processed as W to releive variance commitment */
9348:
9349: UPDATE ap_invoice_distributions_all apdist
9350: SET apdist.pa_addition_flag = DECODE(NVL(apdist.amount_variance,0),0,'G',increment_W_count('W')),
9351: request_id = G_REQUEST_ID,
9352: last_update_date=SYSDATE,
9353: last_updated_by=G_USER_ID,

Line 9362: ap_invoice_distributions_all dist

9358: WHERE rowid in (
9359: SELECT dist.rowid
9360: FROM ap_invoices inv,
9361: po_distributions po,
9362: ap_invoice_distributions_all dist
9363: WHERE inv.invoice_id = dist.invoice_id
9364: AND po.po_distribution_id = dist.po_distribution_id
9365: AND dist.po_distribution_id >0 /*Added the condition for bug#12922795 */
9366: AND NVL(po.destination_type_code, 'EXPENSE') = 'EXPENSE'

Line 9879: FROM ap_invoice_distributions

9875: G_err_stage := 'GET MAX EXPENDITURE ENDING DATE';
9876: write_log(LOG, G_err_stage);
9877: SELECT pa_utils.getweekending(MAX(expenditure_item_date))
9878: INTO G_EXPENDITURE_ENDING_DATE
9879: FROM ap_invoice_distributions
9880: WHERE invoice_id = l_invoice_id_tbl(i);
9881:
9882: If g_body_debug_mode = 'Y' Then
9883: G_err_stage := ('Getting bus group id');

Line 9975: FROM ap_invoice_distributions_all

9971: BEGIN
9972:
9973: SELECT nvl(historical_flag,'N') --check if this flag can be used
9974: INTO l_historical_flag
9975: FROM ap_invoice_distributions_all
9976: WHERE invoice_id = l_invoice_id_tbl(i)
9977: AND invoice_distribution_id = l_parent_rev_id_tbl(i); --check the index on this table
9978:
9979: EXCEPTION

Line 10333: UPDATE ap_invoice_distributions_all dist

10329: write_log(LOG, G_err_stage);
10330:
10331: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
10332:
10333: UPDATE ap_invoice_distributions_all dist
10334: SET dist.pa_addition_flag = l_pa_addflag_tbl(i)
10335: ,dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
10336: WHERE dist.invoice_id = l_sys_ref2_tbl(i)
10337: AND dist.invoice_distribution_id = l_sys_ref5_tbl(i)

Line 10453: FROM AP_invoice_distributions aid

10449: FROM ap_payment_history_all hist
10450: WHERE hist.payment_history_id = dist.payment_history_id
10451: AND hist.posted_flag = 'Y')
10452: AND EXISTS (SELECT invoice_id
10453: FROM AP_invoice_distributions aid
10454: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
10455: AND aid.project_id = G_PROJECT_ID
10456: AND ( nvl(aid.encumbered_flag,'N') = 'R' )
10457: ) ;

Line 10487: FROM AP_invoice_distributions aid

10483: FROM ap_payment_history_all hist
10484: WHERE hist.payment_history_id = dist.payment_history_id
10485: AND hist.posted_flag = 'Y')
10486: AND EXISTS (SELECT aid.invoice_id
10487: FROM AP_invoice_distributions aid
10488: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
10489: AND aid.project_id > 0
10490: AND nvl(aid.encumbered_flag,'N') = 'R'
10491: ) ;

Line 10527: FROM AP_invoice_distributions aid

10523: FROM ap_payment_history_all hist
10524: WHERE hist.payment_history_id = dist.payment_history_id
10525: AND hist.posted_flag = 'Y')
10526: AND EXISTS (SELECT aid.invoice_id
10527: FROM AP_invoice_distributions aid
10528: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
10529: AND aid.project_id = G_PROJECT_ID
10530: AND ( nvl(aid.encumbered_flag,'N') = 'R' )
10531: ) ;

Line 10560: FROM AP_invoice_distributions aid

10556: FROM ap_payment_history_all hist
10557: WHERE hist.payment_history_id = dist.payment_history_id
10558: AND hist.posted_flag = 'Y')
10559: AND EXISTS (SELECT aid.invoice_id
10560: FROM AP_invoice_distributions aid
10561: WHERE aid.invoice_distribution_id = dist.invoice_distribution_id
10562: AND aid.project_id > 0
10563: AND ( nvl(aid.encumbered_flag,'N') = 'R' )
10564: ) ;

Line 10633: AP_Invoice_Distributions_all aid,

10629: AND hist.posted_flag = 'Y')
10630: AND exists (SELECT inv.invoice_id
10631: FROM AP_INVOICES inv,
10632: PO_VENDORS vend,
10633: AP_Invoice_Distributions_all aid,
10634: ap_invoice_payments_all aip
10635: WHERE inv.invoice_id = aid.invoice_id
10636: AND inv.vendor_id = vend.vendor_id
10637: AND aip.invoice_payment_id = dist.invoice_payment_id

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

10670: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10671: FROM AP_INVOICES_ALL inv,
10672: PO_VENDORS vend,
10673: PO_Distributions_all PO,
10674: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10675: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10676: WHERE aid.invoice_id = inv.invoice_id
10677: AND inv.vendor_id = vend.vendor_id
10678: AND inv.org_id = G_ORG_ID

Line 10675: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

10671: FROM AP_INVOICES_ALL inv,
10672: PO_VENDORS vend,
10673: PO_Distributions_all PO,
10674: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10675: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10676: WHERE aid.invoice_id = inv.invoice_id
10677: AND inv.vendor_id = vend.vendor_id
10678: AND inv.org_id = G_ORG_ID
10679: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 10723: AP_Invoice_Distributions_all aid,

10719: AND hist.posted_flag = 'Y')
10720: AND exists (SELECT inv.invoice_id
10721: FROM AP_INVOICES_ALL inv,
10722: PO_VENDORS vend,
10723: AP_Invoice_Distributions_all aid,
10724: ap_invoice_payments_all aip
10725: WHERE inv.vendor_id = vend.vendor_id
10726: AND aid.invoice_id = inv.invoice_id
10727: AND inv.org_id = G_ORG_ID

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

10761: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10762: FROM AP_INVOICES_ALL inv,
10763: PO_VENDORS vend,
10764: PO_Distributions_all PO,
10765: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10766: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10767: WHERE aid.invoice_id = inv.invoice_id
10768: AND inv.vendor_id = vend.vendor_id
10769: AND inv.org_id = G_ORG_ID

Line 10766: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

10762: FROM AP_INVOICES_ALL inv,
10763: PO_VENDORS vend,
10764: PO_Distributions_all PO,
10765: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10766: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10767: WHERE aid.invoice_id = inv.invoice_id
10768: AND inv.vendor_id = vend.vendor_id
10769: AND inv.org_id = G_ORG_ID
10770: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 10828: AP_Invoice_Distributions_all aid,

10824: AND hist.posted_flag = 'Y')
10825: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10826: FROM AP_INVOICES_ALL inv,
10827: PO_Distributions_all PO,
10828: AP_Invoice_Distributions_all aid,
10829: ap_invoice_payments_all aip
10830: WHERE inv.invoice_id = aip.invoice_id
10831: AND aid.invoice_id = inv.invoice_id
10832: AND inv.org_id = G_ORG_ID

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

10871: AND dist.amount <> 0
10872: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10873: FROM AP_INVOICES_ALL inv,
10874: PO_Distributions_all PO,
10875: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10876: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10877: WHERE aid.invoice_id = inv.invoice_id
10878: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
10879: AND inv.org_id = G_ORG_ID

Line 10876: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

10872: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10873: FROM AP_INVOICES_ALL inv,
10874: PO_Distributions_all PO,
10875: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10876: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10877: WHERE aid.invoice_id = inv.invoice_id
10878: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
10879: AND inv.org_id = G_ORG_ID
10880: AND aid2.invoice_id = aid.invoice_id

Line 10930: AP_Invoice_Distributions_all aid,

10926: AND hist.posted_flag = 'Y')
10927: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10928: FROM AP_INVOICES_ALL inv,
10929: PO_Distributions_all PO,
10930: AP_Invoice_Distributions_all aid,
10931: ap_invoice_payments_all aip
10932: WHERE inv.invoice_id = aip.invoice_id
10933: AND aid.invoice_id = inv.invoice_id
10934: AND inv.org_id = G_ORG_ID

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

10973: AND dist.amount <> 0
10974: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10975: FROM AP_INVOICES_ALL inv,
10976: PO_Distributions_all PO,
10977: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10978: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10979: WHERE aid.invoice_id = inv.invoice_id
10980: AND inv.org_id = G_ORG_ID
10981: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line

Line 10978: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE

10974: AND exists(SELECT /*+ no_unnest */ inv.invoice_id
10975: FROM AP_INVOICES_ALL inv,
10976: PO_Distributions_all PO,
10977: AP_Invoice_Distributions_all aid, --STD INV DIST LINE
10978: AP_Invoice_Distributions_all aid2 -- PREPAY APPL DIST LINE
10979: WHERE aid.invoice_id = inv.invoice_id
10980: AND inv.org_id = G_ORG_ID
10981: AND aid.invoice_distribution_id = dist.invoice_distribution_id -- Std inv line
10982: AND aid2.invoice_id = aid.invoice_id

Line 11703: FROM ap_invoice_distributions

11699: write_log(LOG, G_err_stage);
11700: /* Bug 5051103 - replace expnediture_item_date with l_ei_date_tbl(i) */
11701: SELECT pa_utils.getweekending(MAX(l_ei_date_tbl(i)))
11702: INTO G_EXPENDITURE_ENDING_DATE
11703: FROM ap_invoice_distributions
11704: WHERE invoice_id = l_invoice_id_tbl(i);
11705:
11706: G_err_stage := ('Getting bus group id');
11707: write_log(LOG, G_err_stage);

Line 12693: UPDATE ap_invoice_distributions_all dist

12689:
12690: IF l_batch <> 'APDISC' THEN --Payment Discount batch
12691:
12692: FORALL i IN l_sys_ref1_tbl.FIRST..l_sys_ref1_tbl.LAST
12693: UPDATE ap_invoice_distributions_all dist
12694: SET dist.assets_addition_flag = decode(l_assets_addflag_tbl(i),'P','P',dist.assets_addition_flag)
12695: WHERE dist.invoice_distribution_id = l_sys_ref5_tbl(i) ;
12696: END IF;
12697:

Line 13153: FROM ap_invoice_distributions apdist

13149: AND rcv_txn2.po_distribution_id = P_Po_Distribution_Id
13150: AND rcv_sub2.pa_addition_flag = 'G'
13151: UNION ALL
13152: SELECT null
13153: FROM ap_invoice_distributions apdist
13154: WHERE apdist.po_distribution_id = P_Po_Distribution_Id
13155: -- AND apdist.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL','NONREC_TAX') --Modified as below for the bug13984115
13156: AND apdist.line_type_lookup_code in ('ITEM','ACCRUAL','RETROACCRUAL')
13157: AND apdist.pa_addition_flag = 'Y' /*Bug 13602288: Self Assessed Tax Changes*/