# BisamaPOS Flutter App — Prompts 1–12 Verification Report

**Checked Against:**
- `database/migrations/` — All Laravel MySQL migration files
- `public/system_documentation/BISAMA_POS_USER_GUIDE.html` — Full system documentation

**Date:** 2026
**Scope:** Prompts 1–12 in `markdown/FLUTTERFLOW_GUIDE.md`
**Note:** Design elements (colors, fonts, animations, card styles) are NOT checked — only logic, data fields, and feature accuracy.

---

## Legend
- ✅ CORRECT — Matches DB schema and system behaviour
- ❌ ISSUE — Does not match DB or system (needs correction)
- ⚠️ WARNING — Partially correct or needs clarification
- ➕ MISSING — Feature exists in system/DB but not in prompt

---

## Prompt 1: App Structure & Navigation

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Bottom nav: Home, Sales, Inventory, Customers, More | ✅ | Covers all main modules |
| 2 | App bar shows current branch name | ✅ | Maps to `tenant_branches.name` |
| 3 | Account avatar | ✅ | Maps to `users.image` |
| 4 | Notification bell with badge | ✅ | Maps to `activity_logs` table |
| 5 | **CURRENCY TOGGLES section** | ❌ | BisamaPOS is **GHS-only**. No multi-currency table in DB. Remove this section entirely. |
| 6 | Dark mode as default | ✅ | Design preference, no DB impact |

### Action Required
- **Remove** the `CURRENCY TOGGLES` section from Prompt 1. The system uses GHS (Ghana Cedis) exclusively. There is no currency or exchange rate table in the database.

---

## Prompt 2: Authentication Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Login with email + password | ✅ | Maps to `users.email`, `users.password` |
| 2 | No social login (Google/Facebook) | ✅ | Correctly removed |
| 3 | No self-registration / Sign Up | ✅ | Correctly removed — users created by admin only |
| 4 | Forgot Password link | ✅ | Correct — admin-managed |
| 5 | Branch selection after login | ✅ | Maps to `tenant_branches` table |
| 6 | Role-based access after login | ✅ | Maps to `users.role` (admin/director/manager/user) |
| 7 | Token-based auth (Sanctum) | ✅ | Maps to `personal_access_tokens` table |
| 8 | User status check | ⚠️ | Should check `users.status = 'active'` before allowing login |
| 9 | Tenant context after login | ⚠️ | App must store `users.tenant_id` and `users.branch_id` in app state after login |

### Action Required
- Add note: After login, store `tenant_id`, `branch_id`, and `role` from the user response — these are required for ALL subsequent API calls.
- Add check: If `users.status = 'inactive'`, show "Account disabled. Contact your administrator."

---

## Prompt 3: Dashboard / Home Screen

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Stock Management Card (qty, expiry, reorder) | ✅ | Maps to `stocks.qty`, `stocks.expiry_date`, `stocks.reorder_level` |
| 2 | Weekly Sales Chart in GHS | ✅ | Maps to `analytics_sales_daily.total_sales` |
| 3 | Today's Sales card | ✅ | Maps to `analytics_sales_daily.total_sales` (today's date) |
| 4 | Today's Expenses card | ✅ | Maps to `expenses` table (sum by date) |
| 5 | Pending Collections card | ✅ | Maps to `payments` where `credit > 0` and `status != 'paid'` |
| 6 | Recent Sales list | ✅ | Maps to `sales` table joined with `customers` |
| 7 | Payment method chips (Cash/MoMo/Bank/Credit) | ✅ | Maps to `payments.mode` column |
| 8 | **Sale type badge (Retail/Wholesale/Distribution)** | ⚠️ | The `sales` table has **no `sale_type` column**. Sale type is determined by which API endpoint was called. The mobile app must store sale type locally when creating the sale, or the API must return it. |
| 9 | Invoice number format (INV-XXXXXX) | ✅ | Maps to `sales.invoice` |
| 10 | Customer name or "Walk-in Customer" | ✅ | Maps to `customers.name`; walk-in = `customer_id = 0` or null |
| 11 | Quick action buttons | ✅ | All map to valid screens |
| 12 | Revenue Dashboard widget | ✅ | Maps to `analytics_sales_daily` |
| 13 | Expense Dashboard widget | ✅ | Maps to `expenses` table |
| 14 | Customer Dashboard widget | ✅ | Maps to `customers` table (count) |
| 15 | Sales Supplied widget | ✅ | Maps to `payments.status = 'delivered'` |

