10 ! loginout.bas ! to plot log in and out time for a given period ! this version does a bar graph output ! for greatest elapsed time, even if logged out during day 100 dim l$[56],n$[50]v,d1$[9],d2$[9],o1$[9],o2$[1](56),o3$[56]v,xd$[8]v,mo$[36] 101 dim da$[21],tt$[4] 105 mo$="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" 106 da$="SunMonTueWedThuFriSat" 110 sd=24*3600 ! seconds per day 120 open #4, "LOGIO.DOC/WR" 125 set upper on 130 input "User Name ";n$ 150 set upper off 160 print #4,"User Name ";N$; 165 n$="SD:[1,100]"+n$+".LOG/RN/RO/SH/LN:56" 170 for jj=1 to 53 step 4 171 o2$(jj)=" " :o2$(jj+1)=" " :o2$(jj+2)=" " : o2$(jj+3)="|" : next jj 175 input "Month,Year to plot ";mo,yr 180 d1$="01-"+sbs$(mo$,3*mo-2,3)+"-"+frmt$(yr,2) : df=dcen(d1$) 185 if df<1 then print "Invalid date, " : goto 210 190 print #4,tab(25);"Starting date ";d1$; 195 mo=mo+1 : if mo=13 then let yr=yr+1 : mo=1 200 d2$="01-"+sbs$(mo$,3*mo-2,3)+"-"+frmt$(yr,2) : dl=dcen(d2$)-1 : d2$=ddat$(dl) 205 print #4,tab(50);"Final date ";d2$ 210 xd$="" 215 open #3,n$: n=nrc(3) : if n<6 then 1010 220 print #4, "Day date 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 total" 225 print #4, "-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+" 230 lf=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 #4, sbs$(da$,dw*3+1,3);" ";xd$;" |";o3$;" "; 350 if cm>=10 then print #4, frmt$(ch,2);":";frmt$(cm,2) 360 if cm<10 then print #4, frmt$(ch,2);":0";frmt$(cm,1) 370 print #4,"-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+" 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 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 #4, sbs$(da$,dw*3+1,3);" ";xd$;" |";o3$;" "; 470 if cm>=10 then print #4, frmt$(ch,2);":";frmt$(cm,2) 480 if cm<10 then print #4, frmt$(ch,2);":0";frmt$(cm,1) 490 print #4, "-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+" 500 print #4, "day date 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21" 520 tm=tm+60*(oh-ih)+om-im 530 th=int(tm/60) : tm=int(tm-th*60) 540 print #4, tab(54);"Total connect :";frmt$(th,4);":";frmt$(tm,2) : print #4 550 close 560 print "Output is in file LOGIO.DOC" 570 exit