Adjustments for tax reports

This commit is contained in:
David Bomba 2025-02-07 11:26:20 +11:00
parent 8c25834ac4
commit 084ddcc7b8
3 changed files with 21 additions and 2 deletions

View File

@ -74,6 +74,7 @@ class ProjectReport extends BaseExport
'company_name' => $this->company->present()->name(),
'created_on' => $this->translateDate(now()->format('Y-m-d'), $this->company->date_format(), $this->company->locale()),
'created_by' => $user_name,
'charts' => $this->getCharts($projects),
];
$ts = new TemplateService();
@ -114,4 +115,21 @@ class ProjectReport extends BaseExport
return $taskAllocationData;
}
private function getCharts(array $projects)
{
if(!class_exists(Modules\Admin\Services\ChartService::class)) {
return [];
}
$chartService = new Modules\Admin\Services\ChartService();
return $projects->map(function ($project) use ($chartService) {
return [
'id' => $project->hashed_id,
'budgeted_hours' => $chartService->getBudgetedHours($project),
]
});
}
}

View File

@ -34,7 +34,7 @@ class TaxSummaryReport extends BaseExport
public Writer $csv;
public string $date_key = 'created_at';
public string $date_key = 'date';
private array $taxes = [];

View File

@ -1081,6 +1081,7 @@ class TemplateService
{
return [
'id' => $project->hashed_id,
'name' => $project->name ?: '',
'number' => $project->number ?: '',
'created_at' => $this->translateDate($project->created_at, $project->client->date_format(), $project->client->locale()),