### Action Required
- **Sale type**: Since `sales` table has no `sale_type` column, the API endpoint used determines the type (e.g., `/api/retail-sales`, `/api/wholesale-sales`, `/api/distribution-sales`). The mobile app should tag sales with their type when displaying them. Consider asking the backend team to add a `sale_type` column or return it from the API.

---

## Prompt 4: Sales / POS Screen

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Product search by name | ✅ | Maps to `stocks.name` |
| 2 | Barcode scan search | ✅ | Maps to `stocks.product_id` (used as barcode identifier) |
| 3 | Category filter pills | ✅ | Maps to `stocks.category` |
| 4 | Product card: retail_price, wholesale_price, distribution_price | ✅ | All three columns exist in `stocks` table |
| 5 | Stock badge (In Stock / Low / Critical) | ✅ | Based on `stocks.qty` vs `stocks.reorder_level` |
| 6 | Only show active products | ✅ | Filter by `stocks.status = 'active'` |
| 7 | Tax calculation: VAT 15%, NHIL 2.5%, GETFund 2.5% | ✅ | Maps to `sales.vat`, `sales.nhil`, `sales.getfund`, `sales.clevy`, `sales.levy` |
| 8 | Tax rates from `vats` table | ✅ | `vats.vat`, `vats.nhil`, `vats.getfund`, `vats.clevy` per branch |
| 9 | Payment: Cash | ✅ | Maps to `payments.cash` |
| 10 | Payment: MoMo (MTN/Vodafone/AirtelTigo) | ✅ | Maps to `payments.momo`, `momo_transactions` table |
| 11 | MoMo phone number input | ✅ | Maps to `payments.momo_phone` |
| 12 | Payment: Bank Transfer | ✅ | Maps to `payments.bank` |
| 13 | Payment: Combo (Cash+MoMo+Bank) | ✅ | Maps to `payments.mode = 'combo'` with multiple amount fields |
| 14 | Payment: Credit | ✅ | Maps to `payments.credit`; requires customer record |
| 15 | **Sale Type selector (Retail/Wholesale/Distribution)** | ⚠️ | No `sale_type` column in `sales` table. Price shown in cart must change based on selected type (retail_price / wholesale_price / distribution_price from `stocks`). |
| 16 | Customer selection (Walk-in or registered) | ✅ | Maps to `customers` table; walk-in uses a default customer_id |
| 17 | Discount field | ✅ | Maps to `sales.discount` |
| 18 | **Proforma Invoice flow** | ➕ | **MISSING** — The system has a `proformas` table (product_id, qty, price, subtotal, discount, total_value, invoice, customer_id). A "Proforma" option should be available in the Sales screen. |
| 19 | Returns & Exchanges | ✅ | Maps to `sales_exchanges` table |
| 20 | **cheque, transfer, pos payment methods** | ⚠️ | These columns exist in `payments` table (`payments.cheque`, `payments.transfer`, `payments.pos`) but are not shown in the mobile payment options. For mobile, Cash/MoMo/Bank/Combo/Credit is sufficient. |
| 21 | Invoice number auto-generated | ✅ | Maps to `sales.invoice` |
| 22 | Print receipt after sale | ✅ | Correct — triggers `sales.status` update |
| 23 | Scan Payment (barcode) | ✅ | Maps to `payments.barcode_number` |

### Action Required
- **Add Proforma Invoice** as a separate option in the Sales screen (a "Proforma" button that creates a record in the `proformas` table instead of `sales`).
- **Sale type**: The selected type (Retail/Wholesale/Distribution) determines which price column to use from `stocks`. The API endpoint called must also differ (e.g., POST `/api/sales/retail` vs `/api/sales/wholesale`).

---

