Calculates the total of an invoice with discount