SolvexaRetail
Manual ยท Pharma POS
All TopicsBack to app

๐Ÿ’Š Pharmacy

Dedicated POS surface ยท Batch + expiry (FEFO) ยท Rx upload + OCR + auto-cart ยท Multi-batch split ยท Shelf lookup ยท Insurance claims

๐Ÿ’Š Dedicated Pharmacy POS โ€” /Pharma/PharmacyPOS

Pharmacies have their OWN POS surface, visually + functionally distinct from Retail / Hospitality / Kiosk. Health-green branding, 3-column layout with Patient panel ยท Cart ยท Rx panel, and Shelf ยท Batch ยท Expiry as first-class columns on every cart line.

  1. Set the terminal type: /POS/POSTerminal โ†’ edit terminal โ†’ Terminal Type = ๐Ÿ’Š Pharmacy POS โ†’ Save.
  2. Download the launcher .bat (purple ๐Ÿ“ฅ button on the terminal card) and drop on the cashier PC's Desktop.
  3. Double-click the .bat โ†’ the Launch endpoint sees TerminalType='Pharma' and 302s to /Pharma/PharmacyPOS in full-screen kiosk mode.
๐Ÿ’ก Server logic is 100% shared with Retail POS โ€” same endpoints for scan, add, tender, GST, EOD. Only the UI is different. You can also open /Pharma/PharmacyPOS directly in a browser (needs auth + store's PharmacyMode=1).

Overlay on Retail POS (legacy fallback)

A pharmacy sells prescription drugs AND everyday goods (toothpaste, Maggi, beauty products) in the SAME bill. Solvexa handles this as an overlay on the standard Retail POS โ€” no separate pharmacy POS surface. The retail cart, tender, receipt, GRN, transfer, return โ€” all unchanged.

What the pharma overlay adds (only at stores with Pharmacy Mode on):

๐Ÿ’ก One tenant can have (supermarket store) + (restaurant) + (pharmacy counter) all together. Only the pharmacy store shows the batch picker + Upload Rx button. Other stores see pure retail POS.

Setup checklist

  1. Turn on Pharmacy Mode on the store โ€” see below
  2. Flag the drug items with pharma fields โ€” see below
  3. Get batches in โ€” GRN with Batch # + Expiry, OR manual add at /Pharma/Batches
  4. Ring a sale at Retail POS โ€” batch picker pops for pharma items, Upload Rx button appears bottom-right

Store: Pharmacy Mode toggle

Pharmacy Mode is a per-store flag. Turn it on for the stores that dispense drugs; leave it off for pure-retail stores.

  1. Go to /Stores/StoreList โ†’ click the store you want as a pharmacy
  2. Scroll to the toggles row (below Manager/Phone)
  3. Toggle ๐Ÿฉบ Pharmacy? to Yes
  4. Save
๐Ÿ’ก Cashiers who swipe in at THIS store see pharma UI. Cashiers at other stores in the same tenant see none of that โ€” pure retail POS. Runtime decision is fresh on every swipe.

Drug master โ€” Item form's ๐Ÿฉบ Pharma tab

Every drug is a standard Item. The pharma-specific fields live on a dedicated ๐Ÿฉบ Pharma tab on the item form.

  1. /Items/ItemForm โ†’ open the item (or ๏ผ‹ New)
  2. Click the ๐Ÿฉบ Pharma tab (between "More" and "Dimensions")
  3. Toggle Requires prescription โ€” warns cashier + suggests Rx upload when this item is added
  4. Toggle Is Schedule H โ€” the KEY flag. Enables the FEFO batch picker for this item.
  5. Pick Schedule class โ€” H, H1, X, G, K, or blank for OTC
  6. Fill Generic name (Paracetamol), Manufacturer (GSK / Cipla), Pack size (10 tabs / 30ml syrup)
  7. Set Min expiry days โ€” batches expiring within this window show a red warning in the picker (default 30)
  8. Save
๐Ÿ’ก Generic name is what powers Rx OCR matching. If the OCR extracts "Paracetamol", the LIKE match hits any Item where GenericName contains "Paracetamol".

/Pharma/Batches admin page

All PharmaBatchLot rows in one place. Filter, add manually, deactivate.

๐Ÿ’ก Batches typically appear here AUTOMATICALLY after a GRN is posted โ€” the GRN's Batch # + Expiry auto-upserts a PharmaBatchLot row. You only use this page for corrections and opening balances.

Batch picker โ€” qty-aware + multi-batch split

When a cashier adds a pharma-flagged item, a picker modal pops with a Requested vs Total Available banner. Every batch shows a status pill:

All batches sorted FEFO (earliest expiry at top). Near-expiry rows show a red badge (within Item.MinExpiryDays).

Multi-batch split (need 15, batches have 5 + 8 + 10)

  1. Pick batch A (5 left) โ†’ cart gets a line for 5 units stamped with batch A
  2. Toast: "Took 5 from A. 10 more needed โ€” pick another batch."
  3. Picker re-opens automatically with batch A hidden + Requested = 10
  4. Pick batch B (8 left) โ†’ line for 8 units with batch B โ†’ toast for 2 more needed
  5. Pick batch C (10 left) โ†’ line for 2 units with batch C

Result: 3 cart lines for the same item, each with its own batch stamp. Perfectly auditable at Refund + EOD reporting.

๐Ÿ’ก If all batches combined don't cover the ask, picker refuses upfront ("Only 13 units available across all batches") โ€” no partial add.
๐Ÿ’ก Non-pharma items (toothpaste, Maggi) never trigger the picker.

Upload Rx (prescription) + OCR

Purple ๐Ÿ“„ Upload Rx button floats bottom-right of POS. Tap it to attach a prescription to the current bill.

  1. Tap ๐Ÿ“„ Upload Rx โ†’ phone camera or file picker (JPG / PNG / WebP / PDF)
  2. Server receives image โ†’ compresses to ~250 KB JPEG (max 1600px) โ†’ stores at App_Data/Prescriptions/<CompanyID>/<yyyyMM>/<id>.jpg
  3. Server runs OCR (Tesseract โ†’ LLM extract) โ†’ returns list of drugs with name, strength, dosage, duration, qty
  4. Modal opens: Rx image on left, extracted drugs on right with 1-tap "Add to cart" against matching items
  5. Tap the buttons for the drugs you want to dispense โ€” each add triggers the FEFO batch picker
  6. On tender complete, the Rx auto-links to the bill (POSTransaction.RxID + PharmaPrescription.LinkedBillID + Status="Filled")
  7. Receipt footer prints "Rx: RX-2026-00042"
๐Ÿ’ก Rx files are NEVER served via static path. Only accessible via authenticated ?handler=RxFile which enforces same-tenant CompanyID. Cross-tenant leak-proof.

Item flag: Allow Negative-Stock Sales

Every Item has a toggle (Item form โ†’ Flags โ†’ Allow Negative-Stock Sales). Default OFF โ€” POS refuses any sale that would drive stock at this store below zero.

โš  Cashier sees: Item PARA500 has only 3 in stock at this store; line needs 15. Reduce line qty, receive stock, or tick the item's "Allow negative-stock sales" option. โ€” Sale rolls back cleanly.

Tick ON per-item for services, made-to-order items, back-orders where you accept payment before receiving stock, or composite items that unpack via BOM at EOD.

Pre-tender validation โ€” catches batch errors before Pay

The moment you tap PAY on a bill with any pharma line, the browser calls ?handler=ValidatePharmaLines. Server re-checks every batch stamp against live PharmaBatchLot state (exists, active, not expired, correct item, enough qty). If ANY issue โ†’ big alert dialog listing each bad line + fix hint. Tender modal never opens. Non-pharma sales skip this round trip.

Doctor/Patient auto-detect from master

When you upload the same Rx a second time, the modal shows a green pill instead of a checkbox:

Same behavior for Patient (matches on PatientName + Phone).

Shelves + racks (schema ready, admin UI Slice C)

Migration 502 shipped foundations: PharmaShelf (shelf/rack master per store), PharmaItemShelf (multi-shelf per item, one primary), GRNLine.ShelfID (receiving records shelf). Pharmacy POS already displays the primary shelf in the SHELF cart column when set. Coming in Slice C: /Pharma/Shelves admin, item form assignment, /Pharma/Receive with mandatory shelf, "Where is X?" lookup.

Schedule-H drugs (prescription required)

Indian law: Schedule H drugs (most antibiotics, sedatives, opioids) can only be sold against a valid prescription.

Prescription (Rx) capture

  1. At POS, before scanning: Rx button (or auto-prompted for Schedule H)
  2. Enter: Doctor Name + Doctor Registration No (validated against your Doctor Master)
  3. Optional: Photo of the paper Rx (uses tablet camera). Stored as attachment.
  4. Enter Patient Name + Patient Phone (for future refill reminders)
  5. Rx auto-attaches to the bill. Every sale line tagged with Rx ID.
๐Ÿ’ก Set up your Doctor Master upfront: Pharma โ†’ Doctors โ†’ + New. Reg No, Speciality, Phone, Clinic address. Speeds up Rx capture.

Batch + expiry (FEFO)

Same drug arrives in multiple batches (different mfg + expiry). POS auto-picks the batch expiring first (FEFO = First-Expiring-First-Out).

โš  Selling expired stock is illegal. Blocking rule: POS refuses to sell any batch past expiry date. Move to Expiry Write-off instead.

Generic substitutes (offer cheaper alternative)

Doctor prescribed Crocin (branded). Cashier can offer patient the generic Paracetamol (โ‚น15 vs โ‚น35) โ€” legal and encouraged.

  1. Setup: on Item form, expand Substitutes โ†’ add generic + branded siblings sharing same composition
  2. At POS, scanning any variant shows a Substitute button with cheaper options + savings
  3. If patient accepts substitute, cashier taps it โ€” replaces original line in cart
  4. Rx record still valid (composition matches)

Ring up a pharma sale

Same POS as retail โ€” /POS/POSScreen. The overlay adds the batch picker and Upload Rx button; everything else is identical.

  1. Open /POS/POSScreen (or double-click the .bat launcher on the pharmacy terminal)
  2. Swipe / PIN in as cashier
  3. (Optional) Tap ๐Ÿ“„ Upload Rx โ†’ phone camera โ†’ OCR โ†’ 1-tap add drugs
  4. Or scan/type items directly. Pharma items trigger the FEFO batch picker; non-pharma items add straight to cart.
  5. Mix in everyday items (toothpaste, biscuits) โ€” same cart, same tender
  6. Tap Tender โ†’ pick payment mode โ†’ Complete
  7. Receipt prints โ€” footer shows Rx number if one was uploaded

Insurance / TPA (Third-Party Administrator) claims

Corporate customers, mediclaim policies โ€” patient shows the card, shop bills to the insurance company.

  1. Setup insurers: Pharma โ†’ Insurance Setup โ†’ + New. TPA name, code, discount % if applicable, GL account
  2. At POS, after scanning: tap TPA Claim
  3. Enter: TPA, Patient Policy No, Auth Code (pre-authorized by insurer), Approved Amount
  4. Split: Patient pays co-pay (โ‚น100 out of โ‚น500). Insurer pays balance (โ‚น400).
  5. Bill printed with both split. Insurer receivable posts as AR to that TPA account.
  6. Claim aging: Pharma โ†’ TPA Aging. Follow up if unpaid > 30 days.

Returns โ€” auto-restock to the same batch

๐Ÿ’ฌ Ask Saathi: "which drugs expire this month" ยท "TPA outstanding" ยท "top-selling drugs" ยท "Rx count today"