## Prompt 5: Inventory Management Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Product name | ✅ | Maps to `stocks.name` |
| 2 | Category | ✅ | Maps to `stocks.category` |
| 3 | Retail price | ✅ | Maps to `stocks.retail_price` |
| 4 | Wholesale price | ✅ | Maps to `stocks.wholesale_price` (nullable) |
| 5 | Distribution price | ✅ | Maps to `stocks.distribution_price` (nullable) |
| 6 | Purchase price | ✅ | Maps to `stocks.purchase_price` |
| 7 | Quantity (qty) | ✅ | Maps to `stocks.qty` |
| 8 | Reorder level | ✅ | Maps to `stocks.reorder_level` (nullable) |
| 9 | Supplier | ✅ | Maps to `stocks.supplier_id` → `suppliers` table |
| 10 | Expiry date | ✅ | Maps to `stocks.expiry_date` (nullable) |
| 11 | Active/Inactive status | ✅ | Maps to `stocks.status` (active/inactive) |
| 12 | Product ID / Barcode | ✅ | Maps to `stocks.product_id` (string, used as barcode) |
| 13 | **Boxes field** | ➕ | **MISSING** — `stocks.boxes` (decimal) exists in DB. Represents number of boxes. Should be in Add/Edit form. |
| 14 | **Pieces (pcs) field** | ➕ | **MISSING** — `stocks.pcs` (integer) exists in DB. Represents pieces per box. Should be in Add/Edit form. |
| 15 | **Purchase Invoice field** | ➕ | **MISSING** — `stocks.invoice` (string, nullable) exists in DB. Links stock to a purchase invoice. Should be in Add/Edit form. |
| 16 | **Variants section** | ❌ | **NO variants table in DB**. Remove any remaining variants content from the prompt. |
| 17 | **Multiple product images** | ❌ | **No image column in `stocks` table**. Remove multi-image gallery from the prompt. |
| 18 | **Rich text description** | ❌ | **No description column in `stocks` table**. Remove rich text editor. |
| 19 | Stock transfer | ✅ | Maps to `stock_transfers` table (from_branch_id, to_branch_id, product_id, qty, selling_price, purchase_price, approval) |
| 20 | Stock request (inter-branch) | ✅ | Maps to `stock_requests` table (product_id, qty, branch_id, requester_id, status, approver_id, remarks) |
| 21 | Approve transfers | ✅ | Maps to `stock_transfers.approval` column |
| 22 | Low stock alerts | ✅ | Based on `stocks.qty <= stocks.reorder_level` |
| 23 | Expiry alerts | ✅ | Based on `stocks.expiry_date` within 30 days |
| 24 | Restocking (new_stocks) | ✅ | Maps to `new_stocks` table (same structure as `stocks`, records each restock event) |
| 25 | Inventory movements | ✅ | Maps to `inv_movements` table (qty_in, qty_out, source_type, unit_cost) |
| 26 | Inventory balance | ✅ | Maps to `inv_balances` table (qty_on_hand, avg_cost) |

### Action Required
- **Add to Add/Edit Product form**: `boxes` (number of boxes), `pcs` (pieces per box), `invoice` (purchase invoice number).
- **Remove**: Variants section, multiple images gallery, rich text description editor.
- **Clarify**: `product_id` in `stocks` is a string (not auto-increment) — it serves as both the SKU and barcode identifier.

---

## Prompt 6: Customer Management Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Customer name | ✅ | Maps to `customers.name` |
| 2 | Phone number | ✅ | Maps to `customers.phone` |
| 3 | Address | ✅ | Maps to `customers.address` |
| 4 | Customer category | ✅ | Maps to `customers.category` (Retail/Wholesale/Distribution/etc.) |
| 5 | **Email field** | ❌ | **NOT in `customers` table**. Remove email input from customer form. |
| 6 | **Date of Birth** | ❌ | **NOT in `customers` table**. Remove DOB field. |
| 7 | **Gender** | ❌ | **NOT in `customers` table**. Remove gender selector. |
| 8 | **Company Name / Tax ID** | ❌ | **NOT in `customers` table**. Remove business info section. |
| 9 | **Credit Limit** | ❌ | **NOT in `customers` table**. No credit limit column exists. Remove credit limit field. |
| 10 | **Assigned Sales Rep** | ❌ | **NOT in `customers` table**. Remove this field. |
| 11 | **Customer Type (Individual/Business/VIP)** | ❌ | **NOT in `customers` table**. The only customer classification is `customers.category` (free text). Remove the 3-card type selector. |
| 12 | Transaction history | ✅ | Maps to `sales` table filtered by `customer_id` |
| 13 | Payment history | ✅ | Maps to `payments` and `payment_installments` tables |
| 14 | Outstanding balance | ✅ | Calculated from `payments` (total credit - total paid) |
| 15 | Customer appreciations | ✅ | Maps to `customer_appreciations` table (date, appreciation, invoice) |
| 16 | Customer messaging | ✅ | Maps to `message_settings` table (SMS/email via Hubtel/Arkesel) |
| 17 | Loyalty Points | ✅ | Correctly removed (no loyalty table in DB) |
| 18 | Tags | ✅ | Correctly removed (no tags column in DB) |
| 19 | Referral Source | ✅ | Correctly removed (no referral column in DB) |
| 20 | GPS/Map | ✅ | Correctly removed (no GPS column in DB) |
| 21 | Customer Groups/Segments | ✅ | Correctly removed (no segments table in DB) |
| 22 | **Customer form is too complex** | ❌ | The actual `customers` table only has: `name`, `address`, `category`, `phone`. The Add Customer form should only have these 4 fields plus tenant/branch context. |

