2015-10-14 16:15:39 +02:00
|
|
|
@extends('header')
|
2015-04-30 19:54:19 +02:00
|
|
|
|
|
|
|
@section('head')
|
|
|
|
@parent
|
|
|
|
|
|
|
|
<script src="{!! asset('js/Chart.js') !!}" type="text/javascript"></script>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
2015-10-14 16:15:39 +02:00
|
|
|
@include('accounts.nav', ['selected' => ACCOUNT_CHARTS_AND_REPORTS, 'advanced' => true])
|
2015-04-30 19:54:19 +02:00
|
|
|
|
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
{!! Former::open()->rules(['start_date' => 'required', 'end_date' => 'required'])->addClass('warn-on-exit') !!}
|
2015-04-30 19:54:19 +02:00
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
<div style="display:none">
|
|
|
|
{!! Former::text('action') !!}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{!! Former::populateField('start_date', $startDate) !!}
|
|
|
|
{!! Former::populateField('end_date', $endDate) !!}
|
|
|
|
{!! Former::populateField('enable_report', intval($enableReport)) !!}
|
|
|
|
{!! Former::populateField('enable_chart', intval($enableChart)) !!}
|
2015-04-30 19:54:19 +02:00
|
|
|
|
|
|
|
<div class="row">
|
2015-10-14 16:15:39 +02:00
|
|
|
<div class="col-lg-12">
|
2015-04-30 19:54:19 +02:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.settings') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
2015-10-14 16:15:39 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
|
|
|
{!! Former::text('start_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))
|
|
|
|
->addGroupClass('start_date')
|
|
|
|
->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'start_date\')"></i>') !!}
|
|
|
|
{!! Former::text('end_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))
|
|
|
|
->addGroupClass('end_date')
|
|
|
|
->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'end_date\')"></i>') !!}
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
{!! Former::actions(
|
|
|
|
Button::primary(trans('texts.export'))->withAttributes(array('onclick' => 'onExportClick()'))->appendIcon(Icon::create('export')),
|
|
|
|
Button::success(trans('texts.run'))->withAttributes(array('id' => 'submitButton'))->submit()->appendIcon(Icon::create('play'))
|
|
|
|
) !!}
|
|
|
|
|
|
|
|
@if (!Auth::user()->isPro())
|
|
|
|
<script>
|
|
|
|
$(function() {
|
|
|
|
$('form.warn-on-exit').find('input, select, button').prop('disabled', true);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
{!! Former::checkbox('enable_report')->text(trans('texts.enable')) !!}
|
|
|
|
{!! Former::select('report_type')->options($reportTypes, $reportType)->label(trans('texts.group_by')) !!}
|
|
|
|
<p> </p>
|
|
|
|
{!! Former::checkbox('enable_chart')->text(trans('texts.enable')) !!}
|
|
|
|
{!! Former::select('group_by')->options($dateTypes, $groupBy) !!}
|
|
|
|
{!! Former::select('chart_type')->options($chartTypes, $chartType) !!}
|
|
|
|
|
|
|
|
|
|
|
|
{!! Former::close() !!}
|
2015-04-30 19:54:19 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@if ($enableReport)
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
|
|
|
<table class="table table-striped invoice-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
@foreach ($columns as $column)
|
|
|
|
<th>
|
|
|
|
{{ trans("texts.{$column}") }}
|
|
|
|
</th>
|
2015-04-30 19:54:19 +02:00
|
|
|
@endforeach
|
2015-10-14 16:15:39 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach ($displayData as $record)
|
2015-04-30 19:54:19 +02:00
|
|
|
<tr>
|
2015-10-14 16:15:39 +02:00
|
|
|
@foreach ($record as $field)
|
|
|
|
<td>
|
|
|
|
{!! $field !!}
|
|
|
|
</td>
|
|
|
|
@endforeach
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td><b>{{ trans('texts.totals') }}</b></td>
|
|
|
|
@if (!$reportType)
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
@endif
|
|
|
|
<td>
|
|
|
|
@foreach ($reportTotals['amount'] as $currencyId => $total)
|
|
|
|
<b>{{ Utils::formatMoney($total, $currencyId) }}</b><br/>
|
|
|
|
@endforeach
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
@foreach ($reportTotals['paid'] as $currencyId => $total)
|
|
|
|
<b>{{ Utils::formatMoney($total, $currencyId) }}</b><br/>
|
|
|
|
@endforeach
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
@foreach ($reportTotals['balance'] as $currencyId => $total)
|
|
|
|
<b>{{ Utils::formatMoney($total, $currencyId) }}</b><br/>
|
|
|
|
@endforeach
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
</table>
|
2015-04-30 19:54:19 +02:00
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
2015-04-30 19:54:19 +02:00
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
@if ($enableChart)
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
|
|
|
<canvas id="monthly-reports" width="700" height="400"></canvas>
|
|
|
|
<p> </p>
|
|
|
|
<div style="padding-bottom:8px">
|
|
|
|
<div style="float:left; height:22px; width:60px; background-color:rgba(78,205,196,.5); border: 1px solid rgba(78,205,196,1)"></div>
|
|
|
|
<div style="vertical-align: middle"> Invoices</div>
|
|
|
|
</div>
|
|
|
|
<div style="padding-bottom:8px; clear:both">
|
|
|
|
<div style="float:left; height:22px; width:60px; background-color:rgba(255,107,107,.5); border: 1px solid rgba(255,107,107,1)"></div>
|
|
|
|
<div style="vertical-align: middle"> Payments</div>
|
2015-04-30 19:54:19 +02:00
|
|
|
</div>
|
2015-10-14 16:15:39 +02:00
|
|
|
<div style="clear:both">
|
|
|
|
<div style="float:left; height:22px; width:60px; background-color:rgba(199,244,100,.5); border: 1px solid rgba(199,244,100,1)"></div>
|
|
|
|
<div style="vertical-align: middle"> Credits</div>
|
2015-04-30 19:54:19 +02:00
|
|
|
</div>
|
|
|
|
|
2015-10-14 16:15:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
2015-04-30 19:54:19 +02:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function onExportClick() {
|
|
|
|
$('#action').val('export');
|
|
|
|
$('#submitButton').click();
|
|
|
|
$('#action').val('');
|
|
|
|
}
|
|
|
|
|
|
|
|
var ctx = document.getElementById('monthly-reports').getContext('2d');
|
|
|
|
var chart = {
|
2015-08-30 14:08:15 +02:00
|
|
|
labels: {!! json_encode($labels) !!},
|
2015-04-30 19:54:19 +02:00
|
|
|
datasets: [
|
|
|
|
@foreach ($datasets as $dataset)
|
|
|
|
{
|
|
|
|
data: {!! json_encode($dataset['totals']) !!},
|
|
|
|
fillColor : "rgba({!! $dataset['colors'] !!},0.5)",
|
|
|
|
strokeColor : "rgba({!! $dataset['colors'] !!},1)",
|
|
|
|
},
|
|
|
|
@endforeach
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
scaleOverride: true,
|
|
|
|
scaleSteps: 10,
|
|
|
|
scaleStepWidth: {!! $scaleStepWidth !!},
|
|
|
|
scaleStartValue: 0,
|
|
|
|
scaleLabel : "<%=value%>",
|
|
|
|
};
|
|
|
|
|
2015-09-07 11:07:55 +02:00
|
|
|
$(function() {
|
|
|
|
$('.start_date .input-group-addon').click(function() {
|
|
|
|
toggleDatePicker('start_date');
|
|
|
|
});
|
|
|
|
$('.end_date .input-group-addon').click(function() {
|
|
|
|
toggleDatePicker('end_date');
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2015-04-30 19:54:19 +02:00
|
|
|
new Chart(ctx).{!! $chartType !!}(chart, options);
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
|
|
|
|
@section('onReady')
|
|
|
|
|
|
|
|
$('#start_date, #end_date').datepicker({
|
|
|
|
autoclose: true,
|
|
|
|
todayHighlight: true,
|
|
|
|
keyboardNavigation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
@stop
|