From c9bb67cafe9e0fff8a6a2ddeb2f2db48a3eb748e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 13 Aug 2021 07:29:36 +1000 Subject: [PATCH] Fixes for net subtotal when using exclusive taxes --- app/Utils/HtmlEngine.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 583cf4b8147a..70dda9a6edea 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -168,7 +168,12 @@ class HtmlEngine $data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; $data['$discount'] = &$data['$invoice.discount']; $data['$subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; - $data['$net_subtotal'] = ['value' => Number::formatMoney(($this->entity_calc->getSubTotal() - $this->entity->total_taxes), $this->client) ?: ' ', 'label' => ctrans('texts.net_subtotal')]; + + if($this->entity->uses_inclusive_taxes) + $data['$net_subtotal'] = ['value' => Number::formatMoney(($this->entity_calc->getSubTotal() - $this->entity->total_taxes), $this->client) ?: ' ', 'label' => ctrans('texts.net_subtotal')]; + else + $data['$net_subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.net_subtotal')]; + $data['$invoice.subtotal'] = &$data['$subtotal']; if ($this->entity->partial > 0) {