HP 3000 Manuals

MORE CALCULATED FIELDS [ 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

MORE CALCULATED FIELDS 

The next field after DISCNT is called SUB and contains the subtotal.
This value is the result of subtracting any discount from the net total.
The subtotal is another display-only field containing a dollar value.

Action 

Change the field type (FType) to D and the data type (DType) to NUM2.
Then press FIELD TOGGLE to enter the SET statement that calculates a
subtotal, as shown in Figure 5-12.  Press ENTER.

[]
Figure 5-13. Field Menu for TAX_RATE in the TOTALS Form After you press ENTER at the SUB field, the next Field Menu is the one for the tax rate (TR) field. Action As shown in Figure 5-13, change the name of this field to TAX_RATE for clarity in subsequent statements. Make it a required field, and give it the data type NUM2. Since tax rates are fairly stable, assign this field an initial value of 6.25 for a tax rate of 6 1/4%. Press ENTER. The data type is R for required rather than D for display-only so that the user can change the initial tax rate as needed.
[]
Figure 5-14. Field Menu for TAX in the TOTALS Form The next Field Menu is for the TAX field, which is a display-only field calculated from the tax rate and the discounted total. Action As shown in Figure 5-14, change the field type to D, the data type to NUM2 to correspond to the other dollar values, and then go to the Processing Specifications to enter the SET statement to calculate the tax. Press ENTER. Assuming the tax rate is 6.25, this statement sets the TAX field to 6 1/4 percent of the subtotal value in the SUB field. Remember that the value of SUB is the net total less the discount.
[]
Figure 5-15. Field Menu for SHIP in the TOTALS Form The next Field Menu displayed is for the SHIP field, which is the shipping cost value. Shipping cost is a user-entered value that may or may not be needed. Action At the Field Menu for SHIP, leave the field type as O for optional, change the data type to NUM2 to conform to the other dollar values, and provide an initial value of zero (in the format .00 as shown in Figure 5-15). Since the value of the SHIP field is used in a later calculation, it must have a value or the calculation would not be made.
[]
Figure 5-16. Field Menu for TOTAL in the TOTALS Form The next field, TOTAL, contains the total cost of the order. The value of TOTAL is calculated by adding the tax and any shipping cost to the subtotal. Action Change the field type to D and the data type to NUM2. Then enter the SET statement in the Processing Specifications area, as shown in Figure 5-16. Press ENTER. The last field on the TOTALS form contains the customer name originally entered on the ORDER form. Action Leave this field as is. At this point, the user can enter a name or leave the field blank; later you will see how the name can be transferred automatically from the ORDER form.


MPE/iX 5.0 Documentation