### Action Required
- **Simplify the Add/Edit Customer form** to match the actual DB columns:
  - Name (required)
  - Phone (optional)
  - Address (optional)
  - Category (optional — Retail/Wholesale/Distribution/Corporate/etc.)
- **Remove**: Email, DOB, Gender, Company Name, Tax ID, Credit Limit, Assigned Sales Rep, Customer Type cards (Individual/Business/VIP).
- The customer detail view can still show transaction history, payment history, and outstanding balance — these are calculated from other tables.

---

## Prompt 7: Reports & Analytics Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Sales reports (by date, category, customer, payment method) | ✅ | Maps to `sales` table with filters |
| 2 | Inventory reports (stock valuation, movements) | ✅ | Maps to `stocks`, `inv_movements`, `inv_balances` |
| 3 | Customer reports (purchase history, debt) | ✅ | Maps to `customers`, `payments` tables |
| 4 | Financial reports (P&L, Balance Sheet) | ✅ | Maps to `acc_journals`, `acc_journal_lines`, `acc_accounts` |
| 5 | Tax reports (VAT, NHIL, GETFund) | ✅ | Maps to `analytics_tax_monthly`, `sales` tax columns |
| 6 | Payment method breakdown | ✅ | Maps to `analytics_sales_daily` (cash_sales, momo_sales, bank_sales, credit_sales) |
| 7 | Date range filtering | ✅ | Correct |
| 8 | Export (PDF, Excel, CSV) | ✅ | Correct |
| 9 | Scheduled Reports | ✅ | Correctly removed (no scheduled_reports table in DB) |
| 10 | Forecasts tab | ✅ | Correctly removed (no forecasting table in DB) |
| 11 | Chart types (Bar, Line, Pie) | ✅ | Design only |
| 12 | **Truck Sales reports** | ➕ | **MISSING** — `truck_sales` and `truck_payments` tables exist. Truck sales reports should be included (net contribution per truck, driver collection efficiency). |
| 13 | **Payroll/HR reports** | ➕ | **MISSING** — `payrolls` table exists. A payroll summary report should be available. |
| 14 | **Proforma reports** | ➕ | **MISSING** — `proformas` table exists. Should be viewable. |
| 15 | Weekly earnings chart | ✅ | Maps to `analytics_sales_daily` (7-day rolling) |
| 16 | Top products by profit | ✅ | Calculated from `sales.total_value - sales.total_cost` |

### Action Required
- **Add Truck Sales Reports** section: Net contribution per truck, driver collection efficiency, return rate by truck.
- **Add Payroll Summary** report: Monthly payroll totals from `payrolls` table.
- **Add Proforma Report**: List of proforma invoices from `proformas` table.

---

