For me it looks like a memory corruption bug or smth., I remember years ago on one line value of variable is one a few lines down is completely another, even though nothing modified the value.
Actually a new version of this bug is SL>>Reports>>Periodic customer statement "accumulates" amounts
Not sure why it was duplicated, I clicked "submit"only once....