C******************************************************************************
	SUBROUTINE AK$SUM
C******************************************************************************
C AKSUM.FOR
C
C  written by:  K. Trumbley
C  date:        May 1984
C
	INCLUDE 'AK.INC/NOLIST'
	INCLUDE 'BK.INC/NOLIST'
	REAL*4 COST
	CHARACTER DATE_STRING*24
	EQUIVALENCE (DUMMY_STR,DUMMY_LOG)
C
C  Search AK$SUMMARY for current username
C
	IF (TOT_USR.EQ.0) GOTO 100
	DO USER=1,TOT_USR
	  IF (AK$USR_NAM.EQ.AK$SUMMARY(USER)(2:13)) GOTO 110
	END DO
C
C  Add new user to AK$SUMMARY
C
 100	TOT_USR=TOT_USR+1
	IF (AK$LOG_CNT.EQ.0) THEN
	  AK$LST_LOG='           '
	ELSE
	  ISTAT=SYS$ASCTIM(,DATE_STRING,AK$END_DATE,)
	  AK$LST_LOG=DATE_STRING(1:11)
	END IF
	AK$SUMMARY(TOT_USR)=AK$RECORD
	RETURN
C
C  Totalize user record in AK$RECORD with AK$SUMMARY(USER)
C
 110	CONTINUE
	CALL AK$ADD_TOTAL(USER)
C
C  Replace UIC and ACCOUNT fields with latest information
C
	BK$RECORD=AK$SUMMARY(USER)
C
	BK$USR_GRP=AK$USR_GRP
	BK$USR_MEM=AK$USR_MEM
	BK$USR_ACC=AK$USR_ACC
	IF (AK$LOG_CNT.NE.0) THEN
	  ISTAT=SYS$ASCTIM(,DATE_STRING,AK$END_DATE,)
	  BK$LST_LOG=DATE_STRING(1:11)
	END IF
C
	AK$SUMMARY(USER)=BK$RECORD
	RETURN
	END
