事务处理及收款常用更新
1:事务处理更新客户
此更新系统未提供API,如果事务的的科目与客户相关,请先确认更新客户是否会与科目产生影响,如果有影响,请科目一起更新;
事务处理中与客户相关有2个表:分别是ra_customer_trx_all 、ar_payment_schedules_all
1.获取客户信息
select distinct hca.cust_account_id,hca.cust_account_id,hcua.site_use_id,hcua.site_use_id,hca.cust_account_id,hcua.site_use_idinto l_sold_to_customer_id,l_bill_to_customer_id,l_bill_to_site_use_id,l_bill_to_address_id,l_paying_customer_id,l_paying_site_use_idfrom hz_cust_accounts hca,hz_party_sites hps,hz_cust_acct_sites_all hcaa,hz_cust_site_uses_all hcua,hz_parties hpwhere hca.party_id = hps.party_idand hps.party_site_id = hcaa.party_site_idand hcaa.cust_acct_site_id = hcua.cust_acct_site_idand hcua.status = hca.statusand hcaa.status = hca.statusand hps.status = hca.statusand hca.status = 'A'and hp.party_id = hca.party_idand hcua.org_id = l_org_idand hp.known_as = l_known_as;
2、更新 ra_customer_trx_all
update ra_customer_trx_all rctaset rcta.sold_to_customer_id = l_sold_to_customer_id,rcta.bill_to_customer_id = l_bill_to_customer_id,rcta.bill_to_site_use_id = l_bill_to_site_use_id,rcta.bill_to_address_id = l_bill_to_address_id,rcta.paying_customer_id = l_paying_customer_id,rcta.paying_site_use_id = l_paying_site_use_idwhere rcta.customer_trx_id = l_customer_trx_id;
3、更新 AR_PAYMENT_SCHEDULES_ALL
update ar_payment_schedules_all apsaset apsa.customer_id = l_paying_customer_id,apsa.customer_site_use_id = l_paying_site_use_idwhere apsa.customer_trx_id = l_customer_trx_id;
2:事务处理更新GL日期
GL日期与期间相关,更新前请确认该发票是否传送至总账,GL日期的变化是否会对总账的日记账发送额产生影响;
与GL日期相关的表:
ra_customer_trx_all、
ar_payment_schedules_all、
ra_cust_trx_line_gl_dist_all、
xla_events
1、更新 ra_customer_trx_all 表
update ra_customer_trx_all rset r.creation_date = rpt_u.md_gl_date,r.last_update_date = rpt_u.md_gl_date,r.trx_date = rpt_u.md_gl_datewhere r.customer_trx_id = rpt_u.customer_trx_id;
2、更新 ar_payment_schedules_all表
update ar_payment_schedules_all pset p.creation_date = rpt_u.md_gl_date,p.last_update_date = rpt_u.md_gl_date,p.trx_date = rpt_u.md_gl_date,p.gl_date = rpt_u.md_gl_date,p.program_update_date = rpt_u.md_gl_datewhere p.customer_trx_id = rpt_u.customer_trx_id;
3、更新 ra_cust_trx_line_gl_dist_all表
update ra_cust_trx_line_gl_dist_all pset p.creation_date = rpt_u.md_gl_date,p.last_update_date = rpt_u.md_gl_date,p.gl_date = rpt_u.md_gl_datewhere p.customer_trx_id = rpt_u.customer_trx_id;
4、更新 xla_events表
update xla_events pset p.creation_date = rpt_u.md_gl_date,p.last_update_date = rpt_u.md_gl_date,p.event_date = rpt_u.md_gl_date,p.program_update_date = rpt_u.md_gl_date,p.transaction_date = rpt_u.md_gl_datewhere p.event_id = rpt_u.event_id;
3:收款更新客户
客户涉及以下表:ar_cash_receipts_all 、 ar_payment_schedules_all 、 ar_distributions_all具体更新逻辑如下
1、获取客户信息
select c.cust_account_id, -- 收款客户IDua.site_use_id -- 获得地点IDinto l_cust_account_id, l_site_user_idfrom hz_cust_accounts c,hz_customer_profiles cp,hz_parties party,hz_cust_acct_sites_all sa,hz_cust_site_uses_all uawhere sa.cust_acct_site_id = ua.cust_acct_site_idand sa.status = ua.statusand sa.status = 'A' --已启用and ua.site_use_code = 'BILL_TO'and sa.cust_account_id = c.cust_account_idand c.cust_account_id = cp.cust_account_id(+)and cp.site_use_id is nulland c.party_id = party.party_idand ua.org_id = l_org_idand c.account_number = l_customer_number;
2、更新ar_cash_receipts_all 表
update ar_cash_receipts_all aset a.pay_from_customer = l_cust_account_id,a.customer_site_use_id = l_site_user_idwhere a.cash_receipt_id = l_cash_receipt_idand a.pay_from_customer = l_customer_id;
3、获取 ar_distributions_all表
update ar_distributions_all dset d.third_party_id = l_cust_account_id,d.third_party_sub_id = l_site_user_idwhere d.third_party_id = l_customer_idand exists(select 1from ar_receivable_applications_all araawhere araa.receivable_application_id = d.source_idand to_char(araa.creation_date, 'YYYY-MM-DD') =to_char(d.creation_date, 'YYYY-MM-DD')and araa.cash_receipt_id = l_cash_receipt_id);update ar_distributions_all dset d.third_party_id = l_cust_account_id,d.third_party_sub_id = l_site_user_idwhere d.third_party_id = l_customer_idand exists(select 1from ar_receivable_applications_all araawhere araa.cash_receipt_history_id = d.source_idand to_char(araa.creation_date, 'YYYY-MM-DD') =to_char(d.creation_date, 'YYYY-MM-DD')and araa.cash_receipt_id = l_cash_receipt_id);
4:收款更新GL日期
收款GL日期涉及以下表:
ar_cash_receipts_all、ar_cash_receipt_history_all、ar_payment_schedules_all、ar_receivable_applications_all、xla_events
1:更新 ar_cash_receipts_all 表
update ar_cash_receipts_all acraset acra.receipt_date = l_receipt_date,acra.anticipated_clearing_date = l_receipt_date,acra.deposit_date = l_receipt_datewhere acra.cash_receipt_id = l_cash_receipt_id;
2:更新 ar_cash_receipt_history_all表
update ar_cash_receipt_history_all achaset acha.trx_date = l_receipt_date, acha.gl_date = l_receipt_datewhere acha.cash_receipt_id = l_cash_receipt_id;
3:更新 ar_payment_schedules_all 表
update ar_payment_schedules_all apsaset apsa.actual_date_closed = l_receipt_date,apsa.trx_date = l_receipt_date,apsa.gl_date_closed = l_receipt_date,apsa.gl_date = l_receipt_datewhere apsa.cash_receipt_id = l_cash_receipt_id;
4:更新 ar_receivable_applications_all 表
update ar_receivable_applications_all araaset araa.apply_date = l_receipt_date, araa.gl_date = l_receipt_datewhere araa.cash_receipt_id = l_cash_receipt_id;
5:更新 xla_events表
update xla_events xeset xe.transaction_date = l_receipt_date,xe.event_date = l_receipt_datewhere exists(select 1from ar_cash_receipts_all acra, ar_cash_receipt_history_all achawhere xe.event_id = acha.event_idand acra.cash_receipt_id = acha.cash_receipt_idand acra.cash_receipt_id = l_cash_receipt_id);
5:收款更新收款编号
收款编号涉及:ar_cash_receipts_all、xla.xla_transaction_entities、ar_payment_schedules_all
update ar_cash_receipts_all acraset acra.receipt_number = l_receipt_numberwhere acra.cash_receipt_id = l_cash_receipt_id;update xla.xla_transaction_entities xteset xte.transaction_number = l_receipt_numberwhere xte.entity_code = 'RECEIPTS'and xte.source_id_int_1 = l_cash_receipt_id;update ar_payment_schedules_all apsaset apsa.trx_number = l_receipt_numberwhere apsa.cash_receipt_id = l_cash_receipt_id;
事务处理及收款常用更新相关推荐
- SQL Server 常用更新语句,用B表数据作为条件或数据源更新A表数据
SQL Server 常用更新语句,用B表数据作为条件或数据源更新A表数据 示例:用B表姓名覆盖A表姓名 假设: A表数据 Id,Name 1,张三 B表数据 Id,Name 1,李四 用下面这个语句 ...
- oracle常用更新数据语句
1.联表更新 UPDATE T_DEV_ASSET_ACCOUNT SET T_DEV_ASSET_ACCOUNT.DEVICE_TYPE = ( SELECT ID FROM T_DEV_DEVIC ...
- 缓存系列文章--3.缓存常用更新策略对比(一致性)。
2019独角兽企业重金招聘Python工程师标准>>> http://carlosfu.iteye.com/blog/2245723 转载于:https://my.oschina.n ...
- Ubuntu 20.04 更新软件依赖,源 ,删除软件三个常用指令
ubuntu三个常用更新指令 更新源 sudo apt-get update 更新依赖和软件 sudo apt-get upgrade 删除软件 autoremove后面带上空格加软件名 sudo a ...
- mongDB的常用操作总结
目录 常用查询: 查询一条数据 查询子元素集合:image.id gte: 大于等于,lte小于等于... 查询字段不存在的数据not 查询数量: 常用更新 更新第一条数据的一个字段: 更新一条数据的 ...
- 微信支付宝收款二维码还能用吗?权威解读
自央行发布<中国人民银行关于加强支付受理终端及相关业务管理的通知(银发[2021]259号)>以来,引起网友的热烈讨论,同时我们也陆续收到很多客户的咨询. 所以今天我们收集了各个渠道的官方 ...
- sql进行批量更新或者一条sql写出批量更新的语句
有表如下 t_user:字段如下 id,name,phone t_phone:字段如下 uid,phone 其中t_phone表的uid字段是外键并且唯一,他引用t_user的id字段,现需要将t_p ...
- Android 常用ADB命令汇总!!! -- 持续补充
ADB 常用命令 1.基本命令 1.1.显示当前设备 -adb devices 1.2.获取权限,操作Android系统文件 1.3.log日志 - adb logcat 1.4.安装及卸载应用 - ...
- tp5 批量更新多条记录_Thinkphp怎么批量更新数据
展开全部 ||thinkphp批量更新数据可以参考如下三种方法: 方法一: //批量修改 data二维数组 field关键字段62616964757a686964616fe59b9ee7ad94313 ...
最新文章
- 关于对IPtables规则的理解
- Selenium自动化-清空输入框、输入内容、点击按钮
- 在java中finalize_在Java垃圾回收中使用finalize()方法
- 常考数据结构与算法-NC105 二分查找-II
- Ubuntu下pip3的安装、升级、卸载
- Kotlin中?和!!的区别
- python中扑克牌类设计_Python类的基础设计、使用
- 机器学习实战-集成学习-23
- 查询数据库中所有表名
- php 写入sql server,php将图片直接写入SQLServer2008
- springMVC 返回json乱码问题
- 一个可能是世界上最全的 API 接口集合库开源项目
- CSS 图片去色处理
- LTE下行资源分配方式
- opensuse 安装网易云音乐(tumbleweed)(leap)
- 如何在 Next.js 中实现重定向
- 不等缓和曲线计算公式及坐标?
- zuul - 微服务(十三)
- 【Vue组件】从零开始实现一个支持插入自定义表情的评论组件
- 空心三角形(图形的输出)c语言