DEFINE FIELDS FOR THE TOTALS FORM [ USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide ] MPE/iX 5.0 Documentation
USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide
DEFINE FIELDS FOR THE TOTALS FORM
Now that the display-only fields in the ORDER form are defined, you need
to define the display-only fields for the TOTALS form in a similar
manner.
Action
Refer to the form layout for TOTALS, which was shown earlier in Figure
5-5.
Since the TOTALS form, as its name implies, contains the totals for the
order, the fields contain mainly dollar values and percentages. Thus,
all the fields are numeric, except the order number, the date, and the
customer name fields. Another feature of this form is that very few
items require user entry. Most fields that are not display-only can be
assigned initial values. For example, the discount percentage and the
tax rate, which change infrequently, will be assigned initial values.
The discount is calculated from the discount percentage, the tax from the
tax rate, and the total price is calculated from these and other dollar
values. In fact, the only values the user need enter are the order
number and the net price; shipping costs and customer name are optional.
Action
Locate the Field Menu for ORDATE in the TOTALS Form. As was done for the
ORDATE field in the ORDER form, first change the field type to D for
display-only and the data type to MDY. Then press FIELD TOGGLE to go to
the Processing Specifications area of the menu. Now type in the
statement: SET ORDATE TO $TODAY, as shown in Figure 5-8. Press ENTER.
Do not supply a custom message since such messages are illegal with the
SET statement.
Figure 5-9. Field Menu for TOTNET in the TOTALS Form
Figure 5-10. Field Menu for DISCNT_PERCNT in the TOTALS Form
When you press ENTER at the Field Menu for ORDATE, the next Field Menu
displayed is for the TOTNET field, which contains the total net price of
the current order. This field is entered by the user; it should equal
the total order price of the TPRICE field, which was calculated on the
previous form, ORDER. Note that this field must be numeric since it is
used in later calculations.
Action
At the Field Menu for TOTNET, as shown in Figure 5-9, change the field
type to R for required, and the data type to NUM2. Press ENTER.
When you press ENTER, the next Field Menu is displayed, which describes
the discount percentage field DP.
Action
At the Field Menu for DP, as shown in Figure 5-10, change the field name
to DISCNT_PERCNT (a more descriptive name than DP); leave the field type
as 0 for optional; change the data type to NUM0; and assign an initial
value of 10 for a discount of 10 percent. Press ENTER.
In the next section, you learn how to transfer values between forms using
Save Fields. This technique allows the order number, the total net
price, and the customer name to be transferred from the ORDER form to the
TOTALS form.
MPE/iX 5.0 Documentation