Skip to content

Feature: Materials expense tracking (cash drawer delivered separately) #645

Closed

Description

@kamit13

Status

This is the canonical issue for the remaining materials-expense scope from the original request. The cash-drawer subset is already delivered separately in PR #772, and the broad draft PR #680 was closed as superseded/split by scope with contributor history preserved. This issue remains a planning record; no materials-expense implementation is authorized by this update.

Problem or motivation

Cafe operators need to record everyday material expenses such as vegetables, soft drinks, chicken, packaging, or other operating supplies and later understand category totals, paid amounts, and outstanding amounts. The original request also asked for opening/closing cash visibility, but that cash-drawer concern now has a separate delivered foundation.

Current behavior

FloCafe has the formal cash-closure and cash-drawer movement workflow from PR #772, including opening float, Pay In, Pay Out, Safe Drop, close integration, and auditable movement history. It does not yet have a materials-expense catalog, expense entries, payment allocations, category-level paid/due reporting, or expense reporting. The completed product inventory ledger in #280 tracks product quantities, not money spent or supplier balances.

Desired outcome

Define a separate offline materials-expense workflow that can record a categorized expense, amount, date, payee/supplier text where useful, payment method, paid amount, and remaining due state, then report totals by category and period without creating a second cash drawer or turning inventory into accounting.

Proposed technical approach

  • Keep expense records and category/payment reporting in a finance/expenses boundary separate from product/supplies inventory movements and separate from the cash-drawer movement source in PR #772.
  • Reuse the existing offline SQLite, store-timezone, integer-minor-unit, role, and actor-attribution conventions. Use append-only expense/payment records with an auditable correction path rather than editing history silently.
  • Candidate focused v1: material categories, expense entries, bounded payee/supplier text, payment method, paid amount, outstanding amount, and category/period summaries. Define whether a cash-paid entry references a delivered cash movement or is recorded as a linked financial event before implementation; never add a parallel cash-counter total.
  • Keep supplier credit and due balances at the level explicitly accepted for this feature. Invoice matching, recurring vendor accounts, settlement workflows, and accounts payable require a separate product decision because they cross into bookkeeping/ERP.
  • Require migration, authorization, timezone-boundary, malformed-money, correction/void, and report-reconciliation coverage before delivery.

Alternatives considered

  • The broad design from PR #680 combined material categories, expenses, due payments, custom methods, a second cash counter, and monthly reports. It is preserved as contributor history but is not the accepted implementation boundary.
  • Reusing the product ledger in #280 for expenses would mix quantity and money domains and make inventory imply accounting.
  • Adding another opening-float/count ledger would conflict with the delivered cash-drawer source of truth in PR #772.

Area

Reports / Analytics

Acceptance criteria

  • A maintainer-approved materials-expense boundary distinguishes a local expense log from supplier/AP accounting.
  • Authorized staff can record categorized material expenses offline with server-derived timestamps, actor attribution, validated minor-unit amounts, and an auditable correction path.
  • Payment methods and paid/due state are explicit and reportable without duplicating cash-drawer totals.
  • Category and period reports reconcile to the stored expense/payment records and follow the configured store timezone.
  • Existing product, inventory-ledger, order, and cash-closure data remains unchanged through fresh and upgraded database paths.
  • The final implementation has focused migration, authorization, malformed-input, timezone, correction, and reconciliation tests.

Explicit exclusions

No second cash drawer or cash-counter ledger, replacement of PR #772, product/supplies/recipe stock deduction, purchasing automation, purchase orders, invoice matching, unrestricted supplier accounts, multi-location accounting, tax/accounting valuation, or full ERP/accounts-payable behavior without a separate decision.

Dependencies and sequencing

The cash-drawer foundation is complete in PR #772, and the product-ledger baseline is complete in #280 / PR #775. Supplies stock #768, recipe/BOM depletion #769, and receipt tender/change projection #770 are separate canonical scopes and must not be folded into this issue. These links describe boundaries and sequencing only; they do not authorize implementation.

Contributor context

