From 03089ed1b396273a6413304d6e7742e895e8f58f Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Mon, 11 Aug 2025 20:39:54 -0500 Subject: [PATCH] wip --- app/Models/DailyChange.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/DailyChange.php b/app/Models/DailyChange.php index bb6b96e..04f774e 100644 --- a/app/Models/DailyChange.php +++ b/app/Models/DailyChange.php @@ -119,12 +119,12 @@ class DailyChange extends Model WHEN transactions.transaction_type = 'SELL' THEN transactions.sale_price_base - transactions.cost_basis_base END - ) * transactions.quantity * COALESCE(cr.rate, 1) AS realized_gain_loss"), + ) * transactions.quantity * COALESCE(cr.rate, 1) AS realized_gain_dollars"), 'cb') - ->selectRaw('SUM(cb.realized_gain_loss)') + ->selectRaw('SUM(cb.realized_gain_dollars)') ->whereColumn('cb.date', '<=', 'daily_change.date') ->whereColumn('cb.portfolio_id', '=', 'daily_change.portfolio_id'); - }, 'realized_gain_loss') + }, 'realized_gain_dollars') ->selectSub(function ($query) use ($dividendSub) { // todo: maybe costbasis uses this model? $query->fromSub($dividendSub, 'd') ->selectRaw('SUM(d.total_dividends_earned)')