24:
25: debug_info := 'Count for same vendor_id,party_site_id and invoice_num'; /*Bug9105666*/
26: SELECT count(1)
27: INTO dummy_a
28: FROM ap_invoices_all
29: WHERE invoice_num = p_INVOICE_NUM
30: AND vendor_id = p_VENDOR_ID
31: AND org_id = p_ORG_ID -- Bug 5407785
32: AND (party_site_id = P_PARTY_SITE_ID /*Bug9105666*/
250: )
251: IS
252:
253: CURSOR C IS
254: SELECT rowid FROM ap_invoices_all
255: WHERE invoice_id = p_Invoice_Id;
256:
257: CURSOR C2 IS
258: SELECT ap_invoices_s.nextval FROM sys.dual;
254: SELECT rowid FROM ap_invoices_all
255: WHERE invoice_id = p_Invoice_Id;
256:
257: CURSOR C2 IS
258: SELECT ap_invoices_s.nextval FROM sys.dual;
259:
260: current_calling_sequence VARCHAR2(2000);
261: debug_info VARCHAR2(100);
262: BEGIN
284: debug_info := 'hello Close cursor C2';
285: CLOSE C2;
286: END IF;
287:
288: debug_info := 'Insert into ap_invoices_all';
289:
290: INSERT INTO ap_invoices_all(
291: invoice_id,
292: last_update_date,
286: END IF;
287:
288: debug_info := 'Insert into ap_invoices_all';
289:
290: INSERT INTO ap_invoices_all(
291: invoice_id,
292: last_update_date,
293: last_updated_by,
294: vendor_id,
633: CLOSE C;
634:
635: --Bug 4539462 DBI logging
636: AP_DBI_PKG.Maintain_DBI_Summary
637: (p_table_name => 'AP_INVOICES',
638: p_operation => 'I',
639: p_key_value1 => p_invoice_id,
640: p_calling_sequence => current_calling_sequence);
641:
836: P_PARTY_SITE_ID, /*Bug9105666*/
837: P_VENDOR_SITE_ID, /*Bug9105666*/
838: current_calling_sequence);
839:
840: debug_info := 'Update ap_invoices';
841: UPDATE ap_invoices_all
842: SET
843: invoice_id = p_Invoice_Id,
844: last_update_date = p_Last_Update_Date,
837: P_VENDOR_SITE_ID, /*Bug9105666*/
838: current_calling_sequence);
839:
840: debug_info := 'Update ap_invoices';
841: UPDATE ap_invoices_all
842: SET
843: invoice_id = p_Invoice_Id,
844: last_update_date = p_Last_Update_Date,
845: last_updated_by = p_Last_Updated_By,
1003: END IF;
1004:
1005: SELECT invoice_id
1006: INTO l_invoice_id
1007: FROM ap_invoices_all
1008: WHERE rowid = p_rowid;
1009:
1010: --Bug 4539462 DBI logging
1011: AP_DBI_PKG.Maintain_DBI_Summary
1008: WHERE rowid = p_rowid;
1009:
1010: --Bug 4539462 DBI logging
1011: AP_DBI_PKG.Maintain_DBI_Summary
1012: (p_table_name => 'AP_INVOICES',
1013: p_operation => 'U',
1014: p_key_value1 => P_invoice_id,
1015: p_calling_sequence => current_calling_sequence);
1016:
1042: debug_info VARCHAR2(100);
1043: l_key_value_list gl_ca_utility_pkg.r_key_value_arr;
1044:
1045: /*Start of 7388641*/
1046: l_invoice_type_lookup_code AP_INVOICES.INVOICE_TYPE_LOOKUP_CODE%TYPE;
1047: l_return_status_service VARCHAR2(50);
1048: l_msg_count NUMBER;
1049: l_msg_data VARCHAR2(100);
1050: l_transaction_rec ZX_API_PUB.TRANSACTION_REC_TYPE;
1066:
1067: /*7388641 also selecting invoice_type_lookup_code*/
1068: SELECT invoice_id,invoice_type_lookup_code
1069: INTO l_invoice_id,l_invoice_type_lookup_code
1070: FROM ap_invoices
1071: WHERE rowid = p_rowid;
1072:
1073: -- Delete attachments
1074: debug_info := 'Delete from fnd_attachments';
1072:
1073: -- Delete attachments
1074: debug_info := 'Delete from fnd_attachments';
1075: fnd_attached_documents2_pkg.delete_attachments(
1076: 'AP_INVOICES',
1077: l_invoice_id);
1078:
1079: -- Delete from the child entities
1080: -- debug_info := 'Delete from child entity - jg_zz_invoice_info';
1111:
1112: debug_info := 'Before deleting data in Tax tables taking required data';
1113:
1114: l_transaction_rec.application_id := 200;
1115: l_transaction_rec.entity_code := 'AP_INVOICES';
1116: l_transaction_rec.trx_id := l_invoice_id;
1117:
1118: l_success := AP_ETAX_UTILITY_PKG.Get_Event_Class_Code(
1119: P_Invoice_Type_Lookup_Code => l_invoice_type_lookup_code,
1150: x_msg_data => l_msg_data); --out parameter
1151:
1152: --End of 7388641 --
1153:
1154: debug_info := 'Delete from ap_invoices';
1155: DELETE FROM ap_invoices_all
1156: WHERE rowid = p_Rowid;
1157:
1158: --Bug 4539462 DBI logging
1151:
1152: --End of 7388641 --
1153:
1154: debug_info := 'Delete from ap_invoices';
1155: DELETE FROM ap_invoices_all
1156: WHERE rowid = p_Rowid;
1157:
1158: --Bug 4539462 DBI logging
1159: AP_DBI_PKG.Maintain_DBI_Summary
1156: WHERE rowid = p_Rowid;
1157:
1158: --Bug 4539462 DBI logging
1159: AP_DBI_PKG.Maintain_DBI_Summary
1160: (p_table_name => 'AP_INVOICES',
1161: p_operation => 'D',
1162: p_key_value1 => l_invoice_id,
1163: p_calling_sequence => current_calling_sequence);
1164: