1 ! LOGTTYY.BAS [1,100]
2 ! 
	 ! RUN UNDER BA5
100	 ! 
	 ! VARIABLE DEFINITIONS, DIMENSIONS
	 ! 
110 DIM R$[60]V		 ! RECORD STRING FOR TERMINAL FILES
111 DIM L$[60]V		 ! INPUT VARIABLE FOR USER DESCRIPTION FILES
115 DIM FF$[50]V	 ! FOR MASTER FILE NAME
120 DIM AN$[60]V	 ! ACCOUNT NAME (DEPT)
125 DIM NF$[4]V(45)	 ! USER DESCRIPTION FILE NAME
150 DIM M$[3](12) ! MONTH NAMES
170 DIM VA(45,12),HT(45) ! HOURS PER MONTH, TOTALS
400 FL=0 : MM=6
410 FOR I=1 TO 45 : HT(I)=-1 : NEXT I
430	M$(1)="JAN" :
	M$(2)="FEB" :
	M$(3)="MAR" :
	M$(4)="APR" :
	M$(5)="MAY" :
	M$(6)="JUN" :
	M$(7)="JUL" :
	M$(8)="AUG" :
	M$(9)="SEP" :
	M$(10)="OCT" :
	M$(11)="NOV" :
	M$(12)="DEC" :			 ! NAMES OF MONTHS
600	 ! ASK USER FOR MONTH
610 INPUT "FISCAL YEAR OF CONCERN (YY) "; Y&
650 D1=DCEN("07/01/"+STR$(Y&-1))		 ! FIRST DAY OF FY
	D2=DCEN("6/30/"+STR$(Y&))		 ! LAST DAY OF FY
680 INPUT "FILE NAME FOR OUTPUT",FF$:
	 OPEN #5,FF$+"/WR/LN:84"
690 INPUT "FILE NAME FOR USERS ",FF$:
	 OPEN #6,FF$+"/RO/SH/EN:900" : PRINT 
700 GOSUB 1200
710 INPUT LINE #6,AN$ : PRINT AN$
720 UR=VAL(SBS$(AN$,1,2)):
	NF$(UR)=PIECE$(AN$,",",1):
	AN$=PIECE$(AN$,",",2,60)
840	 GOSUB 2000 ! PLOT
850	HT(UR)=VA(UR,0)
860 FL=FL+1
870 IF FL=2 THEN FL=0 : PRINT #5,CHR$(12)
890 GOTO 710
900 GOSUB 3000
910 CLOSE 
920 PRINT 
930 EXIT 
1200	 ! 
	 ! CONNECT TIME
	 ! 
1210	OPEN #3,"TTYTOTS.DAT/RO/EN:1290"
1220		INPUT LINE #3,R$
1230		IF LEN(R$)=0 THEN 1220
1240		IF LEN(R$)=8 THEN MM=MM+1 : IF MM=13 THEN MM=1
1250		INPUT LINE #3,R$
1260		IF LEFT(R$,3)="TOT" THEN 1220
1270			TT=VAL(SBS$(R$,3,2))
1280			VA(TT,MM)=VAL(SBS$(R$,12,5)) : GOTO 1250
1290	CLOSE 3
1299 RETURN 
2000	 ! 
	 ! PRINT PLOT FOR EACH PROJECT
	 ! 
2200	 ! 
	 ! PRINT HEADINGS
	 ! 
2210	 PRINT #5
2220	 PRINT #5,TAB(24);"MICHAEL REESE HOSPITAL AND MEDICAL CENTER" :
	 PRINT #5,TAB(24);"      DEPARTMENT OF MEDICAL PHYSICS      " :
	 PRINT #5 : PRINT #5
2230	 PRINT #5,"    BIOMEDICAL COMPUTATION DIVISION";TAB(74);DDAT$(0) :
	 PRINT #5 : PRINT #5
