PDFPipe

Getting paid / Instalment schedule

An instalment schedule where the amounts visibly add to the total

A table of dated payments making up a total, used on staged contracts, payment plans and deposit-plus-balance arrangements.

Why this block is harder than it looks

The reader's question is always the same: do these add up to what I agreed. So the table has to make the addition checkable, which means the amounts have to be in a column with a visible sum, and the sum has to equal the total printed elsewhere on the document. That last part is where these go wrong, because the schedule and the total are usually produced by different code and rounding a percentage split three ways leaves a unit somewhere. Whichever instalment absorbs the rounding has to be a deliberate choice rather than an accident of iteration order.

The decisions that make it work

Reasons rather than a description of the code. Each of these is a choice that has a wrong answer, and the wrong answer is usually the default.

  • Print a total row at the foot of the schedule and make it the same figure as the document total. If they can differ, they will, and the reader will find it.
  • Decide explicitly which instalment absorbs the rounding remainder, and put it on the last one, so the earlier figures are the round ones.
  • Show the basis alongside the amount where the split is proportional. Thirty percent and 1,254.00 together are checkable; either alone is not.
  • Give every instalment an absolute due date, not an offset from an event the reader has to look up.
  • Mark which instalments have been paid, if any have, and keep the marker in its own column rather than striking through the row. Struck-through text at nine point is hard to read and easy to misread.
  • Keep the schedule and its total together with break-inside: avoid, and let the table break internally only if it is long enough to need to.

The fragment

Markup and the CSS it needs, and nothing else. It expects a document that already has a page rule and a base stylesheet, so paste it into one rather than opening it on its own.

html
<table class="instalments">
  <thead>
    <tr><th>Due</th><th>Stage</th><th class="n">Share</th><th class="n">Amount</th></tr>
  </thead>
  <tbody>
    <tr><td>01 Apr 2026</td><td>On signature</td><td class="n">30%</td><td class="n">1,254.00</td></tr>
    <tr><td>01 Jun 2026</td><td>On delivery</td><td class="n">40%</td><td class="n">1,672.00</td></tr>
    <tr><td>01 Aug 2026</td><td>On acceptance</td><td class="n">30%</td><td class="n">1,254.00</td></tr>
  </tbody>
  <tfoot>
    <tr><td colspan="2">Total</td><td class="n">100%</td><td class="n">4,180.00</td></tr>
  </tfoot>
</table>

<style>
  .instalments {
    break-inside: avoid;
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }
  .instalments th, .instalments td { padding: 3pt 4pt; }
  .instalments .n {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .instalments tfoot td {
    border-top: 1pt solid currentColor;
    font-weight: 700;
    padding-top: 5pt;
  }
</style>

What breaks when it is built the obvious way

Computing each instalment from the percentage independently and printing the result. Three thirty-three percent shares of a total that does not divide by three come to one unit less than the total, the foot row disagrees with the document total, and the customer pays the smaller number.

How to prove it survived pagination

Pick a total that does not divide evenly by the number of instalments, render, and add the column by hand. The foot row, the sum of the rows and the document total should all be the same figure. Then confirm the remainder landed on the instalment you chose rather than wherever the loop happened to put it.

Where it sits in a finished document

This page is one block. The document it belongs to has a page rule, a base stylesheet, a header and everything else around it, and repeating all of that here would make thirty pages that say the same thing. The quotation template is a complete file with this block already in it, so take that and change the fragment rather than assembling one from parts. The property doing most of the work here is covered on its own page, with the support caveats that belong there rather than here.

Frequently asked

Will this fragment work on its own?

Not as a whole document. It has no page rule, no margins and no base type, because those belong to the document rather than to the block, and duplicating them in every fragment would mean thirty copies to keep in step. Paste it into a template that already has them.

Why does it look right in a browser and wrong in the PDF?

Because a browser window is one continuous surface and a document is a stack of fixed rectangles. Nothing in a scrolling view exercises a page boundary, so every break rule in the fragment is inert until the content is paginated. Render the real thing with enough content to cross two or three boundaries, then look.

Do I need a special option on the render request for this?

No. Everything on this page is CSS and markup, which is your side of the boundary. What the render has to give you is a real page size with real margins, and after that the layout is decided by the stylesheet.

Other parts of a document

The blocks that sit next to this one, and one from the next group along so you are not sealed inside a single kind of problem.

Paste the fragment into the playground inside a page rule and see what it does at a real page size. That is the only way any of this gets confirmed.