mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add additional filters for reports
This commit is contained in:
parent
fae98725b0
commit
6fbd80333a
@ -832,6 +832,42 @@ class BaseExport
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function addClientFilter($query, $clients): Builder
|
||||||
|
{
|
||||||
|
$transformed_clients = $this->transformKeys(explode(',', $clients));
|
||||||
|
|
||||||
|
$query->whereIn('client_id', $transformed_clients);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addVendorFilter($query, $vendors): Builder
|
||||||
|
{
|
||||||
|
$transformed_vendors = $this->transformKeys(explode(',', $vendors));
|
||||||
|
|
||||||
|
$query->whereIn('vendor_id', $transformed_vendors);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addProjectFilter($query, $projects): Builder
|
||||||
|
{
|
||||||
|
$transformed_projects = $this->transformKeys(explode(',', $projects));
|
||||||
|
|
||||||
|
$query->whereIn('project_id', $transformed_projects);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addCategoryFilter($query, $expense_categories): Builder
|
||||||
|
{
|
||||||
|
$transformed_expense_categories = $this->transformKeys(explode(',', $expense_categories));
|
||||||
|
|
||||||
|
$query->whereIn('category_id', $transformed_expense_categories);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
protected function addInvoiceStatusFilter($query, $status): Builder
|
protected function addInvoiceStatusFilter($query, $status): Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -88,6 +88,22 @@ class ExpenseExport extends BaseExport
|
|||||||
|
|
||||||
$query = $this->addDateRange($query);
|
$query = $this->addDateRange($query);
|
||||||
|
|
||||||
|
if(isset($this->input['clients'])) {
|
||||||
|
$query = $this->addClientFilter($query, $this->input['clients']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->input['vendors'])) {
|
||||||
|
$query = $this->addVendorFilter($query, $this->input['vendors']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->input['projects'])) {
|
||||||
|
$query = $this->addProjectFilter($query, $this->input['projects']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->input['categories'])) {
|
||||||
|
$query = $this->addCategoryFilter($query, $this->input['categories']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user