src/Invoice/FlattenerInvoiceLines.php
protected function copyVatInfoToParent(array $parent, array $children)
    {
        $parent[Meta::VatAmount] = 0;
        // Copy vat rate info from a child when the parent has no vat rate info.
        if (empty($parent[Tag::VatRate]) || Number::isZero($parent[Tag::VatRate])) {
            $parent[Tag::VatRate] = CompletorInvoiceLines::getMaxAppearingVatRate($children, $index);
            $parent[Meta::VatRateSource] = Completor::VatRateSource_Copied_From_Children;
            if (isset($children[$index][Meta::VatRateMin])) {
                $parent[Meta::VatRateMin] = $children[$index][Meta::VatRateMin];
            } else {
                unset($parent[Meta::VatRateMin]);
            }
            if (isset($children[$index][Meta::VatRateMax])) {
                $parent[Meta::VatRateMax] = $children[$index][Meta::VatRateMax];
            } else {
                unset($parent[Meta::VatRateMax]);
            }
        }
        $parent[Meta::LineVatAmount] = 0;
        unset($parent[Meta::LineDiscountVatAmount]);

        return $parent;
    }
protected function copyVatInfoToParent(array $parent, array $children)
    {
        $parent[Meta::VatAmount] = 0;
        // Copy vat rate info from a child when the parent has no vat rate info.
        if (empty($parent[Tag::VatRate]) || Number::isZero($parent[Tag::VatRate])) {
            $parent[Tag::VatRate] = CompletorInvoiceLines::getMaxAppearingVatRate($children, $index);
            $parent[Meta::VatRateSource] = Completor::VatRateSource_Copied_From_Children;
            if (isset($children[$index][Meta::VatRateMin])) {
                $parent[Meta::VatRateMin] = $children[$index][Meta::VatRateMin];
            } else {
                unset($parent[Meta::VatRateMin]);
            }
            if (isset($children[$index][Meta::VatRateMax])) {
                $parent[Meta::VatRateMax] = $children[$index][Meta::VatRateMax];
            } else {
                unset($parent[Meta::VatRateMax]);
            }
        }
        $parent[Meta::LineVatAmount] = 0;
        unset($parent[Meta::LineDiscountVatAmount]);

        return $parent;
    }
protected function copyVatInfoToParent ( array $ parent , array $ children ) { $ parent [ Meta :: VatAmount ] = 0 ; // Copy vat rate info from a child when the parent has no vat rate info. if ( empty ( $ parent [ Tag :: VatRate ] ) || Number :: isZero ( $ parent [ Tag :: VatRate ] ) ) { $ parent [ Tag :: VatRate ] = CompletorInvoiceLines :: getMaxAppearingVatRate ( $ children , $ index ) ; $ parent [ Meta :: VatRateSource ] = Completor :: VatRateSource_Copied_From_Children ; if ( isset ( $ children [ $ index ] [ Meta :: VatRateMin ] ) ) { $ parent [ Meta :: VatRateMin ] = $ children [ $ index ] [ Meta :: VatRateMin ] ; } else { unset ( $ parent [ Meta :: VatRateMin ] ) ; } if ( isset ( $ children [ $ index ] [ Meta :: VatRateMax ] ) ) { $ parent [ Meta :: VatRateMax ] = $ children [ $ index ] [ Meta :: VatRateMax ] ; } else { unset ( $ parent [ Meta :: VatRateMax ] ) ; } } $ parent [ Meta :: LineVatAmount ] = 0 ; unset ( $ parent [ Meta :: LineDiscountVatAmount ] ) ; return $ parent ; }
Copies vat info to the parent.

This prevents that amounts appear twice on the invoice.

@param array $parent
The parent invoice line.
@param array[] $children
The child invoice lines.

@return array
The parent invoice line with price info removed.
Copies vat info to the parent .