Total taxes for each tax_rate not displayed correctly at the bottom when the amount for a line item is zero

On our invoices we have some lines with a tax rate of 20%, which can also have an amount of 0€ in some months.
Whereas other lines on the same invoice can have a tax rate of 20% but an amount > 0.

This leads to the problem that the totals on the bottom of the invoice are not displayed correclty.

We are using the Calculate Taxes option where we have a standard tax_rate of 20% and a reduced tax_rate of 10%. We also defined a custom tax_rate of 13% (where I have to choose “override tax” on the create invoice page to use it).

When I create such an invoice in the react web app it only says e.g. “20% 123,00€” at the bottom, instead of “USt 20% 123,00€”. So the tax_name is missing.

When I create the same invoice over the API the 20% tax line at the bottom is missing completely.

The API call for this is (with the proper invironment variables):

curl -X POST $APIURL'invoices' \
     -H $TOKENHEADER \
	 -H 'X-Requested-With: XMLHttpRequest' \
	 -H 'Content-Type:application/json' \
	 -d '{"client_id": "KGRb41dBLZ",
          "is_amount_discount": false,
		  "design_id": "kzPdy7aQro",
		  "terms": "terms & conditions", 
		  "footer": "a nice footer", 
		  "public_notes": "some notes", 
          "line_items": [{
			"product_key": "Total sold ticket amount with reduced tax rate of 13%",
			"cost": -2786.68,
			"quantity": 1,
			"tax_name1": "USt",
			"tax_rate1": 13,
			"tax_id": 7
		}, {
			"product_key": "Tax free line item with zero amount this month",
			"cost": 0,
			"quantity": 1,
			"tax_id": 5
		}, {
			"product_key": "Commission",
			"cost": 377.87,
			"quantity": 1,
			"tax_id": 2
		}, {
			"product_key": "Disagio 1,5% (0 bei Negativbetrag)",
			"cost": 0,
			"quantity": 1,
			"tax_id": 2
		} ]
	}'

On the other hand, when I create an invoice with only positive amounts for each line_item then all the taxes are displayed correclty at the bottom.

I think maybe when I pick e.g. “physical goods” or “services” as a tax, but then use an amount of zero for the item, the tax_name column is empty. This somehow messes up the display of the total taxes at the bottom.

When I query the broken invoice over the API these line_items look something like this:

    {"product_key": "Disagio",
      "cost": 0,
      "quantity": 1,
      "tax_id": "2",
      "type_id": "1",
      "product_cost": 0,
      "notes": "",
      "discount": 0,
      "is_amount_discount": false,
      "tax_name1": "",
      "tax_rate1": 20,
      "tax_name2": "",
      "tax_rate2": 0,
      "tax_name3": "",
      "tax_rate3": 0,
      "sort_id": "0",
      "line_total": 0,
      "gross_line_total": 0,
      "tax_amount": 0,
      "date": "",
      "custom_value1": "",
      "custom_value2": "",
      "custom_value3": "",
      "custom_value4": "",
      "task_id": "",
      "expense_id": "",
      "unit_code": "C62"}

Hi,

If you think there’s a bug feel free to create an issue on GitHub.

Created an issue on github:

1 Like