allow to hide tax rows in invoice templates if vat rate is zero (#3484)

This commit is contained in:
Alexander Pankow
2022-09-04 11:43:38 +02:00
committed by GitHub
parent a04b72e866
commit 1d1f5835da
4 changed files with 21 additions and 1 deletions

View File

@@ -77,6 +77,10 @@ final class InvoiceModel
* @var string
*/
private $invoiceNumber;
/**
* @var bool
*/
private $hideZeroTax = false;
/**
* @internal use InvoiceModelFactory
@@ -316,4 +320,14 @@ final class InvoiceModel
return $values;
}
public function isHideZeroTax(): bool
{
return $this->hideZeroTax;
}
public function setHideZeroTax(bool $hideZeroTax): void
{
$this->hideZeroTax = $hideZeroTax;
}
}

View File

@@ -130,6 +130,7 @@ mpdf-->
{% endfor %}
</tbody>
<tfoot>
{% if model.calculator.tax > 0 or not model.isHideZeroTax() %}
<tr>
<td colspan="4" class="text-right">
{{ 'invoice.subtotal'|trans }}
@@ -142,6 +143,7 @@ mpdf-->
</td>
<td class="last text-right">{{ model.calculator.tax|money(currency) }}</td>
</tr>
{% endif %}
<tr>
<td colspan="4" class="text-right text-nowrap">
<strong>{{ 'invoice.total'|trans }}</strong>

View File

@@ -98,6 +98,7 @@
{% endfor %}
</tbody>
<tfoot>
{% if model.calculator.tax > 0 or not model.isHideZeroTax() %}
<tr>
<td colspan="4" class="text-right">
{{ 'invoice.subtotal'|trans }}
@@ -110,6 +111,7 @@
</td>
<td class="text-right">{{ model.calculator.tax|money(currency) }}</td>
</tr>
{% endif %}
<tr>
<td colspan="4" class="text-right text-nowrap">
<strong>{{ 'invoice.total'|trans }}</strong>
@@ -142,4 +144,4 @@
<strong>{{ 'label.contact'|trans }}</strong>: {{ model.template.contact|nl2str(' &ndash; ') }}
</p>
</footer>
{% endblock %}
{% endblock %}

View File

@@ -140,6 +140,7 @@ mpdf-->
{% endfor %}
</tbody>
<tfoot>
{% if model.calculator.tax > 0 or not model.isHideZeroTax() %}
<tr>
<td colspan="3" class="text-right">
{{ 'invoice.subtotal'|trans }}
@@ -152,6 +153,7 @@ mpdf-->
</td>
<td class="last text-right">{{ model.calculator.tax|money(currency) }}</td>
</tr>
{% endif %}
<tr>
<td colspan="3" class="text-right text-nowrap">
<strong>{{ 'invoice.total'|trans }}</strong>