Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Sum problems (no pun inttended)
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement