General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only