Some fixes for bills.

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

No files matched your search

+17 -2
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.
*