Still showing balance due

I have a customer record that the only invoice for was deleted, however the client is still showing a balance due even though it should be $0.

How would I correct this? Any idea why?


Are you able to reproduce the problem or was it older data?

You can use: php artisan ninja:check-data to check for any errors like this.

And php artisan ninja:check-data --fix=true will correct it.

Let me try to reproduce, the data was not very old perhaps a month or so.
Where is this ghost balance coming from? There are no current invoice records or payment records for this client.

With some brief testing was not able to reproduce, however this is from the reports section:
The bottom 2 are incorrect, all payments have been deleted from those records and no invoices remain. One shows a -214 paid to date which is incorrect, and the other shows a 215 balance which is also incorrect.

What’s the result of the check data command?

I am trying to run this now.
From my terminal I get an error “could not open input file: artisan”

You need to run the command in the main folder of the app code

Thank you.
Looks like it’s giving a clean result

@david do you have any thoughts?

This info is from the client list view - the bottom 2 entries are wrong. Neither client has any remaining payment data (not sure how a negative payment records) or any invoice data.


The correct command here is this:

php artisan ninja:check-data --fix=true --client_balance=true --paid_to_date=true

I ran that command with this result:

It did not find any errors, however I still have 2 client entries that are wrong:
One shows a negative paid to date, the other has a balance with no invoices present.

This must have happened when deleting an invoice or payment, but it’s completely wrong and does not seem to balance. Both the clients have no existing invoices, recurring invoices, or payments yet they have those balance and paid to date totals.

Please advise.


I’m not sure, the check data script does a raw SQL query and sums up all active invoice balances and compares it to the client balance.

Is this client deleted?

No, the clients are still active, however there were payments or invoices that were deleted related to those clients.

on both clients view show NO active invoices, payments, credits, or recurring invoices at this time.

Any ideas?

The negative 214 appears to be from a deleted credit. Why is the deleted credit still showing in the client balance? (and how should I remove it?)

I’m still trying to figure out where the positive 215 for the other client record is coming from.

I tried to restore, set to zero and delete that credit and it made it worse!

Now that client is showing a -428 paid to date, even though there are no active credits, invoices, or payments. Arrgh…


Archived invoices are considered active still, are there any archived invoices / credits?

No, there are only deleted ones.

I’m not sure how to reconcile this -
does deleting the client delete all associated payments, credits, invoices, associated with that client?

If I delete their record and recreate it would that ‘clear the slate’?

Deleting the client pushes them out of the system. The system does not consider the delete client payments / invoices in any calculations at all, we simply ignore all deleted records.

In your case, If you wish to delete this client, it may be worth restoring the client, and then purging the client. This will wipe the client and all its related entities from the system completely.