Costing in Pharmaceuticals - hmislk/hmis GitHub Wiki

Scope & Availability

The costing workflow applies to Direct Purchase and GRN when Manage Costing = true.

Key Data Entry Rules

Unit consistency. Free quantities use the same unit as received quantities. If you receive in packs, record free in packs. If you receive in units, record free in units. Discount rate. Enter as amount per unit, not a percentage or total. Example: Purchase rate 1,500; Discount rate 100 β†’ Net rate per unit 1,400.

Definitions (Line Level)

Receiving Qty = paid quantity received. Free Qty = bonus units received. Line Gross Total = Receiving Qty Γ— Purchase Rate. Line Discount Value = Receiving Qty Γ— Discount Rate. Line Net Total = Line Gross Total βˆ’ Line Discount Value. Total Units (sellable) = Receiving Qty + Free Qty. Potential Revenue = Total Units Γ— Retail Rate.

User-entered line values are never altered by bill-level calculations.

Bill-Level Allocations

Bill Discount: distributed proportionally to lines by Line Net Total share. Bill Taxes/Expenses: only items Considered for Costing are added to cost and distributed proportionally. Items Not Considered for Costing are excluded from cost (no impact on mark-up).

Costing Computation (Order of Operations)

  1. Compute each line’s Line Net Total.
  2. Allocate Bill Discount to lines (proportional to Line Net Total).
  3. Add allocated Considered for Costing taxes/expenses to lines.
  4. Per line, compute:
  • COGS (line) = Line Net Total βˆ’ Allocated Bill Discount + Allocated Considered Expenses/Taxes.
  • Cost per unit = COGS (line) Γ· Total Units.
  • Mark-up on cost (%) = [(Potential Revenue βˆ’ COGS (line)) Γ· COGS (line)] Γ— 100.

Worked Example (from GRN)

Crestor 10 mg Tablet Line Net Total: 14,000 Allocated Bill Discount: 1,266.97 β†’ interim cost 12,733.03 Allocated Transport (Considered): 316.74 β†’ COGS (line) 13,049.77 Total Units: 11; Potential Revenue: 11 Γ— 1,800 = 19,800 Gross Profit: 19,800 βˆ’ 13,049.77 = 6,750.23 Mark-up on cost: 6,750.23 Γ· 13,049.77 = 51.7%

Azee 500 mg Tablet Line Net Total: 8,100 Allocated Bill Discount: 733.03 β†’ interim cost 7,366.97 Allocated Transport (Considered): 183.26 β†’ COGS (line) 7,550.23 Total Units: 33; Potential Revenue: 33 Γ— 500 = 16,500 Gross Profit: 16,500 βˆ’ 7,550.23 = 8,949.77 Mark-up on cost: 8,949.77 Γ· 7,550.23 = 118.5%

Bill Summary (Example)

Gross Total (sum of line nets): 22,100.00 Bill Discount: βˆ’2,000.00 Bill Expenses (Considered for Costing): +500.00 Bill Taxes (Considered for Costing): as applicable Net Total (COGS, bill): 20,600.00 Bill Expenses (Not Considered for Costing): e.g., 1,500.00 (no impact on mark-up) Sale Value (Potential Revenue): 36,300.00

Cross-check: Sum of line gross profit equals Sale Value βˆ’ Net Total (COGS, bill).

Display Convention (System)

Primary metric: Mark-up on cost (%). Show alongside Net Revenue, COGS, and Gross Profit per line and for the bill. Round UI to two decimals; keep higher precision in calculations.

Notes & Validation

Keep units consistent for paid and free quantities. Allocate only amounts flagged Considered for Costing. Do not back-calculate or overwrite user-entered line rates. Ensure the grid refreshes after bill-level edits so line mark-ups reflect allocations.

References

GRN Costing Explained

[πŸ” View full-size image](https://github.com/user-attachments/assets/9db5ea28-1d54-435d-9bff-b011900eee42)

β€” [Back](https://github.com/hmislk/hmis/wiki/Pharmaceutical-Logistics)