Ir para o conteúdo
cjulio

Utilizar Webservices da AT

Mensagens Recomendadas

araujor    3
araujor

Ah bom! Fico mais descansado... imagino o "pesadelo" de tanta gente que por aqui anda a criar o SOAP BODY manualmente, e a olhar a erros de sintaxe, semântica, isto para não falar na formatação de campos, etc etc...

Pela minha humilde opinião acerca deste assunto, o que tenho a dizer e que tanto por wsdl através de service Reference ou por HARDCODING são exactamente iguais. Se houver alterações por parte da AT (o que está sempre a acontecer) tens que sempre que analisar/adaptar o teu código ás ditas alterações tanto por um método como pelo outro. O wsdl é como o nome indica apenas uma especificação "de uma classe", não uma implementação. O wsdl facilita um pouco a implementação, tens sempre que fazer validações no teu código.

Este paradigma associa-se muito à forma como cada um de nós programa.

Eu por exemplo sei muito bem onde defino o header, onde faço a encriptação, onde valido se se trata de um nif nacional/internacional e gero o xml "à unha"... etc... etc... e não vejo qual o problema.

Pela minha experiência posso concluir que se seguisse as regras pelo WSDL e com a falta de suporte/especificações da documentação que ainda tinha demorado o triplo do tempo na implementação.

Para que todos nós que travamos esta batalha diária penso que alguém deveria expor aqui pelo menos uma implementação por wsdl e comparamos todos em conjunto os verdadeiros prós e contras tanto de uma como outra implementações.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Pepe71    2
Pepe71

Estou a obter o seguinte a resposta:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>33</faultcode>
<faultstring>complex-type 2.3: element {https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/}envioDocumentoTransporteRequestElem of type {https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/}StockMovement may not have text content</faultstring>
<detail>sgdtws.gdgt</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

Alguém tem uma ideia para o sucedido? Estou a construir o xml à unha

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
augustoc    0
augustoc

Boas, neste bloco de código está-me a acontecer o seguinte:

if (ex.Status == WebExceptionStatus.ProtocolError)
{
WebResponse resp = ex.Response;
StreamReader sr = new StreamReader(resp.GetResponseStream());
string fff = sr.ReadToEnd();
return fff;
}
else
{
return ex.Message;
}

Em caso de excepção está a entrar sempre no primeiro IF, mas ao fazer return da variável fff, devia sai da função certo? Mas está-me a passar para o ELSE, quando não devia! Alguma solução? Porque assim não me retorna a mensagem de erro como esperado mas sim sempre erro interno 505.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
costa1143    11
costa1143

Olá boa tarde!

Recebi esta semana o Certificado e a Chave pública para a cifra da password de acesso e ia dar inicio ao desenvolvimento do envio de documentos de transporte através do webservice.

Tenho algumas dúvidas ainda acerca da implementação, mas para já queria-vos perguntar apenas umas básicas.

No ponto 3.1.2 da documentação da AT eles afirmam:

  • 1. Solicitar as credenciais de subutilizador e senha criada para os testes de comunicação dos documentos de transporte (e.g., 555555555/55 + SENHA);

Que utilizador é este? É o subutilizador da empresa produtora de software criado para o envio de documentos de transporte?
  • 2. Cifrar a senha e compor o SOAP:Header de acordo com o definido na secção 4.1

Para cifrarmos a senha usamos o certificado enviado pela AT ("ChavePublicaAT.cer")?

Estou a programar em PHP, mais alguém aqui tem utilizado esta linguagem para o desenvolvimento? Se conseguir dar umas dicas ficava extremamente agradecido!

Obrigado e parabéns pelo serviço público prestado neste tópico!

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Sergio.    10
Sergio.

Bom dia a todos,

Estou a utilizar OpenSSL para gerar o HEADER

Afim de esclarecer algumas duvidas, agradecia, desde já, que

alguém que já tenha conseguido comunicar com a AT,

disponibilizasse o seguinte:

do XML enviado, o campo

<wss:Nonce>

e

<wss:Created>

mais a Chave Simétrica;

para assim poder perceber quais os parâmetros a utilizar no OPENSSL,

pois não estou a conseguir a comunicação

tenho sempre o erro 8

<faultcode>8 </faultcode>

<faultstring>Rejected: | Codigo: 8 |

Erro: Created: Não foi possível decifrar o campo |

Tentativas Restantes: -1</faultstring>

Obrigado.

Também tou com esse erro, essa informação seria útil para retirar algumas duvidas.

Custa muito alguém ajudar com esta informação?

Ficava agradecido, até porque alguns estão já satisfeitos e o que se pede é muito pouco.

A tese de fazer à mão ou usar um serviço de wdsl tudo depende do que se tem à mão e de cada um.

É como a Teoria de todos aqui acharem que só existe java, vb e c# e PHP já diz alguma coisa sobre o estado das coisas.

A verdade é que existe um sem numero de linguagens e acreditem ou não, nem todas têm a mesma relação com webservices.

Acho que uma mente mais aberta seria benéfico e ajudaria muitos dos que estão sempre a perguntar o mesmo e ninguém se digna a responder.

Obrigado

Editado por Sergio.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
AntonioPereira    2
AntonioPereira

Ok a funcionar novamente, atenção que o campo VehicleID passou a ter validação caso seja preenchido formato: XX-XX-XX

Boa tarde.

Podes-me dizer onde viste isso ? Na estrutura apenas diz que tem que ter um máximo de 32 caracteres

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
FernandoPereira    66
FernandoPereira

Boas,

A mim o envio de documentos de transporte está a devolver sempre o erro 11 (Validade da credencial expirada).

Alguém está com o mesmo erro?

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
AntonioPereira    2
AntonioPereira

Olá boa tarde!

Recebi esta semana o Certificado e a Chave pública para a cifra da password de acesso e ia dar inicio ao desenvolvimento do envio de documentos de transporte através do webservice.

Tenho algumas dúvidas ainda acerca da implementação, mas para já queria-vos perguntar apenas umas básicas.

No ponto 3.1.2 da documentação da AT eles afirmam:

  • 1. Solicitar as credenciais de subutilizador e senha criada para os testes de comunicação dos documentos de transporte (e.g., 555555555/55 + SENHA);

Que utilizador é este? É o subutilizador da empresa produtora de software criado para o envio de documentos de transporte?
  • 2. Cifrar a senha e compor o SOAP:Header de acordo com o definido na secção 4.1

Para cifrarmos a senha usamos o certificado enviado pela AT ("ChavePublicaAT.cer")?

Estou a programar em PHP, mais alguém aqui tem utilizado esta linguagem para o desenvolvimento? Se conseguir dar umas dicas ficava extremamente agradecido!

Obrigado e parabéns pelo serviço público prestado neste tópico!

Boas.

1 - Não. Cada empresa que utiliza o software criado para o envio de documentos de transporte tem que criar um subutilizador.

2 - Usas esse certificado para cifrares com a chave simetrica que irá gerar o campo nonce. A "password" e o "created" é cifrada com a chave simetrica

Boas,

A mim o envio de documentos de transporte está a devolver sempre o erro 11 (Validade da credencial expirada).

Alguém está com o mesmo erro?

Sim, ja tive esse erro. Tinha a ver com o campo created, a hora que eu estava a user era a hora antiga (-1 hora).

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Cr4zyKingLi0n    12
Cr4zyKingLi0n

Boas,

A mim o envio de documentos de transporte está a devolver sempre o erro 11 (Validade da credencial expirada).

Alguém está com o mesmo erro?

Verifica a hora, alguns posts neste tópico tiveram este problema (eu inclusive) e tinha a ver com a hora.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
cealex    3
cealex

roadmap para o pessoal de java, em eclipse

usem a versão 1.7 do java, dá sorte ...

<p>fazer o download de:

- https://dl.dropboxusercontent.com/u/126065/Colibri/FACTEMIPFCLI-1.0.3.0016-src.zip

- apache-cxf-2.7.4.zip

necessario ter um "apache tomcat" numa directoria local

em:

http://info.portaldasfinancas.gov.pt/pt/apoio_contribuinte/

copiar o xml para um dir de

"http://info.portaldasfinancas.gov.pt/NR/rdonlyres/A75E1110-7EB8-479E-BC09-6D5B726F6A1C/0/documentosTransporte.wsdl"

renomear para wsdl

criar um "dynamic web project"

colocar o wsdl nesse projecto de eclipse

criar um new "webservice client"

selecionar o wsdl que esta dentro do projecto

selecionar apache CXF 2.x e selecionar o "server runtime" Tomcat v7.0

irá ser gerada a package pt.gov.portaldasfinancas.servicos.sgdtws.documentostransporte

depois copiar estas classes para o vosso projecto final

um bom ponto de partida são as sources das facturas

na classe xxxx_xxxxSOAP_Client tem um codigo de exemplo

(xxxx, depende do nome do vosso wsdl)

----------------

<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'><S:Header><wss:Security xmlns:wss='http://schemas.xmlsoap.org/ws/2002/12/secext'><wss:UsernameToken><wss:Username>XXXXXXXX</wss:Username><wss:Password>YYYYYYY</wss:Password><wss:Nonce>xyxyxyxyxyx</wss:Nonce><wss:Created>kakakakaka</wss:Created></wss:UsernameToken></wss:Security></S:Header><S:Body><ns2:envioDocumentoTransporteRequestElem xmlns:ns2='https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/'><TaxRegistrationNumber>aaaaa</TaxRegistrationNumber><CompanyName>blabla</CompanyName><CompanyAddress><Addressdetail>AddressDetail</Addressdetail><City>Lisboa</City><PostalCode>3880-068</PostalCode><Country>PT</Country></CompanyAddress><DocumentNumber>000077783</DocumentNumber><MovementStatus>N</MovementStatus><MovementDate>2013-04-17</MovementDate><MovementType>GT</MovementType><CustomerTaxID>123456789</CustomerTaxID><CustomerAddress><Addressdetail>customerAddressDetail</Addressdetail><City>customerCity</City><PostalCode>3880-068</PostalCode><Country>PT</Country></CustomerAddress><CustomerName>CustomerName558201737</CustomerName><AddressTo><Addressdetail>shipToAddressDetail</Addressdetail><City>shipToCity</City><PostalCode>3880-068</PostalCode><Country>PT</Country></AddressTo><AddressFrom><Addressdetail>shipFromAddressDetail</Addressdetail><City>shipFromCity</City><PostalCode>3880-068</PostalCode><Country>PT</Country></AddressFrom><MovementEndTime>2013-04-18T16:03:04</MovementEndTime><MovementStartTime>2013-04-17T17:03:04</MovementStartTime><VehicleID>AA-00-11</VehicleID><Line><OrderReferences><OriginatingON>000077780</OriginatingON></OrderReferences><ProductDescription>Garrafao de tinto</ProductDescription><Quantity>1</Quantity><UnitOfMeasure>UN</UnitOfMeasure><UnitPrice>100.24</UnitPrice></Line><Line><OrderReferences><OriginatingON>000077781</OriginatingON></OrderReferences><ProductDescription>aguardente</ProductDescription><Quantity>2</Quantity><UnitOfMeasure>UN</UnitOfMeasure><UnitPrice>78.32</UnitPrice></Line></ns2:envioDocumentoTransporteRequestElem></S:Body></S:Envelope>

Editado por Rui Carlos
GeSHi

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Diogo_Marcelo    0
Diogo_Marcelo

Boa tarde malta,

Para alêm deste sistema de webservice, é possivel envia via ficheiro saft.

Já alguem encontrou o sitio para download do novo esquema de 1 maio?

Já andei as voltas no portal das finanças e não encontrei nada.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
eesteves    5
eesteves

Boa tarde malta,

Para alêm deste sistema de webservice, é possivel envia via ficheiro saft.

Já alguem encontrou o sitio para download do novo esquema de 1 maio?

Já andei as voltas no portal das finanças e não encontrei nada.

Também estou a tentar por essa via. Parece que ainda não existe (ou temos de usar a versão 1.01_01 ?)

Quando submeto o meu ficheiro no formato 1.01_01 dá-me este erro:

«O ficheiro selecionado não está de acordo com o formato exigido. Erro cvv-elt.1: Cannot find the declaration of element 'AuditFile'»

Mas é claro que o elemento AuditFile está lá...

Alguém já conseguiu submeter um ficheiro SAFT de documentos de transporte?

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
jpedro2013    1
jpedro2013

Boa tarde.

Podes-me dizer onde viste isso ? Na estrutura apenas diz que tem que ter um máximo de 32 caracteres

sim na estrutura diz que é um string. mas se enviares algo com . (ponto final) ele valida, eu estava a colocar um ponto final quando não introduzia o veiculo.

o retorno do error é que tem que estar no formato XX-XX-XX

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Always    1
Always

fonte não official do novo SAF-T PT (retirado a partir do .jar da submissão dos documentos de transporte)

já dá para ir adiantando umas coisinhas...

