The following lines contain the word 'select', 'insert', 'update' or 'delete':
insert into IGW_budget_details(
proposal_id
,version_id
,budget_period_id
,line_item_id
,expenditure_type
,budget_category_code
,expenditure_category_flag
,line_item_description
,based_on_line_item
,line_item_cost
,cost_sharing_amount
,underrecovery_amount
,apply_inflation_flag
,budget_justification
,location_code
,record_version_number
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login )
values (
l_proposal_id
,l_version_id
,l_budget_period_id
,igw_budget_details_s.nextval
,l_expenditure_type
,l_budget_category_code
,l_expenditure_category_flag
,l_line_item_description
,l_based_on_line_item
,l_line_item_cost
,l_cost_sharing_amount
,l_underrecovery_amount
,l_apply_inflation_flag
,l_budget_justification
,l_location_code
,1
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
insert into igw_budget_personnel_cal_amts (
budget_personnel_detail_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,record_version_number
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values(
l_budget_personnel_detail_id
,l_rate_class_id
,l_rate_type_id
,l_apply_rate_flag
,l_calculated_cost
,l_calculated_cost_sharing
,1
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,record_version_number
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
p_proposal_id
,p_version_id
,p_budget_period_id
,p_line_item_id
,p_rate_class_id
,p_rate_type_id
,p_apply_rate_flag
,p_calculated_cost
,p_calculated_cost_sharing
,1
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select apply_inflation_setup_rates
, apply_eb_setup_rates
, apply_oh_setup_rates
, enter_budget_at_period_level
from igw_budgets
where proposal_id = p_proposal_id
and version_id = p_version_id;
select count(*)
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
select pbd.proposal_id
, pbd.version_id
, pbd.budget_period_id
, pbd.line_item_id
, pbd.expenditure_type
, pbd.budget_category_code
, pbd.expenditure_category_flag
, pbd.line_item_description
, pbd.line_item_cost
, pbd.cost_sharing_amount
, pbd.underrecovery_amount
, pbd.apply_inflation_flag
, pbd.budget_justification
, pbd.location_code
, et.personnel_attached_flag
from igw_budget_details pbd
, igw_budget_expenditures_v et
where pbd.expenditure_type = et.budget_expenditure
and pbd.expenditure_category_flag = et.expenditure_category_flag
and pbd.proposal_id = p_proposal_id
and pbd.budget_period_id = p_budget_period_id
and pbd.version_id = p_version_id;
select budget_personnel_detail_id
, line_item_id
, person_id
, party_id
, start_date
, end_date
, period_type_code
, appointment_type_code
, salary_requested
, percent_charged
, percent_effort
, cost_sharing_percent
, underrecovery_amount
from igw_budget_personnel_details
where line_item_id = l_line_item_id;
select '1'
into l_value
from igw_budget_details pbd
where pbd.proposal_id = p_proposal_id
and pbd.version_id = p_version_id
and pbd.budget_period_id <> 1
and rownum < 2;
select apply_rate_flag
into l_apply_rate_flag_oh
from igw_budget_details_cal_amts
where line_item_id = rec_budget_details.line_item_id;
select start_date, end_date
into l_budget_start_date
, l_budget_end_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = l_budget_period_id;
select max(end_date)
into l_budget_end_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,l_budget_period_id
,igw_budget_details_s.currval
,l_rate_class_id_oh
,l_rate_type_id_oh
,l_apply_rate_flag_oh
,nvl(l_oh_value_ov,0)
,nvl(l_calculated_cost_share_ov,0)
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select max(end_date), max(start_date)
into l_max_budget_end_date, l_max_budget_start_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
select '1'
into l_dummy_value
from igw_budget_periods
where ((end_date-start_date) < 364 or (end_date-start_date) > 365)
--and start_date <> l_max_budget_start_date
and proposal_id = p_proposal_id
and version_id = p_version_id
and rownum <2;
select start_date, end_date
into l_budget_start_date
, l_budget_end_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = l_budget_period_id;
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,l_budget_period_id
,igw_budget_details_s.currval
,l_rate_class_id_oh
,l_rate_type_id_oh
,l_apply_rate_flag_oh
,0
,0
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,l_budget_period_id
,igw_budget_details_s.currval
,l_rate_class_id_eb
,l_rate_type_id_eb
,l_apply_rate_flag_eb
,0
,0
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select pca.apply_rate_flag
into l_apply_rate_flag_oh
from igw_budget_personnel_cal_amts pca
, igw_budget_personnel_details pbd
where pbd.budget_personnel_detail_id = rec_budget_personnel.budget_personnel_detail_id
and pca.budget_personnel_detail_id = pbd.budget_personnel_detail_id
and pca.rate_class_id = (select pr.rate_class_id
from igw_rate_classes pr
where pca.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'O');
select pca.apply_rate_flag
into l_apply_rate_flag_eb
from igw_budget_personnel_cal_amts pca
, igw_budget_personnel_details pbd
where pbd.budget_personnel_detail_id = rec_budget_personnel.budget_personnel_detail_id
and pca.budget_personnel_detail_id = pbd.budget_personnel_detail_id
and pca.rate_class_id = (select pr.rate_class_id
from igw_rate_classes pr
where pca.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'E');
select calculation_base
, effective_date
, appointment_type_code
into l_calculation_base
, l_effective_date
, l_appointment_type_code
from igw_budget_persons
where proposal_id = p_proposal_id
and version_id = p_version_id
--and person_id = rec_budget_personnel.person_id
and party_id = rec_budget_personnel.party_id
and appointment_type_code = rec_budget_personnel.appointment_type_code;
insert into igw_budget_personnel_details (
budget_personnel_detail_id
,proposal_id
,version_id
,budget_period_id
,line_item_id
,person_id
,party_id
,start_date
,end_date
,period_type_code
,appointment_type_code
,salary_requested
,percent_charged
,percent_effort
,cost_sharing_percent
,cost_sharing_amount
,underrecovery_amount
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
igw_budget_personnel_s.nextval
,rec_budget_details.proposal_id
,rec_budget_details.version_id
,l_budget_period_id
,igw_budget_details_s.currval
,rec_budget_personnel.person_id
,rec_budget_personnel.party_id
,l_personnel_start_date
,l_personnel_end_date
,rec_budget_personnel.period_type_code
,rec_budget_personnel.appointment_type_code
,l_inflated_salary_ov
,rec_budget_personnel.percent_charged
,rec_budget_personnel.percent_effort
,rec_budget_personnel.cost_sharing_percent
,rec_budget_personnel.cost_sharing_percent/100 *l_inflated_salary_ov
,l_oh_value_ov - l_oh_value
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select igw_budget_personnel_s.currval into l_dummy_personnel_id from dual;
select igw_budget_details_s.currval
into l_line_item_seq
from dual;
update igw_budget_details_cal_amts pdc
set pdc.calculated_cost =
(select nvl(sum(ppc.calculated_cost),0)
from igw_budget_personnel_cal_amts ppc
, igw_budget_personnel_details ppd
, igw_budget_details pd
where pd.line_item_id = ppd.line_item_id
and ppd.budget_personnel_detail_id =ppc.budget_personnel_detail_id
and pd.proposal_id = p_proposal_id
and pd.version_id = p_version_id
and pd.budget_period_id = l_budget_period_id
and pd.line_item_id = l_line_item_seq
and ppc.rate_class_id = pdc.rate_class_id
and ppc.rate_type_id = pdc.rate_type_id)
, pdc.calculated_cost_sharing =
(select nvl(sum(ppc.calculated_cost_sharing),0)
from igw_budget_personnel_cal_amts ppc
, igw_budget_personnel_details ppd
, igw_budget_details pd
where pd.line_item_id = ppd.line_item_id
and ppd.budget_personnel_detail_id = ppc.budget_personnel_detail_id
and pd.proposal_id = p_proposal_id
and pd.version_id = p_version_id
and pd.budget_period_id = l_budget_period_id
and pd.line_item_id = l_line_item_seq
and ppc.rate_class_id = pdc.rate_class_id
and ppc.rate_type_id = pdc.rate_type_id)
where pdc.line_item_id = l_line_item_seq;
update igw_budget_details pdb
set line_item_cost =
(select nvl(sum(salary_requested),0)
from igw_budget_personnel_details ppd
where ppd.line_item_id = l_line_item_seq)
, cost_sharing_amount =
(select nvl(sum(cost_sharing_amount),0)
from igw_budget_personnel_details ppd
where ppd.line_item_id = l_line_item_seq)
where pdb.line_item_id = l_line_item_seq;
select nvl(sum(line_item_cost),0)
, nvl(sum(cost_sharing_amount),0)
, nvl(sum(underrecovery_amount),0)
into l_direct_cost1
, l_cost_share1
, l_underrecovery
from igw_budget_details
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i+1;
select nvl(sum(calculated_cost_sharing),0)
, nvl(sum(calculated_cost),0)
into l_cost_share2
, l_indirect_cost
from igw_budget_details_cal_amts pc
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i+1
and pc.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pc.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'O');
select nvl(sum(calculated_cost_sharing),0)
, nvl(sum(calculated_cost),0)
into l_cost_share3
, l_direct_cost2
from igw_budget_details_cal_amts pc
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i+1
and pc.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pc.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'E');
update igw_budget_periods
set total_cost = (l_direct_cost1+l_direct_cost2+l_indirect_cost)
, total_direct_cost = (l_direct_cost1+l_direct_cost2)
, total_indirect_cost = l_indirect_cost
, cost_sharing_amount = (l_cost_share1+l_cost_share2+l_cost_share3)
, underrecovery_amount = l_underrecovery
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i+1;
select nvl(sum(total_cost),0)
, nvl(sum(total_direct_cost),0)
, nvl(sum(total_indirect_cost),0)
, nvl(sum(cost_sharing_amount),0)
, nvl(sum(underrecovery_amount),0)
, nvl(sum(total_cost_limit),0)
into l_total_cost
, l_total_direct_cost
, l_total_indirect_cost
, l_cost_sharing_amt
, l_underrecovery_amount
, l_total_cost_limit
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
update igw_budgets
set total_cost = l_total_cost
, total_direct_cost = l_total_direct_cost
, total_indirect_cost = l_total_indirect_cost
, cost_sharing_amount = l_cost_sharing_amt
, underrecovery_amount = l_underrecovery_amount
, total_cost_limit = l_total_cost_limit
where proposal_id = p_proposal_id
and version_id = p_version_id;
select count(*)
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id > p_budget_period_id;
select pbd.proposal_id
, pbd.version_id
, pbd.expenditure_type
, pbd.budget_category_code
, pbd.expenditure_category_flag
, pbd.line_item_id
, pbd.line_item_description
, pbd.line_item_cost
, pbd.cost_sharing_amount
, pbd.underrecovery_amount
, pbd.apply_inflation_flag
, pbd.budget_justification
, pbd.location_code
, et.personnel_attached_flag
from igw_budget_details pbd
, igw_budget_expenditures_v et
where pbd.expenditure_type = et.budget_expenditure
and pbd.expenditure_category_flag = et.expenditure_category_flag
and pbd.line_item_id = p_line_item_id;
select budget_personnel_detail_id
, line_item_id
, person_id
, party_id
, start_date
, end_date
, period_type_code
, appointment_type_code
, salary_requested
, percent_charged
, percent_effort
, cost_sharing_percent
, underrecovery_amount
from igw_budget_personnel_details
where line_item_id = l_line_item_id;
select apply_rate_flag
into l_apply_rate_flag_oh
from igw_budget_details_cal_amts
where line_item_id = rec_budget_details.line_item_id;
select distinct based_on_line_item
into l_dummy_based_on
from igw_budget_details
where based_on_line_item = rec_budget_details.line_item_id;
delete from igw_budget_details_cal_amts
where line_item_id IN (select line_item_id
from igw_budget_details pd
where pd.based_on_line_item = l_dummy_based_on);
delete from igw_budget_details
where based_on_line_item = l_dummy_based_on;
select start_date, end_date
into l_budget_start_date
, l_budget_end_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i;
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,i
,igw_budget_details_s.currval
,l_rate_class_id_oh
,l_rate_type_id_oh
,l_apply_rate_flag_oh
,l_oh_value
,l_calculated_cost_share
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select max(end_date), max(start_date)
into l_max_budget_end_date, l_max_budget_start_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
select '1'
into l_dummy_value
from igw_budget_periods
where ((end_date-start_date) < 364 or (end_date-start_date) > 365)
--and start_date <> l_max_budget_start_date
and proposal_id = p_proposal_id
and version_id = p_version_id
and rownum <2;
select distinct based_on_line_item
into l_dummy_based_on
from igw_budget_details
where based_on_line_item = rec_budget_details.line_item_id;
delete from igw_budget_personnel_cal_amts
where budget_personnel_detail_id IN (select budget_personnel_detail_id
from igw_budget_details pd
, igw_budget_personnel_details ppd
where pd.line_item_id = ppd.line_item_id
and pd.based_on_line_item = l_dummy_based_on);
delete from igw_budget_personnel_details
where line_item_id IN (select line_item_id
from igw_budget_details pd
where pd.based_on_line_item = l_dummy_based_on);
delete from igw_budget_details_cal_amts
where line_item_id IN (select line_item_id
from igw_budget_details pd
where pd.based_on_line_item = l_dummy_based_on);
delete from igw_budget_details
where based_on_line_item = l_dummy_based_on;
select start_date, end_date
into l_budget_start_date
, l_budget_end_date
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i;
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,i
,igw_budget_details_s.currval
,l_rate_class_id_oh
,l_rate_type_id_oh
,'Y'
,0
,0
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
insert into igw_budget_details_cal_amts (
proposal_id
,version_id
,budget_period_id
,line_item_id
,rate_class_id
,rate_type_id
,apply_rate_flag
,calculated_cost
,calculated_cost_sharing
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
rec_budget_details.proposal_id
,rec_budget_details.version_id
,i
,igw_budget_details_s.currval
,l_rate_class_id_eb
,l_rate_type_id_eb
,'Y'
,0
,0
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select pca.apply_rate_flag
into l_apply_rate_flag_oh
from igw_budget_personnel_cal_amts pca
, igw_budget_personnel_details pbd
where pbd.budget_personnel_detail_id = rec_budget_personnel.budget_personnel_detail_id
and pca.budget_personnel_detail_id = pbd.budget_personnel_detail_id
and pca.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pca.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'O');
select pca.apply_rate_flag
into l_apply_rate_flag_eb
from igw_budget_personnel_cal_amts pca
, igw_budget_personnel_details pbd
where pbd.budget_personnel_detail_id = rec_budget_personnel.budget_personnel_detail_id
and pca.budget_personnel_detail_id = pbd.budget_personnel_detail_id
and pca.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pca.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'E');
select calculation_base
, effective_date
, appointment_type_code
into l_calculation_base
, l_effective_date
, l_appointment_type_code
from igw_budget_persons
where proposal_id = p_proposal_id
and version_id = p_version_id
--and person_id = rec_budget_personnel.person_id
and party_id = rec_budget_personnel.party_id
and appointment_type_code = rec_budget_personnel.appointment_type_code;
insert into igw_budget_personnel_details (
budget_personnel_detail_id
,proposal_id
,version_id
,budget_period_id
,line_item_id
,person_id
,party_id
,start_date
,end_date
,period_type_code
,appointment_type_code
,salary_requested
,percent_charged
,percent_effort
,cost_sharing_percent
,cost_sharing_amount
,underrecovery_amount
,last_update_date
,last_updated_by
,creation_date
,created_by
,last_update_login)
values (
igw_budget_personnel_s.nextval
,rec_budget_details.proposal_id
,rec_budget_details.version_id
,i
,igw_budget_details_s.currval
,rec_budget_personnel.person_id
,rec_budget_personnel.party_id
,l_personnel_start_date
,l_personnel_end_date
,rec_budget_personnel.period_type_code
,rec_budget_personnel.appointment_type_code
,l_inflated_salary
,rec_budget_personnel.percent_charged
,rec_budget_personnel.percent_effort
,rec_budget_personnel.cost_sharing_percent
,rec_budget_personnel.cost_sharing_percent/100 * l_inflated_salary
,rec_budget_personnel.underrecovery_amount
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.login_id);
select igw_budget_personnel_s.currval into l_dummy_personnel_id from dual;
select igw_budget_details_s.currval
into l_line_item_seq
from dual;
update igw_budget_details_cal_amts pdc
set pdc.calculated_cost =
(select nvl(sum(ppc.calculated_cost),0)
from igw_budget_personnel_cal_amts ppc
, igw_budget_personnel_details ppd
, igw_budget_details pd
where pd.line_item_id = ppd.line_item_id
and ppd.budget_personnel_detail_id =ppc.budget_personnel_detail_id
and pd.proposal_id = p_proposal_id
and pd.version_id = p_version_id
and pd.budget_period_id = i
and pd.line_item_id = l_line_item_seq
and ppc.rate_class_id = pdc.rate_class_id
and ppc.rate_type_id = pdc.rate_type_id)
, pdc.calculated_cost_sharing =
(select nvl(sum(ppc.calculated_cost_sharing),0)
from igw_budget_personnel_cal_amts ppc
, igw_budget_personnel_details ppd
, igw_budget_details pd
where pd.line_item_id = ppd.line_item_id
and ppd.budget_personnel_detail_id = ppc.budget_personnel_detail_id
and pd.proposal_id = p_proposal_id
and pd.version_id = p_version_id
and pd.budget_period_id = i
and pd.line_item_id = l_line_item_seq
and ppc.rate_class_id = pdc.rate_class_id
and ppc.rate_type_id = pdc.rate_type_id)
where pdc.line_item_id = l_line_item_seq;
update igw_budget_details pdb
set line_item_cost =
(select nvl(sum(salary_requested),0)
from igw_budget_personnel_details ppd
where ppd.line_item_id = l_line_item_seq)
, cost_sharing_amount =
(select nvl(sum(cost_sharing_amount),0)
from igw_budget_personnel_details ppd
where ppd.line_item_id = l_line_item_seq)
where pdb.line_item_id = l_line_item_seq;
select nvl(sum(line_item_cost),0)
, nvl(sum(cost_sharing_amount),0)
, nvl(sum(underrecovery_amount),0)
into l_direct_cost1
, l_cost_share1
, l_underrecovery
from igw_budget_details
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i;
select nvl(sum(calculated_cost_sharing),0)
, nvl(sum(calculated_cost),0)
into l_cost_share2
, l_indirect_cost
from igw_budget_details_cal_amts pc
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i
and pc.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pc.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'O');
select nvl(sum(calculated_cost_sharing),0)
, nvl(sum(calculated_cost),0)
into l_cost_share3
, l_direct_cost2
from igw_budget_details_cal_amts pc
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i
and pc.rate_class_id = ( select pr.rate_class_id
from igw_rate_classes pr
where pc.rate_class_id = pr.rate_class_id
and pr.rate_class_type = 'E');
update igw_budget_periods
set total_cost = (l_direct_cost1+l_direct_cost2+l_indirect_cost)
, total_direct_cost = (l_direct_cost1+l_direct_cost2)
, total_indirect_cost = l_indirect_cost
, cost_sharing_amount = (l_cost_share1+l_cost_share2+l_cost_share3)
, underrecovery_amount = l_underrecovery
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = i;
select nvl(sum(total_cost),0)
, nvl(sum(total_direct_cost),0)
, nvl(sum(total_indirect_cost),0)
, nvl(sum(cost_sharing_amount),0)
, nvl(sum(underrecovery_amount),0)
, nvl(sum(total_cost_limit),0)
into l_total_cost
, l_total_direct_cost
, l_total_indirect_cost
, l_cost_sharing_amt
, l_underrecovery_amount
, l_total_cost_limit
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id;
update igw_budgets
set total_cost = l_total_cost
, total_direct_cost = l_total_direct_cost
, total_indirect_cost = l_total_indirect_cost
, cost_sharing_amount = l_cost_sharing_amt
, underrecovery_amount = l_underrecovery_amount
, total_cost_limit = l_total_cost_limit
where proposal_id = p_proposal_id
and version_id = p_version_id;
select total_cost
from igw_budget_periods
where proposal_id = p_proposal_id
and version_id = p_version_id
and budget_period_id = p_budget_period_id;
select calculated_cost
into l_calculated_cost
from igw_budget_details_cal_amts
where line_item_id = p_line_item_id;
select proposal_id
, version_id
, budget_period_id
, expenditure_category_flag
, expenditure_type
from igw_budget_details
where line_item_id = p_line_item_id;
select personnel_attached_flag
into l_personnel_attached_flag
from igw_expenditure_categories_v
where expenditure_category = l_expenditure_type;
select personnel_attached_flag
into l_personnel_attached_flag
from igw_expenditure_categories_v
where expenditure_category = (select expenditure_category from igw_expenditure_types_v
where expenditure_type = l_expenditure_type);
select activity_type_code
into l_activity_type_code
from igw_proposals_all
where proposal_id = l_proposal_id;
select total_cost_limit
into l_period_cost_limit
from igw_budget_periods
where proposal_id = l_proposal_id
and version_id = l_version_id
and budget_period_id = l_budget_period_id;
update igw_budget_details
set line_item_cost = nvl(l_new_line_item_cost, line_item_cost)
where line_item_id = p_line_item_id;
update igw_budget_details_cal_amts
set calculated_cost = nvl(l_new_calculated_cost, calculated_cost)
where line_item_id = p_line_item_id;
select line_item_cost
from igw_budget_details
where line_item_id = p_line_item_id;