The original request and screenshots remain the source context for this issue. The original contributor branch is kamit13/FloCafe dev. The ported draft PR #680 and its review history remain available for selective reuse and credit; it must not be treated as the approved architecture.

Review request

@itsbkm, please review the split between the delivered cash-drawer foundation and this remaining materials-expense scope, share your thoughts on the narrowest acceptable paid/due boundary, and let us know whether you are willing to take over or collaborate.

Activity

  1. added
    enhancement
    on Sep 5, 2026
  2. carvalab commented on Sep 9, 2026

    @carvalab
    Contributor

    Thanks for building this, @kamit13, and for sharing the branch. I ported your expense tracker and cash counter onto current main as PR #680 and kept your authorship on the commit. Two things changed in the port: the migrations moved to v82 since the old numbers are taken, and I rounded the category due to cents so float residue can never block deletion. I also filled in the missing fr/de translations and marked fil/tr as pending. I left three pieces out of this PR so it stays focused: the WhatsApp offer commit, the orders master-detail redesign, and the best-sellers flag. Happy to help bring those over as follow-ups
    @itsbkm @khaira777

  3. khaira777 commented on Sep 9, 2026

    @khaira777
    Contributor

    Thanks for sharing the use case and the initial dev branch, @kamit13.

    While I understand the daily need to track petty cash leaving the drawer and opening floats, we need to be very intentional about scope creep here. FloCafe is an offline-first POS, not a full accounting or ERP system. Managing ongoing vendor credit ledgers, tracking supplier dues, and managing partial invoice payments across months crosses heavily into bookkeeping software territory.

    In addition, there are significant technical and UX concerns with the current design:

    1. Conceptual Overlap: FloCafe already has a formal register day-close flow (/cash-closures / Z-reports). Introducing a parallel "Cash Counter" page creates confusion around which tool cashiers and managers should actually use to count and balance their drawer.
    2. No Error Correction: Real cafe operations are prone to cashier typos. A strictly append-only model with no void or adjustment mechanism means a single mistyped amount permanently corrupts the drawer balance and vendor dues.
    3. Timezone Pitfalls: Business date handling must strictly follow the configured store timezone rather than UTC defaults.

    We have placed PR #680 on hold. Before merging anything of this size, we need to evaluate whether we should strip this down to a simple, standard POS "Pay In / Pay Out" (Petty Cash) drawer utility rather than taking on a full accounts payable ledger.

  4. khaira777 commented on Sep 18, 2026

    @khaira777
    Contributor

    Status update: the cash-drawer portion of this request landed separately in #772 with focused movement history, opening float, Pay In, Pay Out, Safe Drop, and close integration.

    This issue remains open for the still-undelivered materials-expense scope: categories, paid/due balances, payment methods, and expense reporting. The broader draft #680 was closed as superseded/split by scope, with contributor credit preserved.

  5. added
    area:backend
    on Sep 18, 2026
  6. changed the title [-]Everyday material expnese and cash in counter[/-] [+]Feature: Materials expense tracking (cash drawer delivered separately)[/+] on Sep 18, 2026
  7. added
    area:frontend
    on Sep 18, 2026
  8. khaira777 commented on Sep 18, 2026

    @khaira777
    Contributor

    @itsbkm Please review the split between the delivered cash-drawer foundation in PR #772 and the remaining materials-expense scope here. I would value your thoughts on the narrowest acceptable paid/due boundary without creating a second cash ledger, and whether you are willing to take over or collaborate.

  9. khaira777 commented on Oct 20, 2026

    @khaira777
    Contributor

    Delivered and verified on main across merged PRs #1008 (7ea2f748), #1014 (5392c67c), #1016 (8b79ff16), and #1160 (da0512c5). Offline material expense records, categories, cash drawer payment links, reasoned reversals, BigInt aggregate safety bounds, and the operator workflow page (main/routes/expenses.ts, main/services/expenses.ts, frontend/src/app/(dashboard)/expenses/page.tsx) are fully implemented.

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

Metadata

Metadata

Labels

area:backendarea:frontendenhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions