Fixes for export formats
This commit is contained in:
parent
b589dda5c4
commit
c67c73ca01
|
|
@ -191,7 +191,7 @@ class ClientExport extends BaseExport
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity = $this->decorateAdvancedFields($client, $entity);
|
$entity = $this->decorateAdvancedFields($client, $entity);
|
||||||
$this->convertFloats($entity);
|
return $this->convertFloats($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processMetaData(array $row, $resource): array
|
public function processMetaData(array $row, $resource): array
|
||||||
|
|
|
||||||
|
|
@ -143,10 +143,10 @@ class ProductSalesExport extends BaseExport
|
||||||
|
|
||||||
if($product_keys) {
|
if($product_keys) {
|
||||||
if(in_array($item->product_key, $product_keys)) {
|
if(in_array($item->product_key, $product_keys)) {
|
||||||
$this->csv->insertOne($this->buildRow($invoice, $item));
|
$this->csv->insertOne($this->convertFloats($this->buildRow($invoice, $item)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->csv->insertOne($this->buildRow($invoice, $item));
|
$this->csv->insertOne($this->convertFloats($this->buildRow($invoice, $item)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +175,7 @@ class ProductSalesExport extends BaseExport
|
||||||
'tax_amount3' => $key->sum('tax_amount3'),
|
'tax_amount3' => $key->sum('tax_amount3'),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $this->convertFloats($data);
|
||||||
|
|
||||||
})->reject(function ($value) {
|
})->reject(function ($value) {
|
||||||
return $value === false;
|
return $value === false;
|
||||||
|
|
@ -225,10 +225,9 @@ class ProductSalesExport extends BaseExport
|
||||||
$entity[$keyval] = '';
|
$entity[$keyval] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity = $this->decorateAdvancedFields($invoice, $entity);
|
$entity = $this->decorateAdvancedFields($invoice, $entity);
|
||||||
|
|
||||||
$entity = $this->convertFloats($entity);
|
|
||||||
|
|
||||||
$this->sales->push($entity);
|
$this->sales->push($entity);
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
|
|
@ -237,8 +236,6 @@ class ProductSalesExport extends BaseExport
|
||||||
private function decorateAdvancedFields(Invoice $invoice, $entity): array
|
private function decorateAdvancedFields(Invoice $invoice, $entity): array
|
||||||
{
|
{
|
||||||
|
|
||||||
//$product = $this->getProduct($entity['product_key']);
|
|
||||||
// $entity['cost'] = $product->cost ?? 0;
|
|
||||||
/** @var float $unit_cost */
|
/** @var float $unit_cost */
|
||||||
$unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost'];
|
$unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class QuoteItemExport extends BaseExport
|
||||||
$transformed_items = array_merge($transformed_quote, $item_array);
|
$transformed_items = array_merge($transformed_quote, $item_array);
|
||||||
$entity = $this->decorateAdvancedFields($quote, $transformed_items);
|
$entity = $this->decorateAdvancedFields($quote, $transformed_items);
|
||||||
$entity = array_merge(array_flip(array_values($this->input['report_keys'])), $entity);
|
$entity = array_merge(array_flip(array_values($this->input['report_keys'])), $entity);
|
||||||
$entity = $this->convertFloats($entity, $currency);
|
$entity = $this->convertFloats($entity);
|
||||||
|
|
||||||
$this->storage_array[] = $entity;
|
$this->storage_array[] = $entity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue