Skip to content
ES

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.

The issuer counter per document type, controlled by the client system. Sent in the documentNumber field of each issuance.

Assigned by Zentto at issuance time and returned in controlNumber. Formed as Prefijo + LPAD(counter, 8, "0") (e.g. 00012345).

Each series is a [Desde, Hasta] range assigned to a client company for a document type, in the imprenta."ControlSerie" table:

FieldDescription
CompanyIdClient company owning the series.
SerieSeries identifier.
TipoDocumento01..07.
PrefijoControl number prefix.
Desde / HastaRange bounds.
CorrelativoLast number consumed (atomic).
EstadoACTIVA · 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):

  1. Selects the ACTIVA series with SELECT ... FOR UPDATE (row lock).
  2. Computes the next number (Desde on first use, then Correlativo + 1).
  3. If it exceeds Hasta, marks the series AGOTADA and returns no number.
  4. Updates Correlativo and returns Prefijo + LPAD(number, 8, "0").

This guarantees a gap-free, collision-free counter under concurrency.

OperationPathWho
Assign rangePOST /v1/imprenta/asignacionesVertical (company)
List numberingsGET /v1/imprenta/numeracionesVertical
Generate seriesPOST /v1/imprenta/backoffice/seriesZENTTO_SUPERADMIN only
Extend / reassign seriesPOST /v1/imprenta/backoffice/series/{id}/extender · /reasignarZENTTO_SUPERADMIN only
Query integrator rangesGET /api/numeracionesIntegrator
LevelControlled byFieldAssigned when
Document numberClient systemdocumentNumberWhen building the document
NCF-D control numberZentto (own series)controlNumberIn the issuance response