Showing Client Total Overdues on latest Invoice/Quote

Hello !

I am new to InvoicePlane and happy to be here !

Trying to create my invoice/quote PDF Template and need something that don’t exist yet.

Asuuming that my customer has 3 invoices :
Inv1 10€, 01/JAN/2016
Inv2 10€, 01/FEB/2016
Inv3 10€, 01/MAR/2016

Also has only one payment at 15/JAN/2016 off 10€.

So this customer ows me 20€ for the past invoices.

What i want is to display the sum of overdues for this customer on every next invoice so he knows what to pay…

I had this code on my template.php file but cannot find what i need.

<?php print_r($invoice); ?>

Anybody can help me with this ?

Thank you !

The amount of the total client overdues is not meant to be displayed on the template so you would have to modify the /application/helpers/pdf_helper.php to get the data and pass it to the template.

Dear Kovah,

Thank you for your help !

I’ve made this, but now something else came up…

When i go for a payment and typing anything else than the current invoice total i get
"Payment amount cannot exceed invoice balance."

Example: Total invoice sum = 30€ but the payment is only 10€ from this client…

How can avoid this ?

Thank you in advance.

How are your amounts formatted?
Are you using the US standard with 1,000.00 or the normal 1.000,00 ?

Maybe there is a problem with the amounts getting recognized?

I think is normal 1.000,00 €

When i add 6,78 is giving me the error.
When i add 6.78 is adding 678,00
but when i edit the 678,00 and change it to 6,78 is OK !

What modifications would we have to do there exactly?

this may not be the approved way to get this to work, but i added the following:

IFnull((SELECT SUM(invoice_balance) FROM ip_invoice_amounts WHERE invoice_id IN (SELECT invoice_id FROM ip_invoices WHERE ip_invoices.client_id = ip_clients.client_id)), 0) AS client_invoice_balance

to the select statement in application/modules/invoices/models/mdl_invoices.php

and can access the value using: $invoice->client_invoice_balance

This worked amazingly. Thank you so much! You are a life saver =)