src/Invoice/Completor.php
protected function initPossibleVatTypes()
    {
        $possibleVatTypes = array();
        $shopSettings = $this->config->getShopSettings();
        $nature = $shopSettings['nature_shop'];
        $margin = $shopSettings['marginProducts'];
        $foreignVat = $shopSettings['foreignVat'];

        if (!empty($this->invoice[Tag::Customer][Tag::Invoice][Tag::VatType])) {
            // If shop specific code or an event handler has already set the vat
            // type, we obey so.
            $possibleVatTypes[] = $this->invoice[Tag::Customer][Tag::Invoice][Tag::VatType];
        } else {
            if ($this->isNl()) {
                $possibleVatTypes[] = Api::VatType_National;
                // Can it be national reversed VAT: not really supported but
                // possible.
                if ($this->isCompany()) {
                    $possibleVatTypes[] = Api::VatType_NationalReversed;
                }
            } elseif ($this->isEu()) {
                // Can it be normal vat?
                if ($foreignVat !== PluginConfig::ForeignVat_Only) {
                    $possibleVatTypes[] = Api::VatType_National;
                }
                // Can it be foreign vat?
                if ($foreignVat !== PluginConfig::ForeignVat_No) {
                    $possibleVatTypes[] = Api::VatType_ForeignVat;
                }
                // Can it be EU reversed VAT.
                if ($this->isCompany()) {
                    $possibleVatTypes[] = Api::VatType_EuReversed;
                }
            } elseif ($this->isOutsideEu()) {
                // Can it be national vat (possibly vat free)? Services should
                // use vattype = 1.
                if ($nature !== PluginConfig::Nature_Products) {
                    $possibleVatTypes[] = Api::VatType_National;
                }
                // Can it be rest of world (0%)? Goods should use vat type = 4
                // unless you can't or don't want to prove that the goods will
                // leave the EU (see
                // https://www.belastingdienst.nl/rekenhulpen/leveren_van_goederen_naar_het_buitenland/),
                // in which case we should use vat type = 1.
                if ($nature !== PluginConfig::Nature_Services) {
                    $possibleVatTypes[] = Api::VatType_National;
                    $possibleVatTypes[] = Api::VatType_RestOfWorld;
                }
            }

            // Can it be a margin invoice?
            if ($margin !== PluginConfig::MarginProducts_No) {
                $possibleVatTypes[] = Api::VatType_MarginScheme;
            }
        }
        $this->possibleVatTypes = array_unique($possibleVatTypes, SORT_NUMERIC);
    }
protected function initPossibleVatTypes()
    {
        $possibleVatTypes = array();
        $shopSettings = $this->config->getShopSettings();
        $nature = $shopSettings['nature_shop'];
        $margin = $shopSettings['marginProducts'];
        $foreignVat = $shopSettings['foreignVat'];

        if (!empty($this->invoice[Tag::Customer][Tag::Invoice][Tag::VatType])) {
            // If shop specific code or an event handler has already set the vat
            // type, we obey so.
            $possibleVatTypes[] = $this->invoice[Tag::Customer][Tag::Invoice][Tag::VatType];
        } else {
            if ($this->isNl()) {
                $possibleVatTypes[] = Api::VatType_National;
                // Can it be national reversed VAT: not really supported but
                // possible.
                if ($this->isCompany()) {
                    $possibleVatTypes[] = Api::VatType_NationalReversed;
                }
            } elseif ($this->isEu()) {
                // Can it be normal vat?
                if ($foreignVat !== PluginConfig::ForeignVat_Only) {
                    $possibleVatTypes[] = Api::VatType_National;
                }
                // Can it be foreign vat?
                if ($foreignVat !== PluginConfig::ForeignVat_No) {
                    $possibleVatTypes[] = Api::VatType_ForeignVat;
                }
                // Can it be EU reversed VAT.
                if ($this->isCompany()) {
                    $possibleVatTypes[] = Api::VatType_EuReversed;
                }
            } elseif ($this->isOutsideEu()) {
                // Can it be national vat (possibly vat free)? Services should
                // use vattype = 1.
                if ($nature !== PluginConfig::Nature_Products) {
                    $possibleVatTypes[] = Api::VatType_National;
                }
                // Can it be rest of world (0%)? Goods should use vat type = 4
                // unless you can't or don't want to prove that the goods will
                // leave the EU (see
                // https://www.belastingdienst.nl/rekenhulpen/leveren_van_goederen_naar_het_buitenland/),
                // in which case we should use vat type = 1.
                if ($nature !== PluginConfig::Nature_Services) {
                    $possibleVatTypes[] = Api::VatType_National;
                    $possibleVatTypes[] = Api::VatType_RestOfWorld;
                }
            }

            // Can it be a margin invoice?
            if ($margin !== PluginConfig::MarginProducts_No) {
                $possibleVatTypes[] = Api::VatType_MarginScheme;
            }
        }
        $this->possibleVatTypes = array_unique($possibleVatTypes, SORT_NUMERIC);
    }
