Changing CSV fields in reports

Hi,

I played around a bit with the reports feature, since my colleague needs that data exported to manage the finance software.
So, I did an export for invoices, no group, no status, date range set to current month.
The fields contain the customer name, but neither his public_id nor any other identifier to exactly distinguish him.
How can I add the public_id to the csv export when using the reports feature?
It’s impossible to map the exported invoice data to the transactions in the banking software with the customer name only.

Here’s the code for the report. To add a column you need to add it at the top in the $columns array and then add the value in the $row array towards the bottom.

Will try.
But while testing around, I stumbled across another thing that looks strange to me.
Ever since I had to reduce the tax from 19% to 16% due to goverment law, the values from the report don’t match the reality.
For instance, a product with net worth 23.42 is rounded to 27.87€ with 19%, but 27.17 with 16%. The report does contain the 19% price in the CSV even though I changed all tax settings in the invoice items.
In the database, the invoices don’t have tax set at all, but they have a fixed “amount” and “balance” value, where the 19% invoice summary is saved.
I assume, that the report feature doesn’t calculate the values based on the invoices’ items, but on the “handcrafted” values of the invoices itself, that are probably set when creating the recurring invoice, but never modified based on the actual values even after modifying a recurring invoice.

Why is that? What does it do? How can I fix that?

It’s possible, there are cached values used throughout the app (ie, client.balance) which the SQL queries wouldn’t have corrected.

Hmmm, so, how can I fix those values in the sql database? Because in the current state my accountant can’t sync Invoice Ninja to our banking software, thus not being able to mark invoices as paid which makes running the reminders impossible.

btw: adding the client’s id_number to the report output worked, thanks for that. Too bad it doesn’t matter as long as the reported invoice amounts are wrong :frowning:

I’m not aware of a simple fix, to correct it I think you’d need to reverse the change you made and then use the API to bulk update the invoices instead.