get(); } } public function setFrom($v) { $this->setValueFrom($v); } public function setCost($v) { $this->setAmount($v); } public function getCostNetto($with_currency = false) { $v = $this->getAmount(); if ($with_currency) { $v = self::$currency->exchange($v); } return $v; } public function setCostNetto($v) { $this->setAmount($v); } public function getTax() { return $this->getDelivery()->getTax(); } public function getCostBrutto($with_currency = false) { if (SF_APP == 'frontend' && (sfContext::getInstance()->getUser()->hasVatEu() || sfContext::getInstance()->getUser()->hasVatEx())) { return $this->getCostNetto($with_currency); } $costBrutto = $this->getAmountBrutto(); if (null === $costBrutto) { $costBrutto = stPrice::calculate($this->getCostNetto(), $this->getTax()->getVat()); $this->setCostBrutto($costBrutto); } $countryTaxRate = $this->getTax()->getTaxRateByCountry(); if (null !== $countryTaxRate) { $costBrutto = stPrice::calculate(parent::getAmount(), $countryTaxRate); } if ($with_currency) { $costBrutto = self::$currency->exchange($costBrutto); } return $this->format($costBrutto); } public function setCostBrutto($v) { $this->setAmountBrutto($v); } public function getFrom() { return $this->getValueFrom(); } public function getCost() { return $this->getAmount(); } public function getValueFrom() { $v = parent::getValueFrom(); if (strpos($v, '.') !== false) { return $this->format(parent::getValueFrom()); } return parent::getValueFrom(); } public function getAmount() { return $this->format(parent::getAmount()); } protected function format($v) { if (is_numeric($v)) { return stCurrency::formatPrice($v); } return $v; } }