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

  1.  
  2. *PAYFIND.CMD
  3. * This file is called by the PAYBILLS command file after we have found at
  4. * least one cost entry for the supplier that we are looking for.
  5. *   This file now looks for either the first unpaid bill for the supplier
  6. * (if only the name was specified) or looks for a complete match (if more than
  7. * the name was specified).
  8. *   If an unpaid bill meeting the criteria is found, Looking is set
  9. * to False.  Otherwise, it remains True.
  10. *   If only the name was used, at this point we are at the first
  11. * unpaid bill for the supplier name.
  12. *   If more than the name ws specified for the searc, we could be anywhere
  13. * in the indexed list of records for this supplier.  If we do not want to pay
  14. * this particular bill, or we want to pay more bills for this supplier, we use
  15. * a shortcut in the PAYBILLS cmd file so that we do not have to start at the
  16. * first record for the name every time.  To do this, we store the record
  17. * number that we start at to a variable called Start if we have more than the
  18. * name to look for.  Otherwise, Start =0.
  19.  
  20. STORE T TO Looking
  21. IF MBill:Nmbr > ' '.OR. MAmount > 0
  22.     * If we have more than the name, we first check for the bill number.
  23.     * If this is not found or if the bill has already been paid,
  24.     * the confirming procedure is skipped (Looking set TRUE).
  25.     * In this case, we may have entered the list of supplier bills in
  26.     * middle of the indexed list.  In a later procedure, we may need to go
  27.     * back to the top and look at the names we skipped.  To do this, if we
  28.     * find a record here, we store its number to "Start".
  29.  
  30.     IF MBill:Nmbr > ' '
  31.  DO WHILE Name=Key .AND. .NOT. EOF .AND. Looking
  32.      IF Bill:Nmbr <> MBill:Nmbr
  33.   SKIP
  34.      ELSE
  35.   STORE F TO Looking
  36.      ENDIF
  37.  ENDDO
  38.  
  39.  * If we're on a new name or the end of the file, Looking is TRUE
  40.  * because we have not found the supplier we were looking for.
  41.  * Otherwise, we have a matching bill number to confirm.
  42.  IF Looking
  43.      ? '   This BILL NUMBER is not in the costbase.'
  44.      ? ' <Return> to continue..'
  45.      WAIT
  46.  ELSE
  47.      IF Check:Nmbr <> ' '
  48.   STORE T TO Looking
  49.   ? '  This bill paid on ' +Check:Date+', check '+Check:Nmbr
  50.   ? ' <Return> to continue.'
  51.   WAIT
  52.      ENDIF
  53.  ENDIF
  54.     ELSE
  55.  
  56.     * If no bill number, look for the amount and an unpaid bill.
  57.     * If not found, skip the confirmation procedure.
  58.     DO WHILE Name=Key .AND. .NOT. EOF .AND. Looking
  59.  IF Amount <> MAmount .OR. Check:Nmbr <> ' '
  60.      SKIP
  61.  ELSE
  62.      STORE F TO Looking
  63.  ENDIF
  64.     ENDDO
  65.     * If we're on a new name or the end of the file, Looking is TRUE
  66.     * otherwise, we have an unpaid bill to confirm.
  67.     IF Looking
  68.  ? '  No unpaid bill for this amount and this supplier.'
  69.  ? '<Return> to continue.'
  70.  WAIT
  71.     ENDIF
  72. ENDIF
  73.  
  74. * If we found a matching record, store its number to Start
  75. IF .NOT. Looking
  76.     STORE # TO Start
  77. ENDIF
  78.  
  79. ELSE
  80.     * If we have only the name, find the next unpaid bill
  81.     DO WHILE Name-Key .AND. .NOT. EOF .AND. Looking
  82.  IF Check:Nmbr <> ' '
  83.      SKIP
  84.  ELSE
  85.      STORE F TO Looking
  86.  ENDIF
  87.     ENDDO
  88.  
  89.     * If we're on a new name or the end of the file, Looking is TRUE
  90.     * because we did not find the supplier we were looking for.
  91.     * Otherwise, we have an unpaid bill to confirm.
  92.     IF Looking
  93.  ? '  There are no unpaid bills for this supplier.'
  94.  ? '<Return> to continue.'
  95.  WAIT
  96.     ENDIF
  97. ENDIF
  98.  
  99. RETURN
  100.  
  101. Looking
  102.     ?  DO WHILE Check:Nmbr <> ' '
  103.        SKIP
  104.    ENDDO
  105.       ENDIF
  106.   ENDIF
  107.      ENDIF is it the right record
  108.  ENDIF
  109.     ENDDO 
  110. F Looking
  111.     ?  DO WHILE Check:Nmbr <> ' '
  112.        SKIP
  113.    ENDDO
  114.       ENDIF
  115.   ENDIF
  116.      ENDIF is it the right record
  117.  ENDIF
  118.     ENDDO