FUNCTION runscript(_self, _cScriptName)
//-DEFAULTSCRIPT-//
// -----------------------------------------
// 'Buchungsprotokoll'
// -----------------------------------------
// bentigte Script's
global Kopfzeile := _cScriptName + "01.txt"
global Leerzeile := _cScriptName + "02.txt"
global Outline := _cScriptName + "03.txt"
global OutlineVtAnt := _cScriptName + "04.txt"

local m
local n
local aInk
local aProv
local aSchaden
local aVV
local aRueLaGeb
local aVUAbr
local aVtAbr
local aVUAKto
local aBankBelAusglDiff
local aBankBelSach
local aVtAnt
local aHonorar
local nOK
local nGesamt
local cGesamt

aInk := _self:aInk
aProv := _self:aProv
aSchaden := _self:aSchaden
aVV := _self:aVV
aRueLaGeb := _self:aRueLaGeb
aVUAbr := _self:aVUAbr
aVtAbr := _self:aVtAbr
aVUAKto := _self:aVUAKto
aBankBelAusglDiff := _self:aBankBelAusglDiff
aBankBelSach := _self:aBankBelSach
aVtAnt := _self:aVtAnt
aHonorar := _self:aHonorar
nOK := 0

nGesamt := len(aInk)
nGesamt := nGesamt + len(aProv)
nGesamt := nGesamt + len(aSchaden)
nGesamt := nGesamt + len(aVV)
nGesamt := nGesamt + len(aRueLaGeb)
nGesamt := nGesamt + len(aVtAnt)
nGesamt := nGesamt + len(aVUAbr)
nGesamt := nGesamt + len(aVtAbr)
nGesamt := nGesamt + len(aVUAKto)
nGesamt := nGesamt + len(aBankBelAusglDiff)
nGesamt := nGesamt + len(aBankBelSach)
cGesamt := alltrim(str(nGesamt))

_SELF:nSeite := 1

_SELF:seite_neue_seite()
_SELF:seite_waehle_papierformat( _self:_papier_A4(), _self:_format_querformat() )
_SELF:seite_setze_raender( 150, 250, 150, 250 )
_SELF:wYTemp := 0
ExecuteScript(Kopfzeile, _self)	

// Inkassobuchungen
IF ( m := Len(aInk) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aInk[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// Prov-Buchungen
IF ( m := Len(aProv) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aProv[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// Schadensbuchung
IF ( m := Len(aSchaden) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aSchaden[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// VV
IF ( m := Len(aVV) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aVV[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// RueLaGeb
IF ( m := Len(aRueLaGeb) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aRueLaGeb[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aVUAbr
IF ( m := Len(aVUAbr) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aVUAbr[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aVtAbr
IF ( m := Len(aVtAbr) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aVtAbr[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aVUAKto
IF ( m := Len(aVUAKto) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aVUAKto[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aBankBelAusglDiff
IF ( m := Len(aBankBelAusglDiff) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aBankBelAusglDiff[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aBankBelSach
IF ( m := Len(aBankBelSach) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aBankBelSach[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

// aHonorar
IF ( m := Len(aHonorar) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(Outline, _self, aHonorar[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF


// VtAnt
IF ( m := Len(aVtAnt) ) > 0
 FOR n := 1 TO m
  nOK := nOK + 1
  ExecuteScript(OutLineVtAnt, _self, aVtAnt[n], cGesamt, nOK)	
 NEXT n
  ExecuteScript(Leerzeile, _self)	
ENDIF

RETURN
