mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
37 lines
1007 B
PHP
37 lines
1007 B
PHP
<?php
|
|
|
|
namespace App\Ninja\Reports;
|
|
|
|
use App\Models\Task;
|
|
use Utils;
|
|
|
|
class TaskReport extends AbstractReport
|
|
{
|
|
public $columns = [
|
|
'client',
|
|
'date',
|
|
'project',
|
|
'description',
|
|
'duration',
|
|
];
|
|
|
|
public function run()
|
|
{
|
|
$tasks = Task::scope()
|
|
->orderBy('created_at', 'desc')
|
|
->with('client.contacts')
|
|
->withArchived()
|
|
->dateRange($this->startDate, $this->endDate);
|
|
|
|
foreach ($tasks->get() as $task) {
|
|
$this->data[] = [
|
|
$task->client ? ($this->isExport ? $task->client->getDisplayName() : $task->client->present()->link) : trans('texts.unassigned'),
|
|
$this->isExport ? $task->getStartTime() : link_to($task->present()->url, $task->getStartTime()),
|
|
$task->present()->project,
|
|
$task->description,
|
|
Utils::formatTime($task->getDuration()),
|
|
];
|
|
}
|
|
}
|
|
}
|