DBA Data[Home] [Help]

APPS.AP_MATCHING_PKG dependencies on PO_DISTRIBUTIONS

Line 182: G_Award_ID po_distributions_all.award_id%TYPE;

178: G_Build_Prepay_Accts_Flag ap_system_parameters.build_prepayment_accounts_flag%TYPE;
179: G_Income_Tax_Region ap_system_parameters.income_tax_region%TYPE;
180: G_Project_ID pa_projects_all.project_id%TYPE;
181: G_Task_ID pa_tasks.task_id%TYPE;
182: G_Award_ID po_distributions_all.award_id%TYPE;
183: G_Expenditure_Type pa_expenditure_types.expenditure_type%TYPE;
184: G_Invoice_Date ap_invoices.invoice_date%TYPE;
185: G_Expenditure_Organization_ID pa_exp_orgs_it.organization_id%TYPE;
186: G_Asset_Book_Type_Code fa_book_controls.book_type_code%TYPE;

Line 253: l_po_distribution_id po_distributions.po_distribution_id%TYPE := NULL;

249: X_retained_amount IN NUMBER DEFAULT NULL,
250: X_calling_sequence IN VARCHAR2) IS
251:
252: l_single_dist_flag varchar2(1) := 'N';
253: l_po_distribution_id po_distributions.po_distribution_id%TYPE := NULL;
254: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;
255: l_item_line_number ap_invoice_lines_all.line_number%TYPE;
256: l_line_amt_net_retainage ap_invoice_lines_all.amount%TYPE;
257: l_max_amount_to_recoup ap_invoice_lines_all.amount%TYPE;

Line 315: --po distributions of the shipment, for distribution level match we need to

311: p_match_amount => x_amount);
312: END IF;
313:
314: --If shipment level match then we need to prorate the match-quantity among the
315: --po distributions of the shipment, for distribution level match we need to
316: --derive the invoice_distribution_id, base_amount, ccid.
317:
318: l_debug_info := 'Get PO information';
319: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN

Line 608: po_distributions pd,

604: --end Bug 7483260
605: l_retained_amount,
606: -1 * l_retained_amount
607: FROM ap_invoice_distributions aid,
608: po_distributions pd,
609: po_line_locations pll
610: WHERE aid.invoice_distribution_id = l_invoice_distribution_id
611: AND pd.po_distribution_id = aid.po_distribution_id
612: AND pll.line_location_id = pd.line_location_id)

Line 1081: CURSOR po_distributions_cursor(p_total_quantity NUMBER) IS

