Fixed balance list.

This commit is contained in:
James Cole
2016-04-03 13:56:06 +02:00
parent 622a97c8d8
commit 90bdc40393
6 changed files with 152 additions and 4 deletions

View File

@@ -92,6 +92,22 @@ class Tag extends Model
throw new NotFoundHttpException;
}
/**
* @param Tag $tag
*
* @return string
*/
public static function tagSum(Tag $tag): string
{
$sum = '0';
/** @var TransactionJournal $journal */
foreach ($tag->transactionjournals as $journal) {
bcadd($sum, TransactionJournal::amount($journal));
}
return $sum;
}
/**
* @codeCoverageIgnore
*