我正在使用我们的查询工具为Exact Online的XML API的主题GLTransactions
生成XML文件。这些文件的输入是来自Twinfield的XML审计文件(XAF 3.1格式)。
由于Exact Online有一个混合分类账和许多约束,因此不可能直接加载银行分录。相反,当从Twinfield加载XML审计文件时,作为第一步,银行交易被发布到Exact Online的一个单独的总账账户中,并附带一个单独的日记账。
下一步,将保留的总账账户的Exact Online的内容发布到银行日记账中。Exact Online本身生成另一半作为银行总分类账的关联交易行。
用于生成银行分录的查询是:
create or replace table bank@inmemorystorage
as
select case
when substr(tle.description, 1, instr(tle.description, '/') - 1) = 'BNK'
then '20'
when substr(tle.description, 1, instr(tle.description, '/') - 1) = 'BNK2'
then '21'
else '??'
end
txn_journalcode
, txn.financialyear txn_financialyear
, txn.financialperiod txn_financialperiod
, txn.entrynumber txn_entrynumber
, txn.date txn_date
, tle.date tle_date
, tle.linenumber tle_linenumber
, substr(tle.description, instr(tle.description, '/') + 1, instr(tle.description, ':') - instr(tle.description, '/') - 1) tle_glaccountcode_target
, substr(tle.description, instr(tle.description, ':') + 2) tle_description
, trim(tle.accountcode) tle_accountcode
, tle.glaccountcode glaccountcode_source
, tle.amountdc tle_amountdc
, tle.vatcode tle_vatcode
, tle.yourref tle_yourref
from exactonlinerest..transactionlines tle
join exactonlinerest..transactions txn
on tle.entryid = txn.entryid
where tle.glaccountcode like '290%'
and substr(tle.description, instr(tle.description, '/') + 1, instr(tle.description, ':') - instr(tle.description, '/') - 1) not like '11%' /* Not a bank account. */
order
by tle.entrynumber
, tle.linenumber
select 'GLTransactions99-Interim-empty.xml'
filename
, stg.fileprefix
|| chr(13)
|| '<GLTransactions>'
|| xml
|| chr(13)
|| '</GLTransactions>'
|| stg.filepostfix
filecontents
from ( select listagg
( chr(13)
|| '<GLTransaction entry="'
|| txn_entrynumber
|| '">'
|| chr(13)
|| '<Journal code="'
|| txn_journalcode
|| '" />'
|| chr(13)
|| '<Date>'
|| substr(xmlencode(txn_date), 1, 10)
|| '</Date>'
|| chr(13)
|| xml
|| chr(13)
|| '</GLTransaction>'
, ''
) xml
from ( select txn_date
, txn_journalcode
, txn_financialyear
, txn_financialperiod
, txn_entrynumber
, listagg
( chr(13)
|| '<GLTransactionLine type="40" linetype="0" line="'
|| tle_linenumber
|| '" offsetline="1" status="20">'
|| chr(13)
|| '<Date>'
|| substr(xmlencode(tle_date), 1, 10)
|| '</Date>'
|| chr(13)
|| '<FinYear number="'
|| txn_financialyear
|| '" />'
|| chr(13)
|| '<FinPeriod number="'
|| txn_financialperiod
|| '" />'
|| chr(13)
|| '<GLAccount code="'
|| case
when tle_glaccountcode_target = '1560'
then '2902' /* Separate interim GL account, Twinfield does not provide separated. */
else xmlencode(tle_glaccountcode_target)
end
|| '" />'
|| case
when tle_description is not null
then chr(13)
|| '<Description>'
|| xmlencode(tle_description)
|| '</Description>'
end
|| case
when tle_accountcode is not null
then chr(13)
|| '<Account code="'
|| xmlencode(tle_accountcode)
|| '" />'
end
|| chr(13)
|| '<Amount>'
|| '<Currency code="EUR" />'
|| '<Value>'
|| -1 * tle_amountdc
|| '</Value>'
|| case
when tle_glaccountcode_target like '4%'
then '<VAT code="GB" />' /* GB = No VAT. */
else ''
end
|| '</Amount>'
|| chr(13)
|| '</GLTransactionLine>'
, ''
)
xml
from bank@inmemorystorage
group
by txn_date
, txn_journalcode
, txn_financialyear
, txn_financialperiod
, txn_entrynumber
)
)
join settings@inmemorystorage stg
on 1=1
在bank@inmemorystorage
中的tle_yourref
列中,有一个以逗号分隔的相关销售/采购发票列表。
当在银行日记账上手动输入总账交易时,您的参考内容由对账窗口填充。但是,当我从带有事务的Exact Online导出XML文件时,您的ref缺失。
目前,我似乎无法通过精确在线的XML或REST API自动协调银行日记账中的这些交易。
作为一种变通方法,你可以在对账窗口中选择每个单独的账户(它们实际上都是0欧元),然后选择自动对账。但是从Twinfield到Exact Online的每次转换都有太多的账户要做。
是否有另一种方法可以通过Exact Online的API (REST或XML)将发票与银行交易关联?
如果发票和付款之间存在1对1的关系(因此只有1个发票和1笔付款),您可以在银行入库中使用<References><InvoiceNumber>put invoice entrynumber here</InvoiceNumber></References>
使其自动对账。
另一种可能性是创建一个主题为MatchSets
的XML文件(请参阅文档),以便之后进行匹配。
另外,你还可以说:
<References><EntryNumber>10000012</EntryNumber><InvoiceNumber>FAC0001</InvoiceNumber></References>
当关系为1=1时,这总是有效的。如果只指定发票号码,则匹配通常会静默失败。