home *** CD-ROM | disk | FTP | other *** search
- ********** Payfind COMMAND FILE **********
- * This file is called by the Paybills command file after we have found at least
- * one cost entry for the supplier that we are looking for.
- * This file now looks for either the first unpaid bill for the supplier
- * (if only the name was specified) or looks for a complete match (if more than
- * the name was specified).
- * If an an unpaid bill meeting the criteria is found, Looking is
- * set to False; otherwise it remains True.
- * If only the name was used, at this point we are at the first
- * unpaid bill for the supplier name.
- * If more than the name was specified for the search, we could be anywhere
- * in the indexed list of records for this supplier. If we do not want to pay
- * this particular bill, or we want to pay more bills for this supplier, we use
- * a short cut in the Paybills command file so that we do not have to start at
- * the first record for the name every time. To do this, we store the record
- * number that we start at to a variable called Start if we have more than the
- * name to look for. Otherwise, Start =0
- *******************************************************************************
- PARAMETERS MBill_Nmbr,MAmount,Key,Looking,Start
- *
- Looking = .T.
- IF MBill_Nmbr > ' ' .OR. MAmount > 0
- * If we have more than the name, we first check for the bill number.
- * If this is not found or if the bill has already been paid,
- * the confirming procedure is skipped (Looking set TRUE).
- * In this case, we may have entered the list of supplier bills in
- * the middle of the indexed list. In a later procedure, we may need to go
- * back to the top and look at the names we skipped. To do this, if we
- * find a record here, we store its number to "Start".
- *
- IF MBill_Nmbr > ' '
- DO WHILE Name=Key .AND. .NOT. EOF() .AND. Looking
- IF Bill_Nmbr <> MBill_Nmbr
- SKIP
- ELSE
- Looking = .F.
- ENDIF
- ENDDO
- *
- * If we're on a new name or the end of the file, Looking is TRUE
- * because we have not found the supplier we were looking for.
- * Otherwise, we have a matching bill number to confirm.
- IF Looking
- ? ' This BILL NUMBER is not in the Costbase.'
- WAIT '<ENTER> to continue.'
- ELSE
- IF Check_Nmbr <> ' '
- Looking = .T.
- ? ' This bill paid on', Check_Date,', check '+Check_Nmbr
- WAIT '<ENTER> to continue.'
- ENDIF
- ENDIF
- ELSE
- * If no bill number, look for the amount and an unpaid bill.
- * If not found, skip the confirmation procedure.
- DO WHILE Name=Key .AND. .NOT. EOF() .AND. Looking
- IF Amount <> MAmount .OR. Check_Nmbr <> ' '
- SKIP
- ELSE
- Looking = .F.
- ENDIF
- ENDDO
- *
- * If we're on a new name or the end of the file, Looking is TRUE
- * Otherwise, we have an unpaid bill to confirm.
- IF Looking
- ? ' No unpaid bill for this amount and this supplier.'
- WAIT '<ENTER> to continue.'
- ENDIF
- ENDIF
- *
- * If we found a matching record, store its number to Start
- IF .NOT. Looking
- Start = RECNO()
- ENDIF
- *
- ELSE
- * If we have only the name, find the next unpaid bill
- DO WHILE Name=Key .AND. .NOT. EOF() .AND. Looking
- IF Check_Nmbr <> ' '
- SKIP
- ELSE
- Looking = .F.
- ENDIF
- ENDDO
- *
- * If we're on a new name or the end of the file, Looking is TRUE
- * because we did not find the supplier we were looking for.
- * Otherwise, we have an unpaid bill to confirm.
- IF Looking
- ? ' There are no unpaid bills for this supplier.'
- WAIT '<ENTER> to continue.'
- ENDIF
- ENDIF
- *
- RETURN