TOPIC: CHANGES TO ACCUMULATED VALUES [ 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
TOPIC: CHANGES TO ACCUMULATED VALUES
As specified so far, if the quantity or unit price of any order line is
changed in Browse mode, the changed value is added to the existing
accumulated value in STOTNET making the total incorrect. To illustrate,
suppose the following three order lines have been entered on form
ORDER_LINE in Collect mode:
1ST QTY = 2 UPRICE = 10.50 TPRICE = 21.00 (STOTNET = 21.00)
2ND QTY = 4 UPRICE = 15.00 TPRICE = 60.00 (STOTNET = 81.00)
3RD QTY = 3 UPRICE = 14.00 TPRICE = 42.00 (STOTNET = 123.00)
If the user then terminates this order by pressing NEXT FORM in ENTRY,
the value of STOTNET is transferred to the TOTNET field of the
ORDER_TOTALS form. Now, suppose the user goes to Browse mode before
pressing ENTER on ORDER_TOTALS, and changes the QTY value in the second
order line. The following values are recorded:
(STOTNET = 123.00)
QTY = 5 UPRICE = 15.00 TPRICE = 75.00 (STOTNET = 198.00)
As you can see, the value of STOTNET is now grossly incorrect. Instead
of adding a net change of $15.00 to the total order, $75.00 has been
added.
If you make a similar change to an order line after pressing ENTER on the
ORDER_TOTALS form, the values of STOTNET and TOTNET are not easily
predicted. The value of STOTNET is reset for the next form, and is
either zero or contains some other value if new totals have been
calculated. The value of TOTNET remains set to the last value moved to
it from STOTNET.
Figure 7-14. The Field Menu for TPRICE
So what is the solution? For this particular set of forms, you can
change the specifications on TPRICE so that STOTNET (and consequently
TOTNET) reflects changes to the order line as long as they are made while
the user is still entering data for the current order. Once the user
presses ENTER to record the totals on ORDER_TOTALS, and then makes
changes to a previously entered order, the user must recalculate the
value of TOTNET manually.
Action
As a first step, go to the Field Menu for TPRICE and enter the
specifications shown in Figure 7-14.
These statements insure that any changes made to an order in Browse mode
are correctly accumulated into STOTNET and correctly transmitted to
TOTNET, but only if the user has not pressed ENTER and is still working
in the current order.
NOTE A point to remember is that ENTRY is designed for applications in
general. Intrinsics are provided with VPLUS/V that can be used by
your data processing staff to modify ENTRY so that it is tailored
to your particular application.
Figure 7-15. The Field Menu for ORDNUM
One more change is required to the ORDER_TOTALS form to insure correct
data in this situation. When NEXT FORM is pressed to stop the repeat of
ORDER_LINE, the next form, ORDER_TOTALS, is displayed. Whenever this
form is displayed in Collect mode, all the initialization procedures are
performed. One of these procedures sets the order number from the
SORDNUM save field and then increments the value of SORDNUM by 1. After
the user goes to Browse mode to correct an order line and then returns to
Collect mode, the ORDER_TOTALS form is displayed again. The
initialization procedures are performed again, which means that the save
field SORDNUM is incremented again. This causes the order number on the
ORDER_TOTALS form to be greater than the order number for the same order
on ORDER_HEAD.
Action
Because of this, you change the field type from D for Display-Only to R
for required on the Field Menu for ORDNUM as shown in Figure 7-15. Press
ENTER.
Changing the field type to required allows the user to change the order
number if it is greater than the correct number for the current order.
Changes cannot be made after an order is completed because the user
cannot change the corresponding value of TOTNET in ORDER_TOTALS, which is
a display-only field protected from user entry. This field would also
need to be changed to a required field to allow the user to correct the
total if necessary, but for simplicity in this exercise, leave TOTNET as
display-only.
MPE/iX 5.0 Documentation