Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ttpullima/RomsoftBackEnd2021_v2/llms.txt

Use this file to discover all available pages before exploring further.

The pharmacy module (FAR_*) is the backbone of Gestión Clínica’s drug and medical supply inventory. Every item dispensed from the clinic’s pharmacy — prescription medications, over-the-counter drugs, surgical supplies, and medical equipment — is represented as a FAR_PRODUCTO record. Products are richly described with pricing tiers, stock thresholds, regulatory codes (GTIN / UNSPSC), and linkages to the catalog reference tables (generic name, drug class, therapeutic family, typification, and product type). The three endpoints on FAR_PRODUCTOController cover the full write lifecycle — creation, update, and retrieval — and all of them require a valid bearer token in the Authorization header.
All FAR_PRODUCTO endpoints are HTTP POST and expect a JSON body. Responses are wrapped in a JsonResponse envelope with Success (boolean), Message (string), optionally Warning (boolean), and Data (payload).

Endpoints

POST /api/FAR_PRODUCTO/Add

Creates a new pharmaceutical product and returns its generated database ID. Internally the controller maps FAR_PRODUCTOReqDTOFAR_PRODUCTOReq and calls FAR_PRODUCTOBL.Instancia.Add2(), which returns a Tuple<int, string>. When Item1 > 0 the operation succeeded and Data is set to the new product’s id_producto. If Item1 == 0 the response carries Warning: true and Message contains the server-side error text from Item2. Request body — FAR_PRODUCTOReqDTO Response
{
  "Success": true,
  "Warning": false,
  "Message": "Registro satisfactorio",
  "Data": 142
}
Data contains the integer id_producto of the newly created record.
If a business-rule validation fails (e.g., duplicate code), Success remains true but Warning is set to true and Message contains the server explanation. Check both fields before assuming success.
curl example
curl -s -X POST https://{host}/api/FAR_PRODUCTO/Add \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "id_producto": 0,
    "t_codigo": "MED-001",
    "t_descripcion": "PARACETAMOL 500MG TAB",
    "t_presentacion": "CAJA X 100 TABLETAS",
    "t_rutaimagen": "/images/meds/paracetamol.png",
    "id_tipo_producto": 1,
    "id_clase": 3,
    "id_generico": 12,
    "id_familia": 5,
    "id_tipificacion": 2,
    "c_gtin": "7750000123456",
    "c_unspsc": "51102700",
    "n_stockmin": 50,
    "n_stockmax": 500,
    "n_pcosto": 0.35,
    "n_pvf": 0.80,
    "n_utilidad": 56.25,
    "n_pvs": 0.85,
    "n_plista": 0.40,
    "f_inafecto": 0,
    "id_consignacion": 0,
    "id_laboratorio": 7,
    "id_proveedor": 15,
    "n_dscto_1": 5.00,
    "n_dscto_2": 0.00,
    "f_estado": 1,
    "n_valorizado": 1,
    "id_user_registro": 3,
    "d_fecha_registro": "2024-03-15T08:30:00"
  }'

POST /api/FAR_PRODUCTO/Update

Updates an existing pharmaceutical product record. The request body is identical to the Add endpoint (FAR_PRODUCTOReqDTO) — populate id_producto with the target record’s ID. Internally calls FAR_PRODUCTOBL.Instancia.Update2(). A successful update returns an empty Data field; Message carries "Registro satisfactorio". On failure Warning: true and the business-layer message are returned. Request body — same fields as Add (see above); id_producto must be a valid existing ID. Response (success)
{
  "Success": true,
  "Warning": false,
  "Message": "Registro satisfactorio",
  "Data": null
}

POST /api/FAR_PRODUCTO/GetById

Retrieves the full detail record for a single product by its primary key. The integer idProducto is passed as a query-string parameter on the POST request (the controller binds it from the URL, not from the JSON body). Query parameter
idProducto
int
required
The primary key of the product to retrieve (id_producto).
Response — FAR_PRODUCTOByIdResDTO curl example
curl -s -X POST "https://{host}/api/FAR_PRODUCTO/GetById?idProducto=142" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json"
Sample response
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": [
    {
      "id_producto": 142,
      "t_descripcion": "PARACETAMOL 500MG TAB",
      "t_presentacion": "CAJA X 100 TABLETAS",
      "t_rutaimagen": "/images/meds/paracetamol.png",
      "id_tipo_producto": 1,
      "id_clase": 3,
      "id_generico": 12,
      "id_familia": 5,
      "id_tipificacion": 2,
      "c_gtin": "7750000123456",
      "c_unspsc": 51102700,
      "n_stockmin": 50.00,
      "n_stockmax": 500.00,
      "n_pcosto": 0.35,
      "n_pvf": 0.80,
      "n_utilidad": 56.25,
      "n_pvs": 0.85,
      "n_plista": 0.40,
      "f_inafecto": 0,
      "id_consignacion": 0,
      "id_laboratorio": 7,
      "id_proveedor": 15,
      "n_dscto_1": 5.00,
      "n_dscto_2": 0.00,
      "f_estado": 1,
      "n_valorizado": 1
    }
  ]
}

Consignment Stock (FAR_CONSIGNACION)

Products can be linked to a consignment arrangement through the id_consignacion field on FAR_PRODUCTOReqDTO. Consignment in this context means the clinic holds supplier stock without having purchased it outright — payment is triggered only on actual dispensing. The FAR_CONSIGNACION table maintains a catalogue of these consignment arrangements; populate id_consignacion with 0 for products that are owned inventory.
To resolve id_consignacion values for use in product creation, call POST /api/FAR_CONSIGNACION/GetAllActives — see the Catalog reference page for full details.

Common Response Envelope

All responses from this controller share the same wrapper:
FieldTypeDescription
Successbooleantrue if no unhandled exception occurred.
Warningbooleantrue when a business rule prevented the operation.
MessagestringHuman-readable result or error message (Spanish).
DataanyPayload; id_producto on Add, DTO array on GetById.
All endpoints require an Authorization: Bearer {token} header. Unauthenticated requests are rejected at the BaseController level before reaching any action method.

Build docs developers (and LLMs) love