Skip to content

Tax invoice: drawn on the phone, tax total and GST % fixed on web and app - #62

Merged
Axoineo merged 2 commits into
mainfrom
feat/android-native-2
Nov 19, 2026
Merged

Axoineo merged 2 commits into
mainfrom
feat/android-native-2

Conversation

@Axoineo

@Axoineo Axoineo commented Nov 19, 2026

Copy link
Copy Markdown
Owner

For the live website (merging deploys these)

  • Tax total read wrong. In the HSN tax table the amount ended under the template's printed ₹ sign, so a tax of 180.00 showed as ₹80.00. It now sits inside the column. The Rate column also lost its last digit under the column line.
  • GST % was blank on every line: it was read from gst_type, which never holds a rate. It now comes from each line's amounts (the earlier fix from claude/loving-thompson-05d07c, with the owner's choices for 0 and custom rates).

For the Android app (not released yet)

  • The app draws the tax invoice itself on the same template, fonts and positions (PdfBox-Android 2.0.27, Apache 2.0), and saves it to Downloads. The layout is in Dart, tested against the web's own helpers' answers. Not on the API: one invoice takes about 80 ms of CPU, over the Workers free plan's 10 ms.
  • APK size: Bouncy Castle left out, native libraries only for the build's phone type, releases for 64-bit phones only. 16.8 MiB (was heading to 27.4 MiB, over the update service's 25 MiB per file).

Checked

  • npm run check: 350 tests, build, secret scan.
  • App: flutter analyze clean, 398 tests.
  • Android emulator orders 6 of 6: the invoice is drawn on the phone, and its text (client, line, GST 18, amount in words, tax total ₹ 180.00) is read back from the saved PDF.
  • The web invoice code was run in Node on the same order and rendered: it now matches the phone's, both fixed.

Not checked

  • A real phone, and real orders with many lines or very large amounts (a Rate of 1,00,000.00 or more can still touch the Rate column's own ₹ sign; the template's column is narrow).
  • Follow-up: the web Sales orders page and web invoice also load purchase-order lines tied to the sale; the app leaves those out. Worth checking with real data.

🤖 Generated with Claude Code

Axoineo and others added 2 commits November 19, 2026 13:51
The line table and the HSN tax table read the rate out of gst_type, which
only ever holds 'Intra-State', 'Inter-State' or 'Union Territory', so the
GST % column was blank on every taxable line.

The rate now comes from each line's own amounts (invoiceGstRate in
src/lib/gst.js): a standard slab prints that slab, a line with no tax prints
0, a hand-typed tax prints the rate it works out to (for example 17.5), and
tax on a zero taxable amount prints '-'. The owner confirmed the 0 and the
effective-rate choices. The HSN table now groups by HSN and the real rate.

gst.js imports now end in .js so the new Node test can load it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…size fixes

- The Android app draws a sales order's tax invoice itself: the layout is worked
  out in Dart exactly as generateTaxInvoice.js does (checked against the web's
  own helpers' answers), and TaxInvoice.kt draws it onto the same template with
  the same fonts using PdfBox-Android 2.0.27 (Apache 2.0). Saved to Downloads.
  Not on the API: one invoice takes about 80 ms of CPU, over the Workers free
  plan's limit. The template and fonts are copies of public/Temps, kept equal by
  a test.
- Invoice layout, web and app: the HSN table's tax total ended under the
  template's printed ₹ sign, so 180.00 read as ₹80.00; the Rate column lost its
  last digit under the column line.
- Includes the GST % fix (45ac316): the rate comes from each line's amounts.
- APK size: PdfBox without Bouncy Castle, native libraries only for the build's
  --target-platform, and releases for arm64 only: 16.8 MiB, under the update
  service's 25 MiB per file (it would have been 27.4 MiB).
- Emulator scenarios: orders checks hand-offs without a web page in the drawer
  and reads the invoice's text back from the saved PDF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying dikho with  Cloudflare Pages  Cloudflare Pages

Latest commit: f5a6a54
Status: ✅  Deploy successful!
Preview URL: https://486168f4.dikho.pages.dev
Branch Preview URL: https://feat-android-native-2.dikho.pages.dev

View logs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T09:20:56.738493Z f5a6a54 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5a6a54b9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

];
const tens = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'];
String words(int n) {
if (n < 0) return words(-n);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the sign when spelling negative invoice totals

When a credit order has a negative total, this branch spells its absolute value, so the invoice can show -1,000.00 numerically but “One Thousand Rupees Only” in words. Preserve the negative sign or use explicit credit wording so the two representations do not conflict.

AGENTS.md reference: AGENTS.md:L8-L12

Useful? React with 👍 / 👎.

@Axoineo
Axoineo merged commit 9b4f709 into main Nov 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant