Page 1 of 1

Mysterious Numbers Appearing

Posted: Thu Sep 05, 2019 12:54 pm
by JeffGrant
Hi, I am at a real loss here. Spent hours scratching my head.

I have this script that says:

Sub CreateHoldForm()
FormCreate()
FormAdd("Did the customer request this hold?", 1, {"Yes", "No"})
FormShow("Holding Facility ")
If FormResult(1) = 1
cSellPrice3:= Stock->C
Return
Else FormResult(1) = 2
cSellPrice3:= Stock->E
Return
Endif
Return

If FormResult is Yes, then UnitSell on the invoice form is updated and the subtotal is correct. No Drama :-)

If FormResult is No, then UnitSell on the invoice form is updated, but the subtotal shows a negative Stock->E. Therefore subtracting the value Stock->E from the invoice total instead of adding to it.

I have tried using cSellPrice3:= Abs(Stock->E), but the negative still appears.


This is happening on a few routines. So I must clearly be doing something wrong. I don't have any idea where the negative is coming from. The value of Stock->E is being picked up, but why is it negative ?????

I am really really stumped and bemused :-(.

Any guidance would be greatly appreciated.

UPDATE: Mysterious Numbers Appearing

Posted: Fri Sep 06, 2019 9:53 am
by JeffGrant
Morning,

I have spent hours overnight trying to figure this out and tried all sorts of combinations and in many subroutines. The crux of the matter is that the UnitSell Price is being updated on the invoice form, but the subtotal is picking up a negative from somewhere or multiplying the stock price by -1.

Why????

I have tried all sorts of Stock Prices from A to H.
I have tried the If .NOT. etc
I have tried <> and many .OR.

I have run out of ideas.

Please give a direction.

Thanks

UPDATE Part II : Mysterious Numbers Appearing

Posted: Fri Sep 06, 2019 10:30 am
by JeffGrant
Just for fun, I went the next step and printed the invoices. Even though the negative numbers are appearing in the subtotal box on the invoice form, the correct talleys have printed on the actual invoices.

So now I am really bewildered.

????

Re: Mysterious Numbers Appearing

Posted: Mon Sep 09, 2019 4:11 pm
by COBS Tech Support
Unfortunately the tiny fragment of script you posted and the completely missing context of what you're actually doing makes question impossible to answer.