10 ! loginout.bas ! to plot log in and out time for a given week ! this version does a bar graph output ! for greatest elapsed time, even if logged out during day 100 dim l$[56],un$[9]v,n$[50]v,d1$[9],d2$[9],o1$[9],o2$[1](56),o3$[56]v,xd$[8]v,mo$[36] 110 dim da$[21],tt$[4] 120 mo$="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" 130 da$="SunMonTueWedThuFriSat" 140 sd=24*3600 ! seconds per day 145 set upper on : input "User Name ";un$ : set upper off 150 n$="SD:[1,100]"+un$+".LOG/RN/RO/SH/LN:56" 160 for jj=1 to 53 step 4 170 o2$(jj)=" " :o2$(jj+1)=" " :o2$(jj+2)=" " : o2$(jj+3)="|" : next jj 180 set upper on: input "Starting date ";d1$ : set upper off 185 df=dcen(d1$) : if df<1 then print "Invalid date, " : goto 180 190 dw=df-int(df/7)*7 : df=df-dw :d1$=ddat$(df) : !Always start on Sunday 195 dl=df+6 200 print chr$(27)"[H";chr$(27);"[J"; : break 205 print chr$(27)"[H";chr$(27);"[K"; : break 206 print "Logged in time for ";un$;" for week starting on Sunday ";d1$ 210 xd$="" 215 open #3,n$: n=nrc(3) : if n<6 then 1010 220 print " " 222 print "Day date 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 total" 225 print "-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ " 230 lf=0 : xy=0 235 xd$="00/00/00" 240 for i=6 to n 250 input line #3@i,l$ 255 di=dcen(sbs$(l$,1,8)) ! login date 260 do=dcen(sbs$(l$,20,8)) ! logout date 265 if didl then 400 271 if do=di then 275 272 ! correct logout next day to be logout at 18:00 hours same day 273 l$=sbs$(l$,1,28)+"18:00:00"+sbs$(l$,37,20) 275 if xy=1 then 280 : check for first day of rpt 276 xy=1 : xd$=sbs$(l$,1,8) : xx=dcen(xd$) : dw=xx-int(xx/7)*7 277 for jj=1 to 53 step 4 278 o2$(jj)=" " :o2$(jj+1)=" " :o2$(jj+2)=" " : o2$(jj+3)="|" : next jj 279 ih=val(sbs$(l$,10,2)) : im=val(sbs$(l$,13,2)) 280 ld=val(sbs$(xd$,4,2)) 285 if ld=val(sbs$(l$,4,2)) then 390 : !if same day, just update logout time 290 ! new day, set things up 300 fi=(ih*60+im)/15-28 : if fi<1 then let fi=1 305 if fi>56 then let fi=56 310 fo=(oh*60+om)/15-28 : if fo>56 then let fo=56 315 if fo<1 then let fo=1 320 for jj=fi to fo : o2$(jj)="*" : next jj 325 cm=oh*60-ih*60+om-im : ch=int(cm/60) : cm=cm-ch*60 330 o3$="" : for jj=1 to 56 : o3$=o3$+o2$(jj) : next jj 340 print sbs$(da$,dw*3+1,3);" ";xd$;" |";o3$;" "; 350 if cm>=10 then print frmt$(ch,2);":";frmt$(cm,2) 360 if cm<10 then print frmt$(ch,2);":0";frmt$(cm,1) 370 print "-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ " 375 xd$=sbs$(l$,1,8) : xx=dcen(xd$) 380 dw=xx-int(xx/7)*7 385 for jj=1 to 53 step 4 386 o2$(jj)=" " :o2$(jj+1)=" " :o2$(jj+2)=" " : o2$(jj+3)="|" : next jj 388 tm=tm+60*(oh-ih)+om-im : goto 395 390 ix=val(sbs$(l$,10,2))*60+val(sbs$(l$,13,2)) 391 iy=ih*60+im : if iy56 then let fi=56 430 fo=(oh*60+om)/15-28 : if fo>56 then let fo=56 435 if fo<1 then let fo=1 440 for jj=fi to fo : o2$(jj)="*" : next jj 450 o3$="" : for jj=1 to 56 : o3$=o3$+o2$(jj) : next jj 455 cm=oh*60-ih*60+om-im : ch=int(cm/60) : cm=cm-ch*60 460 print sbs$(da$,dw*3+1,3);" ";xd$;" |";o3$;" "; 470 if cm>=10 then print frmt$(ch,2);":";frmt$(cm,2) 480 if cm<10 then print frmt$(ch,2);":0";frmt$(cm,1) 490 print "-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ " 500 print "Day date 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 " 505 print 510 print chr$(27);"[J"; : break 520 tm=tm+60*(oh-ih)+om-im 530 th=int(tm/60) : tm=int(tm-th*60) 540 print tab(55);"Total connect :";frmt$(th,4);":";frmt$(tm,2) 550 close 570 if end then 600 580 set upper on: input "Starting date ";d1$ : set upper off 582 if d1$=" " then let df=dl+1 : goto 590 585 df=dcen(d1$) : if df<1 then print "Invalid date, " : goto 580 590 d1$=ddat$(df) : dl=df+6 595 for jj=1 to 53 step 4 596 o2$(jj)=" " :o2$(jj+1)=" " :o2$(jj+2)=" " : o2$(jj+3)="|" : next jj 597 goto 205 600 exit