|
|
@@ -40,22 +40,26 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
return $total; |
|
|
|
} |
|
|
|
|
|
|
|
public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop): float |
|
|
|
public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false): float |
|
|
|
{ |
|
|
|
$total = $this->getMarginOrderProducts($orderShop); |
|
|
|
if ($cache && $orderShop->getStatMarginOrderProductsWithReductions() !== null) { |
|
|
|
return $orderShop->getStatMarginOrderProductsWithReductions(); |
|
|
|
} else { |
|
|
|
$total = $this->getMarginOrderProducts($orderShop); |
|
|
|
|
|
|
|
$totalReductionAmount = 0; |
|
|
|
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart); |
|
|
|
} |
|
|
|
$totalReductionAmount = 0; |
|
|
|
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart); |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit); |
|
|
|
} |
|
|
|
foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit); |
|
|
|
} |
|
|
|
|
|
|
|
$total -= $totalReductionAmount; |
|
|
|
$total -= $totalReductionAmount; |
|
|
|
|
|
|
|
return $total; |
|
|
|
return $total; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getMarginOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float |
|
|
@@ -165,12 +169,16 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
return $this->getTotalOrderProductsWithTax($orderShop) / $this->getTotalOrderProducts($orderShop); |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop) |
|
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false) |
|
|
|
{ |
|
|
|
$total = $this->getTotalOrderProducts($orderShop); |
|
|
|
$total -= $this->getTotalReductionCartsAmount($orderShop); |
|
|
|
$total -= $this->getTotalReductionCreditsAmount($orderShop); |
|
|
|
return $total; |
|
|
|
if($cache && $orderShop->getStatTotalOrderProductsWithReductions()!==null){ |
|
|
|
return $orderShop->getStatTotalOrderProductsWithReductions(); |
|
|
|
}else { |
|
|
|
$total = $this->getTotalOrderProducts($orderShop); |
|
|
|
$total -= $this->getTotalReductionCartsAmount($orderShop); |
|
|
|
$total -= $this->getTotalReductionCreditsAmount($orderShop); |
|
|
|
return $total; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalOrderProductsWithReductionCarts(OrderShopInterface $orderShop) |
|
|
@@ -198,12 +206,16 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
return $totalReductionAmount; |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalOrderProductsWithTaxAndReductions(OrderShopInterface $orderShop) |
|
|
|
public function getTotalOrderProductsWithTaxAndReductions(OrderShopInterface $orderShop, $cache = false) |
|
|
|
{ |
|
|
|
$total = $this->getTotalOrderProductsWithTax($orderShop); |
|
|
|
$total -= $this->getTotalReductionCartsAmountWithTax($orderShop); |
|
|
|
$total -= $this->getTotalReductionCreditsAmountWithTax($orderShop); |
|
|
|
return $total; |
|
|
|
if($cache && $orderShop->getStatTotalOrderProductsWithTaxAndReductions()!==null){ |
|
|
|
return $orderShop->getStatTotalOrderProductsWithTaxAndReductions(); |
|
|
|
}else { |
|
|
|
$total = $this->getTotalOrderProductsWithTax($orderShop); |
|
|
|
$total -= $this->getTotalReductionCartsAmountWithTax($orderShop); |
|
|
|
$total -= $this->getTotalReductionCreditsAmountWithTax($orderShop); |
|
|
|
return $total; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalOrderProductsWithTaxAndReductionCarts(OrderShopInterface $orderShop) |
|
|
@@ -303,32 +315,32 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
|
|
|
|
public function getTotalReductions(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
$total = 0 ; |
|
|
|
$total = 0; |
|
|
|
|
|
|
|
foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$total += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart) ; |
|
|
|
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$total += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart); |
|
|
|
} |
|
|
|
|
|
|
|
foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit) ; |
|
|
|
foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit); |
|
|
|
} |
|
|
|
|
|
|
|
return $total ; |
|
|
|
return $total; |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalReductionsWithTax(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
$total = 0 ; |
|
|
|
$total = 0; |
|
|
|
|
|
|
|
foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$total += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart) ; |
|
|
|
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
$total += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart); |
|
|
|
} |
|
|
|
|
|
|
|
foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit) ; |
|
|
|
foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
$total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit); |
|
|
|
} |
|
|
|
|
|
|
|
return $total ; |
|
|
|
return $total; |
|
|
|
} |
|
|
|
} |
|
|
|
|