My code:
Code: Select all
'************Mainline*********
cls
gosub InitializeVariable
gosub printheadings
gosub ProcessDetail
gosub printtotals
end
'**************************SET UP CONSTANTS***************************
InitializeVariable:
PAGE.HEADING$ = " REPORT TITLE PAGE ##"
DETAIL.HEAD.1$ = "type size rate charter revenue"
DETAIL.type$ = " \ \ SUBTOTAL ### $#####.## "
DETAIL.TOTAL$ = " \TOTAL REVENUE FOR HOURS CHARTERED\ ###.#"
a1$ = "\ \### ### ### $#####.##"
rt$ = " Report Total ##,###"
RETURN
'**********************READ IN VARIABLE INFORMATION FROM DATA STATEMENTS***********************
PrintHeadings:
PAGE = PAGE + 1
PRINT USING PAGE.HEADING$;Page
PRINT
PRINT DETAIL.HEAD.1$
PRINT
RETURN
'******************Process Detail*********************
processdetail:
gosub readdata
do until Type$ = "EOD"
gosub printdetail
gosub calcsubtotal
typesave$ = TYPE$
gosub readdata
if TypeSave$ <> Type$ then
gosub printsubtotals
end if
loop
return
'*********************** READ COURSE DATA *******************************
ReadData:
READ type$, size, rate, charter, revenue
RETURN
'*******************DATA STATEMENTS*************************
DATA RANGER,22,95.00,24
DATA RANGER,22,69.00,12
DATA WAVELENGTH,24,69.00,6
DATA WAVELENGTH,24,69.00,12
DATA CATALINA,27,160.00,24
DATA CATALINA,27,99.00,6
DATA CATALINA,30,190.00,12
DATA CATALINA,30,225.00,24
DATA CORONADO,32,230.00,24
DATA HOBIE,33,192.00,33
DATA HOBIE,33,235.00,24
DATA HOBIE,33,137.00,6
DATA HOBIE,33,235.00,24
DATA C & C,34,290.00,24
DATA C & C,34,175.00,6
DATA CATALINA,36,185.00,6
DATA CATALINA,36,320.00,24
DATA HANS CHRISTIAN,38,250.00,6
DATA EXCALIBER,45,550.00,24
DATA EXCALIBER,45,295.00,6
DATA EOD,0,0,0
'*******************PrintDetail**************************
PrintDetail:
REVENUE = RATE * CHARTER
print using a1$; type$, size,rate,charter,revenue
RETURN
'*******************Calc SubTotal************************
CalcSubTotal:
calsubchar = calsubchar + CHARTER
tot.revenue = tot.revenue + REVENUE
return
'*********************PRINT SUBTOTALS**************
PrintSubtotals:
PRINT
PRINT USING DETAIL.type$;typesave$,calsubchar,tot.revenue
print
chartot = chartot + calsubchar
calsubchar = 0
LINECT = LINECT + 3
typesave$ = TYPE$
RETURN
'*******************Print Totals****************************
PrintTotals:
print using Rt$;CharTot
RETURN