Overview
The stock operations module tracks all inventory movements in your store, providing a complete audit trail of stock level changes. Every movement records what product was affected, the quantity, the type of operation, and which employee authorized it.Types of Stock Movements
The system supports three types of inventory operations:Entrada
- New merchandise arrives
- Returns from customers
- Transfers from other locations
Salida
- Products are sold
- Items are transferred out
- Returns to suppliers
Ajuste
- Physical count discrepancies
- Damaged goods removal
- Lost or found items
Accessing Stock Operations
Navigate to the Movimientos de Inventario page (movimientos.php) from the main navigation menu.
Interface Layout
The page consists of:- Quick-add form (top): Horizontal form for registering new movements
- Movement history table (below): Chronological list of all movements (newest first)
Registering a Stock Movement
Select the product
- All products currently in the system
- Product names only (not IDs)
- Loaded from the
prendatable
Select the movement type
- Use when stock is increasing
- Adds quantity to
stock_actual - Displayed in green in the history table
- Use when stock is decreasing
- Subtracts quantity from
stock_actual - Displayed in red in the history table
- Use for corrections or inventory reconciliation
- Can increase or decrease stock (based on quantity sign)
- Displayed in red in the history table
Enter the quantity
- Enter positive numbers only
- The system automatically adds or subtracts based on movement type
- Example:
10for 10 units
- Enter positive or negative numbers
- Positive increases stock:
+5or5 - Negative decreases stock:
-3
Select the authorizing employee
How Stock Updates Work
Automatic Stock Calculation
When you register a movement, the system automatically updates the product’s current stock:Movement Type Logic
| Movement Type | Operator | Effect on Stock |
|---|---|---|
| entrada | + | Increases stock_actual by quantity |
| salida | - | Decreases stock_actual by quantity |
| ajuste | + | Adds quantity (can be negative) to stock_actual |
Examples
Example 1: Stock Entry- Product: Camisa Oxford (current stock: 10)
- Type: entrada
- Quantity: 20
- Result:
10 + 20 = 30(new stock)
- Product: Pantalón Mezclilla (current stock: 50)
- Type: salida
- Quantity: 5
- Result:
50 - 5 = 45(new stock)
- Product: Vestido Floral (current stock: 15)
- Type: ajuste
- Quantity: 3
- Result:
15 + 3 = 18(corrected stock after physical count found 3 extra units)
- Product: Bufanda Lana (current stock: 25)
- Type: ajuste
- Quantity: -2
- Result:
25 + (-2) = 23(corrected stock after 2 damaged units removed)
Viewing Movement History
The movement history table displays all operations in reverse chronological order (newest first).Table Columns
| Column | Description |
|---|---|
| Fecha | Date and time of the movement (YYYY-MM-DD HH:MM:SS) |
| Prenda | Product name |
| Tipo | Movement type (ENTRADA, SALIDA, or AJUSTE) in uppercase, color-coded |
| Cant. | Quantity (number of units) |
| Empleado | Employee who authorized the movement |
Color Coding
Movement types are color-coded for quick visual identification:- ENTRADA: Green text (
text-successclass) - SALIDA: Red text (
text-dangerclass) - AJUSTE: Red text (
text-dangerclass)
Query Behind the Table
Movement Validation and Constraints
Current Limitations
Example of what’s allowed but shouldn’t be:- Current stock: 5 units
- Record salida: 10 units
- Result: -5 units (negative stock!)
Best Practices to Avoid Negative Stock
Check current stock before recording exits
Use adjustments for corrections
Implement physical stock checks
Future Enhancement Recommendations
The system could be improved with:Common Use Cases
Receiving new merchandise from supplier
Receiving new merchandise from supplier
- First, register the reception (if not already done):
- Go to Recepciones de Mercancía (
registros.php) - Record which product, employee, and supplier
- Go to Recepciones de Mercancía (
- Then, record the stock entry:
- Go to Movimientos de Inventario (
movimientos.php) - Select the product
- Choose entrada as type
- Enter the quantity received
- Select the receiving employee
- Click Registrar
- Go to Movimientos de Inventario (
Recording a sale (manual stock reduction)
Recording a sale (manual stock reduction)
- Navigate to Movimientos de Inventario
- Select the product sold
- Choose salida as type
- Enter the quantity sold
- Select the employee who processed the sale
- Click Registrar
Conducting a physical inventory count
Conducting a physical inventory count
- Perform physical count: Count actual units for each product
- Compare with system stock: Check current
stock_actualin the inventory page - Record adjustments for discrepancies:
- Go to Movimientos de Inventario
- Select the product
- Choose ajuste as type
- Calculate the difference:
- If physical > system: Enter positive number (e.g.,
+5) - If physical < system: Enter negative number (e.g.,
-3)
- If physical > system: Enter positive number (e.g.,
- Select the auditing employee
- Click Registrar
- System shows: 50 units
- Physical count: 47 units
- Difference: -3
- Record adjustment: ajuste with quantity
-3
Removing damaged or defective items
Removing damaged or defective items
- Navigate to Movimientos de Inventario
- Select the damaged product
- Choose ajuste as type (not salida)
- Enter negative quantity (e.g.,
-2for 2 damaged units) - Select the employee who identified/removed the items
- Click Registrar
Transferring stock between locations (future enhancement)
Transferring stock between locations (future enhancement)
- Record a salida for the transferred quantity
- Note in a separate log: “Transfer to [Location Name]”
- Record an entrada for the received quantity
- Note in a separate log: “Transfer from [Location Name]”
Troubleshooting
Stock level doesn't match expected value after movement
Stock level doesn't match expected value after movement
- Wrong movement type selected:
- You selected entrada but meant salida (or vice versa)
- Solution: Record a correcting ajuste with opposite quantity
- Incorrect quantity entered:
- You entered 100 instead of 10
- Solution: Calculate the difference and record an ajuste
- Multiple movements not visible:
- Several users recorded movements simultaneously
- Solution: Review the full movement history table
- Direct database edit:
- Someone modified stock_actual directly in the database
- Solution: Perform physical count and use ajuste to correct
Negative stock levels in inventory
Negative stock levels in inventory
- Check the movement history for that product
- Look for large salida entries that exceeded available stock
- Identify when the stock went negative
- Perform a physical count to determine actual stock
- Record an ajuste to set stock to the correct value:
- Current stock: -5
- Actual count: 0
- Adjustment: +5
Cannot find product in dropdown
Cannot find product in dropdown
- Verify the product exists: Go to the inventory page and search for it
- Create the product if missing: Use Nueva Prenda to add it
- Refresh the movements page: After creating the product, refresh movimientos.php
- Check database: Query the
prendatable to confirm the product exists
Employee doesn't appear in dropdown
Employee doesn't appear in dropdown
- Verify employee exists: Go to Gestión de Empleados
- Create employee if missing: Use the registration form
- Refresh the movements page: After creating, refresh movimientos.php
- Check for JavaScript errors: Open browser console (F12)
Movement recorded but doesn't appear in history
Movement recorded but doesn't appear in history
- Check for error messages: Look at the top of the page
- Verify database insertion: Check if the record exists in
movimiento_stocktable - Check date/time: Ensure your server’s clock is correct (movements sort by fecha)
- Refresh the page: Try a hard refresh (Ctrl+F5 or Cmd+Shift+R)
- Review query: The table uses a JOIN query that might fail if related records are missing
Need to reverse a movement (undo)
Need to reverse a movement (undo)
- Identify the incorrect movement in the history table
- Note its type, product, and quantity
- Record a new movement with the opposite effect:
- If original was entrada of 10: Record salida of 10
- If original was salida of 5: Record entrada of 5
- If original was ajuste of +3: Record ajuste of -3
Integration with Other Modules
Product Management Integration
Stock movements directly update thestock_actual field in the prenda table:
index.php), the stock column displays this updated value.
Merchandise Reception Integration
While movements and receptions are related, they’re recorded separately:- Recepciones de Mercancía (
registros.php): Tracks WHAT was received, from WHICH supplier, by WHICH employee - Movimientos de Inventario (
movimientos.php): Updates the actual stock count
Employee Audit Integration
Every movement links to an employee viaid_empleado:
Related Features
Managing Products
Managing Employees
Database Schema
Best Practices
Always verify stock before exits
Use descriptive employee names
Use the correct movement type
- entrada: When stock physically arrives
- salida: When stock physically leaves (sales, transfers out)
- ajuste: For corrections, damaged goods, or reconciliation
Document adjustments externally
Regular physical counts
- Weekly for high-turnover items
- Monthly for standard items
- Quarterly for slow-moving items
Review movement history regularly
- Unusual patterns (many adjustments for one product)
- Frequent negative corrections (indicates process issues)
- High volume of movements by one employee (potential audit flag)