收款创建API
ar_receipt_api_pub.create_cash
以下部分关键代码,仅供学习参考
begin
v_user_id := fnd_global.user_id;
v_currency := 币种
v_receipt_number := 收款编号;
v_amount := 收款金额;
v_gl_date := GL日期;
v_account_number := 客户编号;
v_receitp_method := 收款方法名;
g_curreny := 币种;
v_org_id := imp_rpt.org_id;
---- 获取汇率日期
begin
select last_day(add_months(v_gl_date, -1))
into v_conversion_date
from dual;
select r.exchange_date
into v_conversion_date
from ra_customer_trx_all r
where r.trx_number = v_receipt_number;
exception
when others then
v_return_status := 'E';
v_error_message := '获取汇率日期异常' || sqlerrm;
raise fnd_api.g_exc_error;
end;
---- 获取汇率
begin
select g.currency_code
into v_b_currency
from hr_operating_units h, gl_sets_of_books g
where h.organization_id = v_org_id
and h.set_of_books_id = g.set_of_books_id;
if v_b_currency <> g_curreny then
select v.conversion_rate, v.user_conversion_type
into v_conversion_rate, v_rate_type
from gl_daily_rates_v v
where v.from_currency = g_curreny
and v.to_currency = v_b_currency
and v.user_conversion_type = 'Corporate'
and v.conversion_date = v_conversion_date;
else
v_rate_type := null;
v_conversion_date := null;
end if;
exception
when others then
v_return_status := 'E';
v_error_message := '获取汇率异常' || sqlerrm;
goto process_not_cny_end;
end;