<?xml version="1.0" encoding="Windows-1252"?>
<!--Created with Liquid XML Studio - FREE Community Edition 7.1.6.1440 (http://www.liquid-technologies.com)-->
<xs:schema xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation" xmlns:ns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" version="1.02_01" id="SAF-T_PT" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:annotation>
   <xs:documentation>
  <doc:Title>Standard Audit File - Portuguese Version</doc:Title>
  <doc:Subject>Standard Audit File - Portuguese Version</doc:Subject>
  <doc:Copyright>Copyright OECD</doc:Copyright>
  <doc:Version>
    <doc:Number>1.02_01</doc:Number>
    <doc:Status>Production</doc:Status>
  </doc:Version>
  <doc:Author>Autoridade Tributária e Aduaneira</doc:Author>
  <doc:ModificationDate>2013-03-08</doc:ModificationDate>
   </xs:documentation>
 </xs:annotation>
 <!-- Estrutura do ficheiro SAFT-PT-->
 <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="GeneralLedger" />
		  <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:GeneralLedger" />
  <xs:field xpath="ns:AccountID" />
   </xs:unique>
   <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="GeneralLedgerEntriesAccountIDConstraint" refer="AccountIDConstraint">
  <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction/ns:Line" />
  <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:keyref name="GeneralLedgerEntriesSupplierIDConstraint" refer="SupplierIDConstraint">
  <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
  <xs:field xpath="ns:SupplierID" />
   </xs:keyref>
   <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:element>
 <!-- Estrutura de cabeçalho (AuditFile.Header) -->
 <xs:element name="Header">
   <xs:complexType>
  <xs:sequence>
    <xs:element ref="AuditFileVersion" />
    <xs:element ref="CompanyID" />
    <xs:element name="TaxRegistrationNumber" type="SAFPTPortugueseVatNumber" />
    <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 fixed="EUR" name="CurrencyCode" />
    <xs:element ref="DateCreated" />
    <xs:element ref="TaxEntity" />
    <xs:element ref="ProductCompanyTaxID" />
    <xs:element ref="SoftwareCertificateNumber" />
    <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="GeneralLedger">
   <xs:complexType>
  <xs:sequence>
    <xs:element name="AccountID" type="SAFPTGLAccountID" />
    <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="SAFPTGLAccountID" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!--    Estrutura de Cliente (AuditFile.MasterFiles.Customer) -->
 <xs:element name="Customer">
   <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: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: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:sequence>
   </xs:complexType>
 </xs:element>
 <!--    Estrutura de Impostos (AuditFile.MasterFiles.TaxTable) -->
 <xs:element name="TaxTable">
   <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:complexType>
  <xs:sequence>
    <xs:element ref="TaxType" />
    <xs:element ref="TaxCountryRegion" />
    <xs:element ref="TaxCode" />
    <xs:element name="Description" type="SAFPTtextTypeMandatoryMax255Car" />
    <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:sequence>
    <xs:element ref="NumberOfEntries" />
    <xs:element ref="TotalDebit" />
    <xs:element ref="TotalCredit" />
    <xs:element minOccurs="0" maxOccurs="unbounded" name="Journal">
	  <xs:complexType>
	    <xs:sequence>
		  <xs:element ref="JournalID" />
		  <xs:element ref="Description" />
		  <xs:element minOccurs="0" maxOccurs="unbounded" name="Transaction">
		    <xs:complexType>
			  <xs:sequence>
			    <xs:element ref="TransactionID" />
			    <xs:element name="Period" type="SAFPTAccountingPeriod" />
			    <xs:element ref="TransactionDate" />
			    <xs:element ref="SourceID" />
			    <xs:element ref="Description" />
			    <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 minOccurs="2" maxOccurs="unbounded" name="Line">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="RecordID" />
					  <xs:element name="AccountID" type="SAFPTGLAccountID" />
					  <xs:element minOccurs="0" ref="SourceDocumentID" />
					  <xs:element ref="SystemEntryDate" />
					  <xs:element ref="Description" />
					  <xs:choice maxOccurs="1">
					    <xs:element ref="DebitAmount" />
					    <xs:element ref="CreditAmount" />
					  </xs:choice>
				    </xs:sequence>
				  </xs:complexType>
			    </xs:element>
			  </xs:sequence>
		    </xs:complexType>
		  </xs:element>
	    </xs:sequence>
	  </xs:complexType>
    </xs:element>
  </xs:sequence>
   </xs:complexType>
   <xs:unique name="JournalIdConstraint">
  <xs:selector xpath="ns:Journal" />
  <xs:field xpath="ns:JournalID" />
   </xs:unique>
   <xs:unique name="TransactionIdConstraint">
  <xs:selector xpath="ns:Journal/ns:Transaction" />
  <xs:field xpath="ns:TransactionID" />
   </xs:unique>
 </xs:element>
 <!-- Estrutura de Documentos Comerciais (AuditFile.SourceDocuments)-->
 <xs:element name="SourceDocuments">
   <xs:complexType>
  <xs:sequence>
    <xs:element minOccurs="0" name="SalesInvoices">
	  <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:complexType>
			  <xs:sequence>
			    <xs:element ref="InvoiceNo" />
			    <!-- Estrutura da situação do documento -->
			    <xs:element name="DocumentStatus">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="InvoiceStatus" />
					  <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				  </xs:complexType>
			    </xs:element>
			    <xs:element ref="SourceBilling" />
			    <xs:element ref="Hash" />
			    <xs:element minOccurs="0" ref="HashControl" />
			    <xs:element minOccurs="0" ref="Period" />
			    <xs:element ref="InvoiceDate" />
			    <xs:element ref="InvoiceType" />
			    <xs:element ref="SelfBillingIndicator" />
			    <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:complexType>
				    <xs:sequence>
					  <xs:element ref="LineNumber" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					  <xs:element ref="ProductCode" />
					  <xs:element ref="ProductDescription" />
					  <xs:element ref="Quantity" />
					  <xs:element ref="UnitOfMeasure" />
					  <xs:element ref="UnitPrice" />
					  <xs:element ref="TaxPointDate" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="References" />
					  <xs:element ref="Description" />
					  <xs:choice>
					    <xs:element ref="DebitAmount" />
					    <xs:element ref="CreditAmount" />
					  </xs:choice>
					  <xs:element ref="Tax" />
					  <xs:element minOccurs="0" ref="TaxExemptionReason" />
					  <xs:element minOccurs="0" ref="SettlementAmount" />
				    </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" ref="Currency" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="Settlement" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="Payment" />
				    </xs:sequence>
				  </xs:complexType>
			    </xs:element>
			    <xs:element minOccurs="0" ref="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 situação do documento -->
			    <xs:element name="DocumentStatus">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="MovementStatus" />
					  <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				  </xs:complexType>
			    </xs:element>
			    <xs:element ref="SourceBilling" />
			    <xs:element ref="Hash" />
			    <xs:element minOccurs="0" 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" />
			    <!-- Nos documentos resumo (MovementStatus "R"), na ausência de informação concreta, a hora de inicio de transporte (MovementStartTime) pode ser indicada com a concatenação da data constante no campo MovementDate com a hora 00:00:00-->
			    <xs:element minOccurs="0" maxOccurs="1" ref="ATDocCodeID" />
			    <xs:element maxOccurs="unbounded" name="Line">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="LineNumber" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="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:choice>
					    <xs:element ref="DebitAmount" />
					    <xs:element ref="CreditAmount" />
					  </xs:choice>
					  <xs:element minOccurs="0" name="Tax" type="MovementTax" />
					  <xs:element minOccurs="0" ref="TaxExemptionReason" />
					  <xs:element minOccurs="0" ref="SettlementAmount" />
				    </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" ref="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" />
			    <!-- Estrutura da situação do documento -->
			    <xs:element name="DocumentStatus">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="WorkStatus" />
					  <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				  </xs:complexType>
			    </xs:element>
			    <xs:element ref="Hash" />
			    <xs:element minOccurs="0" 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 ref="CustomerID" />
			    <xs:element maxOccurs="unbounded" name="Line">
				  <xs:complexType>
				    <xs:sequence>
					  <xs:element ref="LineNumber" />
					  <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					  <xs:element ref="ProductCode" />
					  <xs:element ref="ProductDescription" />
					  <xs:element ref="Quantity" />
					  <xs:element ref="UnitOfMeasure" />
					  <xs:element ref="UnitPrice" />
					  <xs:element ref="TaxPointDate" />
					  <xs:element ref="Description" />
					  <xs:choice>
					    <xs:element ref="DebitAmount" />
					    <xs:element ref="CreditAmount" />
					  </xs:choice>
					  <xs:element minOccurs="0" ref="Tax" />
					  <xs:element minOccurs="0" ref="TaxExemptionReason" />
					  <xs:element minOccurs="0" ref="SettlementAmount" />
				    </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" ref="Currency" />
				    </xs:sequence>
				  </xs:complexType>
			    </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: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" />
  <xs:element minOccurs="0" ref="Region" />
  <xs:element ref="Country" />
   </xs:sequence>
 </xs:complexType>
 <!-- Estrutura de Moradas para Portugal-->
 <xs:complexType name="AddressStructurePT">
   <xs:sequence>
  <xs:element minOccurs="0" ref="BuildingNumber" />
  <xs:element minOccurs="0" ref="StreetName" />
  <xs:element ref="AddressDetail" />
  <xs:element ref="City" />
  <xs:element name="PostalCode" type="PostalCodePT" />
  <xs:element minOccurs="0" ref="Region" />
  <xs:element fixed="PT" name="Country" />
   </xs:sequence>
 </xs:complexType>
 <!-- Estrutura de valor monetário -->
 <!-- Este elemento apenas deve ser gerado quando a moeda original do documento for diferente de euro -->
 <xs:element name="Currency">
   <xs:complexType>
  <xs:sequence>
    <xs:element ref="CurrencyCode" />
    <xs:element ref="CurrencyAmount" />
    <xs:element minOccurs="0" ref="ExchangeRate" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de Taxa de documentos de movimentação de mercadorias-->
 <xs:complexType name="MovementTax">
   <xs:sequence>
  <xs:element name="TaxType" type="SAFTPTMovementTaxType" />
  <xs:element ref="TaxCountryRegion" />
  <xs:element name="TaxCode" type="SAFTPTMovementTaxCode" />
  <xs:element ref="TaxPercentage" />
   </xs:sequence>
 </xs:complexType>
 <!-- Estrutura de Referências ao documento de origem-->
 <xs:element name="OrderReferences">
   <xs:complexType>
  <xs:sequence>
    <xs:element minOccurs="0" ref="OriginatingON" />
    <xs:element minOccurs="0" ref="OrderDate" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de pagamentos-->
 <xs:element name="Payment">
   <xs:complexType>
  <xs:sequence>
    <xs:element ref="PaymentMechanism" />
    <xs:element name="PaymentAmount" type="SAFmonetaryType" />
    <xs:element name="PaymentDate" type="SAFdateType" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de referências a outros documentos em documentos retificativos de faturas-->
 <xs:element name="References">
   <xs:complexType>
  <xs:sequence>
    <xs:element minOccurs="0" ref="Reference" />
    <xs:element minOccurs="0" ref="Reason" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de Acordos entre cliente e fornecedor-->
 <xs:element name="Settlement">
   <xs:complexType>
  <xs:sequence>
    <xs:element minOccurs="0" name="SettlementDiscount" type="SAFPTtextTypeMandatoryMax30Car" />
    <xs:element minOccurs="0" name="SettlementAmount" type="SAFmonetaryType" />
    <xs:element minOccurs="0" name="SettlementDate" type="SAFdateType" />
    <xs:element minOccurs="0" name="PaymentTerms" type="SAFPTtextTypeMandatoryMax100Car" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de entregas de produtos -->
 <xs:complexType name="ShippingPointStructure">
   <xs:sequence>
  <xs:element minOccurs="0" maxOccurs="unbounded" ref="DeliveryID" />
  <xs:element minOccurs="0" ref="DeliveryDate" />
  <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:element minOccurs="0" ref="WarehouseID" />
    <xs:element minOccurs="0" ref="LocationID" />
  </xs:sequence>
  <xs:element minOccurs="0" ref="Address" />
   </xs:sequence>
 </xs:complexType>
 <!-- Estrutura de Moradas para Fornecedores-->
 <xs:complexType name="SupplierAddressStructure">
   <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" />
  <xs:element minOccurs="0" ref="Region" />
  <xs:element name="Country" type="SupplierCountry" />
   </xs:sequence>
 </xs:complexType>
 <!-- Estrutura de Taxa -->
 <xs:element name="Tax">
   <xs:complexType>
  <xs:sequence>
    <xs:element ref="TaxType" />
    <xs:element ref="TaxCountryRegion" />
    <xs:element ref="TaxCode" />
    <xs:choice>
	  <xs:element ref="TaxPercentage" />
	  <xs:element ref="TaxAmount" />
    </xs:choice>
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- Estrutura de Retenção na fonte-->
 <xs:element name="WithholdingTax">
   <xs:complexType>
  <xs:sequence>
    <xs:element minOccurs="0" ref="WithholdingTaxType" />
    <xs:element minOccurs="0" name="WithholdingTaxDescription" type="SAFPTtextTypeMandatoryMax60Car" />
    <xs:element name="WithholdingTaxAmount" type="SAFmonetaryType" />
  </xs:sequence>
   </xs:complexType>
 </xs:element>
 <!-- ELEMENTOS SIMPLES -->
 <xs:element name="AccountDescription" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="Address" type="AddressStructure" />
 <xs:element name="AddressDetail" type="SAFPTtextTypeMandatoryMax100Car" />
 <xs:element name="ATDocCodeID" type="SAFPTtextTypeMandatoryMax200Car" />
 <xs:element name="BillingAddress" type="AddressStructure" />
 <xs:element name="BuildingNumber" type="SAFPTtextTypeMandatoryMax10Car" />
 <xs:element name="BusinessName" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="City" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="ClosingCreditBalance" type="SAFmonetaryType" />
 <xs:element name="ClosingDebitBalance" type="SAFmonetaryType" />
 <xs:element name="CompanyAddress" type="AddressStructurePT" />
 <xs:element name="CompanyName" type="SAFPTtextTypeMandatoryMax100Car" />
 <xs:element name="Contact" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="CreditAmount" type="SAFmonetaryType" />
 <xs:element name="CurrencyAmount" type="SAFmonetaryType" />
 <xs:element name="CustomerID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="CustomerTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="DateCreated" type="SAFPTDateSpan" />
 <xs:element name="DebitAmount" type="SAFmonetaryType" />
 <xs:element name="DeliveryDate" type="SAFdateType" />
 <xs:element name="DeliveryID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="Description" type="SAFPTtextTypeMandatoryMax200Car" />
 <xs:element name="DocArchivalNumber" type="SAFTPTDocArchivalNumber" />
 <xs:element name="Email" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="EndDate" type="SAFPTDateSpan" />
 <xs:element name="ExchangeRate" type="SAFdecimalType" />
 <xs:element name="Fax" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="GLPostingDate" type="SAFdateTimeType" />
 <xs:element name="GrossTotal" type="SAFmonetaryType" />
 <xs:element name="Hash" type="SAFPTtextTypeMandatoryMax172Car" />
 <xs:element name="HashControl" type="SAFPTtextTypeMandatoryMax40Car" />
 <xs:element name="HeaderComment" type="SAFPTtextTypeMandatoryMax255Car" />
 <xs:element name="InvoiceDate" type="SAFdateType" />
 <xs:element name="InvoiceStatusDate" type="SAFdateTimeType" />
 <xs:element name="JournalID" type="SAFPTJournalID" />
 <xs:element name="LineNumber" type="xs:nonNegativeInteger" />
 <xs:element name="LocationID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="MovementComments" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="MovementDate" type="SAFdateType" />
 <xs:element name="MovementEndTime" type="SAFdateTimeType" />
 <xs:element name="MovementStartTime" type="SAFdateTimeType" />
 <xs:element name="MovementStatusDate" type="SAFdateTimeType" />
 <xs:element name="NetTotal" type="SAFmonetaryType" />
 <xs:element name="NumberOfEntries" type="xs:nonNegativeInteger" />
 <xs:element name="NumberOfMovementLines" type="xs:nonNegativeInteger" />
 <xs:element name="OpeningCreditBalance" type="SAFmonetaryType" />
 <xs:element name="OpeningDebitBalance" type="SAFmonetaryType" />
 <xs:element name="OrderDate" type="SAFdateType" />
 <xs:element name="OriginatingON" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="PostalCode" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="ProductCode" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="ProductCompanyTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="ProductDescription" type="SAFPTtextTypeMandatoryMax200Car" />
 <xs:element name="ProductGroup" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="ProductID" type="SAFPTProductID" />
 <xs:element name="ProductNumberCode" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="ProductVersion" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="Quantity" type="SAFdecimalType" />
 <xs:element name="Reason" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="RecordID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="Reference" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="Region" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="SettlementAmount" type="SAFmonetaryType" />
 <xs:element name="ShipFrom" type="ShippingPointStructure" />
 <xs:element name="ShipFromAddress" type="AddressStructure" />
 <xs:element name="ShipTo" type="ShippingPointStructure" />
 <xs:element name="ShipToAddress" type="AddressStructure" />
 <xs:element name="SoftwareCertificateNumber" type="xs:nonNegativeInteger" />
 <xs:element name="SourceDocumentID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="SourceID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="StartDate" type="SAFPTDateSpan" />
 <xs:element name="StreetName" type="SAFPTtextTypeMandatoryMax90Car" />
 <xs:element name="SupplierID" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element name="SupplierTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="SystemEntryDate" type="SAFdateTimeType" />
 <xs:element name="TaxAmount" type="SAFmonetaryType" />
 <xs:element name="TaxEntity" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="TaxExemptionReason" type="SAFPTPortugueseTaxExemption" />
 <xs:element name="TaxExpirationDate" type="SAFdateType" />
 <xs:element name="TaxPayable" type="SAFmonetaryType" />
 <xs:element name="TaxPercentage" type="SAFdecimalType" />
 <xs:element name="TaxPointDate" type="SAFdateType" />
 <xs:element name="TaxVerificationDate" type="SAFdateType" />
 <xs:element name="Telephone" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="TotalCredit" type="SAFmonetaryType" />
 <xs:element name="TotalDebit" type="SAFmonetaryType" />
 <xs:element name="TotalQuantityIssued" type="SAFdecimalType" />
 <xs:element name="TransactionDate" type="SAFdateType" />
 <xs:element name="TransactionID" type="SAFPTTransactionID" />
 <xs:element name="UnitOfMeasure" type="SAFPTtextTypeMandatoryMax20Car" />
 <xs:element name="UnitPrice" type="SAFmonetaryType" />
 <xs:element name="WarehouseID" type="SAFPTtextTypeMandatoryMax50Car" />
 <xs:element name="Website" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="WorkDate" type="SAFdateType" />
 <xs:element name="WorkStatusDate" type="SAFdateTimeType" />
 <!-- ELEMENTOS SIMPLES COM RESTRIÇÕES ADICIONAIS-->
 <!-- Código da Conta -->
 <xs:element name="AccountID">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="(([0-9a-zA-Z\-/._+*]*)|Desconhecido)" />
    <xs:minLength value="1" />
    <xs:maxLength value="30" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <xs:element name="AuditFileVersion">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="1.02_01" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Identificação da empresa que exportou o SAFT-->
 <xs:element name="CompanyID">
   <xs:annotation>
  <xs:documentation>Obtém-se pela concatenação da Conservatória do Registo Comercial com o número do registo comercial separados pelo carácter espaço. Nos casos em que não existe o registo comercial, deve ser indicado o NIF.</xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="([0-9]{9})+|([a-zA-Z0-9\-/_ãõÃÕéÉàáÀÁóÓçÇíÍ ]+ [0-9]+)" />
    <xs:minLength value="1" />
    <xs:maxLength value="50" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código do país (ISO 3166 1-alpha-2) -->
 <xs:element name="Country">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|Desconhecido|" />
    <xs:minLength value="2" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código da moeda (ISO 4217) -->
 <xs:element name="CurrencyCode">
   <!-- Não consta o EUR por não existirem situações que requeiram este código de moeda -->
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYR|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LTL|LVL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRO|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLL|SOS|SRD|SSP|STD|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|USS|UYI|UYU|UZS|VEF|VND|VUV|WST|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XDR|XFU|XOF|XPD|XPF|XPT|XSU|XUA|YER|ZAR|ZMW|ZWL|EEK|SKK|TMM|ZMK|ZWD|ZWR|" />
    <xs:length value="3" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código único do documento de movimentação de mercadorias e de conferência-->
 <xs:element name="DocumentNumber">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
    <xs:minLength value="1" />
    <xs:maxLength value="60" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código CAE -->
 <xs:element name="EACCode">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="(([0-9]*))" />
    <xs:length value="5" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Ano Fiscal -->
 <xs:element name="FiscalYear">
   <xs:simpleType>
  <xs:restriction base="xs:integer">
    <xs:minInclusive value="2000" />
    <xs:maxInclusive value="9999" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Categoria da conta -->
 <xs:element name="GroupingCategory">
   <xs:annotation>
  <xs:documentation>GR para conta de 1º grau da contabilidade geral, GA para conta agregadora ou integradora da contabilidade geral, GM para conta de movimento da contabilidade geral, AR para conta de 1º grau da contabilidade analítica, AA para conta agregadora ou integradora da contabilidade analítica, AM para conta de movimento da contabilidade analítica </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="GR" />
    <xs:enumeration value="GA" />
    <xs:enumeration value="GM" />
    <xs:enumeration value="AR" />
    <xs:enumeration value="AA" />
    <xs:enumeration value="AM" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código único do documento de venda -->
 <xs:element name="InvoiceNo">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
    <xs:minLength value="1" />
    <xs:maxLength value="60" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Estado do documento SalesInvoices -->
 <xs:element name="InvoiceStatus">
   <xs:annotation>
  <xs:documentation>N para Normal, S para autofaturação, A para anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação, F para faturado </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="N" />
    <xs:enumeration value="S" />
    <xs:enumeration value="A" />
    <xs:enumeration value="R" />
    <xs:enumeration value="F" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipo de documento de venda-->
 <xs:element name="InvoiceType">
   <xs:annotation>
  <xs:documentation>
    Restrição:  FT-Fatura nos termos do art.º 36º do CIVA, FS-Fatura simplificada nos termos do art.º 40º do CIVA, FR-Fatura-Recibo, ND-Nota de débito, NC-Nota de Crédito,VD-Venda a dinheiro (a), TV-Talão de Venda (a), TD-Talão de devolução (a), AA-Alienação Activos (a),DA-Devolução Activos (a), RP-Prémio ou Recibo Prémio, RE-Estorno ou Recibo de Estorno, CS-Imputação a Co-Seguradoras, LD-Imputação a Co-Seguradora Líder, RA-Resseguro Aceite. (a) Para dados até 2012-12-31
  </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="FT" />
    <xs:enumeration value="FS" />
    <xs:enumeration value="FR" />
    <xs:enumeration value="ND" />
    <xs:enumeration value="NC" />
    <xs:enumeration value="VD" />
    <xs:enumeration value="TV" />
    <xs:enumeration value="TD" />
    <xs:enumeration value="AA" />
    <xs:enumeration value="DA" />
    <!-- Menções para o sector segurador-->
    <xs:enumeration value="RP" />
    <xs:enumeration value="RE" />
    <xs:enumeration value="CS" />
    <xs:enumeration value="LD" />
    <xs:enumeration value="RA" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Estado do documento MovementOfGoods -->
 <xs:element name="MovementStatus">
   <xs:annotation>
  <xs:documentation>N para Normal, T por conta de terceiros, A para Anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação. </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="N" />
    <xs:enumeration value="T" />
    <xs:enumeration value="A" />
    <xs:enumeration value="R" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipo de documento de movimentação de mercadorias-->
 <xs:element name="MovementType">
   <xs:annotation>
  <xs:documentation>
    Restrição: Tipos de Documento (GR para Guia de remessa, GT para Guia de transporte, GA para Guia de movimentação de ativos próprios, GC para Guia de consignação, GD para Guia ou nota de devolução)
  </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="GR" />
    <xs:enumeration value="GT" />
    <xs:enumeration value="GA" />
    <xs:enumeration value="GC" />
    <xs:enumeration value="GD" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Meio de pagamento-->
 <xs:element name="PaymentMechanism">
   <xs:annotation>
  <xs:documentation>
	 Restrição: Meio de pagamento (CC para Cartão de Crédito, CD para Cartão de Débito, CH para Cheque, CS para Compensação de saldos em conta corrente, LC para Letra comercial, MB para Multibanco, NU para Numerário, PR para Permuta, TB para Transferência Bancária, TR para Ticket Restaurante)
  </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="CC" />
    <xs:enumeration value="CD" />
    <xs:enumeration value="CH" />
    <xs:enumeration value="CS" />
    <xs:enumeration value="LC" />
    <xs:enumeration value="MB" />
    <xs:enumeration value="NU" />
    <xs:enumeration value="PR" />
    <xs:enumeration value="TB" />
    <xs:enumeration value="TR" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Periodo contabilistico do documento -->
 <xs:element name="Period">
   <xs:simpleType>
  <xs:restriction base="xs:integer">
    <xs:minInclusive value="1" />
    <xs:maxInclusive value="12" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipos de produto -->
 <xs:element name="ProductType">
   <xs:annotation>
  <xs:documentation>Restrição: Tipo de produto: P - Produtos, S - Serviços, O - Outros, I - Impostos, taxas e encargos parafiscais excepto IVA e IS uma vez que se encontram reflectidos na tabela de impostos</xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="P" />
    <xs:enumeration value="S" />
    <xs:enumeration value="O" />
    <xs:enumeration value="I" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Identificador de Autofaturação -->
 <xs:element name="SelfBillingIndicator">
   <xs:simpleType>
  <xs:restriction base="xs:integer">
    <xs:minInclusive value="0" />
    <xs:maxInclusive value="1" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Origem do documento -->
 <xs:element name="SourceBilling">
   <xs:annotation>
  <xs:documentation>P para documento produzido na aplicação, I para documento integrado e produzido noutra aplicação, M para documento proveniente de recuperação de emissão manual </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="P" />
    <xs:enumeration value="I" />
    <xs:enumeration value="M" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipo de sistema que exportou o SAFT -->
 <xs:element name="TaxAccountingBasis">
   <xs:annotation>
  <xs:documentation>C para Contabilidade, F para Faturação incluindo os documentos de transporte, I para Contabilidade-Faturação incluindo os documentos de transporte, S para Autofaturação, E – Faturação, incluindo documentos de transporte, emitida por terceiros, P para Faturação parcial incluindo os documentos de transporte</xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="C" />
    <xs:enumeration value="F" />
    <xs:enumeration value="I" />
    <xs:enumeration value="S" />
    <xs:enumeration value="E" />
    <xs:enumeration value="P" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <xs:element name="TaxCode">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="RED|INT|NOR|ISE|OUT|([0-9.])*|NS" />
    <xs:minLength value="1" />
    <xs:maxLength value="10" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código de Imposto -->
 <xs:element name="TaxCountryRegion">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|PT-AC|PT-MA" />
    <xs:minLength value="2" />
    <xs:maxLength value="5" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipo de Imposto -->
 <xs:element name="TaxType">
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="IVA" />
    <xs:enumeration value="IS" />
    <xs:enumeration value="NS" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipos de Movimento Contabilistico -->
 <xs:element name="TransactionType">
   <xs:annotation>
  <xs:documentation>Restrição: Tipificação dos movimentos contabilísticos - N - Normal, R - Regularizações do período de tributação, A - Apuramento de resultados, J - Movimentos de Ajustamento </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="N" />
    <xs:enumeration value="R" />
    <xs:enumeration value="A" />
    <xs:enumeration value="J" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Código do tipo de imposto retido -->
 <xs:element name="WithholdingTaxType">
   <xs:annotation>
  <xs:documentation>Restrição: IRS para Imposto Sobre o Rendimento das Pessoas Singulares, IRC para Imposto Sobre o Rendimento das Pessoas colectivas, IS para Imposto de selo </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="IRS" />
    <xs:enumeration value="IRC" />
    <xs:enumeration value="IS" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Estado do documento WorkingDocuments -->
 <xs:element name="WorkStatus">
   <xs:annotation>
  <xs:documentation>N para Normal, A para Anulado, F para faturado (quando para este documento também existe na tabela 4.1. o correspondente do tipo fatura ou fatura simplificada) </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="N" />
    <xs:enumeration value="A" />
    <xs:enumeration value="F" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- Tipo de documento de conferência de entrega de mercadorias ou da prestação de serviços -->
 <xs:element name="WorkType">
   <xs:annotation>
  <xs:documentation>
    Restrição: DC para documentos suscetíveis de apresentação ao cliente para conferência de entrega de mercadorias ou da prestação de serviços
  </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:enumeration value="DC" />
  </xs:restriction>
   </xs:simpleType>
 </xs:element>
 <!-- TIPOS DE DADOS BASE SAFT OCDE-->
 <xs:simpleType name="SAFdateTimeType">
   <xs:restriction base="xs:dateTime" />
 </xs:simpleType>
 <xs:simpleType name="SAFdateType">
   <xs:restriction base="xs:date" />
 </xs:simpleType>
 <xs:simpleType name="SAFdecimalType">
   <xs:restriction base="xs:decimal">
  <xs:minInclusive value="0.00" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFmonetaryType">
   <xs:restriction base="xs:decimal">
  <xs:minInclusive value="0.00" />
   </xs:restriction>
 </xs:simpleType>
 <!-- TIPOS DE DADOS BASE SAFT Portugal -->
 <!-- Código Postal Português -->
 <xs:simpleType name="PostalCodePT">
   <xs:restriction base="xs:string">
  <xs:pattern value="([0-9]{4}-[0-9]{3})" />
   </xs:restriction>
 </xs:simpleType>
 <!-- Periodo do movimento contabilístico -->
 <xs:simpleType name="SAFPTAccountingPeriod">
   <xs:restriction base="xs:integer">
  <xs:minInclusive value="1" />
  <xs:maxInclusive value="16" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTDateSpan">
   <xs:restriction base="xs:date">
  <xs:minInclusive value="2000-01-01" />
  <xs:maxInclusive value="9999-12-31" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFTPTDocArchivalNumber">
   <xs:restriction base="xs:string">
  <xs:pattern value="[^ ]{1,20}" />
  <xs:minLength value="1" />
  <xs:maxLength value="20" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTGLAccountID">
   <xs:restriction base="xs:string">
  <xs:pattern value="(([0-9a-zA-Z\-/._+*]*))" />
  <xs:minLength value="1" />
  <xs:maxLength value="30" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTJournalID">
   <xs:restriction base="xs:string">
  <xs:pattern value="[^ ]{1,30}" />
  <xs:minLength value="1" />
  <xs:maxLength value="30" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFTPTMovementTaxCode">
   <xs:restriction base="xs:string">
  <xs:pattern value="RED|INT|NOR|ISE|OUT|NS" />
  <xs:minLength value="1" />
  <xs:maxLength value="3" />
   </xs:restriction>
 </xs:simpleType>
 <!-- Tipo de Imposto da Tabela MovementOfGoods-->
 <xs:simpleType name="SAFTPTMovementTaxType">
   <xs:restriction base="xs:string">
  <xs:enumeration value="IVA" />
  <xs:enumeration value="NS" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTPortugueseTaxExemption">
   <xs:restriction base="xs:string">
  <xs:minLength value="6" />
  <xs:maxLength value="60" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTPortugueseVatNumber">
   <xs:restriction base="xs:integer">
  <xs:minInclusive value="100000000" />
  <xs:maxInclusive value="999999999" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTProductID">
   <xs:restriction base="xs:string">
  <xs:pattern value="[^/]+/[^/]+" />
  <xs:minLength value="3" />
  <xs:maxLength value="255" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax3Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="3" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax10Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="10" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax20Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="20" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax30Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="30" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax40Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="40" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax50Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="50" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax60Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="60" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax70Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="70" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax90Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="90" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax100Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="100" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax172Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="172" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax200Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="200" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMandatoryMax255Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="1" />
  <xs:maxLength value="255" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTtextTypeMax40Car">
   <xs:restriction base="xs:string">
  <xs:minLength value="0" />
  <xs:maxLength value="40" />
   </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="SAFPTTransactionID">
   <xs:restriction base="xs:string">
  <xs:pattern value="[1-9][0-9]{3}-[01][0-9]-[0-3][0-9] [^ ]{1,30} [^ ]{1,20}" />
  <xs:minLength value="1" />
  <xs:maxLength value="70" />
   </xs:restriction>
 </xs:simpleType>
 <!-- Código do país (ISO 3166 1-alpha-2) -->
 <xs:simpleType name="SupplierCountry">
   <xs:restriction base="xs:string">
  <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|" />
  <xs:length value="2" />
   </xs:restriction>
 </xs:simpleType>
</xs:schema>

fonte...

https://faturas.portaldasfinancas.gov.pt/DocTransporte/sgdtpf_static/java/SGDTUP-1.0.1.0014.jar

Editado por Always

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
Cr4zyKingLi0n    12
Cr4zyKingLi0n

Também estou a tentar por essa via. Parece que ainda não existe (ou temos de usar a versão 1.01_01 ?)

Quando submeto o meu ficheiro no formato 1.01_01 dá-me este erro:

«O ficheiro selecionado não está de acordo com o formato exigido. Erro cvv-elt.1: Cannot find the declaration of element 'AuditFile'»

Mas é claro que o elemento AuditFile está lá...

Alguém já conseguiu submeter um ficheiro SAFT de documentos de transporte?

Sim,

Verifica este topico:

Mensagem #241

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
a.ribeiro    1
a.ribeiro

Bom dia a todos,

Estou a utilizar OpenSSL para gerar o HEADER

Afim de esclarecer algumas duvidas, agradecia, desde já, que

alguém que já tenha conseguido comunicar com a AT,

disponibilizasse o seguinte:

do XML enviado, o campo

<wss:Nonce>

e

<wss:Created>

mais a Chave Simétrica;

para assim poder perceber quais os parâmetros a utilizar no OPENSSL,

pois não estou a conseguir a comunicação

tenho sempre o erro 8

<faultcode>8 </faultcode>

<faultstring>Rejected: | Codigo: 8 |

Erro: Created: Não foi possível decifrar o campo |

Tentativas Restantes: -1</faultstring>

Obrigado.

Agradecia muito alguma ajuda.

o tempo está-se a esgotar.

Dos que já tenha conseguiram comunicar, e foram muitos, não há uma pessoa capaz de me ajudar.

obrigado.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
ARP    2
ARP

fonte não official do novo SAF-T PT (retirado a partir do .jar da submissão dos documentos de transporte)

já dá para ir adiantando umas coisinhas...

<?xml version="1.0" encoding="Windows-1252"?>
<!--Created with Liquid XML Studio - FREE Community Edition 7.1.6.1440 (http://www.liquid-technologies.com)-->
<xs:schema xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation" xmlns:ns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" version="1.02_01" id="SAF-T_PT" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
 <doc:Title>Standard Audit File - Portuguese Version</doc:Title>
 <doc:Subject>Standard Audit File - Portuguese Version</doc:Subject>
 <doc:Copyright>Copyright OECD</doc:Copyright>
 <doc:Version>
 <doc:Number>1.02_01</doc:Number>
 <doc:Status>Production</doc:Status>
 </doc:Version>
 <doc:Author>Autoridade Tributária e Aduaneira</doc:Author>
 <doc:ModificationDate>2013-03-08</doc:ModificationDate>
</xs:documentation>
</xs:annotation>
<!-- Estrutura do ficheiro SAFT-PT-->
<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="GeneralLedger" />
		 <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:GeneralLedger" />
 <xs:field xpath="ns:AccountID" />
</xs:unique>
<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="GeneralLedgerEntriesAccountIDConstraint" refer="AccountIDConstraint">
 <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction/ns:Line" />
 <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:keyref name="GeneralLedgerEntriesSupplierIDConstraint" refer="SupplierIDConstraint">
 <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
 <xs:field xpath="ns:SupplierID" />
</xs:keyref>
<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:element>
<!-- Estrutura de cabeçalho (AuditFile.Header) -->
<xs:element name="Header">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="AuditFileVersion" />
 <xs:element ref="CompanyID" />
 <xs:element name="TaxRegistrationNumber" type="SAFPTPortugueseVatNumber" />
 <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 fixed="EUR" name="CurrencyCode" />
 <xs:element ref="DateCreated" />
 <xs:element ref="TaxEntity" />
 <xs:element ref="ProductCompanyTaxID" />
 <xs:element ref="SoftwareCertificateNumber" />
 <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="GeneralLedger">
<xs:complexType>
 <xs:sequence>
 <xs:element name="AccountID" type="SAFPTGLAccountID" />
 <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="SAFPTGLAccountID" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Cliente (AuditFile.MasterFiles.Customer) -->
<xs:element name="Customer">
<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: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: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:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Impostos (AuditFile.MasterFiles.TaxTable) -->
<xs:element name="TaxTable">
<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:complexType>
 <xs:sequence>
 <xs:element ref="TaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element ref="TaxCode" />
 <xs:element name="Description" type="SAFPTtextTypeMandatoryMax255Car" />
 <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:sequence>
 <xs:element ref="NumberOfEntries" />
 <xs:element ref="TotalDebit" />
 <xs:element ref="TotalCredit" />
 <xs:element minOccurs="0" maxOccurs="unbounded" name="Journal">
	 <xs:complexType>
	 <xs:sequence>
		 <xs:element ref="JournalID" />
		 <xs:element ref="Description" />
		 <xs:element minOccurs="0" maxOccurs="unbounded" name="Transaction">
		 <xs:complexType>
			 <xs:sequence>
			 <xs:element ref="TransactionID" />
			 <xs:element name="Period" type="SAFPTAccountingPeriod" />
			 <xs:element ref="TransactionDate" />
			 <xs:element ref="SourceID" />
			 <xs:element ref="Description" />
			 <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 minOccurs="2" maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="RecordID" />
					 <xs:element name="AccountID" type="SAFPTGLAccountID" />
					 <xs:element minOccurs="0" ref="SourceDocumentID" />
					 <xs:element ref="SystemEntryDate" />
					 <xs:element ref="Description" />
					 <xs:choice maxOccurs="1">
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
				 </xs:sequence>
				 </xs:complexType>
			 </xs:element>
			 </xs:sequence>
		 </xs:complexType>
		 </xs:element>
	 </xs:sequence>
	 </xs:complexType>
 </xs:element>
 </xs:sequence>
</xs:complexType>
<xs:unique name="JournalIdConstraint">
 <xs:selector xpath="ns:Journal" />
 <xs:field xpath="ns:JournalID" />
</xs:unique>
<xs:unique name="TransactionIdConstraint">
 <xs:selector xpath="ns:Journal/ns:Transaction" />
 <xs:field xpath="ns:TransactionID" />
</xs:unique>
</xs:element>
<!-- Estrutura de Documentos Comerciais (AuditFile.SourceDocuments)-->
<xs:element name="SourceDocuments">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" name="SalesInvoices">
	 <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:complexType>
			 <xs:sequence>
			 <xs:element ref="InvoiceNo" />
			 <!-- Estrutura da situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="InvoiceStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="SourceBilling" />
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" ref="HashControl" />
			 <xs:element minOccurs="0" ref="Period" />
			 <xs:element ref="InvoiceDate" />
			 <xs:element ref="InvoiceType" />
			 <xs:element ref="SelfBillingIndicator" />
			 <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:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					 <xs:element ref="ProductCode" />
					 <xs:element ref="ProductDescription" />
					 <xs:element ref="Quantity" />
					 <xs:element ref="UnitOfMeasure" />
					 <xs:element ref="UnitPrice" />
					 <xs:element ref="TaxPointDate" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="References" />
					 <xs:element ref="Description" />
					 <xs:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element ref="Tax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="Currency" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="Settlement" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="Payment" />
				 </xs:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element minOccurs="0" ref="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 situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="MovementStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="SourceBilling" />
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" 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" />
			 <!-- Nos documentos resumo (MovementStatus "R"), na ausência de informação concreta, a hora de inicio de transporte (MovementStartTime) pode ser indicada com a concatenação da data constante no campo MovementDate com a hora 00:00:00-->
			 <xs:element minOccurs="0" maxOccurs="1" ref="ATDocCodeID" />
			 <xs:element maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="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:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element minOccurs="0" name="Tax" type="MovementTax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="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" />
			 <!-- Estrutura da situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="WorkStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" 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 ref="CustomerID" />
			 <xs:element maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					 <xs:element ref="ProductCode" />
					 <xs:element ref="ProductDescription" />
					 <xs:element ref="Quantity" />
					 <xs:element ref="UnitOfMeasure" />
					 <xs:element ref="UnitPrice" />
					 <xs:element ref="TaxPointDate" />
					 <xs:element ref="Description" />
					 <xs:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element minOccurs="0" ref="Tax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="Currency" />
				 </xs:sequence>
				 </xs:complexType>
			 </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: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" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element ref="Country" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Moradas para Portugal-->
<xs:complexType name="AddressStructurePT">
<xs:sequence>
 <xs:element minOccurs="0" ref="BuildingNumber" />
 <xs:element minOccurs="0" ref="StreetName" />
 <xs:element ref="AddressDetail" />
 <xs:element ref="City" />
 <xs:element name="PostalCode" type="PostalCodePT" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element fixed="PT" name="Country" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de valor monetário -->
<!-- Este elemento apenas deve ser gerado quando a moeda original do documento for diferente de euro -->
<xs:element name="Currency">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="CurrencyCode" />
 <xs:element ref="CurrencyAmount" />
 <xs:element minOccurs="0" ref="ExchangeRate" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Taxa de documentos de movimentação de mercadorias-->
<xs:complexType name="MovementTax">
<xs:sequence>
 <xs:element name="TaxType" type="SAFTPTMovementTaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element name="TaxCode" type="SAFTPTMovementTaxCode" />
 <xs:element ref="TaxPercentage" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Referências ao documento de origem-->
<xs:element name="OrderReferences">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="OriginatingON" />
 <xs:element minOccurs="0" ref="OrderDate" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de pagamentos-->
<xs:element name="Payment">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="PaymentMechanism" />
 <xs:element name="PaymentAmount" type="SAFmonetaryType" />
 <xs:element name="PaymentDate" type="SAFdateType" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de referências a outros documentos em documentos retificativos de faturas-->
<xs:element name="References">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="Reference" />
 <xs:element minOccurs="0" ref="Reason" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Acordos entre cliente e fornecedor-->
<xs:element name="Settlement">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" name="SettlementDiscount" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element minOccurs="0" name="SettlementAmount" type="SAFmonetaryType" />
 <xs:element minOccurs="0" name="SettlementDate" type="SAFdateType" />
 <xs:element minOccurs="0" name="PaymentTerms" type="SAFPTtextTypeMandatoryMax100Car" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de entregas de produtos -->
<xs:complexType name="ShippingPointStructure">
<xs:sequence>
 <xs:element minOccurs="0" maxOccurs="unbounded" ref="DeliveryID" />
 <xs:element minOccurs="0" ref="DeliveryDate" />
 <xs:sequence minOccurs="0" maxOccurs="unbounded">
 <xs:element minOccurs="0" ref="WarehouseID" />
 <xs:element minOccurs="0" ref="LocationID" />
 </xs:sequence>
 <xs:element minOccurs="0" ref="Address" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Moradas para Fornecedores-->
<xs:complexType name="SupplierAddressStructure">
<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" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element name="Country" type="SupplierCountry" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Taxa -->
<xs:element name="Tax">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="TaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element ref="TaxCode" />
 <xs:choice>
	 <xs:element ref="TaxPercentage" />
	 <xs:element ref="TaxAmount" />
 </xs:choice>
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Retenção na fonte-->
<xs:element name="WithholdingTax">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="WithholdingTaxType" />
 <xs:element minOccurs="0" name="WithholdingTaxDescription" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="WithholdingTaxAmount" type="SAFmonetaryType" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- ELEMENTOS SIMPLES -->
<xs:element name="AccountDescription" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="Address" type="AddressStructure" />
<xs:element name="AddressDetail" type="SAFPTtextTypeMandatoryMax100Car" />
<xs:element name="ATDocCodeID" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="BillingAddress" type="AddressStructure" />
<xs:element name="BuildingNumber" type="SAFPTtextTypeMandatoryMax10Car" />
<xs:element name="BusinessName" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="City" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ClosingCreditBalance" type="SAFmonetaryType" />
<xs:element name="ClosingDebitBalance" type="SAFmonetaryType" />
<xs:element name="CompanyAddress" type="AddressStructurePT" />
<xs:element name="CompanyName" type="SAFPTtextTypeMandatoryMax100Car" />
<xs:element name="Contact" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="CreditAmount" type="SAFmonetaryType" />
<xs:element name="CurrencyAmount" type="SAFmonetaryType" />
<xs:element name="CustomerID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="CustomerTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="DateCreated" type="SAFPTDateSpan" />
<xs:element name="DebitAmount" type="SAFmonetaryType" />
<xs:element name="DeliveryDate" type="SAFdateType" />
<xs:element name="DeliveryID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Description" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="DocArchivalNumber" type="SAFTPTDocArchivalNumber" />
<xs:element name="Email" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="EndDate" type="SAFPTDateSpan" />
<xs:element name="ExchangeRate" type="SAFdecimalType" />
<xs:element name="Fax" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="GLPostingDate" type="SAFdateTimeType" />
<xs:element name="GrossTotal" type="SAFmonetaryType" />
<xs:element name="Hash" type="SAFPTtextTypeMandatoryMax172Car" />
<xs:element name="HashControl" type="SAFPTtextTypeMandatoryMax40Car" />
<xs:element name="HeaderComment" type="SAFPTtextTypeMandatoryMax255Car" />
<xs:element name="InvoiceDate" type="SAFdateType" />
<xs:element name="InvoiceStatusDate" type="SAFdateTimeType" />
<xs:element name="JournalID" type="SAFPTJournalID" />
<xs:element name="LineNumber" type="xs:nonNegativeInteger" />
<xs:element name="LocationID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="MovementComments" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="MovementDate" type="SAFdateType" />
<xs:element name="MovementEndTime" type="SAFdateTimeType" />
<xs:element name="MovementStartTime" type="SAFdateTimeType" />
<xs:element name="MovementStatusDate" type="SAFdateTimeType" />
<xs:element name="NetTotal" type="SAFmonetaryType" />
<xs:element name="NumberOfEntries" type="xs:nonNegativeInteger" />
<xs:element name="NumberOfMovementLines" type="xs:nonNegativeInteger" />
<xs:element name="OpeningCreditBalance" type="SAFmonetaryType" />
<xs:element name="OpeningDebitBalance" type="SAFmonetaryType" />
<xs:element name="OrderDate" type="SAFdateType" />
<xs:element name="OriginatingON" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="PostalCode" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="ProductCode" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="ProductCompanyTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="ProductDescription" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="ProductGroup" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ProductID" type="SAFPTProductID" />
<xs:element name="ProductNumberCode" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ProductVersion" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Quantity" type="SAFdecimalType" />
<xs:element name="Reason" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="RecordID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Reference" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="Region" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="SettlementAmount" type="SAFmonetaryType" />
<xs:element name="ShipFrom" type="ShippingPointStructure" />
<xs:element name="ShipFromAddress" type="AddressStructure" />
<xs:element name="ShipTo" type="ShippingPointStructure" />
<xs:element name="ShipToAddress" type="AddressStructure" />
<xs:element name="SoftwareCertificateNumber" type="xs:nonNegativeInteger" />
<xs:element name="SourceDocumentID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="SourceID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="StartDate" type="SAFPTDateSpan" />
<xs:element name="StreetName" type="SAFPTtextTypeMandatoryMax90Car" />
<xs:element name="SupplierID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="SupplierTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="SystemEntryDate" type="SAFdateTimeType" />
<xs:element name="TaxAmount" type="SAFmonetaryType" />
<xs:element name="TaxEntity" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="TaxExemptionReason" type="SAFPTPortugueseTaxExemption" />
<xs:element name="TaxExpirationDate" type="SAFdateType" />
<xs:element name="TaxPayable" type="SAFmonetaryType" />
<xs:element name="TaxPercentage" type="SAFdecimalType" />
<xs:element name="TaxPointDate" type="SAFdateType" />
<xs:element name="TaxVerificationDate" type="SAFdateType" />
<xs:element name="Telephone" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="TotalCredit" type="SAFmonetaryType" />
<xs:element name="TotalDebit" type="SAFmonetaryType" />
<xs:element name="TotalQuantityIssued" type="SAFdecimalType" />
<xs:element name="TransactionDate" type="SAFdateType" />
<xs:element name="TransactionID" type="SAFPTTransactionID" />
<xs:element name="UnitOfMeasure" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="UnitPrice" type="SAFmonetaryType" />
<xs:element name="WarehouseID" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="Website" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="WorkDate" type="SAFdateType" />
<xs:element name="WorkStatusDate" type="SAFdateTimeType" />
<!-- ELEMENTOS SIMPLES COM RESTRIÇÕES ADICIONAIS-->
<!-- Código da Conta -->
<xs:element name="AccountID">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="(([0-9a-zA-Z\-/._+*]*)|Desconhecido)" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AuditFileVersion">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="1.02_01" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Identificação da empresa que exportou o SAFT-->
<xs:element name="CompanyID">
<xs:annotation>
 <xs:documentation>Obtém-se pela concatenação da Conservatória do Registo Comercial com o número do registo comercial separados pelo carácter espaço. Nos casos em que não existe o registo comercial, deve ser indicado o NIF.</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="([0-9]{9})+|([a-zA-Z0-9\-/_ãõÃÕéÉàáÀÁóÓçÇíÍ ]+ [0-9]+)" />
 <xs:minLength value="1" />
 <xs:maxLength value="50" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código do país (ISO 3166 1-alpha-2) -->
<xs:element name="Country">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|Desconhecido|" />
 <xs:minLength value="2" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código da moeda (ISO 4217) -->
<xs:element name="CurrencyCode">
<!-- Não consta o EUR por não existirem situações que requeiram este código de moeda -->
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYR|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LTL|LVL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRO|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLL|SOS|SRD|SSP|STD|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|USS|UYI|UYU|UZS|VEF|VND|VUV|WST|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XDR|XFU|XOF|XPD|XPF|XPT|XSU|XUA|YER|ZAR|ZMW|ZWL|EEK|SKK|TMM|ZMK|ZWD|ZWR|" />
 <xs:length value="3" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código único do documento de movimentação de mercadorias e de conferência-->
<xs:element name="DocumentNumber">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código CAE -->
<xs:element name="EACCode">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="(([0-9]*))" />
 <xs:length value="5" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Ano Fiscal -->
<xs:element name="FiscalYear">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="2000" />
 <xs:maxInclusive value="9999" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Categoria da conta -->
<xs:element name="GroupingCategory">
<xs:annotation>
 <xs:documentation>GR para conta de 1º grau da contabilidade geral, GA para conta agregadora ou integradora da contabilidade geral, GM para conta de movimento da contabilidade geral, AR para conta de 1º grau da contabilidade analítica, AA para conta agregadora ou integradora da contabilidade analítica, AM para conta de movimento da contabilidade analítica </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="GR" />
 <xs:enumeration value="GA" />
 <xs:enumeration value="GM" />
 <xs:enumeration value="AR" />
 <xs:enumeration value="AA" />
 <xs:enumeration value="AM" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código único do documento de venda -->
<xs:element name="InvoiceNo">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento SalesInvoices -->
<xs:element name="InvoiceStatus">
<xs:annotation>
 <xs:documentation>N para Normal, S para autofaturação, A para anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação, F para faturado </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="S" />
 <xs:enumeration value="A" />
 <xs:enumeration value="R" />
 <xs:enumeration value="F" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de venda-->
<xs:element name="InvoiceType">
<xs:annotation>
 <xs:documentation>
 Restrição: FT-Fatura nos termos do art.º 36º do CIVA, FS-Fatura simplificada nos termos do art.º 40º do CIVA, FR-Fatura-Recibo, ND-Nota de débito, NC-Nota de Crédito,VD-Venda a dinheiro (a), TV-Talão de Venda (a), TD-Talão de devolução (a), AA-Alienação Activos (a),DA-Devolução Activos (a), RP-Prémio ou Recibo Prémio, RE-Estorno ou Recibo de Estorno, CS-Imputação a Co-Seguradoras, LD-Imputação a Co-Seguradora Líder, RA-Resseguro Aceite. (a) Para dados até 2012-12-31
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="FT" />
 <xs:enumeration value="FS" />
 <xs:enumeration value="FR" />
 <xs:enumeration value="ND" />
 <xs:enumeration value="NC" />
 <xs:enumeration value="VD" />
 <xs:enumeration value="TV" />
 <xs:enumeration value="TD" />
 <xs:enumeration value="AA" />
 <xs:enumeration value="DA" />
 <!-- Menções para o sector segurador-->
 <xs:enumeration value="RP" />
 <xs:enumeration value="RE" />
 <xs:enumeration value="CS" />
 <xs:enumeration value="LD" />
 <xs:enumeration value="RA" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento MovementOfGoods -->
<xs:element name="MovementStatus">
<xs:annotation>
 <xs:documentation>N para Normal, T por conta de terceiros, A para Anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação. </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="T" />
 <xs:enumeration value="A" />
 <xs:enumeration value="R" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de movimentação de mercadorias-->
<xs:element name="MovementType">
<xs:annotation>
 <xs:documentation>
 Restrição: Tipos de Documento (GR para Guia de remessa, GT para Guia de transporte, GA para Guia de movimentação de ativos próprios, GC para Guia de consignação, GD para Guia ou nota de devolução)
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="GR" />
 <xs:enumeration value="GT" />
 <xs:enumeration value="GA" />
 <xs:enumeration value="GC" />
 <xs:enumeration value="GD" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Meio de pagamento-->
<xs:element name="PaymentMechanism">
<xs:annotation>
 <xs:documentation>
	 Restrição: Meio de pagamento (CC para Cartão de Crédito, CD para Cartão de Débito, CH para Cheque, CS para Compensação de saldos em conta corrente, LC para Letra comercial, MB para Multibanco, NU para Numerário, PR para Permuta, TB para Transferência Bancária, TR para Ticket Restaurante)
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="CC" />
 <xs:enumeration value="CD" />
 <xs:enumeration value="CH" />
 <xs:enumeration value="CS" />
 <xs:enumeration value="LC" />
 <xs:enumeration value="MB" />
 <xs:enumeration value="NU" />
 <xs:enumeration value="PR" />
 <xs:enumeration value="TB" />
 <xs:enumeration value="TR" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Periodo contabilistico do documento -->
<xs:element name="Period">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="1" />
 <xs:maxInclusive value="12" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipos de produto -->
<xs:element name="ProductType">
<xs:annotation>
 <xs:documentation>Restrição: Tipo de produto: P - Produtos, S - Serviços, O - Outros, I - Impostos, taxas e encargos parafiscais excepto IVA e IS uma vez que se encontram reflectidos na tabela de impostos</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="P" />
 <xs:enumeration value="S" />
 <xs:enumeration value="O" />
 <xs:enumeration value="I" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Identificador de Autofaturação -->
<xs:element name="SelfBillingIndicator">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="0" />
 <xs:maxInclusive value="1" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Origem do documento -->
<xs:element name="SourceBilling">
<xs:annotation>
 <xs:documentation>P para documento produzido na aplicação, I para documento integrado e produzido noutra aplicação, M para documento proveniente de recuperação de emissão manual </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="P" />
 <xs:enumeration value="I" />
 <xs:enumeration value="M" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de sistema que exportou o SAFT -->
<xs:element name="TaxAccountingBasis">
<xs:annotation>
 <xs:documentation>C para Contabilidade, F para Faturação incluindo os documentos de transporte, I para Contabilidade-Faturação incluindo os documentos de transporte, S para Autofaturação, E – Faturação, incluindo documentos de transporte, emitida por terceiros, P para Faturação parcial incluindo os documentos de transporte</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="C" />
 <xs:enumeration value="F" />
 <xs:enumeration value="I" />
 <xs:enumeration value="S" />
 <xs:enumeration value="E" />
 <xs:enumeration value="P" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TaxCode">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="RED|INT|NOR|ISE|OUT|([0-9.])*|NS" />
 <xs:minLength value="1" />
 <xs:maxLength value="10" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código de Imposto -->
<xs:element name="TaxCountryRegion">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|PT-AC|PT-MA" />
 <xs:minLength value="2" />
 <xs:maxLength value="5" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de Imposto -->
<xs:element name="TaxType">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="IVA" />
 <xs:enumeration value="IS" />
 <xs:enumeration value="NS" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipos de Movimento Contabilistico -->
<xs:element name="TransactionType">
<xs:annotation>
 <xs:documentation>Restrição: Tipificação dos movimentos contabilísticos - N - Normal, R - Regularizações do período de tributação, A - Apuramento de resultados, J - Movimentos de Ajustamento </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="R" />
 <xs:enumeration value="A" />
 <xs:enumeration value="J" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código do tipo de imposto retido -->
<xs:element name="WithholdingTaxType">
<xs:annotation>
 <xs:documentation>Restrição: IRS para Imposto Sobre o Rendimento das Pessoas Singulares, IRC para Imposto Sobre o Rendimento das Pessoas colectivas, IS para Imposto de selo </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="IRS" />
 <xs:enumeration value="IRC" />
 <xs:enumeration value="IS" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento WorkingDocuments -->
<xs:element name="WorkStatus">
<xs:annotation>
 <xs:documentation>N para Normal, A para Anulado, F para faturado (quando para este documento também existe na tabela 4.1. o correspondente do tipo fatura ou fatura simplificada) </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="A" />
 <xs:enumeration value="F" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de conferência de entrega de mercadorias ou da prestação de serviços -->
<xs:element name="WorkType">
<xs:annotation>
 <xs:documentation>
 Restrição: DC para documentos suscetíveis de apresentação ao cliente para conferência de entrega de mercadorias ou da prestação de serviços
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="DC" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- TIPOS DE DADOS BASE SAFT OCDE-->
<xs:simpleType name="SAFdateTimeType">
<xs:restriction base="xs:dateTime" />
</xs:simpleType>
<xs:simpleType name="SAFdateType">
<xs:restriction base="xs:date" />
</xs:simpleType>
<xs:simpleType name="SAFdecimalType">
<xs:restriction base="xs:decimal">
 <xs:minInclusive value="0.00" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFmonetaryType">
<xs:restriction base="xs:decimal">
 <xs:minInclusive value="0.00" />
</xs:restriction>
</xs:simpleType>
<!-- TIPOS DE DADOS BASE SAFT Portugal -->
<!-- Código Postal Português -->
<xs:simpleType name="PostalCodePT">
<xs:restriction base="xs:string">
 <xs:pattern value="([0-9]{4}-[0-9]{3})" />
</xs:restriction>
</xs:simpleType>
<!-- Periodo do movimento contabilístico -->
<xs:simpleType name="SAFPTAccountingPeriod">
<xs:restriction base="xs:integer">
 <xs:minInclusive value="1" />
 <xs:maxInclusive value="16" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTDateSpan">
<xs:restriction base="xs:date">
 <xs:minInclusive value="2000-01-01" />
 <xs:maxInclusive value="9999-12-31" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFTPTDocArchivalNumber">
<xs:restriction base="xs:string">
 <xs:pattern value="[^ ]{1,20}" />
 <xs:minLength value="1" />
 <xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTGLAccountID">
<xs:restriction base="xs:string">
 <xs:pattern value="(([0-9a-zA-Z\-/._+*]*))" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTJournalID">
<xs:restriction base="xs:string">
 <xs:pattern value="[^ ]{1,30}" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFTPTMovementTaxCode">
<xs:restriction base="xs:string">
 <xs:pattern value="RED|INT|NOR|ISE|OUT|NS" />
 <xs:minLength value="1" />
 <xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
<!-- Tipo de Imposto da Tabela MovementOfGoods-->
<xs:simpleType name="SAFTPTMovementTaxType">
<xs:restriction base="xs:string">
 <xs:enumeration value="IVA" />
 <xs:enumeration value="NS" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTPortugueseTaxExemption">
<xs:restriction base="xs:string">
 <xs:minLength value="6" />
 <xs:maxLength value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTPortugueseVatNumber">
<xs:restriction base="xs:integer">
 <xs:minInclusive value="100000000" />
 <xs:maxInclusive value="999999999" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTProductID">
<xs:restriction base="xs:string">
 <xs:pattern value="[^/]+/[^/]+" />
 <xs:minLength value="3" />
 <xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax3Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax10Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax20Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax30Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax40Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="40" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax50Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax60Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax70Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="70" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax90Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax100Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax172Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="172" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax200Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="200" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax255Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMax40Car">
<xs:restriction base="xs:string">
 <xs:minLength value="0" />
 <xs:maxLength value="40" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTTransactionID">
<xs:restriction base="xs:string">
 <xs:pattern value="[1-9][0-9]{3}-[01][0-9]-[0-3][0-9] [^ ]{1,30} [^ ]{1,20}" />
 <xs:minLength value="1" />
 <xs:maxLength value="70" />
</xs:restriction>
</xs:simpleType>
<!-- Código do país (ISO 3166 1-alpha-2) -->
<xs:simpleType name="SupplierCountry">
<xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|" />
 <xs:length value="2" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

fonte...

https://faturas.portaldasfinancas.gov.pt/DocTransporte/sgdtpf_static/java/SGDTUP-1.0.1.0014.jar

Com base neste .xsd:

<!-- Origem do documento -->
 <xs:element name="SourceBilling">
<xs:annotation>
	  <xs:documentation>P para documento produzido na aplicação, I para documento integrado e produzido noutra aplicação, M para documento proveniente de recuperação de emissão manual </xs:documentation>
</xs:annotation>
<xs:simpleType>
	  <xs:restriction base="xs:string">
		<xs:enumeration value="P" />
		<xs:enumeration value="I" />
		<xs:enumeration value="M" />
	  </xs:restriction>
</xs:simpleType>
 </xs:element>
 <!-- Tipo de sistema que exportou o SAFT -->

Editado por Rui Carlos
GeSHi

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
eesteves    5
eesteves

fonte não official do novo SAF-T PT (retirado a partir do .jar da submissão dos documentos de transporte)

já dá para ir adiantando umas coisinhas...

<?xml version="1.0" encoding="Windows-1252"?>
<!--Created with Liquid XML Studio - FREE Community Edition 7.1.6.1440 (http://www.liquid-technologies.com)-->
<xs:schema xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation" xmlns:ns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:OECD:StandardAuditFile-Tax:PT_1.02_01" version="1.02_01" id="SAF-T_PT" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
 <doc:Title>Standard Audit File - Portuguese Version</doc:Title>
 <doc:Subject>Standard Audit File - Portuguese Version</doc:Subject>
 <doc:Copyright>Copyright OECD</doc:Copyright>
 <doc:Version>
 <doc:Number>1.02_01</doc:Number>
 <doc:Status>Production</doc:Status>
 </doc:Version>
 <doc:Author>Autoridade Tributária e Aduaneira</doc:Author>
 <doc:ModificationDate>2013-03-08</doc:ModificationDate>
</xs:documentation>
</xs:annotation>
<!-- Estrutura do ficheiro SAFT-PT-->
<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="GeneralLedger" />
		 <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:GeneralLedger" />
 <xs:field xpath="ns:AccountID" />
</xs:unique>
<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="GeneralLedgerEntriesAccountIDConstraint" refer="AccountIDConstraint">
 <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction/ns:Line" />
 <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:keyref name="GeneralLedgerEntriesSupplierIDConstraint" refer="SupplierIDConstraint">
 <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
 <xs:field xpath="ns:SupplierID" />
</xs:keyref>
<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:element>
<!-- Estrutura de cabeçalho (AuditFile.Header) -->
<xs:element name="Header">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="AuditFileVersion" />
 <xs:element ref="CompanyID" />
 <xs:element name="TaxRegistrationNumber" type="SAFPTPortugueseVatNumber" />
 <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 fixed="EUR" name="CurrencyCode" />
 <xs:element ref="DateCreated" />
 <xs:element ref="TaxEntity" />
 <xs:element ref="ProductCompanyTaxID" />
 <xs:element ref="SoftwareCertificateNumber" />
 <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="GeneralLedger">
<xs:complexType>
 <xs:sequence>
 <xs:element name="AccountID" type="SAFPTGLAccountID" />
 <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="SAFPTGLAccountID" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Cliente (AuditFile.MasterFiles.Customer) -->
<xs:element name="Customer">
<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: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: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:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Impostos (AuditFile.MasterFiles.TaxTable) -->
<xs:element name="TaxTable">
<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:complexType>
 <xs:sequence>
 <xs:element ref="TaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element ref="TaxCode" />
 <xs:element name="Description" type="SAFPTtextTypeMandatoryMax255Car" />
 <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:sequence>
 <xs:element ref="NumberOfEntries" />
 <xs:element ref="TotalDebit" />
 <xs:element ref="TotalCredit" />
 <xs:element minOccurs="0" maxOccurs="unbounded" name="Journal">
	 <xs:complexType>
	 <xs:sequence>
		 <xs:element ref="JournalID" />
		 <xs:element ref="Description" />
		 <xs:element minOccurs="0" maxOccurs="unbounded" name="Transaction">
		 <xs:complexType>
			 <xs:sequence>
			 <xs:element ref="TransactionID" />
			 <xs:element name="Period" type="SAFPTAccountingPeriod" />
			 <xs:element ref="TransactionDate" />
			 <xs:element ref="SourceID" />
			 <xs:element ref="Description" />
			 <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 minOccurs="2" maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="RecordID" />
					 <xs:element name="AccountID" type="SAFPTGLAccountID" />
					 <xs:element minOccurs="0" ref="SourceDocumentID" />
					 <xs:element ref="SystemEntryDate" />
					 <xs:element ref="Description" />
					 <xs:choice maxOccurs="1">
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
				 </xs:sequence>
				 </xs:complexType>
			 </xs:element>
			 </xs:sequence>
		 </xs:complexType>
		 </xs:element>
	 </xs:sequence>
	 </xs:complexType>
 </xs:element>
 </xs:sequence>
</xs:complexType>
<xs:unique name="JournalIdConstraint">
 <xs:selector xpath="ns:Journal" />
 <xs:field xpath="ns:JournalID" />
</xs:unique>
<xs:unique name="TransactionIdConstraint">
 <xs:selector xpath="ns:Journal/ns:Transaction" />
 <xs:field xpath="ns:TransactionID" />
</xs:unique>
</xs:element>
<!-- Estrutura de Documentos Comerciais (AuditFile.SourceDocuments)-->
<xs:element name="SourceDocuments">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" name="SalesInvoices">
	 <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:complexType>
			 <xs:sequence>
			 <xs:element ref="InvoiceNo" />
			 <!-- Estrutura da situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="InvoiceStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="SourceBilling" />
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" ref="HashControl" />
			 <xs:element minOccurs="0" ref="Period" />
			 <xs:element ref="InvoiceDate" />
			 <xs:element ref="InvoiceType" />
			 <xs:element ref="SelfBillingIndicator" />
			 <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:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					 <xs:element ref="ProductCode" />
					 <xs:element ref="ProductDescription" />
					 <xs:element ref="Quantity" />
					 <xs:element ref="UnitOfMeasure" />
					 <xs:element ref="UnitPrice" />
					 <xs:element ref="TaxPointDate" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="References" />
					 <xs:element ref="Description" />
					 <xs:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element ref="Tax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="Currency" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="Settlement" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="Payment" />
				 </xs:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element minOccurs="0" ref="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 situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="MovementStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="SourceBilling" />
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" 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" />
			 <!-- Nos documentos resumo (MovementStatus "R"), na ausência de informação concreta, a hora de inicio de transporte (MovementStartTime) pode ser indicada com a concatenação da data constante no campo MovementDate com a hora 00:00:00-->
			 <xs:element minOccurs="0" maxOccurs="1" ref="ATDocCodeID" />
			 <xs:element maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="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:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element minOccurs="0" name="Tax" type="MovementTax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="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" />
			 <!-- Estrutura da situação do documento -->
			 <xs:element name="DocumentStatus">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="WorkStatus" />
					 <!-- Na exportação de dados relativos a exercícios anteriores em que esta informação seja desconhecida, este campo deverá 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:sequence>
				 </xs:complexType>
			 </xs:element>
			 <xs:element ref="Hash" />
			 <xs:element minOccurs="0" 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 ref="CustomerID" />
			 <xs:element maxOccurs="unbounded" name="Line">
				 <xs:complexType>
				 <xs:sequence>
					 <xs:element ref="LineNumber" />
					 <xs:element minOccurs="0" maxOccurs="unbounded" ref="OrderReferences" />
					 <xs:element ref="ProductCode" />
					 <xs:element ref="ProductDescription" />
					 <xs:element ref="Quantity" />
					 <xs:element ref="UnitOfMeasure" />
					 <xs:element ref="UnitPrice" />
					 <xs:element ref="TaxPointDate" />
					 <xs:element ref="Description" />
					 <xs:choice>
					 <xs:element ref="DebitAmount" />
					 <xs:element ref="CreditAmount" />
					 </xs:choice>
					 <xs:element minOccurs="0" ref="Tax" />
					 <xs:element minOccurs="0" ref="TaxExemptionReason" />
					 <xs:element minOccurs="0" ref="SettlementAmount" />
				 </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" ref="Currency" />
				 </xs:sequence>
				 </xs:complexType>
			 </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: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" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element ref="Country" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Moradas para Portugal-->
<xs:complexType name="AddressStructurePT">
<xs:sequence>
 <xs:element minOccurs="0" ref="BuildingNumber" />
 <xs:element minOccurs="0" ref="StreetName" />
 <xs:element ref="AddressDetail" />
 <xs:element ref="City" />
 <xs:element name="PostalCode" type="PostalCodePT" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element fixed="PT" name="Country" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de valor monetário -->
<!-- Este elemento apenas deve ser gerado quando a moeda original do documento for diferente de euro -->
<xs:element name="Currency">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="CurrencyCode" />
 <xs:element ref="CurrencyAmount" />
 <xs:element minOccurs="0" ref="ExchangeRate" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Taxa de documentos de movimentação de mercadorias-->
<xs:complexType name="MovementTax">
<xs:sequence>
 <xs:element name="TaxType" type="SAFTPTMovementTaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element name="TaxCode" type="SAFTPTMovementTaxCode" />
 <xs:element ref="TaxPercentage" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Referências ao documento de origem-->
<xs:element name="OrderReferences">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="OriginatingON" />
 <xs:element minOccurs="0" ref="OrderDate" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de pagamentos-->
<xs:element name="Payment">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="PaymentMechanism" />
 <xs:element name="PaymentAmount" type="SAFmonetaryType" />
 <xs:element name="PaymentDate" type="SAFdateType" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de referências a outros documentos em documentos retificativos de faturas-->
<xs:element name="References">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="Reference" />
 <xs:element minOccurs="0" ref="Reason" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Acordos entre cliente e fornecedor-->
<xs:element name="Settlement">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" name="SettlementDiscount" type="SAFPTtextTypeMandatoryMax30Car" />
 <xs:element minOccurs="0" name="SettlementAmount" type="SAFmonetaryType" />
 <xs:element minOccurs="0" name="SettlementDate" type="SAFdateType" />
 <xs:element minOccurs="0" name="PaymentTerms" type="SAFPTtextTypeMandatoryMax100Car" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de entregas de produtos -->
<xs:complexType name="ShippingPointStructure">
<xs:sequence>
 <xs:element minOccurs="0" maxOccurs="unbounded" ref="DeliveryID" />
 <xs:element minOccurs="0" ref="DeliveryDate" />
 <xs:sequence minOccurs="0" maxOccurs="unbounded">
 <xs:element minOccurs="0" ref="WarehouseID" />
 <xs:element minOccurs="0" ref="LocationID" />
 </xs:sequence>
 <xs:element minOccurs="0" ref="Address" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Moradas para Fornecedores-->
<xs:complexType name="SupplierAddressStructure">
<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" />
 <xs:element minOccurs="0" ref="Region" />
 <xs:element name="Country" type="SupplierCountry" />
</xs:sequence>
</xs:complexType>
<!-- Estrutura de Taxa -->
<xs:element name="Tax">
<xs:complexType>
 <xs:sequence>
 <xs:element ref="TaxType" />
 <xs:element ref="TaxCountryRegion" />
 <xs:element ref="TaxCode" />
 <xs:choice>
	 <xs:element ref="TaxPercentage" />
	 <xs:element ref="TaxAmount" />
 </xs:choice>
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- Estrutura de Retenção na fonte-->
<xs:element name="WithholdingTax">
<xs:complexType>
 <xs:sequence>
 <xs:element minOccurs="0" ref="WithholdingTaxType" />
 <xs:element minOccurs="0" name="WithholdingTaxDescription" type="SAFPTtextTypeMandatoryMax60Car" />
 <xs:element name="WithholdingTaxAmount" type="SAFmonetaryType" />
 </xs:sequence>
</xs:complexType>
</xs:element>
<!-- ELEMENTOS SIMPLES -->
<xs:element name="AccountDescription" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="Address" type="AddressStructure" />
<xs:element name="AddressDetail" type="SAFPTtextTypeMandatoryMax100Car" />
<xs:element name="ATDocCodeID" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="BillingAddress" type="AddressStructure" />
<xs:element name="BuildingNumber" type="SAFPTtextTypeMandatoryMax10Car" />
<xs:element name="BusinessName" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="City" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ClosingCreditBalance" type="SAFmonetaryType" />
<xs:element name="ClosingDebitBalance" type="SAFmonetaryType" />
<xs:element name="CompanyAddress" type="AddressStructurePT" />
<xs:element name="CompanyName" type="SAFPTtextTypeMandatoryMax100Car" />
<xs:element name="Contact" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="CreditAmount" type="SAFmonetaryType" />
<xs:element name="CurrencyAmount" type="SAFmonetaryType" />
<xs:element name="CustomerID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="CustomerTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="DateCreated" type="SAFPTDateSpan" />
<xs:element name="DebitAmount" type="SAFmonetaryType" />
<xs:element name="DeliveryDate" type="SAFdateType" />
<xs:element name="DeliveryID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Description" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="DocArchivalNumber" type="SAFTPTDocArchivalNumber" />
<xs:element name="Email" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="EndDate" type="SAFPTDateSpan" />
<xs:element name="ExchangeRate" type="SAFdecimalType" />
<xs:element name="Fax" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="GLPostingDate" type="SAFdateTimeType" />
<xs:element name="GrossTotal" type="SAFmonetaryType" />
<xs:element name="Hash" type="SAFPTtextTypeMandatoryMax172Car" />
<xs:element name="HashControl" type="SAFPTtextTypeMandatoryMax40Car" />
<xs:element name="HeaderComment" type="SAFPTtextTypeMandatoryMax255Car" />
<xs:element name="InvoiceDate" type="SAFdateType" />
<xs:element name="InvoiceStatusDate" type="SAFdateTimeType" />
<xs:element name="JournalID" type="SAFPTJournalID" />
<xs:element name="LineNumber" type="xs:nonNegativeInteger" />
<xs:element name="LocationID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="MovementComments" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="MovementDate" type="SAFdateType" />
<xs:element name="MovementEndTime" type="SAFdateTimeType" />
<xs:element name="MovementStartTime" type="SAFdateTimeType" />
<xs:element name="MovementStatusDate" type="SAFdateTimeType" />
<xs:element name="NetTotal" type="SAFmonetaryType" />
<xs:element name="NumberOfEntries" type="xs:nonNegativeInteger" />
<xs:element name="NumberOfMovementLines" type="xs:nonNegativeInteger" />
<xs:element name="OpeningCreditBalance" type="SAFmonetaryType" />
<xs:element name="OpeningDebitBalance" type="SAFmonetaryType" />
<xs:element name="OrderDate" type="SAFdateType" />
<xs:element name="OriginatingON" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="PostalCode" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="ProductCode" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="ProductCompanyTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="ProductDescription" type="SAFPTtextTypeMandatoryMax200Car" />
<xs:element name="ProductGroup" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ProductID" type="SAFPTProductID" />
<xs:element name="ProductNumberCode" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="ProductVersion" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Quantity" type="SAFdecimalType" />
<xs:element name="Reason" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="RecordID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="Reference" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="Region" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="SettlementAmount" type="SAFmonetaryType" />
<xs:element name="ShipFrom" type="ShippingPointStructure" />
<xs:element name="ShipFromAddress" type="AddressStructure" />
<xs:element name="ShipTo" type="ShippingPointStructure" />
<xs:element name="ShipToAddress" type="AddressStructure" />
<xs:element name="SoftwareCertificateNumber" type="xs:nonNegativeInteger" />
<xs:element name="SourceDocumentID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="SourceID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="StartDate" type="SAFPTDateSpan" />
<xs:element name="StreetName" type="SAFPTtextTypeMandatoryMax90Car" />
<xs:element name="SupplierID" type="SAFPTtextTypeMandatoryMax30Car" />
<xs:element name="SupplierTaxID" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="SystemEntryDate" type="SAFdateTimeType" />
<xs:element name="TaxAmount" type="SAFmonetaryType" />
<xs:element name="TaxEntity" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="TaxExemptionReason" type="SAFPTPortugueseTaxExemption" />
<xs:element name="TaxExpirationDate" type="SAFdateType" />
<xs:element name="TaxPayable" type="SAFmonetaryType" />
<xs:element name="TaxPercentage" type="SAFdecimalType" />
<xs:element name="TaxPointDate" type="SAFdateType" />
<xs:element name="TaxVerificationDate" type="SAFdateType" />
<xs:element name="Telephone" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="TotalCredit" type="SAFmonetaryType" />
<xs:element name="TotalDebit" type="SAFmonetaryType" />
<xs:element name="TotalQuantityIssued" type="SAFdecimalType" />
<xs:element name="TransactionDate" type="SAFdateType" />
<xs:element name="TransactionID" type="SAFPTTransactionID" />
<xs:element name="UnitOfMeasure" type="SAFPTtextTypeMandatoryMax20Car" />
<xs:element name="UnitPrice" type="SAFmonetaryType" />
<xs:element name="WarehouseID" type="SAFPTtextTypeMandatoryMax50Car" />
<xs:element name="Website" type="SAFPTtextTypeMandatoryMax60Car" />
<xs:element name="WorkDate" type="SAFdateType" />
<xs:element name="WorkStatusDate" type="SAFdateTimeType" />
<!-- ELEMENTOS SIMPLES COM RESTRIÇÕES ADICIONAIS-->
<!-- Código da Conta -->
<xs:element name="AccountID">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="(([0-9a-zA-Z\-/._+*]*)|Desconhecido)" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AuditFileVersion">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="1.02_01" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Identificação da empresa que exportou o SAFT-->
<xs:element name="CompanyID">
<xs:annotation>
 <xs:documentation>Obtém-se pela concatenação da Conservatória do Registo Comercial com o número do registo comercial separados pelo carácter espaço. Nos casos em que não existe o registo comercial, deve ser indicado o NIF.</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="([0-9]{9})+|([a-zA-Z0-9\-/_ãõÃÕéÉàáÀÁóÓçÇíÍ ]+ [0-9]+)" />
 <xs:minLength value="1" />
 <xs:maxLength value="50" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código do país (ISO 3166 1-alpha-2) -->
<xs:element name="Country">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|Desconhecido|" />
 <xs:minLength value="2" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código da moeda (ISO 4217) -->
<xs:element name="CurrencyCode">
<!-- Não consta o EUR por não existirem situações que requeiram este código de moeda -->
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYR|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LTL|LVL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRO|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLL|SOS|SRD|SSP|STD|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|USS|UYI|UYU|UZS|VEF|VND|VUV|WST|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XDR|XFU|XOF|XPD|XPF|XPT|XSU|XUA|YER|ZAR|ZMW|ZWL|EEK|SKK|TMM|ZMK|ZWD|ZWR|" />
 <xs:length value="3" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código único do documento de movimentação de mercadorias e de conferência-->
<xs:element name="DocumentNumber">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código CAE -->
<xs:element name="EACCode">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="(([0-9]*))" />
 <xs:length value="5" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Ano Fiscal -->
<xs:element name="FiscalYear">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="2000" />
 <xs:maxInclusive value="9999" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Categoria da conta -->
<xs:element name="GroupingCategory">
<xs:annotation>
 <xs:documentation>GR para conta de 1º grau da contabilidade geral, GA para conta agregadora ou integradora da contabilidade geral, GM para conta de movimento da contabilidade geral, AR para conta de 1º grau da contabilidade analítica, AA para conta agregadora ou integradora da contabilidade analítica, AM para conta de movimento da contabilidade analítica </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="GR" />
 <xs:enumeration value="GA" />
 <xs:enumeration value="GM" />
 <xs:enumeration value="AR" />
 <xs:enumeration value="AA" />
 <xs:enumeration value="AM" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código único do documento de venda -->
<xs:element name="InvoiceNo">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="[^ ]+ [^/^ ]+/[0-9]+" />
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento SalesInvoices -->
<xs:element name="InvoiceStatus">
<xs:annotation>
 <xs:documentation>N para Normal, S para autofaturação, A para anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação, F para faturado </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="S" />
 <xs:enumeration value="A" />
 <xs:enumeration value="R" />
 <xs:enumeration value="F" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de venda-->
<xs:element name="InvoiceType">
<xs:annotation>
 <xs:documentation>
 Restrição: FT-Fatura nos termos do art.º 36º do CIVA, FS-Fatura simplificada nos termos do art.º 40º do CIVA, FR-Fatura-Recibo, ND-Nota de débito, NC-Nota de Crédito,VD-Venda a dinheiro (a), TV-Talão de Venda (a), TD-Talão de devolução (a), AA-Alienação Activos (a),DA-Devolução Activos (a), RP-Prémio ou Recibo Prémio, RE-Estorno ou Recibo de Estorno, CS-Imputação a Co-Seguradoras, LD-Imputação a Co-Seguradora Líder, RA-Resseguro Aceite. (a) Para dados até 2012-12-31
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="FT" />
 <xs:enumeration value="FS" />
 <xs:enumeration value="FR" />
 <xs:enumeration value="ND" />
 <xs:enumeration value="NC" />
 <xs:enumeration value="VD" />
 <xs:enumeration value="TV" />
 <xs:enumeration value="TD" />
 <xs:enumeration value="AA" />
 <xs:enumeration value="DA" />
 <!-- Menções para o sector segurador-->
 <xs:enumeration value="RP" />
 <xs:enumeration value="RE" />
 <xs:enumeration value="CS" />
 <xs:enumeration value="LD" />
 <xs:enumeration value="RA" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento MovementOfGoods -->
<xs:element name="MovementStatus">
<xs:annotation>
 <xs:documentation>N para Normal, T por conta de terceiros, A para Anulado, R para documento de resumo doutros documentos criados noutras aplicações e gerado nesta aplicação. </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="T" />
 <xs:enumeration value="A" />
 <xs:enumeration value="R" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de movimentação de mercadorias-->
<xs:element name="MovementType">
<xs:annotation>
 <xs:documentation>
 Restrição: Tipos de Documento (GR para Guia de remessa, GT para Guia de transporte, GA para Guia de movimentação de ativos próprios, GC para Guia de consignação, GD para Guia ou nota de devolução)
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="GR" />
 <xs:enumeration value="GT" />
 <xs:enumeration value="GA" />
 <xs:enumeration value="GC" />
 <xs:enumeration value="GD" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Meio de pagamento-->
<xs:element name="PaymentMechanism">
<xs:annotation>
 <xs:documentation>
	 Restrição: Meio de pagamento (CC para Cartão de Crédito, CD para Cartão de Débito, CH para Cheque, CS para Compensação de saldos em conta corrente, LC para Letra comercial, MB para Multibanco, NU para Numerário, PR para Permuta, TB para Transferência Bancária, TR para Ticket Restaurante)
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="CC" />
 <xs:enumeration value="CD" />
 <xs:enumeration value="CH" />
 <xs:enumeration value="CS" />
 <xs:enumeration value="LC" />
 <xs:enumeration value="MB" />
 <xs:enumeration value="NU" />
 <xs:enumeration value="PR" />
 <xs:enumeration value="TB" />
 <xs:enumeration value="TR" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Periodo contabilistico do documento -->
<xs:element name="Period">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="1" />
 <xs:maxInclusive value="12" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipos de produto -->
<xs:element name="ProductType">
<xs:annotation>
 <xs:documentation>Restrição: Tipo de produto: P - Produtos, S - Serviços, O - Outros, I - Impostos, taxas e encargos parafiscais excepto IVA e IS uma vez que se encontram reflectidos na tabela de impostos</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="P" />
 <xs:enumeration value="S" />
 <xs:enumeration value="O" />
 <xs:enumeration value="I" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Identificador de Autofaturação -->
<xs:element name="SelfBillingIndicator">
<xs:simpleType>
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="0" />
 <xs:maxInclusive value="1" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Origem do documento -->
<xs:element name="SourceBilling">
<xs:annotation>
 <xs:documentation>P para documento produzido na aplicação, I para documento integrado e produzido noutra aplicação, M para documento proveniente de recuperação de emissão manual </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="P" />
 <xs:enumeration value="I" />
 <xs:enumeration value="M" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de sistema que exportou o SAFT -->
<xs:element name="TaxAccountingBasis">
<xs:annotation>
 <xs:documentation>C para Contabilidade, F para Faturação incluindo os documentos de transporte, I para Contabilidade-Faturação incluindo os documentos de transporte, S para Autofaturação, E – Faturação, incluindo documentos de transporte, emitida por terceiros, P para Faturação parcial incluindo os documentos de transporte</xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="C" />
 <xs:enumeration value="F" />
 <xs:enumeration value="I" />
 <xs:enumeration value="S" />
 <xs:enumeration value="E" />
 <xs:enumeration value="P" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TaxCode">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="RED|INT|NOR|ISE|OUT|([0-9.])*|NS" />
 <xs:minLength value="1" />
 <xs:maxLength value="10" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código de Imposto -->
<xs:element name="TaxCountryRegion">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|PT-AC|PT-MA" />
 <xs:minLength value="2" />
 <xs:maxLength value="5" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de Imposto -->
<xs:element name="TaxType">
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="IVA" />
 <xs:enumeration value="IS" />
 <xs:enumeration value="NS" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipos de Movimento Contabilistico -->
<xs:element name="TransactionType">
<xs:annotation>
 <xs:documentation>Restrição: Tipificação dos movimentos contabilísticos - N - Normal, R - Regularizações do período de tributação, A - Apuramento de resultados, J - Movimentos de Ajustamento </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="R" />
 <xs:enumeration value="A" />
 <xs:enumeration value="J" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Código do tipo de imposto retido -->
<xs:element name="WithholdingTaxType">
<xs:annotation>
 <xs:documentation>Restrição: IRS para Imposto Sobre o Rendimento das Pessoas Singulares, IRC para Imposto Sobre o Rendimento das Pessoas colectivas, IS para Imposto de selo </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="IRS" />
 <xs:enumeration value="IRC" />
 <xs:enumeration value="IS" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Estado do documento WorkingDocuments -->
<xs:element name="WorkStatus">
<xs:annotation>
 <xs:documentation>N para Normal, A para Anulado, F para faturado (quando para este documento também existe na tabela 4.1. o correspondente do tipo fatura ou fatura simplificada) </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="N" />
 <xs:enumeration value="A" />
 <xs:enumeration value="F" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Tipo de documento de conferência de entrega de mercadorias ou da prestação de serviços -->
<xs:element name="WorkType">
<xs:annotation>
 <xs:documentation>
 Restrição: DC para documentos suscetíveis de apresentação ao cliente para conferência de entrega de mercadorias ou da prestação de serviços
 </xs:documentation>
</xs:annotation>
<xs:simpleType>
 <xs:restriction base="xs:string">
 <xs:enumeration value="DC" />
 </xs:restriction>
</xs:simpleType>
</xs:element>
<!-- TIPOS DE DADOS BASE SAFT OCDE-->
<xs:simpleType name="SAFdateTimeType">
<xs:restriction base="xs:dateTime" />
</xs:simpleType>
<xs:simpleType name="SAFdateType">
<xs:restriction base="xs:date" />
</xs:simpleType>
<xs:simpleType name="SAFdecimalType">
<xs:restriction base="xs:decimal">
 <xs:minInclusive value="0.00" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFmonetaryType">
<xs:restriction base="xs:decimal">
 <xs:minInclusive value="0.00" />
</xs:restriction>
</xs:simpleType>
<!-- TIPOS DE DADOS BASE SAFT Portugal -->
<!-- Código Postal Português -->
<xs:simpleType name="PostalCodePT">
<xs:restriction base="xs:string">
 <xs:pattern value="([0-9]{4}-[0-9]{3})" />
</xs:restriction>
</xs:simpleType>
<!-- Periodo do movimento contabilístico -->
<xs:simpleType name="SAFPTAccountingPeriod">
<xs:restriction base="xs:integer">
 <xs:minInclusive value="1" />
 <xs:maxInclusive value="16" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTDateSpan">
<xs:restriction base="xs:date">
 <xs:minInclusive value="2000-01-01" />
 <xs:maxInclusive value="9999-12-31" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFTPTDocArchivalNumber">
<xs:restriction base="xs:string">
 <xs:pattern value="[^ ]{1,20}" />
 <xs:minLength value="1" />
 <xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTGLAccountID">
<xs:restriction base="xs:string">
 <xs:pattern value="(([0-9a-zA-Z\-/._+*]*))" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTJournalID">
<xs:restriction base="xs:string">
 <xs:pattern value="[^ ]{1,30}" />
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFTPTMovementTaxCode">
<xs:restriction base="xs:string">
 <xs:pattern value="RED|INT|NOR|ISE|OUT|NS" />
 <xs:minLength value="1" />
 <xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
<!-- Tipo de Imposto da Tabela MovementOfGoods-->
<xs:simpleType name="SAFTPTMovementTaxType">
<xs:restriction base="xs:string">
 <xs:enumeration value="IVA" />
 <xs:enumeration value="NS" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTPortugueseTaxExemption">
<xs:restriction base="xs:string">
 <xs:minLength value="6" />
 <xs:maxLength value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTPortugueseVatNumber">
<xs:restriction base="xs:integer">
 <xs:minInclusive value="100000000" />
 <xs:maxInclusive value="999999999" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTProductID">
<xs:restriction base="xs:string">
 <xs:pattern value="[^/]+/[^/]+" />
 <xs:minLength value="3" />
 <xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax3Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax10Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax20Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax30Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax40Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="40" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax50Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax60Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax70Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="70" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax90Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax100Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax172Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="172" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax200Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="200" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMandatoryMax255Car">
<xs:restriction base="xs:string">
 <xs:minLength value="1" />
 <xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTtextTypeMax40Car">
<xs:restriction base="xs:string">
 <xs:minLength value="0" />
 <xs:maxLength value="40" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SAFPTTransactionID">
<xs:restriction base="xs:string">
 <xs:pattern value="[1-9][0-9]{3}-[01][0-9]-[0-3][0-9] [^ ]{1,30} [^ ]{1,20}" />
 <xs:minLength value="1" />
 <xs:maxLength value="70" />
</xs:restriction>
</xs:simpleType>
<!-- Código do país (ISO 3166 1-alpha-2) -->
<xs:simpleType name="SupplierCountry">
<xs:restriction base="xs:string">
 <xs:pattern value="AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW|" />
 <xs:length value="2" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

fonte...

https://faturas.portaldasfinancas.gov.pt/DocTransporte/sgdtpf_static/java/SGDTUP-1.0.1.0014.jar

Obrigado Always. Já criei o SAFTPT_1.02_01.XSD a partir dos elementos que forneceste. Também alterei o meu XML para usar este novo XSD e não são detetados erros. Mas quando tento submeter o ficheiro, continua a dar o mesmo erro (Cannot find the declaration of element 'AuditFile'). Penso que temos que aguardar até o serviço estar funcional.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
ARP    2
ARP

Obrigado Always. Já criei o SAFTPT_1.02_01.XSD a partir dos elementos que forneceste. Também alterei o meu XML para usar este novo XSD e não são detetados erros. Mas quando tento submeter o ficheiro, continua a dar o mesmo erro (Cannot find the declaration of element 'AuditFile'). Penso que temos que aguardar até o serviço estar funcional.

EEsteves é melhor verificares novamente, porque eu e outros já conseguimos submeter ficheiros com sucesso.

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
chicl3t    2
chicl3t

Alguem sabe orque nao me gera o Nonce??

certpk = Createobject('Chilkat.Cert')
CRYPT= Createobject('Chilkat.Crypt2')
RSA = Createobject('Chilkat.Rsa')

If certpk.LoadFromFile( "c:\EnvioGuias\ChavePublicaAT.cer") <> 1
Messagebox('Error loading certificate file')
Return .F.
Endif

publickey = certpk.ExportPublicKey
*!* generate an array of random bytes for the secret key
CRYPT.CryptAlgorithm = 'aes'
CRYPT.CipherMode = 'ecb'
CRYPT.KeyLength = 128
CRYPT.Charset = 'utf-8'
CRYPT.PaddingScheme = 0 && PKCS5
simkey = "1234567890123456"
CRYPT.SetEncodedKey(simkey, 'ascii')
*!* encrypt the secret key
If RSA.ImportPublicKey(publickey.GetXml) <> 1
Messagebox('Error importing public key')
Endif
RSA.EncodingMode = 'base64'
RSA.Charset = 'utf-8'
RSA.LittleEndian = 1
RSA.VerboseLogging = 1
RSA.OaepPadding = 0
nonce = RSA.EncryptBytesENC(CRYPT.StringToBytes(simkey,'utf-8'), 0)

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites
AntonioPereira    2
AntonioPereira

Boas tarde, alguém me pode tirar umas dúvidas:

Sabendo que temos que optar pela comunicação de facturas (Webservice ou Ficheiro Saft), quais as consequências de enviar facturas por webservice e depois enviar as mesmas pelo ficheiro SAFT, ou vice-versa? Se for ao contrário, o webservice retornaria um erro a dizer que já tinha sido inserido? Tenho que ter essa preocupação ou simplesmente eles validam esses documentos e não tenho que me preocupar?

Obrigado

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!

Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.

Entrar Agora


×

Aviso Sobre Cookies

Ao usar este site você aceita os nossos Termos de Uso e Política de Privacidade