src/Invoice/Creator.php
public static function getVatRangeTags($numerator, $denominator, $numeratorPrecision = 0.01, $denominatorPrecision = 0.01)
    {
        if (Number::isZero($denominator, 0.0001)) {
            $result = array(
                Tag::VatRate => null,
                Meta::VatAmount => $numerator,
                Meta::VatRateSource => static::VatRateSource_Completor,
            );
        } elseif (Number::isZero($numerator, 0.0001)) {
            $result = array(
                Tag::VatRate => 0,
                Meta::VatAmount => $numerator,
                Meta::VatRateSource => static::VatRateSource_Exact0,
            );
        } else {
            $range = Number::getDivisionRange($numerator, $denominator, $numeratorPrecision, $denominatorPrecision);
            $result = array(
                Tag::VatRate => 100.0 * $range['calculated'],
                Meta::VatRateMin => 100.0 * $range['min'],
                Meta::VatRateMax => 100.0 * $range['max'],
                Meta::VatAmount => $numerator,
                Meta::PrecisionUnitPrice => $denominatorPrecision,
                Meta::PrecisionVatAmount => $numeratorPrecision,
                Meta::VatRateSource => static::VatRateSource_Calculated,
            );
        }
        return $result;
    }
public static function getVatRangeTags($numerator, $denominator, $numeratorPrecision = 0.01, $denominatorPrecision = 0.01)
    {
        if (Number::isZero($denominator, 0.0001)) {
            $result = array(
                Tag::VatRate => null,
                Meta::VatAmount => $numerator,
                Meta::VatRateSource => static::VatRateSource_Completor,
            );
        } elseif (Number::isZero($numerator, 0.0001)) {
            $result = array(
                Tag::VatRate => 0,
                Meta::VatAmount => $numerator,
                Meta::VatRateSource => static::VatRateSource_Exact0,
            );
        } else {
            $range = Number::getDivisionRange($numerator, $denominator, $numeratorPrecision, $denominatorPrecision);
            $result = array(
                Tag::VatRate => 100.0 * $range['calculated'],
                Meta::VatRateMin => 100.0 * $range['min'],
                Meta::VatRateMax => 100.0 * $range['max'],
                Meta::VatAmount => $numerator,
                Meta::PrecisionUnitPrice => $denominatorPrecision,
                Meta::PrecisionVatAmount => $numeratorPrecision,
                Meta::VatRateSource => static::VatRateSource_Calculated,
            );
        }
        return $result;
    }
public static function getVatRangeTags ( $ numerator , $ denominator , $ numeratorPrecision = 0.01 , $ denominatorPrecision = 0.01 ) { if ( Number :: isZero ( $ denominator , 0.0001 ) ) { $ result = array ( Tag :: VatRate => null , Meta :: VatAmount => $ numerator , Meta :: VatRateSource => static :: VatRateSource_Completor , ) ; } elseif ( Number :: isZero ( $ numerator , 0.0001 ) ) { $ result = array ( Tag :: VatRate => 0 , Meta :: VatAmount => $ numerator , Meta :: VatRateSource => static :: VatRateSource_Exact0 , ) ; } else { $ range = Number :: getDivisionRange ( $ numerator , $ denominator , $ numeratorPrecision , $ denominatorPrecision ) ; $ result = array ( Tag :: VatRate => 100.0 * $ range [ 'calculated' ] , Meta :: VatRateMin => 100.0 * $ range [ 'min' ] , Meta :: VatRateMax => 100.0 * $ range [ 'max' ] , Meta :: VatAmount => $ numerator , Meta :: PrecisionUnitPrice => $ denominatorPrecision , Meta :: PrecisionVatAmount => $ numeratorPrecision , Meta :: VatRateSource => static :: VatRateSource_Calculated , ) ; } return $ result ; }
Returns the range in which the vat rate will lie.

If a webshop does not store the vat rates used in the order, we must
calculate them using a (product) price and the vat on it. But as web
shops often store these numbers rounded to cents, the vat rate
calculation becomes imprecise. Therefore we compute the range in which
it will lie and will let the Completor do a comparison with the actual
vat rates that an order can have (one of the Dutch or, for electronic
services, other EU country VAT rates).

- If $denominator = 0 (free product), the vatrate will be set to null
and the Completor will try to get this line listed under the correct
vat rate.
- If $numerator = 0 the vatrate will be set to 0 and be treated as if it
is an exact vat rate, not a vat range.

@param float $numerator
The amount of VAT as received from the web shop.
@param float $denominator
The price of a product excluding VAT as received from the web shop.
@param float $numeratorPrecision
The precision used when rounding the number. This means that the
original numerator will not differ more than half of this.
@param float $denominatorPrecision
The precision used when rounding the number. This means that the
original denominator will not differ more than half of this.

@return array
Array with keys (noy all keys will always be available):
- vatrate
- vatamount
- meta-vatrate-min
- meta-vatrate-max
- meta-vatamount-precision
- meta-vatrate-source

@todo: can we move this from the (plugin specific) creators to the
completor phase? This would aid in simplifying the creators towards raw
data collectors..
Returns the range in which the vat rate will lie .