ソースを参照

PriceUtils

feature/export_comptable
Guillaume 4年前
コミット
47055737ed
2個のファイルの変更34行の追加4行の削除
  1. +32
    -2
      ShopBundle/Services/Price/OrderShopPriceUtils.php
  2. +2
    -2
      ShopBundle/Services/Price/PriceUtils.php

+ 32
- 2
ShopBundle/Services/Price/OrderShopPriceUtils.php ファイルの表示

@@ -58,7 +58,7 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}

public function getMarginOrderProductsPercent(OrderShopInterface $orderShop): float
public function getMarginOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProductsWithReductions($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop) * 100);
@@ -67,7 +67,7 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
}
}

public function getMarginOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
public function getMarginOrderProductsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProducts($orderShop) / $this->getTotalOrderProducts($orderShop) * 100);
@@ -76,11 +76,31 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
}
}

public function getBrandTaxesOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProducts($orderShop) / $this->getTotalBuyingPriceOrderProducts($orderShop->getOrderProducts()) * 100);
} else {
return 0;
}
}

public function getTotalOrderProductsWithTax(OrderShopInterface $orderShop): float
{
return $this->getTotalOrderProductsWithTaxByOrderProducts($orderShop->getOrderProducts());
}

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

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

return $total;
}

public function getTotalBuyingPriceOrderProductsWithTax($orderProducts): float
{
$total = 0;
@@ -280,5 +300,15 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

return $amountWithTax;
}

public function getTotalReductions()
{

}

public function getTotalReductionsWithTax()
{

}
}


+ 2
- 2
ShopBundle/Services/Price/PriceUtils.php ファイルの表示

@@ -35,7 +35,7 @@ class PriceUtils implements PriceUtilsInterface
$service = 'orderProductPriceUtils';
}

if ($entity instanceof OrderShopInterface || is_array($entity)) {
if ($entity instanceof OrderShopInterface || is_iterable($entity) || is_array($entity)) {
$service = 'orderShopPriceUtils';
}

@@ -51,7 +51,7 @@ class PriceUtils implements PriceUtilsInterface
}
} else {
if (!strlen($service)) {
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré.");
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré");
} else {
if (!method_exists($this->$service, $name)) {
throw new \ErrorException("PriceUtils : la méthode " . $name . " du service " . $service . " n'existe pas.");

読み込み中…
キャンセル
保存