181 lines
7.5 KiB
XML
181 lines
7.5 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<rsm:CrossIndustryInvoice
|
|
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
|
|
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
|
|
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
|
|
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
|
|
<!-- 1. CONTEXTE -->
|
|
<rsm:ExchangedDocumentContext>
|
|
<ram:GuidelineSpecifiedDocumentContextParameter>
|
|
<ram:ID>urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic</ram:ID>
|
|
</ram:GuidelineSpecifiedDocumentContextParameter>
|
|
</rsm:ExchangedDocumentContext>
|
|
|
|
<!-- 2. EN-TÊTE FACTURE -->
|
|
<rsm:ExchangedDocument>
|
|
<ram:ID>{{ invoice.number }}</ram:ID>
|
|
<ram:TypeCode>{{ invoice.type_code }}</ram:TypeCode>
|
|
<ram:IssueDateTime>
|
|
<udt:DateTimeString format="102">{{ invoice.issue_date | datefmt }}</udt:DateTimeString>
|
|
</ram:IssueDateTime>
|
|
{% if invoice.note %}
|
|
<ram:IncludedNote>
|
|
<ram:Content>{{ invoice.note }}</ram:Content>
|
|
</ram:IncludedNote>
|
|
{% endif %}
|
|
</rsm:ExchangedDocument>
|
|
|
|
<!-- 3. TRANSACTION COMMERCIALE -->
|
|
<rsm:SupplyChainTradeTransaction>
|
|
|
|
<!-- 3a. Lignes de facture -->
|
|
{% for line in invoice.lines %}
|
|
<ram:IncludedSupplyChainTradeLineItem>
|
|
<ram:AssociatedDocumentLineDocument>
|
|
<ram:LineID>{{ line.line_id }}</ram:LineID>
|
|
</ram:AssociatedDocumentLineDocument>
|
|
<ram:SpecifiedTradeProduct>
|
|
<ram:Name>{{ line.description }}</ram:Name>
|
|
</ram:SpecifiedTradeProduct>
|
|
<ram:SpecifiedLineTradeAgreement>
|
|
<ram:NetPriceProductTradePrice>
|
|
<ram:ChargeAmount>{{ line.unit_price | amount }}</ram:ChargeAmount>
|
|
</ram:NetPriceProductTradePrice>
|
|
</ram:SpecifiedLineTradeAgreement>
|
|
<ram:SpecifiedLineTradeDelivery>
|
|
<ram:BilledQuantity unitCode="{{ line.unit_code }}">{{ line.quantity | amount }}</ram:BilledQuantity>
|
|
</ram:SpecifiedLineTradeDelivery>
|
|
<ram:SpecifiedLineTradeSettlement>
|
|
<ram:ApplicableTradeTax>
|
|
<ram:TypeCode>VAT</ram:TypeCode>
|
|
<ram:CategoryCode>{{ line.vat_category }}</ram:CategoryCode>
|
|
<ram:RateApplicablePercent>{{ line.vat_rate | amount }}</ram:RateApplicablePercent>
|
|
</ram:ApplicableTradeTax>
|
|
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
|
<ram:LineTotalAmount>{{ (line.quantity * line.unit_price) | amount }}</ram:LineTotalAmount>
|
|
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
|
</ram:SpecifiedLineTradeSettlement>
|
|
</ram:IncludedSupplyChainTradeLineItem>
|
|
{% endfor %}
|
|
|
|
<!-- 3b. Accord commercial -->
|
|
<ram:ApplicableHeaderTradeAgreement>
|
|
|
|
<ram:SellerTradeParty>
|
|
<ram:Name>{{ seller.name }}</ram:Name>
|
|
{% if seller.siret %}
|
|
<ram:SpecifiedLegalOrganization>
|
|
<ram:ID schemeID="0002">{{ seller.siret }}</ram:ID>
|
|
</ram:SpecifiedLegalOrganization>
|
|
{% endif %}
|
|
{% if seller.address %}
|
|
<ram:PostalTradeAddress>
|
|
<ram:PostcodeCode>{{ seller.address.postcode }}</ram:PostcodeCode>
|
|
<ram:LineOne>{{ seller.address.line1 }}</ram:LineOne>
|
|
{% if seller.address.line2 %}
|
|
<ram:LineTwo>{{ seller.address.line2 }}</ram:LineTwo>
|
|
{% endif %}
|
|
<ram:CityName>{{ seller.address.city }}</ram:CityName>
|
|
<ram:CountryID>{{ seller.address.country_code }}</ram:CountryID>
|
|
</ram:PostalTradeAddress>
|
|
{% endif %}
|
|
{% if seller.vat_id %}
|
|
<ram:SpecifiedTaxRegistration>
|
|
<ram:ID schemeID="VA">{{ seller.vat_id }}</ram:ID>
|
|
</ram:SpecifiedTaxRegistration>
|
|
{% endif %}
|
|
</ram:SellerTradeParty>
|
|
|
|
<ram:BuyerTradeParty>
|
|
<ram:Name>{{ buyer.name }}</ram:Name>
|
|
{% if buyer.siret %}
|
|
<ram:SpecifiedLegalOrganization>
|
|
<ram:ID schemeID="0002">{{ buyer.siret }}</ram:ID>
|
|
</ram:SpecifiedLegalOrganization>
|
|
{% endif %}
|
|
{% if buyer.address %}
|
|
<ram:PostalTradeAddress>
|
|
<ram:PostcodeCode>{{ buyer.address.postcode }}</ram:PostcodeCode>
|
|
<ram:LineOne>{{ buyer.address.line1 }}</ram:LineOne>
|
|
{% if buyer.address.line2 %}
|
|
<ram:LineTwo>{{ buyer.address.line2 }}</ram:LineTwo>
|
|
{% endif %}
|
|
<ram:CityName>{{ buyer.address.city }}</ram:CityName>
|
|
<ram:CountryID>{{ buyer.address.country_code }}</ram:CountryID>
|
|
</ram:PostalTradeAddress>
|
|
{% endif %}
|
|
</ram:BuyerTradeParty>
|
|
|
|
{% if invoice.payment_reference %}
|
|
<ram:BuyerOrderReferencedDocument>
|
|
<ram:IssuerAssignedID>{{ invoice.payment_reference }}</ram:IssuerAssignedID>
|
|
</ram:BuyerOrderReferencedDocument>
|
|
{% endif %}
|
|
|
|
</ram:ApplicableHeaderTradeAgreement>
|
|
|
|
<!-- 3c. Livraison -->
|
|
<ram:ApplicableHeaderTradeDelivery>
|
|
<ram:ShipToTradeParty>
|
|
<ram:Name>{{ buyer.name }}</ram:Name>
|
|
</ram:ShipToTradeParty>
|
|
</ram:ApplicableHeaderTradeDelivery>
|
|
|
|
<!-- 3d. Règlement -->
|
|
<ram:ApplicableHeaderTradeSettlement>
|
|
<ram:InvoiceCurrencyCode>{{ invoice.currency }}</ram:InvoiceCurrencyCode>
|
|
|
|
<ram:SpecifiedTradeSettlementPaymentMeans>
|
|
<ram:TypeCode>{{ invoice.payment_means_code }}</ram:TypeCode>
|
|
{% if invoice.iban %}
|
|
<ram:PayeePartyCreditorFinancialAccount>
|
|
<ram:IBANID>{{ invoice.iban }}</ram:IBANID>
|
|
</ram:PayeePartyCreditorFinancialAccount>
|
|
{% endif %}
|
|
</ram:SpecifiedTradeSettlementPaymentMeans>
|
|
|
|
{% for tax in invoice.tax_lines %}
|
|
<ram:ApplicableTradeTax>
|
|
<ram:CalculatedAmount>{{ tax.amount | amount }}</ram:CalculatedAmount>
|
|
<ram:TypeCode>VAT</ram:TypeCode>
|
|
{% if tax.exemption_reason %}
|
|
<ram:ExemptionReason>{{ tax.exemption_reason }}</ram:ExemptionReason>
|
|
{% endif %}
|
|
<ram:BasisAmount>{{ tax.base_amount | amount }}</ram:BasisAmount>
|
|
<ram:CategoryCode>{{ tax.category }}</ram:CategoryCode>
|
|
<ram:RateApplicablePercent>{{ tax.rate | amount }}</ram:RateApplicablePercent>
|
|
</ram:ApplicableTradeTax>
|
|
|
|
|
|
<ram:ApplicableTradeTax>
|
|
<ram:CalculatedAmount>{{ tax.amount | amount }}</ram:CalculatedAmount>
|
|
<ram:TypeCode>VAT</ram:TypeCode>
|
|
<ram:BasisAmount>{{ tax.base_amount | amount }}</ram:BasisAmount>
|
|
<ram:CategoryCode>{{ tax.category }}</ram:CategoryCode>
|
|
<ram:RateApplicablePercent>{{ tax.rate | amount }}</ram:RateApplicablePercent>
|
|
</ram:ApplicableTradeTax>
|
|
{% endfor %}
|
|
|
|
{% if invoice.due_date %}
|
|
<ram:SpecifiedTradePaymentTerms>
|
|
<ram:DueDateDateTime>
|
|
<udt:DateTimeString format="102">{{ invoice.due_date | datefmt }}</udt:DateTimeString>
|
|
</ram:DueDateDateTime>
|
|
</ram:SpecifiedTradePaymentTerms>
|
|
{% endif %}
|
|
|
|
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
|
<ram:LineTotalAmount>{{ invoice.total_ht | amount }}</ram:LineTotalAmount>
|
|
<ram:TaxBasisTotalAmount>{{ invoice.total_ht | amount }}</ram:TaxBasisTotalAmount>
|
|
<ram:TaxTotalAmount currencyID="{{ invoice.currency }}">{{ invoice.total_tva | amount }}</ram:TaxTotalAmount>
|
|
<ram:GrandTotalAmount>{{ invoice.total_ttc | amount }}</ram:GrandTotalAmount>
|
|
<ram:DuePayableAmount>{{ invoice.total_ttc | amount }}</ram:DuePayableAmount>
|
|
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
|
|
|
</ram:ApplicableHeaderTradeSettlement>
|
|
|
|
</rsm:SupplyChainTradeTransaction>
|
|
</rsm:CrossIndustryInvoice>
|