Table of Contents

Struct GibInvoiceNumber

Namespace
HeroKit.Globalization.Turkey
Assembly
HeroKit.dll

A Turkish e-Fatura or e-Arşiv invoice number in the GİB format: a 3-character series, a 4-digit year and a 9-digit sequence, for example "ABC2026000000001".

public readonly record struct GibInvoiceNumber : IEquatable<GibInvoiceNumber>
Implements
Inherited Members
Extension Methods

Constructors

GibInvoiceNumber(string, int, int)

A Turkish e-Fatura or e-Arşiv invoice number in the GİB format: a 3-character series, a 4-digit year and a 9-digit sequence, for example "ABC2026000000001".

public GibInvoiceNumber(string Series, int Year, int Sequence)

Parameters

Series string

The 3-character series (A–Z, 0–9).

Year int

The 4-digit year.

Sequence int

The sequence number within the series and year (1–999,999,999).

Fields

MaxSequence

The largest sequence number that fits in nine digits.

public const int MaxSequence = 999999999

Field Value

int

Properties

Sequence

The sequence number within the series and year (1–999,999,999).

public int Sequence { get; init; }

Property Value

int

Series

The 3-character series (A–Z, 0–9).

public string Series { get; init; }

Property Value

string

Year

The 4-digit year.

public int Year { get; init; }

Property Value

int

Methods

Create(string, int, int)

Creates an invoice number after validating its parts.

public static GibInvoiceNumber Create(string series, int year, int sequence)

Parameters

series string

The 3-character series (A–Z, 0–9).

year int

The year (2000–2099).

sequence int

The sequence number (1–999,999,999).

Returns

GibInvoiceNumber

The invoice number.

Examples

GibInvoiceNumber.Create("ABC", 2026, 1).ToString(); // "ABC2026000000001"

Exceptions

ArgumentException

A part is not valid.

Next()

Returns the next invoice number in the same series and year.

public GibInvoiceNumber Next()

Returns

GibInvoiceNumber

The invoice number with the sequence increased by one.

Examples

GibInvoiceNumber.Create("ABC", 2026, 41).Next().ToString(); // "ABC2026000000042"

Exceptions

InvalidOperationException

The sequence is already at MaxSequence.

ToString()

Formats the invoice number as 16 characters, for example "ABC2026000000001".

public override string ToString()

Returns

string

The formatted invoice number.

TryParse(string?, out GibInvoiceNumber)

Tries to parse an invoice number in the GİB format.

public static bool TryParse(string? value, out GibInvoiceNumber result)

Parameters

value string

The invoice number, for example "ABC2026000000001". Must be upper case, without spaces.

result GibInvoiceNumber

The parsed invoice number when the method returns true.

Returns

bool

True if the value is a valid invoice number; otherwise false.