twinfield icon indicating copy to clipboard operation
twinfield copied to clipboard

InvoiceTotals only contains the totals of the first invoiceline when adding a SalesInvoice

Open J87NL opened this issue 3 years ago • 0 comments

When adding a new invoice using $invoiceApiConnector->send() the InvoiceTotals in the returned data only seems to contain the totals of the first InvoiceLine in stead of the total of the invoice:

    [totals:PhpTwinfield\Invoice:private] => PhpTwinfield\InvoiceTotals Object
        (
            [valueExcl:PhpTwinfield\InvoiceTotals:private] => 19.80
            [valueInc:PhpTwinfield\InvoiceTotals:private] => 21.58
        )
        ...
    [lines:PhpTwinfield\Invoice:private] => Array
        (
            [1] => PhpTwinfield\InvoiceLine Object
                (
                    [ID:PhpTwinfield\InvoiceLine:private] => 1
                    [quantity:PhpTwinfield\InvoiceLine:private] => 1
                ...
                    [unitsPriceExcl:PhpTwinfield\InvoiceLine:private] => 19.80
                    [unitsPriceInc:PhpTwinfield\InvoiceLine:private] => 
                    [units:PhpTwinfield\InvoiceLine:private] => 1
                    [allowDiscountOrPremium:PhpTwinfield\InvoiceLine:private] => true
                    [valueExcl:PhpTwinfield\InvoiceLine:private] => 19.80
                    [vatValue:PhpTwinfield\InvoiceLine:private] => 1.78
                    [valueInc:PhpTwinfield\InvoiceLine:private] => 21.58
                ...
                )

            [2] => PhpTwinfield\InvoiceLine Object
                (
                ...
                    [unitsPriceExcl:PhpTwinfield\InvoiceLine:private] => 20.87
                    [unitsPriceInc:PhpTwinfield\InvoiceLine:private] => 
                    [units:PhpTwinfield\InvoiceLine:private] => 1
                    [allowDiscountOrPremium:PhpTwinfield\InvoiceLine:private] => true
                    [valueExcl:PhpTwinfield\InvoiceLine:private] => 20.87
                    [vatValue:PhpTwinfield\InvoiceLine:private] => 4.38
                    [valueInc:PhpTwinfield\InvoiceLine:private] => 25.25
                ...
                )

J87NL avatar Dec 11 '20 15:12 J87NL