From 6b750c909a9b0cb5fc0bf07a696ed777b0d56710 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 27 Dec 2015 08:39:41 +0100 Subject: [PATCH] Fix forgotten call in bill repository. --- app/Repositories/Bill/BillRepository.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 91f4a794cd..ded8eba0ec 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -498,22 +498,21 @@ class BillRepository implements BillRepositoryInterface { $accounts = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); - $creditCards = $accounts->getCreditCards(); + $creditCards = $accounts->getCreditCards($end); $paid = $set->get('paid'); $unpaid = $set->get('unpaid'); foreach ($creditCards as $creditCard) { - $balance = Steam::balance($creditCard, $end, true); $date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate')); - if ($balance < 0) { + if ($creditCard->balance < 0) { // unpaid! create a fake bill that matches the amount. $description = $creditCard->name; - $amount = $balance * -1; + $amount = $creditCard->balance * -1; $fakeBill = $this->createFakeBill($description, $date, $amount); unset($description, $amount); $unpaid->push([$fakeBill, $date]); } - if ($balance == 0) { + if ($creditCard->balance == 0) { // find transfer(s) TO the credit card which should account for // anything paid. If not, the CC is not yet used. $journals = $accounts->getTransfersInRange($creditCard, $start, $end);