The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_login_id igc_cc_headers.last_update_login%TYPE := FND_GLOBAL.login_id;
SELECT currency_code
INTO l_ledger_currency
FROM gl_ledgers
WHERE ledger_id = P_CC_Header_Rec.set_of_books_id;
SELECT NVL(precision, 0), NVL(minimum_accountable_unit,(1/power(10,precision)))
INTO l_precision, l_minimum_accountable_unit
FROM fnd_currencies
WHERE currency_code = l_ledger_currency;
DELETE FROM zx_trx_headers_gt
WHERE application_id = IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID
AND entity_code = IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE
AND event_class_code = IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE
AND trx_id = P_CC_Header_Rec.cc_header_id;
INSERT INTO zx_trx_headers_gt(
internal_organization_id,
internal_org_location_id,
application_id,
entity_code,
event_class_code,
event_type_code,
trx_id,
hdr_trx_user_key1,
hdr_trx_user_key2,
hdr_trx_user_key3,
hdr_trx_user_key4,
hdr_trx_user_key5,
hdr_trx_user_key6,
trx_date,
trx_doc_revision,
ledger_id,
trx_currency_code,
currency_conversion_date,
currency_conversion_rate,
currency_conversion_type,
minimum_accountable_unit,
precision,
legal_entity_id,
rounding_ship_to_party_id,
rounding_ship_from_party_id,
rounding_bill_to_party_id,
rounding_bill_from_party_id,
rndg_ship_to_party_site_id,
rndg_ship_from_party_site_id,
rndg_bill_to_party_site_id,
rndg_bill_from_party_site_id,
establishment_id,
receivables_trx_type_id,
related_doc_application_id,
related_doc_entity_code,
related_doc_event_class_code,
related_doc_trx_id,
rel_doc_hdr_trx_user_key1,
rel_doc_hdr_trx_user_key2,
rel_doc_hdr_trx_user_key3,
rel_doc_hdr_trx_user_key4,
rel_doc_hdr_trx_user_key5,
rel_doc_hdr_trx_user_key6,
related_doc_number,
related_doc_date,
default_taxation_country,
quote_flag,
ctrl_total_hdr_tx_amt,
trx_number,
trx_description,
trx_communicated_date,
batch_source_id,
batch_source_name,
doc_seq_id,
doc_seq_name,
doc_seq_value,
trx_due_date,
trx_type_description,
document_sub_type,
supplier_tax_invoice_number,
supplier_tax_invoice_date,
supplier_exchange_rate,
tax_invoice_date,
tax_invoice_number,
tax_event_class_code,
tax_event_type_code,
doc_event_status,
rdng_ship_to_pty_tx_prof_id,
rdng_ship_from_pty_tx_prof_id,
rdng_bill_to_pty_tx_prof_id,
rdng_bill_from_pty_tx_prof_id,
rdng_ship_to_pty_tx_p_st_id,
rdng_ship_from_pty_tx_p_st_id,
rdng_bill_to_pty_tx_p_st_id,
rdng_bill_from_pty_tx_p_st_id,
bill_third_pty_acct_id,
bill_third_pty_acct_site_id,
ship_third_pty_acct_id,
ship_third_pty_acct_site_id,
icx_session_id)
VALUES
(
P_CC_Header_Rec.org_id, --internal_organization_id
NULL, --P_CC_Header_Rec.location_id, --internal_org_location_id ^^
IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID, --application_id
IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE, --entity_code
IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE, --event_class_code
IGC_ETAX_UTIL_PKG.IGC_EVENT_TYPE_CODE, --event_type_code
P_CC_Header_Rec.cc_header_id, --trx_id
NULL, --hdr_trx_user_key1
NULL, --hdr_trx_user_key2
NULL, --hdr_trx_user_key3
NULL, --hdr_trx_user_key4
NULL, --hdr_trx_user_key5
NULL, --hdr_trx_user_key6
nvl(P_CC_Header_Rec.cc_acct_date,sysdate), -- *check* p_invoice_header_rec.invoice_date, --trx_date
NULL, --trx_doc_revision
P_CC_Header_Rec.set_of_books_id, --ledger_id
l_ledger_currency, --trx_currency_code
null, --currency_conversion_date
null, --currency_conversion_rate
null, --currency_conversion_type
l_minimum_accountable_unit, --minimum_accountable_unit
l_precision, --precision
P_Legal_Entity_Id, --*check* p_invoice_header_rec.legal_entity_id, --legal_entity_id
P_CC_Header_Rec.vendor_id, --rounding_ship_to_party_id ^^
NULL, --rounding_ship_from_party_id *CC*
l_rounding_bill_to_party_id, --rounding_bill_to_party_id
NULL, --rounding_bill_from_party_id *CC*
NULL, --rndg_ship_to_party_site_id
NULL, --rndg_ship_from_party_site_id *CC*
NULL, --rndg_bill_to_party_site_id
NULL, --rndg_bill_from_party_site_id *CC*
NULL, --establishment_id
NULL, --receivables_trx_type_id
NULL, --related_doc_application_id *CC*
NULL, --related_doc_entity_code *CC*
NULL, --related_doc_event_class_code *CC*
NULL, --related_doc_trx_id *CC*
NULL, --rel_doc_hdr_trx_user_key1
NULL, --rel_doc_hdr_trx_user_key2
NULL, --rel_doc_hdr_trx_user_key3
NULL, --rel_doc_hdr_trx_user_key4
NULL, --rel_doc_hdr_trx_user_key5
NULL, --rel_doc_hdr_trx_user_key6
NULL, --related_doc_number *CC*
NULL, --related_doc_date *CC*
NULL, --*check* p_invoice_header_rec.taxation_country, --default_taxation_country
IGC_ETAX_UTIL_PKG.IGC_TAX_QUOTE_FLAG, --quote_flag
NULL, --ctrl_total_hdr_tx_amt *CC*
P_CC_Header_Rec.cc_num, --trx_number *CC*
NULL, --trx_description
NULL, --trx_communicated_date
NULL, --batch_source_id
NULL, --batch_source_name
NULL, --doc_seq_id *CC*
NULL, --doc_seq_name *CC*
NULL, --doc_seq_value *CC*
NULL, --trx_due_date
NULL, --trx_type_description *CC*
NULL, --document_sub_type *CC*
NULL, --supplier_tax_invoice_number *CC*
NULL, --supplier_tax_invoice_date *CC*
NULL, --supplier_exchange_rate *CC*
NULL, --tax_invoice_date *CC*
NULL, --tax_invoice_number *CC*
NULL, --tax_event_class_code
IGC_ETAX_UTIL_PKG.IGC_TAX_EVENT_TYPE_CODE, --tax_event_type_code
NULL, --doc_event_status
NULL, --rdng_ship_to_pty_tx_prof_id
NULL, --rdng_ship_from_pty_tx_prof_id
NULL, --rdng_bill_to_pty_tx_prof_id
NULL, --rdng_bill_from_pty_tx_prof_id
NULL, --rdng_ship_to_pty_tx_p_st_id
NULL, --rdng_ship_from_pty_tx_p_st_id
NULL, --rdng_bill_to_pty_tx_p_st_id
NULL, --rdng_bill_from_pty_tx_p_st_id
P_CC_Header_Rec.vendor_id, --bill_third_pty_acct_id
P_CC_Header_Rec.vendor_site_id, --bill_third_pty_acct_site_id
P_CC_Header_Rec.vendor_id, --ship_third_pty_acct_id
P_CC_Header_Rec.vendor_site_id, --ship_third_pty_acct_site_id
FND_GLOBAL.session_id --icx_session_id
);
l_debug_info := 'Populating zx header table after insert before retunr';
SELECT *
FROM igc_cc_acct_lines
WHERE cc_acct_line_id = c_line_id;
l_cc_line_list.DELETE;
DELETE FROM zx_transaction_lines_gt
WHERE application_id = IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID
AND entity_code = IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE
AND event_class_code = IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE
AND trx_id = P_CC_Header_Rec.cc_header_id
AND TRX_LEVEL_TYPE = IGC_ETAX_UTIL_PKG.IGC_TRX_LEVEL_TYPE ;
l_debug_info := 'Bulk Insert into global temp table';
INSERT INTO zx_transaction_lines_gt
VALUES l_trans_lines(i);
SELECT *
FROM igc_cc_acct_lines
WHERE cc_acct_line_id = p_acct_line_id;
/* First Delete from zx_itm_distributions_gt table */
l_calling_sequence := 'IGC_ETAX_UTIL_PKG.Populate_Dist_GT';
DELETE FROM zx_itm_distributions_gt
WHERE application_id = IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID
AND entity_code = IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE
AND event_class_code = IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE
AND trx_id = P_CC_Header_Rec.cc_header_id
AND TRX_LEVEL_TYPE = IGC_ETAX_UTIL_PKG.IGC_TRX_LEVEL_TYPE ;
Put_Debug_Msg (l_full_path,p_debug_msg => 'Calling insert into zx_itm_distributions_gt');
INSERT INTO zx_itm_distributions_gt(
application_id
,entity_code
,event_class_code
,trx_id
,trx_line_id
,trx_level_type
,trx_line_dist_id
,dist_level_action
,trx_line_dist_date
,item_dist_number
,task_id
,award_id
,project_id
,expenditure_type
,expenditure_organization_id
,expenditure_item_date
,trx_line_dist_amt
,trx_line_dist_qty
,trx_line_quantity
,account_ccid
,currency_exchange_rate
,overriding_recovery_rate
)
Values
(
IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID --application_id
,IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE --entity_code
,IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE --event_class_code
,P_CC_Header_Rec.cc_header_id --trx_id
,l_cc_lines.cc_acct_line_id --trx_line_id
,IGC_ETAX_UTIL_PKG.IGC_TRX_LEVEL_TYPE --trx_level_type
,1 --trx_line_dist_id /* We cal always insert trx_line_dist_id as 1. Only one distribution is required for each call */
,'CREATE' --dist_level_action
,sysdate --trx_line_dist_date
,l_cc_lines.cc_acct_line_num --item_dist_number
,null --task_id
,null --award_id
,l_cc_lines.project_id
,null --expenditure_type
,null --expenditure_organization_id
,null --expenditure_item_date
,nvl(p_amount,0) --trx_line_dist_amt
,1 --trx_line_dist_qty
,1 --trx_line_quantity
,l_cc_lines.cc_charge_code_combination_id --account_ccid
,null --currency_exchange_rate
,null --overriding_recovery_rate
);
Put_Debug_Msg (l_full_path,p_debug_msg => 'Insert into zx_itm_distributions_gt complete');
select hrop.default_legal_context_id from
hr_operating_units hrop
where hrop.organization_id=p_org_id;
SELECT location_id
INTO G_ORG_LOC_ID
FROM HR_ALL_ORGANIZATION_UNITS
WHERE organization_id = p_cc_header_rec.org_id;
/* Update zx_trx_headers_gt to set event code to "DISTRIBUTED" */
UPDATE zx_trx_headers_gt
set event_type_code = 'DISTRIBUTED'
WHERE application_id = IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID
AND entity_code = IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE
AND event_class_code = IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE
AND trx_id = P_CC_Header_Rec.cc_header_id;
SELECT nvl(SUM(rec_nrec_tax_amt),0)
INTO l_tax_amount
FROM ZX_REC_NREC_DIST_GT
WHERE application_id = IGC_ETAX_UTIL_PKG.IGC_APPLICATION_ID --'8407'
AND entity_code =IGC_ETAX_UTIL_PKG.IGC_ENTITY_CODE --'IGC_CC_HEADERS'
AND event_class_code =IGC_ETAX_UTIL_PKG.IGC_EVENT_CLASS_CODE --'PURCHASE_TRANSACTION_TAX_QUOTE'
AND trx_id = P_CC_Header_Rec.cc_header_id
AND trx_line_id = p_line_id
AND trx_level_type = IGC_ETAX_UTIL_PKG.IGC_TRX_LEVEL_TYPE --'LINE'
AND recoverable_flag = 'N';