1 ! LOGTTYM.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(30)	! USER DESCRIPTION FILE NAME
150 DIM M$[3](12),M&(12) ! MONTH NAMES, # OF DAYS IN MONTH
170 DIM H(31),HT(30)	! HOURS PER DAY
430	M$(1)="JAN" : M&(1)=31 :
	M$(2)="FEB" : M&(2)=29 :
	M$(3)="MAR" : M&(3)=31 :
	M$(4)="APR" : M&(4)=30 :
	M$(5)="MAY" : M&(5)=31 :
	M$(6)="JUN" : M&(6)=30 :
	M$(7)="JUL" : M&(7)=31 :
	M$(8)="AUG" : M&(8)=31 :
	M$(9)="SEP" : M&(9)=30 :
	M$(10)="OCT" : M&(10)=31 :
	M$(11)="NOV" : M&(11)=30 :
	M$(12)="DEC" : M&(12)=31	! NAMES OF MONTHS, DAYS IN MONTH
500 OPEN #3,"FOR002.DAT/RO/EN:900"
510 INPUT LINE #3,R$
600	 ! ASK USER FOR MONTH
610 INPUT "MONTH OF CONCERN (MMYY) "; M
620 M&=INT(M/100) : IF M&<1 OR M&>12 THEN  PRINT "BAD MONTH" : GOTO 610
630 Y&=M-(M&*100) ! YEAR
635 IF 4*INT(Y&/4)<>Y& THEN M&(2)=28	! CORRECT FOR NON LEAP YEAR
640 IF M&>6	 THEN FY&=Y&+1
		 ELSE FY&=Y&		! FISCAL YEAR IS JULY-JUNE
650 D1=DCEN(STR$(M&)+"/01/"+STR$(Y&))		! FIRST DAY OF MONTH
	D2=D1 + M&(M&)-1			! LAST  DAY OF MONTH
680 INPUT "FILE NAME FOR OUTPUT",FF$:
	OPEN #5,FF$+"/WR/LN:84"
700 INPUT "FILE NAME FOR USERS ",FF$: UR=0:
	OPEN #6,FF$+"/RO/SH/EN:900" : PRINT
710 INPUT LINE #6,AN$ : PRINT AN$ : UR=UR+1
720 NF$(UR)=PIECE$(AN$,",",1): NF=VAL(NF$(UR)):
	AN$=PIECE$(AN$,",",2,60)
740 FOR J=0 TO 31 : H(J)=0 : NEXT J
820	GOSUB 1220 ! GET TERMINAL TIME
840	GOSUB 2000 ! PLOT
850	HT(UR)=H(0)
890 GOTO 710
900 GOSUB 3000
910 CLOSE
920 PRINT
930 EXIT
1200	 !
	 ! CONNECT TIME
	 !
1210 INPUT LINE #3,R$
1220 NR=VAL(LEFT(R$,3))
1230 IF NR<NF THEN 1200
1240 IF NR>NF THEN 1299
1250	DR&=VAL(SBS$(R$,8,2))	! DAY OF MONTH
	O1=VAL(SBS$(R$,14,8))/360 :
	H(DR&)=H(DR&)+O1	! ADD TERMINAL TIME
1280 GOTO 1200
1299 RETURN
2000	 !
	 ! PRINT PLOT FOR EACH PROJECT
	 ! 
2200	 !
	 ! PRINT HEADINGS
	 ! 
2210	 PRINT #5,CHR$(12)
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 ";M$(M&);", 19";STR$(Y&);" -- ";AN$ :
	 PRINT #5,TAB(5);STRING$("-",22+LEN(AN$))
2250	 PRINT #5 : PRINT #5
2260	 PRINT #5,TAB(14);"HOURS"
2270	 PRINT #5
2300	 !
	 ! PRINT HOURS
	 ! 
2310	 FOR J=1 TO M&(M&)		! FOR EACH DAY OF THE MONTH
2315		 PRINT #5,TAB(5);M$(M&);J;
2320		 PRINT #5,TAB(13);
2325		PRINT #5,FRMT$(H(J),6,1);" !";
2330		KK=INT(10*H(J)) : IF KK>60 THEN KK=60
2335		FOR K=1 TO KK
2340			PRINT #5,"*";
2345		NEXT K : PRINT #5
2360	H(0)=H(0)+H(J)	! TOTAL # OF TERMINAL HRS
2399	 NEXT J
2400	 !
	 ! PRINT TOTAL HOURS
	 ! 
2410	 PRINT #5
2420	 PRINT #5,TAB(5);"TOTAL:"; TAB(11); :
		 PRINT #5,FRMT$(H(0),8,1);	! TERMINAL TIME
2430		PRINT #5," HOURS";TAB(55);"(* = 1/10 HOUR)"
2440	RETURN
3000	 !
	 ! PRINT PLOT FOR ALL PROJECTS FOR THE MONTH
	 ! 
	OPEN #7,"TTYTOTS.DAT/LN:100/AP"
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 ";M$(M&);", 19";STR$(Y&);" -- ALL TERMINALS" :
	 PRINT #7 : PRINT #7,M$(M&);" 19";STR$(Y&) :
	 PRINT #5,TAB(5);STRING$("-",35)
3250	 PRINT #5 : PRINT #5
3260	 PRINT #5,TAB(14);"HOURS"
3270	 PRINT #5
3300	 !
	 ! PRINT HOURS
	 ! 
3310	 FOR J=1 TO UR		! FOR EACH TERMINAL
3315		 PRINT #5,TAB(5);"TT";NF$(J);
3320		 PRINT #5,TAB(11);
3325		PRINT #5,FRMT$(HT(J),8,1);" !";
3330		KK=INT(2*HT(J)) : IF KK>60 THEN KK=60
3335		FOR K=1 TO KK
3340			PRINT #5,"*";
3345		NEXT K : PRINT #5
3350		PRINT #7,"TT";NF$(J);"    ";FRMT$(HT(J),8,1)
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);"(* = 1/2 HOUR)"
3440	PRINT #7,"TOTAL   ";FRMT$(HT(0),8,1)
3450	RETURN
