From eb44584fe8f47bb0372aef5c531b0a5c1e972695 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 29 Jun 2023 13:57:16 +1000 Subject: [PATCH] Fixes for tax calculations --- app/DataMapper/Tax/US/Rule.php | 3 +++ app/Filters/ExpenseFilters.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/DataMapper/Tax/US/Rule.php b/app/DataMapper/Tax/US/Rule.php index 59cd75943ca5..497585a5bef5 100644 --- a/app/DataMapper/Tax/US/Rule.php +++ b/app/DataMapper/Tax/US/Rule.php @@ -117,6 +117,9 @@ class Rule extends BaseRule implements RuleInterface if(in_array($this->tax_data?->txbService,['Y','L'])) { $this->default($item); } + else { + $this->taxExempt($item); + } return $this; } diff --git a/app/Filters/ExpenseFilters.php b/app/Filters/ExpenseFilters.php index 922db6c8fd0b..6260c1b04b3c 100644 --- a/app/Filters/ExpenseFilters.php +++ b/app/Filters/ExpenseFilters.php @@ -120,10 +120,10 @@ class ExpenseFilters extends QueryFilters $search_key = $split[0] == 'client' ? 'client_id' : 'project_id'; - return $this->builder->whereNotNull('invoice_id') - ->whereHas('invoice', function ($query) use ($search_key, $split){ - $query->where($search_key, $this->decodePrimaryKey($split[1])); - }); + return $this->builder->whereHas('invoice', function ($query) use ($search_key, $split){ + $query->where($search_key, $this->decodePrimaryKey($split[1])) + ->whereIn('status_id', [\App\Models\Invoice::STATUS_DRAFT, \App\Models\Invoice::STATUS_SENT, \App\Models\Invoice::STATUS_PARTIAL]); + }); } return $this->builder;