-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
intf.ZUGFeRDGlobalIDSchemeIdentifiers.pas
95 lines (86 loc) · 2.84 KB
/
intf.ZUGFeRDGlobalIDSchemeIdentifiers.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
unit intf.ZUGFeRDGlobalIDSchemeIdentifiers;
interface
uses
System.SysUtils
;
type
TZUGFeRDGlobalIDSchemeIdentifiers = (
/// <summary>
/// Unknown means, we have a problem ...
/// </summary>
Unknown = 0,
/// <summary>
/// SIRENE (System Information et Repertoire des Entreprise et des Etablissements)
/// </summary>
Sirene = 2,
/// <summary>
/// SIRENE (System Information et Repertoire des Entreprise et des Etablissements)
/// </summary>
SiretCode = 9,
/// <summary>
/// SWIFT (BIC)
/// </summary>
Swift = 21,
/// <summary>
/// D-U-N-S Number
/// </summary>
DUNS = 60,
/// <summary>
/// GS1 Global Location Number (GLN)
/// </summary>
GLN = 88,
/// <summary>
/// GS1 Global Trade Item Number (GTIN, EAN)
/// </summary>
EAN = 160,
/// <summary>
/// OSCAR (Odette)
/// </summary>
ODETTE = 177,
/// <summary>
/// Numero d'entreprise / ondernemingsnummer / Unternehmensnummer
/// </summary>
CompanyNumber = 208
);
TZUGFeRDGlobalIDSchemeIdentifiersExtensions = class
public
class function FromString(s: string): TZUGFeRDGlobalIDSchemeIdentifiers;
class function EnumToString(c: TZUGFeRDGlobalIDSchemeIdentifiers): string;
end;
implementation
class function TZUGFeRDGlobalIDSchemeIdentifiersExtensions.FromString(s: string): TZUGFeRDGlobalIDSchemeIdentifiers;
begin
if SameText(s,'0002') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.Sirene else
if SameText(s,'0009') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.SiretCode else
if SameText(s,'0021') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.Swift else
if SameText(s,'0060') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.DUNS else
if SameText(s,'0088') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.GLN else
if SameText(s,'0160') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.EAN else
if SameText(s,'0177') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.ODETTE else
if SameText(s,'0208') then
Result := TZUGFeRDGlobalIDSchemeIdentifiers.CompanyNumber else
Result := TZUGFeRDGlobalIDSchemeIdentifiers.Unknown;
end;
class function TZUGFeRDGlobalIDSchemeIdentifiersExtensions.EnumToString(c: TZUGFeRDGlobalIDSchemeIdentifiers): string;
begin
case c of
TZUGFeRDGlobalIDSchemeIdentifiers.Sirene: Result := '0002';
TZUGFeRDGlobalIDSchemeIdentifiers.SiretCode: Result := '0009';
TZUGFeRDGlobalIDSchemeIdentifiers.Swift: Result := '0021';
TZUGFeRDGlobalIDSchemeIdentifiers.DUNS: Result := '0060';
TZUGFeRDGlobalIDSchemeIdentifiers.GLN: Result := '0088';
TZUGFeRDGlobalIDSchemeIdentifiers.EAN: Result := '0160';
TZUGFeRDGlobalIDSchemeIdentifiers.ODETTE: Result := '0177';
TZUGFeRDGlobalIDSchemeIdentifiers.CompanyNumber: Result := '0208';
else
Result := '0000';
end;
end;
end.