## Prompt 8: Settings & Configuration Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | User profile (name, email, phone, role) | ✅ | Maps to `users` table |
| 2 | Change password | ✅ | Maps to `users.password` |
| 3 | Switch branch | ✅ | Maps to `tenant_branches` table |
| 4 | Theme (Light/Dark/System) | ✅ | Local preference, no DB |
| 5 | Language | ✅ | Local preference, no DB |
| 6 | Currency display | ⚠️ | GHS only — no multi-currency in DB. Remove currency selector or make it read-only showing "GHS" |
| 7 | VAT Settings | ✅ | Maps to `vats` table (vat, nhil, clevy, getfund, total_tax, minimum_value, maximum_value) |
| 8 | PAYE Settings | ✅ | Maps to `payroll_settings` table (order, chargeable_income, rate, cumulative_income, cumulative_tax) |
| 9 | SSNIT Settings | ✅ | Maps to `social_securities` table (employee 5.5%, employer 13%) |
| 10 | Attendance Settings | ✅ | Maps to `attendance_settings` table (time_in, time_out) |
| 11 | Message Settings | ✅ | Maps to `message_settings` table (name, code) |
| 12 | User Privileges | ✅ | Maps to `user_privileges` table (all boolean columns) |
| 13 | Stock Pricing Settings | ✅ | Maps to `stock_settings` table (category, retail_price, wholesale_price, distribution_price) |
| 14 | Bank Settings | ✅ | Maps to `bank_settings` table (name, account_number) |
| 15 | Expense Settings | ✅ | Maps to `expense_settings` table (name, code) |
| 16 | Biometric Login | ✅ | Correctly removed (no biometric table in DB) |
| 17 | PIN Protection | ✅ | Correctly removed (no PIN table in DB) |
| 18 | 2FA | ✅ | Correctly removed (no 2FA table in DB) |
| 19 | Backup Settings | ✅ | Correctly removed (no backup table in DB) |
| 20 | Sync Settings | ✅ | Correctly removed (no sync table in DB) |
| 21 | Referral Bonus | ✅ | Correctly removed (no referral table in DB) |
| 22 | **Receipt Settings** | ❌ | **NOT in DB** — no `receipt_settings` table. Remove this section. |
| 23 | **Payment Methods Configuration** | ❌ | **NOT in DB** — no payment methods config table (only `bank_settings` exists). Remove or simplify to just show bank_settings. |
| 24 | **Tenant Modules** | ➕ | **MISSING** — `tenant_modules` table controls which modules are enabled for a tenant. The mobile app should check this before showing menu items. |
| 25 | Auto-logout timeout | ✅ | Local preference, no DB |
| 26 | Notification preferences | ✅ | Local preference, no DB |

### Action Required
- **Remove**: Receipt Settings section, Payment Methods Configuration section.
- **Add**: Tenant Modules check — before showing any menu item, verify it's enabled in `tenant_modules` for the current tenant.
- **Currency**: Change currency selector to read-only "GHS — Ghanaian Cedi" (no selection needed).

---

## Prompt 9: Truck Sales System Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Truck list | ✅ | Maps to `truck_details` (name, truck_number, driver_number, truck_route, status) |
| 2 | Truck status (active/inactive) | ✅ | Maps to `truck_details.status` |
| 3 | Outstanding balance on truck card | ✅ | Calculated from `truck_payments.outstanding_balance` |
| 4 | Truck Sales screen | ✅ | Maps to `truck_sales` table |
| 5 | Product search with all 3 price tiers | ✅ | Maps to `stocks` (retail_price, wholesale_price, distribution_price) |
| 6 | Tax calculation (VAT 15%, NHIL 2.5%, GETFund 2.5%) | ✅ | Maps to `truck_sales.vat`, `.nhil`, `.getfund`, `.clevy`, `.levy` |
| 7 | Print Invoice (posts to accounting) | ✅ | Maps to `truck_sales.posting_status` |
| 8 | Truck Payments screen | ✅ | Maps to `truck_payments` table |
| 9 | Cash/MoMo/Bank collected | ✅ | Maps to `truck_payments.cash`, `.momo`, `.bank` |
| 10 | Fuel/Maintenance/Other expenses | ✅ | Maps to `truck_payments.fuel_expense`, `.maintenance_expense`, `.other_expense` |
| 11 | Net Payment calculation | ✅ | Maps to `truck_payments.net_payment` |
| 12 | Outstanding Balance calculation | ✅ | Maps to `truck_payments.outstanding_balance` |
| 13 | Truck Returns screen | ✅ | Maps to `truck_returns` table |
| 14 | Return reference (auto-generated) | ✅ | Maps to `truck_returns.return_reference` (unique) |
| 15 | Returned qty, unit_price, unit_cost | ✅ | Maps to `truck_returns.returned_qty`, `.unit_price`, `.unit_cost`, `.returned_cost` |
| 16 | IAS 2 compliant return (restores at original cost) | ✅ | Maps to `truck_returns.returned_cost` |
| 17 | Driver Sales upload | ✅ | Maps to `driver_sales` (customer_phone, image_path, driver_id) |
| 18 | **Truck Invoice View screen** | ➕ | **MISSING** — The web app has a "Truck Invoice View" to view/reprint truck invoices. Should be added as a screen. Maps to `truck_sales` filtered by truck/date/invoice. |
| 19 | **Truck payment installments** | ⚠️ | `truck_payment_installments` table exists for tracking multiple payments per invoice. The Truck Payments screen should support recording installment payments. |
| 20 | Truck status filter | ✅ | Filter by `truck_details.status` |
| 21 | Goods sold amount | ✅ | Maps to `truck_payments.goods_sold_amount` |

