Order of calculation
Subtotal = quantity × unit price. Discount is taken off the subtotal. Tax is calculated on the discounted amount, then added to reach the total.
Saudi invoices commonly add 15% VAT. A frequent Pakistan sales-tax rate on taxable supplies is 18%. US sales tax depends on the state and is often added only if you are registered to collect it — use 0% when tax is not on the invoice, or type the local rate. This is one line; add several line totals yourself for a full bill.