commit
be69baf26b
@ -91,6 +91,15 @@ class ExpenseSummary extends Controller
|
||||
$this->setAmount($expenses_graph, $totals, $expenses, $payments, 'payment', 'paid_at');
|
||||
}
|
||||
|
||||
// Check if it's a print or normal request
|
||||
if (request('print')) {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line_print';
|
||||
$view_template = 'reports.expense_summary.print';
|
||||
} else {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line';
|
||||
$view_template = 'reports.expense_summary.index';
|
||||
}
|
||||
|
||||
// Expenses chart
|
||||
$chart = Charts::multi('line', 'chartjs')
|
||||
->dimensions(0, 300)
|
||||
@ -98,12 +107,12 @@ class ExpenseSummary extends Controller
|
||||
->dataset(trans_choice('general.expenses', 1), $expenses_graph)
|
||||
->labels($dates)
|
||||
->credits(false)
|
||||
->view('vendor.consoletvs.charts.chartjs.multi.line');
|
||||
->view($chart_template);
|
||||
|
||||
// Expenses Graph
|
||||
$expenses_graph = json_encode($expenses_graph);
|
||||
|
||||
return view('reports.expense_summary.index', compact('chart', 'dates', 'categories', 'expenses', 'totals'));
|
||||
return view($view_template, compact('chart', 'dates', 'categories', 'expenses', 'totals'));
|
||||
}
|
||||
|
||||
private function setAmount(&$graph, &$totals, &$expenses, $items, $type, $date_field)
|
||||
|
@ -141,6 +141,15 @@ class IncomeExpenseSummary extends Controller
|
||||
$this->setAmount($profit_graph, $totals, $compares, $payments, 'payment', 'paid_at');
|
||||
}
|
||||
|
||||
// Check if it's a print or normal request
|
||||
if (request('print')) {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line_print';
|
||||
$view_template = 'reports.income_expense_summary.print';
|
||||
} else {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line';
|
||||
$view_template = 'reports.income_expense_summary.index';
|
||||
}
|
||||
|
||||
// Profit chart
|
||||
$chart = Charts::multi('line', 'chartjs')
|
||||
->dimensions(0, 300)
|
||||
@ -148,9 +157,9 @@ class IncomeExpenseSummary extends Controller
|
||||
->dataset(trans_choice('general.profits', 1), $profit_graph)
|
||||
->labels($dates)
|
||||
->credits(false)
|
||||
->view('vendor.consoletvs.charts.chartjs.multi.line');
|
||||
->view($chart_template);
|
||||
|
||||
return view('reports.income_expense_summary.index', compact('chart', 'dates', 'income_categories', 'expense_categories', 'compares', 'totals'));
|
||||
return view($view_template, compact('chart', 'dates', 'income_categories', 'expense_categories', 'compares', 'totals'));
|
||||
}
|
||||
|
||||
private function setAmount(&$graph, &$totals, &$compares, $items, $type, $date_field)
|
||||
|
@ -91,6 +91,15 @@ class IncomeSummary extends Controller
|
||||
$this->setAmount($incomes_graph, $totals, $incomes, $revenues, 'revenue', 'paid_at');
|
||||
}
|
||||
|
||||
// Check if it's a print or normal request
|
||||
if (request('print')) {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line_print';
|
||||
$view_template = 'reports.income_summary.print';
|
||||
} else {
|
||||
$chart_template = 'vendor.consoletvs.charts.chartjs.multi.line';
|
||||
$view_template = 'reports.income_summary.index';
|
||||
}
|
||||
|
||||
// Incomes chart
|
||||
$chart = Charts::multi('line', 'chartjs')
|
||||
->dimensions(0, 300)
|
||||
@ -98,9 +107,9 @@ class IncomeSummary extends Controller
|
||||
->dataset(trans_choice('general.incomes', 1), $incomes_graph)
|
||||
->labels($dates)
|
||||
->credits(false)
|
||||
->view('vendor.consoletvs.charts.chartjs.multi.line');
|
||||
->view($chart_template);
|
||||
|
||||
return view('reports.income_summary.index', compact('chart', 'dates', 'categories', 'incomes', 'totals'));
|
||||
return view($view_template, compact('chart', 'dates', 'categories', 'incomes', 'totals'));
|
||||
}
|
||||
|
||||
private function setAmount(&$graph, &$totals, &$incomes, $items, $type, $date_field)
|
||||
|
4
public/css/app.css
vendored
4
public/css/app.css
vendored
@ -515,6 +515,10 @@ ul.add-new.nav.navbar-nav.pull-left {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.print-width {
|
||||
max-width: 1500px;
|
||||
}
|
||||
|
||||
/*
|
||||
.tooltip > .tooltip-inner {
|
||||
background-color: #6da252;
|
||||
|
7
resources/views/layouts/print.blade.php
Normal file
7
resources/views/layouts/print.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
@include('partials.admin.head')
|
||||
|
||||
<body onload="window.print();" class="print-width">
|
||||
@yield('content')
|
||||
</body>
|
||||
</html>
|
48
resources/views/reports/expense_summary/body.blade.php
Normal file
48
resources/views/reports/expense_summary/body.blade.php
Normal file
@ -0,0 +1,48 @@
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-report-expenses">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($expenses)
|
||||
@foreach($expenses as $category_id => $category)
|
||||
<tr>
|
||||
<td>{{ $categories[$category_id] }}</td>
|
||||
@foreach($category as $item)
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">@money($total['amount'], $total['currency_code'], true)</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
@ -2,6 +2,10 @@
|
||||
|
||||
@section('title', trans('reports.summary.expense'))
|
||||
|
||||
@section('new_button')
|
||||
<span class="new-button"><a href="{{ url('reports/expense-summary') }}?print=1&status={{ request('status') }}&year={{ request('year', $this_year) }}" target="_blank" class="btn btn-success btn-sm"><span class="fa fa-print"></span> {{ trans('general.print') }}</a></span>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
@ -17,55 +21,8 @@
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-report-expenses">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($expenses)
|
||||
@foreach($expenses as $category_id => $category)
|
||||
<tr>
|
||||
<td>{{ $categories[$category_id] }}</td>
|
||||
@foreach($category as $item)
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">@money($total['amount'], $total['currency_code'], true)</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
@include('reports.expense_summary.body')
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
||||
|
7
resources/views/reports/expense_summary/print.blade.php
Normal file
7
resources/views/reports/expense_summary/print.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('layouts.print')
|
||||
|
||||
@section('title', trans('reports.summary.expense'))
|
||||
|
||||
@section('content')
|
||||
@include('reports.expense_summary.body')
|
||||
@endsection
|
@ -0,0 +1,66 @@
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-payments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($compares)
|
||||
@foreach($compares as $type => $categories)
|
||||
@foreach($categories as $category_id => $category)
|
||||
<tr>
|
||||
@if($type == 'income')
|
||||
<td>{{ $income_categories[$category_id] }}</td>
|
||||
@else
|
||||
<td>{{ $expense_categories[$category_id] }}</td>
|
||||
@endif
|
||||
@foreach($category as $item)
|
||||
@if($type == 'income')
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@else
|
||||
<td class="text-right">@money(-$item['amount'], $item['currency_code'], true)</td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="13">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">
|
||||
@if($total['amount'] == 0)
|
||||
<span>@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@elseif($total['amount'] > 0)
|
||||
<span class="text-green">@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@else
|
||||
<span class="text-red">@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@endif
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
@ -1,6 +1,10 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', trans_choice('reports.summary.income_expense', 1))
|
||||
@section('title', trans('reports.summary.income_expense'))
|
||||
|
||||
@section('new_button')
|
||||
<span class="new-button"><a href="{{ url('reports/income-expense-summary') }}?print=1&status={{ request('status') }}&year={{ request('year', $this_year) }}" target="_blank" class="btn btn-success btn-sm"><span class="fa fa-print"></span> {{ trans('general.print') }}</a></span>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
@ -17,73 +21,8 @@
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-payments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($compares)
|
||||
@foreach($compares as $type => $categories)
|
||||
@foreach($categories as $category_id => $category)
|
||||
<tr>
|
||||
@if($type == 'income')
|
||||
<td>{{ $income_categories[$category_id] }}</td>
|
||||
@else
|
||||
<td>{{ $expense_categories[$category_id] }}</td>
|
||||
@endif
|
||||
@foreach($category as $item)
|
||||
@if($type == 'income')
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@else
|
||||
<td class="text-right">@money(-$item['amount'], $item['currency_code'], true)</td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="13">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">
|
||||
@if($total['amount'] == 0)
|
||||
<span>@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@elseif($total['amount'] > 0)
|
||||
<span class="text-green">@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@else
|
||||
<span class="text-red">@money($total['amount'], $total['currency_code'], true)</span>
|
||||
@endif
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
@include('reports.income_expense_summary.body')
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
||||
|
@ -0,0 +1,7 @@
|
||||
@extends('layouts.print')
|
||||
|
||||
@section('title', trans('reports.summary.income_expense'))
|
||||
|
||||
@section('content')
|
||||
@include('reports.income_expense_summary.body')
|
||||
@endsection
|
48
resources/views/reports/income_summary/body.blade.php
Normal file
48
resources/views/reports/income_summary/body.blade.php
Normal file
@ -0,0 +1,48 @@
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-report-incomes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($incomes)
|
||||
@foreach($incomes as $category_id => $category)
|
||||
<tr>
|
||||
<td>{{ $categories[$category_id] }}</td>
|
||||
@foreach($category as $item)
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">@money($total['amount'], $total['currency_code'], true)</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
@ -1,10 +1,14 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', trans_choice('reports.summary.income', 1))
|
||||
@section('title', trans('reports.summary.income'))
|
||||
|
||||
@section('new_button')
|
||||
<span class="new-button"><a href="{{ url('reports/income-summary') }}?print=1&status={{ request('status') }}&year={{ request('year', $this_year) }}" target="_blank" class="btn btn-success btn-sm"><span class="fa fa-print"></span> {{ trans('general.print') }}</a></span>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
<div class="box-header">
|
||||
<div class="pull-left" style="margin-left: 23px">
|
||||
<a href="{{ url('reports/income-summary') }}?year={{ request('year', $this_year) }}"><span class="badge @if (request('status') == '') bg-green @else bg-default @endif">{{ trans('general.all') }}</span></a>
|
||||
@ -17,55 +21,8 @@
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{!! $chart->render() !!}
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover" id="tbl-report-incomes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.categories', 1) }}</th>
|
||||
@foreach($dates as $date)
|
||||
<th class="text-right">{{ $date }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($incomes)
|
||||
@foreach($incomes as $category_id => $category)
|
||||
<tr>
|
||||
<td>{{ $categories[$category_id] }}</td>
|
||||
@foreach($category as $item)
|
||||
<td class="text-right">@money($item['amount'], $item['currency_code'], true)</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<h5 class="text-center">{{ trans('general.no_records') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>{{ trans_choice('general.totals', 1) }}</th>
|
||||
@foreach($totals as $total)
|
||||
<th class="text-right">@money($total['amount'], $total['currency_code'], true)</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@include('reports.income_summary.body')
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
{!! Charts::assets() !!}
|
||||
@endpush
|
||||
|
7
resources/views/reports/income_summary/print.blade.php
Normal file
7
resources/views/reports/income_summary/print.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('layouts.print')
|
||||
|
||||
@section('title', trans('reports.summary.income'))
|
||||
|
||||
@section('content')
|
||||
@include('reports.income_summary.body')
|
||||
@endsection
|
58
resources/views/vendor/consoletvs/charts/chartjs/multi/line_print.blade.php
vendored
Normal file
58
resources/views/vendor/consoletvs/charts/chartjs/multi/line_print.blade.php
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
@if(!$model->customId)
|
||||
@include('charts::_partials.container.canvas2')
|
||||
@endif
|
||||
|
||||
<script type="text/javascript">
|
||||
var ctx = document.getElementById("{{ $model->id }}")
|
||||
var data = {
|
||||
labels: [
|
||||
@foreach($model->labels as $label)
|
||||
"{!! $label !!}",
|
||||
@endforeach
|
||||
],
|
||||
datasets: [
|
||||
@for ($i = 0; $i < count($model->datasets); $i++)
|
||||
{
|
||||
fill: false,
|
||||
label: "{!! $model->datasets[$i]['label'] !!}",
|
||||
lineTension: 0.3,
|
||||
@if($model->colors and count($model->colors) > $i)
|
||||
@php($c = $model->colors[$i])
|
||||
@else
|
||||
@php($c = sprintf('#%06X', mt_rand(0, 0xFFFFFF)))
|
||||
@endif
|
||||
borderColor: "{{ $c }}",
|
||||
backgroundColor: "{{ $c }}",
|
||||
data: [
|
||||
@foreach($model->datasets[$i]['values'] as $dta)
|
||||
{{ $dta }},
|
||||
@endforeach
|
||||
],
|
||||
},
|
||||
@endfor
|
||||
]
|
||||
};
|
||||
|
||||
var myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
options: {
|
||||
responsive: {{ $model->responsive || !$model->width ? 'true' : 'false' }},
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'top'
|
||||
},
|
||||
animation: {
|
||||
duration: 0
|
||||
},
|
||||
@if($model->title)
|
||||
title: {
|
||||
display: true,
|
||||
text: "{!! $model->title !!}",
|
||||
fontSize: 20,
|
||||
}
|
||||
@endif
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user