Wij gebruiken het volgende script om reeds afgedrukte facturen uit SEDIS in te lezen in Exact Online:
--
-- Importeer alle reeds verzonden facturen uit SEDIS
-- in Exact Online.
--
-- Het factuurnummer in Exact Online is gelijk aan dat uit SEDIS.
--
rollback transaction
set use-http-memory-cache@eol false
set use-http-disk-cache@eol false
local define DIVISION "123456"
local define INVOICENUMBER_FROM "25100001"
local define INVOICENUMBER_TO "25100250"
begin transaction
insert into exactonlinerest..SalesEntries@eol
( Division
, EntryNumber
, InvoiceNumber
, Customer
, Description
, Journal
, Status
, Type
, EntryDate
, DueDate
, Currency
)
select ${DIVISION} Division
, ftr.InvoiceNumber EntryNumber
, ftr.InvoiceNumber
, act.Id Customer
, 'Factuur ' || invoiceNumber description
, '70' Journal
, 50
, case
when AmountDC < 0 then 21 else 20 end Type
, to_date(ftr.InvoiceDate, 'DD-MM-YYYY') InvoiceDate
, to_date(ftr.ExpiryDate, 'DD-MM-YYYY') DueDate
, ftr.Currency
from import20250115_ftr_sedis@sql ftr
left
outer
join ExactOnlineREST..AccountsBulk@eol act
on act.Division = ${DIVISION}
and act.Code = to_char(ftr.AccountCode)
and act.Status = 'C' /* Customer */
where ftr.LineNumber = 1
and to_char(ftr.InvoiceNumber) like '2510%'
and ftr.invoicenumber >= ${INVOICENUMBER_FROM}
and ftr.invoicenumber < ${INVOICENUMBER_TO}
identified by 'INVOICE' || ftr.InvoiceNumber
insert into ExactOnlineREST..SalesEntryLines@eol
( Division
, AmountFC
, Description
, GLAccount
, Quantity
, linenumber
, VATCode
, VATAmountFC
)
select ${DIVISION} Division
, ftr.AmountDC + 1 * ftr.VATAmountDC
, ftr.Description
, gat.ID GLAccount
, 1 Quantity
, ftr.linenumber
, ftr.VATCode
, ftr.VATAmountDC
from import20250115_ftr_sedis@sql ftr
left
outer
join GLAccountsBulk@eol gat
on gat.Division = ${DIVISION}
and gat.Code =
-- Vertaal oude grootboekrekeningen.
case
when ftr.Grootboek = '8000' then '80000'
else ftr.Grootboek
end
where 1=1
and ftr.invoicenumber >= ${INVOICENUMBER_FROM}
and ftr.invoicenumber < ${INVOICENUMBER_TO}
attach to 'INVOICE' || ftr.InvoiceNumber
commit transaction