首页 > 代码库 > R12_专题知识总结提炼-AP模块
R12_专题知识总结提炼-AP模块
应付模块业务操作流程
供应商管理
供应商概述
在您使用 Oracle Purchasing 之前,需要定义供应商、供应商site,以及供应商联系人, 供应商主数据(SUPPLIER MASTER DATA,简称SMD)是指供应商的基本信息,是企业和供 应商进行业务往来、交易付款等必须的基础数据,主要包括两类信息:
A 采购数据 ——例如,供应商名称、联系人、地址、沟通方法等;
B 付款数据 ——例如,付款条款、银行帐号、税号等。
应付发票管理
应付发票基本流程
应付发票分类
标准发票: 指由于采购货物或接受劳务,从供应商处取得的发票(标准发票,既可以和订单匹 配 ,也可以不匹配)。
贷项通知单: 指供应商对已开发票的货物或劳务,所开的红冲发票。
借项通知单: 指供应商未开红冲发票,而由自已录入的红冲发票。
费用报表: 指与雇员相关费用的发票。
PO缺省: 指和采购订单匹配的发票。输入PO号码后,Oracle应付自动地提供供应商信息。
预付: 指为供应商或雇员支付预付款的一种发票(视为发票)。
预扣税: 为代扣代缴税生成的发票。
混合发票: 指既可以和采购订单又可以和发票匹配的发票。(既可以输入正数,也可以输入负数)。
应付发票与采购订单匹配方式
二维匹配:应付发票与采购订单的数量、单价的匹配;
三维匹配:应付发票与采购订单、接收单的数量、单价的匹配;
四维匹配:应付发票与采购订单、接收单、入库单的数量、单价的匹配;
系统自动采用 2-way matching与采购订单匹配.在 Purchasing Options 窗口可选择附加使用 3-way或 4-way matching. 可以在供应商、供应商地点更改 invoice match option。
如果发票和采购订单在您定义的数量和价格容限内不匹配,“审批”将在发票上标记匹配挂起。必须在支付发票之前释放挂起。
应付发票分配类型
项目: 记录向供应商购货或劳务收费金额
税: 记录购买商品或劳务而产生的税额
运费: 记录供应商的运输费用
杂项费用: 记录一张发票的各项杂项费用
应付发票 录入及会计分录信息
应付发票可以手工录入或通过接口导入。与采购有关的发票需要通过匹配采购订单生成应付发票。 根据采购项目的税信息,会自动或手工产生税行。
发票录入界面(R12):
如果收到的发票价格为10。税码为VAT17。
采购匹配的应付发票会计分录为:
应付帐款-应付暂估 DR 10¥
进项税 DR 10*0.17¥
应付帐款-发票款 CR 11.7
科目的余额变化如下:
科目 初 发生 余额
应付帐款-应付暂估 10 -10 0¥
进项税 0 -1.7 -1.7¥(应交税费属于负债类科目)
应付帐款-发票款 0 +11.7 11.7¥
中转科目应付帐款-应付暂估科目的余额已结平为0。因此我们实际的应付账款为10+10*0.17。
会计分录信息:
(1).录入发票
AP发票的分配记录了所有应付暂估和预付款核销的科目,再加上应付发票本身的应付账款科目,分录查询SQL为:
1 SELECT ai.invoice_num, 2 ai.gl_date, 3 fnd_flex_ext.get_segs(‘SQLGL‘, 4 ‘GL#‘, 5 50348, 6 ai.accts_pay_code_combination_id) acct, 7 gl_flexfields_pkg.Get_Concat_Description(50348, ai.accts_pay_code_combination_id) acct_desc, 8 0 dr, 9 ai.invoice_amount cr10 FROM ap_invoices_all ai11 WHERE ai.invoice_id = &p_invoice_id12 UNION ALL13 --由于预付核销产生的应付账款借项14 SELECT ai.invoice_num,15 aid.accounting_date,16 fnd_flex_ext.get_segs(‘SQLGL‘,17 ‘GL#‘,18 50348,19 ai.accts_pay_code_combination_id) acct,20 gl_flexfields_pkg.Get_Concat_Description(50348, ai.accts_pay_code_combination_id) acct_desc,21 -1 * aid.amount dr,22 0 cr23 FROM ap_invoices_all ai, ap_invoice_distributions_all aid24 WHERE ai.invoice_id = aid.invoice_id25 AND aid.line_type_lookup_code = ‘PREPAY‘26 AND ai.invoice_id = &p_invoice_id27 UNION ALL28 -- 应付发票分配(借项)29 SELECT ai.invoice_num,30 aid.accounting_date,31 fnd_flex_ext.get_segs(‘SQLGL‘,32 ‘GL#‘,33 50348,34 aid.dist_code_combination_id) acct,35 gl_flexfields_pkg.Get_Concat_Description(50348, aid.dist_code_combination_id) acct_desc,36 aid.amount dr,37 0 cr38 FROM ap_invoices_all ai, ap_invoice_distributions_all aid39 WHERE ai.invoice_id = aid.invoice_id40 AND ai.invoice_id = &p_invoice_id
(2).创建会计分录
有两种方式可以创建会计分录,R12创建会计科目有三个选项可选(Draft:建立草稿,不能传送到总帐,Final:完成会计科目创建,可传送到总帐,Final Post:完成会计科目创建,并传送到总帐)
1.为单笔事务处理或事务处理批创建会计分录,单笔事务处理可通过Action创建会计分录来完成
2.可以通过提交请求(“Create Accounting”),来创建成批的AP分录;
创建会计分录后,会在xla中产生分录信息(与11i有所不同,同11i不同点将在文档后面介绍),可以通过如下sql查询:
1 --发票产生的分录信息 2 SELECT gcc.segment3, 3 fnd_flex_ext.get_segs(‘SQLGL‘, 4 ‘GL#‘, 5 50348, 6 gcc.code_combination_id) acct, 7 gl_flexfields_pkg.Get_Concat_Description(50348, 8 gcc.code_combination_id) acct_desc, 9 l.accounted_dr,10 l.accounted_cr11 FROM xla.xla_transaction_entities te,12 xla_events e,13 xla_ae_headers h,14 xla_ae_lines l,15 gl_code_combinations gcc16 WHERE te.entity_code = ‘AP_INVOICES‘17 AND te.application_id = 20018 AND nvl(te.source_id_int_1, (-99)) = &invoice_id --Invoice_id19 AND te.entity_id = h.entity_id20 AND te.application_id = h.application_id21 AND e.event_id = h.event_id22 AND e.application_id = h.application_id23 AND h.ae_header_id = l.ae_header_id24 AND h.application_id = l.application_id25 AND l.code_combination_id = gcc.code_combination_id;
(3).传送总帐
1.单笔事务处理或事务处理批传送到总帐(创建会计科目时已介绍)
2.运行请求(“Transfer Journal Entries to GL”),运行完,将在总帐产生日记帐分录,来源为je_source=’ Payables’ and je_category=’Purchase Invoices‘,总帐追溯sql查询:
1 --总帐追溯 2 SELECT DISTINCT XTE.SOURCE_ID_INT_1 --INVOICE_ID 3 FROM GL_JE_HEADERS GJH, 4 GL_JE_LINES GJL, 5 GL_CODE_COMBINATIONS GCC, 6 GL_IMPORT_REFERENCES GIR, 7 XLA_AE_LINES XAL, 8 XLA_AE_HEADERS XAH, 9 XLA_TRANSACTION_ENTITIES XTE10 WHERE GJH.JE_HEADER_ID = GJL.JE_HEADER_ID11 AND GJL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID12 AND GJL.je_header_id = gir.je_header_id13 and GJL.je_line_num = gir.je_line_num14 AND GIR.gl_sl_link_id = XAL.GL_SL_LINK_ID15 AND XAL.AE_HEADER_ID = XAH.AE_HEADER_ID16 AND XAH.ENTITY_ID = XTE.ENTITY_ID17 and GJH.je_source = ‘Payables‘18 and GJH.je_category = ‘Purchase Invoices‘19 and GJH.status = ‘P‘20 AND GJH.JE_HEADER_ID = &JE_HEADER_ID;
应付发票挂起和释放
挂起的作用:
使用挂起可阻止某个发票的付款,阻止某个发票的过帐。
系统提供了许多发票挂起的理由,也可根据发票审批的需要自己定义挂起。
比如可针对供应商或供应商地点挂起,不必只针对单个发票挂起。
Hold的应用对象:
对供应商地点发票挂起;
(挂起所有付款;发票数额限制;挂起不匹配发票;挂起未来发票)
对选择的发票挂起;
发票暂挂分类及描述:
账户原因 : 标识无效、不正确应付账款负债、汇率差异或分配账户的发票
资金原因:使用预算控制时,在发票分配资金不足或系统不能提供资金检查时挂起
信息不充分:对没有汇率的外币发票挂起
发票原因:在输入或调整发票时可对发票人工应用挂起
匹配原因:发票违背了预定义的匹配标准
期间原因:对GL日期在将来期间的发票应用此挂起
差异原因:“分配差异”;“税差异”;“税额范围”
应付贷项通知单和借项通知单
贷项通知单与借项通知单比较
贷项通知单和借项通知单的金额只能是负数;实际上应付贷项通知单与应付借项通知应应收的概念并不等同:
应付贷项通知单:指供应商开给我们的表示应付减少的通知,负数,冲原始发票,可用0支付结清;常用于做采购退货业务,发生采购退货业务后,在应付录入应付贷项通知单,同时匹配退货生 成贷项通知单行(一般为供应商开的发票);
应付借项通知单:指我们自己开出的表示应付减少的通知,同样是负数,冲原始发票,可用0支付结清,适用于发票做错后的反冲。功能上它与贷项通知单基本相似。也可用于退货业务。在采购 退货界面有是否生成借项通知单的复选框,通过采购系统选项控制是否启用;(一般为企业自已开的发票);
贷项通知单匹配退货
通过应付款发票界面录入类型为贷项通知单的应付发票,然后通过匹配采购退货产生贷项通知单行。
对于采购退货业务的分录如下(与应收发票的分录方向恰恰相反):
应付帐款-应付暂估 CR 5¥
进项税 CR 5*0.17¥(应交税费属于负债类科目)
应付帐款-发票款 DR 5.85¥
相关科目的余额变化如下:
科目 初 发生 余额
应付帐款-应付暂估 -5 +5 0¥
进项税 -1.7 +0.85 -0.85¥
应付帐款-发票款 11.7 -5.85 5.85¥
中转科目应付帐款-应付暂估科目的余额已结平为0。
货的最终结果就是使库存成本和应付账款-发票款相应减少;这样,退货的最终结果就是使库存成本和应付账款-发票款相应减少。可以通过上面应付发票SQL查询贷项通知单有关的分录信息。
其它应付业务
预付款发票
供应商的预付款和员工差旅或采购的借支都可以在应付系统中作为预付款发票管理;
预付款发票可与应付发票核销,来进行预付和应付的抵消;
预付款发票只有在付款以后才能与应付发票核销;
标准发票的分录有所不同,不过技术实现上是一样的。它的分录通常是:
预付款发票创建:
借:预付账款/其他应收款
贷:应付账款/其他应付款
预付款发票付款:
借:应付账款/其他应付款
贷:现金/银行存款
应付发票创建:
借:费用
贷:应付账款
预付款发票核销:
借:应付账款
贷:预付账款/其他应收款
应付发票导入固定资产
应付发票可以成批增加为固定资产。有两种方式建立应付发票:
1) 直接定义固定资产型物料,其属性不可库存,并制定它的销售费用科目为固定资产中转科目。该种类型物料接收、交货通常不会产生会计分录,然后通过正常采购并匹配应付发票。这 时候,
应付发票的分录应为:
DR 固定资产中转
CR 应付帐款
2) 手工录入应付发票,并指定发票分配科目为固定资产中转科目。它的分录同上。最后,在应付模块提交请求“创建成批增加”后,则可以在FA模块成批增加资产。最终过账后,会形成如 下分录。
DR 固定资产
CR 固定资产中转
固定资产中转科目结清为0;
FA创建会计分录后,有关固定资产的分录信息查询sql:
1 --事务处理 2 SELECT fa.asset_number, 3 fth.transaction_type_code, 4 h.period_name, 5 fnd_flex_ext.get_segs(‘SQLGL‘, ‘GL#‘, 50348, gcc.code_combination_id) acct, 6 gl_flexfields_pkg.Get_Concat_Description(50348, 7 gcc.code_combination_id) acct_desc, 8 l.accounted_dr, 9 l.accounted_cr10 FROM xla.xla_transaction_entities te,11 xla_events e,12 xla_ae_headers h,13 xla_ae_lines l,14 gl_code_combinations gcc,15 fa_transaction_headers fth,16 fa_additions fa17 WHERE te.entity_code = ‘TRANSACTIONS‘18 AND te.application_id = 14019 AND te.ledger_id = 202220 AND nvl(te.source_id_int_1, (-99)) = fth.transaction_header_id21 AND fth.asset_id = fa.asset_id22 AND te.entity_id = h.entity_id23 AND te.application_id = h.application_id24 AND e.event_id = h.event_id25 AND e.application_id = h.application_id26 AND h.ae_header_id = l.ae_header_id27 AND h.application_id = l.application_id28 AND l.code_combination_id = gcc.code_combination_id29 AND fa.asset_number = ‘&p_asset_number‘30 UNION ALL31 -- 折旧32 SELECT fa.asset_number,33 te.entity_code,34 h.period_name,35 fnd_flex_ext.get_segs(‘SQLGL‘, ‘GL#‘, 50348, gcc.code_combination_id) acct,36 gl_flexfields_pkg.Get_Concat_Description(50348,37 gcc.code_combination_id) acct_desc,38 l.accounted_dr,39 l.accounted_cr40 FROM xla.xla_transaction_entities te,41 xla_events e,42 xla_ae_headers h,43 xla_ae_lines l,44 gl_code_combinations gcc,45 fa_additions fa46 WHERE te.entity_code = ‘DEPRECIATION‘47 AND te.application_id = 14048 AND te.ledger_id = 202249 AND nvl(te.source_id_int_1, (-99)) = fa.asset_id50 AND te.entity_id = h.entity_id51 AND te.application_id = h.application_id52 AND e.event_id = h.event_id53 AND e.application_id = h.application_id54 AND h.ae_header_id = l.ae_header_id55 AND h.application_id = l.application_id56 AND l.code_combination_id = gcc.code_combination_id57 AND fa.asset_number = ‘&p_asset_number‘;
手工应付发票
应付除了用于与采购模块集成外,还可以通过应付发票做些其他的杂项业务。记录些与采购无关的业务。
例如:员工费用报销…
会计分录信息:
招待费 DR
其他应付款 CR
未上线网上报销模块时常常如上手工建立应付发票实现员工报销
费用报表
费用报表是网上报销模块导入的一种类型的应付发票,当网上报销流程结束并审核通过后,可以通过请求“导入费用报表”导入应付发票。
除了与标准应付发票的科目有所不同。其他作用等同于标准应付发票。
企业报销的分录通常如下:
员工报销科目 DR
其他应付款-报销 CR
付款管理
付款概述
发票生成并验证通过以后,可以对发票进行付款。
可以在发票界面通过快速付款,付款界面录入人工付款,或者进行批付款对发票进行批量付款。批付款常应用于员工报销付款。
在付款界面,将蓝票(应付发票)和红票(贷项通知单)选入到同一个付款,进行付款。
付款的约定:
必须通过 “银行帐户” 支付,必须使用付款单据及单据号。
只能对供应商付款。
付款必须指定发票,且所选发票核销总额必须与付款金额相同。
付款方式:
支票(Check): 发送给供应商的支票
结清(Clearing): 支付从公司其他实体转来的发票,无需建立付款单据
电子(EFT): 电子转账至供应商开户银行
电汇(Wire)
付款录入及会计分录信息
对发票付款,实际上就是用现金支付应付欠款,现金与应付款都减少;
单笔收款录入价面,批付款在文档后面有介绍:
应付帐款-发票款 DR 5.85¥
银行存款 CR 5.85¥
相关科目的余额变化如下:
科目 初 发生 余额
应付帐款-发票款 5.85 -5.85 0¥
银行存款 100 -5.85 94.15¥
付款产生的会计分录信息:
1 --付款产生的分录信息 2 SELECT h.accounting_date, 3 fnd_flex_ext.get_segs(‘SQLGL‘, ‘GL#‘, 50348, gcc.code_combination_id) acct, 4 gl_flexfields_pkg.Get_Concat_Description(50348, 5 gcc.code_combination_id) acct_desc, 6 l.accounted_dr, 7 l.accounted_cr 8 FROM xla.xla_transaction_entities te, 9 xla_events e,10 xla_ae_headers h,11 xla_ae_lines l,12 gl_code_combinations gcc13 WHERE te.entity_code = ‘AP_PAYMENTS‘14 AND te.application_id = 20015 AND nvl(te.source_id_int_1, (-99)) = &check_id 16 AND te.entity_id = h.entity_id17 AND te.application_id = h.application_id18 AND e.event_id = h.event_id19 AND e.application_id = h.application_id20 AND h.ae_header_id = l.ae_header_id21 AND h.application_id = l.application_id22 AND l.code_combination_id = gcc.code_combination_id;
付款会计分录传送到总帐
跟前面讲述的发票传送总帐方式比较类似,产生的总帐信息为:来源为je_source=’ Payables’ and je_category=’ Payments ‘。
应付模块11i跟R12差异比较
子分类帐差异
R12新增加SLA模块用来管理子分类帐;请参照<<SLA专题>>了解详细内容;
(1).子分类帐相关表变化
11i | R12 |
ap_accounting_events_all | XLA_TRANSACTION_ENTITIES |
ap_ae_headers_all | XLA_EVENTS |
ap_ae_lines | XLA_AE_HEADERS |
| XLA_AE_LINES |
(2).应付发票子分类帐SQL(其它类似,以应付发票为例)
11i:
1 SELECT GCC.SEGMENT3, 2 fnd_flex_ext.get_segs(‘SQLGL‘, ‘GL#‘, 50348, gcc.code_combination_id) acct, 3 gl_flexfields_pkg.Get_Concat_Description(50348, 4 gcc.code_combination_id) acct_desc, 5 AL.accounted_dr, 6 AL.accounted_cr 7 8 FROM AP_ACCOUNTING_EVENTS_ALL AE, 9 AP_AE_HEADERS_ALL AH,10 AP_AE_LINES_ALL AL,11 GL_CODE_COMBINATIONS GCC12 WHERE AE.SOURCE_ID = &INVOICE_ID --发票ID13 AND AE.SOURCE_TABLE = ‘AP_INVOICES‘14 AND AE.ACCOUNTING_EVENT_ID = AH.ACCOUNTING_EVENT_ID15 AND AH.AE_HEADER_ID = AL.AE_HEADER_ID16 AND AL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID;
R12
1 --发票产生的分录信息 2 SELECT gcc.segment3, 3 fnd_flex_ext.get_segs(‘SQLGL‘, 4 ‘GL#‘, 5 50348, 6 gcc.code_combination_id) acct, 7 gl_flexfields_pkg.Get_Concat_Description(50348, 8 gcc.code_combination_id) acct_desc, 9 l.accounted_dr,10 l.accounted_cr11 FROM xla.xla_transaction_entities te,12 xla_events e,13 xla_ae_headers h,14 xla_ae_lines l,15 gl_code_combinations gcc16 WHERE te.entity_code = ‘AP_INVOICES‘17 AND te.application_id = 20018 AND nvl(te.source_id_int_1, (-99)) = &invoice_id --Invoice_id19 AND te.entity_id = h.entity_id20 AND te.application_id = h.application_id21 AND e.event_id = h.event_id22 AND e.application_id = h.application_id23 AND h.ae_header_id = l.ae_header_id24 AND h.application_id = l.application_id25 AND l.code_combination_id = gcc.code_combination_id;
子模块追溯
R12下总账追溯子模块比11i简单统一了很多,通过gl_import_reference表
应付发票子模块追溯SQL(其它类似,以应付发票为例)
11i:
1 --总帐追溯 2 select distinct ae.source_id --发票id 3 from gl_je_headers jh, 4 gl_je_lines jl, 5 gl_import_references gir, 6 ap_ae_headers_all ah, 7 ap_ae_lines_all al, 8 ap_accounting_events_all ae 9 where jh.je_header_id = jl.je_header_id10 and jl.je_header_id = gir.je_header_id11 and jl.je_line_num = gir.je_line_num12 and jl.gl_sl_link_id = al.gl_sl_link_id13 and al.ae_header_id = ah.ae_header_id14 and ah.accounting_event_id = ae.accounting_event_id15 and jh.je_source = ‘Payables‘16 and jh.je_category = ‘Purchase Invoices‘17 and jh.status = ‘P‘18 and jh.je_header_id = &je_header_id;
R12
1 --总帐追溯 2 SELECT DISTINCT XTE.SOURCE_ID_INT_1 --INVOICE_ID 3 FROM GL_JE_HEADERS GJH, 4 GL_JE_LINES GJL, 5 GL_CODE_COMBINATIONS GCC, 6 GL_IMPORT_REFERENCES GIR, 7 XLA_AE_LINES XAL, 8 XLA_AE_HEADERS XAH, 9 XLA_TRANSACTION_ENTITIES XTE10 WHERE GJH.JE_HEADER_ID = GJL.JE_HEADER_ID11 AND GJL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID12 AND GJL.je_header_id = gir.je_header_id13 and GJL.je_line_num = gir.je_line_num14 AND GIR.gl_sl_link_id = XAL.GL_SL_LINK_ID15 AND XAL.AE_HEADER_ID = XAH.AE_HEADER_ID16 AND XAH.ENTITY_ID = XTE.ENTITY_ID17 and GJH.je_source = ‘Payables‘18 and GJH.je_category = ‘Purchase Invoices‘19 and GJH.status = ‘P‘20 AND GJH.JE_HEADER_ID = &JE_HEADER_ID;
其它差异
- R12新增加ap_invoice_lines表;
官方解释:
Oracle Payables introduces invoice lines as an entity between the invoice header and
invoice distributions. With the new model, the invoice header remains unchanged, and continues to store information about the supplier who sent the invoice, the invoice attributes, and remittance information.Invoice lines represent the goods (direct or indirect materials), service(s), and/orassociated tax/freight/miscellaneous charges invoiced. Invoice distributions store theaccounting, allocation and other detail information that makes up the invoice line. Thecharge allocation table used in prior releases to manage accounting allocations is obsolete.During the upgrade, Oracle Payables creates invoice lines for all existing invoices,creating one line for every distribution available in the Release 11i distributions table,except in the case of reversal pairs. In those cases, Payables creates one line with a zero amount.
- 供应商银行信息表变化
11i | R12 |
AP_BANK_ACCOUNTS_ALL | IBY_EXTERNAL_PAYEES_ALL |
|
IBY_EXT_BANK_ACCOUNTS
|
|
IBY_PMT_INSTR_USES_ALL
|
- 付款银行表变化
11i | R12 |
AP_BANK_ACCOUNTS_ALL | CE_BANK_ACCOUNTS |
AP_BANK_ACCOUNT_USES_ALL |
CE_BANK_ACCT_USES_ALL
|
AP_BANK_BRANCHES |
CE_BANK_BRANCHES_V
|
取付款银行信息sql(R12):
1 --付款银行信息 2 SELECT AC.CHECK_NUMBER, 3 CBA.BANK_ACCOUNT_ID BANK_ACCOUNT_ID, 4 AC.BANK_ACCOUNT_NAME BANK_ACCOUNT_NAME, 5 AC.BANK_ACCOUNT_NUM BANK_ACCOUNT_NUM, 6 CBA.BANK_ACCOUNT_NAME, 7 CBB.BANK_BRANCH_NAME 8 FROM AP_CHECKS_ALL AC, 9 CE_BANK_ACCOUNTS CBA,10 CE_BANK_ACCT_USES_ALL CBAU,11 CE_BANK_BRANCHES_V CBB12 WHERE AC.CE_BANK_ACCT_USE_ID = CBAU.BANK_ACCT_USE_ID(+)13 AND CBAU.BANK_ACCOUNT_ID = CBA.BANK_ACCOUNT_ID(+)14 AND CBB.BRANCH_PARTY_ID(+) = CBA.BANK_BRANCH_ID;
4.供应商表变化
11i | R12 |
PO_VENDORS | AP_SUPPLIERS |
PO_VENDOR_SITES_ALL |
AP_SUPPLIER_SITES_ALL
|
PO_VENDOR_CONTACTS |
AP_SUPPLIER_CONTACTS
|
5.Payment Documents 表变化
11i | R12 |
AP_CHECK_STOCKS_ALL | CE_PAYMENT_DOCUMENTS |
取Payment Documents SQL(R12):
1 Select cs.payment_document_name, 2 DECODE(cs.MANUAL_PAYMENTS_ONLY_FLAG, 3 ‘Y‘, 4 ‘RECORDED‘, 5 ‘N‘, 6 ‘COMBINED‘) 7 From ap_checks_all ch, CE_PAYMENT_DOCUMENTS CS, ap_lookup_codes lk 8 Where CH.PAYMENT_DOCUMENT_ID = cs.PAYMENT_DOCUMENT_ID(+) 9 AND DECODE(cs.MANUAL_PAYMENTS_ONLY_FLAG,10 ‘Y‘,11 ‘RECORDED‘,12 ‘N‘,13 ‘COMBINED‘) = lk.lookup_code(+)14 AND lk.lookup_type(+) = ‘DISBURSEMENT TYPE‘;
6.Payment Batch
表变化:
11i | R12 |
AP_CHECKS_ALL | AP_CHECKS_ALL |
AP_INV_SELECTION_CRITERIA_ALL | AP_INV_SELECTION_CRITERIA_ALL |
AP_SELECTED_INVOICES_ALL | AP_SELECTED_INVOICES_ALL |
AP_SELECTED_INVOICE_CHECKS_ALL | IBY_PAY_SERVICE_REQUESTS |
| IBY_PAY_INSTRUCTIONS_ALL |
| IBY_PAYMENTS_ALL
|
批付款操作界面变化:
11i:
7.税
R11版本按照设置税码税率计算税;在R12版以后,在计税方面有了重大改变,税也成为一个独立的模块。其计税的逻辑也从以前单纯的税码和税率的关联转换为通过税则,来建 立会计分类代码(fiscal classification code)与税率的联系。会计分类代码可以应用至交易方(Party)、产品(Product)以及事务处理(Transaction)之上。 具体介绍请参 照<<TAX专题>>
官方解释:
Oracle E-Business Tax manages tax across the E-Business Suite. In prior releases, the
setup, defaulting, and calculation of tax for Payables was managed within Payables
using tax codes, their associated rates, and a hierarchy of defaulting options. This method is still available in this release. During the upgrade, E-Business Tax migrates the tax codes as appropriate within E-Business Tax so that your tax processing can work the same way after the upgrade as it did before.New fields are added to the supplier, invoice, and invoice lines entities to track tax attributes used by E-Business Tax. Many of these attributes were implemented withglobal descriptive flexfields in prior releases and are upgraded to regular fields on these entities.
表变化:
11i | R12 |
AP_TAX_CODES_ALL | ZX_LINES_SUMMARY |
| ZX_LINES |
| ZX_RATES_TL |
PO税查询sql:
1 select zl.trx_id, 2 zl.trx_line_id, 3 zl.tax_regime_code, 4 zl.tax, 5 zl.tax_status_code, 6 zl.tax_rate_code, 7 zl.tax_rate 8 from po_line_locations_all pll, zx_lines zl 9 where pll.po_header_id = zl.trx_id10 and pll.line_location_id = zl.trx_line_id11 and zl.application_id(+) = 20112 AND zl.trx_level_type(+) = ‘SHIPMENT‘;
AP Invoices应付发票【Open Interface】
以R12为例,具体介绍应付发票导入,R12导入应付发票较11i有部分不同,比如:
11i,ap_invoice_lines_interface弹性域写入发票分配行,r12默认写入发票行,可能过profile设定,把行上的弹性域带到分配行上,profile:AP_COPY Invoice Lines Flex fied 设为Y;
发票税导入:
11i通过税码,税率产生税,R12按照发票行上的税信息产生税,具体的规则见下表:
| ITEM1 | ITEM2 | TAX1 | TAX2 |
LINE_NUMBER | 1 | 2 | 3 | 4 |
LINE_GROUP_NUMBER | 1 | 2 | 1 | 2 |
TAX_REGIME_CODE | The set of tax rules that determines the treatment of one or | |||
TAX | A classification of a charge imposed by a government through a fiscal or tax authority. | |||
TAX_RATE_CODE | Tax rate name associated with tax rate identifier | |||
TAX_STATUS_CODE | Tax status code | |||
TAX_JURISDICTION_CODE | Internal ID of the Tax Jurisdiction | |||
TAX_RATE | TAX_RATE | |||
TAX_RATE_ID | TAX_RATE_ID is unique while the TAX_RATE_CODE may have different tax rates based on date ranges | |||
PRORATE_ACROSS_FLAG | Y | Y | Y | Y |
接口表,错误信息表
接口表 | 数据表 | 说明 |
|
|
|
ap_invoices_interface | ap_invoices_all | AP头 |
ap_invoice_lines_interface | ap_invoice_distributions_all | AP行 |
ap_interface_rejections |
| 错误信息表 |
并发程序Payables Open Interface Import
参数 | 说明 |
|
|
Operating Unit | ou |
Source | 来源 |
Group | 组ID,放空代表全部 |
Batch Name | 批名 |
Hold Name | 放空即可 |
Hold Reason | 放空即可 |
GL Date | 放空即可 |
Purge | Y,是否删除成功导入的记录 |
Trace Switch | N,是否启用Trace,隐藏的参数 |
Debug Switch | N,是否启用调式信息,隐藏的参数 |
Summarize Report | N,是否打印汇总报表,隐藏的参数 |
Commit Batch Size | 放空即可,隐藏的参数 |
User ID | 放空即可,隐藏的参数 |
Login ID | 放空即可,隐藏的参数 |
关键字段
ap_invoices_interface
字段 | 说明 |
|
|
org_id | 经营单位ID |
invoice_id | 来自ap_invoices_interface_s |
invoice_num | 发票号 |
invoice_type_lookup_code | STANDARD是标准发票,CREDIT是Credit Memo |
invoice_date | 发票日期 |
vendor_id | 供应商ID |
vendor_site_id | 供应商地点 |
invoice_amount | 发票金额 |
invoice_currency_code | 发票币种 |
exchange_xxx | 如果是外币,需要输入汇率类型、日期、汇率 |
SOURCE | 来源,来自快速编码SOURCE |
group_id | 组ID,可直接用invoice_id |
5个who字段 | 习惯上都给 |
ap_invoice_lines_interface
字段 | 说明 |
|
|
org_id | 经营单位ID |
invoice_id | =ap_invoices_interface.invoice_id |
invoice_line_id | 来自ap_invoice_lines_interface_s |
accounting_date | 财务日期 |
line_number | 行号 |
line_type_lookup_code | 行类型 |
amount | 金额 |
dist_code_combination_id | 账户ID |
5个who字段 | 习惯上都给 |
/*-- 本例以PO匹配发票为例,请注意导入税的取值*/DECLARE LN_INVOICE_ID NUMBER;BEGIN LN_INVOICE_ID := AP.AP_INVOICE_LINES_INTERFACE_S.NEXTVAL; --Header INSERT INTO AP_INVOICES_INTERFACE (INVOICE_ID, INVOICE_NUM, INVOICE_TYPE_LOOKUP_CODE, INVOICE_DATE, VENDOR_SITE_ID, INVOICE_AMOUNT, INVOICE_CURRENCY_CODE, EXCHANGE_DATE, TERMS_ID, SOURCE, GROUP_ID, DESCRIPTION, PAYMENT_METHOD_LOOKUP_CODE, ORG_ID, PAYMENT_CURRENCY_CODE, VENDOR_ID, GOODS_RECEIVED_DATE, INVOICE_RECEIVED_DATE, PAYMENT_CROSS_RATE_DATE, GL_DATE, LAST_UPDATE_DATE ) SELECT LN_INVOICE_ID, T.INVOICE_NUM||‘-‘||TO_CHAR(SYSDATE,‘YYYY/MM/DD‘), T.INVOICE_TYPE_LOOKUP_CODE, T.INVOICE_DATE, T.VENDOR_SITE_ID, T.INVOICE_AMOUNT, T.INVOICE_CURRENCY_CODE, T.EXCHANGE_DATE, T.TERMS_ID, T.SOURCE, 10000 GROUP_ID, T.DESCRIPTION, T.PAYMENT_METHOD_LOOKUP_CODE, T.ORG_ID, T.PAYMENT_CURRENCY_CODE, T.VENDOR_ID, T.GOODS_RECEIVED_DATE, T.INVOICE_RECEIVED_DATE, T.PAYMENT_CROSS_RATE_DATE, T.GL_DATE, SYSDATE FROM AP_INVOICES_ALL T WHERE T.INVOICE_ID = 12261; -- LINES INSERT INTO AP_INVOICE_LINES_INTERFACE (INVOICE_ID, INVOICE_LINE_ID, LINE_TYPE_LOOKUP_CODE, DESCRIPTION, AMOUNT, PO_HEADER_ID, PO_LINE_ID, PO_LINE_LOCATION_ID, PO_DISTRIBUTION_ID, ASSETS_TRACKING_FLAG, QUANTITY_INVOICED, UNIT_PRICE, ORG_ID, PA_ADDITION_FLAG, LAST_UPDATE_DATE, CREATION_DATE, LINE_NUMBER, LINE_GROUP_NUMBER ) SELECT LN_INVOICE_ID, AP.AP_INVOICE_LINES_INTERFACE_S.NEXTVAL INVOICE_LINE_ID, T.LINE_TYPE_LOOKUP_CODE, T.DESCRIPTION, T.AMOUNT, T.PO_HEADER_ID, T.PO_LINE_ID, T.PO_LINE_LOCATION_ID, T.PO_DISTRIBUTION_ID, T.ASSETS_TRACKING_FLAG, T.QUANTITY_INVOICED, T.UNIT_PRICE, T.ORG_ID, ‘N‘ PA_ADDITION_FLAG, T.LAST_UPDATE_DATE, SYSDATE, T.LINE_NUMBER, T.LINE_GROUP_NUMBER FROM AP_INVOICE_LINES_ALL T, AP_INVOICE_DISTRIBUTIONS_ALL T1 WHERE T.INVOICE_ID = T1.INVOICE_ID AND T.LINE_NUMBER = T1.INVOICE_LINE_NUMBER AND T.LINE_TYPE_LOOKUP_CODE = ‘ITEM‘ AND T.INVOICE_ID = 12261; -- TAX INSERT INTO AP_INVOICE_LINES_INTERFACE (INVOICE_ID, INVOICE_LINE_ID, LINE_TYPE_LOOKUP_CODE, AMOUNT, ORG_ID, LAST_UPDATE_DATE, CREATION_DATE, PA_ADDITION_FLAG, LINE_NUMBER, LINE_GROUP_NUMBER, TAX_REGIME_CODE, TAX, TAX_RATE_CODE, TAX_STATUS_CODE, TAX_JURISDICTION_CODE, TAX_RATE, TAX_RATE_ID, PRORATE_ACROSS_FLAG ) SELECT LN_INVOICE_ID, AP.AP_INVOICE_LINES_INTERFACE_S.NEXTVAL INVOICE_LINE_ID, LINE_TYPE_LOOKUP_CODE, AMOUNT, ORG_ID, SYSDATE, CREATION_DATE, ‘N‘ PA_ADDITION_FLAG, LINE_NUMBER, LINE_GROUP_NUMBER, TAX_REGIME_CODE, TAX, TAX_RATE_CODE, TAX_STATUS_CODE, TAX_JURISDICTION_CODE, TAX_RATE, TAX_RATE_ID, ‘Y‘ PRORATE_ACROSS_FLAG FROM AP_INVOICE_LINES_ALL T WHERE T.INVOICE_ID = 12261 AND T.LINE_TYPE_LOOKUP_CODE = ‘TAX‘; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK;END;
AP常用API
使用API可在开发中得到便利,下面介绍AP模块几个常用的API:
AP_INVOICES_PKG
AP_INVOICES_INTERFACE_PKG
AP_INVOICE_LINES_INTERFACE_PKG
AP_IMPORT_INVOICES_PKG
AP_IMPORT_VALIDATION_PKG
R11
R12
附 :R12中子模块的帐是如何产生的
1) 在FORM:ARXRWMAI 的按钮 SLACEXEC.OK_BP 触发器中有提交创建的代码:
arp_sla_submit.which_case;
2)包arp_sla_submit在pll文件ARSLAOLS.pll中。
3)在arp_sla_submit.which_case中执行以下过程,将FORM界面上的信息传入过程
submit_xla_accounting
4) submit_xla_accounting过程调用以下数据库package创建会计科目
XLA_ACCOUNTING_PUB_PKG.accounting_program_document
5)在XLA_ACCOUNTING_PUB_PKG中根据p_offline_flag的取值,分别调用
xla_accounting_pkg.accounting_program_document
或者调用创建会计科目的请求
6)在xla_accounting_pkg中调用下面过程
xla_accounting_pkg.accounting_program_events
7)在events_processor在调用handle_accounting_hook调根据application_id分别调用
CASE
WHEN p_application_id = 200 THEN
xla_ap_acct_hooks_pkg.main
WHEN p_application_id = 222 THEN
xla_ar_acct_hooks_pkg.main
WHEN p_application_id = 140 THEN
xla_fa_acct_hooks_pkg.main
WHEN p_application_id = 260 THEN
xla_ce_acct_hooks_pkg.main
WHEN p_application_id = 555 THEN
xla_gmf_acct_hooks_pkg.main
WHEN p_application_id = 801 THEN
xla_pay_acct_hooks_pkg.main
ELSE
END CASE;
其中event_name为extract。然后调用arp_xla_extract_main_pkg.extract 来取子模块的分配。其主要作用是将来自子模块的分配。AR的发票、调整、收款、核销等子模块的帐的分配插入 ar_xla_lines_extract临时表,在这个package中可以看到xla是如何从业务模块数据取数的。