report function usage updated

This commit is contained in:
batuhanbas 2020-03-10 14:54:20 +03:00
parent c17a9f1ad0
commit 1d08c0ea80
8 changed files with 40 additions and 57 deletions

View File

@ -67,8 +67,8 @@ abstract class Report
'datasets' => [],
];
public $column_width = 'report-column';
public $head_column_width = 'head_report_column';
public $column_name_width = 'report-column-name';
public $column_value_width = 'report-column-value';
public function __construct(Model $model = null, $load_data = true)
{
@ -79,8 +79,6 @@ abstract class Report
}
$this->model = $model;
$this->setHeadColumnWidth();
$this->setDataColumnWidth();
if (!$load_data) {
return;
@ -100,6 +98,7 @@ abstract class Report
$this->setFilters();
$this->setRows();
$this->setData();
$this->setColumnWidth();
$this->loaded = true;
}
@ -203,33 +202,13 @@ abstract class Report
return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx');
}
public function setHeadColumnWidth()
public function setColumnWidth()
{
if (empty($this->model->settings->period)) {
return;
}
$head_width = 'head_report_column';
switch ($this->model->settings->period) {
case 'quarterly':
$head_width = 'col-sm-2';
break;
case 'yearly':
$head_width = 'col-sm-4';
break;
}
$this->head_column_width = $head_width;
}
public function setDataColumnWidth()
{
if (empty($this->model->settings->period)) {
return;
}
$width = 'report-column';
$width = '';
switch ($this->model->settings->period) {
case 'quarterly':
@ -240,7 +219,11 @@ abstract class Report
break;
}
$this->column_width = $width;
if (empty($width)) {
return;
}
$this->column_name_width = $this->column_value_width = $width;
}
public function setYear()

18
public/css/custom.css vendored
View File

@ -634,15 +634,7 @@ table .align-items-center td span.badge
/*--------Report Column--------*/
.report-column
{
-webkit-box-flex: 0;
-ms-flex: 0 0 6.66%;
flex: 0 0 6.66%;
max-width: 6.66%;
}
.head_report_column
.report-column-name
{
-webkit-box-flex: 0;
-ms-flex: 0 0 10%;
@ -650,6 +642,14 @@ table .align-items-center td span.badge
width: 10%;
max-width: 10%;
}
.report-column-value
{
-webkit-box-flex: 0;
-ms-flex: 0 0 6.66%;
flex: 0 0 6.66%;
max-width: 6.66%;
}
/*--------Report Column Finish--------*/

View File

@ -1,11 +1,11 @@
<tfoot>
<tr class="row rp-border-top-1 font-size-unset px-3">
<th class="{{ $class->head_column_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
<th class="{{ $class->column_name_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
@php $grand_total = 0; @endphp
@foreach($class->footer_totals[$table] as $total)
@php $grand_total += $total; @endphp
<th class="{{ $class->column_width }} text-right px-0">@money($total, setting('default.currency'), true)</th>
<th class="{{ $class->column_value_width }} text-right px-0">@money($total, setting('default.currency'), true)</th>
@endforeach
<th class="{{ $class->head_column_width }} text-right">@money($grand_total, setting('default.currency'), true)</th>
<th class="{{ $class->column_name_width }} text-right">@money($grand_total, setting('default.currency'), true)</th>
</tr>
</tfoot>

View File

@ -1,13 +1,13 @@
<thead class="thead-light">
<tr class="row font-size-unset">
@if (($table == 'default') && !empty($class->groups))
<th class="{{ $class->head_column_width }}">{{ $class->groups[$class->model->settings->group] }}</th>
<th class="{{ $class->column_name_width }}">{{ $class->groups[$class->model->settings->group] }}</th>
@else
<th class="{{ $class->head_column_width }}">{{ $table }}</th>
<th class="{{ $class->column_name_width }}">{{ $table }}</th>
@endif
@foreach($class->dates as $date)
<th class="{{ $class->column_width }} text-right px-0">{{ $date }}</th>
<th class="{{ $class->column_value_width }} text-right px-0">{{ $date }}</th>
@endforeach
<th class="{{ $class->head_column_width }} text-right">{{ trans_choice('general.totals', 1) }}</th>
<th class="{{ $class->column_name_width }} text-right">{{ trans_choice('general.totals', 1) }}</th>
</tr>
</thead>

