簡體   English   中英

具有自動對帳功能的精確在線導入 GLTransactions

[英]Exact Online import GLTransactions with automatic reconciliation

我正在使用我們的查詢工具為 Exact Online 的 XML API 的主題GLTransactions生成 XML 文件。 這些文件的輸入是來自 Twinfield(XAF 3.1 格式)的 XML 審計文件。

由於 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 'GLTransactions\99-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 文件時,您的引用丟失了。

目前我似乎無法通過 Exact Online 的 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 時,這始終有效。 如果您僅指定發票編號,則匹配通常會以靜默方式失敗。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM