Documentation Build v9.18

ExportFormatter
in package

An implementation of formatting helpers for the CEESV export

This class contains small formatting and validation rules used by the CEESV export scripts. It is used for values that are shared in several places of the export, such as the provider code positions, the filename prefix and the AHV validation.

Example: $positions = exportFormatter::providerCodePositions('9999'); $prefix = exportFormatter::providerCodeForFilename('9999'); $filename = exportFormatter::exportFilename('9999', '2026', '03', 1713700000, 'A123456'); $ahv_ok = exportFormatter::isValidAhv('756.1234.5678.97');

Tags
author

Alejandro Sosa soal@verua.swiss

Table of Contents

Methods

exportFilename()  : string
Returns the filename used for the export file.
filenameChronoSequence()  : string
Returns the chronological sequence used in the CEESV filename.
isValidAhv()  : bool
Validates an AHV number for CEESV export.
isValidProviderCode()  : bool
Returns whether the provider code can be used for the CEESV export.
normalizeProviderCode()  : string
Returns the normalized provider code for CEESV exports.
providerCodeForFilename()  : string
Returns the provider code used as prefix for the export filename.
providerCodePositions()  : array{position104: string, position116: string}
Returns the provider code values for positions 1.04 and 1.16.
resolveProviderCode()  : string
Returns the provider code to use for CEESV exports.

Methods

exportFilename()

Returns the filename used for the export file.

public static exportFilename(mixed $providerCode, mixed $jahr, mixed $monat, mixed $timestamp, mixed $zsr) : string

CEESV naming rule from the PDF preamble: "-.txt" Example: "001-aaaammjjhhmmss.txt"

Parameters
$providerCode : mixed
$jahr : mixed
$monat : mixed
$timestamp : mixed
$zsr : mixed
Return values
string

filenameChronoSequence()

Returns the chronological sequence used in the CEESV filename.

public static filenameChronoSequence(mixed $jahr, mixed $monat, mixed $timestamp) : string

The CEESV naming example uses "aaaammjjhhmmss". We keep the billing year and month passed to the export and complete the remaining day/time part from the provided timestamp so the filename stays tied to the exported period instead of the current server month.

Parameters
$jahr : mixed
$monat : mixed
$timestamp : mixed
Return values
string

isValidAhv()

Validates an AHV number for CEESV export.

public static isValidAhv(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

isValidProviderCode()

Returns whether the provider code can be used for the CEESV export.

public static isValidProviderCode(mixed $providerCode) : bool
Parameters
$providerCode : mixed
Return values
bool

normalizeProviderCode()

Returns the normalized provider code for CEESV exports.

public static normalizeProviderCode(mixed $providerCode) : string

CEESV "Type enregistrement 1 / entete 1":

  • 1.04 "No prestataire" has format 999 and occupies positions 13-15
  • 1.16 "No prestataire (a 4 positions)" has format 9999 and occupies positions 87-90

The official PDF "descriptionCEESV-2401" (dated 2026-03-10, "en vigueur des le 01.01.2024") states that 1.16 is mandatory for new providers whose number has 4 digits, while 1.04 remains the 3-digit provider field.

Zero handling:

  • for 1.04, a legacy 2-digit code such as 83 is normalized to 083 because the field requires exactly 3 digits
  • for 1.04, an existing 3-digit code such as 230 stays 230 and is not prefixed again
  • for 1.16, a real 4-digit code keeps all 4 digits exactly as assigned, including a leading zero such as 0230
Parameters
$providerCode : mixed
Return values
string

providerCodeForFilename()

Returns the provider code used as prefix for the export filename.

public static providerCodeForFilename(mixed $providerCode) : string

CEESV preamble / naming rule: "999-sequence chrono (999 = no prestataire selon 1.04)" Example in the PDF: "001-aaaammjjhhmmss.txt si sequence chrono = date"

For the filename, the provider code must appear first using the same width as the CEESV provider field that applies to the case:

  • a short legacy code such as 83 becomes 083 for the 1.04 format
  • a 3-digit code such as 609 stays 609
  • a 4-digit code such as 0230 stays 0230
Parameters
$providerCode : mixed
Return values
string

providerCodePositions()

Returns the provider code values for positions 1.04 and 1.16.

public static providerCodePositions(mixed $providerCode) : array{position104: string, position116: string}

CEESV format:

  • 1.04 "No prestataire" -> 3 chars, positions 13-15
  • 1.16 "No prestataire (a 4 positions)" -> 4 chars, positions 87-90

Zero handling by position:

  • 1.04 carries a leading zero only when VeruA stored a legacy short code and it must be left-padded to 3 digits, for example 83 -> 083
  • 1.16 keeps the 4-digit provider number exactly as assigned, for example 0230 stays 0230

3-digit provider codes are exported in position 1.04 and 4-digit provider codes are exported in position 1.16.

Parameters
$providerCode : mixed
Return values
array{position104: string, position116: string}

resolveProviderCode()

Returns the provider code to use for CEESV exports.

public static resolveProviderCode(mixed $providerCode[, mixed $clientId = '' ]) : string

The CEESV TXT structure must always use the provider number configured in VeruA for field 1.04 or 1.16.

If an OAuth client id exists for CEESV integration, it is only an authentication identifier and must not be reused to fabricate 1.04/1.16 values in the export file.

Parameters
$providerCode : mixed
$clientId : mixed = ''
Return values
string
On this page

Search results