When editing an order that is In Preparation to modify the price of the products in the order, or to add new products with custom prices, the total values (without taxes) are calculated erroneously which leads to the invoice having inconsistencies. In this example, the first row should be $34.00 (0.85*40), the second row should be $56.00 (1.12*50). Apparently, the error occurs because at the time of order edition the totals are calculated with taxes included first, and then the total without taxes is calculated based on that value.
The third row ($28.14) is ok because the price was not changed.
This invoice no longer works because the rest of the calculations carry these errors.
The only way I have found to overcome this problem is to cancel the order and recreate a new one by entering the new prices before placing the order.