1077: X_Dist_Tab IN OUT NOCOPY DIST_TAB_TYPE,
1078: X_Calling_Sequence IN VARCHAR2) IS
1079:
1080:
1081: CURSOR po_distributions_cursor(p_total_quantity NUMBER) IS
1082: SELECT po_distribution_id,
1083: /*PRORATED AMOUNT*/
1084: DECODE(g_min_acct_unit,
1085: '', ROUND( X_match_amount * DECODE(X_match_mode,

Line 1172: FROM po_distributions_ap_v PD

1168: NULL), --expenditure_organization_id
1169: DECODE(PD.destination_type_code,
1170: 'EXPENSE', PD.award_id), --award_id
1171: ap_invoice_distributions_s.nextval
1172: FROM po_distributions_ap_v PD
1173: WHERE line_location_id = x_po_line_location_id;
1174:
1175:
1176: l_total_quantity number;

Line 1177: l_po_distribution_id po_distributions_all.po_distribution_id%TYPE;

1173: WHERE line_location_id = x_po_line_location_id;
1174:
1175:
1176: l_total_quantity number;
1177: l_po_distribution_id po_distributions_all.po_distribution_id%TYPE;
1178: l_amount_invoiced ap_invoice_distributions_all.amount%TYPE;
1179: l_quantity_invoiced ap_invoice_distributions_all.quantity_invoiced%TYPE;
1180: l_po_dist_ccid po_distributions.code_combination_id%TYPE;
1181: l_accrue_on_receipt_flag po_distributions.accrue_on_receipt_flag%TYPE;

Line 1180: l_po_dist_ccid po_distributions.code_combination_id%TYPE;

1176: l_total_quantity number;
1177: l_po_distribution_id po_distributions_all.po_distribution_id%TYPE;
1178: l_amount_invoiced ap_invoice_distributions_all.amount%TYPE;
1179: l_quantity_invoiced ap_invoice_distributions_all.quantity_invoiced%TYPE;
1180: l_po_dist_ccid po_distributions.code_combination_id%TYPE;
1181: l_accrue_on_receipt_flag po_distributions.accrue_on_receipt_flag%TYPE;
1182: l_project_id po_distributions.project_id%TYPE;
1183: l_unbuilt_flex varchar2(240):='';
1184: l_reason_unbuilt_flex varchar2(2000):='';

Line 1181: l_accrue_on_receipt_flag po_distributions.accrue_on_receipt_flag%TYPE;

1177: l_po_distribution_id po_distributions_all.po_distribution_id%TYPE;
1178: l_amount_invoiced ap_invoice_distributions_all.amount%TYPE;
1179: l_quantity_invoiced ap_invoice_distributions_all.quantity_invoiced%TYPE;
1180: l_po_dist_ccid po_distributions.code_combination_id%TYPE;
1181: l_accrue_on_receipt_flag po_distributions.accrue_on_receipt_flag%TYPE;
1182: l_project_id po_distributions.project_id%TYPE;
1183: l_unbuilt_flex varchar2(240):='';
1184: l_reason_unbuilt_flex varchar2(2000):='';
1185: l_dist_ccid ap_invoice_distributions_all.dist_code_combination_id%TYPE;

Line 1182: l_project_id po_distributions.project_id%TYPE;

1178: l_amount_invoiced ap_invoice_distributions_all.amount%TYPE;
1179: l_quantity_invoiced ap_invoice_distributions_all.quantity_invoiced%TYPE;
1180: l_po_dist_ccid po_distributions.code_combination_id%TYPE;
1181: l_accrue_on_receipt_flag po_distributions.accrue_on_receipt_flag%TYPE;
1182: l_project_id po_distributions.project_id%TYPE;
1183: l_unbuilt_flex varchar2(240):='';
1184: l_reason_unbuilt_flex varchar2(2000):='';
1185: l_dist_ccid ap_invoice_distributions_all.dist_code_combination_id%TYPE;
1186: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;

Line 1187: l_task_id po_distributions.task_id%TYPE;

1183: l_unbuilt_flex varchar2(240):='';
1184: l_reason_unbuilt_flex varchar2(2000):='';
1185: l_dist_ccid ap_invoice_distributions_all.dist_code_combination_id%TYPE;
1186: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;
1187: l_task_id po_distributions.task_id%TYPE;
1188: l_award_set_id po_distributions_all.award_id%TYPE;
1189: l_expenditure_type po_distributions.expenditure_type%TYPE;
1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;
1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;

Line 1188: l_award_set_id po_distributions_all.award_id%TYPE;

1184: l_reason_unbuilt_flex varchar2(2000):='';
1185: l_dist_ccid ap_invoice_distributions_all.dist_code_combination_id%TYPE;
1186: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;
1187: l_task_id po_distributions.task_id%TYPE;
1188: l_award_set_id po_distributions_all.award_id%TYPE;
1189: l_expenditure_type po_distributions.expenditure_type%TYPE;
1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;
1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;
1192: l_max_dist_amount number := 0;

Line 1189: l_expenditure_type po_distributions.expenditure_type%TYPE;

1185: l_dist_ccid ap_invoice_distributions_all.dist_code_combination_id%TYPE;
1186: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;
1187: l_task_id po_distributions.task_id%TYPE;
1188: l_award_set_id po_distributions_all.award_id%TYPE;
1189: l_expenditure_type po_distributions.expenditure_type%TYPE;
1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;
1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;
1192: l_max_dist_amount number := 0;
1193: l_sum_prorated_amount number := 0;

Line 1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;

1186: l_invoice_distribution_id ap_invoice_distributions.invoice_distribution_id%TYPE;
1187: l_task_id po_distributions.task_id%TYPE;
1188: l_award_set_id po_distributions_all.award_id%TYPE;
1189: l_expenditure_type po_distributions.expenditure_type%TYPE;
1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;
1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;
1192: l_max_dist_amount number := 0;
1193: l_sum_prorated_amount number := 0;
1194: l_sum_dist_base_amount number := 0;

Line 1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;

1187: l_task_id po_distributions.task_id%TYPE;
1188: l_award_set_id po_distributions_all.award_id%TYPE;
1189: l_expenditure_type po_distributions.expenditure_type%TYPE;
1190: l_po_expenditure_item_date po_distributions.expenditure_item_date%TYPE;
1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;
1192: l_max_dist_amount number := 0;
1193: l_sum_prorated_amount number := 0;
1194: l_sum_dist_base_amount number := 0;
1195: l_rounding_index po_distributions.po_distribution_id%TYPE;

Line 1195: l_rounding_index po_distributions.po_distribution_id%TYPE;

1191: l_expenditure_organization_id po_distributions.expenditure_organization_id%TYPE;
1192: l_max_dist_amount number := 0;
1193: l_sum_prorated_amount number := 0;
1194: l_sum_dist_base_amount number := 0;
1195: l_rounding_index po_distributions.po_distribution_id%TYPE;
1196: l_base_amount ap_invoice_distributions.base_amount%TYPE;
1197: flex_overlay_failed exception;
1198: current_calling_sequence varchar2(2000);
1199: l_debug_info varchar2(2000);

Line 1232: OPEN PO_Distributions_Cursor(l_total_quantity);

1228: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
1229: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
1230: END IF;
1231:
1232: OPEN PO_Distributions_Cursor(l_total_quantity);
1233: LOOP
1234:
1235: l_debug_info := 'Fetch record from Po_Distributions_Cursor l_total_quantity is '||l_total_quantity;
1236: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN

Line 1235: l_debug_info := 'Fetch record from Po_Distributions_Cursor l_total_quantity is '||l_total_quantity;

1231:
1232: OPEN PO_Distributions_Cursor(l_total_quantity);
1233: LOOP
1234:
1235: l_debug_info := 'Fetch record from Po_Distributions_Cursor l_total_quantity is '||l_total_quantity;
1236: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
1237: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
1238: END IF;
1239:

Line 1240: FETCH PO_Distributions_Cursor INTO l_po_distribution_id,

1236: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
1237: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
1238: END IF;
1239:
1240: FETCH PO_Distributions_Cursor INTO l_po_distribution_id,
1241: l_amount_invoiced,
1242: l_quantity_invoiced,
1243: l_po_dist_ccid,
1244: l_accrue_on_receipt_flag,

Line 1253: EXIT WHEN PO_Distributions_Cursor%NOTFOUND;

1249: l_expenditure_organization_id,
1250: l_award_set_id,
1251: l_invoice_distribution_id;
1252:
1253: EXIT WHEN PO_Distributions_Cursor%NOTFOUND;
1254:
1255: --IF (l_amount_invoiced <> 0) THEN --Bug6321189
1256:
1257: l_debug_info := 'Populate the PL/SQL table x_dist_tab with the distribution information';

Line 1298: CLOSE PO_Distributions_Cursor;

1294: --END IF; /* (l_amount_invoiced <> 0) */
1295:
1296: END LOOP;
1297:
1298: CLOSE PO_Distributions_Cursor;
1299:
1300: --Update the PL/SQL table's amount column with the rounding amount due
1301: --to proration, before the base_amounts are calculated.
1302:

Line 1334: FROM po_distributions_ap_v

1330: x_dist_tab(i).expenditure_type,
1331: x_dist_tab(i).expenditure_item_date,
1332: x_dist_tab(i).expenditure_organization_id,
1333: x_dist_tab(i).invoice_distribution_id
1334: FROM po_distributions_ap_v
1335: WHERE po_distribution_id = x_dist_tab(i).po_distribution_id;
1336:
1337: -- Bug 5554493
1338: x_dist_tab(i).pa_quantity := x_dist_tab(i).quantity_invoiced;

Line 1575: --po_distributions_ap_v.code_combination_id is accrual account

1571: --bugfix:4668058 added the following clause
1572: (x_dist_tab(i).project_id IS NOT NULL AND g_allow_pa_override = 'N')
1573: ) THEN
1574:
1575: --po_distributions_ap_v.code_combination_id is accrual account
1576: --if accruing on receipt or else charge account
1577:
1578: x_dist_tab(i).dist_ccid := x_dist_tab(i).po_ccid;
1579:

Line 1749: FROM po_distributions_ap_v PD

1745: )
1746: )
1747: )
1748: INTO X_Total_Quantity
1749: FROM po_distributions_ap_v PD
1750: WHERE line_location_id = X_Po_Line_Location_Id;
1751:
1752: IF(x_total_quantity = 0) THEN
1753: x_total_quantity := 1;

