This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPanamahSDK.NFe.pas
553 lines (500 loc) · 18.8 KB
/
PanamahSDK.NFe.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
unit PanamahSDK.NFe;
interface
uses
StrUtils, SysUtils, Classes, PanamahSDK.Types, PanamahSDK.Models.Loja,
PanamahSDK.Models.Fornecedor, PanamahSDK.Models.Produto,
PanamahSDK.Models.Cliente, PanamahSDK.Models.Venda, ActiveX;
type
TPanamahNFeDocumentType = (ndtDESCONHECIDO, ndtENTRADA, ndtSAIDA, ndtCANCELAMENTO);
TPanamahNFeDocumentTypeSet = set of TPanamahNFeDocumentType;
IPanamahNFeDocument = interface
['{D4B3A500-E80F-4B13-82AA-0E3F882E0158}']
function GetItem(AIndex: Integer): IPanamahModel;
function GetDocumentType: TPanamahNFeDocumentType;
function GetCount: Integer;
function GetId: string;
procedure DeserializeFromXML(const AXML: string);
procedure DeserializeFromFile(const AFilename: string);
procedure SetDocumentType(AType: TPanamahNFeDocumentType);
procedure SetId(const AId: string);
property Count: Integer read GetCount;
property DocumentType: TPanamahNFeDocumentType read GetDocumentType write SetDocumentType;
property Items[AIndex: Integer]: IPanamahModel read GetItem; default;
property Id: string read GetId write SetId;
end;
IPanamahNFeDocumentList = interface
['{2CFB6ECB-36E3-430B-9F6D-A2C090B862AB}']
function GetCount: Integer;
function GetItem(AIndex: Integer): IPanamahNFeDocument;
procedure Clear;
procedure SetItem(AIndex: Integer; const Value: IPanamahNFeDocument);
procedure LoadFromDirectory(const ADirectory: string);
procedure Add(const AItem: IPanamahNFeDocument);
property Items[AIndex: Integer]: IPanamahNFeDocument read GetItem write SetItem; default;
property Count: Integer read GetCount;
end;
TPanamahNFeDeserializer = class
public
class function DeserializeLojaFromEmit(const ANFeXML: string): IPanamahLoja;
class function DeserializeClienteFromDest(const ANFeXML: string): IPanamahCliente;
class function DeserializeFornecedorFromEmit(const ANFeXML: string): IPanamahFornecedor;
class function DeserializeLojaFromDest(const ANFeXML: string): IPanamahLoja;
class function DeserializeProdutosFromProd(const ANFeXML: string): IPanamahProdutoList;
class function DeserializeVendaFromNFe(const ANFeXML: string): IPanamahVenda;
class function GetIdFromXML(const ANFeXML: string): string;
end;
TPanamahNFeDocument = class(TInterfacedObject, IPanamahNFeDocument)
private
FModels: TInterfaceList;
FDataTypes: TStrings;
FDocumentType: TPanamahNFeDocumentType;
FId: string;
function GetDocumentType: TPanamahNFeDocumentType;
function GetItem(AIndex: Integer): IPanamahModel;
function GetId: string;
function FindOutDocumentType(const AId: string): TPanamahNFeDocumentType;
procedure SetDocumentType(AType: TPanamahNFeDocumentType);
procedure SetId(const AId: string);
procedure Add(AModel: IPanamahModel);
public
constructor Create; reintroduce;
function GetCount: Integer;
procedure DeserializeFromXML(const AXML: string);
procedure DeserializeFromFile(const AFilename: string);
class function FromXML(ADocumentType: TPanamahNFeDocumentType; const AXML: string): IPanamahNFeDocument;
class function FromFile(ADocumentType: TPanamahNFeDocumentType; const AFilename: string): IPanamahNFeDocument;
destructor Destroy; override;
property DocumentType: TPanamahNFeDocumentType read GetDocumentType write SetDocumentType;
property Items[AIndex: Integer]: IPanamahModel read GetItem; default;
property Count: Integer read GetCount;
property Id: string read GetId write SetId;
end;
TPanamahNFeDocumentList = class(TInterfacedObject, IPanamahNFeDocumentList)
private
FList: TInterfaceList;
function GetItem(AIndex: Integer): IPanamahNFeDocument;
function GetCount: Integer;
function GetDocumentByType(ATypes: TPanamahNFeDocumentTypeSet): IPanamahNFeDocumentList;
procedure SetItem(AIndex: Integer; const Value: IPanamahNFeDocument);
public
constructor Create; reintroduce;
procedure Clear;
procedure Add(const AItem: IPanamahNFeDocument);
procedure RefreshCanceledDocuments;
procedure LoadFromDirectory(const ADirectory: string);
destructor Destroy; override;
property Items[AIndex: Integer]: IPanamahNFeDocument read GetItem write SetItem; default;
property Count: Integer read GetCount;
end;
implementation
{ TPanamahNFeDocument }
uses PanamahSDK.XMLUtils, XMLIntf, PanamahSDK.ModelUtils;
procedure TPanamahNFeDocument.Add(AModel: IPanamahModel);
begin
FModels.Add(AModel);
FDataTypes.Add(AModel.ModelName);
end;
constructor TPanamahNFeDocument.Create;
begin
inherited Create;
FDocumentType := ndtDESCONHECIDO;
FModels := TInterfaceList.Create;
FDataTypes := TStringList.Create;
end;
procedure TPanamahNFeDocument.DeserializeFromFile(const AFilename: string);
var
XMLFile: TStrings;
begin
XMLFile := TStringList.Create;
try
XMLFile.LoadFromFile(AFilename);
DeserializeFromXML(XMLFile.Text);
finally
XMLFile.Free;
end;
end;
procedure TPanamahNFeDocument.DeserializeFromXML(const AXML: string);
var
Cliente: IPanamahCliente;
Fornecedor: IPanamahFornecedor;
Loja: IPanamahLoja;
Produtos: IPanamahProdutoList;
Venda: IPanamahVenda;
I: Integer;
begin
FModels.Clear;
FId := TPanamahNFeDeserializer.GetIdFromXML(AXML);
FDocumentType := FindOutDocumentType(FId);
case FDocumentType of
ndtDESCONHECIDO,
ndtSAIDA:
begin
Loja := TPanamahNFeDeserializer.DeserializeLojaFromEmit(AXML);
Cliente := TPanamahNFeDeserializer.DeserializeClienteFromDest(AXML);
Venda := TPanamahNFeDeserializer.DeserializeVendaFromNFe(AXML);
Add(Loja);
Add(Cliente);
Add(Venda);
end;
ndtENTRADA:
begin
Fornecedor := TPanamahNFeDeserializer.DeserializeFornecedorFromEmit(AXML);
Loja := TPanamahNFeDeserializer.DeserializeLojaFromDest(AXML);
Add(Fornecedor);
Add(Loja);
end;
end;
Produtos := TPanamahNFeDeserializer.DeserializeProdutosFromProd(AXML);
for I := 0 to Produtos.Count - 1 do
Add(Produtos[I]);
end;
destructor TPanamahNFeDocument.Destroy;
begin
FreeAndNil(FDataTypes);
FreeAndNil(FModels);
inherited;
end;
function TPanamahNFeDocument.FindOutDocumentType(const AId: string): TPanamahNFeDocumentType;
begin
Result := ndtDESCONHECIDO;
if StartsText('ID110111', AId) then
Result := ndtCANCELAMENTO;
end;
class function TPanamahNFeDocument.FromFile(ADocumentType: TPanamahNFeDocumentType;
const AFilename: string): IPanamahNFeDocument;
begin
Result := TPanamahNFeDocument.Create;
Result.DocumentType := ADocumentType;
Result.DeserializeFromFile(AFilename);
end;
class function TPanamahNFeDocument.FromXML(ADocumentType: TPanamahNFeDocumentType;
const AXML: string): IPanamahNFeDocument;
begin
Result := TPanamahNFeDocument.Create;
Result.DocumentType := ADocumentType;
Result.DeserializeFromXML(AXML);
end;
function TPanamahNFeDocument.GetCount: Integer;
begin
Result := FModels.Count;
end;
function TPanamahNFeDocument.GetDocumentType: TPanamahNFeDocumentType;
begin
Result := FDocumentType;
end;
function TPanamahNFeDocument.GetId: string;
begin
Result := FId;
end;
function TPanamahNFeDocument.GetItem(AIndex: Integer): IPanamahModel;
begin
Result := GetModelFromInterfaceList(FModels, AIndex);
end;
procedure TPanamahNFeDocument.SetDocumentType(AType: TPanamahNFeDocumentType);
begin
FDocumentType := AType;
end;
procedure TPanamahNFeDocument.SetId(const AId: string);
begin
FId := AId;
end;
{ TPanamahNFeDeserializer }
class function TPanamahNFeDeserializer.DeserializeClienteFromDest(
const ANFeXML: string): IPanamahCliente;
var
Document: IXMLDocument;
begin
Result := TPanamahCliente.Create;
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Result.NumeroDocumento :=
CoalesceText(
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CNPJ'']'),
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CPF'']')
);
Result.Id := Result.NumeroDocumento;
Result.Nome := XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''xNome'']');
Result.Uf := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''UF'']');
Result.Bairro := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xBairro'']');
Result.Cidade := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xMun'']');
end;
end;
class function TPanamahNFeDeserializer.DeserializeFornecedorFromEmit(
const ANFeXML: string): IPanamahFornecedor;
var
Document: IXMLDocument;
begin
Result := TPanamahFornecedor.Create;
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Result.Id := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''CNPJ'']');
Result.Nome := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''xNome'']');
Result.NumeroDocumento := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''CNPJ'']');
Result.Uf := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''UF'']');
Result.Bairro := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xBairro'']');
Result.Cidade := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xMun'']');
end;
end;
class function TPanamahNFeDeserializer.DeserializeLojaFromDest(
const ANFeXML: string): IPanamahLoja;
var
Document: IXMLDocument;
begin
Result := TPanamahLoja.Create;
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Result.NumeroDocumento :=
CoalesceText(
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CNPJ'']'),
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CPF'']')
);
Result.Id := Result.NumeroDocumento;
Result.Descricao := XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''xNome'']');
Result.Uf := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''UF'']');
Result.Logradouro := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xLgr'']');
Result.Numero := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''nro'']');
Result.Complemento := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xCpl'']');
Result.Bairro := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xBairro'']');
Result.Cep := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''CEP'']');
Result.Cidade := XPathValue(Document, '//*[local-name()=''enderDest'']/*[local-name()=''xMun'']');
end;
end;
class function TPanamahNFeDeserializer.DeserializeLojaFromEmit(
const ANFeXML: string): IPanamahLoja;
var
Document: IXMLDocument;
begin
Result := TPanamahLoja.Create;
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Result.Id := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''CNPJ'']');
Result.Descricao := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''xNome'']');
Result.NumeroDocumento := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''CNPJ'']');
Result.Uf := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''UF'']');
Result.Logradouro := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xLgr'']');
Result.Numero := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''nro'']');
Result.Complemento := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xCpl'']');
Result.Bairro := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xBairro'']');
Result.Cep := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''CEP'']');
Result.Cidade := XPathValue(Document, '//*[local-name()=''enderEmit'']/*[local-name()=''xMun'']');
end;
end;
class function TPanamahNFeDeserializer.DeserializeProdutosFromProd(
const ANFeXML: string): IPanamahProdutoList;
function GetProdValue(AIndex: Integer; ANode: IXMLNode; ATagName: string): string;
begin
Result := TPanamahXMLHelper.XPathValue(
ANode,
Format(
'//*[local-name()=''det''][@nItem=''%d'']' +
'/*[local-name()=''prod'']' +
'/*[local-name()=''%s'']', [AIndex + 1, ATagName]
)
);
end;
var
Document: IXMLDocument;
Nodes: TCustomXMLNodeArray;
Produto: IPanamahProduto;
Ean, EanTributado: string;
ProdutoEan: IPanamahProdutoEan;
I: Integer;
Id: string;
begin
Result := TPanamahProdutoList.Create;
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Nodes := XPathSelect(Document, '//*[local-name()=''prod'']');
for I := 0 to Length(Nodes) - 1 do
begin
Produto := TPanamahProduto.Create;
Id := GetProdValue(I, Nodes[I], 'cProd');
Produto.Id := Id;
Produto.Descricao := GetProdValue(I, Nodes[I], 'xProd');
Produto.Ativo := True;
Ean := GetProdValue(I, Nodes[I], 'cEAN');
EanTributado := GetProdValue(I, Nodes[I], 'cEANTrib');
if ((Ean <> EmptyStr) and (Ean <> 'SEM GTIN')) or ((EanTributado <> EmptyStr) and (EanTributado <> 'SEM GTIN')) then
begin
Produto.Eans := TPanamahProdutoEanList.Create;
if EanTributado <> EmptyStr then
begin
ProdutoEan := TPanamahProdutoEan.Create;
ProdutoEan.Id := EanTributado;
ProdutoEan.Tributado := True;
Produto.Eans.Add(ProdutoEan);
end;
if (Ean <> EmptyStr) and (Ean <> EanTributado) then
begin
ProdutoEan := TPanamahProdutoEan.Create;
ProdutoEan.Id := Ean;
ProdutoEan.Tributado := False;
Produto.Eans.Add(ProdutoEan);
end;
end;
Result.Add(Produto);
end;
end;
end;
class function TPanamahNFeDeserializer.DeserializeVendaFromNFe(
const ANFeXML: string): IPanamahVenda;
function GetItemValue(AIndex: Integer; ANode: IXMLNode; ATagName: string): string;
begin
Result := TPanamahXMLHelper.XPathValue(
ANode,
Format(
'//*[local-name()=''det''][@nItem=''%d'']' +
'/*[local-name()=''prod'']' +
'/*[local-name()=''%s'']', [AIndex + 1, ATagName]
)
);
end;
var
Document: IXMLDocument;
Produtos: IPanamahProdutoList;
Item: IPanamahVendaItem;
I: Integer;
begin
Result := TPanamahVenda.Create;
with TPanamahXMLHelper do
begin
Produtos := DeserializeProdutosFromProd(ANFeXML);
Document := CreateDocument(ANFeXML);
Result.Id := TPanamahNFeDeserializer.GetIdFromXML(ANFeXML);
Result.XML := ANFeXML;
Result.LojaId := XPathValue(Document, '//*[local-name()=''emit'']/*[local-name()=''CNPJ'']');
Result.ClienteId :=
CoalesceText(
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CNPJ'']'),
XPathValue(Document, '//*[local-name()=''dest'']/*[local-name()=''CPF'']')
);
Result.Data := ISO8601ToDateTime(XPathValue(Document, '//*[local-name()=''dhEmi'']'));
Result.DataHoraVenda := Result.Data;
Result.Efetiva := True;
Result.QuantidadeItens := Produtos.Count;
Result.Valor := DecimalDotStringToDouble(XPathValue(Document, '//*[local-name()=''total'']/*[local-name()=''ICMSTot'']/*[local-name()=''vNF'']'));
if Result.QuantidadeItens > 0 then
begin
Result.Itens := TPanamahVendaItemList.Create;
for I := 0 to Produtos.Count - 1 do
begin
Item := TPanamahVendaItem.Create;
Item.ProdutoId := Produtos[I].Id;
Item.Quantidade := DecimalDotStringToDouble(GetItemValue(I, Document.DocumentElement, 'qCom'));
Item.ValorUnitario := DecimalDotStringToDouble(GetItemValue(I, Document.DocumentElement, 'vUnCom'));
Item.ValorTotal := DecimalDotStringToDouble(GetItemValue(I, Document.DocumentElement, 'vProd'));
Item.Preco := DecimalDotStringToDouble(GetItemValue(I, Document.DocumentElement, 'vUnCom'));
Item.Desconto := DecimalDotStringToDouble(GetItemValue(I, Document.DocumentElement, 'vDesc'));
Item.Efetivo := True;
Result.Itens.Add(Item);
end;
end;
end;
end;
class function TPanamahNFeDeserializer.GetIdFromXML(const ANFeXML: string): string;
var
Document: IXMLDocument;
begin
with TPanamahXMLHelper do
begin
Document := CreateDocument(ANFeXML);
Result := CoalesceText(XPathValue(Document, '//*[local-name()=''infNFe'']/@Id'), XPathValue(Document, '//*[local-name()=''infEvento'']/@Id'));
end;
end;
{ TPanamahNFeDocumentList }
procedure TPanamahNFeDocumentList.Add(const AItem: IPanamahNFeDocument);
begin
FList.Add(AItem);
end;
procedure TPanamahNFeDocumentList.Clear;
begin
FList.Clear;
end;
constructor TPanamahNFeDocumentList.Create;
begin
inherited Create;
FList := TInterfaceList.Create;
end;
destructor TPanamahNFeDocumentList.Destroy;
begin
FreeAndNil(FList);
inherited;
end;
function TPanamahNFeDocumentList.GetCount: Integer;
begin
Result := FList.Count;
end;
function TPanamahNFeDocumentList.GetDocumentByType(ATypes: TPanamahNFeDocumentTypeSet): IPanamahNFeDocumentList;
var
I: Integer;
begin
FList.Lock;
try
Result := TPanamahNFeDocumentList.Create;
for I := 0 to FList.Count - 1 do
if (FList[I] as IPanamahNFeDocument).DocumentType in ATypes then
Result.Add(FList[I] as IPanamahNFeDocument);
finally
FList.Unlock;
end;
end;
function TPanamahNFeDocumentList.GetItem(AIndex: Integer): IPanamahNFeDocument;
begin
Result := FList[AIndex] as IPanamahNFeDocument;
end;
procedure TPanamahNFeDocumentList.LoadFromDirectory(const ADirectory: string);
var
SearchRec: TSearchRec;
begin
if DirectoryExists(ADirectory) then
begin
if FindFirst(Format('%s\*.xml', [ADirectory]), faAnyFile, SearchRec) = 0 then
begin
repeat
FList.Add(TPanamahNFeDocument.FromFile(ndtDESCONHECIDO, Format('%s\%s', [ADirectory, SearchRec.Name])));
RefreshCanceledDocuments;
until FindNext(SearchRec) <> 0;
end;
end
else
raise EPanamahSDKIOException.Create(Format('Diretório %s não existe.', [ADirectory]));
end;
procedure TPanamahNFeDocumentList.RefreshCanceledDocuments;
var
Emissao, Cancelamento: IPanamahNFeDocument;
Cancelamentos, Emissoes: IPanamahNFeDocumentList;
I1, I2, I3: Integer;
begin
Cancelamentos := GetDocumentByType([ndtCANCELAMENTO]);
Emissoes := GetDocumentByType([ndtDESCONHECIDO, ndtENTRADA, ndtSAIDA]);
for I1 := 0 to Emissoes.Count - 1 do
begin
Emissao := Emissoes[I1];
for I2 := 0 to Cancelamentos.Count - 1 do
begin
Cancelamento := Cancelamentos[I2];
if ContainsText(Cancelamento.Id, OnlyNumbers(Emissao.Id)) then
begin
for I3 := 0 to Emissao.Count - 1 do
begin
if SameText(Emissao[I3].ModelName, 'VENDA') then
(Emissao[I3] as IPanamahVenda).Efetiva := False;
end;
end;
end;
end;
end;
procedure TPanamahNFeDocumentList.SetItem(AIndex: Integer; const Value: IPanamahNFeDocument);
begin
FList[AIndex] := Value;
end;
initialization
CoInitialize(nil);
finalization
CoUninitialize;
end.