SUBROUTINE AC_RPT1_PRN(Dummy)
Dummy = ''
* LIST ANNUAL_CONTRACTS JUSTLEN 4 CUST_NAME JUSTLEN 30 PO JUSTLEN 18 STATUS JUSTLEN 6 TOT_CONTRACT_AMOUNT TOT_REL_AMOUNT BALANCE HEADING " Annual Contracts by Company 'T' PAGE # 'PPL'"
* 
DECLARE FUNCTION SET_STATUS, SET_FSERROR, SEND_INFO, SET_ROWDEF, SET_PRINTER
* HEADING/FOOTING
TheHeader = " Annual Contracts by Company 'D' 'T' PAGE # 'P'"
HeadPos   = '.75,2.5,1.25,1,1.5,1.5,1.5'
convert ',' to @fm in HeadPos
ColHeader = "Key" : @vm : "Customer" : @vm : "PO" : @vm : "Status" : @vm : "Contract Amount" : @vm : "Release Amount":@vm: "Balance"
ColHeader<-1> = str( '-', 5 ):@vm:str( '-', 25 ):@vm:str( '-', 15 ):@vm:str( '-', 15 ):@vm:str( '-', 17 ):@vm:str( '-', 17 ):@vm:str( '-', 17 )
Void = set_printer( 'FONTHEADFOOT' )
Void = set_printer( 'HEADER', TheHeader, HeadPos, ColHeader )
* 
@RECCOUNT=0
FIRST.PASS=1
LAST.RECORD=0
READERR=0
* 
* OPEN DICT AND DATA FILES
* 
OPEN "DICT","ANNUAL_CONTRACTS" TO @DICT ELSE RETURN
OPEN "","ANNUAL_CONTRACTS" TO FILE.IN ELSE RETURN
* 
* MAKE COLUMN HEADING
* 
READRECORD:
* 
* 
READNEXT @ID, WHICH.VALUE ELSE
 IF STATUS() GT 0 THEN
 STATX = SET_FSERROR() 
 RETURN
 END
 IF @FILE.ERROR<1> EQ 421 THEN
 STATX = SET_FSERROR()
 GOTO READRECORD
 END
 IF @FILE.ERROR<1> NE 111 THEN
 @ANS = @FILE.ERROR<1>
 STATX = set_printer( 'TEXT', {RLIST_TEXT_4} ) 
 READERR += 1
 GOTO READRECORD
 END
 LAST.RECORD=1
END
@FILE.ERROR.MODE=0
* 
S.ATID = @ID
* 
IF FIRST.PASS AND LAST.RECORD THEN
 STATX = set_printer( 'TEXT', {RLIST_TEXT_2} )
 RETURN
END
* 
IF LAST.RECORD THEN GOTO BREAKS
* 
IF @REDUCTION.DONE THEN
 READO @RECORD FROM FILE.IN, @ID ELSE
 @FILE.ERROR.MODE = 0
 IF STATUS() GT 0 THEN
 STATX = SET_FSERROR()
 RETURN
 END
 IF @FILE.ERROR<1> NE 100 THEN
 READERR += 1
 END
 GOTO READRECORD
 END
END
* 
@RECCOUNT += 1
* 
* 
* CALCULATE VALUE(S) FOR COLUMN(S)
* 
S.ATID={@ID}
I.ATID=S.ATID
S.CUSTULNAME={CUST_NAME}
I.CUSTULNAME=S.CUSTULNAME
S.PO={PO}
I.PO=S.PO
S.STATUS={STATUS}
I.STATUS=S.STATUS
S.TOTULCONTRACTULAMOUNT={TOT_CONTRACT_AMOUNT}
I.TOTULCONTRACTULAMOUNT=S.TOTULCONTRACTULAMOUNT
S.TOTULRELULAMOUNT={TOT_REL_AMOUNT}
I.TOTULRELULAMOUNT=S.TOTULRELULAMOUNT
S.BALANCE={BALANCE}
I.BALANCE=S.BALANCE
* 
* 
IF FIRST.PASS THEN
FIRST.PASS=0
GOTO DETAIL
END
* 
* 
BREAKS:
* 
* 
* PERFORM LAST RECORD OUTPUT IF DONE
* 
IF LAST.RECORD THEN
IF READERR THEN
@ANS=READERR
STATX = set_printer( 'TEXT', {RLIST_TEXT_3} )
END
RETURN
END
* 
DETAIL:
* 
* DO CONVERSIONS IF ANY
* 
IF S.STATUS NE "" THEN S.STATUS=OCONV(S.STATUS,"[AC_STATUS_CONV]")
IF S.TOTULCONTRACTULAMOUNT NE "" THEN S.TOTULCONTRACTULAMOUNT=OCONV(S.TOTULCONTRACTULAMOUNT,"MD2,$")
IF S.TOTULRELULAMOUNT NE "" THEN S.TOTULRELULAMOUNT=OCONV(S.TOTULRELULAMOUNT,"MD2,$")
IF S.BALANCE NE "" THEN S.BALANCE=OCONV(S.BALANCE,"MD2,$")
* 
* PRINT DETAIL LINE
* 
PRINTLINE = ""
PRINTLINE := S.ATID:@vm
PRINTLINE := S.CUSTULNAME:@vm
PRINTLINE := S.PO:@vm
PRINTLINE := S.STATUS:@vm
PRINTLINE := S.TOTULCONTRACTULAMOUNT:@vm
PRINTLINE := S.TOTULRELULAMOUNT:@vm
PRINTLINE := S.BALANCE:@vm
TableColInfo = '<+1080':@vm:'<+3600':@vm:'<+1800':@vm:'<+1440':@vm:'>+2160':@vm:'>+2160':@vm:'>+2160'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PRINTLINE, '', '', 1, TB_NONE ) 
*STATX = set_printer( 'TEXTCOL', PRINTLINE )
* 
* 
GOTO READRECORD
* 
END

