home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / DBASEACC.ARC / COSTTIME.PRG < prev    next >
Encoding:
Text File  |  1979-12-31  |  3.8 KB  |  139 lines

  1.  
  2.  
  3. * COSTTIME.CMD
  4. * Accepts time sheet entries for employees using a temporary file called
  5. * GetTime.  For data entry.
  6. *   GetTime is used because the operator can decide to quit on an incomplete
  7. * entry.  In that case, the entry is marked for deletion, and when the data is
  8. * APPENded to the PostFile, these entries are eliminated (the APPEND command
  9. * does not transfer records marked for deletion).
  10. *   After all entries are made, entries are checked for the correct range
  11. * of employee numbers and to see that hours have been entered. Using GetTime
  12. * we can check the entries without having to go through the entire PostFile.
  13. *   After verifying that the dates are in the right format and
  14. * checking the names against our Suppliers file, the billing amounts are
  15. * computed.
  16. *   The records are then transferred to the CostFile and the temporary
  17. * file GetTime is deleted.
  18.  
  19. @ 0,25 SAY ' TIME SHEETS '
  20.  
  21. RESTORE FROM Constant
  22. USE PostFile
  23. COPY STRUCTURE TO GetTime
  24.  
  25. USE GetTime
  26. STORE 'Y' TO Time
  27. DO WHILE !(Time) <> 'F'
  28.     APPEND BLANK
  29.     STORE STR(#,5) TO Number
  30.  
  31.     STORE T TO Entering
  32.     DO WHILE Entering
  33.  ERASE
  34.  STORE F TO Entering
  35.  @ 1,0 SAY '       RECORD NUMBER:  ' -NUMBER
  36.  @ 3,0 SAY '         DATE WORKED' GET Bill:Date
  37.  @ 4,0 SAY '              CLIENT' GET Client
  38.  @ 5,0 SAY '          JOB NUMBER' GET Job:Nmbr
  39.  @ 6,0 SAY '        HOURS WORKED' GET Hours
  40.  @ 7,0 SAY '     EMPLOYEE NUMBER' GET Emp:Nmbr
  41.  @ 8,0 SAY '       EMPLOYEE NAME' GET Name
  42.  READ
  43.  
  44.  REPLACE Check:Nmbr WITH '----', Check:Date WITH Bill:Date,;
  45.      Client WITH !(Client), Name WITH !(Name)
  46.  @ 4,21 SAY Client
  47.  @ 8,21 SAY Name
  48.  
  49.     * The following sequence of IF statements flags all entry errors, then
  50.     * gives the operator the choice of fixing them or ending the procedure.
  51.  
  52.     ?
  53.     IF $(Client,1,1)=' '.OR.  $(Client,2,1) =' ' .OR. $(Client,3,1) =' '
  54.  ? '   CLIENT must have three letters.'
  55.  STORE T TO Entering
  56.     ENDIF
  57.  
  58.     IF Job:Nmbr < 100
  59.  ? '    JOB # is not for a client job.'
  60.  ? '    Is this right (Y or N)?'
  61.  WAIT TO Ask
  62.  IF !(Ask) <> 'Y'
  63.      STORE T TO Entering
  64.  ENDIF
  65. ENDIF
  66.  
  67.     IF .NOT. (Hours > 0)
  68.  ? '   HOURS must be entered.      '
  69.  STORE T TO Entering
  70.     ENDIF
  71.  
  72.     IF .NOT.(Emp:Nmbr>0 .AND. Emp:Nmbr<=MaxEmpl)
  73.  ? '    EMPLOYEE # out of range.    '
  74.  STORE T TO Entering
  75.     ENDIF
  76.  
  77.     IF $(Name,1,1) = ' '
  78.  ? '    NAME must not start with a blank.'
  79.  STORE T TO Entering
  80.     ENDIF
  81.  
  82.     IF Entering
  83.     ?
  84.     ?
  85.     ? '    F if FINISHED,'
  86.     ACCEPT ' <Return> to change' TO Time
  87.  
  88.     * If the operator decides to quit on an incomplete entry, it is
  89.     * marked for deletion so that it is not transferred to the PostFile.
  90.     IF !(Time) = 'F'
  91.  DELETE RECORD &Number
  92.  STORE F TO Entering
  93.     ENDIF
  94. ELSE
  95.     ?
  96.     ? '    C to CHANGE,'
  97.     ? '    F if FINISHED,'
  98.     ACCEPT ' <Return> to continue' TO Time
  99.     IF !(Time) = 'C'
  100.  STORE T TO Entering
  101.     ENDIF
  102. ENDIF
  103. ENDDO Entering
  104. ENDDO Time
  105.  
  106. COUNT FOR .NOT. * TO Any
  107. IF Any = 0
  108.     ERASE
  109.     @ 3,0 SAY '     No entries to add to the CostFile. '
  110.     ? ' <Return to the menu. '
  111.     USE
  112.     WAIT
  113. ELSE
  114.  
  115. * The test for the date needs the name of the date field to be tested.
  116. STORE 'Bill:Date' TO Date
  117. DO DateTest
  118.  
  119. * Checks names against a list of suppliers to catch spelling and
  120. * abbreviation inconsistencies.
  121. DO NameTest
  122.  
  123. * Verifies match between employee name and number, then computes the amount
  124. * to be billed for the employee's time based on his salary.
  125. DO TimeCalc
  126.  
  127. ERASE
  128.  
  129.     @ 3,25 SAY " *** DO NOT INTERRUPT *** "
  130.     @ 5,25 SAY " UPDATING THE POSTING FILE"
  131.     USE PostFile
  132.     APPEND FROM GetTime
  133. ENDIF
  134.  
  135. DELETE FILE GetTime
  136. RELEASE ALL
  137. RETURN
  138.  
  139.