The total of an invoice is calculated by applying discounts, rebates and shipping costs to the subtotal of the invoice.