mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-07-23 16:04:46 -07:00
🤖 Auto commit for release 'develop' on 2026-01-23
This commit is contained in:
@@ -68,7 +68,7 @@ class ReconcileController extends Controller
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function overview(Request $request, null|Account $account = null, null|Carbon $start = null, null|Carbon $end = null): JsonResponse
|
||||
public function overview(Request $request, ?Account $account = null, ?Carbon $start = null, ?Carbon $end = null): JsonResponse
|
||||
{
|
||||
$startBalance = $request->get('startBalance');
|
||||
$endBalance = $request->get('endBalance');
|
||||
@@ -101,13 +101,13 @@ class ReconcileController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setJournalIds($selectedIds);
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$journals = $collector->getExtractedJournals();
|
||||
}
|
||||
|
||||
// Collect all journals already reconciled
|
||||
if (count($clearedIds) > 0) {
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setJournalIds($clearedIds);
|
||||
$clearedJournals = $collector->getExtractedJournals();
|
||||
}
|
||||
@@ -128,10 +128,10 @@ class ReconcileController extends Controller
|
||||
Log::debug(sprintf('End balance: "%s"', $endBalance));
|
||||
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
|
||||
Log::debug(sprintf('Amount: "%s"', $amount));
|
||||
$difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount), $amount);
|
||||
$diffCompare = bccomp($difference, '0');
|
||||
$countCleared = count($clearedJournals);
|
||||
$reconSum = bcadd(bcadd($startBalance ?? '0', $amount), $clearedAmount);
|
||||
$difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount), $amount);
|
||||
$diffCompare = bccomp($difference, '0');
|
||||
$countCleared = count($clearedJournals);
|
||||
$reconSum = bcadd(bcadd($startBalance ?? '0', $amount), $clearedAmount);
|
||||
|
||||
try {
|
||||
$view = view('accounts.reconcile.overview', [
|
||||
@@ -147,7 +147,7 @@ class ReconcileController extends Controller
|
||||
'route' => $route,
|
||||
'countCleared' => $countCleared,
|
||||
'reconSum' => $reconSum,
|
||||
'selectedIds' => $selectedIds
|
||||
'selectedIds' => $selectedIds,
|
||||
])->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('View error: %s', $e->getMessage()));
|
||||
@@ -157,14 +157,14 @@ class ReconcileController extends Controller
|
||||
throw new FireflyException($view, 0, $e);
|
||||
}
|
||||
|
||||
$return = ['post_url' => $route, 'html' => $view];
|
||||
$return = ['post_url' => $route, 'html' => $view];
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
|
||||
{
|
||||
$toAdd = '0';
|
||||
$toAdd = '0';
|
||||
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
|
||||
|
||||
// not much magic below we need to cover using tests.
|
||||
@@ -200,7 +200,7 @@ class ReconcileController extends Controller
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function transactions(Account $account, null|Carbon $start = null, null|Carbon $end = null)
|
||||
public function transactions(Account $account, ?Carbon $start = null, ?Carbon $end = null)
|
||||
{
|
||||
if (!$start instanceof Carbon || !$end instanceof Carbon) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
@@ -210,10 +210,10 @@ class ReconcileController extends Controller
|
||||
}
|
||||
$start->endOfDay();
|
||||
$end->endOfDay();
|
||||
$startDate = clone $start;
|
||||
$startDate = clone $start;
|
||||
$startDate->subDay();
|
||||
|
||||
$currency = $this->accountRepos->getAccountCurrency($account) ?? $this->primaryCurrency;
|
||||
$currency = $this->accountRepos->getAccountCurrency($account) ?? $this->primaryCurrency;
|
||||
// correct
|
||||
Log::debug(sprintf('transactions: Call accountsBalancesOptimized with date/time "%s"', $startDate->toIso8601String()));
|
||||
Log::debug(sprintf('transactions2: Call accountsBalancesOptimized with date/time "%s"', $end->toIso8601String()));
|
||||
@@ -222,8 +222,8 @@ class ReconcileController extends Controller
|
||||
// $startBalance = Steam::bcround(Steam::finalAccountBalance($account, $startDate)['balance'], $currency->decimal_places);
|
||||
// $endBalance = Steam::bcround(Steam::finalAccountBalance($account, $end)['balance'], $currency->decimal_places);
|
||||
|
||||
$startBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $startDate)[$account->id];
|
||||
$endBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id];
|
||||
$startBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $startDate)[$account->id];
|
||||
$endBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id];
|
||||
// round balances.
|
||||
foreach ($startBalance as $key => $value) {
|
||||
$startBalance[$key] = Steam::bcround($value, $currency->decimal_places);
|
||||
@@ -236,7 +236,7 @@ class ReconcileController extends Controller
|
||||
$selectionStart = clone $start;
|
||||
$selectionStart->startOfDay();
|
||||
$selectionStart->subDays(3);
|
||||
$selectionEnd = clone $end;
|
||||
$selectionEnd = clone $end;
|
||||
$selectionEnd->endOfDay();
|
||||
$selectionEnd->addDays(3);
|
||||
|
||||
@@ -245,16 +245,17 @@ class ReconcileController extends Controller
|
||||
|
||||
// grab transactions:
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
||||
$collector
|
||||
->setAccounts(new Collection()->push($account))
|
||||
->setRange($selectionStart, $selectionEnd)
|
||||
->withBudgetInformation()
|
||||
->withCategoryInformation()
|
||||
->withAccountInformation();
|
||||
$array = $collector->getExtractedJournals();
|
||||
$journals = $this->processTransactions($account, $array);
|
||||
->withAccountInformation()
|
||||
;
|
||||
$array = $collector->getExtractedJournals();
|
||||
$journals = $this->processTransactions($account, $array);
|
||||
|
||||
try {
|
||||
$html = view('accounts.reconcile.transactions', [
|
||||
@@ -264,7 +265,7 @@ class ReconcileController extends Controller
|
||||
'start' => $start,
|
||||
'end' => $end,
|
||||
'selectionStart' => $selectionStart,
|
||||
'selectionEnd' => $selectionEnd
|
||||
'selectionEnd' => $selectionEnd,
|
||||
])->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||
@@ -286,7 +287,7 @@ class ReconcileController extends Controller
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($array as $journal) {
|
||||
$inverse = false;
|
||||
$inverse = false;
|
||||
|
||||
if (TransactionTypeEnum::DEPOSIT->value === $journal['transaction_type_type']) {
|
||||
$inverse = true;
|
||||
|
||||
Reference in New Issue
Block a user