rem alert(clpstat$+ordstat$+A.order$+A.stm$+A.state$+mrkstat$+sttstat$+stmstat$)
rem what if we are starting half way through a mark total
if ((clpstat$="Off")and(ordstat$="ChequeBook")and(onfilt$="On")and(A.order$<>"0")and(A.stm$="x")and(A.state$<>" ")and(mrkstat$="On")and(sttstat$="On")and(stmstat$="On")) rem posibility that there is something above this (defensive coding?)
lstate$=A.state$
position rptr%:(curidx%,(pos%+k%-1))
rem alert(lstate$,A.state$)
if (lstate$=A.state$) rem already there, dont worry
while ((A.state$=lstate$)and(pos%+k%>=1))
k%=k%-1
if (pos%+k%<filepos%) rem should always be true
missing%=missing%-1
endif
lstate$=A.state$
position rptr%:(curidx%,pos%+k%-1)
rem alert(lstate$+"*"+A.state$+"*",num$(pos%,10))
endwh
endif
endif
rem alert("missing "+num$(missing%,10))
pos%=pos%+k%
k%=0
rem alert(num$(pos%,10))
lstate$="Nothing"
htotal=0 rem initialise hold total to 0 for mark total compression
while ((j%<=scrlen%)and(pos%+k%<count))
if ((stmstat$="On")and(mrkstat$="On")and(sttstat$="On"))
position rptr%:(curidx%,(pos%+k%))
else
position pos%+k%+1
endif
if (mrkstat$="Off")
gat 6,(i%*linehi%+linea%+linehi%+3) :gprintb C.mark$,55,3
gat 79,(i%*linehi%+linea%+linehi%+3) :gprintb C.amm$,statmx%-104,1
gat statmx%-21,(i%*linehi%+linea%+linehi%+3) :gprintb C.stm$,10,3
elseif (sttstat$="Off")
rem dont print month and year if they are 0
if (C.mon$<>"0")
gat 2,(i%*linehi%+linea%+linehi%+3) :gprintb C.mon$,28,1 rem s3a
rem s3z gat 2,(i%*linehi%+linea%+linehi%+3) :gprintb C.mon$,30,1
endif
if (C.yr$<>"0")
gat 52,(i%*linehi%+linea%+linehi%+3) :gprintb C.yr$,48,3 rem s3a
rem s3z gat 37,(i%*linehi%+linea%+linehi%+3) :gprintb C.yr$,48,3
endif
gat 102,(i%*linehi%+linea%+linehi%+3) :gprintb C.type$,188,2 rem s3a
gat 200,(i%*linehi%+linea%+linehi%+3) :gprintb C.amm$,90,1 rem s3a
rem s3z gat 77,(i%*linehi%+linea%+linehi%+3) :gprintb C.type$,120,2
rem s3z gat 132,(i%*linehi%+linea%+linehi%+3) :gprintb C.amm$,90,1
elseif (stmstat$="Off")
if (why$="Off")
disp$=B.desc$+"("+B.type$+")"
else
disp$=B.desc$
endif
gat 8,(i%*linehi%+linea%+linehi%+3) :gprintb left$(B.sdate$,8),80,3 rem s3a
gat 90,(i%*linehi%+linea%+linehi%+3) :gprintb disp$,120,2 rem s3a
gat 202+(40-gtwidth(B.amm$)),(i%*linehi%+linea%+linehi%+3) :gprintb B.amm$,gtwidth(B.amm$)+10,1 rem s3a
gat 254,(i%*linehi%+linea%+linehi%+3) :gprintb left$(B.pdate$,8),78,3 rem s3a
gat 334,(i%*linehi%+linea%+linehi%+3) :gprintb B.rep$,126,2 rem s3a
rem s3z gat 5,(i%*linehi%+linea%+linehi%+3) :gprintb left$(B.sdate$,8),50,3
rem s3z gat 54,(i%*linehi%+linea%+linehi%+3) :gprintb disp$,60,2
rem s3z gat 111-gtwidth(B.amm$),(i%*linehi%+linea%+linehi%+3) :gprintb B.amm$,gtwidth(B.amm$)+1,1
rem s3z gat 112,(i%*linehi%+linea%+linehi%+3) :gprintb left$(B.pdate$,8),50,3
rem s3z gat 162,(i%*linehi%+linea%+linehi%+3) :gprintb B.rep$,70,2
if (B.always$="No")
gat 388,(i%*linehi%+linea%+linehi%+3) :gprintb B.until$,71,3 rem s3a
rem s3z gat 184,(i%*linehi%+linea%+linehi%+3) :gprintb B.until$,48,3