<?xml version="1.0" encoding="Windows-1252"?>
<xs:schema xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation" xmlns:ns="urn:OECD:StandardAuditFile-Tax:PT_1.03_01" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.03_01" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:OECD:StandardAuditFile-Tax:PT_1.03_01" version="1.03_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.03_01</doc:Number>
        <doc:Status>Production</doc:Status>
      </doc:Version>
      <doc:Author>Autoridade Tributaria e Aduaneira</doc:Author>
      <doc:ModificationDate>2013-10-01</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:unique name="GeneralLedgerEntriesJournalIdConstraint">
      <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal" />
      <xs:field xpath="ns:JournalID" />
    </xs:unique>
    <xs:keyref name="GeneralLedgerEntriesSupplierIDConstraint" refer="SupplierIDConstraint">
      <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
      <xs:field xpath="ns:SupplierID" />
    </xs:keyref>
    <xs:unique name="GeneralLedgerEntriesTransactionIdConstraint">
      <xs:selector xpath="ns:GeneralLedgerEntries/ns:Journal/ns:Transaction" />
      <xs:field xpath="ns:TransactionID" />
    </xs:unique>
    <xs:unique name="InvoiceNoConstraint">
      <xs:selector xpath="ns:SourceDocuments/ns:SalesInvoices/ns:Invoice" />
      <xs:field xpath="ns:InvoiceNo" />
    </xs:unique>
    <xs:keyref name="InvoiceCustomerIDConstraint" refer="CustomerIDConstraint">
      <xs:selector xpath="ns:SourceDocuments/ns:SalesInvoices/ns:Invoice" />
      <xs:field xpath="ns:CustomerID" />
    </xs:keyref>
    <xs: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:unique name="PaymentPaymentRefNoConstraint">
      <xs:selector xpath="ns:SourceDocuments/ns:Payments/ns:Payment" />
      <xs:field xpath="ns:PaymentRefNo" />
    </xs:unique>
    <xs:keyref name="PaymentPaymentRefNoCustomerIDConstraint" refer="CustomerIDConstraint">
      <xs:selector xpath="ns:SourceDocuments/ns:Payments/ns:Payment" />
      <xs:field xpath="ns:CustomerID" />
    </xs:keyref>
  </xs:element>
  <!-- Estrutura de cabecalho (AuditFile.Header) -->
  <xs:element name="Header">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="AuditFileVersion" />
        <xs:element ref="CompanyID" />
        <xs:element name="TaxRegistrationNumber" type="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 name="TaxCode" type="TaxTableEntryTaxCode" />
        <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: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 situacao atual do documento -->
                    <xs:element name="DocumentStatus">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="InvoiceStatus" />
                          <!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
                          <xs:element ref="InvoiceStatusDate" />
                          <xs:element minOccurs="0" ref="Reason" />
                          <xs:element ref="SourceID" />
                          <xs:element name="SourceBilling" type="SAFTPTSourceBilling" />
                        </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="InvoiceDate" />
                    <xs:element ref="InvoiceType" />
                    <xs:element name="SpecialRegimes" type="SpecialRegimes" />
                    <xs:element ref="SourceID" />
                    <xs:element minOccurs="0" ref="EACCode" />
                    <xs:element ref="SystemEntryDate" />
                    <xs:element minOccurs="0" ref="TransactionID" />
                    <xs:element ref="CustomerID" />
                    <xs:element minOccurs="0" maxOccurs="1" ref="ShipTo" />
                    <xs:element minOccurs="0" maxOccurs="1" ref="ShipFrom" />
                    <xs:element minOccurs="0" maxOccurs="1" ref="MovementEndTime" />
                    <xs:element minOccurs="0" maxOccurs="1" ref="MovementStartTime" />
                    <xs:element maxOccurs="unbounded" name="Line">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="LineNumber" />
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="OrderReferences" type="OrderReferences" />
                          <xs:element ref="ProductCode" />
                          <xs:element ref="ProductDescription" />
                          <xs:element ref="Quantity" />
                          <xs:element ref="UnitOfMeasure" />
                          <xs:element ref="UnitPrice" />
                          <xs:element ref="TaxPointDate" />
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="References" type="References" />
                          <xs:element ref="Description" />
                          <xs:choice>
                            <xs:element ref="DebitAmount" />
                            <xs:element ref="CreditAmount" />
                          </xs:choice>
                          <xs:element name="Tax" type="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" name="Currency" type="Currency" />
                          <!-- A estrutura Settlement representa acordos ou formas de pagamento futuros. Nao constitui em caso algum o somatorio dos descontos concedidos e reflectidos nas linhas dos documentos e a informacao aqui constante nao influi o montante total do documento (GrossTotal) -->
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="Settlement" type="Settlement" />
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="Payment" type="PaymentMethod" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="WithholdingTax" type="WithholdingTax" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="MovementOfGoods">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="NumberOfMovementLines" />
              <xs:element ref="TotalQuantityIssued" />
              <xs:element minOccurs="0" maxOccurs="unbounded" name="StockMovement">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element ref="DocumentNumber" />
                    <!-- Estrutura da situacao atual do documento -->
                    <xs:element name="DocumentStatus">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="MovementStatus" />
                          <!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
                          <xs:element ref="MovementStatusDate" />
                          <xs:element minOccurs="0" ref="Reason" />
                          <xs:element ref="SourceID" />
                          <xs:element name="SourceBilling" type="SAFTPTSourceBilling" />
                        </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="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 falta desta informacao em concreto, a hora de inicio de transporte (MovementStartTime) pode ser indicada com a concatenacao 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" name="OrderReferences" type="OrderReferences" />
                          <xs:element ref="ProductCode" />
                          <xs:element ref="ProductDescription" />
                          <xs:element ref="Quantity" />
                          <xs:element ref="UnitOfMeasure" />
                          <xs:element ref="UnitPrice" />
                          <xs:element ref="Description" />
                          <xs: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" name="Currency" type="Currency" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="WorkingDocuments">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="NumberOfEntries" />
              <xs:element ref="TotalDebit" />
              <xs:element ref="TotalCredit" />
              <xs:element minOccurs="0" maxOccurs="unbounded" name="WorkDocument">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element ref="DocumentNumber" />
                    <xs:element name="DocumentStatus">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="WorkStatus" />
                          <!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
                          <xs:element ref="WorkStatusDate" />
                          <xs:element minOccurs="0" ref="Reason" />
                          <xs:element ref="SourceID" />
                          <xs:element name="SourceBilling" type="SAFTPTSourceBilling" />
                        </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" name="OrderReferences" type="OrderReferences" />
                          <xs:element ref="ProductCode" />
                          <xs:element ref="ProductDescription" />
                          <xs:element ref="Quantity" />
                          <xs:element ref="UnitOfMeasure" />
                          <xs:element ref="UnitPrice" />
                          <xs:element ref="TaxPointDate" />
                          <xs:element ref="Description" />
                          <xs:choice>
                            <xs:element ref="DebitAmount" />
                            <xs:element ref="CreditAmount" />
                          </xs:choice>
                          <xs:element minOccurs="0" name="Tax" type="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" name="Currency" type="Currency" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="Payments">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="NumberOfEntries" />
              <xs:element ref="TotalDebit" />
              <xs:element ref="TotalCredit" />
              <xs:element minOccurs="0" maxOccurs="unbounded" name="Payment">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element ref="PaymentRefNo" />
                    <xs:element minOccurs="0" ref="Period" />
                    <xs:element minOccurs="0" ref="TransactionID" />
                    <xs:element ref="TransactionDate" />
                    <xs:element name="PaymentType" type="SAFTPTPaymentType" />
                    <xs:element minOccurs="0" ref="Description" />
                    <xs:element minOccurs="0" ref="SystemID" />
                    <xs:element name="DocumentStatus">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="PaymentStatus" />
                          <!-- Na exportacao de dados relativos a exercicios anteriores em que esta informacao seja desconhecida, este campo devera ser preenchido com a data do documento e hora como 00:00:00 -->
                          <xs:element ref="PaymentStatusDate" />
                          <xs:element minOccurs="0" ref="Reason" />
                          <xs:element ref="SourceID" />
                          <xs:element name="SourcePayment" type="SAFTPTSourcePayment" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="PaymentMethod" type="PaymentMethod" />
                    <xs:element ref="SourceID" />
                    <xs:element ref="SystemEntryDate" />
                    <xs:element ref="CustomerID" />
                    <xs:element maxOccurs="unbounded" name="Line">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="LineNumber" />
                          <xs:element maxOccurs="unbounded" name="SourceDocumentID">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element ref="OriginatingON" />
                                <xs:element ref="InvoiceDate" />
                                <xs:element minOccurs="0" ref="Description" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" ref="SettlementAmount" />
                          <xs:choice>
                            <xs:element ref="DebitAmount" />
                            <xs:element ref="CreditAmount" />
                          </xs:choice>
                          <xs:element minOccurs="0" name="Tax" type="PaymentTax" />
                          <xs:element minOccurs="0" ref="TaxExemptionReason" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="DocumentTotals">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="TaxPayable" />
                          <xs:element ref="NetTotal" />
                          <xs:element ref="GrossTotal" />
                          <!-- O conteudo desta estrutura Settlement representa o somatorio dos descontos reflectidos no elemento SettlementAmount das linhas do recibo. Trata-se de um raciocinio diverso da tabela 4.1 SalesInvoices -->
                          <xs:element minOccurs="0" name="Settlement">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element ref="SettlementAmount" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" name="Currency" type="Currency" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="WithholdingTax" type="WithholdingTax" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs: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 monetario -->
  <!-- Este elemento apenas deve ser gerado quando a moeda original do documento for diferente de euro -->
  <xs:complexType name="Currency">
    <xs:sequence>
      <xs:element ref="CurrencyCode" />
      <xs:element ref="CurrencyAmount" />
      <xs:element minOccurs="0" ref="ExchangeRate" />
    </xs:sequence>
  </xs:complexType>
  <!-- Estrutura de Taxa de documentos de movimentacao 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 Referencias ao documento de origem-->
  <xs:complexType name="OrderReferences">
    <xs:sequence>
      <xs:element minOccurs="0" ref="OriginatingON" />
      <xs:element minOccurs="0" ref="OrderDate" />
    </xs:sequence>
  </xs:complexType>
  <!-- Estrutura de pagamentos-->
  <xs:complexType name="PaymentMethod">
    <xs:sequence>
      <xs:element ref="PaymentMechanism" />
      <xs:element name="PaymentAmount" type="SAFmonetaryType" />
      <xs:element name="PaymentDate" type="SAFdateType" />
    </xs:sequence>
  </xs:complexType>
  <!-- Estrutura de Taxa dos recibos-->
  <xs:complexType name="PaymentTax">
    <xs:sequence>
      <xs:element ref="TaxType" />
      <xs:element ref="TaxCountryRegion" />
      <xs:element name="TaxCode" type="PaymentTaxCode" />
      <xs:choice>
        <xs:element ref="TaxPercentage" />
        <xs:element ref="TaxAmount" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <!-- Estrutura de referencias a outros documentos em documentos retificativos de faturas-->
  <xs:complexType name="References">
    <xs:sequence>
      <xs:element minOccurs="0" ref="Reference" />
      <xs:element minOccurs="0" ref="Reason" />
    </xs:sequence>
  </xs:complexType>
  <!-- Estrutura de Acordos entre cliente e fornecedor-->
  <xs:complexType name="Settlement">
    <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>
  <!-- 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 Regimes especiais de faturacao-->
  <xs:complexType name="SpecialRegimes">
    <xs:sequence>
      <xs:element ref="SelfBillingIndicator" />
      <xs:element ref="CashVATSchemeIndicator" />
      <xs:element ref="ThirdPartiesBillingIndicator" />
    </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:complexType name="Tax">
    <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>
  <!-- Estrutura de Retencao na fonte-->
  <xs:complexType name="WithholdingTax">
    <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>
  <!-- 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="SAFPTtextTypeMandatoryMax255Car" />
  <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="PaymentStatusDate" type="SAFdateTimeType" />
  <xs:element name="PostalCode" type="SAFPTtextTypeMandatoryMax20Car" />
  <xs:element name="ProductCode" type="SAFPTtextTypeMandatoryMax60Car" />
  <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="SystemID" type="SAFPTtextTypeMandatoryMax35Car" />
  <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 RESTRICOES ADICIONAIS-->
  <!-- Codigo 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.03_01" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Indicador de regime de IVA de Caixa -->
  <xs:element name="CashVATSchemeIndicator">
    <xs:simpleType>
      <xs:restriction base="xs:integer">
        <xs:minInclusive value="0" />
        <xs:maxInclusive value="1" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Identificacao da entidade a que respeitam os dados constantes no SAF-T-->
  <xs:element name="CompanyID">
    <xs:annotation>
      <xs:documentation>Concatenacao da Conservatoria do Registo Comercial com o numero do registo comercial separados pelo caracter espaco. Nos casos em que nao 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\-/_&#0227;&#0195;&#0245;&#0213;&#0233;&#0201;&#0234;&#0202;&#0224;&#0192;&#0225;&#0193;&#0243;&#0211;&#0231;&#0199;&#0237;&#0205;&#0250;&#0218;&#0186;&#0170;&amp; ]+ [0-9/]+)" />
        <xs:minLength value="1" />
        <xs:maxLength value="50" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Codigo do pais (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>
  <!-- Codigo da moeda (ISO 4217) -->
  <xs:element name="CurrencyCode">
    <!-- Nao consta o EUR por nao existirem situacoes que requeiram este codigo 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>
  <!-- Identificacao unica do documento de movimentacao de mercadorias e de conferencia-->
  <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>
  <!-- Codigo 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 analitica, AA para conta agregadora ou integradora da contabilidade analitica, AM para conta de movimento da contabilidade analitica </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>
  <!-- Codigo unico 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 Autofaturacao, A para Documento anulado, R para Documento de resumo doutros documentos criados noutras aplicacoes e gerado nesta aplicacao, F para Documento 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>
        Restricao:FT para Fatura, emitida nos termos do artigo 36. do Codigo do IVA, FS para Fatura simplificada, emitida nos termos do artigo 40. do Codigo do IVA, FR para Fatura-recibo, ND para Nota de debito, NC para Nota de credito, VD para Venda a dinheiro e factura/recibo (a), TV para Talao de venda (a), TD para Talao de devolucao (a), AA para Alienacao de ativos (a), DA para Devolucao de  ativos (a). Para o setor Segurador, ainda pode ser preenchido com: RP para Premio ou recibo de premio, RE para Estorno ou recibo de estorno, CS para Imputacao a co-seguradoras, LD para Imputacao a co-seguradora líder, RA para Resseguro aceite. (a) Para os dados ate 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" />
        <!-- 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 para Por conta de terceiros, A para Documento anulado, F para Documento faturado, quando para este documento tambem existe na tabela 4.1. para Documentos comerciais a clientes (SalesInvoices) o correspondente do tipo fatura ou fatura simplificada, R para Documento de resumo doutros documentos criados noutras aplicacoes e gerado nesta aplicacao </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="F" />
        <xs:enumeration value="R" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Tipo de documento de movimentacao de mercadorias-->
  <xs:element name="MovementType">
    <xs:annotation>
      <xs:documentation>
        Restricao: Tipos de Documento (GR para Guia de remessa, GT para Guia de transporte incluindo as globais, GA para Guia de movimentacao de ativos fixos proprios, GC para Guia de consignacao, GD para Guia ou nota de devolucao
      </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>
         Restricao:CC para Cartao credito, CD para Cartao debito, CH para Cheque bancario, CO para Cheque ou cartao oferta, CS para Compensacao de saldos em conta corrente, DE para Dinheiro eletronico, por exemplo em cartoes de fidelidade ou de pontos, LC para Letra comercial, MB para Referencias de pagamento para Multibanco, NU para Numerario, OU para Outros meios aqui nao assinalados, PR para Permuta de bens, TB para Transferencia bancaria ou debito direto autorizado, 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="CO" />
        <xs:enumeration value="CS" />
        <xs:enumeration value="DE" />
        <xs:enumeration value="LC" />
        <xs:enumeration value="MB" />
        <xs:enumeration value="NU" />
        <xs:enumeration value="OU" />
        <xs:enumeration value="PR" />
        <xs:enumeration value="TB" />
        <xs:enumeration value="TR" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Codigo unico do documento de venda -->
  <xs:element name="PaymentRefNo">
    <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 Payments -->
  <xs:element name="PaymentStatus">
    <xs:annotation>
      <xs:documentation>N para normal, A para Anulado </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="N" />
        <xs:enumeration value="A" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Codigo de de Imposto de pagamento-->
  <xs:simpleType name="PaymentTaxCode">
    <xs:restriction base="xs:string">
      <xs:pattern value="RED|INT|NOR|ISE|OUT|([0-9.])*|NA" />
      <xs:minLength value="1" />
      <xs:maxLength value="10" />
    </xs:restriction>
  </xs:simpleType>
  <!-- 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>Restricao: P para Produtos, S para Servicos, O para Outros (Ex: portes debitados, adiantamentos recebidos ou alienacao de ativos), I para Impostos, taxas e encargos parafiscais exceto IVA e IS que deverao ser refletidos na tabela 2.5 Tabela de impostos (TaxTable) </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>
  <!-- Indicador de Autofaturacao -->
  <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>
  <!-- Tipo de sistema que exportou o SAFT -->
  <xs:element name="TaxAccountingBasis">
    <xs:annotation>
      <xs:documentation>C para Contabilidade, E para Faturacao emitida por terceiros, F para Faturacao, I para Contabilidade integrada com a faturacao, P para Faturacao parcial, R para Recibos (a), S para Autofaturacao, T para Documentos de transporte (a). (a) Deve ser indicado este tipo, se o programa apenas este emitir este tipo de documento. Caso contrario, devera ser utilizado o tipo C, F ou I </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="C" />
        <xs:enumeration value="E" />
        <xs:enumeration value="F" />
        <xs:enumeration value="I" />
        <xs:enumeration value="P" />
        <xs:enumeration value="R" />
        <xs:enumeration value="S" />
        <xs:enumeration value="T" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Codigo de de Imposto -->
  <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>
  <!-- Pais ou regiao 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 da tabela de impostos-->
  <xs:simpleType name="TaxTableEntryTaxCode">
    <xs:restriction base="xs:string">
      <xs:pattern value="RED|INT|NOR|ISE|OUT|([0-9.])*|NS|NA" />
      <xs:minLength value="1" />
      <xs:maxLength value="10" />
    </xs:restriction>
  </xs:simpleType>
  <!-- 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>
  <!-- Indicador de faturacao emitida em nome e por conta de terceiros -->
  <xs:element name="ThirdPartiesBillingIndicator">
    <xs:simpleType>
      <xs:restriction base="xs:integer">
        <xs:minInclusive value="0" />
        <xs:maxInclusive value="1" />
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <!-- Tipos de Movimento Contabilistico -->
  <xs:element name="TransactionType">
    <xs:annotation>
      <xs:documentation>Restricao: N para Normal, R para Regularizacoes do periodo de tributacao, A para Apuramento de resultados, J para 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>
  <!-- Codigo do tipo de imposto retido -->
  <xs:element name="WithholdingTaxType">
    <xs:annotation>
      <xs:documentation>Restricao: IRS para Imposto Sobre o Rendimento das Pessoas Singulares, IRC para Imposto Sobre o Rendimento das Pessoas colectivas, IS para Imposto do 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 tambem 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 suscetivel de apresentacao ao cliente para conferencia de entrega de mercadorias ou da prestacao de servicos e Fatura de consignacao nos termos do art. 38. do codigo do IVA -->
  <xs:element name="WorkType">
    <xs:annotation>
      <xs:documentation>
        Restricao: DC para documentos emitidos que sejam suscetiveis de apresentacao ao cliente para conferencia de entrega de mercadorias ou da prestacao de servicos, FC para Fatura de consignacao nos termos do art. 38. do codigo do IVA
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="DC" />
        <xs:enumeration value="FC" />
      </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 -->
  <!-- Codigo Postal Portugues -->
  <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 contabilistico -->
  <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="SAFTPTPaymentType">
    <xs:annotation>
      <xs:documentation>
        Restricao: RC para Recibo emitido no ambito do regime de IVA de Caixa (incluindo os relativos a adiantamentos desse regime), RG para Outros recibos emitidos
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="RC" />
      <xs:enumeration value="RG" />
    </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>
  <!-- Origem do documento -->
  <xs:simpleType name="SAFTPTSourceBilling">
    <xs:annotation>
      <xs:documentation>P para documento produzido na aplicacao, I para documento integrado e produzido noutra aplicacao, M para documento proveniente de recuperacao ou de emissao manual </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="P" />
      <xs:enumeration value="I" />
      <xs:enumeration value="M" />
    </xs:restriction>
  </xs:simpleType>
  <!-- Origem do documento -->
  <xs:simpleType name="SAFTPTSourcePayment">
    <xs:annotation>
      <xs:documentation>P para documento produzido na aplicacao, I para documento integrado e produzido noutra aplicacao, M para documento proveniente de recuperacao ou de emissao manual </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="P" />
      <xs:enumeration value="I" />
      <xs:enumeration value="M" />
    </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="SAFPTtextTypeMandatoryMax35Car">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:maxLength value="35" />
    </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>
  <!-- Codigo do pais (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>