Skip to content
Devix Open Source

An invoice, rounded two ways

Add some lines and watch the tax change depending on whether it is worked out per line or on the total — the difference that fails audits.

Live preview
<div class="demo demo--wide">
  <div class="demo-row">
    <div class="demo-seg" id="country" role="group" aria-label="Country">
      <button type="button" data-country="AE" aria-pressed="true">UAE 5%</button>
      <button type="button" data-country="SA">Saudi 15%</button>
      <button type="button" data-country="PK">Pakistan 18%</button>
      <button type="button" data-country="BH">Bahrain 10%</button>
    </div>
    <button class="demo-btn demo-btn--ghost" id="add">Add a line</button>
    <button class="demo-btn demo-btn--ghost" id="many">Ten lines of 0.30</button>
  </div>

  <table class="lines">
    <thead><tr><th>Amount</th><th>Qty</th><th>Treatment</th><th class="num">Net</th><th class="num">Tax</th></tr></thead>
    <tbody id="body"></tbody>
  </table>

  <div class="totals">
    <div class="total" id="perLine"><span>Taxed per line</span></div>
    <div class="total" id="perTotal"><span>Taxed on the total</span></div>
  </div>
  <p class="demo-hint" id="note"></p>
</div>