The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT pvr.lease_id,
pvr.var_rent_id,
pvr.rent_num,
pvr.invoice_on,
pvr.location_id,
pvr.currency_code,
pvr.term_template_id,
per.period_id,
per.period_num,
pl.lease_class_code,
pl.org_id
FROM pn_leases pl,
pn_lease_details_all pld,
pn_var_rents_all pvr,
pn_locations_all ploc,
pn_var_periods_all per
WHERE pl.lease_id = pvr.lease_id
AND pld.lease_id = pvr.lease_id
AND ploc.location_id = pvr.location_id
AND pvr.var_rent_id = per.var_rent_id
AND pl.lease_num >= nvl(p_lease_num_from, pl.lease_num)
AND pl.lease_num <= nvl(p_lease_num_to, pl.lease_num)
AND ploc.location_code >= nvl(p_location_code_from, ploc.location_code)
AND ploc.location_code <= nvl(p_location_code_to, ploc.location_code)
AND pvr.rent_num >= nvl(p_vrent_num_from,pvr.rent_num)
AND pvr.rent_num <= nvl(p_vrent_num_to,pvr.rent_num)
AND per.period_num >= nvl(p_period_num_from,per.period_num)
AND per.period_num <= nvl(p_period_num_to,period_num)
AND pld.responsible_user = nvl(p_responsible_user, pld.responsible_user)
AND (pl.org_id = p_org_id or p_org_id is null)
ORDER BY pl.lease_id, pvr.var_rent_id,per.period_num;
SELECT pvr.lease_id,
pvr.var_rent_id,
pvr.rent_num,
pvr.invoice_on,
pvr.location_id,
pvr.currency_code,
pvr.term_template_id,
per.period_id,
per.period_num,
pl.lease_class_code,
pl.org_id
FROM pn_var_rents_all pvr,
pn_leases pl,
pn_lease_details_all pld,
pn_var_periods_all per
WHERE pl.lease_id = pvr.lease_id
AND pld.lease_id = pvr.lease_id
AND pvr.var_rent_id = per.var_rent_id
AND pl.lease_num >= nvl(p_lease_num_from, pl.lease_num)
AND pl.lease_num <= nvl(p_lease_num_to, pl.lease_num)
AND pvr.rent_num >= nvl(p_vrent_num_from,pvr.rent_num)
AND pvr.rent_num <= nvl(p_vrent_num_to,pvr.rent_num)
AND per.period_num >= nvl(p_period_num_from,per.period_num)
AND per.period_num <= nvl(p_period_num_to,period_num)
AND pld.responsible_user = nvl(p_responsible_user, pld.responsible_user)
AND per.period_id = nvl(p_period_id,per.period_id)
AND (pl.org_id = p_org_id or p_org_id is null)
ORDER BY pl.lease_id,pvr.var_rent_id,per.period_num;
SELECT var_rent_id,
var_rent_inv_id,
invoice_date,
for_per_rent,
period_id
FROM pn_var_rent_inv_all
WHERE period_id = ip_period_id
AND adjust_num = 0
AND nvl(for_per_rent,0) <> 0
AND forecasted_exp_code = 'N'
AND forecasted_term_status = decode(p_period_id,null,'N','Y')
AND pn_variable_amount_pkg.find_if_term_exists(var_rent_inv_id,'FORECASTED') ='N'
AND invoice_date <= nvl(fnd_date.canonical_to_date(p_period_date),to_date('12/31/4712','mm/dd/yyyy'))
ORDER BY invoice_date;
SELECT var_rent_id,
var_rent_inv_id,
invoice_date,
adjust_num,
actual_invoiced_amount,
period_id,
credit_flag
FROM pn_var_rent_inv_all
WHERE period_id = ip_period_id
AND actual_exp_code = 'N'
AND nvl(actual_invoiced_amount,0) <> 0
AND actual_term_status = decode(p_period_id,null,'N','Y')
AND pn_variable_amount_pkg.find_if_term_exists(var_rent_inv_id,'ACTUAL') ='N'
AND invoice_date <= nvl(fnd_date.canonical_to_date(p_period_date),to_date('12/31/4712','mm/dd/yyyy'))
ORDER BY invoice_date;
SELECT inv.var_rent_id,
inv.var_rent_inv_id,
inv.adjust_num,
inv.invoice_date,
inv.period_id,
decode(inv.adjust_num,0,(inv.actual_invoiced_amount-NVL(inv.for_per_rent,0)),
inv.actual_invoiced_amount) act_for_amt
FROM pn_var_rent_inv_all inv
WHERE inv.period_id = ip_period_id
AND inv.variance_exp_code = 'N'
AND nvl(decode(inv.adjust_num,0,(inv.actual_invoiced_amount-NVL(inv.for_per_rent,0)),
inv.actual_invoiced_amount),0) <> 0
AND inv.variance_term_status = decode(p_period_id,null,'N','Y')
AND not exists (SELECT null
FROM pn_var_grp_dates_all gd
WHERE gd.invoice_date = inv.invoice_date
AND gd.period_id = inv.period_id
AND gd.var_rent_id = inv.var_rent_id
AND nvl(gd.forecasted_exp_code,'N') = 'N')
AND pn_variable_amount_pkg.find_if_term_exists(inv.var_rent_inv_id,'VARIANCE') = 'N'
AND invoice_date <= nvl(fnd_date.canonical_to_date(p_period_date),to_date('12/31/4712','mm/dd/yyyy'))
ORDER BY inv.invoice_date;
SELECT payment_term_id
FROM pn_payment_terms_all
WHERE var_rent_inv_id IN (SELECT var_rent_inv_id
FROM pn_var_rent_inv_all
WHERE invoice_date = p_invoice_date
AND var_rent_id = p_var_rent_id);
SELECT count(*) INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = rec_for_inv.var_rent_inv_id
AND var_rent_type = 'FORECASTED';
UPDATE pn_var_rent_inv_all
SET forecasted_term_status='Y',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_for_inv.var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET forecasted_term_status='N',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_for_inv.var_rent_inv_id;
SELECT count(*) INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = rec_var_inv.var_rent_inv_id
AND var_rent_type = 'VARIANCE';
UPDATE pn_var_rent_inv_all
SET variance_term_status='Y',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_var_inv.var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'Y'
WHERE var_rent_inv_id = rec_var_inv.var_rent_inv_id
AND true_up_status IS NOT NULL;
UPDATE pn_var_rent_inv_all
SET variance_term_status='N',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_var_inv.var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'N'
WHERE var_rent_inv_id = rec_var_inv.var_rent_inv_id
AND true_up_status IS NOT NULL;
SELECT count(*) INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id
AND var_rent_type = 'ACTUAL';
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'Y'
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id
AND true_up_status IS NOT NULL;
UPDATE pn_var_rent_inv_all
SET actual_term_status='N',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'N'
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id
AND true_up_status IS NOT NULL;
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y',
last_update_date = SYSDATE,
last_update_login = NVL(fnd_profile.value('LOGIN_ID'),0),
last_updated_by = NVL(fnd_profile.value('USER_ID'),0)
WHERE var_rent_inv_id = rec_act_inv.var_rent_inv_id
AND actual_term_status='N' ;
SELECT *
FROM pn_distributions_all
WHERE term_template_id = (SELECT term_template_id
FROM pn_var_rents_all
WHERE var_rent_id = p_var_rent_id);
SELECT *
FROM pn_term_templates_all
WHERE term_template_id = (SELECT term_template_id
FROM pn_var_rents_all
WHERE var_rent_id = p_var_rent_id);
SELECT currency_code
FROM pn_var_rents_all
WHERE var_rent_id = p_var_rent_id;
SELECT DISTINCT inv_start_date
FROM pn_var_grp_dates_all
WHERE var_rent_id = p_var_rent_id
AND invoice_date = p_invoice_date;*/
SELECT pl.lease_class_code,
pld.lease_change_id,
pl.org_id
INTO l_lease_class_code,
l_lease_change_id,
l_org_id
FROM pn_leases_all pl,
pn_lease_details_all pld
WHERE pl.lease_id = pld.lease_id
AND pld.lease_id = p_lease_id;
/*SELECT distinct inv_schedule_date
INTO l_payment_start_date
FROM pn_var_grp_dates_all
WHERE period_id = p_period_id
AND invoice_date = p_invoice_date;*/
l_context := 'Inserting into pn_payment_terms';
pnt_payment_terms_pkg.insert_row (
x_rowid => l_rowid
,x_payment_term_id => l_payment_term_id
,x_index_period_id => null
,x_index_term_indicator => null
,x_var_rent_inv_id => p_var_rent_inv_id
,x_var_rent_type => p_var_rent_type
,x_last_update_date => SYSDATE
,x_last_updated_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_creation_date => SYSDATE
,x_created_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_payment_purpose_code => rec_template.payment_purpose_code
,x_payment_term_type_code => rec_template.payment_term_type_code
,x_frequency_code => l_frequency
,x_lease_id => p_lease_id
,x_lease_change_id => l_lease_change_id
,x_start_date => l_payment_start_date
,x_end_date => l_payment_end_date
,x_set_of_books_id => NVL(rec_template.set_of_books_id,l_set_of_books_id)
--,x_currency_code => NVL(rec_template.currency_code, l_currency_code)
,x_currency_code => NVl(g_currency_code, l_currency_code)
,x_rate => 1 -- not used in application
,x_last_update_login => NVL(fnd_profile.value('LOGIN_ID'),0)
,x_vendor_id => rec_template.vendor_id
,x_vendor_site_id => rec_template.vendor_site_id
,x_target_date => NULL
,x_actual_amount => p_payment_amount
,x_estimated_amount => NULL
,x_attribute_category => rec_template.attribute_category
,x_attribute1 => rec_template.attribute1
,x_attribute2 => rec_template.attribute2
,x_attribute3 => rec_template.attribute3
,x_attribute4 => rec_template.attribute4
,x_attribute5 => rec_template.attribute5
,x_attribute6 => rec_template.attribute6
,x_attribute7 => rec_template.attribute7
,x_attribute8 => rec_template.attribute8
,x_attribute9 => rec_template.attribute9
,x_attribute10 => rec_template.attribute10
,x_attribute11 => rec_template.attribute11
,x_attribute12 => rec_template.attribute12
,x_attribute13 => rec_template.attribute13
,x_attribute14 => rec_template.attribute14
,x_attribute15 => rec_template.attribute15
,x_project_attribute_category => NULL
,x_project_attribute1 => NULL
,x_project_attribute2 => NULL
,x_project_attribute3 => NULL
,x_project_attribute4 => NULL
,x_project_attribute5 => NULL
,x_project_attribute6 => NULL
,x_project_attribute7 => NULL
,x_project_attribute8 => NULL
,x_project_attribute9 => NULL
,x_project_attribute10 => NULL
,x_project_attribute11 => NULL
,x_project_attribute12 => NULL
,x_project_attribute13 => NULL
,x_project_attribute14 => NULL
,x_project_attribute15 => NULL
,x_customer_id => rec_template.customer_id
,x_customer_site_use_id => rec_template.customer_site_use_id
,x_normalize => 'N'
,x_location_id => p_location_id
,x_schedule_day => l_schedule_day
,x_cust_ship_site_id => rec_template.cust_ship_site_id
,x_ap_ar_term_id => rec_template.ap_ar_term_id
,x_cust_trx_type_id => rec_template.cust_trx_type_id
,x_project_id => rec_template.project_id
,x_task_id => rec_template.task_id
,x_organization_id => rec_template.organization_id
,x_expenditure_type => rec_template.expenditure_type
,x_expenditure_item_date => rec_template.expenditure_item_date
,x_tax_group_id => rec_template.tax_group_id
,x_tax_code_id => rec_template.tax_code_id
,x_tax_classification_code => rec_template.tax_classification_code
,x_tax_included => rec_template.tax_included
,x_distribution_set_id => rec_template.distribution_set_id
,x_inv_rule_id => rec_template.inv_rule_id
,x_account_rule_id => rec_template.account_rule_id
,x_salesrep_id => rec_template.salesrep_id
,x_approved_by => NULL
,x_status => 'DRAFT'
,x_po_header_id => rec_template.po_header_id
,x_cust_po_number => rec_template.cust_po_number
,x_receipt_method_id => rec_template.receipt_method_id
,x_calling_form => 'PNXVAREN'
,x_org_id => l_org_id
,x_term_template_id => rec_template.term_template_id
,x_area => l_area
,x_area_type_code => l_area_type_code
,x_include_in_var_rent => NULL
);
l_context := 'Inserting into pn_distributions';
pn_distributions_pkg.insert_row (
x_rowid => l_rowid
,x_distribution_id => l_distribution_id
,x_account_id => rec_distributions.account_id
,x_payment_term_id => l_payment_term_id
,x_term_template_id => NULL
,x_account_class => rec_distributions.account_class
,x_percentage => rec_distributions.percentage
,x_line_number => rec_distributions.line_number
,x_last_update_date => SYSDATE
,x_last_updated_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_creation_date => SYSDATE
,x_created_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_last_update_login => NVL(fnd_profile.value('LOGIN_ID'),0)
,x_attribute_category => rec_distributions.attribute_category
,x_attribute1 => rec_distributions.attribute1
,x_attribute2 => rec_distributions.attribute2
,x_attribute3 => rec_distributions.attribute3
,x_attribute4 => rec_distributions.attribute4
,x_attribute5 => rec_distributions.attribute5
,x_attribute6 => rec_distributions.attribute6
,x_attribute7 => rec_distributions.attribute7
,x_attribute8 => rec_distributions.attribute8
,x_attribute9 => rec_distributions.attribute9
,x_attribute10 => rec_distributions.attribute10
,x_attribute11 => rec_distributions.attribute11
,x_attribute12 => rec_distributions.attribute12
,x_attribute13 => rec_distributions.attribute13
,x_attribute14 => rec_distributions.attribute14
,x_attribute15 => rec_distributions.attribute15
,x_org_id => l_org_id
);
SELECT count(*)
INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = p_var_rent_inv_id
AND var_rent_type = 'ACTUAL';
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'Y'
WHERE var_rent_inv_id = p_var_rent_inv_id
AND true_up_status IS NOT NULL;
UPDATE pn_var_rent_inv_all
SET actual_term_status='N'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'N'
WHERE var_rent_inv_id = p_var_rent_inv_id
AND true_up_status IS NOT NULL;
SELECT count(*)
INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = p_var_rent_inv_id
AND var_rent_type = 'ACTUAL';
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET actual_term_status='N'
WHERE var_rent_inv_id = p_var_rent_inv_id;
SELECT payment_status_lookup_code
FROM pn_payment_schedules_all
WHERE lease_id = p_lease_id
AND schedule_date = p_schedule_date;
SELECT line_item_id
FROM pn_var_lines_all
WHERE period_id = p_prd_id
ORDER BY line_item_id;
SELECT start_date, end_date, line_item_id
FROM pn_var_vol_hist_all vol,
(SELECT gd.period_id,
gd.grp_date_id
FROM pn_var_grp_dates_all gd
WHERE gd.period_id= p_prd_id
AND gd.invoice_date = p_inv_dt OR p_inv_dt IS NULL
)itemp
WHERE vol.grp_date_id = itemp.grp_date_id
AND vol.line_item_id = p_line_id
AND vol.period_id = itemp.period_id
AND vol_hist_status_code = 'APPROVED'
AND actual_amount IS NOT NULL
ORDER BY start_date,end_date;
SELECT start_date, end_date, line_item_id
FROM pn_var_vol_hist_all vol,
(SELECT gd.period_id,
gd.grp_date_id
FROM pn_var_grp_dates_all gd
WHERE gd.period_id= p_prd_id
AND gd.invoice_date <= p_inv_dt
)itemp
WHERE vol.grp_date_id = itemp.grp_date_id
AND vol.line_item_id = p_line_id
AND vol.period_id = itemp.period_id
AND vol_hist_status_code = 'APPROVED'
AND actual_amount IS NOT NULL
AND start_date <= p_end_dt
ORDER BY start_date,end_date;
SELECT start_date, end_date, line_item_id
FROM pn_var_vol_hist_all vol,
(SELECT gd.period_id,
gd.grp_date_id
FROM pn_var_grp_dates_all gd
WHERE gd.period_id= p_prd_id
AND gd.invoice_date >= p_inv_dt
)itemp
WHERE vol.grp_date_id = itemp.grp_date_id
AND vol.line_item_id = p_line_id
AND vol.period_id = itemp.period_id
AND vol_hist_status_code = 'APPROVED'
AND actual_amount IS NOT NULL
AND end_date >= p_st_dt
ORDER BY start_date,end_date;
SELECT proration_rule, commencement_date, termination_date
FROM pn_var_rents_all
WHERE var_rent_id = p_vr_id;
SELECT period_id, period_num, start_date, end_date
FROM pn_var_periods_all
WHERE partial_period='Y'
AND var_rent_id = p_vr_id;
SELECT inv_start_date ,inv_end_date
FROM pn_var_grp_dates_all
WHERE period_id = p_prd_id
AND invoice_date = p_inv_dt;
vol_hist_tab.DELETE;
vol_hist_tab.DELETE;
vol_hist_tab.DELETE;
SELECT period_id
FROM pn_var_periods_all
WHERE var_rent_id = p_vr_id
AND p_date BETWEEN start_date AND end_date;
SELECT line_item_id
FROM pn_var_lines_all
WHERE line_default_id IN ( SELECT line_default_id
FROM pn_var_lines_all
WHERE line_item_id=p_line_id
)
AND period_id = p_prd_id;
SELECT invoice_date
FROM pn_var_grp_dates_all
WHERE period_id = p_prd_id
AND p_date BETWEEN inv_start_date AND inv_end_date ;
SELECT line_item_id
FROM pn_var_lines_all
WHERE period_id = p_prd_id
ORDER BY line_item_id;
SELECT start_date, end_date, line_item_id
FROM pn_var_vol_hist_all vol,
(SELECT gd.period_id,
gd.grp_date_id
FROM pn_var_grp_dates_all gd
WHERE gd.period_id= p_prd_id
AND gd.invoice_date = p_inv_dt OR p_inv_dt IS NULL
)itemp
WHERE vol.grp_date_id = itemp.grp_date_id
AND vol.line_item_id = p_line_id
AND vol.period_id = itemp.period_id
AND vol_hist_status_code = 'APPROVED'
AND forecasted_amount IS NOT NULL
ORDER BY start_date,end_date;
SELECT start_date, end_date, line_item_id
FROM pn_var_vol_hist_all vol,
(SELECT gd.period_id,
gd.grp_date_id
FROM pn_var_grp_dates_all gd
WHERE gd.period_id= p_prd_id
AND gd.invoice_date = p_inv_dt OR p_inv_dt IS NULL
)itemp
WHERE vol.grp_date_id = itemp.grp_date_id
AND vol.line_item_id = p_line_id
AND vol.period_id = itemp.period_id
AND vol_hist_status_code = 'APPROVED'
AND actual_amount IS NOT NULL
ORDER BY start_date,end_date;
SELECT period_id, period_num, start_date, end_date
FROM pn_var_periods_all
WHERE partial_period='Y'
AND var_rent_id = p_vr_id;
SELECT inv_start_date ,inv_end_date
FROM pn_var_grp_dates_all
WHERE period_id = p_prd_id
AND invoice_date = p_inv_dt;
vol_hist_tab.DELETE;
SELECT *
FROM pn_distributions_all
WHERE payment_term_id = p_payment_term_id;
SELECT *
FROM pn_payment_terms_all
WHERE payment_term_id = p_payment_term_id;
pnt_payment_terms_pkg.insert_row (
x_rowid => l_rowid
,x_payment_term_id => l_payment_term_id
,x_index_period_id => payment_term_rec.index_period_id
,x_index_term_indicator => payment_term_rec.index_term_indicator
,x_var_rent_inv_id => p_var_rent_inv_id
,x_var_rent_type => p_var_rent_type
,x_last_update_date => SYSDATE
,x_last_updated_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_creation_date => SYSDATE
,x_created_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_payment_purpose_code => payment_term_rec.payment_purpose_code
,x_payment_term_type_code => payment_term_rec.payment_term_type_code
,x_frequency_code => payment_term_rec.frequency_code
,x_lease_id => payment_term_rec.lease_id
,x_lease_change_id => payment_term_rec.lease_change_id
,x_start_date => payment_term_rec.start_date
,x_end_date => payment_term_rec.end_date
,x_set_of_books_id => payment_term_rec.set_of_books_id
,x_currency_code => payment_term_rec.currency_code
,x_rate => payment_term_rec.rate
,x_last_update_login => NVL(fnd_profile.value('LOGIN_ID'),0)
,x_vendor_id => payment_term_rec.vendor_id
,x_vendor_site_id => payment_term_rec.vendor_site_id
,x_target_date => NULL
,x_actual_amount => -(payment_term_rec.actual_amount)
,x_estimated_amount => NULL
,x_attribute_category => payment_term_rec.attribute_category
,x_attribute1 => payment_term_rec.attribute1
,x_attribute2 => payment_term_rec.attribute2
,x_attribute3 => payment_term_rec.attribute3
,x_attribute4 => payment_term_rec.attribute4
,x_attribute5 => payment_term_rec.attribute5
,x_attribute6 => payment_term_rec.attribute6
,x_attribute7 => payment_term_rec.attribute7
,x_attribute8 => payment_term_rec.attribute8
,x_attribute9 => payment_term_rec.attribute9
,x_attribute10 => payment_term_rec.attribute10
,x_attribute11 => payment_term_rec.attribute11
,x_attribute12 => payment_term_rec.attribute12
,x_attribute13 => payment_term_rec.attribute13
,x_attribute14 => payment_term_rec.attribute14
,x_attribute15 => payment_term_rec.attribute15
,x_project_attribute_category => NULL
,x_project_attribute1 => NULL
,x_project_attribute2 => NULL
,x_project_attribute3 => NULL
,x_project_attribute4 => NULL
,x_project_attribute5 => NULL
,x_project_attribute6 => NULL
,x_project_attribute7 => NULL
,x_project_attribute8 => NULL
,x_project_attribute9 => NULL
,x_project_attribute10 => NULL
,x_project_attribute11 => NULL
,x_project_attribute12 => NULL
,x_project_attribute13 => NULL
,x_project_attribute14 => NULL
,x_project_attribute15 => NULL
,x_customer_id => payment_term_rec.customer_id
,x_customer_site_use_id => payment_term_rec.customer_site_use_id
,x_normalize => 'N'
,x_location_id => payment_term_rec.location_id
,x_schedule_day => payment_term_rec.schedule_day
,x_cust_ship_site_id => payment_term_rec.cust_ship_site_id
,x_ap_ar_term_id => payment_term_rec.ap_ar_term_id
,x_cust_trx_type_id => payment_term_rec.cust_trx_type_id
,x_project_id => payment_term_rec.project_id
,x_task_id => payment_term_rec.task_id
,x_organization_id => payment_term_rec.organization_id
,x_expenditure_type => payment_term_rec.expenditure_type
,x_expenditure_item_date => payment_term_rec.expenditure_item_date
,x_tax_group_id => payment_term_rec.tax_group_id
,x_tax_code_id => payment_term_rec.tax_code_id
,x_tax_classification_code => payment_term_rec.tax_classification_code
,x_tax_included => payment_term_rec.tax_included
,x_distribution_set_id => payment_term_rec.distribution_set_id
,x_inv_rule_id => payment_term_rec.inv_rule_id
,x_account_rule_id => payment_term_rec.account_rule_id
,x_salesrep_id => payment_term_rec.salesrep_id
,x_approved_by => NULL
,x_status => 'DRAFT'
,x_po_header_id => payment_term_rec.po_header_id
,x_cust_po_number => payment_term_rec.cust_po_number
,x_receipt_method_id => payment_term_rec.receipt_method_id
,x_calling_form => 'PNXVAREN'
,x_org_id => payment_term_rec.org_id
,x_term_template_id => payment_term_rec.term_template_id
,x_area => payment_term_rec.area
,x_area_type_code => payment_term_rec.area_type_code
,x_include_in_var_rent => NULL
);
l_context := 'Inserting into pn_distributions';
pn_distributions_pkg.insert_row (
x_rowid => l_rowid
,x_distribution_id => l_distribution_id
,x_account_id => rec_distributions.account_id
,x_payment_term_id => l_payment_term_id
,x_term_template_id => NULL
,x_account_class => rec_distributions.account_class
,x_percentage => rec_distributions.percentage
,x_line_number => rec_distributions.line_number
,x_last_update_date => SYSDATE
,x_last_updated_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_creation_date => SYSDATE
,x_created_by => NVL (fnd_profile.VALUE ('USER_ID'), 0)
,x_last_update_login => NVL(fnd_profile.value('LOGIN_ID'),0)
,x_attribute_category => rec_distributions.attribute_category
,x_attribute1 => rec_distributions.attribute1
,x_attribute2 => rec_distributions.attribute2
,x_attribute3 => rec_distributions.attribute3
,x_attribute4 => rec_distributions.attribute4
,x_attribute5 => rec_distributions.attribute5
,x_attribute6 => rec_distributions.attribute6
,x_attribute7 => rec_distributions.attribute7
,x_attribute8 => rec_distributions.attribute8
,x_attribute9 => rec_distributions.attribute9
,x_attribute10 => rec_distributions.attribute10
,x_attribute11 => rec_distributions.attribute11
,x_attribute12 => rec_distributions.attribute12
,x_attribute13 => rec_distributions.attribute13
,x_attribute14 => rec_distributions.attribute14
,x_attribute15 => rec_distributions.attribute15
,x_org_id => rec_distributions.org_id
);
SELECT count(*)
INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = p_var_rent_inv_id
AND var_rent_type = 'ACTUAL';
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'Y'
WHERE var_rent_inv_id = p_var_rent_inv_id
AND true_up_status IS NOT NULL;
UPDATE pn_var_rent_inv_all
SET actual_term_status='N'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET true_up_status = 'N'
WHERE var_rent_inv_id = p_var_rent_inv_id
AND true_up_status IS NOT NULL;
SELECT count(*)
INTO term_count
FROM pn_payment_terms_all
WHERE var_rent_inv_id = p_var_rent_inv_id
AND var_rent_type = 'ACTUAL';
UPDATE pn_var_rent_inv_all
SET actual_term_status='Y'
WHERE var_rent_inv_id = p_var_rent_inv_id;
UPDATE pn_var_rent_inv_all
SET actual_term_status='N'
WHERE var_rent_inv_id = p_var_rent_inv_id;