Expenses & Purchases

Overview

This feature tracks operational money leaving the business. It categorizes expenses into either "Direct Restocking Costs" (COGS) or "Overhead Costs" (Electricity, Rent, Employee Salaries).

Why it exists

A point-of-sale only tracks Revenue. To determine true net profitability, Bambu needs to know what it costs to keep the lights on and stock the shelves.

User flow

  1. User logs into app/dashboard/expenses.
  2. They click "Log Expense".
  3. They input the Amount, Date, Category (e.g., Overhead), and an optional Note.
  4. The expense is added to the general ledger.

UI walkthrough

![Expenses List Data Table](../../assets/images/expenses/list-view.png) ![Expense Logging Form](../../assets/images/expenses/log-form.png)

Backend logic

Expenses are often automatically generated by the system. If a user clicks Restock on a product (detailed in the Workflow), Bambu automatically provisions a silent Expense row tagged as a Restock cost. Manual expenses supplement these automated ones.

Database tables involved

Tenant Schema:

  • Expense: The master ledger for outgoing cash.
  • ExpenseCategory: To group costs functionally.

API endpoints

  • GET /api/expenses - Retrieve date-range filtered expenses.
  • POST /api/expenses - Insert new operational expenditure.

Permissions / roles

  • Owner: Full access.
  • Manager: Can log expenses (e.g., paying for water).
  • Cashier: Access blocked.

Edge cases

  • Deleting an expense that was auto-generated by an Inventory Restock does NOT reverse the stock injection; it only removes the financial accounting for it.

Validation rules

  • Expense amounts must be positive integers > 0.

Error handling

  • Form submissions check for valid categories dynamically pulled from the backend and return standard React-Hook-Form field errors on mismatch.

Screenshots placeholders

![Category Required Error](../../assets/images/expenses/category-error.png)

Troubleshooting

  • If profits look artificially high, check if routine fixed expenses (like Rent) were skipped by the Manager this month.

Related features