A complete refactoring means... Start from the data and convert it to a format needed to upload into the accounting program.

To do that, we need to know the formats the accounting program needs for each.

It will be very helpful to know what each column of the Data, both Raw and formatted, represents, or means, or is called/named.

For Example
Raw Data:
Column A. Represents Date of Transaction
Column B. Serial Number
Et al. ...
Column G. Transaction types; "I" means Invoice and "C" means Credit
Etc. ...

Credit Report:
blah
blah

Invoice Report:
blah
blah

An upload with three sheets, each with simple, common headers, as programmer notes, and a couple of Rows of correctly formatted data will suffice. The Columns' explanations and any other notes can be below that.

What you will probably get back from this forum will be code that is well organized, fast and efficient, easily understandable and maintainable, and, importantly, written in only one style.