home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / DB3.ARC / PAYFIND.PRG < prev    next >
Encoding:
Text File  |  1984-10-25  |  3.6 KB  |  97 lines

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