Skip to main content

Raw Material Kardex

The Raw Material Kardex API allows you to track all inventory movements for raw materials. It records transactions such as purchases, usage in production, returns, adjustments, and other material movements.

Endpoints

POST /api/pos/kardexmp

Create a new raw material kardex transaction.
mp_codigo
string
required
Raw material code
trn_cod
string
required
Transaction code (e.g., ‘COM’ for purchase, ‘CON’ for consumption)
krd_mp_cantidad
number
required
Transaction quantity
krd_mp_obs
string
Observation or notes for the transaction
krd_mp_fecha
string
Transaction date (ISO 8601 format)

Response

Returns 201 Created on success.
cURL
curl -X POST "http://localhost:3000/api/pos/kardexmp" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mp_codigo": "MP001",
    "trn_cod": "COM",
    "krd_mp_cantidad": 50,
    "krd_mp_obs": "Purchase order #789"
  }'
{
  "krd_mp_codigo": "KMP001",
  "message": "Kardex de materia prima creado exitosamente"
}

GET /api/pos/kardexmp

Get all raw material kardex transactions with pagination.
page
number
Page number for pagination (default: 1)

Response

page
number
Current page number
limit
number
Number of items per page
count
number
Total count of kardex records
data
array
Array of kardex transaction objects
cURL
curl -X GET "http://localhost:3000/api/pos/kardexmp?page=1" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "page": 1,
  "limit": 20,
  "count": 320,
  "data": [
    {
      "krd_mp_codigo": "KMP001",
      "mp_codigo": "MP001",
      "mp_descripcion": "Mozzarella Cheese",
      "unidad_medida": "KG",
      "trn_cod": "COM",
      "trn_descripcion": "Compra",
      "krd_mp_cantidad": 50,
      "krd_mp_fecha": "2024-03-15T08:00:00.000Z",
      "krd_mp_obs": "Purchase order #789",
      "saldo": 150
    },
    {
      "krd_mp_codigo": "KMP002",
      "mp_codigo": "MP001",
      "mp_descripcion": "Mozzarella Cheese",
      "unidad_medida": "KG",
      "trn_cod": "CON",
      "trn_descripcion": "Consumo",
      "krd_mp_cantidad": 2.5,
      "krd_mp_fecha": "2024-03-15T10:30:00.000Z",
      "krd_mp_obs": "Used in production batch #123",
      "saldo": 147.5
    }
  ]
}

GET /api/pos/kardexmp/search

Search kardex transactions by raw material name.
name
string
required
Raw material description to search for
page
number
Page number for pagination (default: 1)

Response

page
number
Current page number
limit
number
Number of items per page
count
number
Total count of matching kardex records
data
array
Array of matching kardex transaction objects
cURL
curl -X GET "http://localhost:3000/api/pos/kardexmp/search?name=Cheese&page=1" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "page": 1,
  "limit": 20,
  "count": 15,
  "data": [
    {
      "krd_mp_codigo": "KMP001",
      "mp_codigo": "MP001",
      "mp_descripcion": "Mozzarella Cheese",
      "trn_cod": "COM",
      "krd_mp_cantidad": 50,
      "krd_mp_fecha": "2024-03-15T08:00:00.000Z"
    }
  ]
}

GET /api/pos/kardexmp/:id

Get a specific raw material kardex transaction by ID.
id
string
required
Kardex record ID

Response

kardex
object
Kardex transaction object with all details
cURL
curl -X GET "http://localhost:3000/api/pos/kardexmp/KMP001" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "krd_mp_codigo": "KMP001",
  "mp_codigo": "MP001",
  "mp_descripcion": "Mozzarella Cheese",
  "unidad_medida": "KG",
  "trn_cod": "COM",
  "trn_descripcion": "Compra",
  "krd_mp_cantidad": 50,
  "krd_mp_fecha": "2024-03-15T08:00:00.000Z",
  "krd_mp_obs": "Purchase order #789",
  "saldo": 150,
  "costo_unitario": 8.50
}

PUT /api/pos/kardexmp/:id

Update an existing raw material kardex transaction.
id
string
required
Kardex record ID to update
mp_codigo
string
Raw material code
trn_cod
string
Transaction code
krd_mp_cantidad
number
Transaction quantity
krd_mp_obs
string
Observation or notes
krd_mp_fecha
string
Transaction date (ISO 8601 format)

Response

message
string
Success message
cURL
curl -X PUT "http://localhost:3000/api/pos/kardexmp/KMP001" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "krd_mp_cantidad": 55,
    "krd_mp_obs": "Updated quantity - Purchase order #789"
  }'
{
  "message": "Kardex de materia prima actualizado exitosamente"
}

DELETE /api/pos/kardexmp/:id

Delete a raw material kardex transaction by ID.
id
string
required
Kardex record ID to delete

Response

Returns 204 No Content on success.
cURL
curl -X DELETE "http://localhost:3000/api/pos/kardexmp/KMP001" \
  -H "Authorization: Bearer YOUR_TOKEN"

Transaction Types

Common transaction codes used in the Raw Material Kardex:
  • COM: Compra - Purchase/incoming transaction
  • CON: Consumo - Consumption/usage in production
  • DEV: Devolución - Return transaction
  • AJU: Ajuste - Inventory adjustment
  • MER: Merma - Wastage/loss
The kardex automatically calculates running balances (saldo) based on the transaction type and quantity.

Build docs developers (and LLMs) love