protected function initPossibleVatTypes ( ) { $ possibleVatTypes = array ( ) ; $ shopSettings = $ this -> config -> getShopSettings ( ) ; $ nature = $ shopSettings [ 'nature_shop' ] ; $ margin = $ shopSettings [ 'marginProducts' ] ; $ foreignVat = $ shopSettings [ 'foreignVat' ] ; if ( ! empty ( $ this -> invoice [ Tag :: Customer ] [ Tag :: Invoice ] [ Tag :: VatType ] ) ) { // If shop specific code or an event handler has already set the vat // type, we obey so. $ possibleVatTypes [ ] = $ this -> invoice [ Tag :: Customer ] [ Tag :: Invoice ] [ Tag :: VatType ] ; } else { if ( $ this -> isNl ( ) ) { $ possibleVatTypes [ ] = Api :: VatType_National ; // Can it be national reversed VAT: not really supported but // possible. if ( $ this -> isCompany ( ) ) { $ possibleVatTypes [ ] = Api :: VatType_NationalReversed ; } } elseif ( $ this -> isEu ( ) ) { // Can it be normal vat? if ( $ foreignVat !== PluginConfig :: ForeignVat_Only ) { $ possibleVatTypes [ ] = Api :: VatType_National ; } // Can it be foreign vat? if ( $ foreignVat !== PluginConfig :: ForeignVat_No ) { $ possibleVatTypes [ ] = Api :: VatType_ForeignVat ; } // Can it be EU reversed VAT. if ( $ this -> isCompany ( ) ) { $ possibleVatTypes [ ] = Api :: VatType_EuReversed ; } } elseif ( $ this -> isOutsideEu ( ) ) { // Can it be national vat (possibly vat free)? Services should // use vattype = 1. if ( $ nature !== PluginConfig :: Nature_Products ) { $ possibleVatTypes [ ] = Api :: VatType_National ; } // Can it be rest of world (0%)? Goods should use vat type = 4 // unless you can't or don't want to prove that the goods will // leave the EU (see // https://www.belastingdienst.nl/rekenhulpen/leveren_van_goederen_naar_het_buitenland/), // in which case we should use vat type = 1. if ( $ nature !== PluginConfig :: Nature_Services ) { $ possibleVatTypes [ ] = Api :: VatType_National ; $ possibleVatTypes [ ] = Api :: VatType_RestOfWorld ; } } // Can it be a margin invoice? if ( $ margin !== PluginConfig :: MarginProducts_No ) { $ possibleVatTypes [ ] = Api :: VatType_MarginScheme ; } } $ this -> possibleVatTypes = array_unique ( $ possibleVatTypes , SORT_NUMERIC ) ; }
Initializes the list of possible vat types for this invoice.

The list of possible vat types depends on:
- Whether the vat type already has been set.
- Whether there is at least 1 line with a costprice.
- The country of the client.
- Whether the client is a company.
- The shop settings (selling foreign vat or vat free products).
- Optionally, the date of the invoice.

See also: {@see https://wiki.acumulus.nl/index.php?page=facturen-naar-het-buitenland}.
Initializes the list of possible vat types for this invoice .