Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sum problems (no pun inttended)
Message
 
To
08/08/2003 16:08:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00818421
Message ID:
00818430
Views:
13
Try to run a debug and control the value of paytest on each step to see where it became greater/lower than expected.

>When running the code below the amount returned for paytest is double the amount just entered into the pytendered and not the actual total. But when I run the SUM command as is in the Command Window and ?print the result it is fine.
>
>Public NQUAN,NNOW,LWAIT,CRAMOUNT,CTHIS,paytest,NTICK
>paytest=0
>LWAIT=.T.
>CTHIS=This.Value
>NTICK=INVOICE.NTICKET
>SET CONSOLE OFF
>Sum PAYRECEIVED.namount For PAYRECEIVED.NTICKET = NTICK To CRPAY
>CRAMOUNT=INVOICE.YTOTALSALE-CRPAY
>Do Case
>
>Case CTHIS="RENTAL"
> Thisform.COMMAND2.Click
> LWAIT=.T.
>
>Case CTHIS="CANCEL"
> LWAIT=.T.
> Delete All For SALES.NTICKET = Val(Sys(3004)) In SALES
> Delete All For INVOICE.NTICKET = Val(Sys(3004)) In INVOICE
>
>Case CTHIS ="CASH"
> LWAIT=.T.
> Append Blank In PAYRECEIVED
> Replace PAYRECEIVED.namount With PYTENDERED In PAYRECEIVED
> Replace PAYRECEIVED.NTICKET With NTICK In PAYRECEIVED
> Replace PAYRECEIVED.ctype With "CASH" In PAYRECEIVED
> SUM payreceived.namount FOR payreceived.nticket = ntick TO paytest
> Do Case
> Case paytest < INVOICE.YTOTALSALE
> This.Parent.Tendered.SetFocus
> Case paytest >= INVOICE.YTOTALSALE
> This.Parent.COMPLETESALE
> LWAIT=.F.
> Endcase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform