Eksempel på masseoppretting av salgsfakturaer i Exact Online

Følgende skript oppretter 60 salgsfakturaer i Exact Online for kunden med kode 4. Serien med fakturaer genereres via range. Hver eksisterende artikkel behandles i hver faktura.

Det bruker synchronize (se Exact Online synchroniseren met Visma.net Financials):

begin
  begin transaction;
  insert into exactonlinerest..salesinvoices@eol
  ( invoiceto
  , orderedby
  , deliverto
  , description
  )
  select act.Id
  ,      act.id
  ,      act.id
  ,      'Voorbeeld'
  from   ExactOnlineREST..Accounts@eol act
  join   range@datadictionary(60) rge
  where  act.Code = '4'
  identified 
  by     'f' || rge.value
  ;
  insert into exactonlinerest..salesinvoicelines@eol
  ( item
  , quantity
  , description
  )
  select id
  ,      round(random(10)*10, 0)+ 1
  ,      'Voorbeeld ' || code
  from   exactonlinerest..items@eol
  join   range@datadictionary(10) artmult
  join   range@datadictionary(60) rge
  attach 
  to     'f' || rge.value
  ;
  --
  -- Send til Exact Online som 60 API-kall, hver som en batch
  -- som består av én faktura pluss noen fakturalinjer.
  --
  commit;
end;

Takk for at du delte en fin bruksmåte!