Some fixes for bills.

This commit is contained in:
James Cole
2016-10-23 14:56:05 +02:00
parent e092515dff
commit 78deb1420d
6 changed files with 70 additions and 49 deletions

View File

@@ -326,11 +326,11 @@ class BillRepository implements BillRepositoryInterface
}
/**
* @param $bill
* @param Bill $bill
*
* @return string
*/
public function getOverallAverage($bill): string
public function getOverallAverage(Bill $bill): string
{
$journals = $bill->transactionJournals()->get();
$sum = '0';
@@ -347,6 +347,21 @@ class BillRepository implements BillRepositoryInterface
return $avg;
}
/**
* @param Bill $bill
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
{
$dates = $bill->transactionJournals()->before($end)->after($start)->get(['transaction_journals.date'])->pluck('date');
return $dates;
}
/**
* Between start and end, tells you on which date(s) the bill is expected to hit.
*