2015-02-25 08:19:14 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Bill;
|
|
|
|
|
2015-03-03 10:40:17 -06:00
|
|
|
use Carbon\Carbon;
|
2015-02-25 08:19:14 -06:00
|
|
|
use FireflyIII\Models\Bill;
|
|
|
|
use FireflyIII\Models\TransactionJournal;
|
2015-04-05 11:20:06 -05:00
|
|
|
use Illuminate\Support\Collection;
|
2015-02-25 08:19:14 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface BillRepositoryInterface
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Repositories\Bill
|
|
|
|
*/
|
2015-03-29 14:27:51 -05:00
|
|
|
interface BillRepositoryInterface
|
|
|
|
{
|
2015-02-25 08:19:14 -06:00
|
|
|
|
2015-07-09 02:41:54 -05:00
|
|
|
/**
|
2015-12-27 10:29:41 -06:00
|
|
|
* This method will tell you if you still have a CC bill to pay. Amount will be negative if the amount
|
|
|
|
* has been paid
|
2015-07-09 02:41:54 -05:00
|
|
|
*
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
2015-12-27 10:29:41 -06:00
|
|
|
* @return string
|
2015-07-09 02:41:54 -05:00
|
|
|
*/
|
2015-12-27 10:29:41 -06:00
|
|
|
public function getCreditCardBill(Carbon $start, Carbon $end);
|
2015-07-09 02:41:54 -05:00
|
|
|
|
2015-05-17 03:01:47 -05:00
|
|
|
/**
|
2015-12-27 10:29:41 -06:00
|
|
|
* Get the total amount of money paid for the users active bills in the date range given.
|
2015-05-17 03:01:47 -05:00
|
|
|
*
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
2015-12-27 10:29:41 -06:00
|
|
|
* @return string
|
2015-05-17 03:01:47 -05:00
|
|
|
*/
|
2015-12-27 10:29:41 -06:00
|
|
|
public function getBillsPaidInRange(Carbon $start, Carbon $end);
|
2015-05-17 03:01:47 -05:00
|
|
|
|
2015-12-26 02:39:35 -06:00
|
|
|
/**
|
2015-12-27 10:29:41 -06:00
|
|
|
* Get the total amount of money due for the users active bills in the date range given.
|
2015-12-26 02:39:35 -06:00
|
|
|
*
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
2015-12-27 10:29:41 -06:00
|
|
|
* @return string
|
2015-12-26 02:39:35 -06:00
|
|
|
*/
|
2015-12-27 10:29:41 -06:00
|
|
|
public function getBillsUnpaidInRange(Carbon $start, Carbon $end);
|
2015-12-26 02:39:35 -06:00
|
|
|
|
2015-04-07 03:14:10 -05:00
|
|
|
/**
|
2015-12-27 10:29:41 -06:00
|
|
|
* @return Collection
|
2015-04-07 03:14:10 -05:00
|
|
|
*/
|
2015-12-27 10:29:41 -06:00
|
|
|
public function getActiveBills();
|
|
|
|
|
2015-04-07 03:14:10 -05:00
|
|
|
|
2015-02-25 08:19:14 -06:00
|
|
|
/**
|
|
|
|
* @param Bill $bill
|
|
|
|
*
|
2015-04-05 11:20:06 -05:00
|
|
|
* @return mixed
|
2015-02-25 08:19:14 -06:00
|
|
|
*/
|
2015-04-05 11:20:06 -05:00
|
|
|
public function destroy(Bill $bill);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getBills();
|
|
|
|
|
2015-12-12 03:33:19 -06:00
|
|
|
/**
|
|
|
|
* Gets the bills which have some kind of relevance to the accounts mentioned.
|
|
|
|
*
|
|
|
|
* @param Collection $accounts
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getBillsForAccounts(Collection $accounts);
|
|
|
|
|
2015-04-05 11:20:06 -05:00
|
|
|
/**
|
|
|
|
* @param Bill $bill
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2015-04-06 02:15:59 -05:00
|
|
|
public function getJournals(Bill $bill);
|
2015-04-05 11:20:06 -05:00
|
|
|
|
2015-04-07 03:14:10 -05:00
|
|
|
/**
|
|
|
|
* Get all journals that were recorded on this bill between these dates.
|
|
|
|
*
|
|
|
|
* @param Bill $bill
|
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getJournalsInRange(Bill $bill, Carbon $start, Carbon $end);
|
|
|
|
|
2015-04-05 11:20:06 -05:00
|
|
|
/**
|
|
|
|
* @param Bill $bill
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2015-04-06 02:15:59 -05:00
|
|
|
public function getPossiblyRelatedJournals(Bill $bill);
|
2015-02-25 08:19:14 -06:00
|
|
|
|
2015-03-03 10:40:17 -06:00
|
|
|
/**
|
|
|
|
* Every bill repeats itself weekly, monthly or yearly (or whatever). This method takes a date-range (usually the view-range of Firefly itself)
|
|
|
|
* and returns date ranges that fall within the given range; those ranges are the bills expected. When a bill is due on the 14th of the month and
|
2015-12-27 10:29:41 -06:00
|
|
|
* you give 1st and the 31st of that month as argument, you'll get one response, matching the range of your bill (from the 14th to the 31th).
|
2015-03-03 10:40:17 -06:00
|
|
|
*
|
2015-03-29 14:27:51 -05:00
|
|
|
* @param Bill $bill
|
2015-03-03 10:40:17 -06:00
|
|
|
* @param Carbon $start
|
|
|
|
* @param Carbon $end
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getRanges(Bill $bill, Carbon $start, Carbon $end);
|
|
|
|
|
2015-02-25 08:19:14 -06:00
|
|
|
/**
|
2015-04-05 11:20:06 -05:00
|
|
|
* @param Bill $bill
|
2015-02-25 08:19:14 -06:00
|
|
|
*
|
2015-04-05 11:20:06 -05:00
|
|
|
* @return Carbon|null
|
2015-02-25 08:19:14 -06:00
|
|
|
*/
|
2015-04-05 11:20:06 -05:00
|
|
|
public function lastFoundMatch(Bill $bill);
|
2015-02-25 08:19:14 -06:00
|
|
|
|
2015-04-07 03:14:10 -05:00
|
|
|
|
2015-02-25 08:19:14 -06:00
|
|
|
/**
|
2015-04-05 11:20:06 -05:00
|
|
|
* @param Bill $bill
|
2015-02-25 08:19:14 -06:00
|
|
|
*
|
2015-05-26 13:59:16 -05:00
|
|
|
* @return \Carbon\Carbon
|
2015-02-25 08:19:14 -06:00
|
|
|
*/
|
2015-04-05 11:20:06 -05:00
|
|
|
public function nextExpectedMatch(Bill $bill);
|
2015-02-25 08:19:14 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Bill $bill
|
|
|
|
* @param TransactionJournal $journal
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function scan(Bill $bill, TransactionJournal $journal);
|
|
|
|
|
2015-04-05 11:20:06 -05:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return Bill
|
|
|
|
*/
|
|
|
|
public function store(array $data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Bill $bill
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function update(Bill $bill, array $data);
|
|
|
|
|
2015-03-29 01:14:32 -05:00
|
|
|
}
|