|
@@ -6,6 +6,7 @@ use App\Contracts\ExportableReport;
|
6
|
6
|
use App\DTO\ReportDTO;
|
7
|
7
|
use App\Filament\Company\Pages\Accounting\Transactions;
|
8
|
8
|
use App\Models\Accounting\Account;
|
|
9
|
+use App\Models\Accounting\JournalEntry;
|
9
|
10
|
use App\Services\ExportService;
|
10
|
11
|
use App\Services\ReportService;
|
11
|
12
|
use App\Support\Column;
|
|
@@ -18,6 +19,7 @@ use Filament\Support\Enums\MaxWidth;
|
18
|
19
|
use Filament\Tables\Actions\Action;
|
19
|
20
|
use Guava\FilamentClusters\Forms\Cluster;
|
20
|
21
|
use Illuminate\Contracts\Support\Htmlable;
|
|
22
|
+use Illuminate\Database\Eloquent\Builder;
|
21
|
23
|
use Illuminate\Support\Collection;
|
22
|
24
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
23
|
25
|
|
|
@@ -162,12 +164,26 @@ class AccountTransactions extends BaseReportPage
|
162
|
164
|
];
|
163
|
165
|
}
|
164
|
166
|
|
165
|
|
- public function tableHasEmptyState(): bool
|
|
167
|
+ public function hasNoTransactionsForSelectedAccount(): bool
|
166
|
168
|
{
|
167
|
|
- if ($this->report) {
|
168
|
|
- return empty($this->report->getCategories());
|
169
|
|
- } else {
|
170
|
|
- return true;
|
|
169
|
+ $query = JournalEntry::query();
|
|
170
|
+ $selectedAccountId = $this->getFilterState('selectedAccount');
|
|
171
|
+
|
|
172
|
+ if ($selectedAccountId !== 'all') {
|
|
173
|
+ $query->where('account_id', $selectedAccountId);
|
171
|
174
|
}
|
|
175
|
+
|
|
176
|
+ if ($this->getFilterState('startDate') && $this->getFilterState('endDate')) {
|
|
177
|
+ $query->whereHas('transaction', function (Builder $query) {
|
|
178
|
+ $query->whereBetween('posted_at', [$this->getFormattedStartDate(), $this->getFormattedEndDate()]);
|
|
179
|
+ });
|
|
180
|
+ }
|
|
181
|
+
|
|
182
|
+ return $query->doesntExist();
|
|
183
|
+ }
|
|
184
|
+
|
|
185
|
+ public function tableHasEmptyState(): bool
|
|
186
|
+ {
|
|
187
|
+ return $this->hasNoTransactionsForSelectedAccount();
|
172
|
188
|
}
|
173
|
189
|
}
|