Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/15aozzz/Lab-Nova-Salud/llms.txt

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

The Nueva Venta page is where all pharmacy sales are recorded. It handles both consumer receipts (boletas) and business invoices (facturas). Once you submit a sale, the system generates the official voucher number automatically and deducts the sold quantities from inventory — no manual stock adjustments needed. Route: /nueva-venta

Recording a sale

1

Select the document type

Choose Boleta for individual customers or Factura for businesses that require a tax invoice. The system automatically retrieves the corresponding series code (e.g., B001 for boletas, F001 for facturas) and the next sequential correlativo (e.g., 00000001). The full voucher number — such as B001-00000001 — is shown in the Comprobante Info panel before you submit.
2

Look up the client

Enter the client’s DNI (8 digits) or RUC (11 digits) in the client search field. The system queries the database and pre-fills the client’s name if they already exist. If the client is new, type their name manually — they will be saved automatically when the sale is recorded.
3

Add products

Search for a product by its commercial name or active ingredient. Results appear as you type (minimum 2 characters). For each product, select the pricing unit — for example, a single tablet, a blister pack of 10, or a full box — then set the quantity. Each unit option shows its individual sale price.
You can add multiple products to the same sale. Use the trash icon next to a line item to remove it before submitting.
4

Review totals and submit

The Resumen panel on the right updates in real time as you add or adjust items. Confirm the subtotals and grand total, then press Registrar Venta. The sale is recorded in a single database transaction.

Automatic voucher numbering

You do not need to track voucher numbers manually. When you select a document type, the system calls the database to retrieve the current series and the next available correlativo. After the sale is saved, the correlativo increments by one so the next sale receives the following number in sequence. Example voucher numbers:
Document typeSeriesCorrelativoFull number
BoletaB00100000001B001-00000001
FacturaF00100000001F001-00000001

Automatic stock deduction

Stock is managed entirely by the database. Two MySQL triggers run whenever a sale line is inserted:
  • A before-insert trigger checks that sufficient stock exists. If the quantity requested exceeds what is available, the entire sale is cancelled and an error is returned — no partial deductions occur.
  • An after-insert trigger deducts the correct number of base units from inventory, accounting for the unit equivalence of the selected pricing tier.
Example: selling 2 blister packs of 10 tablets of Paracetamol deducts 20 units (2 × 10) from the product’s stock.

Sale request structure

The following JSON is sent to the backend when you submit a sale. This is shown here for reference — the form on the Nueva Venta page builds this payload automatically.
{
  "id_tipo_comprobante": 1,
  "numero_documento_cliente": "12345678",
  "nombres_razon_social": "Juan Pérez",
  "id_usuario": 2,
  "total": 5.00,
  "detalle": [
    {
      "id_producto": 1,
      "id_producto_precio": 1,
      "cantidad": 10,
      "precio_unitario": 0.50,
      "subtotal": 5.00
    }
  ]
}
A successful response returns the generated voucher reference:
{
  "exito": true,
  "id_venta": 1,
  "serie": "B001",
  "numero_documento": "00000001",
  "total": 5.00
}

Viewing completed sales

After a sale is registered it becomes available in the Comprobantes section (/comprobantes), where you can search the full history by date range, document type, or client name.

Build docs developers (and LLMs) love