src/Invoice/CompletorStrategy/ApplySameVatRate.php
protected function tryVatRate($vatRate)
    {
        $this->description = "ApplySameVatRate($vatRate)";
        $this->replacingLines = array();
        $vatAmount = 0.0;
        foreach ($this->lines2Complete as $line2Complete) {
            $vatAmount += $this->completeLine($line2Complete, $vatRate);
        }

        $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategy . $this->getName()] = "tryVatRate($vatRate): $vatAmount";
        // If the vat totals are equal, the strategy worked.
        // We allow for a reasonable margin, as rounding errors may add up.
        return Number::floatsAreEqual($vatAmount, $this->vat2Divide, 0.04);
    }
protected function tryVatRate($vatRate)
    {
        $this->description = "ApplySameVatRate($vatRate)";
        $this->replacingLines = array();
        $vatAmount = 0.0;
        foreach ($this->lines2Complete as $line2Complete) {
            $vatAmount += $this->completeLine($line2Complete, $vatRate);
        }

        $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategy . $this->getName()] = "tryVatRate($vatRate): $vatAmount";
        // If the vat totals are equal, the strategy worked.
        // We allow for a reasonable margin, as rounding errors may add up.
        return Number::floatsAreEqual($vatAmount, $this->vat2Divide, 0.04);
    }
protected function tryVatRate ( $ vatRate ) { $ this -> description = "ApplySameVatRate($vatRate)" ; $ this -> replacingLines = array ( ) ; $ vatAmount = 0.0 ; foreach ( $ this -> lines2Complete as $ line2Complete ) { $ vatAmount += $ this -> completeLine ( $ line2Complete , $ vatRate ) ; } $ this -> invoice [ Tag :: Customer ] [ Tag :: Invoice ] [ Meta :: CompletorStrategy . $ this -> getName ( ) ] = "tryVatRate($vatRate): $vatAmount" ; // If the vat totals are equal, the strategy worked. // We allow for a reasonable margin, as rounding errors may add up. return Number :: floatsAreEqual ( $ vatAmount , $ this -> vat2Divide , 0.04 ) ; }
Tries 1 of the possible vat rates.

@param float $vatRate

@return bool
Tries 1 of the possible vat rates .