1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Ninja/Reports/TaskReport.php

37 lines
1007 B
PHP
Raw Normal View History

2017-01-22 11:09:29 +01:00
<?php
namespace App\Ninja\Reports;
use App\Models\Task;
2017-01-30 20:40:43 +01:00
use Utils;
2017-01-22 11:09:29 +01:00
class TaskReport extends AbstractReport
{
public $columns = [
'client',
'date',
'project',
'description',
'duration',
];
public function run()
{
$tasks = Task::scope()
2017-03-31 08:01:07 +02:00
->orderBy('created_at', 'desc')
2017-01-22 11:09:29 +01:00
->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'),
2017-08-27 22:18:10 +02:00
$this->isExport ? $task->getStartTime() : link_to($task->present()->url, $task->getStartTime()),
2017-01-22 11:09:29 +01:00
$task->present()->project,
$task->description,
2017-01-22 11:09:29 +01:00
Utils::formatTime($task->getDuration()),
];
}
}
}