return: round(calc($sub * $tax-rate));

SHOWCASE 01 · ONE SOURCE · WEB APP + ACID DB + GMAIL EMAIL + JSON API

Invoice & Receipt Studio

$status-msg

Compiled from the exact same hash-pinned <define> used for Gmail/Outlook email export.

Issued Ledger ($invoice-count)

✓ $inv
body:load { $db-ready: db-create($invoices, "invoices", "client, email, item, subtotal, tax, total"); $last-id: db-insert($invoices, "invoices", "Acme Studio", "billing@acme.dev", "HTML+ Architecture Audit", 1200, 96, 1296); $invoice-count: db-count($invoices, "invoices"); } #invoice-form:submit { @if (valid-form("#invoice-form")) { $subtotal: $amount; $tax: call(calc-tax, $subtotal); $total: calc($subtotal + $tax); $last-id: db-insert($invoices, "invoices", trim($client), lower(trim($email)), trim($item), $subtotal, $tax, $total); $invoice-count: db-count($invoices, "invoices"); $ledger: add(concat("INV-100", $last-id, " · ", trim($client), " — $", $total)); $status-msg: concat("Issued INV-100", $last-id, " for ", trim($client), " (Total: $", $total, ")"); } @else { $status-msg: form-error("#invoice-form"); } } #invoices-api:request { reply-json: { count: $invoice-count, last_client: $client, subtotal: $subtotal, tax: $tax, total: $total }; } set: $client = "Nova Labs"; set: $email = "invalid-email"; set: $item = "Consulting"; set: $amount = 500; trigger: #invoice-form:submit; assert-invalid: "#invoice-form"; assert: $invoice-count == 1; set: $client = "Nova Labs"; set: $email = "finance@novalabs.io"; set: $item = "Zero-JS Migration"; set: $amount = 2000; trigger: #invoice-form:submit; assert-valid: "#invoice-form"; assert: $tax == 160; assert: $total == 2160; assert: $invoice-count == 2; assert-contains: #studio-status "Issued INV-1002 for Nova Labs (Total: $2160)";