This section sums Debits (SumIn) and Credits(SumOut) and calculate the difference (DiffSum)

This Subroutine gives DiffSum error:

dbpSum of SumIn is correct i.e. .00

dbpSum of SumOut is correcot i.e. .02

But DiffSum shows value of error but should be .02 as result

Not sure why.

Works on all other entries.

Also checks to see if the calculation of Journal entries agrees with Account Balance.

Again, this works correctly except of these values i.e. error not equal to .02 (Account Balance).

- Code: Select all
`:SumInOut`

SetVar "[SumIn]" "0"

SetVar "[SumOut]" "0"

SetVar "[DiffSum]" "0"

If "[NBAccounting.JrDetails.$RecCount]" ">" "0"

dbpSum "NBAccounting" "JrDetails" "InAmt" "[SumIn]"

AlertBox "SumIn" "SumIn = [SumIn]"

dbpSum "NBAccounting" "JrDetails" "OutAmt" "[SumOut]"

AlertBox "SumOut" "SumOut = [SumOut]"

If "[SumIn]" ">=" "[SumOut]"

Math "[SumIn]-[SumOut]" "2" "[DiffSum]"

EndIf

. Else

If "[SumIn]" "<" "[SumOut]"

Math "[SumOut]-[SumIn]" "2" "[DiffSum]"

EndIf

If "[BalanceFld]" "<>" "[DiffSum]"

AlertBox "Out of Balance" "Account [NBAccounting.Gl.AcctDescription] is out of balance."

EndIf

Return

Suggestions? Thoughts?