-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathintf.ZUGFeRDDateTypeCodes.pas
69 lines (57 loc) · 1.54 KB
/
intf.ZUGFeRDDateTypeCodes.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
unit intf.ZUGFeRDDateTypeCodes;
interface
uses
System.SysUtils,
intf.ZUGFeRDHelper;
// UNTID 2475 codes
//
type
TZUGFeRDDateTypeCodes = (
/// <summary>
/// Unknown means, we have a problem ...
/// </summary>
Unknown = 0,
/// <summary>
/// Date of invoice
/// </summary>
InvoiceDate = 5,
/// <summary>
/// Date of delivery of goods to establishments/domicile/site
/// </summary>
DeliveryDate = 29,
/// <summary>
/// Payment date
/// </summary>
PaymentDate = 72
);
TZUGFeRDDateTypeCodesExtensions = class
public
class function FromString(s: string): ZUGFeRDNullable<TZUGFeRDDateTypeCodes>;
class function EnumToString(c: ZUGFeRDNullable<TZUGFeRDDateTypeCodes>): string;
end;
implementation
class function TZUGFeRDDateTypeCodesExtensions.FromString(s: string): ZUGFeRDNullable<TZUGFeRDDateTypeCodes>;
begin
if s='' then
exit(Nil);
if SameText(s,'5') then
Result := TZUGFeRDDateTypeCodes.InvoiceDate else
if SameText(s,'29') then
Result := TZUGFeRDDateTypeCodes.DeliveryDate else
if SameText(s,'72') then
Result := TZUGFeRDDateTypeCodes.PaymentDate else
Result := Nil
end;
class function TZUGFeRDDateTypeCodesExtensions.EnumToString(c: ZUGFeRDNullable<TZUGFeRDDateTypeCodes>): string;
begin
if Not(c.HasValue) then
exit('');
case c.Value of
TZUGFeRDDateTypeCodes.InvoiceDate: Result := '5';
TZUGFeRDDateTypeCodes.DeliveryDate: Result := '29';
TZUGFeRDDateTypeCodes.PaymentDate: Result := '72';
else
Result := '';
end;
end;
end.