From 81940efdef4912c3af443ef63c26462006028126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sun, 30 May 2021 17:22:48 +0300 Subject: [PATCH] inclusive tax calculate fixed.. --- app/Jobs/Document/CreateDocumentItem.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Jobs/Document/CreateDocumentItem.php b/app/Jobs/Document/CreateDocumentItem.php index 2ff857fe5..07f1565fa 100644 --- a/app/Jobs/Document/CreateDocumentItem.php +++ b/app/Jobs/Document/CreateDocumentItem.php @@ -77,6 +77,9 @@ class CreateDocumentItem extends Job case 'fixed': $tax_amount = $tax->rate * (double) $this->request['quantity']; + // @todo tax calculate check here + //$tax_amount = round(abs($tax_amount), $precision); + $item_taxes[] = [ 'company_id' => $this->document->company_id, 'type' => $this->document->type, @@ -92,6 +95,9 @@ class CreateDocumentItem extends Job case 'withholding': $tax_amount = 0 - $item_discounted_amount * ($tax->rate / 100); + // @todo tax calculate check here + //$tax_amount = round(abs($tax_amount), $precision); + $item_taxes[] = [ 'company_id' => $this->document->company_id, 'type' => $this->document->type, @@ -107,6 +113,9 @@ class CreateDocumentItem extends Job default: $tax_amount = $item_discounted_amount * ($tax->rate / 100); + // @todo tax calculate check here + //$tax_amount = round(abs($tax_amount), $precision); + $item_taxes[] = [ 'company_id' => $this->document->company_id, 'type' => $this->document->type, @@ -130,6 +139,8 @@ class CreateDocumentItem extends Job foreach ($inclusives as $inclusive) { $tax_amount = $item_base_rate * ($inclusive->rate / 100); + $tax_amount = round(abs($tax_amount), $precision); + $item_taxes[] = [ 'company_id' => $this->document->company_id, 'type' => $this->document->type, @@ -149,6 +160,8 @@ class CreateDocumentItem extends Job foreach ($compounds as $compound) { $tax_amount = (($item_discounted_amount + $item_tax_total) / 100) * $compound->rate; + $tax_amount = round(abs($tax_amount), $precision); + $item_taxes[] = [ 'company_id' => $this->document->company_id, 'type' => $this->document->type,