### Action Required
- **Add Truck Invoice View screen**: List of truck sales invoices with search by truck, driver, date range, invoice number. Tap to view/reprint.
- **Add installment support** to Truck Payments: When recording a payment, it should create a record in `truck_payment_installments` with the actual payment date.

---

## Prompt 10: HR & Payroll View Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Employee list | ✅ | Maps to `employees` table |
| 2 | Employee ID | ✅ | Maps to `employees.employee_id` (unique string) |
| 3 | Name, phone, department, position | ✅ | All in `employees` table |
| 4 | Salary | ✅ | Maps to `employees.salary` |
| 5 | Employment type | ✅ | Maps to `employees.employment_type` |
| 6 | Start date / End date | ✅ | Maps to `employees.start_date`, `employees.end_date` |
| 7 | Status (active/inactive) | ✅ | Maps to `employees.status` |
| 8 | Emergency contact | ✅ | Maps to `employees.emergency_name`, `employees.emergency_number` |
| 9 | Attendance view | ✅ | Maps to `attendances` (employee_id, date, time_in, status: on_time/late/absent, remarks) |
| 10 | Payroll history | ✅ | Maps to `payrolls` (gross_salary, allowances, deductions, ssnit, employer_contribution, income_tax, total_deductions, net_salary, amount_payable) |
| 11 | PAYE tax calculation display | ✅ | Maps to `payrolls.income_tax` |
| 12 | SSNIT employee (5.5%) | ✅ | Maps to `payrolls.ssnit` |
| 13 | SSNIT employer (13%) | ✅ | Maps to `payrolls.employer_contribution` |
| 14 | Task assignment view | ✅ | Maps to `task_assigns` (title, category, description, due_date, status: pending/progress/completed) |
| 15 | Task response/attachment | ✅ | Maps to `task_assigns.response`, `.respond_attachment` |
| 16 | Attendance upload (CSV/Excel) | ✅ | Matches web app functionality |
| 17 | **Provident fund** | ➕ | **MISSING** — `payrolls.provident_fund` column exists. Should be shown in payroll detail. |
| 18 | **Taxable income** | ➕ | **MISSING** — `payrolls.taxable_income` column exists. Should be shown in payroll detail. |
| 19 | **Payroll invoice number** | ➕ | **MISSING** — `payrolls.invoice` column exists. Should be shown for reference. |
| 20 | **Employee files** | ⚠️ | `employees.files` (text) exists — stores file paths. Mobile app could show a list of attached documents. |
| 21 | View-only mode for mobile | ✅ | Correct — HR management (add/edit employees, run payroll) stays on web |

### Action Required
- **Add to Payroll detail view**: `provident_fund`, `taxable_income`, `payroll.invoice` (invoice number for reference).
- **Note**: The mobile app is view-only for HR. Adding/editing employees and running payroll is done on the web application.

---

## Prompt 11: Analytics Dashboard Screens

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | All 11 analytics categories | ✅ | Matches the 50 analytics system |
| 2 | Director Dashboard (6 analytics) | ✅ | Maps to `analytics_sales_daily`, `acc_journals` |
| 3 | Financial Analytics (5 analytics) | ✅ | Maps to `acc_journals`, `acc_journal_lines` |
| 4 | Cash Flow & Payments (4 analytics) | ✅ | Maps to `payments`, `payment_installments` |
| 5 | Tax Compliance (4 analytics) | ✅ | Maps to `analytics_tax_monthly` |
| 6 | Manager Dashboard (6 analytics) | ✅ | Maps to `analytics_sales_daily` |
| 7 | Sales Analytics (4 analytics) | ✅ | Maps to `sales` table |
| 8 | Customer Analytics (4 analytics) | ✅ | Maps to `analytics_customer_summary` |
| 9 | Truck Distribution (4 analytics) | ✅ | Maps to `truck_sales`, `truck_payments` |
| 10 | Fraud Monitoring (4 analytics) | ✅ | Maps to `sales` (discount, price overrides) |
| 11 | Inventory Intelligence (6 analytics) | ✅ | Maps to `analytics_inventory_daily` |
| 12 | Operations Analytics (4 analytics) | ✅ | Maps to `expenses`, `employees`, `stock_transfers` |
| 13 | Access control by role | ✅ | Maps to `user_privileges` (analytics_menu, analytics_overview, analytics_reports, analytics_insights) |
| 14 | Data refreshes every 5 minutes | ✅ | Matches web app behaviour |
| 15 | GHS currency throughout | ✅ | All amounts in GHS |
| 16 | **Tenant module check** | ⚠️ | Analytics screen should only show if `tenant_modules.analytics_module = 1` |

