<?php
 namespace App\Dashboard\Widget\Helper; class QrSheet { protected \App\QuickReports\PivotTables\GenerateContent $pivotContentGen; protected $name; protected $description; protected $inlineTitle; protected $displayCurrency = null; protected $displayFilters = []; public function __construct(\App\QuickReports\PivotTables\GenerateContent $pivotContentGen, $name, $description, $inlineTitle) { $this->pivotContentGen = $pivotContentGen; $this->name = $name; $this->description = $description; $this->inlineTitle = $inlineTitle; } public function getName() { return $this->name; } public function getDescription() { return $this->description; } public function getInlineTitle() { return $this->inlineTitle; } public function getPivotContentGen() :\App\QuickReports\PivotTables\GenerateContent { return $this->pivotContentGen; } public function setDisplayCurrency($displayCurrency) { $this->displayCurrency = $displayCurrency; } public function getDisplayCurrency() { return $this->displayCurrency; } public function addDisplayFilter($field, $value) { $this->displayFilters[$field] = $value; } public function getDisplayFiltersText() { $pivotSource = $this->pivotContentGen->getPivotSource(); $class = "\\App\\QuickReports\\PivotTables\\Data\\{$pivotSource}"; $pivotData = new $class(); $return = []; foreach($this->displayFilters as $field=>$value) { $filterReadValue = $pivotData->getColumnDisplayValue($field, $value); $filterFieldName = $pivotData->getColumnName($field); $return[] = "{$filterFieldName} = {$filterReadValue}"; } return implode(" , ", $return); } } 