# AMM-2491 – Tester Guide (Camp Laptop + Central Inventory)

Follow the steps in order. Fill the **Result** column (Pass / Fail) and write what you saw for every Fail. Attach screenshots for the steps marked 📷.

## 0. Before you start
| Item | Value |
|---|---|
| Central | https://uatstoptb.piramalswasthya.org (DB 192.168.45.198) |
| Test laptop | must be a **clean** laptop database (no old test data from other vans) |
| Van / camp store | Van 403 "Van 1" → camp store 424 "Baksa Camp Store" (main store 423) |
| MMU line / Stop TB line | 1726 / 1734 |
| Users | `stoptb1` (van operator / pharmacist, MMU-UI, Inventory-UI), `nidhinur` (nurse, StopTB app), an Admin Portal user on central |
| Laptop `.env` | `STOPTB_VAN_ID=403`, `STOPTB_ENFORCE_VANID=true` (FLW, TM, Identity, MMU-API) |

Check with the developer that these versions are deployed (open `<service>/version`):

| Service | Where | Branch |
|---|---|---|
| FLW-API | laptop + central | vb/stoptb-drug-dispense |
| TM-API | laptop + central | vb/stoptb-drug-dispense |
| MMU-API, MMU-UI | laptop + central | vb/3.12.0-auto-sync |
| Inventory-API, Inventory-UI | laptop + central | vb/3.9.0-low-stock |
| Admin-API, ADMIN-UI | central | vb/3.12.0-item-min-stock / vb/3.11.0-item-min-stock |

## 1. Admin sets the stock threshold (central)
| # | Step | Expected | Result |
|---|---|---|---|
| 1.1 | ADMIN-UI → Inventory → Item Master → create a new item, fill **Min Stock = 20** 📷 | Item saved; Min Stock 20 shown when opened again | |
| 1.2 | Edit an existing item (e.g. Aluminium Hydroxide, line 1726) → **Min Stock = 95** → Save 📷 | Saved; reopening shows 95 | |
| 1.3 | Repeat 1.2 for DOXICYCLINE and Ampicillin (Min Stock 95) | Saved | |
| 1.4 | Edit one of these items, change only Description, Save | Min Stock still 95 | |
| 1.5 | Enter a negative Min Stock | Not accepted / saved as empty | |

## 2. Masters reach the laptop
| # | Step | Expected | Result |
|---|---|---|---|
| 2.1 | Laptop: MMU-UI login `stoptb1` → Data Sync (central login) → **Download Masters** 📷 | Completes 100%, no failed masters | |
| 2.2 | StopTB app (nidhinur) → General OPD → medicine list | Only camp store drugs (e.g. Aluminium Hydroxide, BETAMETHASONE); no drugs from other stores | |
| 2.3 | Chief complaint list | Complaints from central master | |
| 2.4 | Change Min Stock of one item on central, wait for the automatic download (max 6 h) **or** press Download Masters | New value used by the laptop Low Stock Report (step 5) | |

## 3. Camp stock (laptop, Inventory-UI as `stoptb1`)
| # | Step | Expected | Result |
|---|---|---|---|
| 3.1 | Login → select Main store → **sub store 424** | Store selected | |
| 3.2 | Physical Stock Entry: 2 items, batch, expiry (future), qty 100 📷 | Saved; stock shows 100 | |
| 3.3 | Stock Adjustment: reduce one item by 5 | Stock 95 | |
| 3.4 | Stock Entry with an **expired** batch (if the screen allows) | That batch is not dispensed / not counted as usable | |

## 4. Nurse dispensing (StopTB app as `nidhinur`)
| # | Step | Expected | Result |
|---|---|---|---|
| 4.1 | OPD: 2 complaints + Aluminium Hydroxide Tablet, BD, 3 Day(s) → Submit 📷 | Saved; qty 6 issued; stock −6 | |
| 4.2 | Add a cream / drops item | Qty 1 issued | |
| 4.3 | Prescribe more than available stock | Error "Insufficient stock"; nothing saved; stock unchanged | |
| 4.4 | Submit the same OPD again (retry / poor network) | No second dispense; stock unchanged | |
| 4.5 | Patient with TB symptoms: TB screening (+ TB suspected) then OPD | OPD appears in OPD history (getAll) | |
| 4.6 | Inventory-UI → Medicine dispense view / Beneficiary drug issue report | The OPD dispense is listed | |

## 5. Low Stock Report (laptop)
| # | Step | Expected | Result |
|---|---|---|---|
| 5.1 | Inventory-UI → Reports → **Low Stock Report** 📷 | Items with stock ≤ Min Stock listed as **Low stock**; stock 0 as **Out of stock**; lowest first | |
| 5.2 | Item with no Min Stock and stock > 0 | Not listed | |
| 5.3 | Dispense until an item reaches 0 → Refresh | Item shows **Out of stock** | |
| 5.4 | Download (Excel) | File has Store, Item, Min Stock, Quantity In Hand, Status | |
| 5.5 | Labels in Hindi / Assamese (change language) | Report title and columns translated | |

## 6. Sync to central
| # | Step | Expected | Result |
|---|---|---|---|
| 6.1 | Keep the laptop online **30 min** (no button) | Automatic upload runs | |
| 6.2 | MMU-UI → Data Sync → **Automatic Sync** tab 📷 | Last upload time shown; "None" under records central did not accept | |
| 6.3 | Central (Inventory-UI on central, store 424) or DB check | Same OPD dispense and same stock as the laptop | |
| 6.4 | Disconnect internet, do an OPD, reconnect, wait 30 min | Record reaches central; nothing lost | |
| 6.5 | Press **Upload** manually while online | Works as before | |
| 6.6 | Low Stock Report on **central** for store 424 | Same items as the laptop (as of the last upload) | |

## 7. Refill (indent)
| # | Step | Expected | Result |
|---|---|---|---|
| 7.1 | Laptop: Indent request for a low-stock item | Saved | |
| 7.2 | Upload → central store keeper issues the indent | Issued | |
| 7.3 | Laptop: Inventory Data Download → Receive indent | Stock increases; item leaves the Low Stock Report | |

## 8. DB checks (for the developer / tester with DB access)
```sql
-- laptop: van linked to its store, masters present
SELECT VanID, FacilityID FROM db_iemr.m_van WHERE VanID = 403;            -- FacilityID 424
SELECT COUNT(*) FROM db_iemr.m_itemfacilitymapping WHERE FacilityID = 424 AND Deleted = 0;
-- laptop: nothing left to upload after sync
SELECT COUNT(*) FROM db_iemr.t_patientissue WHERE Processed <> 'P' AND SyncFacilityID IS NOT NULL;   -- 0
-- central: stock of the camp store
SELECT ItemID, SUM(QuantityInHand) FROM db_iemr.t_itemstockentry WHERE FacilityID = 424 AND Deleted = 0 GROUP BY ItemID;
```

## 9. Summary (fill at the end)
| Section | Pass | Fail | Notes |
|---|---|---|---|
| 1 Threshold | | | |
| 2 Masters | | | |
| 3 Camp stock | | | |
| 4 Dispensing | | | |
| 5 Low Stock Report | | | |
| 6 Sync | | | |
| 7 Refill | | | |

Tester: ____________ Date: ____________ Build/versions checked: ☐