### Action Required
- Before showing the Analytics menu, check `tenant_modules.analytics_module = 1` for the current tenant.
- Access levels: `analytics_overview` = Director, `analytics_reports` = Manager, `analytics_insights` = Cashier/User.

---

## Prompt 12: Barcode Scanner Interface

### Issues Found

| # | Item | Status | Detail |
|---|------|--------|--------|
| 1 | Scan product barcode | ✅ | Maps to `stocks.product_id` (string, used as barcode) |
| 2 | Product found card (name, price, stock) | ✅ | Maps to `stocks` table |
| 3 | Add to cart on scan | ✅ | Correct |
| 4 | Product not found → Add New Product | ✅ | Correct |
| 5 | Manual barcode entry | ✅ | Correct |
| 6 | Scan Payment (invoice barcode) | ✅ | Maps to `payments.barcode_number` (unique) |
| 7 | Torch/flash toggle | ✅ | Device feature, no DB |
| 8 | Barcode types (UPC, EAN, Code128, QR) | ✅ | Correct |
| 9 | **Show all 3 prices on scan** | ⚠️ | When a product is scanned, show retail_price, wholesale_price, AND distribution_price so the cashier can select the correct one based on sale type. |

### Action Required
- When a product is scanned and found, show all three price tiers (retail, wholesale, distribution) so the cashier can confirm the correct price for the current sale type.

---

## Summary of All Issues

### ❌ MUST FIX (Incorrect — not in DB)

| Prompt | Issue |
|--------|-------|
| P1 | Remove **CURRENCY TOGGLES** section — GHS only, no multi-currency in DB |
| P5 | Remove **Variants** section — no variants table in DB |
| P5 | Remove **Multiple product images** — no image column in `stocks` table |
| P5 | Remove **Rich text description** — no description column in `stocks` table |
| P6 | Remove **Email** from customer form — not in `customers` table |
| P6 | Remove **Date of Birth** from customer form — not in `customers` table |
| P6 | Remove **Gender** from customer form — not in `customers` table |
| P6 | Remove **Company Name / Tax ID** — not in `customers` table |
| P6 | Remove **Credit Limit** — not in `customers` table |
| P6 | Remove **Assigned Sales Rep** — not in `customers` table |
| P6 | Remove **Customer Type cards** (Individual/Business/VIP) — not in `customers` table |
| P8 | Remove **Receipt Settings** section — no receipt_settings table in DB |
| P8 | Remove **Payment Methods Configuration** — no such table in DB |

### ➕ MISSING (In DB but not in prompts)

| Prompt | Missing Item | DB Table/Column |
|--------|-------------|-----------------|
| P4 | **Proforma Invoice** flow | `proformas` table |
| P5 | **Boxes** field in product form | `stocks.boxes` |
| P5 | **Pieces (pcs)** field in product form | `stocks.pcs` |
| P5 | **Purchase Invoice** field in product form | `stocks.invoice` |
| P7 | **Truck Sales Reports** | `truck_sales`, `truck_payments` |
| P7 | **Payroll Summary Report** | `payrolls` table |
| P7 | **Proforma Report** | `proformas` table |
| P9 | **Truck Invoice View** screen | `truck_sales` table |
| P9 | **Payment installments** support | `truck_payment_installments` |
| P10 | **Provident fund** in payroll detail | `payrolls.provident_fund` |
| P10 | **Taxable income** in payroll detail | `payrolls.taxable_income` |
| P10 | **Payroll invoice number** | `payrolls.invoice` |

