-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from andrewdwallo/development-3.x
Development 3.x
- Loading branch information
Showing
55 changed files
with
1,654 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Contracts; | ||
|
||
use App\DTO\ReportCategoryDTO; | ||
use App\Support\Column; | ||
|
||
interface HasSummaryReport | ||
{ | ||
/** | ||
* @return Column[] | ||
*/ | ||
public function getSummaryColumns(): array; | ||
|
||
public function getSummaryHeaders(): array; | ||
|
||
/** | ||
* @return ReportCategoryDTO[] | ||
*/ | ||
public function getSummaryCategories(): array; | ||
|
||
public function getSummaryOverallTotals(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\DTO; | ||
|
||
class AccountTypeDTO | ||
{ | ||
/** | ||
* @param AccountDTO[] $accounts | ||
*/ | ||
public function __construct( | ||
public array $accounts, | ||
public AccountBalanceDTO $summary, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\DTO; | ||
|
||
class ReportTypeDTO | ||
{ | ||
public function __construct( | ||
public ?array $header = null, | ||
public ?array $data = null, | ||
public ?array $summary = null, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
namespace App\Filament\Company\Pages\Reports; | ||
|
||
use App\Contracts\ExportableReport; | ||
use App\DTO\ReportDTO; | ||
use App\Filament\Forms\Components\DateRangeSelect; | ||
use App\Services\ExportService; | ||
use App\Services\ReportService; | ||
use App\Support\Column; | ||
use App\Transformers\BalanceSheetReportTransformer; | ||
use Filament\Forms\Form; | ||
use Filament\Support\Enums\Alignment; | ||
use Livewire\Attributes\Url; | ||
use Symfony\Component\HttpFoundation\StreamedResponse; | ||
|
||
class BalanceSheet extends BaseReportPage | ||
{ | ||
protected static string $view = 'filament.company.pages.reports.balance-sheet'; | ||
|
||
protected static bool $shouldRegisterNavigation = false; | ||
|
||
protected ReportService $reportService; | ||
|
||
protected ExportService $exportService; | ||
|
||
#[Url] | ||
public ?string $activeTab = 'summary'; | ||
|
||
public function boot(ReportService $reportService, ExportService $exportService): void | ||
{ | ||
$this->reportService = $reportService; | ||
$this->exportService = $exportService; | ||
} | ||
|
||
public function getTable(): array | ||
{ | ||
return [ | ||
Column::make('account_code') | ||
->label('Account Code') | ||
->toggleable() | ||
->alignment(Alignment::Center), | ||
Column::make('account_name') | ||
->label('Account') | ||
->alignment(Alignment::Left), | ||
Column::make('ending_balance') | ||
->label('Amount') | ||
->alignment(Alignment::Right), | ||
]; | ||
} | ||
|
||
public function filtersForm(Form $form): Form | ||
{ | ||
return $form | ||
->inlineLabel() | ||
->columns(3) | ||
->schema([ | ||
DateRangeSelect::make('dateRange') | ||
->label('As of') | ||
->selectablePlaceholder(false) | ||
->endDateField('asOfDate'), | ||
$this->getAsOfDateFormComponent() | ||
->hiddenLabel() | ||
->extraFieldWrapperAttributes([]), | ||
]); | ||
} | ||
|
||
protected function buildReport(array $columns): ReportDTO | ||
{ | ||
return $this->reportService->buildBalanceSheetReport($this->getFormattedAsOfDate(), $columns); | ||
} | ||
|
||
protected function getTransformer(ReportDTO $reportDTO): ExportableReport | ||
{ | ||
return new BalanceSheetReportTransformer($reportDTO); | ||
} | ||
|
||
public function exportCSV(): StreamedResponse | ||
{ | ||
return $this->exportService->exportToCsv($this->company, $this->report, endDate: $this->getFilterState('asOfDate')); | ||
} | ||
|
||
public function exportPDF(): StreamedResponse | ||
{ | ||
return $this->exportService->exportToPdf($this->company, $this->report, endDate: $this->getFilterState('asOfDate')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.