<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
         xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    <ext:UBLExtensions><ext:UBLExtension><ext:ExtensionContent/></ext:UBLExtension></ext:UBLExtensions>
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:CustomizationID>2.0</cbc:CustomizationID>
    <cbc:ID>F001-99001</cbc:ID>
    <cbc:IssueDate>2026-03-11</cbc:IssueDate>
    <cbc:InvoiceTypeCode listID="0101">01</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>PEN</cbc:DocumentCurrencyCode>

    <!-- Proveedor conocido -->
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyIdentification><cbc:ID schemeID="6">20123456789</cbc:ID></cac:PartyIdentification>
            <cac:PartyLegalEntity><cbc:RegistrationName>Proveedor QA XML</cbc:RegistrationName></cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PartyIdentification><cbc:ID schemeID="6">20000000001</cbc:ID></cac:PartyIdentification>
            <cac:PartyLegalEntity><cbc:RegistrationName>MI EMPRESA</cbc:RegistrationName></cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingCustomerParty>

    <!-- TOTAL INCORRECTO A PROPÓSITO: suma líneas = 25.00 + 0.00 + 37.50 = 62.50, pero ponemos 100.00 -->
    <cac:LegalMonetaryTotal>
        <cbc:PayableAmount currencyID="PEN">100.00</cbc:PayableAmount>
        <cbc:TaxInclusiveAmount currencyID="PEN">100.00</cbc:TaxInclusiveAmount>
    </cac:LegalMonetaryTotal>

    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="PEN">15.25</cbc:TaxAmount>
    </cac:TaxTotal>

    <!-- LÍNEA 1: Producto EXISTENTE (IBUPROFENO 800mg), cantidad normal -->
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="NIU">5</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="PEN">25.00</cbc:LineExtensionAmount>
        <cac:PricingReference>
            <cac:AlternativeConditionPrice>
                <cbc:PriceAmount currencyID="PEN">5.90</cbc:PriceAmount>
                <cbc:PriceTypeCode>01</cbc:PriceTypeCode>
            </cac:AlternativeConditionPrice>
        </cac:PricingReference>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="PEN">3.81</cbc:TaxAmount>
            <cac:TaxSubtotal>
                <cbc:TaxableAmount currencyID="PEN">21.19</cbc:TaxableAmount>
                <cbc:TaxAmount currencyID="PEN">3.81</cbc:TaxAmount>
                <cac:TaxCategory>
                    <cbc:Percent>18</cbc:Percent>
                    <cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode>
                    <cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme>
                </cac:TaxCategory>
            </cac:TaxSubtotal>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Description>IBUPROFENO Tableta Recubierta 800 mg</cbc:Description>
            <cac:SellersItemIdentification><cbc:ID>PROV-IBU800</cbc:ID></cac:SellersItemIdentification>
        </cac:Item>
        <cac:Price><cbc:PriceAmount currencyID="PEN">5.00</cbc:PriceAmount></cac:Price>
    </cac:InvoiceLine>

    <!-- LÍNEA 2: Producto INEXISTENTE + precio CERO -->
    <cac:InvoiceLine>
        <cbc:ID>2</cbc:ID>
        <cbc:InvoicedQuantity unitCode="NIU">10</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="PEN">0.00</cbc:LineExtensionAmount>
        <cac:PricingReference>
            <cac:AlternativeConditionPrice>
                <cbc:PriceAmount currencyID="PEN">0.00</cbc:PriceAmount>
                <cbc:PriceTypeCode>01</cbc:PriceTypeCode>
            </cac:AlternativeConditionPrice>
        </cac:PricingReference>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount>
            <cac:TaxSubtotal>
                <cbc:TaxableAmount currencyID="PEN">0.00</cbc:TaxableAmount>
                <cbc:TaxAmount currencyID="PEN">0.00</cbc:TaxAmount>
                <cac:TaxCategory>
                    <cbc:Percent>18</cbc:Percent>
                    <cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode>
                    <cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme>
                </cac:TaxCategory>
            </cac:TaxSubtotal>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Description>MEDICAMENTO FANTASMA QUE NO EXISTE EN BD</cbc:Description>
            <cac:SellersItemIdentification><cbc:ID>XYZFAKE999</cbc:ID></cac:SellersItemIdentification>
        </cac:Item>
        <cac:Price><cbc:PriceAmount currencyID="PEN">0.00</cbc:PriceAmount></cac:Price>
    </cac:InvoiceLine>

    <!-- LÍNEA 3: Producto INEXISTENTE + cantidad DECIMAL -->
    <cac:InvoiceLine>
        <cbc:ID>3</cbc:ID>
        <cbc:InvoicedQuantity unitCode="NIU">2.5</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="PEN">37.50</cbc:LineExtensionAmount>
        <cac:PricingReference>
            <cac:AlternativeConditionPrice>
                <cbc:PriceAmount currencyID="PEN">17.70</cbc:PriceAmount>
                <cbc:PriceTypeCode>01</cbc:PriceTypeCode>
            </cac:AlternativeConditionPrice>
        </cac:PricingReference>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="PEN">5.72</cbc:TaxAmount>
            <cac:TaxSubtotal>
                <cbc:TaxableAmount currencyID="PEN">31.78</cbc:TaxableAmount>
                <cbc:TaxAmount currencyID="PEN">5.72</cbc:TaxAmount>
                <cac:TaxCategory>
                    <cbc:Percent>18</cbc:Percent>
                    <cbc:TaxExemptionReasonCode>10</cbc:TaxExemptionReasonCode>
                    <cac:TaxScheme><cbc:ID>1000</cbc:ID><cbc:Name>IGV</cbc:Name><cbc:TaxTypeCode>VAT</cbc:TaxTypeCode></cac:TaxScheme>
                </cac:TaxCategory>
            </cac:TaxSubtotal>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Description>CREMA DERMATOLOGICA PREMIUM ULTRA RARA</cbc:Description>
            <cac:SellersItemIdentification><cbc:ID>NOEXISTE777</cbc:ID></cac:SellersItemIdentification>
        </cac:Item>
        <cac:Price><cbc:PriceAmount currencyID="PEN">15.00</cbc:PriceAmount></cac:Price>
    </cac:InvoiceLine>
</Invoice>
