From 92e07fc20646839513bfebfdf8ff307186c06caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 6 Jun 2020 11:48:20 +0300 Subject: [PATCH] hide lines w/o money in reports --- .../views/partials/reports/table.blade.php | 2 +- .../partials/reports/table/footer.blade.php | 24 ++++++++++++------- .../partials/reports/table/rows.blade.php | 18 +++++++------- .../profit_loss/table/footer.blade.php | 24 ++++++++++++------- .../tax_summary/table/footer.blade.php | 24 ++++++++++++------- 5 files changed, 55 insertions(+), 37 deletions(-) diff --git a/resources/views/partials/reports/table.blade.php b/resources/views/partials/reports/table.blade.php index a3794a43a..5366b369d 100644 --- a/resources/views/partials/reports/table.blade.php +++ b/resources/views/partials/reports/table.blade.php @@ -9,7 +9,7 @@ @else -
{{ trans('general.no_records') }}
+
{{ trans('general.no_records') }}
@endif diff --git a/resources/views/partials/reports/table/footer.blade.php b/resources/views/partials/reports/table/footer.blade.php index ba6e3260a..8443fd1ba 100644 --- a/resources/views/partials/reports/table/footer.blade.php +++ b/resources/views/partials/reports/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans_choice('general.totals', 1) }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans_choice('general.totals', 1) }} + @foreach($class->footer_totals[$table] as $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif diff --git a/resources/views/partials/reports/table/rows.blade.php b/resources/views/partials/reports/table/rows.blade.php index 51832cc90..35f8c5cfc 100644 --- a/resources/views/partials/reports/table/rows.blade.php +++ b/resources/views/partials/reports/table/rows.blade.php @@ -1,9 +1,9 @@ -@php $row_total = 0; @endphp - - {{ $class->row_names[$table][$id] }} - @foreach($rows as $row) - @php $row_total += $row; @endphp - @money($row, setting('default.currency'), true) - @endforeach - @money($row_total, setting('default.currency'), true) - +@if ($row_total = array_sum($rows)) + + {{ $class->row_names[$table][$id] }} + @foreach($rows as $row) + @money($row, setting('default.currency'), true) + @endforeach + @money($row_total, setting('default.currency'), true) + +@endif diff --git a/resources/views/reports/profit_loss/table/footer.blade.php b/resources/views/reports/profit_loss/table/footer.blade.php index 5cae13c0c..8554a37fb 100644 --- a/resources/views/reports/profit_loss/table/footer.blade.php +++ b/resources/views/reports/profit_loss/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans_choice('general.totals', 1) }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $date => $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans_choice('general.totals', 1) }} + @foreach($class->footer_totals[$table] as $date => $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif diff --git a/resources/views/reports/tax_summary/table/footer.blade.php b/resources/views/reports/tax_summary/table/footer.blade.php index 17b2c7bd9..9804cec3f 100644 --- a/resources/views/reports/tax_summary/table/footer.blade.php +++ b/resources/views/reports/tax_summary/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans('reports.net') }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans('reports.net') }} + @foreach($class->footer_totals[$table] as $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif