startDate = $startDate; $this->endDate = $endDate; $this->isExport = $isExport; $this->options = $options; } public function run() { } public function results() { return [ 'columns' => $this->columns, 'displayData' => $this->data, 'reportTotals' => $this->totals, ]; } protected function addToTotals($currencyId, $field, $value, $dimension = false) { $currencyId = $currencyId ?: Auth::user()->account->getCurrencyId(); if (! isset($this->totals[$currencyId][$dimension])) { $this->totals[$currencyId][$dimension] = []; } if (! isset($this->totals[$currencyId][$dimension][$field])) { $this->totals[$currencyId][$dimension][$field] = 0; } $this->totals[$currencyId][$dimension][$field] += $value; } public function tableHeaderArray() { $columns_labeled = []; foreach ($this->columns as $key => $val) { if (is_array($val)) { $field = $key; $class = $val; } else { $field = $val; $class = []; } if (strpos($field, 'date') !== false) { $class[] = 'group-date-' . (isset($this->options['group_dates_by']) ? $this->options['group_dates_by'] : 'monthyear'); } elseif (in_array($field, ['client', 'vendor', 'product', 'user', 'method', 'category', 'project'])) { $class[] = 'group-letter-100'; } elseif (in_array($field, ['amount', 'paid', 'balance'])) { $class[] = 'group-number-50'; } $class = count($class) ? implode(' ', $class) : 'group-false'; $label = trans("texts.{$field}"); $columns_labeled[] = [ 'label' => $label, 'class' => $class, 'key' => $field ]; } return $columns_labeled; } public function tableHeader() { $columns_labeled = $this->tableHeaderArray(); $str = ''; foreach ($columns_labeled as $field => $attr) $str .= "