Line 1830: -- go to base tables PO_LINES_ALL, PO_LINE_LOCATIONS and PO_DISTRIBUTIONS

1826: END IF;
1827: --End Bug#13505998
1828:
1829: -- bug 5061826
1830: -- go to base tables PO_LINES_ALL, PO_LINE_LOCATIONS and PO_DISTRIBUTIONS
1831: -- instead of PO_LINE_LOCATIONS_AP_V and PO_DISTRIBUTIONS_AP_V
1832:
1833: INSERT INTO AP_INVOICE_LINES (
1834: INVOICE_ID,

Line 1831: -- instead of PO_LINE_LOCATIONS_AP_V and PO_DISTRIBUTIONS_AP_V

1827: --End Bug#13505998
1828:
1829: -- bug 5061826
1830: -- go to base tables PO_LINES_ALL, PO_LINE_LOCATIONS and PO_DISTRIBUTIONS
1831: -- instead of PO_LINE_LOCATIONS_AP_V and PO_DISTRIBUTIONS_AP_V
1832:
1833: INSERT INTO AP_INVOICE_LINES (
1834: INVOICE_ID,
1835: LINE_NUMBER,

Line 2207: po_distributions pd,

2203: G_PAY_AWT_GROUP_ID --pay_awt_group_id bug8222382
2204: -- bug 5061826 -- new FROM clause that goes to base tables
2205: FROM PO_LINES_ALL PL,
2206: PO_LINE_LOCATIONS_ALL PLL,
2207: po_distributions pd,
2208: mtl_system_items msi
2209: WHERE pll.line_location_id = x_po_line_location_id
2210: and pd.line_location_id = pll.line_location_id
2211: AND PLL.PO_LINE_ID = PL.PO_LINE_ID

Line 2218: PO_DISTRIBUTIONS_AP_V PD,

2214: and msi.organization_id(+) = g_inventory_organization_id
2215: and rownum = 1;
2216: /* -- bug 5061826 -- commented out older FROM clause
2217: FROM PO_LINE_LOCATIONS_AP_V PLL,
2218: PO_DISTRIBUTIONS_AP_V PD,
2219: MTL_SYSTEM_ITEMS MSI
2220: WHERE PLL.LINE_LOCATION_ID = X_PO_LINE_LOCATION_ID
2221: AND PD.LINE_LOCATION_ID = PLL.LINE_LOCATION_ID
2222: AND PD.PO_DISTRIBUTION_ID = NVL(X_PO_DISTRIBUTION_ID,PD.PO_DISTRIBUTION_ID)

Line 2972: FROM po_distributions pd,

2968: 'N', --accrual_posted_flag
2969: 'N', --cash_posted_flag
2970: 'N', --rcv_charge_addition_flag
2971: x_dist_tab(i).pay_awt_group_id --pay_awt_group_id bug8222382
2972: FROM po_distributions pd,
2973: ap_invoice_lines ail,
2974: gl_code_combinations gcc
2975: WHERE ail.invoice_id = x_invoice_id
2976: AND ail.line_number = x_invoice_line_number

Line 3155: l_debug_info := 'Call the PO_AP_INVOICE_MATCH_GRP to update the Po Distributions and Po Line Locations';

3151: END IF;
3152:
3153: END LOOP;
3154:
3155: l_debug_info := 'Call the PO_AP_INVOICE_MATCH_GRP to update the Po Distributions and Po Line Locations';
3156: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
3157: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
3158: END IF;
3159:

Line 3333: l_po_distribution_id PO_DISTRIBUTIONS.PO_DISTRIBUTION_ID%TYPE := NULL;

3329: X_Uom_Lookup_Code IN VARCHAR2,
3330: X_Retained_Amount IN NUMBER DEFAULT NULL,
3331: X_Calling_Sequence IN VARCHAR2) IS
3332:
3333: l_po_distribution_id PO_DISTRIBUTIONS.PO_DISTRIBUTION_ID%TYPE := NULL;
3334: l_item_line_number AP_INVOICE_LINES_ALL.LINE_NUMBER%TYPE;
3335: l_line_amt_net_retainage ap_invoice_lines_all.amount%TYPE;
3336: l_max_amount_to_recoup ap_invoice_lines_all.amount%TYPE;
3337: l_amount_to_recoup ap_invoice_lines_all.amount%TYPE;

Line 3629: po_distributions pd,

3625: pd.variance_account_id),
3626: ap_invoice_distributions_s.nextval
3627: FROM ap_invoice_lines ail,
3628: ap_invoice_distributions aid1,
3629: po_distributions pd,
3630: ap_invoice_distributions aid2
3631: WHERE ail.invoice_id = x_corrected_invoice_id
3632: AND ail.line_number = x_corrected_line_number
3633: AND aid1.invoice_id = ail.invoice_id

Line 3671: po_distributions pd

3667: aid.dist_code_combination_id,
3668: ap_invoice_distributions_s.nextval
3669: FROM ap_invoice_distributions aid,
3670: ap_invoice_lines ail,
3671: po_distributions pd
3672: WHERE ail.invoice_id = x_corrected_invoice_id
3673: AND ail.line_number = x_corrected_line_number
3674: AND aid.invoice_id = ail.invoice_id
3675: AND aid.invoice_line_number = ail.line_number

Line 3777: FROM po_distributions pd,

3773: IF (x_match_mode IN ('STD-PS','CR-PS')) THEN
3774:
3775: SELECT sum(decode(pd.distribution_type,'PREPAYMENT',nvl(pd.quantity_financed,0),nvl(pd.quantity_billed,0)))
3776: INTO l_total_quantity_billed
3777: FROM po_distributions pd,
3778: ap_invoice_distributions aid
3779: WHERE pd.po_distribution_id = aid.po_distribution_id
3780: AND aid.invoice_id = x_corrected_invoice_id
3781: AND aid.invoice_line_number = x_corrected_line_number

Line 3956: FND_LOG.STRING(G_LEVEL_PROCEDURE,G_MODULE_NAME||l_api_name,'AP_MATCHING_PKG.Update_Corr_Po_Distributions(+)');

3952:
3953: current_calling_sequence := 'Update_Corr_Po_Shipments_Dists<-'||x_calling_sequence;
3954:
3955: IF (G_LEVEL_PROCEDURE >= G_CURRENT_RUNTIME_LEVEL) THEN
3956: FND_LOG.STRING(G_LEVEL_PROCEDURE,G_MODULE_NAME||l_api_name,'AP_MATCHING_PKG.Update_Corr_Po_Distributions(+)');
3957: END IF;
3958:
3959: l_debug_info := 'Create l_po_ap_dist_rec object';
3960: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN

Line 4004: l_debug_info := 'Call PO api to update po_distributions and po_shipments table'

4000:
4001: END IF;
4002:
4003:
4004: l_debug_info := 'Call PO api to update po_distributions and po_shipments table'
4005: ||' with quantity/amount billed information.';
4006:
4007: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
4008: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);

Line 4047: l_debug_info := 'Call the PO_AP_INVOICE_MATCH_GRP to update the Po Distributions and Po Line Locations';

4043: END IF;
4044:
4045: END LOOP;
4046:
4047: l_debug_info := 'Call the PO_AP_INVOICE_MATCH_GRP to update the Po Distributions and Po Line Locations';
4048: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
4049: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
4050: END IF;
4051:

Line 4888: po_distributions pd

4884: ail.pay_awt_group_id,NULL),
4885: NULL) --pay_awt_group_id bug8222382
4886: FROM ap_invoice_lines ail,
4887: ap_invoice_distributions aid,
4888: po_distributions pd
4889: WHERE ail.invoice_id = x_invoice_id
4890: AND ail.line_number = x_invoice_line_number
4891: AND aid.invoice_id = ail.corrected_inv_id
4892: AND aid.invoice_line_number = ail.corrected_line_number