Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invoice Grid Recalculates Erroneous Sub-Totals
Message
From
26/05/2002 20:59:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
26/05/2002 15:29:00
Antonio Gubaira
Ingenieria Y Sistemas
Valencia, Venezuela
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00661499
Message ID:
00661542
Views:
21
>Hi Everyone,
>
>I am having trouble with a VFP grid that I use in my app. for invoicing. Everything works perfect when I add new items. The quantity and price columns are related by a multiply operation giving the right sub-total for that row. This equation is used in the "Lost Focus" method of each control. However if for example I am standing on item 2 row and click to change quantity (for example) for item 1, the subtotal for row 1 is calculated by the new quantity x the price of item 2. Why does this happen ?
>
>Now if I jump to price of item 1 and then loose focus of the control, the correct amount is displayed for sub-total.
>
>How can I fix this situation ?

Do your calculations in the grid's BeforeRowColumnChange or AfterRCC methods. When your code fires from a lostfocus, you're not quite sure as to which record is the recordsource of your controls. During the BRCC you're still sitting on the same row - and I'd actually recommend to try to use fields (i.e. replace command), not control.value. YMMV, of course, but I'm generally more comfortable dealing with fields than grid controls.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform