Pharmacy Quantities Allow Fractions - hmislk/hmis GitHub Wiki

This page explains how to use fractional quantities for medicines and devices in Pharmacy workflows when enabled for an item.

This is an end‑user guide. For technical details and the full change plan, see the developer reference at:

Applies to: Pharmacy Issue (Disposals/Disbursements), Direct Purchase, GRN (receive/approval/costing), Purchase Return, GRN Return, Store Disbursement.

Overview

  • Each item (AMP/AMPP) can be marked to allow decimal (fractional) quantities.
  • When enabled for an item, quantity fields accept decimals (e.g., 0.5, 1.25).
  • When disabled (default), quantity fields accept integers only (e.g., 1, 2, 10).

When To Use

  • Use fractional quantities for items that are dispensed, purchased, or received in partial units (e.g., compounded liquids, partial vials, split packs per policy).
  • Keep integer‑only for items that must be processed as whole units (e.g., full packs, devices, single‑use items).

How To Use

  1. Make sure the item is configured:
    • Pharmacy Admin → AMP/AMPP → open item → toggle "Allow Fractions" → Save.
  2. In transaction screens (Issue, Direct Purchase, GRN, Returns):
    • Select the item/batch as usual.
    • Enter quantity:
      • If the item allows fractions: decimals are accepted.
      • If not: only whole numbers are accepted.

Understanding Messages & Behavior

  • Integer‑only items: decimal keystrokes are blocked; pasted decimals will be rejected when leaving the field.
  • Fraction‑enabled items: decimal keystrokes are accepted; calculations reflect the decimal value.
  • Any insufficient stock or general validation errors show as usual.

Best Practices

  • Always confirm the item’s “Allow Fractions” setting before large batch entries.
  • For split pack handling, align your quantity entry and units (Pack vs Unit) with departmental policy.
  • Double‑check totals when mixing fractional and integer items on the same bill.

Troubleshooting

  • I can’t enter decimals: Ensure the item’s "Allow Fractions" is enabled; reselect the item after saving.
  • Decimals accept but totals look off: Confirm you’re entering against the correct unit (Pack vs Unit) and check price/pack conversions.
  • GRN/Return fields still blocking decimals: Clear and reselect the item row; verify the admin toggle and that you’re editing the correct line.

Configuration (User Impact)

  • Where: Pharmacy Admin → AMP/AMPP → Allow Fractions toggle.
  • Default: OFF (integer‑only) for all existing items to preserve behavior.
  • Change impact: Immediately affects how quantities can be typed across pharmacy transactions for the configured item.

FAQ

  • Does this change retail sale quantities? Not in this phase. Retail pages that use integer quantities remain integer‑only.
  • Can this be item‑specific? Yes—configured per item (AMP/AMPP).
  • Is this a permission? No, it’s an item property. Usual privileges for admin access apply.

For Developers

  • Technical plan and page list: developer_docs/feature/allow-fractions-in-pharmacy.md
  • Includes: updated entities (Item), DTOs (StockDTO), JPQL builders, and the exact XHTML files changed for QA.