This problem is due to a bad version of 5.9.5 where refunds (TotalAmount field) are inserted into the postransactions table as NEGATIVE values (-1) instead of POSITIVE values (1).
The fix is to go through each database find the refund transactions with values less than 0 and change them to their opposite value.
Query:
mysql -uroot --batch -p Merchantxxx -sN -e "select TotalAmount,TransactionNumber from postransactions where \`TotalAmount\` < 0 and \`TransactionType\` = '2';"
Take this output and put it into a spreadsheet and convert the text to columns. Separate the columns and these rows in between to create update queries to change the values.
update postransactions set `TotalAmount` =' | ' where `TransactionNumber` =' | '; |
Run these queries and also push them to the POS with the push tool.