505: /*** The following set of curr_ variables are used to keep track of the
506: current values used to determine if a new invoice has to be created ***/
507: X_curr_invoice_amount NUMBER := 0;
508: X_curr_invoice_id NUMBER := NULL;
509: X_curr_invoice_num ap_invoices.invoice_num%TYPE;
510:
511: X_curr_vendor_id NUMBER := NULL;
512: X_curr_pay_site_id NUMBER := NULL;
513: X_curr_currency_code rcv_transactions.currency_code%TYPE := NULL;
556:
557: X_batch_id NUMBER;
558: X_discountable_amount NUMBER;
559: X_inv_event VARCHAR2(26);
560: X_invoice_description ap_invoices.description%TYPE;
561: l_user_id NUMBER;
562: v_req_id NUMBER;
563:
564: /** this is the group id we insert into the
832: END;
833: END IF;*/
834: /* End bug 7512542 */
835:
836: select ap_invoices_interface_s.nextval
837: into x_curr_invoice_id
838: from sys.dual;
839:
840: x_group_id := substr('ERS-'||TO_CHAR(X_rcv_txns.transaction_id),1,80);
849: END IF;
850:
851: End IF; -- X_first_rcv_txn_flag
852:
853: -- parameters to this API are NOT all the columns in AP_INVOICES, the
854: -- other columns are not used by create_receipt_invoices or create_notice_invoices.
855:
856: /**** Check to see if there is a change in vendor,
857: pay_site,
884: */
885:
886: /* Bug 2531542 - The logic followed for creating invoices is to
887: insert records into ap_lines_interface first (distributions)
888: and then insert the records in ap_invoices_interface(Headers)
889: so the amount will be the total distribution amount.
890: For bug fix 1762305 , if the net received quantity is 0 then
891: distribuitions lines were not inserted. But the records were
892: inserted for the headers even for the received qty of 0.
1012: X_first_rcv_txn_flag := 'Y';
1013: END;
1014: /* End bug 7512542 */
1015:
1016: insert into AP_INVOICES_INTERFACE
1017: (INVOICE_ID,
1018: INVOICE_NUM,
1019: VENDOR_ID,
1020: VENDOR_SITE_ID,
1184: X_ap_pay_curr := X_curr_currency_code;
1185: END IF;
1186:
1187: -- parameters to this API are NOT all the columns in
1188: -- AP_INVOICES, the other columns are not used by
1189: -- create_receipt_invoices or create_notice_invoices.
1190:
1191: END IF; /** change in one of the curr_ variables **/
1192:
1396:
1397: /* End Bug 7512542 */
1398:
1399:
1400: insert into AP_INVOICES_INTERFACE
1401: (INVOICE_ID,
1402: INVOICE_NUM,
1403: VENDOR_ID,
1404: VENDOR_SITE_ID,
1472: where invoice_id = x_curr_invoice_id;
1473:
1474: if (x_dist_count = 0 ) then
1475: x_invoice_count := x_invoice_count - 1;
1476: delete from ap_invoices_interface
1477: where invoice_id=x_curr_invoice_id;
1478: end if;
1479:
1480:
1662:
1663: /*** make sure the "current" variables are correct ***/
1664: X_progress := '080';
1665:
1666: select ap_invoices_interface_s.nextval
1667: into x_curr_invoice_id
1668: from sys.dual;
1669:
1670: X_curr_invoice_amount := 0;
1716: RETURN VARCHAR2
1717: IS
1718: x_progress VARCHAR2 (3) := NULL;
1719: x_tmp_sequence_id NUMBER;
1720: x_tmp_invoice_num ap_invoices.invoice_num%TYPE;
1721: x_prefix VARCHAR2 (20);
1722:
1723: -- SBI ENH
1724: x_return_status VARCHAR2 (1);
2771: l_aging_period NUMBER;
2772: l_cutoff_date DATE;
2773: l_def_base_currency_code ap_system_parameters.base_currency_code%TYPE;
2774: l_org_id po_headers.org_id%TYPE;
2775: l_invoice_desc ap_invoices_interface.description%TYPE;
2776:
2777: l_group_id ap_invoices_interface.group_id%TYPE;
2778: l_user_id NUMBER;
2779: l_login_id NUMBER;
2773: l_def_base_currency_code ap_system_parameters.base_currency_code%TYPE;
2774: l_org_id po_headers.org_id%TYPE;
2775: l_invoice_desc ap_invoices_interface.description%TYPE;
2776:
2777: l_group_id ap_invoices_interface.group_id%TYPE;
2778: l_user_id NUMBER;
2779: l_login_id NUMBER;
2780: l_tmp_batch_id NUMBER;
2781: l_batch_name ap_batches.batch_name%TYPE;
2778: l_user_id NUMBER;
2779: l_login_id NUMBER;
2780: l_tmp_batch_id NUMBER;
2781: l_batch_name ap_batches.batch_name%TYPE;
2782: l_request_id ap_invoices_interface.request_id%TYPE;
2783:
2784: l_error_msg VARCHAR2(2000);
2785: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
2786: l_progress VARCHAR2(3);
3430: END IF; -- GL_CURRENCY_API.is_fixed_rate(...)
3431:
3432: x_curr.invoice_amount := 0;
3433:
3434: SELECT AP_INVOICES_INTERFACE_S.NEXTVAL
3435: INTO x_curr.invoice_id
3436: FROM SYS.DUAL;
3437:
3438: x_curr.vendor_id := p_next_consump.vendor_id(p_index);
3518:
3519: x_return_status := FND_API.G_RET_STS_SUCCESS;
3520:
3521: FORALL i IN p_from..p_to
3522: INSERT INTO ap_invoices_interface(
3523: invoice_id,
3524: invoice_num,
3525: vendor_id,
3526: vendor_site_id,