-
Notifications
You must be signed in to change notification settings - Fork 63
/
SAFTAO1.01_01.xsd
2954 lines (2943 loc) · 122 KB
/
SAFTAO1.01_01.xsd
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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation"
xmlns:ns="urn:OECD:StandardAuditFile-Tax:AO_1.01_01"
xmlns="urn:OECD:StandardAuditFile-Tax:AO_1.01_01" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:OECD:StandardAuditFile-Tax:AO_1.01_01" version="1.01_01" id="SAF-T_AO"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
<doc:Title>Standard Audit File - Angola</doc:Title>
<doc:Subject>Standard Audit File - Angola</doc:Subject>
<doc:Copyright>Copyright OECD</doc:Copyright>
<doc:Version>
<doc:Number>1.01_01</doc:Number>
<doc:Status>Development</doc:Status>
<doc:Repository>https://github.com/assoft-portugal/SAF-T-AO/</doc:Repository>
</doc:Version>
<doc:Author>AGT - Administração Geral Tributária</doc:Author>
<!-- Contributos para o Projeto -->
<doc:Contributors>
<doc:Contributor name="ASSOFT - Associação Portuguesa de Software" url="https://www.assoft.org/" />
<doc:Contributor name="Nelson Lopes" url="https://github.com/cryptolopes/" />
<doc:Contributor name="PRIMAVERA - Business Software Solutions, S.A." url="http://www.primaverabss.com/" />
<doc:Contributor name="Softpack - Software, Lda" url="https://www.softpack.pt/" />
<doc:Contributor name="Cacimbo Angola" url="https://www.cacimboangola.com/" />
<doc:Contributor name="Infodelivery S.A." url="http://www.infodelivery.pt/" />
<doc:Contributor name="Eticadata Software Lda" url="http://www.eticadata.pt/" />
<doc:Contributor name="SOFTSTORE, S.A." url="http://www.softstore.pt/" />
<doc:Contributor name="SAP PORTUGAL - Sistemas, Aplicações e Produtos Informáticos, Sociedade Unipessoal Lda." url="http://www.sap.com/" />
<doc:Contributor name="Texto Editores (SU) LDA" url="https://www.textoeditores.ao" />
<doc:Contributor name="Paulo Matos" url="https://github.com/batalhadematos" />
<doc:Contributor name="ITGest" url="https://itgest.co.ao/" />
<doc:Contributor name="Newtec Tecnologias LDA" url="http://www.newtec.co.ao/" />
<doc:Contributor name="Infodelivery S.A." url="http://www.infodelivery.pt" />
<doc:Contributor name="Arquiconsult S.A." url="https://www.arquiconsult.com" />
</doc:Contributors>
<doc:ModificationDate>2021-02-19</doc:ModificationDate>
</xs:documentation>
</xs:annotation>
<!-- Estrutura do ficheiro SAFT-AO-->
<xs:element name="AuditFile">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" ref="Header" />
<xs:element name="MasterFiles">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="GeneralLedgerAccounts" />
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Customer" />
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Supplier" />
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Product" />
<xs:element minOccurs="0" ref="TaxTable" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" ref="GeneralLedgerEntries" />
<xs:element minOccurs="0" ref="SourceDocuments" />
</xs:sequence>
</xs:complexType>
<!-- Constraint-->
<xs:unique name="AccountIDConstraint">
<xs:selector xpath="ns:MasterFiles/ns:GeneralLedgerAccounts/ns:Account" />
<xs:field xpath="ns:AccountID" />
</xs:unique>
<xs:keyref name="GroupingCodeConstraint" refer="AccountIDConstraint">
<xs:selector xpath="ns:MasterFiles/ns:GeneralLedgerAccounts/ns:Account" />
<xs:field xpath="ns:GroupingCode" />
</xs:keyref>
<xs:unique name="CustomerIDConstraint">
<xs:selector xpath="ns:MasterFiles/ns:Customer" />
<xs:field xpath="ns:CustomerID" />
</xs:unique>
<xs:unique name="SupplierIDConstraint">
<xs:selector xpath="ns:MasterFiles/ns:Supplier" />
<xs:field xpath="ns:SupplierID" />
</xs:unique>
<xs:unique name="ProductCodeConstraint">
<xs:selector xpath="ns:MasterFiles/ns:Product" />
<xs:field xpath="ns:ProductCode" />
</xs:unique>
<xs:keyref name="GeneralLedgerEntriesDebitLineAccountIDConstraint" refer="AccountIDConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction/ns:Lines/ns:DebitLine" />
<xs:field xpath="ns:AccountID" />
</xs:keyref>
<xs:keyref name="GeneralLedgerEntriesCreditLineAccountIDConstraint" refer="AccountIDConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction/ns:Lines/ns:CreditLine" />
<xs:field xpath="ns:AccountID" />
</xs:keyref>
<xs:keyref name="GeneralLedgerEntriesCustomerIDConstraint" refer="CustomerIDConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
<xs:field xpath="ns:CustomerID" />
</xs:keyref>
<xs:unique name="GeneralLedgerEntriesJournalIdConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal" />
<xs:field xpath="ns:JournalID" />
</xs:unique>
<xs:keyref name="GeneralLedgerEntriesSupplierIDConstraint" refer="SupplierIDConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
<xs:field xpath="ns:SupplierID" />
</xs:keyref>
<xs:unique name="GeneralLedgerEntriesTransactionIdConstraint">
<xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
<xs:field xpath="ns:TransactionID" />
</xs:unique>
<xs:unique name="InvoiceNoConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:SalesInvoices/ns:Invoice" />
<xs:field xpath="ns:InvoiceNo" />
</xs:unique>
<xs:keyref name="InvoiceCustomerIDConstraint" refer="CustomerIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:SalesInvoices/ns:Invoice" />
<xs:field xpath="ns:CustomerID" />
</xs:keyref>
<xs:keyref name="InvoiceProductCodeConstraint" refer="ProductCodeConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:SalesInvoices/ns:Invoice/ns:Line" />
<xs:field xpath="ns:ProductCode" />
</xs:keyref>
<xs:unique name="DocumentNumberConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:MovementOfGoods/ns:StockMovement" />
<xs:field xpath="ns:DocumentNumber" />
</xs:unique>
<xs:keyref name="StockMovementCustomerIDConstraint" refer="CustomerIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:MovementOfGoods/ns:StockMovement" />
<xs:field xpath="ns:CustomerID" />
</xs:keyref>
<xs:keyref name="StockMovementSupplierIDConstraint" refer="SupplierIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:MovementOfGoods/ns:StockMovement" />
<xs:field xpath="ns:SupplierID" />
</xs:keyref>
<xs:keyref name="StockMovementProductCodeConstraint" refer="ProductCodeConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:MovementOfGoods/ns:StockMovement/ns:Line" />
<xs:field xpath="ns:ProductCode" />
</xs:keyref>
<xs:unique name="WorkDocumentDocumentNumberConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:WorkingDocuments/ns:WorkDocument" />
<xs:field xpath="ns:DocumentNumber" />
</xs:unique>
<xs:keyref name="WorkDocumentDocumentCustomerIDConstraint" refer="CustomerIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:WorkingDocuments/ns:WorkDocument" />
<xs:field xpath="ns:CustomerID" />
</xs:keyref>
<xs:keyref name="WorkDocumentDocumentProductCodeConstraint" refer="ProductCodeConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:WorkingDocuments/ns:WorkDocument/ns:Line" />
<xs:field xpath="ns:ProductCode" />
</xs:keyref>
<xs:unique name="PaymentPaymentRefNoConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:Payments/ns:Payment" />
<xs:field xpath="ns:PaymentRefNo" />
</xs:unique>
<xs:keyref name="PaymentPaymentRefNoCustomerIDConstraint" refer="CustomerIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:Payments/ns:Payment" />
<xs:field xpath="ns:CustomerID" />
</xs:keyref>
<!-- Constraints de Documentos Comerciais de Fornecedores -->
<xs:keyref name="InvoiceSupplierIDConstraint" refer="SupplierIDConstraint">
<xs:selector xpath="ns:SourceDocuments/ns:PurchaseInvoices/ns:Invoice" />
<xs:field xpath="ns:SupplierID" />
</xs:keyref>
</xs:element>
<!-- Estrutura de cabecalho (AuditFile.Header) -->
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="AuditFileVersion" />
<xs:element ref="CompanyID" />
<xs:element name="TaxRegistrationNumber" type="SAFAOAngolaVatNumber">
<xs:annotation>
<xs:documentation>
Número de identificação fiscal da empresa
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="TaxAccountingBasis" />
<xs:element ref="CompanyName" />
<xs:element minOccurs="0" ref="BusinessName" />
<xs:element ref="CompanyAddress" />
<xs:element ref="FiscalYear" />
<xs:element ref="StartDate" />
<xs:element ref="EndDate" />
<xs:element name="CurrencyCode" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Código da moeda. Identifica a moeda padrão a utilizar nos campos do tipo monetário existentes no ficheiro. Preencher com "AOA".
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AOA" />
<xs:enumeration value="USD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element ref="DateCreated" />
<xs:element ref="TaxEntity">
<xs:annotation>
<xs:documentation>
No caso do ficheiro de faturação, deve ser especificado a que estabelecimento (posto de venda) diz respeito o ficheiro produzido, se aplicável. Caso contrário, deve ser preenchido com a especificação "Global". No caso do ficheiro de contabilidade ou integrado, este campo deve ser preenchido com a especificação "Sede".
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="ProductCompanyTaxID">
<xs:annotation>
<xs:documentation>
Preencher com o NIF da entidade produtora do software.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="SoftwareValidationNumber" />
<xs:element ref="ProductID" />
<xs:element ref="ProductVersion" />
<xs:element minOccurs="0" ref="HeaderComment" />
<xs:element minOccurs="0" ref="Telephone" />
<xs:element minOccurs="0" ref="Fax" />
<xs:element minOccurs="0" ref="Email" />
<xs:element minOccurs="0" ref="Website" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Ficheiros Mestre (AuditFile.MasterFiles) -->
<!-- Estrutura do Plano de Contas (AuditFile.MasterFiles.GeneralLedger)-->
<xs:element name="GeneralLedgerAccounts">
<xs:complexType>
<xs:sequence>
<xs:element name="Account" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="AccountID" type="SAFAOGLAccountID">
<xs:annotation>
<xs:documentation>
Devem constar no ficheiro todas as contas, incluindo as respetivas contas integradoras, até às contas do Razão.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="AccountDescription" />
<xs:element ref="OpeningDebitBalance" />
<xs:element ref="OpeningCreditBalance" />
<xs:element ref="ClosingDebitBalance" />
<xs:element ref="ClosingCreditBalance" />
<xs:element ref="GroupingCategory" />
<xs:element minOccurs="0" name="GroupingCode" type="SAFAOGLAccountID">
<xs:annotation>
<xs:documentation>
Excepto para as contas do 1.º grau, deve ser indicada a contaagregadora respectiva, do grau imediatamente superior, utilizando para este efeito a exacta estrutura que consta no correspondente campo 2.1.2.1. - Código da conta (Account ID).
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Cliente (AuditFile.MasterFiles.Customer) -->
<xs:element name="Customer">
<xs:annotation>
<xs:documentation>
Tabela de clientes
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="CustomerID" />
<xs:element ref="AccountID" />
<xs:element ref="CustomerTaxID" />
<xs:element ref="CompanyName" />
<xs:element minOccurs="0" ref="Contact" />
<xs:element ref="BillingAddress" />
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ShipToAddress" />
<xs:element minOccurs="0" ref="Telephone" />
<xs:element minOccurs="0" ref="Fax" />
<xs:element minOccurs="0" ref="Email" />
<xs:element minOccurs="0" ref="Website" />
<xs:element ref="SelfBillingIndicator" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Fornecedor (AuditFile.MasterFiles.Supplier) -->
<xs:element name="Supplier">
<xs:annotation>
<xs:documentation>
Tabela de fornecedores
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="SupplierID" />
<xs:element ref="AccountID" />
<xs:element ref="SupplierTaxID" />
<xs:element ref="CompanyName" />
<xs:element minOccurs="0" ref="Contact" />
<xs:element name="BillingAddress" type="SupplierAddressStructure" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="ShipFromAddress" type="SupplierAddressStructure" />
<xs:element minOccurs="0" ref="Telephone" />
<xs:element minOccurs="0" ref="Fax" />
<xs:element minOccurs="0" ref="Email" />
<xs:element minOccurs="0" ref="Website" />
<xs:element ref="SelfBillingIndicator" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de produto (AuditFile.MasterFiles.Product)-->
<xs:element name="Product">
<xs:annotation>
<xs:documentation>
Tabela de produtos/serviços
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="ProductType" />
<xs:element ref="ProductCode" />
<xs:element minOccurs="0" ref="ProductGroup" />
<xs:element ref="ProductDescription" />
<xs:element ref="ProductNumberCode" />
<xs:element name="CustomsDetails" type="CustomsDetails" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Impostos (AuditFile.MasterFiles.TaxTable) -->
<xs:element name="TaxTable">
<xs:annotation>
<xs:documentation>
Tabela de impostos
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" ref="TaxTableEntry" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Imposto -->
<xs:element name="TaxTableEntry">
<xs:annotation>
<xs:documentation>
Registo na tabela de impostos
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxType" />
<xs:element ref="TaxCountryRegion" minOccurs="0" />
<xs:element name="TaxCode" type="TaxTableEntryTaxCode" />
<xs:element name="Description" type="SAFAOtextTypeMandatoryMax255Car">
<xs:annotation>
<xs:documentation>
Descrição do imposto
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" ref="TaxExpirationDate" />
<xs:choice>
<xs:element ref="TaxPercentage" />
<xs:element ref="TaxAmount" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Movimentos Contabilisticos (AuditFile.GeneralLedgerEntries)-->
<xs:element name="GeneralLedgerEntries">
<xs:complexType>
<xs:annotation>
<xs:documentation>
Movimentos contabilísticos
Neste elemento registam-se os movimentos contabilísticos correspondentes ao periodo de exportação
a que diz respeito o SAF-T (AO), não devendo os movimentos de abertura ser objeto de exportação,
na medida em que estes são apenas refletidos ao nível do elemento GeneralLedgerAccounts.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="NumberOfEntries" />
<xs:element ref="TotalDebit" />
<xs:element ref="TotalCredit" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Journal">
<xs:annotation>
<xs:documentation>
Diários
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="JournalID" />
<xs:element ref="Description">
<xs:annotation>
<xs:documentation>
Descrição do diário
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Transaction">
<xs:annotation>
<xs:documentation>
Identificador da transação
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="TransactionID" />
<xs:element name="Period" type="SAFAOAccountingPeriod">
<xs:annotation>
<xs:documentation>
Período contabilístico
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="TransactionDate" />
<xs:element ref="SourceID" />
<xs:element ref="Description">
<xs:annotation>
<xs:documentation>
Descrição do movimento
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="DocArchivalNumber" />
<xs:element ref="TransactionType" />
<xs:element ref="GLPostingDate" />
<xs:choice>
<xs:element minOccurs="0" ref="CustomerID" />
<xs:element minOccurs="0" ref="SupplierID" />
</xs:choice>
<xs:element name="Lines">
<xs:complexType>
<xs:annotation>
<xs:documentation>
Estrutura agregadora das linhas de movimentos, que tem que incluir, pelo menos, uma linha de débito e uma linha de crédito.
Tem de ser tida em consideração a ordem dos elementos:
- Primeiro os de DebitLine
- Depois os de CreditLine
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:group ref="DebitLineGroup" minOccurs="1" maxOccurs="unbounded" />
<xs:group ref="CreditLineGroup" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Documentos Comerciais (AuditFile.SourceDocuments)-->
<xs:element name="SourceDocuments">
<xs:annotation>
<xs:documentation>
Documentos comerciais
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="SalesInvoices">
<xs:annotation>
<xs:documentation>
Documentos comerciais a clientes
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="NumberOfEntries" />
<xs:element ref="TotalDebit" />
<xs:element ref="TotalCredit" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Invoice">
<xs:annotation>
<xs:documentation>
Documento de venda
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="InvoiceNo" />
<!-- Estrutura da situacao atual do documento -->
<xs:element name="DocumentStatus">
<xs:annotation>
<xs:documentation>
Situação do documento
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="InvoiceStatus" />
<!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
<xs:element ref="InvoiceStatusDate" />
<xs:element minOccurs="0" ref="Reason" />
<xs:element ref="SourceID" />
<xs:element name="SourceBilling" type="SAFTAOSourceBilling" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="Hash" />
<xs:element ref="HashControl" />
<xs:element minOccurs="0" ref="Period" />
<xs:element ref="InvoiceDate" />
<xs:element ref="InvoiceType" />
<xs:element name="SpecialRegimes" type="SpecialRegimes" />
<xs:element ref="SourceID" />
<xs:element minOccurs="0" ref="EACCode" />
<xs:element ref="SystemEntryDate" />
<xs:element minOccurs="0" ref="TransactionID" />
<xs:element ref="CustomerID" />
<xs:element minOccurs="0" maxOccurs="1" ref="ShipTo" />
<xs:element minOccurs="0" maxOccurs="1" ref="ShipFrom" />
<xs:element minOccurs="0" maxOccurs="1" ref="MovementEndTime" />
<xs:element minOccurs="0" maxOccurs="1" ref="MovementStartTime" />
<xs:element maxOccurs="unbounded" name="Line">
<xs:annotation>
<xs:documentation>
Linha do documento
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="LineNumber" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="OrderReferences" type="OrderReferences" />
<xs:element ref="ProductCode" />
<xs:element ref="ProductDescription" />
<xs:element ref="Quantity" />
<xs:element ref="UnitOfMeasure" />
<xs:element ref="UnitPrice" />
<xs:element ref="TaxBase" minOccurs="0" />
<xs:element ref="TaxPointDate" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="References" type="References" />
<xs:element ref="Description">
<xs:annotation>
<xs:documentation>
Descrição da linha. Deve coincidir com aquela que consta do documento entregue ao cliente.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ProductSerialNumber" type="ProductSerialNumber" minOccurs="0" />
<xs:choice>
<xs:element ref="DebitAmount" />
<xs:element ref="CreditAmount" />
</xs:choice>
<xs:element name="Tax" type="Tax" />
<xs:group ref="TaxExemptions" minOccurs="0" />
<xs:element minOccurs="0" ref="SettlementAmount" />
<xs:element name="CustomsInformation" type="CustomsInformation" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DocumentTotals">
<xs:annotation>
<xs:documentation>
Totais do documento
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxPayable" />
<xs:element ref="NetTotal" />
<xs:element ref="GrossTotal" />
<xs:element minOccurs="0" name="Currency" type="Currency" />
<!-- A estrutura Settlement representa acordos ou formas de pagamento futuros. Nao constitui em caso algum o somatorio dos descontos concedidos e reflectidos nas linhas dos documentos e a informacao aqui constante nao influi o montante total do documento (GrossTotal) -->
<xs:element minOccurs="0" maxOccurs="unbounded" name="Settlement" type="Settlement" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Payment" type="PaymentMethod" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="WithholdingTax" type="WithholdingTax" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="MovementOfGoods">
<xs:complexType>
<xs:sequence>
<xs:element ref="NumberOfMovementLines" />
<xs:element ref="TotalQuantityIssued" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="StockMovement">
<xs:complexType>
<xs:sequence>
<xs:element ref="DocumentNumber" />
<!-- Estrutura da situacao atual do documento -->
<xs:element name="DocumentStatus">
<xs:complexType>
<xs:sequence>
<xs:element ref="MovementStatus" />
<!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
<xs:element ref="MovementStatusDate" />
<xs:element minOccurs="0" ref="Reason" />
<xs:element ref="SourceID" />
<xs:element name="SourceBilling" type="SAFTAOSourceBilling" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="Hash" />
<xs:element ref="HashControl" />
<xs:element minOccurs="0" ref="Period" />
<xs:element ref="MovementDate" />
<xs:element ref="MovementType" />
<xs:element ref="SystemEntryDate" />
<xs:element minOccurs="0" ref="TransactionID" />
<xs:choice>
<xs:element ref="CustomerID" />
<xs:element ref="SupplierID" />
</xs:choice>
<xs:element ref="SourceID" />
<xs:element minOccurs="0" ref="EACCode" />
<xs:element minOccurs="0" ref="MovementComments" />
<xs:element minOccurs="0" maxOccurs="1" ref="ShipTo" />
<xs:element minOccurs="0" maxOccurs="1" ref="ShipFrom" />
<xs:element minOccurs="0" maxOccurs="1" ref="MovementEndTime" />
<xs:element maxOccurs="1" ref="MovementStartTime" />
<xs:element minOccurs="0" maxOccurs="1" ref="AGTDocCodeID" />
<xs:element maxOccurs="unbounded" name="Line">
<xs:complexType>
<xs:sequence>
<xs:element ref="LineNumber" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="OrderReferences" type="OrderReferences" />
<xs:element ref="ProductCode" />
<xs:element ref="ProductDescription" />
<xs:element ref="Quantity" />
<xs:element ref="UnitOfMeasure" />
<xs:element ref="UnitPrice" />
<xs:element ref="Description" />
<xs:element name="ProductSerialNumber" type="ProductSerialNumber" minOccurs="0" />
<xs:choice>
<xs:element ref="DebitAmount" />
<xs:element ref="CreditAmount" />
</xs:choice>
<xs:element minOccurs="0" name="Tax" type="MovementTax" />
<xs:group minOccurs="0" ref="TaxExemptions" />
<xs:element minOccurs="0" ref="SettlementAmount" />
<xs:element name="CustomsInformation" type="CustomsInformation" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DocumentTotals">
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxPayable" />
<xs:element ref="NetTotal" />
<xs:element ref="GrossTotal" />
<xs:element minOccurs="0" name="Currency" type="Currency" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="WorkingDocuments">
<xs:complexType>
<xs:sequence>
<xs:element ref="NumberOfEntries" />
<xs:element ref="TotalDebit" />
<xs:element ref="TotalCredit" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="WorkDocument">
<xs:complexType>
<xs:sequence>
<xs:element ref="DocumentNumber" />
<xs:element name="DocumentStatus">
<xs:complexType>
<xs:sequence>
<xs:element ref="WorkStatus" />
<!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
<xs:element ref="WorkStatusDate" />
<xs:element minOccurs="0" ref="Reason" />
<xs:element ref="SourceID" />
<xs:element name="SourceBilling" type="SAFTAOSourceBilling" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="Hash" />
<xs:element ref="HashControl" />
<xs:element minOccurs="0" ref="Period" />
<xs:element ref="WorkDate" />
<xs:element ref="WorkType" />
<xs:element ref="SourceID" />
<xs:element minOccurs="0" ref="EACCode" />
<xs:element ref="SystemEntryDate" />
<xs:element minOccurs="0" ref="TransactionID" />
<xs:element ref="CustomerID" />
<xs:element maxOccurs="unbounded" name="Line">
<xs:complexType>
<xs:sequence>
<xs:element ref="LineNumber" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="OrderReferences" type="OrderReferences" />
<xs:element ref="ProductCode" />
<xs:element ref="ProductDescription" />
<xs:element ref="Quantity" />
<xs:element ref="UnitOfMeasure" />
<xs:element ref="UnitPrice" />
<xs:element ref="TaxBase" minOccurs="0" />
<xs:element ref="TaxPointDate" />
<xs:element ref="Description" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="References" type="References" />
<xs:element name="ProductSerialNumber" type="ProductSerialNumber" minOccurs="0" />
<xs:choice>
<xs:element ref="DebitAmount" />
<xs:element ref="CreditAmount" />
</xs:choice>
<xs:element minOccurs="0" name="Tax" type="Tax" />
<xs:group ref="TaxExemptions" minOccurs="0" />
<xs:element minOccurs="0" ref="SettlementAmount" />
<xs:element name="CustomsInformation" type="CustomsInformation" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DocumentTotals">
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxPayable" />
<xs:element ref="NetTotal" />
<xs:element ref="GrossTotal" />
<xs:element minOccurs="0" name="Currency" type="Currency" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="Payments">
<xs:complexType>
<xs:sequence>
<xs:element ref="NumberOfEntries" />
<xs:element ref="TotalDebit" />
<xs:element ref="TotalCredit" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Payment">
<xs:complexType>
<xs:sequence>
<xs:element ref="PaymentRefNo" />
<xs:element minOccurs="0" ref="Period" />
<xs:element minOccurs="0" ref="TransactionID" />
<xs:element ref="TransactionDate" />
<xs:element name="PaymentType" type="SAFTAOPaymentType" />
<xs:element minOccurs="0" ref="Description" />
<xs:element minOccurs="0" ref="SystemID" />
<xs:element name="DocumentStatus">
<xs:complexType>
<xs:sequence>
<xs:element ref="PaymentStatus" />
<!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
<xs:element ref="PaymentStatusDate" />
<xs:element minOccurs="0" ref="Reason" />
<xs:element ref="SourceID" />
<xs:element name="SourcePayment" type="SAFTAOSourcePayment" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="PaymentMethod" type="PaymentMethod" />
<xs:element ref="SourceID" />
<xs:element ref="SystemEntryDate" />
<xs:element ref="CustomerID" />
<xs:element maxOccurs="unbounded" name="Line">
<xs:complexType>
<xs:sequence>
<xs:element ref="LineNumber" />
<xs:element maxOccurs="unbounded" name="SourceDocumentID">
<xs:complexType>
<xs:sequence>
<xs:element ref="OriginatingON" />
<xs:element ref="InvoiceDate" />
<xs:element minOccurs="0" ref="Description" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" ref="SettlementAmount" />
<xs:choice>
<xs:element ref="DebitAmount" />
<xs:element ref="CreditAmount" />
</xs:choice>
<xs:element minOccurs="0" name="Tax" type="PaymentTax" />
<xs:group ref="TaxExemptions" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DocumentTotals">
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxPayable" />
<xs:element ref="NetTotal" />
<xs:element ref="GrossTotal" />
<!-- O conteudo desta estrutura Settlement representa o somatorio dos descontos reflectidos no elemento SettlementAmount das linhas do recibo. Trata-se de um raciocinio diverso da tabela 4.1 SalesInvoices -->
<xs:element minOccurs="0" name="Settlement">
<xs:complexType>
<xs:sequence>
<xs:element ref="SettlementAmount" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="Currency" type="Currency" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="WithholdingTax" type="WithholdingTax" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="PurchaseInvoices">
<xs:complexType>
<xs:annotation>
<xs:documentation>
Documentos comerciais de Fornecedores
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="NumberOfEntries" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Invoice">
<xs:complexType>
<xs:sequence>
<xs:element name="InvoiceNo" type="ns:SAFAOtextTypeMandatoryMax60Car" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="References" type="PurchaseReferences" />
<xs:element ref="Hash">
<xs:annotation>
<xs:documentation>
Preencher com os 4 valores correspondentes ao Hash constantes no documento impresso.
O campo deve ser preenchido com “0” (zero), caso não haja obrigatoriedade de validação.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="SourceID" />
<xs:element minOccurs="0" ref="Period" />
<xs:element ref="InvoiceDate" />
<xs:element ref="PurchaseType" />
<xs:element ref="SupplierID" />
<xs:element name="DocumentTotals">
<xs:complexType>
<xs:sequence>
<xs:element ref="TaxPayable" />
<xs:element ref="NetTotal" />
<xs:element ref="GrossTotal" />
<xs:group ref="DeductibleTaxes" minOccurs="0" maxOccurs="unbounded" />
<xs:element minOccurs="0" name="Currency" type="Currency" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="WithholdingTax" type="WithholdingTax">
<xs:annotation>
<xs:documentation>Informação relativa a impostos retidos pelo fornecedor.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- ESTRUTURAS DE SUPORTE -->
<!-- Estrutura de Moradas -->
<xs:complexType name="AddressStructure">
<xs:annotation>
<xs:documentation>
Endereço
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" ref="BuildingNumber" />
<xs:element minOccurs="0" ref="StreetName" />
<xs:element ref="AddressDetail" />
<xs:element ref="City" />
<xs:element ref="PostalCode" minOccurs="0" />
<xs:element minOccurs="0" ref="Province" />
<xs:element ref="Country" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Moradas para Angola-->
<xs:complexType name="AddressStructureAO">
<xs:sequence>
<xs:element minOccurs="0" ref="BuildingNumber" />
<xs:element minOccurs="0" ref="StreetName" />
<xs:element ref="AddressDetail" />
<xs:element ref="City" />
<xs:element minOccurs="0" name="PostalCode" type="PostalCodeAO" />
<xs:element minOccurs="0" ref="Province" />
<xs:element name="Country" fixed="AO" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de valor monetario -->
<!-- Este elemento apenas deve ser gerado quando a moeda original do documento for diferente de AOA -->
<xs:complexType name="Currency">
<xs:annotation>
<xs:documentation>
Moeda estrangeira
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="CurrencyCode" />
<xs:element ref="CurrencyAmount" />
<xs:element ref="ExchangeRate" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de caracterização aduaneira de produtos-->
<xs:complexType name="CustomsDetails">
<xs:annotation>
<xs:documentation>
Caracterização aduaneira
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="UNNumber" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de informacao aduaneira-->
<xs:complexType name="CustomsInformation">
<xs:annotation>
<xs:documentation>
Informação aduaneira
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="ARCNo" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="IECAmount" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de numero de serie do produto-->
<xs:complexType name="ProductSerialNumber">
<xs:annotation>
<xs:documentation>
Número de série
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="SerialNumber" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Taxa de documentos de movimentacao de mercadorias-->
<xs:complexType name="MovementTax">
<xs:annotation>
<xs:documentation>
Impostos
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="TaxType" type="SAFTAOMovementTaxType" />
<xs:element ref="TaxCountryRegion" minOccurs="0" />
<xs:element name="TaxCode" type="SAFTAOMovementTaxCode" />
<xs:element ref="TaxPercentage" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Referencias ao documento de origem-->
<xs:complexType name="OrderReferences">
<xs:annotation>
<xs:documentation>
Existindo a necessidade de efectuar mais do que uma referência, esta estrutura poderá ser gerada tantas vezes quantas as necessárias.
O preenchimento é obrigatório, quando o campo 4.1.4.8. for preenchendo com “NC” – Nota de crédito para um documento de ano económico anterior.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" ref="OriginatingON">
<xs:annotation>
<xs:documentation>
Deve ser indicado o tipo, a série e o número do documento que suporta a emissão deste.
Se o documento estiver contido no SAF-T AO deve ser utilizada a estrutura de numeração do campo de origem.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" ref="OrderDate" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de pagamentos-->
<xs:complexType name="PaymentMethod">
<xs:annotation>
<xs:documentation>
Relativo à forma e ao método de pagamento. Havendo mais que um, pode ser repetido quantas vezes forem necessárias.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element ref="PaymentMechanism" minOccurs="0" />
<xs:element name="PaymentAmount" type="SAFmonetaryType">
<xs:annotation>
<xs:documentation>
Montante por meio de pagamento.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="PaymentDate" type="SAFdateType">
<xs:annotation>
<xs:documentation>
Data do pagamento.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Taxa dos recibos-->
<xs:complexType name="PaymentTax">
<xs:sequence>
<xs:element ref="TaxType" />
<xs:element ref="TaxCountryRegion" minOccurs="0" />
<xs:element name="TaxCode" type="PaymentTaxCode" />
<xs:choice>
<xs:element ref="TaxPercentage" />
<xs:element ref="TaxAmount" />
</xs:choice>