1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Ninja/Reports/TaskReport.php
2017-03-31 09:01:07 +03:00

37 lines
976 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'),
link_to($task->present()->url, $task->getStartTime()),
$task->present()->project,
$task->present()->description,
Utils::formatTime($task->getDuration()),
];
}
}
}