View File

@ -1,9 +1,9 @@
@php $row_total = 0; @endphp
<tr class="row rp-border-top-1 font-size-unset">
<td class="{{ $class->head_column_width }}">{{ $class->row_names[$table][$id] }}</td>
<td class="{{ $class->column_name_width }}">{{ $class->row_names[$table][$id] }}</td>
@foreach($rows as $row)
@php $row_total += $row; @endphp
<td class="{{ $class->column_width }} text-right px-0">@money($row, setting('default.currency'), true)</td>
<td class="{{ $class->column_value_width }} text-right px-0">@money($row, setting('default.currency'), true)</td>
@endforeach
<td class="{{ $class->head_column_width }} text-right">@money($row_total, setting('default.currency'), true)</td>
<td class="{{ $class->column_name_width }} text-right">@money($row_total, setting('default.currency'), true)</td>
</tr>

View File

@ -1,12 +1,12 @@
<div class="table-responsive overflow-auto my-4">
<div class="table-responsive overflow-auto my-2">
<table class="table table-hover align-items-center rp-border-collapse">
<tfoot class="border-top-style">
<tr class="row rp-border-top-1 font-size-unset px-3">
<th class="{{ $class->head_column_width }} text-uppercase text-nowrap">{{ trans('reports.net_profit') }}</th>
<th class="{{ $class->column_name_width }} text-uppercase text-nowrap border-top-0">{{ trans('reports.net_profit') }}</th>
@foreach($class->net_profit as $profit)
<th class="{{ $class->column_width }} text-right px-0">@money($profit, setting('default.currency'), true)</th>
<th class="{{ $class->column_value_width }} text-right px-0 border-top-0">@money($profit, setting('default.currency'), true)</th>
@endforeach
<th class="{{ $class->head_column_width }} text-right">
<th class="{{ $class->column_name_width }} text-right border-top-0">
@money(array_sum($class->net_profit), setting('default.currency'), true)
</th>
</tr>

View File

@ -2,11 +2,11 @@
<table class="table table-hover align-items-center rp-border-collapse">
<thead class="border-top-style">
<tr class="row rp-border-bottom-1 font-size-unset px-3">
<th class="{{ $class->head_column_width }} text-right px-0"></th>
<th class="{{ $class->column_name_width }} text-right px-0 border-top-0"></th>
@foreach($class->dates as $date)
<th class="{{ $class->column_width }} text-right px-0">{{ $date }}</th>
<th class="{{ $class->column_value_width }} text-right px-0 border-top-0">{{ $date }}</th>
@endforeach
<th class="{{ $class->head_column_width }} text-uppercase text-right">
<th class="{{ $class->column_name_width }} text-uppercase text-right border-top-0">
{{ trans_choice('general.totals', 1) }}
</th>
</tr>

View File

@ -1,11 +1,11 @@
<tfoot>
<tr class="row rp-border-top-1 font-size-unset px-3">
<th class="{{ $class->head_column_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
<tr class="row rp-border-top-1 font-size-unset px-3 mb-3">
<th class="{{ $class->column_name_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
@php $grand_total = 0; @endphp
@foreach($class->footer_totals[$table] as $date => $total)
@php $grand_total += $total; @endphp
<th class="{{ $class->column_width }} text-right px-0">@money($total, setting('default.currency'), true)</th>
<th class="{{ $class->column_value_width }} text-right px-0">@money($total, setting('default.currency'), true)</th>
@endforeach
<th class="{{ $class->head_column_width }} text-right">@money($grand_total, setting('default.currency'), true)</th>
<th class="{{ $class->column_name_width }} text-right">@money($grand_total, setting('default.currency'), true)</th>
</tr>
</tfoot>