Browse Source

[Frontend] Compte producteur : adaptation prix

master
Guillaume 4 years ago
parent
commit
24009c980d
2 changed files with 22 additions and 1 deletions
  1. +12
    -1
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +10
    -0
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 12
- 1
ShopBundle/Services/Price/OrderProductPriceUtils.php View File

@@ -68,7 +68,10 @@ class OrderProductPriceUtils
return $orderProduct->getQuantityOrder() * $this->getPrice($orderProduct);
}


public function getTotalBuyingPrice(OrderProductInterface $orderProduct)
{
return $orderProduct->getQuantityOrder() * $this->getBuyingPrice($orderProduct);
}

public function getMargin(OrderProductInterface $orderProduct)
{
@@ -120,6 +123,14 @@ class OrderProductPriceUtils
);
}

public function getTotalBuyingPriceWithTax(OrderProductInterface $orderProduct)
{
return $this->applyTax(
$this->getTotalBuyingPrice($orderProduct),
$orderProduct->getTaxRateInherited()->getValue()
);
}

//inclus toujours les réductions catalogues
public function getTotalTaxes(OrderProductInterface $orderProduct){
return $this->getTotalWithTaxAndReduction($orderProduct) - $this->getTotalWithReduction($orderProduct);

+ 10
- 0
ShopBundle/Services/Price/OrderShopPriceUtils.php View File

@@ -49,6 +49,16 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $this->getTotalOrderProductsWithTaxByOrderProducts($orderShop->getOrderProducts()) ;
}

public function getTotalBuyingPriceOrderProductsWithTax($orderProducts):float
{
$total = 0;

foreach ($orderProducts as $orderProduct) {
$total += $this->orderProductPriceUtils->getTotalBuyingPriceWithTax($orderProduct);
}

return $total;
}

public function getTotalOrderProductsWithTaxByOrderProducts($orderProducts):float
{

Loading…
Cancel
Save