add status to client export

This commit is contained in:
David Bomba 2022-12-05 09:28:08 +11:00
parent 8b2f9a8708
commit ea3b6d0259
2 changed files with 14 additions and 2 deletions

View File

@ -76,6 +76,7 @@ class ClientExport extends BaseExport
'contact_custom_value3' => 'contact.custom_value3', 'contact_custom_value3' => 'contact.custom_value3',
'contact_custom_value4' => 'contact.custom_value4', 'contact_custom_value4' => 'contact.custom_value4',
'email' => 'contact.email', 'email' => 'contact.email',
'status' => 'status'
]; ];
private array $decorate_keys = [ private array $decorate_keys = [
@ -173,6 +174,19 @@ class ClientExport extends BaseExport
$entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : ''; $entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
} }
$entity['status'] = $this->calculateStatus($client);
return $entity; return $entity;
} }
private function calculateStatus($client)
{
if($client->is_deleted)
return ctrans('texts.deleted');
if($client->deleted_at)
return ctrans('texts.arcvived');
return ctrans('texts.active');
}
} }

View File

@ -56,8 +56,6 @@ class InvoiceFilters extends QueryFilters
if (in_array('unpaid', $status_parameters)) { if (in_array('unpaid', $status_parameters)) {
$this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]); $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]);
} }
//->where('due_date', '>', Carbon::now())
//->orWhere('partial_due_date', '>', Carbon::now());
if (in_array('overdue', $status_parameters)) { if (in_array('overdue', $status_parameters)) {
$this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])