# Gas & utilities, biomedical maintenance, analytics and subscription billing

## Medical gas & utilities
Menu **Gas & utilities** (separate from cold chain). Add a monitoring point with kind:

| Kind | Readings (default limits warn / critical) |
|---|---|
| Medical gas manifold / pipeline | O₂, medical air pressure 3.8–4.6 / 3.5–5.0 bar · N₂O pressure · suction vacuum ≥ 50 / 40 kPa · cylinder manifold ≥ 40 / 20 bar |
| Liquid oxygen tank / PSA plant | LMO level ≥ 30 / 15 % · O₂ purity ≥ 93 / 90 % |
| Power / UPS / DG | mains voltage 210–245 / 200–255 V · load kW · UPS battery ≥ 50 / 25 % · DG fuel ≥ 40 / 20 % |
| Water | tank level ≥ 30 / 15 % |
| HVAC | chiller temp 5–9 / 4–12 °C · CO₂ ≤ 1000 / 1500 ppm |

Readings come through the edge gateway (Modbus TCP/RTU from transducers, tank gauges, energy meters, DG controllers — most have
Modbus or 4–20 mA → Modbus converters) or MQTT, or `POST /api/v1/readings` with `"location": {"name": "<monitoring point>"}`.
Pressures accept bar, psi, kPa, MPa. Out-of-range values raise the same excursion alerts as cold chain (routing: *Cold chain / room
excursions go to*). For levels (LMO, DG fuel, water, UPS, cylinders) the board shows **time to critical**: least-squares trend of
the last 24 h projected to the critical low limit. Not a replacement for HTM 02-01 / IS 7396 area alarm panels.

## Biomedical maintenance
* **Report a problem** on any device page (or + Work order): breakdown, priority, "device is out of service". A breakdown of a
  high-criticality device raises a critical *maintenance* alert to *device alert roles* (and escalation trees).
* Work order numbers `WO-YYYY-NNNN`; status open → assigned → in progress → waiting for parts → completed / cancelled; assignee,
  vendor, due date, resolution, parts, cost, service certificate (upload to device documents as *certificate*).
* Out of service: device status *maintenance* (shown on floor map, not assignable) from `down from` until completion; downtime =
  down_from → down_to.
* **Plans** (PPM, calibration, electrical safety, QA) per device or for a whole category with interval and first due date. The
  worker creates the work order `maint_lead_days` (default 7) before due and raises an *overdue* warning after the due date.
  Completing a plan's work order rolls `next_due` forward by the interval and updates calibration due.
* **Uptime report**: per device — breakdowns, downtime hours, uptime % for any period/category; averages for all and for
  high-criticality equipment; MTTR. CSV export.
* Device fields added: criticality (low/medium/high), cost, AMC vendor.

## Analytics & scheduled reports
**Analytics** (7 / 30 / 90 days, printable): critical alerts handled ≤ 15 min, median acknowledgement, escalations, phone
acknowledgements, high NEWS2, RPM adherence per programme, nurse call response by ward and per day, equipment uptime, MTTR, PPM
on time, open/overdue work orders, cold chain & utilities time in range, location tags and security alerts, teleconsults.
**Settings → Scheduled reports**: management, clinical, nurse call, cold chain, maintenance; daily / weekly / monthly at a chosen
hour to any e-mail addresses; *Send now* for testing. Sent through the platform's e-mail provider (SES / SMTP).

## Subscription billing & usage metering (Level 1)
* **Daily usage snapshot** per client (worker, once a day): active patients, devices, gateways online, readings, alerts, users,
  occupied beds, live-waveform beds, active tags, WhatsApp / SMS / e-mail sent, voice calls, consults.
* **Plans**: base price per patient / bed / device / flat, included WhatsApp messages and voice calls, add-on prices per waveform
  bed and per RTLS tag, price per extra message / call.
* **Client billing fields**: GSTIN, billing address & e-mail, state (for tax), unit price override, minimum units, billing start
  (pro-rated first month).
* **Invoice lines**: base (units = average active patients / licensed beds / average devices / 1, never below minimum) ×
  rate, pro-rated by billing start; add-ons on average waveform beds and active tags; WhatsApp and voice above the allowance.
* **GST**: client in seller's state → CGST + SGST; other Indian state → IGST; outside India → no GST with LUT note. Rate and SAC from
  Level 1 → Settings → Invoicing (**confirm SAC and LUT with your CA**). Total rounded to the rupee, amount in words (Indian system).
* **Flow**: Level 1 → Billing → *Draft invoices* for a month (all clients or one) → check → **Issue** (number
  `PREFIX/2026-27/0001`, sequence per financial year April–March, due date = payment terms, e-mailed to billing e-mail with a
  link) → **Mark paid** (reference) or **Void**. With *auto-draft* on, the worker drafts last month's invoices on the 1st–5th.
* Hospital admins see **Subscription** (plan, this month's usage, estimate, issued/paid invoices with print / PDF).
* Online payment: set a payment link (Razorpay / PayU / OjasPay payment page) — shown on issued invoices. Gateway webhooks for
  automatic *paid* marking are not built yet.
