Overview
The Inventory Management module provides comprehensive control over dental supplies, materials, and clinic inventory. It tracks stock levels, generates low-stock alerts, and records all inventory transactions (entries and exits).Access requires
VIEW_INVENTORY permission. Transaction management requires MANAGE_INVENTORY permission.Key Metrics
The inventory page displays three critical statistics:Stock Bajo
Count of items at or below minimum stock threshold
Artículos
Total number of inventory items tracked
Valor Total
Total inventory value (stock × price) in DOP
Inventory Items
Item Properties
Each inventory item contains:| Field | Type | Description |
|---|---|---|
id | number | Unique inventory item ID |
name | string | Material/supply name |
description | string | Technical observations |
category | string | Item category (e.g., “Resinas”, “Instrumental”) |
unit | string | Unit of measure (“unidades”, “ml”, “cajas”) |
stock | number | Current stock quantity |
min_stock | number | Minimum threshold for alerts |
price | number | Unit cost in DOP |
Status Indicators
- Reorden Requerido
- Suficiente
Red badge - Displayed when
stock <= min_stockIndicates immediate reorder required. Items with this status appear with:- Red background tint (
#fffafb) - Alert pulse animation
- 6px left border accent
Core Features
Add New Material
Admins can register new inventory items using the ”➕ Nuevo Material” button. Form Fields:Required Information
Required Information
- Nombre del Material: Item name (e.g., “Resina A2 Filtek”)
- Categoría: Classification (default: “General”)
- Unidad de Medida: Unit type (default: “unidades”)
- Costo Unitario: Price per unit in DOP
- Alerta de Stock Mínimo: Minimum threshold quantity
- Observaciones Técnicas: Optional description
sp_create_inventory_item stored procedure.
Stock Transactions
Inventory movements are tracked through two transaction types:📥 Entrada
Entry TransactionRecords incoming inventory (purchases, restocks)
- Increases stock level
- Tracks supplier reference
- Logs date and user
📤 Salida
Exit TransactionRecords outgoing inventory (usage, consumption)
- Decreases stock level
- Documents usage reason
- Links to procedures (optional)
Transaction Workflow
API Call:
sp_update_stock(id, type, quantity, notes, user_id) procedure.
Data Display
The inventory module uses theDataTable component with two view modes:
Table View
- Columns
- Row Styling
- Material: Item name with category avatar
- Estado: Status badge (Reorden/Suficiente)
- Stock Actual: Current quantity with units
- Acciones: Entry/exit transaction buttons
Grid View (Mobile)
Compact card layout showing:- Category tag
- Item name
- Current stock (large display)
- Minimum threshold
- Unit price (formatted currency)
- Transaction buttons
API Endpoints
List Inventory
VIEW_INVENTORY permission
Response:
/src/routes/api/inventory/+server.jsProcedure:
sp_list_inventory()
Create Item
MANAGE_INVENTORY permission
Body: Item properties (name, description, category, unit, min_stock, price)
Response:
sp_create_inventory_item(name, description, category, unit, min_stock, price, user_id)
Update Stock
MANAGE_INVENTORY permission
Body:
sp_update_stock(id, type, quantity, notes, user_id)
Low Stock Alerts
The system automatically generates alerts when inventory items reach critical levels:Alert Calculation
- Display “Reorden Requerido” badge
- Show red stock values
- Appear with alert styling in both table and grid views
Currency Formatting
All prices display in Dominican Peso (DOP) format:Usage Examples
Example 1: Register New Supply
Example 2: Record Stock Entry
Example 3: Record Stock Exit
Related Pages
Dashboard
View low stock alerts on main dashboard
Reports
Analyze inventory trends and costs
