Sommige bedrijven laden maandelijks veel verkoopfacturen in Exact Online. Je kunt alle facturen handmatig afdrukken. Maar om de facturen definitief af te drukken, kun je ook een script gebruiken. Voordeel van een script is dat je meer vrijheden hebt hoe de facturen afgedrukt worden, los van de instellingen in Exact Online op administratie of klant. Je kunt met een script bijvoorbeeld gemakkelijk tussen lay-outs wisselen.
Met Invantive SQL kun je met het volgende SQL script alle verkoopfacturen of een deel daarvan afdrukken:
create or replace table invoicestoprint@inmemorystorage
as
select /*+ http_disk_cache(false) http_memory_cache(false) */
sie.InvoiceID
, sie.AmountDC
, sie.InvoiceDate
, sie.InvoiceToName
, sie.OrderNumber
, sie.YourRef
, sie.Description
, act.Language
, lyt.id
emaillayoutid
label 'Email Layout ID'
from exactonlinerest..salesinvoices@eol sie
join exactonlinerest..accounts@eol act
on act.id = sie.invoiceto
left
outer
join exactonlinerest..layouts@eol lyt
--
-- Email text layout.
--
on lyt.type = 2
and lyt.subject
=
case
when act.language in ('NL', 'EN')
then act.language
else 'EN'
end
|| ' Begeleidend schrijven verkoopfactuur'
where true
--
-- A list of sales orders to print based upon order number.
--
and sie.ordernumber in
(1, 2, 3)
--
-- Only consider non-final invoices.
--
and sie.status = 20
--
-- Perform the actual print, sending invoices from the
-- listed email address.
--
insert into PrintedSalesInvoices@eol
( invoiceid
, sendemailtocustomer
, senderemailaddress
, emaillayout
)
select invoiceid
, true
, 'finance@invantive.com'
, emaillayoutid
from invoicestoprint@inmemorystorage