Merge pull request #432 from garyhgohoos/23254-3

Issue #23254:fix gain/loss calculation
goes with https://github.com/xtuple/xtuple/pull/1732
Issue #24332:add signals for scripting
Merge pull request #455 from garyhgohoos/24332

issue #24332 - add signals for scripting