mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-03 20:20:37 -06:00
Some cleaning up [skip ci]
This commit is contained in:
parent
8bd445ab19
commit
0de1242c83
@ -16,19 +16,19 @@ class BillLine
|
||||
|
||||
/** @var bool */
|
||||
protected $active;
|
||||
/** @var float */
|
||||
/** @var string */
|
||||
protected $amount;
|
||||
/** @var BillModel */
|
||||
protected $bill;
|
||||
/** @var bool */
|
||||
protected $hit;
|
||||
/** @var float */
|
||||
/** @var string */
|
||||
protected $max;
|
||||
/** @var float */
|
||||
/** @var string */
|
||||
protected $min;
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @return string
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
@ -36,7 +36,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @param string $amount
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
@ -60,7 +60,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @return string
|
||||
*/
|
||||
public function getMax()
|
||||
{
|
||||
@ -68,7 +68,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $max
|
||||
* @param string $max
|
||||
*/
|
||||
public function setMax($max)
|
||||
{
|
||||
@ -76,7 +76,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @return string
|
||||
*/
|
||||
public function getMin()
|
||||
{
|
||||
@ -84,7 +84,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $min
|
||||
* @param string $min
|
||||
*/
|
||||
public function setMin($min)
|
||||
{
|
||||
|
@ -217,18 +217,19 @@ class ReportHelper implements ReportHelperInterface
|
||||
$billLine = new BillLine;
|
||||
$billLine->setBill($bill);
|
||||
$billLine->setActive(intval($bill->active) == 1);
|
||||
$billLine->setMin(floatval($bill->amount_min));
|
||||
$billLine->setMax(floatval($bill->amount_max));
|
||||
$billLine->setMin($bill->amount_min);
|
||||
$billLine->setMax($bill->amount_max);
|
||||
|
||||
// is hit in period?
|
||||
bcscale(2);
|
||||
$set = $repository->getJournalsInRange($bill, $start, $end);
|
||||
if ($set->count() == 0) {
|
||||
$billLine->setHit(false);
|
||||
} else {
|
||||
$billLine->setHit(true);
|
||||
$amount = 0;
|
||||
$amount = '0';
|
||||
foreach ($set as $entry) {
|
||||
$amount += $entry->amount;
|
||||
$amount = bcadd($amount, $entry->amount);
|
||||
}
|
||||
$billLine->setAmount($amount);
|
||||
}
|
||||
|
@ -99,7 +99,6 @@ class ReportQuery implements ReportQueryInterface
|
||||
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||
}
|
||||
)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->where(
|
||||
function (Builder $query) {
|
||||
|
||||
|
@ -183,11 +183,13 @@ Route::controllers(
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
* Home Controller
|
||||
*/
|
||||
|
||||
Route::group(
|
||||
['middleware' => ['auth', 'range', 'reminders']], function () {
|
||||
|
||||
/**
|
||||
* Home Controller
|
||||
*/
|
||||
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
||||
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
||||
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
||||
|
@ -33,24 +33,11 @@ class Steam
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
||||
// find the first known transaction on this account:
|
||||
$firstDateObject = $account
|
||||
->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
||||
|
||||
$firstDate = is_null($firstDateObject) ? clone $date : new Carbon($firstDateObject->date);
|
||||
$date = $date < $firstDate ? $firstDate : $date;
|
||||
|
||||
bcscale(2);
|
||||
$set = $account->transactions()->leftJoin(
|
||||
|
||||
$balance = $account->transactions()->leftJoin(
|
||||
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||
)->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->get(['transactions.*']);
|
||||
$balance = '0';
|
||||
foreach ($set as $entry) {
|
||||
$balance = bcadd($balance, $entry->amount);
|
||||
}
|
||||
)->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount');
|
||||
|
||||
if (!$ignoreVirtualBalance) {
|
||||
$balance = bcadd($balance, $account->virtual_balance);
|
||||
|
Loading…
Reference in New Issue
Block a user