Add New Customers While In The Receipts File

If most of the work is being done in the receipts file, i.e., entering charges, taking payments, etc, it is a waste of time to force the user to back out of this file and enter the customer file just to add a new account. This becomes even more of a problem when such a program is used at the Point Of Sale where time and speed of operation are the critical measurement of how good a program works.

There is no need to leave one filePro file simply to add a record in another one. The whole operation, including getting the next unique account number, can be done from just about anywhere inside filePro.

From this point on, since this is the Advanced Guide, it will be assumed that you know how to enter Define Processing on whichever file is listed. Do the work on whichever file is specified. These names can be found on the bottom left and right of each processing screen. These basic instructions will be left out of this section of the tutorial guides.

Add the following lines of code (25 through 56) to the "vidrec/input" table. Modify any lines that already exist to match the following four screens.

images\File0144.gif

 

images\File0145.gif

 

images\File0146.gif

 

images\File0147.gif

The code above will activate when the user's cursor leaves field 3 (Last Name) while there is a period in it. This is a user-defined trigger if you will that makes use of the when-leaving field trigger to do its work. If the field contains a period, the program looks up a free record in the customer file "vidcust" and pops up Screen.0 from that file. After the user is finished entering the new account information, this data is stored on the free record in the customer file and the next available (and unique) Account# is assigned to it.

Except for the POPUP UPDATE command on line 44, we have seen all this code in one variation or another before. The POPUP UPDATE puts the user on the screen designated from the lookup file. When the user is finished entering data and presses ESC, filePro writes all the fields on this screen to the looked up record automatically. The only thing left for us to do before we give control back to the user is obtain the next unique Account# and assign it to this record's field 1. At this point, the new customer account becomes available for use by the file the user is actually standing in, "vidrec" (the receipts file).

It is necessary to put the same user edit that resides in the "vidcust" file into the "vidrec" file. This way, when the user enters the account type for the new customer, the field will only allow the same codes that are allowed in the customer file.

Go to Define Edits for the "vidrec" file and add the following.

images\File0148.gif

Go into the "vidrec" file and try out this new feature.

While standing on a new record, enter a period in the Last Name field and press ENTER .

images\File0149.gif

A blank customer info screen will appear.

Enter the following data.

images\File0150.gif

Press ESC to save the new customer record.

The following will appear on your screen. The newly added customer data and its specific Account# have popped into place. You could immediately add Catalog#'s to this receipt. We will not do this now.

images\File0151.gif

If you were to search for this customer in the "vidcust" file, you would find that is has been correctly added in that file.