Please help me to show on current invoice if the client has an overdue invoice the overdue amount and to sum with current invoice.
I tried something to show the overdue amount but doesn’t work. Here is what I done until now:
{% for invoicemama in loader.getInvoices() %}
heuhio
{% if (date(date_till) < date()) and status == ‘not_paid’ %}
eeee
{% set sold_precendent = invoicemama.total %}
{{ sold_precedent }}
{% endif %}
{% endfor %}
But doesn’t enter even in for.
Does, but 1) you have to disable invoice cache → Config / Finance / Settings (Invouice / Invoice cache set to false)
2) You have to delete existing invoice cache : Config / Tools / Invoice cache - Delete
You have typo on code - {% set sold_precendent = invoicemama.total %} - sold_precendent != sold_precedent
before for you need to inicialize sold_precendent : {% set sold_precendent = 0 %}
you have bad IF statement (you use current invoice values, not loaded), it
should be:
{% if (date(invoicemama.date_till) < date()) and invoicemama.status == 'not_paid' %}
working example:
{% set sold_precendent = 0 %}
{% for invoicemama in loader.getInvoices() %}
heuhio
{% if (date(invoicemama.date_till) < date()) and invoicemama.status == ‘not_paid’ %}
eeee
{% set sold_precendent = invoicemama.total %}
{{ sold_precendent }}
{% endif %}
{% endfor %}