Voorbeeld massaal aanmaken verkoopfacturen in Exact Online

Het volgende script maakt 60 verkoopfacturen in Exact Online voor de klant met code 4. De reeks facturen wordt gegenereerd via range. Elk bestaand artikel wordt in elke factuur verwerkt.

Het gebruikt synchronize (zie 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 to Exact Online as 60 API calls, each as a batch
  -- consisting of one invoicese plus some invoice lines.
  --
  commit;
end;

Dank voor delen leuke toepassing!

Dit topic is 3 dagen na het laatste antwoord automatisch gesloten. Nieuwe antwoorden zijn niet meer toegestaan.