# POS Hardware Setup — Super Shop (Scanner, Scale, Cash Drawer)

This guide matches the POS screen in `pos.html`. Serve the app over **HTTP/HTTPS** (not `file://`).

---

## 1. Barcode scanner (USB / Bluetooth)

### What to buy
- **1D** scanner: packaged goods with standard barcodes (EAN-13, Code 128).
- **2D** scanner: QR codes on labels or phone screens (recommended for flexibility).

### Connect
1. Plug USB into the counter PC, or pair Bluetooth and set as default input device.
2. Windows treats the scanner as a **keyboard (HID wedge)** — no extra driver needed for most models.

### Configure scanner (once)
- Set suffix to **Enter (CR)** after each scan (factory default on most devices).
- Disable “keyboard layout” country quirks if scans look wrong.
- Test in Notepad: scan a barcode → digits appear + new line.

### Use in POS
- Focus the **Barcode / SKU** field (or press **F2**).
- Scan → product adds to cart on Enter.
- POS options (expand **Hardware setup** on POS page):
  - **Keep barcode field focused** — best for busy counters.
  - **Global scan capture** — scan works even when focus is not on the barcode box (fast wedge input only).

### Product barcodes
- Set barcode on each product (or variant) in **Inventory → Products**.
- Weighted items can use PLU codes if configured on the product.

---

## 2. Digital weighing scale (Serial / USB)

### What to buy
- Retail scale with **RS232** or **USB serial** output (continuous weight stream).
- Common brands in BD: CAS, Mettler, generic Chinese POS scales (verify serial output format).

### Connect
1. Scale → **RS232-to-USB** adapter (if needed) → PC USB port.
2. Install USB-serial driver if Windows adds a new **COM port** (Device Manager → Ports).

### Browser
- Use **Google Chrome** or **Microsoft Edge** (Web Serial API).
- Firefox/Safari do **not** support live scale read — use manual weight entry.

### Use in POS
1. Open POS in Chrome/Edge.
2. Click **Connect scale** in the header (or inside the weight modal).
3. Pick the correct **COM port** in the browser prompt.
4. Baud rate: **9600** (default). Change in Hardware setup if your scale uses 4800/115200.
5. Place item on scale → wait for **Stable weight** → **Add to cart**.
6. Scale stays connected for the shift (closing the weight modal does not disconnect).

### Weighted products
- Mark product as weighted in inventory (`isWeighted` / WEIGHT tag on POS grid).
- Price is **per kg**; line total = price × weight.

### Troubleshooting
| Problem | Fix |
|--------|-----|
| No COM port | Check cable, driver, Device Manager |
| Garbage numbers | Wrong baud rate — try 4800 or 9600 |
| Web Serial blocked | Use HTTPS or `localhost`; not `file://` |
| Weight jumps | Wait for stable reading; zero the scale |

---

## 3. Cash drawer (via thermal receipt printer)

Web POS cannot open a drawer directly. Standard setup:

### Wiring
1. **RJ11 cable** from cash drawer → **DK port** on thermal receipt printer (80 mm POS printer).
2. Install printer driver (Epson, Xprinter, Rongta, etc.).

### Windows driver — open drawer on print
1. **Control Panel** → **Devices and Printers**.
2. Right-click receipt printer → **Printer properties** (or **Printing preferences**).
3. Find **Peripherals** / **Cash drawer** / **Device settings**.
4. Enable **Cash drawer #1** → **Open before print** or **Open after print**.
5. Set this printer as **default** for the counter PC (or choose it in the print dialog once).

### POS behaviour
- **Complete sale** → receipt prints via `window.print()` → printer kicks drawer (if driver configured).
- **All cash** payment + print = typical cash sale flow.
- **Day close** slip can print separately; drawer usually opens on customer receipt only.

### Receipt paper
- 80 mm thermal roll; set paper size in printer preferences to match (80 mm × continuous).

---

## 4. Recommended counter layout

```
[PC monitor — Chrome POS full screen]
[USB barcode scanner]
[Scale platform + serial to PC]
[Thermal printer + drawer underneath]
[Optional: bill counter for end-of-day cash count — manual entry in Day close]
```

---

## 5. Day close & cash counting

- **Bill counter / note counting machine**: standalone; operator enters **Counted cash (৳)** in **Day close**.
- POS compares counted vs expected cash/card/mobile and prints variance slip.

---

## 6. Quick checklist

- [ ] Scanner adds product to cart from Barcode field
- [ ] F2 focuses barcode field
- [ ] Weight product opens weight modal; stable scale reading works
- [ ] Cash sale prints receipt and opens drawer (driver setting)
- [ ] Register ID set (e.g. `R1`) for shift/close reports

See also: [POS_UAT_CHECKLIST.md](./POS_UAT_CHECKLIST.md)
