Cleaning up

This commit is contained in:
James Cole 2016-01-01 21:15:03 +01:00
parent 27cabb398e
commit 5eb0e18cae
5 changed files with 43 additions and 49 deletions

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Helpers\Collection; namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel; use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
@ -45,24 +44,19 @@ class BalanceLine
} }
/** /**
* @return string * @return Collection
*/ */
public function getTitle() public function getBalanceEntries()
{ {
if ($this->getBudget() instanceof BudgetModel) { return $this->balanceEntries;
return $this->getBudget()->name; }
}
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
return trans('firefly.noBudget');
}
if ($this->getRole() == self::ROLE_TAGROLE) {
return trans('firefly.coveredWithTags');
}
if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced');
}
return ''; /**
* @param Collection $balanceEntries
*/
public function setBalanceEntries($balanceEntries)
{
$this->balanceEntries = $balanceEntries;
} }
/** /**
@ -97,6 +91,27 @@ class BalanceLine
$this->role = $role; $this->role = $role;
} }
/**
* @return string
*/
public function getTitle()
{
if ($this->getBudget() instanceof BudgetModel) {
return $this->getBudget()->name;
}
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
return trans('firefly.noBudget');
}
if ($this->getRole() == self::ROLE_TAGROLE) {
return trans('firefly.coveredWithTags');
}
if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced');
}
return '';
}
/** /**
* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine * If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine
* should have a "spent" value, which is the amount of money that has been spent * should have a "spent" value, which is the amount of money that has been spent
@ -115,20 +130,4 @@ class BalanceLine
return $start; return $start;
} }
/**
* @return Collection
*/
public function getBalanceEntries()
{
return $this->balanceEntries;
}
/**
* @param Collection $balanceEntries
*/
public function setBalanceEntries($balanceEntries)
{
$this->balanceEntries = $balanceEntries;
}
} }

View File

@ -5,8 +5,6 @@ namespace FireflyIII\Helpers\Report;
use Auth; use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use DB; use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Database\Query\JoinClause; use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View File

@ -3,8 +3,6 @@
namespace FireflyIII\Helpers\Report; namespace FireflyIII\Helpers\Report;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
@ -16,16 +14,16 @@ interface ReportQueryInterface
{ {
/** /**
* This method returns all the "in" transaction journals for the given account and given period. The amount * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers)
* is stored in "journalAmount". * grouped by month like so: "2015-01" => '123.45'
* *
* @param Collection $accounts * @param Collection $accounts
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return Collection * @return array
*/ */
public function income(Collection $accounts, Carbon $start, Carbon $end); public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end);
/** /**
* This method returns all the "out" transaction journals for the given account and given period. The amount * This method returns all the "out" transaction journals for the given account and given period. The amount
@ -40,16 +38,16 @@ interface ReportQueryInterface
public function expense(Collection $accounts, Carbon $start, Carbon $end); public function expense(Collection $accounts, Carbon $start, Carbon $end);
/** /**
* Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) * This method returns all the "in" transaction journals for the given account and given period. The amount
* grouped by month like so: "2015-01" => '123.45' * is stored in "journalAmount".
* *
* @param Collection $accounts * @param Collection $accounts
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return array * @return Collection
*/ */
public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end); public function income(Collection $accounts, Carbon $start, Carbon $end);
/** /**
* Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers)
@ -61,7 +59,7 @@ interface ReportQueryInterface
* *
* @return array * @return array
*/ */
public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end); public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end);
} }

View File

@ -17,8 +17,6 @@ interface BudgetRepositoryInterface
{ {
/** /**
* @return void * @return void
*/ */
@ -97,8 +95,8 @@ interface BudgetRepositoryInterface
* from the given users accounts.. * from the given users accounts..
* *
* @param Collection $accounts * @param Collection $accounts
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
* *
* @return array * @return array
*/ */

View File

@ -61,6 +61,7 @@
</script> </script>
</body> </body>