More hip report stuff.

This commit is contained in:
James Cole
2015-05-16 15:43:58 +02:00
parent cdeac2c6db
commit b812881cdb
8 changed files with 140 additions and 187 deletions

View File

@@ -109,21 +109,34 @@ class ReportHelper implements ReportHelperInterface
$header->addAccount($account);
}
/** @var BudgetModel $budget */
foreach ($budgets as $budget) {
$line = new BalanceLine;
$line->setBudget($budget);
// get budget amount for current period:
$rep = $budget->limitrepetitions()->where('budget_limits.startdate',$start->format('Y-m-d 00:00:00'))->first();
if($rep) {
$line->setBudgetAmount($rep->amount);
}
// loop accounts:
foreach ($accounts as $account) {
$balanceEntry = new BalanceEntry;
$balanceEntry->setAccount($account);
$balanceEntry->setSpent(rand(1, 100));
// get spent:
$spent = $this->query->spentInBudget($account, $budget, $start, $end, $shared); // I think shared is irrelevant.
$balanceEntry->setSpent($spent);
$line->addBalanceEntry($balanceEntry);
}
// add line to balance:
$balance->addBalanceLine($line);
}
// then a new line for without budget.
$balance->setBalanceHeader($header);
return $balance;