Numbering and control
Zentto Digital Print operates a two-level numbering model: the document number (issuer counter) and the fiscal control number (NCF-D), which Zentto generates in-house from its internal series.
Document number
Section titled “Document number”The issuer counter per document type, controlled by the client system. Sent in the
documentNumber field of each issuance.
Fiscal control number (NCF-D)
Section titled “Fiscal control number (NCF-D)”Assigned by Zentto at issuance time and returned in controlNumber. Formed as
Prefijo + LPAD(counter, 8, "0") (e.g. 00012345).
Own series
Section titled “Own series”Each series is a [Desde, Hasta] range assigned to a client company for a document type,
in the imprenta."ControlSerie" table:
| Field | Description |
|---|---|
CompanyId | Client company owning the series. |
Serie | Series identifier. |
TipoDocumento | 01..07. |
Prefijo | Control number prefix. |
Desde / Hasta | Range bounds. |
Correlativo | Last number consumed (atomic). |
Estado | ACTIVA · AGOTADA · SUSPENDIDA. |
Atomic assignment — fn_assign_control_serie
Section titled “Atomic assignment — fn_assign_control_serie”The PL/pgSQL function imprenta.fn_assign_control_serie(p_company_id, p_tipo_doc, p_serie):
- Selects the
ACTIVAseries withSELECT ... FOR UPDATE(row lock). - Computes the next number (
Desdeon first use, thenCorrelativo + 1). - If it exceeds
Hasta, marks the seriesAGOTADAand returns no number. - Updates
Correlativoand returnsPrefijo + LPAD(number, 8, "0").
This guarantees a gap-free, collision-free counter under concurrency.
Range management (vertical / integrator)
Section titled “Range management (vertical / integrator)”| Operation | Path | Who |
|---|---|---|
| Assign range | POST /v1/imprenta/asignaciones | Vertical (company) |
| List numberings | GET /v1/imprenta/numeraciones | Vertical |
| Generate series | POST /v1/imprenta/backoffice/series | ZENTTO_SUPERADMIN only |
| Extend / reassign series | POST /v1/imprenta/backoffice/series/{id}/extender · /reasignar | ZENTTO_SUPERADMIN only |
| Query integrator ranges | GET /api/numeraciones | Integrator |
Summary
Section titled “Summary”| Level | Controlled by | Field | Assigned when |
|---|---|---|---|
| Document number | Client system | documentNumber | When building the document |
| NCF-D control number | Zentto (own series) | controlNumber | In the issuance response |