mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Remove $columns_labeled to use return
This commit is contained in:
parent
8ace6ad1ea
commit
fe8f34fc33
@ -145,7 +145,7 @@ class ReportController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get labeled header
|
//Get labeled header
|
||||||
$report->tableHeaderArray();
|
$columns_labeled = $report->tableHeaderArray();
|
||||||
|
|
||||||
/*$summary = [];
|
/*$summary = [];
|
||||||
if(count(array_values($totals))) {
|
if(count(array_values($totals))) {
|
||||||
@ -167,8 +167,8 @@ class ReportController extends BaseController
|
|||||||
|
|
||||||
dd($summary);*/
|
dd($summary);*/
|
||||||
|
|
||||||
return Excel::create($filename, function($excel) use($report, $data, $reportType, $format) {
|
return Excel::create($filename, function($excel) use($report, $data, $reportType, $format, $columns_labeled) {
|
||||||
$excel->sheet(trans("texts.$reportType"), function($sheet) use($report, $data, $format) {
|
$excel->sheet(trans("texts.$reportType"), function($sheet) use($report, $data, $format, $columns_labeled) {
|
||||||
|
|
||||||
$sheet->setOrientation('landscape');
|
$sheet->setOrientation('landscape');
|
||||||
$sheet->freezeFirstRow();
|
$sheet->freezeFirstRow();
|
||||||
@ -178,12 +178,12 @@ class ReportController extends BaseController
|
|||||||
$sheet->setAllBorders('thin');
|
$sheet->setAllBorders('thin');
|
||||||
|
|
||||||
$sheet->rows(array_merge(
|
$sheet->rows(array_merge(
|
||||||
[array_map(function($col) {return $col['label'];}, $report->columns_labeled)],
|
[array_map(function($col) {return $col['label'];}, $columns_labeled)],
|
||||||
$data
|
$data
|
||||||
));
|
));
|
||||||
|
|
||||||
//Styling header
|
//Styling header
|
||||||
$sheet->cells('A1:'.Utils::num2alpha(count($report->columns_labeled)-1).'1', function($cells) {
|
$sheet->cells('A1:'.Utils::num2alpha(count($columns_labeled)-1).'1', function($cells) {
|
||||||
$cells->setBackground('#777777');
|
$cells->setBackground('#777777');
|
||||||
$cells->setFontColor('#FFFFFF');
|
$cells->setFontColor('#FFFFFF');
|
||||||
$cells->setFontSize(14);
|
$cells->setFontSize(14);
|
||||||
|
@ -14,7 +14,6 @@ class AbstractReport
|
|||||||
public $totals = [];
|
public $totals = [];
|
||||||
public $columns = [];
|
public $columns = [];
|
||||||
public $data = [];
|
public $data = [];
|
||||||
public $columns_labeled = [];
|
|
||||||
|
|
||||||
public function __construct($startDate, $endDate, $isExport, $options = false)
|
public function __construct($startDate, $endDate, $isExport, $options = false)
|
||||||
{
|
{
|
||||||
@ -54,6 +53,7 @@ class AbstractReport
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function tableHeaderArray() {
|
public function tableHeaderArray() {
|
||||||
|
$columns_labeled = [];
|
||||||
|
|
||||||
foreach ($this->columns as $key => $val) {
|
foreach ($this->columns as $key => $val) {
|
||||||
if (is_array($val)) {
|
if (is_array($val)) {
|
||||||
@ -75,16 +75,18 @@ class AbstractReport
|
|||||||
$class = count($class) ? implode(' ', $class) : 'group-false';
|
$class = count($class) ? implode(' ', $class) : 'group-false';
|
||||||
$label = trans("texts.{$field}");
|
$label = trans("texts.{$field}");
|
||||||
|
|
||||||
$this->columns_labeled[] = ['label' => $label, 'class' => $class, 'key' => $field];
|
$columns_labeled[] = ['label' => $label, 'class' => $class, 'key' => $field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $columns_labeled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tableHeader()
|
public function tableHeader()
|
||||||
{
|
{
|
||||||
$this->tableHeaderArray();
|
$columns_labeled = $this->tableHeaderArray();
|
||||||
$str = '';
|
$str = '';
|
||||||
|
|
||||||
foreach ($this->columns_labeled as $field => $attr)
|
foreach ($columns_labeled as $field => $attr)
|
||||||
$str .= "<th class=\"{$attr['class']}\">{$attr['label']}</th>";
|
$str .= "<th class=\"{$attr['class']}\">{$attr['label']}</th>";
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user