home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 25
/
CD_ASCQ_25_1095.iso
/
dos
/
tools
/
par330
/
exampl18.pom
< prev
next >
Wrap
Text File
|
1995-09-06
|
8KB
|
216 lines
;
; NOTE: A quick-reference summary of POM commands appears in EXAMPL04.POM
;
;-------------------------------------------------------------------------------
;
; Prologue
;
PROLOGUE
;
; Use MINLEN to set READNEXT to ignore null lines in the input
;
MINLEN "1" "1"
;
; Skip the header lines
;
; Note that since we're in the PROLOGUE section, the first READNEXT
; actually reads the first line of the input file, since the prologue
; is run before any input lines have been read.
;
READNEXT
READNEXT
READNEXT
READNEXT
READNEXT
READNEXT
READNEXT
;
; Output a report header
;
; ----+----1----+----2----+----3----+----4 (Measuring scale)
OUTEND |----------------------------------------
OUTEND | WEEKLY SALES SUMMARY
OUTEND |----------------------------------------
OUTEND |
OUTEND | DATE CRATES SOLD EARNINGS
OUTEND |-------- ----------- ------------
END
;
;-------------------------------------------------------------------------------
;
; Get the date and initialize the daily figures
;
; We did not have to initialize the accumulating weekly figures in the
; prologue, since an unassigned variable is set to null (""), which
; the calculation commands treat as zero.
;
IGNORE $FLINE[11] = "-"
SET date = $FLINE[11 18]
SET soldtoday = "0"
SET cashtoday = "0.00"
;
; Read in the day's data
;
; Beans
;
CALC soldbeanwkly = soldbeanwkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashbeanwkly = cashbeanwkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Zucchinis
;
READNEXT
CALC soldzuccwkly = soldzuccwkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashzuccwkly = cashzuccwkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Tomatoes, Type 1
;
READNEXT
CALC soldtom1wkly = soldtom1wkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashtom1wkly = cashtom1wkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Tomatoes, Type 2
;
READNEXT
CALC soldtom2wkly = soldtom2wkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashtom2wkly = cashtom2wkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Corn
;
READNEXT
CALC soldcornwkly = soldcornwkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashcornwkly = cashcornwkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Lettuce
;
READNEXT
CALC soldlettwkly = soldlettwkly "+" $FLINE[50 58]
CALC soldtoday = soldtoday "+" $FLINE[50 58]
CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
CALCREAL cashlettwkly = cashlettwkly "+" cash "2"
CALCREAL cashtoday = cashtoday "+" cash "2"
;
; Accumulate the total weekly figures
;
CALC soldwkly = soldwkly "+" soldtoday
CALCREAL cashwkly = cashwkly "+" cashtoday "2"
;
; Output the daily figures
;
PAD soldtoday "L" " " "12"
PAD cashtoday "L" " " "11"
OUTEND |{date} {soldtoday} ${cashtoday}
;
;-------------------------------------------------------------------------------
;
; Epilogue
;
;
EPILOGUE
;
; Format figures for output
;
PAD soldwkly "L" " " "12"
PAD cashwkly "L" " " "12"
PAD soldbeanwkly "L" " " "12"
PAD soldzuccwkly "L" " " "12"
PAD soldtom1wkly "L" " " "12"
PAD soldtom2wkly "L" " " "12"
PAD soldcornwkly "L" " " "12"
PAD soldlettwkly "L" " " "12"
PAD cashbeanwkly "L" " " "12"
PAD cashzuccwkly "L" " " "12"
PAD cashtom1wkly "L" " " "12"
PAD cashtom2wkly "L" " " "12"
PAD cashcornwkly "L" " " "12"
PAD cashlettwkly "L" " " "12"
;
; Calculate averages
;
; Note that we do not specify the number of decimal places
; for soldavg, so we will get a "floating point" answer.
;
CALCREAL soldavg = soldwkly "/" "5"
CALCREAL cashavg = cashwkly "/" "5" "2"
PAD soldavg "L" " " "12"
PAD cashavg "L" " " "12"
;
; Figure out best-selling and best-earning item
;
CALC soldbest = soldbeanwkly "HIGHEST" soldzuccwkly
CALC soldbest = soldbest "HIGHEST" soldtom1wkly
CALC soldbest = soldbest "HIGHEST" soldtom2wkly
CALC soldbest = soldbest "HIGHEST" soldcornwkly
CALC soldbest = soldbest "HIGHEST" soldlettwkly
PAD soldbest "L" " " "12"
CALCREAL cashbest = cashbeanwkly "HIGHEST" cashzuccwkly "2"
CALCREAL cashbest = cashbest "HIGHEST" cashtom1wkly "2"
CALCREAL cashbest = cashbest "HIGHEST" cashtom2wkly "2"
CALCREAL cashbest = cashbest "HIGHEST" cashcornwkly "2"
CALCREAL cashbest = cashbest "HIGHEST" cashlettwkly "2"
PAD cashbest "L" " " "12"
;
; Figure out worst-selling and worst-earning item
;
CALC soldworst = soldbeanwkly "LOWEST" soldzuccwkly
CALC soldworst = soldworst "LOWEST" soldtom1wkly
CALC soldworst = soldworst "LOWEST" soldtom2wkly
CALC soldworst = soldworst "LOWEST" soldcornwkly
CALC soldworst = soldworst "LOWEST" soldlettwkly
PAD soldworst "L" " " "12"
CALCREAL cashworst = cashbeanwkly "LOWEST" cashzuccwkly "2"
CALCREAL cashworst = cashworst "LOWEST" cashtom1wkly "2"
CALCREAL cashworst = cashworst "LOWEST" cashtom2wkly "2"
CALCREAL cashworst = cashworst "LOWEST" cashcornwkly "2"
CALCREAL cashworst = cashworst "LOWEST" cashlettwkly "2"
PAD cashworst "L" " " "12"
;
; Output a header (column scale shown below)
;
; ----+----1----+----2----+----3----+----4 (Measuring scale)
OUTEND |
OUTEND |----------------------------------------
OUTEND | WEEKLY FIGURES
OUTEND |----------------------------------------
OUTEND |
OUTEND |CRATES SOLD: Beans: {soldbeanwkly}
OUTEND | Zucchini: {soldzuccwkly}
OUTEND | Tomato Type 1: {soldtom1wkly}
OUTEND | Tomato Type 2: {soldtom2wkly}
OUTEND | Corn: {soldcornwkly}
OUTEND | Lettuce: {soldlettwkly}
OUTEND | -------------- ------------
OUTEND | Weekly Total: {soldwkly}
OUTEND | Daily Average: {soldavg}
OUTEND | Best Volume: {soldbest}
OUTEND | Worst Volume: {soldworst}
OUTEND |
OUTEND |EARNINGS: Beans: ${cashbeanwkly}
OUTEND | Zucchini: ${cashzuccwkly}
OUTEND | Tomato Type 1: ${cashtom1wkly}
OUTEND | Tomato Type 2: ${cashtom2wkly}
OUTEND | Corn: ${cashcornwkly}
OUTEND | Lettuce: ${cashlettwkly}
OUTEND | -------------- ------------
OUTEND | Weekly Total: ${cashwkly}
OUTEND | Daily Average: ${cashavg}
OUTEND | Best Earning: ${cashbest}
OUTEND | Worst Earning: ${cashworst}
END