diff --git a/app/Ninja/Reports/AbstractReport.php b/app/Ninja/Reports/AbstractReport.php index e327c60b7170..511872be178e 100644 --- a/app/Ninja/Reports/AbstractReport.php +++ b/app/Ninja/Reports/AbstractReport.php @@ -14,6 +14,7 @@ class AbstractReport public $totals = []; public $columns = []; public $data = []; + public $columns_labeled = []; public function __construct($startDate, $endDate, $isExport, $options = false) { @@ -52,9 +53,7 @@ class AbstractReport $this->totals[$currencyId][$dimension][$field] += $value; } - public function tableHeader() - { - $str = ''; + public function tableHeaderArray() { foreach ($this->columns as $key => $val) { if (is_array($val)) { @@ -75,8 +74,18 @@ class AbstractReport $class = count($class) ? implode(' ', $class) : 'group-false'; $label = trans("texts.{$field}"); - $str .= "{$label}"; + + $this->columns_labeled[] = ['label' => $label, 'class' => $class, 'key' => $field]; } + } + + public function tableHeader() + { + $this->tableHeaderArray(); + $str = ''; + + foreach ($this->columns_labeled as $field => $attr) + $str .= "{$attr['label']}"; return $str; } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index ca224373f276..135b42a0ca00 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2389,6 +2389,7 @@ $LANG = array( 'currency_peruvian_sol' => 'Peruvian Sol', 'use_english_version' => 'Make sure to use the English version of the files.
We use the column headers to match the fields.', + 'download_pdf' => 'Download PDF' ); diff --git a/resources/views/reports/chart_builder.blade.php b/resources/views/reports/chart_builder.blade.php index 99bbbd3cfd64..6e6fab97c6f4 100644 --- a/resources/views/reports/chart_builder.blade.php +++ b/resources/views/reports/chart_builder.blade.php @@ -1,7 +1,7 @@ @extends('header') @section('head') - @parent + @parent @@ -9,42 +9,47 @@ - + + @foreach ($account->getFontFolders() as $font) + + @endforeach + @stop @section('content') - @if (!Utils::isPro()) -
-
- {!! trans('texts.pro_plan_reports', ['link'=>'' . trans('texts.pro_plan_remove_logo_link') . '']) !!} -
-
- @endif + @if (!Utils::isPro()) +
+
+ {!! trans('texts.pro_plan_reports', ['link'=>'' . trans('texts.pro_plan_remove_logo_link') . '']) !!} +
+
+ @endif - @endif + @if (!Auth::user()->hasFeature(FEATURE_REPORTS)) + + @endif -
- {!! Button::primary(trans('texts.export')) - ->withAttributes(array('onclick' => 'onExportClick()')) - ->appendIcon(Icon::create('export')) - ->large() !!} - {!! Button::success(trans('texts.run')) - ->withAttributes(array('id' => 'submitButton')) - ->submit() - ->appendIcon(Icon::create('play')) - ->large() !!} -

+
+ @if(request()->report_type) + {!! Button::warning(trans('texts.download_pdf')) + ->withAttributes(array('onclick' => 'exportPDF()')) + ->appendIcon(Icon::create('save')) + ->large() !!} + @endif + {!! Button::primary(trans('texts.export')) + ->withAttributes(array('onclick' => 'onExportClick()')) + ->appendIcon(Icon::create('export')) + ->large() !!} + {!! Button::success(trans('texts.run')) + ->withAttributes(array('id' => 'submitButton')) + ->submit() + ->appendIcon(Icon::create('play')) + ->large() !!} +
+
- {!! Former::close() !!} + {!! Former::close() !!} - @if (request()->report_type) -
-
+ @if (request()->report_type) +
+
- @if (count(array_values($reportTotals))) - - - - - @foreach (array_values(array_values($reportTotals)[0])[0] as $key => $val) - - @endforeach - - - - @foreach ($reportTotals as $currencyId => $each) - @foreach ($each as $dimension => $val) - - - @foreach ($val as $id => $field) - - @endforeach - - @endforeach - @endforeach - - -

 

- @endif + @if (count(array_values($reportTotals))) + + + + + @foreach (array_values(array_values($reportTotals)[0])[0] as $key => $val) + + @endforeach + + + + @foreach ($reportTotals as $currencyId => $each) + @foreach ($each as $dimension => $val) + + + @foreach ($val as $id => $field) + + @endforeach + + @endforeach + @endforeach + + +

 

+ @endif - - - - - {!! $report->tableHeader() !!} - - - - @if (count($displayData)) - @foreach ($displayData as $record) - - @foreach ($record as $field) - - @endforeach - - @endforeach - @else - - - - @endif - - + + + + {!! $report->tableHeader() !!} + + + + @if (count($displayData)) + @foreach ($displayData as $record) + + @foreach ($record as $field) + + @endforeach + + @endforeach + @else + + + + @endif + + -
-
- {{ trans('texts.reports_help') }} -
+
+
+ {{ trans('texts.reports_help') }} +
+ +
+
-
- + @endif - @endif + + @stop - - -@stop - - -@section('onReady') - - $('#start_date, #end_date').datepicker({ - autoclose: true, - todayHighlight: true, - keyboardNavigation: false - }); + @section('onReady') + + $('#start_date, #end_date').datepicker({ + autoclose: true, + todayHighlight: true, + keyboardNavigation: false + }); @stop