Enhancements for reports

This commit is contained in:
David Bomba 2023-05-26 12:07:37 +10:00
parent b66272c974
commit 57e7b4f879
3 changed files with 12 additions and 4 deletions

View File

@ -129,11 +129,13 @@ class Rule extends BaseRule implements RuleInterface
*/
public function taxShipping($item): self
{
if($this->tax_data?->txbFreight == 'Y') {
$this->default($item);
return $this->default($item);
}
$this->tax_rate1 = 0;
$this->tax_name1 = '';
return $this;
}

View File

@ -33,6 +33,8 @@ class BaseExport
public string $client_description = 'All Clients';
public array $forced_keys = [];
protected function filterByClients($query)
{
if (isset($this->input['client_id']) && $this->input['client_id'] != 'all') {
@ -170,7 +172,7 @@ class BaseExport
{
$header = [];
foreach ($this->input['report_keys'] as $value) {
foreach (array_merge($this->input['report_keys'], $this->forced_keys) as $value) {
$key = array_search($value, $this->entity_keys);
$key = str_replace('item.', '', $key);

View File

@ -81,6 +81,10 @@ class ClientExport extends BaseExport
'client.industry',
];
public array $forced_keys = [
'status',
];
public function __construct(Company $company, array $input)
{
$this->company = $company;
@ -103,7 +107,7 @@ class ClientExport extends BaseExport
if (count($this->input['report_keys']) == 0) {
$this->input['report_keys'] = array_values($this->entity_keys);
}
//insert the header
$this->csv->insertOne($this->buildHeader());