Sfoglia il codice sorgente

Drobna poprawka - walidacja aby VAT nie był liczbą ujemną

Mariusz Muszyński 9 anni fa
parent
commit
b243b420f8
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      SE/se-lib/V.php

+ 2 - 0
SE/se-lib/V.php

@@ -518,8 +518,10 @@ EOF';
 	}
 
 	public static function nettoOdBrutto($brutto = 0, $vat = "23") {
+		if ($vat < 0) throw new Exception("Stawka VAT nie może być liczbą ujemną!");
 		$netto = round($brutto/(1+$vat/100),2);
 		if (round($netto*(1+$vat/100),2) > $brutto) $netto -= 0.01;
 		return $netto;
 	}
+
 }