Acrylitec exposes two dedicated AJAX endpoints consumed by its frontend JavaScript. Both return JSON and are called viaDocumentation 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.
fetch() from the order and quotation screens. A third route — /pedidos/nuevo/ — also accepts a JSON POST body when Content-Type: application/json is set, acting as the cart-submission endpoint for the POS order screen.
POST /ajax/calcular/
Calculates the quoted price for a single line item in real time given its dimensions, product type, and optional laser cutting minutes. The quotation form calls this endpoint on every dimension or product change to show a live price preview before the user adds the item to the cart.Request
URL:/ajax/calcular/Method:
POSTAuth: Login required
Content-Type:
application/x-www-form-urlencoded
Piece length in centimetres. Passed as a form field; the view coerces it to
Decimal. Send 0 or omit to default to zero.Piece width in centimetres. Same coercion rules as
largo_pza.Primary key of the
Productos record to use. The view looks up the product to read its porcentaje_utilidad and, if set, its precio_fijo. Returns an error response if the PK does not match any product.Number of laser cutting minutes for this piece. Multiplied by
ConfiguracionPrecios.tarifa_laser_minuto to produce costo_laser. Defaults to 0 if omitted or blank.Pricing logic
The view delegates to the internal_calcular_monto() helper:
area_cm2 = largo × anchoarea_m2 = area_cm2 / 10 000- The
TabuladorCostosrow matching the submittedespesor_mmvalue provides afactor_costo(cost per m²). If no matching row exists,factor_costodefaults to0.00. costo_material = area_m2 × factor_costoutilidad = costo_material × (porcentaje_utilidad / 100)costo_laser = minutos_lazer × tarifa_laser_minutomonto_total = (costo_material + utilidad + costo_laser), rounded to 2 decimal places withROUND_HALF_UP.
If the selected
Productos record has a non-null precio_fijo, the calculation short-circuits: monto_total is set to precio_fijo and all cost components (costo_material, utilidad, costo_laser) are returned as 0.00.Success response
HTTP200 with Content-Type: application/json. All monetary values are strings with 2 decimal places.
| Field | Type | Description |
|---|---|---|
ok | bool | Always true on success. |
area | string | largo × ancho in cm². |
costo_material | string | Raw material cost before margin. |
utilidad | string | Profit margin amount. |
costo_laser | string | Laser cutting cost. |
monto_total | string | Final quoted amount (material + margin + laser). |
Error response
Returned when the product PK is invalid or any other exception is raised during calculation.POST, the endpoint returns:
Example fetch() call
POST /ajax/crear-cliente/
Creates a newClientes record inline without navigating away from the POS order screen. Called by the quick-create dialog that appears when the operator clicks “Nuevo cliente” inside the order form. After a successful response, the frontend appends the new client to the Select2 dropdown and selects them automatically.
Request
URL:/ajax/crear-cliente/Method:
POSTAuth: Login required
Content-Type:
application/json
Send a JSON body in the request:
Client full name. The view validates that this field is present and non-empty; missing or blank values return an error response immediately.
Client phone number. Stored as-is on the
Clientes model. Optional.Client email address. Optional; no format validation is performed server-side.
Full mailing or delivery address. Optional.
Success response
HTTP200. Returns the new client’s database primary key and display name so the frontend can add them to the Select2 control.
| Field | Type | Description |
|---|---|---|
ok | bool | Always true on success. |
id_cliente | integer | Primary key of the newly created Clientes record. |
nombre | string | The saved client name, echoed back for display use. |
Error responses
Missingnombre field:
POST):
Example fetch() call
POS Order Submission (POST /pedidos/nuevo/)
While/pedidos/nuevo/ is a regular HTML view on GET, it also accepts a JSON POST body when the Content-Type: application/json header is present. This is the mechanism used by the POS cart screen to submit a completed order.
Request
URL:/pedidos/nuevo/Method:
POSTAuth: Login required
Content-Type:
application/json
Primary key of an existing
Clientes record. Returns a 404 response if not found.Advance payment amount. Coerced to
Decimal. Defaults to 0 if omitted or blank.Initial sale status. Accepted values:
pendiente, en_produccion, pagada, entregada. Defaults to "pendiente" if omitted.Expected delivery date in
YYYY-MM-DD format. Stored as null if omitted or blank.Array of one or more cart item objects. Each item creates one
DetalleVenta record and decrements the referenced material’s stock_actual by cantidad.carrito[]):
Primary key of the
Productos record for this line item.Primary key of the
Materiales record (acrylic sheet) used for this item.Number of pieces. Used to compute the stock decrement.
Piece length in cm, stored on
DetalleVenta.largo_pza.Piece width in cm, stored on
DetalleVenta.ancho_pza.Material thickness in mm, stored on
DetalleVenta.espesor_mm.Laser cutting minutes for this piece, stored on
DetalleVenta.minutos_lazer.Pre-calculated line subtotal (price × quantity). Commas are normalised to dots before
Decimal conversion.Success response
HTTP200.
| Field | Type | Description |
|---|---|---|
ok | bool | Always true on success. |
venta_id | integer | Primary key (id_venta) of the newly created Ventas record. |
alertas_stock | array | Materials whose stock_actual fell to or below stock_minimo after this order. Empty array [] when no materials are low. |
Stock alert object
| Field | Type | Description |
|---|---|---|
nombre | string | Materiales.descripcion of the low-stock item. |
actual | integer | stock_actual value after decrement. |
minimo | integer | stock_minimo threshold value. |