### ⚠️ WARNINGS (Needs clarification or partial fix)

| Prompt | Warning |
|--------|---------|
| P2 | Store `tenant_id`, `branch_id`, `role` from login response in app state |
| P2 | Check `users.status = 'active'` before allowing login |
| P3 | `sales` table has no `sale_type` column — type determined by API endpoint |
| P4 | `sales` table has no `sale_type` column — price tier (retail/wholesale/distribution) must be selected before adding to cart |
| P4 | `payments.cheque`, `.transfer`, `.pos` exist in DB but not needed in mobile |
| P8 | Currency selector should be read-only "GHS" — no multi-currency in DB |
| P9 | `truck_payment_installments` table exists — Truck Payments should record installments |
| P11 | Check `tenant_modules.analytics_module = 1` before showing Analytics menu |
| P12 | Show all 3 price tiers when product is scanned |

---

## Key Database Facts for Flutter Developers

### Authentication
- Table: `users` — `email`, `password`, `role` (admin/director/manager/user), `tenant_id`, `branch_id`, `status`
- Auth: Laravel Sanctum — `personal_access_tokens` table
- Every API request needs: `Authorization: Bearer {token}`, `tenant_id`, `branch_id`

### Products (Stocks)
- Table: `stocks` — `product_id` (string, = barcode), `name`, `boxes`, `pcs`, `qty`, `retail_price`, `wholesale_price`, `distribution_price`, `purchase_price`, `reorder_level`, `supplier_id`, `category`, `expiry_date`, `status` (active/inactive)
- No variants, no images, no description column

### Customers
- Table: `customers` — `name`, `phone`, `address`, `category` ONLY
- No email, no DOB, no gender, no credit limit

### Sales
- Table: `sales` — `product_id`, `qty`, `price`, `subtotal`, `discount`, `total_value`, `total_cost`, `taxable_amount`, `nhil`, `getfund`, `clevy`, `levy`, `vat`, `invoice`, `customer_id`, `status`
- No `sale_type` column — type determined by API endpoint used
- Tax columns: `vat` (15%), `nhil` (2.5%), `getfund` (2.5%), `clevy` (COVID levy), `levy` (total)

### Payments
- Table: `payments` — `customer_id`, `invoice`, `mode`, `amount`, `cash`, `momo`, `credit`, `bank`, `cheque`, `transfer`, `pos`, `momo_phone`, `status`, `barcode_number`
- Mobile payment modes: cash, momo, bank, combo, credit

### Ghana Tax Structure
- VAT: 15% → `sales.vat`
- NHIL: 2.5% → `sales.nhil`
- GETFund: 2.5% → `sales.getfund`
- COVID Levy (clevy): variable → `sales.clevy`
- Total effective rate: ~20%
- Tax rates stored in: `vats` table per branch

### Truck Sales
- `truck_details`: name, truck_number, driver_number, truck_route, status
- `truck_sales`: product_id, truck_id, qty, price, tax fields, invoice, status (pending/confirmed/delivered/paid)
- `truck_payments`: truck_id, invoice, cash, momo, bank, fuel_expense, maintenance_expense, other_expense, net_payment, outstanding_balance
- `truck_returns`: truck_sale_id, stock_id, returned_qty, unit_cost, returned_cost (IAS 2 compliant)
- `driver_sales`: customer_phone, image_path, driver_id

### HR & Payroll
- `employees`: employee_id, name, phone, department, position, salary, employment_type, start_date, end_date, status
- `attendances`: employee_id, date, time_in, status (on_time/late/absent)
- `payrolls`: employee_id, gross_salary, allowances, deductions, provident_fund, taxable_income, ssnit, employer_contribution, income_tax, total_deductions, net_salary, amount_payable
- `task_assigns`: title, category, description, due_date, status (pending/progress/completed), employee_id

### Analytics
- `analytics_sales_daily`: daily totals per branch
- `analytics_customer_summary`: per-customer lifetime metrics
- `analytics_inventory_daily`: daily inventory health
- `analytics_tax_monthly`: monthly tax obligations
- Access controlled by: `user_privileges.analytics_menu/overview/reports/insights`
- Module enabled by: `tenant_modules.analytics_module`

---

*Report generated for BisamaPOS Flutter mobile app development.*
*Corrections to be applied to Prompts 1–12 in `markdown/FLUTTERFLOW_GUIDE.md`.*
