mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for reports
This commit is contained in:
parent
2c7c60f985
commit
dee0b51771
@ -86,7 +86,12 @@ class CreditExport extends BaseExport
|
|||||||
{
|
{
|
||||||
$query = $this->init();
|
$query = $this->init();
|
||||||
|
|
||||||
$header = $this->buildHeader();
|
$headerdisplay = $this->buildHeader();
|
||||||
|
$header = [];
|
||||||
|
|
||||||
|
foreach ($this->input['report_keys'] as $key => $value) {
|
||||||
|
$header[] = ['identifier' => $value, 'display_value' => $headerdisplay[$key]];
|
||||||
|
}
|
||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($credit) {
|
->map(function ($credit) {
|
||||||
@ -94,7 +99,10 @@ class CreditExport extends BaseExport
|
|||||||
return $this->processMetaData($row, $credit);
|
return $this->processMetaData($row, $credit);
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
return array_merge([$header], $report);
|
nlog(array_merge(['column' => $header], $report));
|
||||||
|
|
||||||
|
|
||||||
|
return array_merge(['column' => $header], $report);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processMetaData(array $row, Credit $credit): array
|
private function processMetaData(array $row, Credit $credit): array
|
||||||
@ -112,6 +120,7 @@ class CreditExport extends BaseExport
|
|||||||
$clean_row[$key]['id'] = $report_keys[1] ?? $report_keys[0];
|
$clean_row[$key]['id'] = $report_keys[1] ?? $report_keys[0];
|
||||||
$clean_row[$key]['hashed_id'] = $report_keys[0] == 'credit' ? null : $credit->{$report_keys[0]}->hashed_id ?? null;
|
$clean_row[$key]['hashed_id'] = $report_keys[0] == 'credit' ? null : $credit->{$report_keys[0]}->hashed_id ?? null;
|
||||||
$clean_row[$key]['value'] = $row[$column_key];
|
$clean_row[$key]['value'] = $row[$column_key];
|
||||||
|
$clean_row[$key]['identifier'] = $value;
|
||||||
|
|
||||||
if(in_array($clean_row[$key]['id'], ['amount', 'balance', 'partial', 'refunded', 'applied','unit_cost','cost','price']))
|
if(in_array($clean_row[$key]['id'], ['amount', 'balance', 'partial', 'refunded', 'applied','unit_cost','cost','price']))
|
||||||
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $credit->client);
|
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $credit->client);
|
||||||
@ -134,14 +143,6 @@ class CreditExport extends BaseExport
|
|||||||
|
|
||||||
if (count($this->input['report_keys']) == 0) {
|
if (count($this->input['report_keys']) == 0) {
|
||||||
$this->input['report_keys'] = array_values($this->entity_keys);
|
$this->input['report_keys'] = array_values($this->entity_keys);
|
||||||
// $this->input['report_keys'] = collect(array_values($this->entity_keys))->map(function ($value){
|
|
||||||
|
|
||||||
// // if(in_array($value,['client_id','country_id']))
|
|
||||||
// // return $value;
|
|
||||||
// // else
|
|
||||||
// return 'credit.'.$value;
|
|
||||||
// })->toArray();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Credit::query()
|
$query = Credit::query()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user