|
|
发表于 2007/6/7 21:55:22
|
显示全部楼层
关于客户余额在AR管理员下菜单的客户账户下可以直接查询。但是查询的值仅限于当前客户的余额不能查历史某个时间点的客户余额。
以下给你提供一个SQL供你提取当前客户的客户余额。
在AR中客户余额=收款额-发票额
收款与发票的核销不影响客户余额。
- begin
- fnd_client_info.set_org_context(org_id);
- --org_id为ou的org_id,因为下面查询的客户余额是用了一个视图,所以需要首先初始化一下 org_id
- end;
- SELECT CUSTOMER_NAME,
- CUSTOMER_NUMBER,
- LOCATION,
- CURRENCY_CODE,
- CUSTOMER_STATUS,
- ACCOUNT_STATUS,
- PROFILE_CLASS,
- RISK_CODE,
- COLLECTOR_NAME,
- DSO,
- OVERALL_CREDIT_LIMIT,
- ORDER_CREDIT_LIMIT,
- CREDIT_AVAILABLE,
- PASTDUE_INVOICES,
- BALANCE,
- ACCTD_BALANCE,
- PASTDUE_BALANCE,
- ACCTD_PASTDUE_BALANCE,
- OPEN_CREDIT,
- ACCTD_OPEN_CREDIT,
- CUSTOMER_OR_LOCATION,
- ACCTD_OR_ENTERED,
- CUSTOMER_ID,
- CUSTOMER_SITE_USE_ID
- FROM AR_CUSTOMER_ACCOUNTS
- WHERE (CUSTOMER_NUMBER LIKE '客户编号')
- and (CUSTOMER_OR_LOCATION = 'C')
- and (ACCTD_OR_ENTERED = 'A')
- order by CUSTOMER_NAME, CUSTOMER_NUMBER, LOCATION;
复制代码 |
|