Bug in overdue calculation on dashboard

I just discovered that the overdue calculation on the dashboard either

  • only calculate based on the 10 displayed “recent invoices” on the dashboard or

  • only calculate based on the 10 newest invoices that is overdue.

In my setup I have many more invoices that is overdue, but they are not a part of the result of the calculated amount. (They all have status “Sent”.)

Best regards,
Erol Haagenrud

(This is not a request for support, it’s just a notification to the developers.)

FYI, I made a temporary solution for my own system.

In /application/modules/dashboard/controllers/dashboard.php I changed from

'quote_statuses' => $this->mdl_quotes->statuses(),
'overdue_invoices' => $this->mdl_invoices->is_overdue()->limit(10)->get()->result()

to

'quote_statuses' => $this->mdl_quotes->statuses(),
'overdue_invoices_warning' => $this->mdl_invoices->is_overdue()->get()->result(),
'overdue_invoices' => $this->mdl_invoices->is_overdue()->limit(10)->get()->result()

(I added the second last line.)

Then, in /application/modules/dashboard/views/index.php, around line 100 I changed from

<?php } else {
    $overdue_invoices_total = 0;
    foreach ($overdue_invoices as $invoice) {
        $overdue_invoices_total += $invoice->invoice_balance;
}

to

<?php } else {
    $overdue_invoices_total = 0;
    foreach ($overdue_invoices_warning as $invoice) {
        $overdue_invoices_total += $invoice->invoice_balance;
}

Now all invoices that are overdue is included in the calculation.
Why there initially was a limit of showing the sum of only the last 10 invoices that was overdue I don’t know.

1 Like

https://development.invoiceplane.com/browse/IP-375

Status: fixed

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.