|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
按客户统计:应收帐款余额(ar_payment_schedules_all. amount_due_remaining)
同时将金额转换成”本位币(CNY)“,ERP中有一汇率表 GL_DAILY_RATES,我的SQL为:
select aps.customer_id,
sum(nvl(aps.amount_due_remaining*gdr.conversion_rate, 0)) due_remaining
from ar_payment_schedules_all aps,
ra_customer_trx_all rct,
oe_order_headers_all head,
qp_list_headers_v qp,
GL_DAILY_RATES gdr
where 1 = 1
and aps.customer_trx_id = rct.customer_trx_id
and rct.ct_reference like '_1%'--取订单号的第二位为‘1’的订单
and head.order_number = rct.ct_reference
and head.price_list_id = qp.list_header_id(+)--与价目表关联取订单的币别
and qp.currency_code = gdr.from_currency
and gdr.to_currency='CNY'
and gdr.CONVERSION_TYPE = 'Corporate'
and gdr.conversion_date = trunc(sysdate) --这个条件如何写??
就是将订单对应的币别按对应的汇率转换成本位币,而汇率表是经常变的,应该是取与现今最近的一次转换为标准
group by aps.customer_id |
|