Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/YonAnn99/Acrylitec/llms.txt

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

A cotización (quotation) is a price estimate prepared for a client before a sale is confirmed. Any authenticated user can create one by navigating to /pedidos/nuevo/. The final price (monto_total) is computed automatically — either from the product’s fixed price or from a formula that combines material area, thickness, profit margin, and laser cutting time — and is recalculated live in the browser as the user types, then persisted to the database on save.

Pricing Formula

The price calculation is defined in two places that share identical logic: the _calcular_monto() helper in views.py (used for the live AJAX preview at /ajax/calcular/) and the calcular_monto() method on the Cotizaciones model (called automatically in Cotizaciones.save()).

Fixed-price products

If the selected Productos record has a non-null precio_fijo, that value is used directly as monto_total and all area/material calculations are skipped.

Variable-price calculation

For products without a fixed price, the formula is:
area_m2 = (largo_cm * ancho_cm) / 10000
costo_material = area_m2 * factor_costo        # factor_costo from TabuladorCostos (keyed by espesor_mm)
utilidad = costo_material * (porcentaje_utilidad / 100)
costo_laser = minutos_lazer * tarifa_laser_minuto  # tarifa_laser_minuto from ConfiguracionPrecios
monto_total = round(costo_material + utilidad + costo_laser, 2)
Where each value comes from:
VariableSource
largo_cm, ancho_cmEntered by the user (piece dimensions in centimetres)
factor_costoLooked up from TabuladorCostos using espesor_mm as the key
porcentaje_utilidadStored on the Cotizaciones record; defaults to 40 %
minutos_lazerOptional laser cutting time entered by the user
tarifa_laser_minutoSingleton value from ConfiguracionPrecios.get_config()
The result is rounded to two decimal places using ROUND_HALF_UP (Python Decimal).
To change the default profit margin for a specific product or to update the global laser tariff per minute, visit the Pricing Configuration page at /configuracion/. Changes take effect immediately for all new calculations.

How Price Calculation Is Triggered

1

Navigate to the new order form

Go to /pedidos/nuevo/ from the sidebar or from the Dashboard quick-access button labelled Nuevo Pedido. This is the active POS interface where the pricing engine runs both client-side (live preview) and server-side (on save).
2

Select a client

Choose an existing client from the searchable Select2 dropdown. The list is pre-populated with all Clientes records. You can type part of the client’s name or phone number to filter.
3

Select a product and material

Pick the Productos entry that matches the custom piece being quoted, then choose the acrylic sheet (Materiales) to be used.
4

Enter dimensions and thickness

Fill in Largo (cm) and Ancho (cm) for the piece dimensions. Then select the Espesor (mm) from the dropdown, which is populated from the TabuladorCostos table. The espesor value determines the factor_costo used in the material cost calculation.
5

Optionally enter laser minutes

If the job requires laser cutting time, enter the estimated Minutos Láser (minutos_lazer). Leave at 0 if no laser work is needed.
6

Review the live price preview

As you update any field, the right-hand panel recalculates and displays a real-time cost breakdown — area, material cost, profit, laser cost, and total — by calling POST /ajax/calcular/. The same formula mirrors the server-side logic in _calcular_monto(). If the product has a fixed price, the panel shows that price directly and marks the other fields as not applicable.
7

Submit the order

Click Registrar Pedido Completo. The browser sends the cart as a JSON payload to POST /pedidos/nuevo/ with Content-Type: application/json. For any Cotizaciones record that is created or updated separately (e.g., via the Django admin), Cotizaciones.save() automatically calls calcular_monto() to recompute and store monto_total.

Cotizaciones Model Fields

The Cotizaciones model (db_table = 'cotizaciones') stores the following fields:
FieldTypeDescription
id_cotizacionAutoField (PK)Auto-generated primary key
id_clienteFK → ClientesThe client this quote is for
id_productoFK → ProductosThe product being quoted
id_materialFK → MaterialesThe acrylic sheet material
largo_pzaDecimalFieldPiece length in centimetres
ancho_pzaDecimalFieldPiece width in centimetres
espesor_mmIntegerFieldThickness in millimetres; used to look up TabuladorCostos.factor_costo
porcentaje_utilidadIntegerFieldProfit margin percentage; defaults to 40
minutos_lazerIntegerFieldEstimated laser cutting time in minutes
monto_totalDecimalFieldAuto-calculated on every save() call
fechaDateFieldDate the quotation was created

Build docs developers (and LLMs) love