mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Final fix before we merge back into develop and wreck havoc on everybody.
This commit is contained in:
@@ -25,10 +25,9 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
||||||
use FireflyIII\Helpers\Collection\BillLine;
|
use FireflyIII\Helpers\Collection\BillLine;
|
||||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||||
use FireflyIII\Helpers\FiscalHelperInterface;
|
use FireflyIII\Helpers\FiscalHelperInterface;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -70,8 +69,8 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*
|
*
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @return BillCollection
|
* @return BillCollection
|
||||||
@@ -92,10 +91,11 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
foreach ($expectedDates as $payDate) {
|
foreach ($expectedDates as $payDate) {
|
||||||
$endOfPayPeriod = app('navigation')->endOfX($payDate, $bill->repeat_freq, null);
|
$endOfPayPeriod = app('navigation')->endOfX($payDate, $bill->repeat_freq, null);
|
||||||
|
|
||||||
/** @var TransactionCollectorInterface $collector */
|
|
||||||
$collector = app(TransactionCollectorInterface::class);
|
/** @var GroupCollectorInterface $collector */
|
||||||
$collector->setAccounts($accounts)->setRange($payDate, $endOfPayPeriod)->setBills($bills);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$transactions = $collector->getTransactions();
|
$collector->setAccounts($accounts)->setRange($payDate, $endOfPayPeriod)->setBill($bill);
|
||||||
|
$journals = $collector->getExtractedJournals();
|
||||||
|
|
||||||
$billLine = new BillLine;
|
$billLine = new BillLine;
|
||||||
$billLine->setBill($bill);
|
$billLine->setBill($bill);
|
||||||
@@ -105,16 +105,15 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
$billLine->setMin((string)$bill->amount_min);
|
$billLine->setMin((string)$bill->amount_min);
|
||||||
$billLine->setMax((string)$bill->amount_max);
|
$billLine->setMax((string)$bill->amount_max);
|
||||||
$billLine->setHit(false);
|
$billLine->setHit(false);
|
||||||
$entry = $transactions->filter(
|
/** @var array $first */
|
||||||
function (Transaction $transaction) use ($bill) {
|
$first = null;
|
||||||
return $transaction->bill_id === $bill->id;
|
if (count($journals) > 0) {
|
||||||
}
|
$first = reset($journals);
|
||||||
);
|
}
|
||||||
$first = $entry->first();
|
|
||||||
if (null !== $first) {
|
if (null !== $first) {
|
||||||
$billLine->setTransactionJournalId($first->id);
|
$billLine->setTransactionJournalId($first['transaction_journal_id']);
|
||||||
$billLine->setAmount($first->transaction_amount);
|
$billLine->setAmount($first['amount']);
|
||||||
$billLine->setLastHitDate($first->date);
|
$billLine->setLastHitDate($first['date']);
|
||||||
$billLine->setHit(true);
|
$billLine->setHit(true);
|
||||||
}
|
}
|
||||||
if ($billLine->isActive() || $billLine->isHit()) {
|
if ($billLine->isActive() || $billLine->isHit()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user