Esempio n. 1
0
 public static function RecalculatePriceVat($price, $bVatIncluded, $vatId)
 {
     $result = $price;
     if (self::$bVatMode === null) {
         self::$bVatMode = CCrmTax::isVatMode();
         if (self::$bVatMode) {
             self::$arVatRates = CCrmVat::GetAll();
         }
     }
     if (self::$bVatMode) {
         if ($bVatIncluded !== 'Y') {
             if (isset(self::$arVatRates[$vatId])) {
                 $vatRate = self::$arVatRates[$vatId]['RATE'];
                 $result = (doubleval($vatRate) / 100 + 1) * doubleval($price);
             }
         }
     }
     return $result;
 }