2240	 PRINT #5,"    PLOT FOR FISCAL YEAR 19";STR$(Y&);" -- ";AN$ :
	 PRINT #5,TAB(5);STRING$("-",29+LEN(AN$))
2250	 PRINT #5 : PRINT #5
2260	 PRINT #5,TAB(14);"HOURS"
2270	 PRINT #5
2300	 ! 
	 ! PRINT HOURS
	 ! 
2310	 FOR J=7 TO 12 :
		 PRINT #5,TAB(5);M$(J);TAB(13); :
			 PRINT #5,FRMT$(VA(UR,J),6,1);" !";
2320			KK=INT(2*VA(UR,J)) : IF KK>60 THEN KK=60
2330			 FOR K=1 TO KK : PRINT #5,"*"; : NEXT K : PRINT #5
2340		VA(UR,0)=VA(UR,0)+VA(UR,J) :
	 NEXT J
2350	 FOR J=1 TO 6 :
		 PRINT #5,TAB(5);M$(J);TAB(13); :
			 PRINT #5,FRMT$(VA(UR,J),6,1);" !";
2360			KK=INT(2*VA(UR,J)) : IF KK>60 THEN KK=60
2370			 FOR K=1 TO KK : PRINT #5,"*"; : NEXT K : PRINT #5
2380		VA(UR,0)=VA(UR,0)+VA(UR,J) :
	 NEXT J
2400	 ! 
	 ! PRINT TOTAL HOURS
	 ! 
2410	 PRINT #5
2420	 PRINT #5,TAB(5);"TOTAL:"; TAB(11); :
		 PRINT #5,FRMT$(VA(UR,0),8,1);	 ! TERMINAL TIME
2430		 PRINT #5," HOURS";TAB(55);"(* = 1/2 HOUR)"
2440	 PRINT #5 : PRINT #5 : PRINT #5 : PRINT #5
2490	 RETURN 
3000	 ! 
	 ! PRINT PLOT FOR ALL PROJECTS FOR THE MONTH
	 ! 
3200	 ! 
	 ! PRINT HEADINGS
	 ! 
3210	 PRINT #5,CHR$(12)
3220	 PRINT #5,TAB(24);"MICHAEL REESE HOSPITAL AND MEDICAL CENTER" :
	 PRINT #5,TAB(24);"      DEPARTMENT OF MEDICAL PHYSICS      " :
	 PRINT #5 : PRINT #5
3230	 PRINT #5,"    BIOMEDICAL COMPUTATION DIVISION";TAB(74);DDAT$(0) :
	 PRINT #5 : PRINT #5
3240	 PRINT #5,"    PLOT FOR FISCAL YEAR 19";STR$(Y&);" -- ALL TERMINALS" :
	 PRINT #5,TAB(5);STRING$("-",42)
3250	 PRINT #5 : PRINT #5
3260	 PRINT #5,TAB(14);"HOURS"
3270	 PRINT #5
3300	 ! 
	 ! PRINT HOURS
	 ! 
3310	 FOR J=1 TO 45		 ! FOR EACH TERMINAL
		IF HT(J)=-1 THEN 3399
3315		 PRINT #5,TAB(5);"TT";NF$(J);
3320		 PRINT #5,TAB(11);
3325		 PRINT #5,FRMT$(HT(J),8,1);" !";
3330		KK=INT(HT(J)/3) : IF KK>60 THEN KK=60
3335		 FOR K=1 TO KK
3340			 PRINT #5,"*";
3345		 NEXT K : PRINT #5
3360	HT(0)=HT(0)+HT(J)	 ! TOTAL # OF TERMINAL HRS
3399	 NEXT J
3400	 ! 
	 ! PRINT TOTAL HOURS
	 ! 
3410	 PRINT #5
3420	 PRINT #5,TAB(5);"TOTAL:"; TAB(11); :
		 PRINT #5,FRMT$(HT(0),8,1);	 ! TERMINAL TIME
3430		 PRINT #5," HOURS";TAB(55);"(* = 3 HOURS)"
3440	 RETURN 
