Custom action to duplicate a row

Custom action to duplicate a row

I have a custom-billing app with a form with about 50 fields.
I need to sometimes duplicate a row, but reverse all numeric fields to be the negative of each value -- essentially if the original line is a billing line then the duplicated line is a refund line. 

How can I write  a custom action to place a button on the report to achieve this? Thanks!