Am repost neg cheque

From Acacia Support Wiki
Jump to navigation Jump to search

am_repost_neg_cheque is used to clean up old cheque transactions that had negative lines.

Negative cheque lines don't make sensed. All cheque lines should be positive values.

They occurred because of pre-4.4.1 logic that created cheques from bills just by duplicating the lines and linking them to pay the bill lines.

When this process is called, it does the following:

  • Removes the allocation from the -ve cheque line to the -ve bill line
  • Reduces the value of the largest other +ve cheque line by the total of the -ve line.
  • Reduces the amount allocated from the largest +ve cheque line to match the new value.
  • Sets the -ve cheque line values to zero. At this point, the total value of the cheque remains unchanged.
  • The -ve line on the bill is allocated to the +ve lines on the bill.

The end result is:

  • a cheque with no negative lines
  • no negative allocations from the cheque
  • the bill still paid the same amount
  • all ledger balances unchanged