Skip to content

The bill agrees with itself, and stops talking to the restaurant - #746

Merged
sridharkalaibala merged 1 commit into
developfrom
fix/the-bill-adds-up
Sep 15, 2026
Merged

sridharkalaibala merged 1 commit into
developfrom
fix/the-bill-adds-up

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

The bill that did not add up

Paneer Starter        2 x 240        480.00
...
Subtotal                             400.00

Two faults, hiding each other. The line printed the tax-inclusive amount
while the subtotal below it added the tax-exclusive ones, and the unit
price was never printed at all. So the only number a customer could check
against the menu was the one with tax folded into it, and the two halves of
the document disagreed by exactly the tax.

Now:

ITEM                             RATE QTY AMOUNT
------------------------------------------------
Paneer Starter                 200.00   2 400.00
Butter Naan                     45.00   3 135.00
------------------------------------------------
Subtotal                                  535.00
CGST 2.5%                                  13.38
SGST 2.5%                                  13.38
================================================
TOTAL                                     561.75

Rate times quantity is the amount, the amounts add to the subtotal, and the
tax is added once underneath where it can be seen being added.

The RATE column appears only when the payload carries rates, so a counter
receipt is laid out exactly as it was - reserving five characters of a
48-character line to head a column of blanks would be a regression paid for by
every shop that is not a restaurant.

Three things the bill was saying that are not its business

was now
UNPAID under the heading on every pre-payment print gone
From: Captain app on every bill off unless switched on
Table, order type, covers, item count on every bill off unless switched on

A document presented at a table asking for money is unpaid by definition, so
the stamp said nothing the heading did not, and a customer's copy stamped
UNPAID reads as an accusation rather than a request. It was removed from
both print paths - the browser view and the main process - because one
without the other means the shop sees it come back depending on who pressed
print.

The rest is the restaurant talking to itself on the customer's copy. The
kitchen ticket carries every one of them and is untouched
, which is the whole
argument for taking them off the bill; there is a test that fails if the ticket
ever loses them.

None of it is deleted

A hotel restaurant's tax invoice prints table, session, steward and covers, so
each row is a switch rather than a decision taken for every shop at once:

bill_print_source      bill_print_table       bill_print_dine_type
bill_print_covers      bill_print_steward     bill_print_total_qty

Absent means OFF. That direction is the point: 90 shops are printing today
and a default of on would put new rows on every one of their bills the morning
this deploys. A shop that wants the hotel bill turns them on and gets it.

Read as the settings form stores them, a string, so a saved 'false' is a real
value - reading it as a boolean is how a switched-off setting silently stays
on, which this codebase has been bitten by before.

Tests

tests/the-bill-adds-up.test.js, 13 cases, built on the sale off the
photographed bill. The arithmetic, the paper, each thing that no longer prints,
each switch that brings it back, a switch turned on for something the sale does
not have, the kitchen ticket keeping all of it, and no line wider than the roll.

The suites: POS 2413 pass / 0 fail, API 10619 pass / 0 fail.

Four existing tests pinned the old defaults and now pin the new ones, each with
the reversal written down rather than quietly edited.

A printed bill read "Paneer Starter  2 x 240  480.00" above a subtotal of
400.00. Two faults were hiding each other: the line carried the tax-inclusive
amount while the subtotal added the exclusive ones, and the unit price was
never printed at all, so the only number a customer could check against the
menu had tax folded into it and the two halves of the document disagreed by
exactly the tax.

The line is now the pre-tax line, with a RATE column beside the quantity:
200.00 x 2 = 400.00, and the tax added once underneath where it can be seen
being added. The column appears only when the payload carries rates, so a
counter receipt is laid out exactly as before.

Three things the bill said that are not its business are now off by default:

  UNPAID   a document presented at a table asking for money is unpaid by
           definition. Removed from both print paths - the browser view and
           the main process - or a shop would see it come back depending on
           who pressed print.
  From:    which device sent the order settles a dispute for the shop. The
           kitchen ticket still prints it every time.
  Table, order type, covers, item count
           all of it is the restaurant talking to itself on the customer's
           copy, and the kitchen ticket carries every one.

None of it is deleted. A hotel restaurant's tax invoice prints table, session,
steward and covers, so each is a switch: bill_print_source, bill_print_table,
bill_print_dine_type, bill_print_covers, bill_print_steward and
bill_print_total_qty. Absent means OFF, which is the direction that matters
with 90 shops printing today: a default of on would put new rows on every one
of their bills the morning this deploys.
@sridharkalaibala
sridharkalaibala merged commit 4f29579 into develop Sep 15, 2026
9 checks passed
@github-actions github-actions Bot added the ready for QA Merged to develop and live on develop.posnic.io - anyone can test it label Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Merged to develop. Anyone can test this - you do not need write access.

Try it at https://develop.posnic.io, or run it yourself:

git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev   # then http://localhost:3000

When you have tested it, say what you did and what happened, and set
QA passed or QA failed. If you cannot set labels, just comment -
a maintainer will.

Reporting that something is broken is as useful as fixing it. It is
better found here than by a shopkeeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for QA Merged to develop and live on develop.posnic.io - anyone can test it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant