using POST in forms 4.0 question

From: Chip Graham <cgraham_at_convex.com>
Date: 20 Jan 1994 16:29:21 GMT
Message-ID: <2hmbh1$96h_at_convex.convex.com>


We need some help using the POST function using forms 4.0. below is a description of the process:

We are trying to develop a form which will display sales quote data and allow the user to change any of the information on any line item. As soon as the user leaves any numeric field that has been updated, the program will then recalculate the line item values, depending on which field was changed, as well as the total of the quote, and subtotals. Subtotals and totals are calculated by doing a sum of the columns, grouped by item type. These subtotals are inserted into the subtotal table for this quote, which is then requeried and displayed in the second block. Item types can be added or deleted at any point and will vary by quote, so they cannot be hardcoded onto the screen.

example:



  ITEMS:
  item	type	qty	price	total	disc	net total
  ABC	HW 	1	20.00	20.00	25	18.00
  XYZ	HW	4	15.00	60.00	25	45.00
  WWW   SW	1	30.00	30.00	30	20.00

  (these fields are base table fields in block one.)

  SUBTOTALS:         

	type		disc	total
	HW		25	63.00
	SW		30	20.00

  Quote Total:			83.00

 (these field are base table fields in block two.)



Calculations:

line item total = qty * price
line item net total = total - (total * discount percentage) subtotal total = select sum(total) from items group by type.

If the user changes the qty, price, or discount on the item level, the net total is recalculated, along with all totals and subtotals.

If the user changes the net total on the item level, the percent discount is recalculated, along with all totals and subtotals.

If the user changes the subtotal for an item type, the percent discount is recalculated at the subtotal level and then distributed back over the discount percent for each of the line items for that type.

We have written the code to do all of the line item recalculations and that works. What we cannot do is recalculate the subtotals and totals in the on-validate triggers. We want to use the POST command after each field change so we can do the select(sum) on the total columns, however POST is a restricted procedure which cannot be used in an on-validate trigger.

We could put a push-button labeled RECALC, but then the user would have to push the button every time the left a field they had changed. That is not the best answer, but it may be our only hope.

Does anyone have any suggestions on how to get this to work?

-- 
Chip Graham      cgraham_at_convex.com         +1 214 497 4642
Convex Computer Corporation 
3000 Waterview Parkway     
Box 833851, Richardson,Tx,75083
Received on Thu Jan 20 1994 - 17:29:21 CET

Original text of this message