diff --git a/app/Models/Common/Contact.php b/app/Models/Common/Contact.php index 6506a98b0..5b4ceaaa3 100644 --- a/app/Models/Common/Contact.php +++ b/app/Models/Common/Contact.php @@ -132,7 +132,7 @@ class Contact extends Model { $amount = 0; - $collection = ($this->type == 'customer') ? 'invoices' : 'bills'; + $collection = in_array($this->type, $this->getCustomerTypes()) ? 'invoices' : 'bills'; $this->$collection()->accrued()->notPaid()->each(function ($item) use (&$amount) { $unpaid = $item->amount - $item->paid;