Sub topic 10
Building the quote: line items, discounts, tax, total
A quote is the part of the offer that the buyer's finance team will check line by line. If the arithmetic is wrong, the buyer stops trusting the rest of the document. This chapter explains how a quote is assembled, the order of the calculations, and the errors that most often reach a buyer.
This chapter assumes you have finished scoping the solution and chosen a pricing model. It also assumes you know the cost and minimum margin for the deal, and that you are comfortable with percentages. The Python examples use only the standard library.
What a quote contains
A quote is a priced list of what the buyer will receive. Each row is a line item. Every line item needs the following:
- A description that matches the scope section of the proposal, using the same names.
- A quantity and a unit of measure, such as users, hours, or months.
- A unit price.
- An amount, which is quantity multiplied by unit price.
- A tax flag, because not every line is taxed the same way.
Below the lines, the quote shows the subtotal, discounts, tax, and total. The quote should also show the currency, the quote number, the issue date, and the validity date. The validity date is covered in the chapter on terms.
If a line item does not appear in the proposal's scope, either the scope or the quote is wrong. Fix this before the document leaves your company.
The order of calculation
The order matters because discounts and tax are both percentages. A percentage applied to a different base gives a different number.
The rules are:
- Calculate each line amount first.
- Add the line amounts to get the subtotal.
- Subtract discounts to get the net price.
- Calculate tax on the net price, never on the pre-discount subtotal.
- Add tax to the net price to get the total.
The margin check uses the net price before tax. Tax is collected for the government and is not your revenue, so it must stay out of the margin calculation.
A first calculation with Decimal
Use exact decimal arithmetic for money. Binary floating-point numbers cannot represent values such as 0.1 exactly, and the small errors show up as totals that are off by a cent. The example below uses the license and onboarding lines from a typical software deal.
from decimal import Decimal, ROUND_HALF_UP
def money(value):
return value.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
line_items = [
("Platform license (per user, annual)", 50, Decimal("120.00")),
("Onboarding package", 1, Decimal("2500.00")),
]
discount_rate = Decimal("0.10")
tax_rate = Decimal("0.08")
subtotal = sum(Decimal(qty) * unit_price for _, qty, unit_price in line_items)
discount = money(subtotal * discount_rate)
net = subtotal - discount
tax = money(net * tax_rate)
total = net + tax
print(f"Subtotal: {money(subtotal)}")
print(f"Discount: -{discount}")
print(f"Net: {money(net)}")
print(f"Tax: {tax}")
print(f"Total: {money(total)}")The subtotal is 8500.00, the discount is 850.00, the net price is 7650.00, the tax is 612.00, and the total is 8262.00.
Rounding rules
money rounds half up to two decimal places, which is how most buyers round by hand. Two rules prevent mismatches:
- Create Decimal values from strings, as in
Decimal("0.10"). WritingDecimal(0.1)copies the floating-point error into the Decimal. - Round at the line level, then add the rounded values. If you add unrounded values and round only the total, the printed lines may not add up to the printed total. A buyer who checks with a calculator will notice.
State your rounding rule in the terms if amounts involve fractions of a cent, for example per-message pricing.
Discounts in detail
Discounts come in several forms, and each one changes the quote differently.
| Discount type | How it works | Where to watch |
|---|---|---|
| Percentage on the whole quote | One rate applied to the subtotal | It also discounts items that carry little margin, such as pass-through costs |
| Percentage on selected lines | Different rates per line | The quote must show which lines are discounted |
| Fixed amount | A set sum is subtracted | It must be allocated across lines if tax applies to some lines only |
| Volume tier | The unit price falls above a quantity threshold | State whether the tier applies to all units or only the units above the threshold |
| Multi-year or prepay | A lower price for a longer commitment | Tie it to the commitment in the terms |
Show a discount as its own visible line or column and not as a silently lowered unit price. Then the buyer sees the list price, your concession, and the net. This also makes later negotiation easier, because the discount is a number you can trade for something, such as a longer term.
A quote with per-line discounts and mixed tax
Real quotes often discount some lines and not others, and some lines are not taxed. The next program models each line as an object and computes tax only on taxable lines. The tax treatment below is an assumption for the example. The correct treatment depends on the jurisdiction and the product, so confirm it with your finance team.
from dataclasses import dataclass
from decimal import Decimal, ROUND_HALF_UP
def money(value):
return value.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
@dataclass
class Line:
description: str
qty: Decimal
unit_price: Decimal
discount_rate: Decimal = Decimal("0")
taxable: bool = True
@property
def amount(self):
return money(self.qty * self.unit_price)
@property
def discount(self):
return money(self.amount * self.discount_rate)
@property
def net(self):
return self.amount - self.discount
TAX_RATE = Decimal("0.08")
ZERO = Decimal("0.00")
lines = [
Line("Platform license (per user, annual)", Decimal("50"), Decimal("120.00"), Decimal("0.10")),
Line("Onboarding package", Decimal("1"), Decimal("2500.00"), Decimal("0.10")),
Line("Travel expenses (at cost)", Decimal("1"), Decimal("400.00"), taxable=False),
]
subtotal = sum((line.amount for line in lines), ZERO)
discount = sum((line.discount for line in lines), ZERO)
net = subtotal - discount
taxable_net = sum((line.net for line in lines if line.taxable), ZERO)
tax = money(taxable_net * TAX_RATE)
total = net + tax
for line in lines:
print(f"{line.description:<38}{line.net:>10}")
print(f"{'Subtotal':<38}{subtotal:>10}")
print(f"{'Discounts':<38}{-discount:>10}")
print(f"{'Net':<38}{net:>10}")
print(f"{'Tax (8% on taxable lines)':<38}{tax:>10}")
print(f"{'Total':<38}{total:>10}")The subtotal is 8900.00 and the discounts are 850.00. The net is 8050.00, and tax is 8% of the taxable net of 7650.00, which is 612.00. The total is 8662.00.
Check the margin before you send
After the net price is known, compare it with delivery cost, as described in the earlier chapter on cost and discount limits. This check uses the net price before tax.
from decimal import Decimal
def gross_margin(price, cost):
return (price - cost) / price
net_price = Decimal("7650.00")
delivery_cost = Decimal("5100.00")
minimum_margin = Decimal("0.30")
margin = gross_margin(net_price, delivery_cost)
print(f"Gross margin: {margin:.1%}")
print("Approved" if margin >= minimum_margin else "Needs review")The margin is 33.3%, above the 30% floor, so the quote passes. Run this check every time a discount changes. A quote that passed at 10% off may fail at 15% off.
Common errors
| Error | Effect | Prevention |
|---|---|---|
| Tax calculated on the subtotal instead of the net | Tax is too high by the tax on the discount | Follow the fixed order of calculation |
| Floating-point math | Totals off by a cent | Use Decimal built from strings |
| Rounding only the total | Lines do not add up | Round each line, then sum |
| Line names that differ from the scope | The buyer asks what they are paying for | Copy names from the scope section |
| Missing currency or tax assumption | Disputes at invoicing | Print both on the quote |
| Margin checked on the tax-inclusive total | Margin looks higher than it is | Check on net price before tax |
| Unit price edited without updating the amount | Subtotal and lines disagree | Compute amounts in one place |
Compute amounts in one place, either a spreadsheet or a script. Copying numbers by hand between the quote, the proposal's investment section, and the executive summary is how three documents end up with three different totals.
Exercise
A quote has two taxable lines: 20 users at 150.00 each, and a setup fee of 1000.00. The buyer gets a 5% discount on the whole subtotal, and tax is 10%. Delivery cost is 2850.00 and the minimum margin is 30%. What are the net price, tax, and total, and does the quote pass the margin check?
Show answer
The subtotal is 20 x 150.00 + 1000.00 = 4000.00. The discount is 5% of 4000.00 = 200.00, so the net price is 3800.00. Tax is 10% of 3800.00 = 380.00, so the total is 4180.00. The margin is (3800.00 - 2850.00) / 3800.00 = 25.0%, which is below the 30% floor, so the quote needs review. It would pass only with a smaller discount or a lower delivery cost.