Exportar consulta de access a XML con formato de factura electrónica
He hecho un programa de facturación sencillo, pero necesitaría pasar una factura a xml en formato factura electrónica, no sé ni por donde empezar tengo la consulta y el informe de esa consulta pero estoy muy pez, la estructura del xml la conozco y no parece complicado pero no sé como poner los campos entre las tags ni nada. A ver si me pueden iluminar.
En la comunidad Access Users Group España, en la reunión de hace dos meses se trató precisamente ese tema. Te pongo el enlace a la entrada, donde podrás ver el video con la explicación (es un poco largo, pero merece la pena verlo entero) y bajarte los archivos que se usaron:
http://accessusergroups.org/espana/ya-podemos-ver-como-crear-xml-con-el-asistente-de-access-y-combinarlo-con-xlst/
Buenas de nuevo ya implementé la creación del xml pero el formato que pasásteis no me sale como válido como factura electrónica oficial, bueno me descargué un ejemplo de oficial y lo implementé
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<fe:Facturae xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:fe="http://www.facturae.es/Facturae/2009/v3.2/Facturae">
<FileHeader>
<SchemaVersion>3.2</SchemaVersion>
<Modality>I</Modality>
<InvoiceIssuerType>EM</InvoiceIssuerType>
<Batch>
<BatchIdentifier>0</BatchIdentifier>
<InvoicesCount>1</InvoicesCount>
<TotalInvoicesAmount>
<TotalAmount><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></TotalAmount>
</TotalInvoicesAmount>
<TotalOutstandingAmount>
<TotalAmount><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></TotalAmount>
</TotalOutstandingAmount>
<TotalExecutableAmount>
<TotalAmount><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></TotalAmount>
</TotalExecutableAmount>
<InvoiceCurrencyCode>EUR</InvoiceCurrencyCode>
</Batch>
</FileHeader>
<Parties>
<SellerParty>
<TaxIdentification>
<PersonTypeCode>J</PersonTypeCode>
<ResidenceTypeCode>R</ResidenceTypeCode>
<TaxIdentificationNumber>B57791147</TaxIdentificationNumber>
</TaxIdentification>
<LegalEntity>
<CorporateName>Hermanos Martin Trenas S.L.U</CorporateName>
<AddressInSpain>
<Address>Travessa de Sans i Mallorca 2</Address>
<PostCode>07400</PostCode>
<Town>Pto Alcudia</Town>
<Province>Baleares</Province>
<CountryCode>ESP</CountryCode>
</AddressInSpain>
</LegalEntity>
</SellerParty>
<BuyerParty>
<TaxIdentification>
<PersonTypeCode>J</PersonTypeCode>
<ResidenceTypeCode>R</ResidenceTypeCode>
<TaxIdentificationNumber><xsl:value-of select="dataroot/exportarxml/NIF"/></TaxIdentificationNumber>
</TaxIdentification>
<LegalEntity>
<CorporationName><xsl:value-of select="dataroot/exportarxml/Nombre"/><xsl:value-of select="dataroot/exportarxml/Apellidos"/></CorporationName>
<AddressInSpain>
<xsl:choose>
<xsl:when test="not(normalize-space(dataroot/exportarxml/Dir)='')">
<Address><xsl:value-of select="dataroot/exportarxml/Dirección"/></Address>
<PostCode><xsl:value-of select="dataroot/exportarxml/Código_x0020_Postal"/></PostCode>
<Town><xsl:value-of select="dataroot/exportarxml/Ciudad"/></Town>
<Province>Baleares</Province>
<CountryCode>ESP</CountryCode>
</xsl:when>
</xsl:choose>
</AddressInSpain>
</LegalEntity>
</BuyerParty>
</Parties>
<Invoices>
<Invoice>
<InvoiceHeader>
<InvoiceNumber><xsl:value-of select="dataroot/exportarxml/Factura_Numero"/></InvoiceNumber>
<InvoiceDocumentType>FC</InvoiceDocumentType>
<InvoiceSeriesCode>A</InvoiceSeriesCode>
</InvoiceHeader>
<InvoiceIssueData>
<IssueDate><xsl:value-of select="dataroot/exportarxml/Fecha"/></IssueDate>
<InvoiceCurrencyCode>EUR</InvoiceCurrencyCode>
<TaxCurrencyCode>EUR</TaxCurrencyCode>
<LanguageName>ESP</LanguageName>
</InvoiceIssueData>
<xsl:for-each select="dataroot/exportarxml">
<TaxesOutputs>
<Tax>
<TaxTypeCode><xsl:value-of select="dataroot/exportarxml/IDIVA"/></TaxTypeCode>
<TaxRate><xsl:value-of select="IVA_Aplicado*100"/></TaxRate>
<TaxableBase>
<TotalAmount><xsl:value-of select="Precio_x0020_Total"/></TotalAmount>
</TaxableBase>
<TaxAmount>
<TotalAmount><xsl:value-of select="IVA_Total"/></TotalAmount>
</TaxAmount>
</Tax>
</TaxesOutputs>
</xsl:for-each>
<InvoiceTotals>
<TotalGrossAmount><xsl:value-of select="sum(//Precio_x0020_Total)"/></TotalGrossAmount>
<TotalGrossAmountBeforeTaxes><xsl:value-of select="sum(//Precio_x0020_Total)"/></TotalGrossAmountBeforeTaxes>
<TotalTaxOutputs><xsl:value-of select="sum(//IVA_Total)"</TotalTaxOutputs>
<TotalTaxesWithheld>0.00</TotalTaxesWithheld>
<InvoiceTotal><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></InvoiceTotal>
<TotalOutstandingAmount><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></TotalOutstandingAmount>
<TotalExecutableAmount><xsl:value-of select="dataroot/exportarxml/Factura_x0020_total"/></TotalExecutableAmount>
</InvoiceTotals>
<xsl:for-each select="dataroot/exportarxml">
<Items>
<InvoiceLine>
<IssuerContractReference>AA11</IssuerContractReference>
<IssuerTransactionReference>AA1</IssuerTransactionReference>
<ItemDescription><xsl:value-of select="Descripción"/></ItemDescription>
<Quantity><xsl:value-of select="Unidades"/></Quantity>
<UnitOfMeasure>01</UnitOfMeasure>
<UnitPriceWithoutTax><xsl:value-of select="Precio"/></UnitPriceWithoutTax>
<TotalCost><xsl:value-of select="Precio_x0020_Total"/></TotalCost>
<GrossAmount><xsl:value-of select="Precio_x0020_Total"/></GrossAmount>
<TaxesOutputs>
<Tax>
<TaxTypeCode><xsl:value-of select="IDIVA"/></TaxTypeCode>
<TaxRate><xsl:value-of select="IVA_Aplicado*100"/></TaxRate>
<TaxableBase>
<TotalAmount><xsl:value-of select="Precio_x0020_Total"/></TotalAmount>
</TaxableBase>
<TaxAmount>
<TotalAmount><xsl:value-of select="IVA_Total"/></TotalAmount>
</TaxAmount>
</Tax>
</TaxesOutputs>
<TransactionDate><xsl:value-of select="Fecha"/></TransactionDate>
</InvoiceLine>
</Items>
</xsl:for-each>
</Invoice>
</Invoices>
<AdditionalData>
<InvoiceAdditionalInformation>Facturae generada con access y XSLT</InvoiceAdditionalInformation>
</AdditionalData>
</fe:Facturae>
</xsl:template>
</xsl:stylesheet>
Bueno a la hora de exportar el XML con formato me lanza un error pero no doy con él, me pone "falta un espacio necesario en blanco" lo repaso pero no doy con él me puedes ayudar? gracias.
- Compartir respuesta
tengo un sistema de ventas en access y requiero implementar facturación electrónica... me puede ayudar dejo mi correo para que me escribas.. [email protected] - Emerson Andres Bermeo S.
Tengo un sistema de ventas en access y requiero implementar facturación electrónica... me peudes escribir al correo [email protected] - Emerson Andres Bermeo S.