getSellPriceTax() public method

public getSellPriceTax ( ) : WellCommerce\Bundle\TaxBundle\Entity\TaxInterface
return WellCommerce\Bundle\TaxBundle\Entity\TaxInterface
コード例 #1
0
 /**
  * Recalculates sell prices for product
  *
  * @param ProductInterface $product
  */
 protected function refreshProductSellPrices(ProductInterface $product)
 {
     $sellPrice = $product->getSellPrice();
     $grossAmount = $sellPrice->getGrossAmount();
     $discountedGrossAmount = $sellPrice->getDiscountedGrossAmount();
     $taxRate = $product->getSellPriceTax()->getValue();
     $netAmount = TaxHelper::calculateNetPrice($grossAmount, $taxRate);
     $discountedNetAmount = TaxHelper::calculateNetPrice($discountedGrossAmount, $taxRate);
     $sellPrice->setTaxRate($taxRate);
     $sellPrice->setTaxAmount($grossAmount - $netAmount);
     $sellPrice->setNetAmount($netAmount);
     $sellPrice->setDiscountedTaxAmount($discountedGrossAmount - $discountedNetAmount);
     $sellPrice->setDiscountedNetAmount($discountedNetAmount);
 }