Overview
The requisition management system is the core feature of the Procurement Calendar application. It provides a comprehensive workflow for tracking procurement orders from initial request through delivery and receipt. Each requisition captures detailed information about products, suppliers, delivery schedules, and order status.Requisition Lifecycle
Requisitions flow through multiple states during their lifecycle:Pending
Initial state when a requisition is created. The order has been placed but not yet confirmed by the supplier.
Confirmed
Supplier has confirmed the order and committed to a delivery date. The
fecha_confirmada field is populated.In Transit
Order has been shipped and is en route to the destination. Tracking information may be available.
Status transitions are managed through the
estatus catalog, which includes color-coded badges for visual identification:- Pendiente (Orange
#F59E0B) - Confirmado (Blue
#3B82F6) - En Tránsito (Purple
#8B5CF6) - Recibido (Green
#10B981) - Cancelado (Red
#EF4444) - En Revisión (Orange
#F97316)
Data Structure
Each requisition contains the following core fields:Required Fields
| Field | Type | Description |
|---|---|---|
fecha_recepcion | Date | Date the requisition was received/created |
proveedor_id | UUID | Reference to supplier from catalog |
producto_id | UUID | Reference to product from catalog |
presentacion_id | UUID | Product presentation (e.g., “Tambor 200 L”, “Saco 25 kg”) |
destino_id | UUID | Delivery destination/location |
estatus_id | UUID | Current status of the requisition |
cantidad_solicitada | Numeric | Quantity ordered (must be > 0) |
unidad_cantidad_id | UUID | Unit of measure (kg, L, pzs, etc.) |
Optional Fields
| Field | Type | Description |
|---|---|---|
numero_oc | Text | Purchase order number (e.g., “GG-01000”) |
requisicion_numero | Text | Internal requisition number (e.g., “F0000”) |
fecha_oc | Date | Date purchase order was issued |
fecha_solicitada_entrega | Date | Requested delivery date |
fecha_confirmada | Date | Confirmed delivery date from supplier |
fecha_entregado | Date | Actual delivery date |
cantidad_entregada | Numeric | Actual quantity delivered |
factura_remision | Text | Invoice or delivery note number |
comentarios | Text | Additional notes or instructions |
The requisition structure is defined in
types/index.ts:54-83 and enforced at the database level with foreign key constraints and check constraints.Creating Requisitions
Only users with admin or coordinadora roles can create requisitions.Using the Form Modal
TheRequisicionFormModal component provides a comprehensive form with three sections:
Section 1: Requisition Data
Server Action
Editing Requisitions
Requisitions can be edited by admin and coordinadora users. The system automatically tracks all changes in an audit trail.Update with Audit Trail
requisiciones_historial table:
Deleting Requisitions
Only admin users can delete requisitions. Deletion is permanent and cascades to the audit trail.Querying Requisitions
Retrieve requisitions with optional filtering:Available Filters
Joined Relations
All queries automatically join related catalog data:Search and Filter UI
TheFilterBar component provides a user-friendly interface for filtering requisitions:
- Multi-select filtering by supplier, destination, and status
- Date range selection
- Clear all filters button
- Real-time updates
Table View
The requisitions table displays comprehensive information with sorting and actions: Key Features:- Automatically sorts received items to bottom
- Color-coded status badges
- Calculated pending quantity (cantidad_solicitada - cantidad_entregada)
- View and edit actions based on user role
- Responsive design with horizontal scroll
- № Requi (requisition number)
- Fecha Rec. (reception date)
- FOLIO OC (purchase order number)
- Proveedor (supplier)
- Producto (product with quantity and presentation)
- Fecha Sol. (requested date)
- Fecha Conf. (confirmed date)
- Cant. Ent. (delivered quantity)
- F. Entrega (delivery date)
- Cant. Pend. (pending quantity)
- Estatus (status badge)
- Destino (destination)
- Acciones (view/edit buttons)
View Details
All users can view requisition details including full history and comments
Edit
Admin and coordinadora roles can edit existing requisitions
View Audit History
Retrieve the change history for a requisition:- Field that was modified
- Previous and new values
- User who made the change
- Timestamp of the change
- User profile information (nombre_completo, rol)
Permission Summary
Admin
- Create requisitions
- Edit all fields
- Delete requisitions
- View all history
Coordinadora
- Create requisitions
- Edit all fields
- View history
- Cannot delete
Consulta
- View requisitions
- Read-only access
- No modifications
Best Practices
When to use each date field
When to use each date field
- fecha_recepcion: When the order request was received internally
- fecha_oc: When the official purchase order was issued
- fecha_solicitada_entrega: When you want delivery to occur
- fecha_confirmada: When the supplier confirms they can deliver
- fecha_entregado: When the products actually arrived
Managing partial deliveries
Managing partial deliveries
When a supplier delivers less than requested:
- Update
cantidad_entregadawith actual amount received - Set
fecha_entregadoto actual delivery date - The table automatically calculates and displays pending quantity
- Optionally create a new requisition for the remaining amount
Status workflow recommendations
Status workflow recommendations
- Start with Pendiente when creating requisition
- Move to Confirmado once supplier confirms (set fecha_confirmada)
- Update to En Tránsito when supplier ships
- Change to Recibido when delivered (set fecha_entregado)
- Use En Revisión if there are quality or documentation issues
- Use Cancelado if order is cancelled before delivery
