diff --git a/app/Http/Controllers/Common/Items.php b/app/Http/Controllers/Common/Items.php index beaa3c34c..b270481a6 100644 --- a/app/Http/Controllers/Common/Items.php +++ b/app/Http/Controllers/Common/Items.php @@ -334,14 +334,14 @@ class Items extends Controller } if (!empty($item['tax_id'])) { - $includes = $compounds = $taxes = []; + $inclusives = $compounds = $taxes = []; foreach ($item['tax_id'] as $tax_id) { $tax = Tax::find($tax_id); switch ($tax->type) { - case 'included': - $includes[] = $tax; + case 'inclusive': + $inclusives[] = $tax; break; case 'compound': $compounds[] = $tax; @@ -357,7 +357,7 @@ class Items extends Controller } } - if ($includes) { + if ($inclusives) { if ($discount) { $item_tax_total = 0; @@ -369,20 +369,20 @@ class Items extends Controller } } - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_sub_total + $item_tax_total; - $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $include->rate)) / 100); + $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $inclusive->rate)) / 100); $item_sub_total = $item_sub_and_tax_total - $item_tax_total; $item_discount_total = $item_sub_total - ($item_sub_total * ($discount / 100)); } } else { - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_discount_total + $item_tax_total; - $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $include->rate)) / 100); + $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $inclusive->rate)) / 100); $item_sub_total = $item_sub_and_tax_total - $item_tax_total; diff --git a/app/Http/Controllers/Settings/Taxes.php b/app/Http/Controllers/Settings/Taxes.php index 9998ecd2f..c56a307a6 100644 --- a/app/Http/Controllers/Settings/Taxes.php +++ b/app/Http/Controllers/Settings/Taxes.php @@ -40,7 +40,7 @@ class Taxes extends Controller { $types = [ 'normal' => trans('taxes.normal'), - 'included' => trans('taxes.included'), + 'inclusive' => trans('taxes.inclusive'), 'compound' => trans('taxes.compound'), ]; @@ -76,7 +76,7 @@ class Taxes extends Controller { $types = [ 'normal' => trans('taxes.normal'), - 'included' => trans('taxes.included'), + 'inclusive' => trans('taxes.inclusive'), 'compound' => trans('taxes.compound'), ]; diff --git a/app/Jobs/Expense/CreateBillItem.php b/app/Jobs/Expense/CreateBillItem.php index 662d87d03..1cbf755f3 100644 --- a/app/Jobs/Expense/CreateBillItem.php +++ b/app/Jobs/Expense/CreateBillItem.php @@ -71,14 +71,14 @@ class CreateBillItem $item_tax_total = 0; if (!empty($this->data['tax_id'])) { - $includes = $compounds = $taxes = []; + $inclusives = $compounds = $taxes = []; foreach ((array) $this->data['tax_id'] as $tax_id) { $tax = Tax::find($tax_id); switch ($tax->type) { case 'included': - $includes[] = $tax; + $inclusives[] = $tax; break; case 'compound': $compounds[] = $tax; @@ -102,7 +102,7 @@ class CreateBillItem } } - if ($includes) { + if ($inclusives) { if ($this->discount) { $item_tax_total = 0; @@ -114,34 +114,34 @@ class CreateBillItem } } - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_amount + $item_tax_total; - $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $include->rate)) / 100); + $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $inclusive->rate)) / 100); $item_sub_total = $item_sub_and_tax_total - $item_tax_total; $item_taxes[] = [ 'company_id' => $this->bill->company_id, 'bill_id' => $this->bill->id, - 'tax_id' => $include->id, - 'name' => $include->name, + 'tax_id' => $inclusive->id, + 'name' => $inclusive->name, 'amount' => $tax_amount, ]; $item_discount_amount = $item_sub_total - ($item_sub_total * ($this->discount / 100)); } } else { - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_discount_amount + $item_tax_total; - $item_tax_total = $tax_amount = $item_sub_and_tax_total - ($item_sub_and_tax_total / (1 + ($include->rate / 100))); + $item_tax_total = $tax_amount = $item_sub_and_tax_total - ($item_sub_and_tax_total / (1 + ($inclusive->rate / 100))); $item_taxes[] = [ 'company_id' => $this->bill->company_id, 'bill_id' => $this->bill->id, - 'tax_id' => $include->id, - 'name' => $include->name, + 'tax_id' => $inclusive->id, + 'name' => $inclusive->name, 'amount' => $tax_amount, ]; @@ -183,7 +183,7 @@ class CreateBillItem if (!empty($this->data['tax_id'])) { // set item_taxes for $bill_item->item_taxes = $item_taxes; - $bill_item->includes = $includes; + $bill_item->inclusive = $inclusives; $bill_item->compounds = $compounds; } diff --git a/app/Jobs/Income/CreateInvoiceItem.php b/app/Jobs/Income/CreateInvoiceItem.php index 03f99f513..1e01167d6 100644 --- a/app/Jobs/Income/CreateInvoiceItem.php +++ b/app/Jobs/Income/CreateInvoiceItem.php @@ -98,14 +98,14 @@ class CreateInvoiceItem $item_tax_total = 0; if (!empty($this->data['tax_id'])) { - $includes = $compounds = $taxes = []; + $inclusives = $compounds = $taxes = []; foreach ((array) $this->data['tax_id'] as $tax_id) { $tax = Tax::find($tax_id); switch ($tax->type) { - case 'included': - $includes[] = $tax; + case 'inclusive': + $inclusives[] = $tax; break; case 'compound': $compounds[] = $tax; @@ -129,7 +129,7 @@ class CreateInvoiceItem } } - if ($includes) { + if ($inclusives) { if ($this->discount) { $item_tax_total = 0; @@ -141,34 +141,34 @@ class CreateInvoiceItem } } - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_amount + $item_tax_total; - $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $include->rate)) / 100); + $item_tax_total = $item_sub_and_tax_total - (($item_sub_and_tax_total * (100 - $inclusive->rate)) / 100); $item_sub_total = $item_sub_and_tax_total - $item_tax_total; $item_taxes[] = [ 'company_id' => $this->invoice->company_id, 'invoice_id' => $this->invoice->id, - 'tax_id' => $include->id, - 'name' => $include->name, + 'tax_id' => $inclusive->id, + 'name' => $inclusive->name, 'amount' => $tax_amount, ]; $item_discount_amount = $item_sub_total - ($item_sub_total * ($this->discount / 100)); } } else { - foreach ($includes as $include) { + foreach ($inclusives as $inclusive) { $item_sub_and_tax_total = $item_discount_amount + $item_tax_total; - $item_tax_total = $tax_amount = $item_sub_and_tax_total - ($item_sub_and_tax_total / (1 + ($include->rate / 100))); + $item_tax_total = $tax_amount = $item_sub_and_tax_total - ($item_sub_and_tax_total / (1 + ($inclusive->rate / 100))); $item_taxes[] = [ 'company_id' => $this->invoice->company_id, 'invoice_id' => $this->invoice->id, - 'tax_id' => $include->id, - 'name' => $include->name, + 'tax_id' => $inclusive->id, + 'name' => $inclusive->name, 'amount' => $tax_amount, ]; @@ -210,7 +210,7 @@ class CreateInvoiceItem if (!empty($this->data['tax_id'])) { // set item_taxes for $invoice_item->item_taxes = $item_taxes; - $invoice_item->includes = $includes; + $invoice_item->inclusives = $inclusives; $invoice_item->compounds = $compounds; } diff --git a/resources/lang/en-GB/taxes.php b/resources/lang/en-GB/taxes.php index d5aea8a56..3e689c47c 100644 --- a/resources/lang/en-GB/taxes.php +++ b/resources/lang/en-GB/taxes.php @@ -5,7 +5,7 @@ return [ 'rate' => 'Rate', 'rate_percent' => 'Rate (%)', 'normal' => 'Normal', - 'included' => 'Included in Price', + 'inclusive' => 'Inclusive', 'compound' => 'Compound', ]; diff --git a/resources/views/settings/taxes/edit.blade.php b/resources/views/settings/taxes/edit.blade.php index 0277d4c90..68221d122 100644 --- a/resources/views/settings/taxes/edit.blade.php +++ b/resources/views/settings/taxes/edit.blade.php @@ -17,7 +17,7 @@ {{ Form::textGroup('rate', trans('taxes.rate'), 'percent') }} - {{ Form::selectGroup('type', trans('general.type'), 'bars', $types, null, []) }} + {{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, null, []) }} {{ Form::radioGroup('enabled', trans('general.enabled')) }}