1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Added activity report

This commit is contained in:
Hillel Coren 2017-03-23 17:37:22 +02:00
parent 34776b2eb2
commit d8f55445c3
4 changed files with 90 additions and 0 deletions

View File

@ -67,6 +67,7 @@ class ReportController extends BaseController
}
$reportTypes = [
'activity',
'aging',
'client',
'expense',

View File

@ -0,0 +1,40 @@
<?php
namespace App\Ninja\Reports;
use App\Models\Activity;
use Auth;
class ActivityReport extends AbstractReport
{
public $columns = [
'date',
'client',
'user',
'activity',
];
public function run()
{
$account = Auth::user()->account;
$startDate = $this->startDate->format('Y-m-d');
$endDate = $this->endDate->format('Y-m-d');
$activities = Activity::scope()
->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'task', 'expense', 'account')
->whereRaw("DATE(created_at) >= \"{$startDate}\" and DATE(created_at) <= \"$endDate\"");
foreach ($activities->get() as $activity) {
$client = $activity->client;
$this->data[] = [
$activity->present()->createdAt,
$client ? ($this->isExport ? $client->getDisplayName() : $client->present()->link) : '',
$activity->present()->user,
$activity->getMessage(),
];
}
}
}

View File

@ -0,0 +1,34 @@
@extends('emails.master_user')
@section('body')
<div>
{{ trans('texts.email_salutation', ['name' => $userName]) }}
</div>
&nbsp;
<div>
{!! $primaryMessage !!}
</div>
@if (! empty($secondaryMessage))
&nbsp;
<div>
{!! $secondaryMessage !!}
</div>
@endif
@if (! empty($invoiceLink))
&nbsp;
<div>
<center>
@include('partials.email_button', [
'link' => $invoiceLink,
'field' => "view_invoice",
'color' => '#0b4d78',
])
</center>
</div>
@endif
&nbsp;
<div>
{{ trans('texts.email_signature') }} <br/>
{{ trans('texts.email_from') }}
</div>
@stop

View File

@ -0,0 +1,15 @@
{!! trans('texts.email_salutation', ['name' => $userName]) !!}
{!! strip_tags($primaryMessage) !!}
@if (! empty($secondaryMessage))
{!! strip_tags($secondaryMessage) !!}
@endif
@if (! empty($invoiceLink))
{!! $invoiceLink !!}
@endif
{!! trans('texts.email_signature') !!}
{!! trans('texts.email_from') !!}