Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the getTotals function is not considering the quantity of the InvoiceLine #67

Open
nunopeixoto opened this issue Nov 25, 2024 · 0 comments

Comments

@nunopeixoto
Copy link

Hi,
It seems like quantity is being considered from totals. Given an invoice with one line only (quantity 10, price 81.30). With VAT of 23% the total should be 999,99 (81.30 * 10 * 1.23), but getTotals() is returning the value of a single item. Please see the XML and getTotals result below.

getTotals result
object(Einvoicing\Models\InvoiceTotals)#195 (13) {
  ["currency"]=>
  string(3) "EUR"
  ["vatCurrency"]=>
  string(3) "EUR"
  ["netAmount"]=>
  float(81.3)
  ["allowancesAmount"]=>
  float(0)
  ["chargesAmount"]=>
  float(0)
  ["vatAmount"]=>
  float(18.699)
  ["taxExclusiveAmount"]=>
  float(81.3)
  ["taxInclusiveAmount"]=>
  float(99.999)
  ["paidAmount"]=>
  float(0)
  ["roundingAmount"]=>
  float(0)
  ["customVatAmount"]=>
  NULL
  ["payableAmount"]=>
  float(99.999)
  ["vatBreakdown"]=>
  array(1) {
    [0]=>
    object(Einvoicing\Models\VatBreakdown)#194 (6) {
      ["category"]=>
      string(1) "S"
      ["rate"]=>
      float(23)
      ["exemptionReasonCode"]=>
      NULL
      ["exemptionReason"]=>
      NULL
      ["taxableAmount"]=>
      float(81.3)
      ["taxAmount"]=>
      float(18.699)
    }
  }
}
XML File
<?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">
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:ID>FT 2023/23</cbc:ID>
    <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
    <cbc:IssueDate>2024-11-25</cbc:IssueDate>
    <cbc:DueDate>2024-11-25</cbc:DueDate>
    <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
    <cbc:Note>Teste 2</cbc:Note>
    <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>EUR</cbc:TaxCurrencyCode>
    <cac:InvoicePeriod>
        <cbc:StartDate>2024-11-25</cbc:StartDate>
        <cbc:EndDate>2024-11-30</cbc:EndDate>
    </cac:InvoicePeriod>
    <cac:OrderReference>
        <cbc:ID>---</cbc:ID>
    </cac:OrderReference>
    <cac:OriginatorDocumentReference>
        <cbc:ID>---</cbc:ID>
    </cac:OriginatorDocumentReference>
    <cac:ContractDocumentReference>
        <cbc:ID>---</cbc:ID>
    </cac:ContractDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>2023/23</cbc:ID>
        <cbc:DocumentTypeCode>130</cbc:DocumentTypeCode>
        <cbc:DocumentDescription>REPRESENTATION</cbc:DocumentDescription>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject filename="filename.pdf"
                mimeCode="application/pdf">...</cbc:EmbeddedDocumentBinaryObject>
            <cac:ExternalReference>
                <cbc:URI>http://example.com</cbc:URI>
            </cac:ExternalReference>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cbc:EndpointID schemeID="EMAIL">[email protected]</cbc:EndpointID>
            <cac:PartyIdentification>
                <cbc:ID>PT500000000</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>Publi - Soluções de publicidade, Lda</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Rua Barão de Sabrosa, 217 - Sala 3</cbc:StreetName>
                <cbc:CityName>Lisboa</cbc:CityName>
                <cbc:PostalZone>1234-123</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>PT</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>PT500000000</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Publi - Soluções de publicidade, Lda</cbc:RegistrationName>
                <cbc:CompanyID>500000000</cbc:CompanyID>
            </cac:PartyLegalEntity>
            <cac:Contact>
                <cbc:Name>Publi - Soluções de publicidade, Lda</cbc:Name>
                <cbc:Telephone>123123123 912345674</cbc:Telephone>
                <cbc:ElectronicMail>[email protected]</cbc:ElectronicMail>
            </cac:Contact>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cbc:EndpointID schemeID="EMAIL">[email protected]</cbc:EndpointID>
            <cac:PartyIdentification>
                <cbc:ID>PT599999977</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>GF - Teste 3</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Braga</cbc:StreetName>
                <cbc:CityName>Braga</cbc:CityName>
                <cbc:PostalZone>4700-000</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>PT</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>PT500000000</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>GF - Teste 3</cbc:RegistrationName>
                <cbc:CompanyID>599999977</cbc:CompanyID>
            </cac:PartyLegalEntity>
            <cac:Contact>
                <cbc:Name>GF - Teste 3</cbc:Name>
                <cbc:ElectronicMail>[email protected]</cbc:ElectronicMail>
            </cac:Contact>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <cac:Delivery>
        <cac:DeliveryLocation>
            <cac:Address>
                <cbc:StreetName>---</cbc:StreetName>
                <cbc:CityName>---</cbc:CityName>
                <cbc:PostalZone>---</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>PT</cbc:IdentificationCode>
                </cac:Country>
            </cac:Address>
        </cac:DeliveryLocation>
        <cac:DeliveryParty>
            <cac:PartyName>
                <cbc:Name>---</cbc:Name>
            </cac:PartyName>
        </cac:DeliveryParty>
    </cac:Delivery>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="EUR">186.99</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="EUR">813.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="EUR">186.99</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>23.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="EUR">813.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="EUR">813.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="EUR">999.99</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="EUR">0.00</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="EUR">0.00</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="EUR">999.99</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>31803283</cbc:ID>
        <cbc:InvoicedQuantity unitCode="C62">10.000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="EUR">813.00000000</cbc:LineExtensionAmount>
        <cac:Item>
            <cbc:Description>teste 2 - Relatorio - Hoje</cbc:Description>
            <cbc:Description>teste 2</cbc:Description>
            <cbc:Name>00031</cbc:Name>
            <cac:SellersItemIdentification>
                <cbc:ID>---</cbc:ID>
            </cac:SellersItemIdentification>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>23.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="EUR">81.30000000</cbc:PriceAmount>
            <cbc:BaseQuantity>10.000</cbc:BaseQuantity>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

Sorry if I am missing anything obvious.

Thank you for the collaboration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant