{% extends "base.html" %} {% from "partials/ui.html" import page_header, subtabs %} {% block content %} {{ page_header('POS / Inventory', 'Simple sub-tabs for sales, inventory, batches/traceability, meals, activities, and history. Reservation POS posts to folio immediately; walk-in cart commits atomically.') }} {{ subtabs([ {'key':'sell','href':'/pos?tab=sell','label':'Sell'}, {'key':'inventory','href':'/pos?tab=inventory','label':'Inventory'}, {'key':'batches','href':'/pos?tab=batches','label':'Batches & Traceability'}, {'key':'meals','href':'/pos?tab=meals','label':'Meals & Recipes'}, {'key':'activities','href':'/pos?tab=activities','label':'Activities'}, {'key':'history','href':'/pos?tab=history','label':'History'} ], active_tab, 'POS and inventory sections') }} {% if active_tab == 'sell' %}
Resolves item SKU/barcode or lot code and shows batch data. Embedded QR payloads are decoded if present.
{% if scan_result %} {% if scan_result.type == 'batch' %}| Lot | Received (bought) | Expiry | Remaining | Unit cost | Supplier | Status |
|---|---|---|---|---|---|---|
{{scan_result.batch.lot_code}} | {{scan_result.batch.received_at}} | {{scan_result.batch.expiry_date or '—'}} {% if scan_result.batch.expiry_state=='expired' %}EXPIRED{% elif scan_result.batch.expiry_state=='expiring' %}expiring{% endif %} | {{scan_result.batch.quantity_remaining}} | {{"%.2f"|format(scan_result.batch.unit_cost or 0)}} | {{scan_result.batch.supplier}} | {{scan_result.batch.status}} |
{{scan_result.code}}| Item | Lot/Batch trace | Qty | Unit | Tax | Gross | |
|---|---|---|---|---|---|---|
| {{it.desc}}{% if it.inv_id %} [inv {{it.inv_id}}]{% endif %} |
{{ it.lot_code or ('#' ~ it.batch_id if it.batch_id else '—') }}
{% if it.batch_id %}batch #{{it.batch_id}}{% endif %}
{% if it.batch_received_at or it.received_at %}{% endif %}
{% if it.batch_expiry_date or it.expiry_date %}{% endif %}
{% if not (it.lot_code or it.batch_id) %}{% endif %}
|
{{it.qty}} | {{"%.2f"|format(it.price)}} | {{"%.2f"|format(it.tax)}} | {{"%.2f"|format(it.gross)}} | |
| Cart is empty. Add items below. | ||||||
| TOTAL | {{"%.2f"|format(cart_total)}} EGP | |||||
Search and add to cart quickly. Full item management is in Inventory; specific lots in Batches.
| ID | Name | Sell | Stock | |
|---|---|---|---|---|
| {{i['id']}} | {{i['item_name']}}{% if i.get('recipe_components') %} recipe{% endif %} SKU {{i.get('sku') or '—'}} · {{i.get('barcode') or '—'}} |
{{"%.2f"|format(i['selling_price'] or 0)}} | {{i['stock_qty']}} | Batches |
| No items | ||||
Quick sale actions go to Sell tab; select Batches to manage/choose specific lots.
| ID | Name / Barcode | Sell | Stock | Next expiry | Recipe | Actions |
|---|---|---|---|---|---|---|
| {{i['id']}} | {{i['item_name']}} SKU: {{i.get('sku') or '—'}} · Code: {{i.get('barcode') or '—'}} |
{{"%.2f"|format(i['selling_price'] or 0)}} | {{i['stock_qty']}} | {{i.get('next_expiry') or '—'}} | {% if i.get('recipe_components') %}{{i['recipe_components']}} ingr.{% else %}—{% endif %} | Batches |
| No items | ||||||
Restock records a received batch with time bought/received for traceability.
Active batches with remaining stock near/after expiry. “Received” = time bought/received.
| Item | Lot | Received | Expiry | Remaining | State | |
|---|---|---|---|---|---|---|
| {{b.item_name}} #{{b.item_id}} | {{b.lot_code}} | {{b.received_at}} | {{b.expiry_date or '—'}} | {{b.quantity_remaining}} | {% if b.expiry_state=='expired' %}EXPIRED ({{b.days_to_expiry}}d){% elif b.expiry_state=='expiring' %}Expiring ({{b.days_to_expiry}}d){% else %}{{b.expiry_state}}{% endif %} | |
| No expiring/expired batches. | ||||||
View all active batches or filter to a specific item.
{% if batch_item %}{% endif %}Tip: from Inventory/Sell you can click “Batches” on an item to jump here.
| ID | Item | Lot | Received | Expiry | Rem/Recv | Cost | Actions |
|---|---|---|---|---|---|---|---|
| {{b.id}} | {{b.item_name}} (#{{b.item_id}}) | {{b.lot_code}} |
{{b.received_at}} | {{b.expiry_date or '—'}} {% if b.expiry_state=='expired' %}EXPIRED{% elif b.expiry_state=='expiring' %}expiring soon{% endif %} | {{b.quantity_remaining}} / {{b.quantity_received}} | {{"%.2f"|format(b.unit_cost or 0)}} |
Res |
| No batches shown (receive a batch or choose an item filter). | |||||||
ingredient_id,qty_per_sale.Register a meal once. When staff orders it in POS using its linked Inventory/POS ID, ingredients are deducted from inventory automatically.
| Meal | POS ID | Price | Ingredients | Preparation | Action |
|---|---|---|---|---|---|
| {{m['name']}} {{m.get('description') or ''}} |
{% if m.get('linked_inventory_id') %}{{m['linked_inventory_id']}}{% else %}—{% endif %} |
{{"%.2f"|format(m.get('selling_price') or 0)}} | {% for ing in m.get('ingredients') or [] %} {{ing['item_name']}}: {{ing['qty_per_sale']}} {{ing.get('unit') or ''}}{% if ing.get('note') %} ({{ing['note']}}){% endif %} {% else %}No ingredients{% endfor %} |
{{(m.get('preparation') or '')[:120]}}{% if (m.get('preparation') or '')|length > 120 %}…{% endif %} | |
| No meals registered yet. | |||||
Define ingredients for a sellable meal/menu inventory item directly. When sold in POS by Inventory ID, ingredients auto-deduct and meal stock is not deducted. Components: one per line ingredient_id,qty_per_sale.
| Activity | Cat | Active | Bookings | Qty | Revenue |
|---|---|---|---|---|---|
| {{s.activity_name}} #{{s.activity_id}} | {{s.category}} | {{'Yes' if s.active else 'No'}} | {{s.bookings}} | {{s.total_qty}} | {{"%.2f"|format(s.gross_revenue or 0)}} |
| No activity bookings/stats yet. | |||||
| ID | Name | Category | Price | Active | Description | |
|---|---|---|---|---|---|---|
| {{a.id}} | {{a.name}} | {{a.category}} | {{"%.2f"|format(a.unit_price or 0)}} | {{'Yes' if a.active else 'No'}} | {{a.description}} | |
| No activities registered yet. | ||||||
| ID | At | Item | Batch / Lot trace | Qty | Gross-ish | Action |
|---|---|---|---|---|---|---|
| {{p['id']}} | {{p['created_at']}} | {{p['item_description']}} |
{{ p.get('lot_code') or p.get('batch_lot_code') or ('#' ~ p.get('batch_id') if p.get('batch_id') else '—') }}
{% if p.get('batch_id') %}batch #{{ p.get('batch_id') }}{% endif %}
{% if p.get('received_at') or p.get('batch_received_at') %}{% endif %}
{% if p.get('expiry_date') or p.get('batch_expiry_date') %}{% endif %}
|
{{p['quantity']}} | {{"%.2f"|format((p['quantity']*p['unit_price']) + (p['tax_amount'] or 0))}} | |
| None | ||||||
| ID | At | Amount | Method | Notes |
|---|---|---|---|---|
| {{p['id']}} | {{p['at']}} | {{"%.2f"|format(p['amount'])}} | {{p['method']}} | {{p['notes']}} |
| None | ||||