home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 25 / CD_ASCQ_25_1095.iso / dos / tools / par330 / exampl18.pom < prev    next >
Text File  |  1995-09-06  |  8KB  |  216 lines

  1. ;
  2. ;   NOTE:  A quick-reference summary of POM commands appears in EXAMPL04.POM
  3. ;
  4. ;-------------------------------------------------------------------------------
  5. ;
  6. ;   Prologue
  7. ;
  8. PROLOGUE
  9.   ;
  10.   ;   Use MINLEN to set READNEXT to ignore null lines in the input
  11.   ;
  12.   MINLEN   "1" "1"
  13.   ;
  14.   ;   Skip the header lines
  15.   ;
  16.   ;   Note that since we're in the PROLOGUE section, the first READNEXT
  17.   ;   actually reads the first line of the input file, since the prologue
  18.   ;   is run before any input lines have been read.
  19.   ;
  20.   READNEXT
  21.   READNEXT
  22.   READNEXT
  23.   READNEXT
  24.   READNEXT
  25.   READNEXT
  26.   READNEXT
  27.   ;
  28.   ;   Output a report header
  29.   ;
  30.   ;         ----+----1----+----2----+----3----+----4  (Measuring scale)
  31.   OUTEND   |----------------------------------------
  32.   OUTEND   |          WEEKLY SALES SUMMARY
  33.   OUTEND   |----------------------------------------
  34.   OUTEND   |
  35.   OUTEND   |  DATE       CRATES SOLD      EARNINGS
  36.   OUTEND   |--------     -----------    ------------
  37. END
  38. ;
  39. ;-------------------------------------------------------------------------------
  40. ;
  41. ;   Get the date and initialize the daily figures
  42. ;
  43. ;   We did not have to initialize the accumulating weekly figures in the
  44. ;   prologue, since an unassigned variable is set to null (""), which
  45. ;   the calculation commands treat as zero.
  46. ;
  47. IGNORE   $FLINE[11]   = "-"
  48. SET      date         = $FLINE[11 18]
  49. SET      soldtoday    = "0"
  50. SET      cashtoday    = "0.00"
  51. ;
  52. ;   Read in the day's data
  53. ;
  54. ;   Beans
  55. ;
  56. CALC     soldbeanwkly = soldbeanwkly  "+" $FLINE[50 58]
  57. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  58. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  59. CALCREAL cashbeanwkly = cashbeanwkly  "+" cash          "2"
  60. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  61. ;
  62. ;   Zucchinis
  63. ;
  64. READNEXT
  65. CALC     soldzuccwkly = soldzuccwkly  "+" $FLINE[50 58]
  66. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  67. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  68. CALCREAL cashzuccwkly = cashzuccwkly  "+" cash          "2"
  69. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  70. ;
  71. ;   Tomatoes, Type 1
  72. ;
  73. READNEXT
  74. CALC     soldtom1wkly = soldtom1wkly  "+" $FLINE[50 58]
  75. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  76. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  77. CALCREAL cashtom1wkly = cashtom1wkly  "+" cash          "2"
  78. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  79. ;
  80. ;   Tomatoes, Type 2
  81. ;
  82. READNEXT
  83. CALC     soldtom2wkly = soldtom2wkly  "+" $FLINE[50 58]
  84. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  85. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  86. CALCREAL cashtom2wkly = cashtom2wkly  "+" cash          "2"
  87. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  88. ;
  89. ;   Corn
  90. ;
  91. READNEXT
  92. CALC     soldcornwkly = soldcornwkly  "+" $FLINE[50 58]
  93. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  94. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  95. CALCREAL cashcornwkly = cashcornwkly  "+" cash          "2"
  96. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  97. ;
  98. ;   Lettuce
  99. ;
  100. READNEXT
  101. CALC     soldlettwkly = soldlettwkly  "+" $FLINE[50 58]
  102. CALC     soldtoday    = soldtoday     "+" $FLINE[50 58]
  103. CALCREAL cash         = $FLINE[50 58] "*" $FLINE[61 69] "2"
  104. CALCREAL cashlettwkly = cashlettwkly  "+" cash          "2"
  105. CALCREAL cashtoday    = cashtoday     "+" cash          "2"
  106. ;
  107. ;   Accumulate the total weekly figures
  108. ;
  109. CALC     soldwkly     = soldwkly      "+" soldtoday
  110. CALCREAL cashwkly     = cashwkly      "+" cashtoday     "2"
  111. ;
  112. ;   Output the daily figures
  113. ;
  114. PAD      soldtoday "L" " " "12"
  115. PAD      cashtoday "L" " " "11"
  116. OUTEND   |{date}    {soldtoday}    ${cashtoday}
  117. ;
  118. ;-------------------------------------------------------------------------------
  119. ;
  120. ;   Epilogue
  121. ;
  122. ;
  123. EPILOGUE
  124.   ;
  125.   ;   Format figures for output
  126.   ;
  127.   PAD      soldwkly     "L" " " "12"
  128.   PAD      cashwkly     "L" " " "12"
  129.   PAD      soldbeanwkly "L" " " "12"
  130.   PAD      soldzuccwkly "L" " " "12"
  131.   PAD      soldtom1wkly "L" " " "12"
  132.   PAD      soldtom2wkly "L" " " "12"
  133.   PAD      soldcornwkly "L" " " "12"
  134.   PAD      soldlettwkly "L" " " "12"
  135.   PAD      cashbeanwkly "L" " " "12"
  136.   PAD      cashzuccwkly "L" " " "12"
  137.   PAD      cashtom1wkly "L" " " "12"
  138.   PAD      cashtom2wkly "L" " " "12"
  139.   PAD      cashcornwkly "L" " " "12"
  140.   PAD      cashlettwkly "L" " " "12"
  141.   ;
  142.   ;   Calculate averages
  143.   ;
  144.   ;   Note that we do not specify the number of decimal places
  145.   ;   for soldavg, so we will get a "floating point" answer.
  146.   ;
  147.   CALCREAL soldavg      = soldwkly "/" "5"
  148.   CALCREAL cashavg      = cashwkly "/" "5" "2"
  149.   PAD      soldavg      "L" " " "12"
  150.   PAD      cashavg      "L" " " "12"
  151.   ;
  152.   ;   Figure out best-selling and best-earning item
  153.   ;
  154.   CALC     soldbest     = soldbeanwkly "HIGHEST" soldzuccwkly
  155.   CALC     soldbest     = soldbest     "HIGHEST" soldtom1wkly
  156.   CALC     soldbest     = soldbest     "HIGHEST" soldtom2wkly
  157.   CALC     soldbest     = soldbest     "HIGHEST" soldcornwkly
  158.   CALC     soldbest     = soldbest     "HIGHEST" soldlettwkly
  159.   PAD      soldbest     "L" " " "12"
  160.  
  161.   CALCREAL cashbest     = cashbeanwkly "HIGHEST" cashzuccwkly "2"
  162.   CALCREAL cashbest     = cashbest     "HIGHEST" cashtom1wkly "2"
  163.   CALCREAL cashbest     = cashbest     "HIGHEST" cashtom2wkly "2"
  164.   CALCREAL cashbest     = cashbest     "HIGHEST" cashcornwkly "2"
  165.   CALCREAL cashbest     = cashbest     "HIGHEST" cashlettwkly "2"
  166.   PAD      cashbest     "L" " " "12"
  167.   ;
  168.   ;   Figure out worst-selling and worst-earning item
  169.   ;
  170.   CALC     soldworst    = soldbeanwkly "LOWEST"  soldzuccwkly
  171.   CALC     soldworst    = soldworst    "LOWEST"  soldtom1wkly
  172.   CALC     soldworst    = soldworst    "LOWEST"  soldtom2wkly
  173.   CALC     soldworst    = soldworst    "LOWEST"  soldcornwkly
  174.   CALC     soldworst    = soldworst    "LOWEST"  soldlettwkly
  175.   PAD      soldworst    "L" " " "12"
  176.  
  177.   CALCREAL cashworst    = cashbeanwkly "LOWEST"  cashzuccwkly "2"
  178.   CALCREAL cashworst    = cashworst    "LOWEST"  cashtom1wkly "2"
  179.   CALCREAL cashworst    = cashworst    "LOWEST"  cashtom2wkly "2"
  180.   CALCREAL cashworst    = cashworst    "LOWEST"  cashcornwkly "2"
  181.   CALCREAL cashworst    = cashworst    "LOWEST"  cashlettwkly "2"
  182.   PAD      cashworst    "L" " " "12"
  183.   ;
  184.   ;   Output a header (column scale shown below)
  185.   ;
  186.   ;         ----+----1----+----2----+----3----+----4  (Measuring scale)
  187.   OUTEND   |
  188.   OUTEND   |----------------------------------------
  189.   OUTEND   |             WEEKLY FIGURES
  190.   OUTEND   |----------------------------------------
  191.   OUTEND   |
  192.   OUTEND   |CRATES SOLD:       Beans:   {soldbeanwkly}
  193.   OUTEND   |                Zucchini:   {soldzuccwkly}
  194.   OUTEND   |           Tomato Type 1:   {soldtom1wkly}
  195.   OUTEND   |           Tomato Type 2:   {soldtom2wkly}
  196.   OUTEND   |                    Corn:   {soldcornwkly}
  197.   OUTEND   |                 Lettuce:   {soldlettwkly}
  198.   OUTEND   |           --------------   ------------
  199.   OUTEND   |            Weekly Total:   {soldwkly}
  200.   OUTEND   |           Daily Average:   {soldavg}
  201.   OUTEND   |             Best Volume:   {soldbest}
  202.   OUTEND   |            Worst Volume:   {soldworst}
  203.   OUTEND   |
  204.   OUTEND   |EARNINGS:          Beans:  ${cashbeanwkly}
  205.   OUTEND   |                Zucchini:  ${cashzuccwkly}
  206.   OUTEND   |           Tomato Type 1:  ${cashtom1wkly}
  207.   OUTEND   |           Tomato Type 2:  ${cashtom2wkly}
  208.   OUTEND   |                    Corn:  ${cashcornwkly}
  209.   OUTEND   |                 Lettuce:  ${cashlettwkly}
  210.   OUTEND   |           --------------   ------------
  211.   OUTEND   |            Weekly Total:  ${cashwkly}
  212.   OUTEND   |           Daily Average:  ${cashavg}
  213.   OUTEND   |            Best Earning:  ${cashbest}
  214.   OUTEND   |           Worst Earning:  ${cashworst}
  215. END
  216.