Browse Source

Processus de commande

feature/export_comptable
Fab 4 years ago
parent
commit
29570e2a08
1 changed files with 55 additions and 24 deletions
  1. +55
    -24
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 55
- 24
ShopBundle/Services/Price/OrderShopPriceUtils.php View File

@@ -77,6 +77,9 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop)
{
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$reductionAmount = $this->amountOrderProductsReductionCart($orderShop,$orderReductionCart);
}

}

@@ -86,38 +89,66 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

}

public function applyOrderProductsReductionCart(OrderShopInterface $order, $withTax = true)
public function amountOrderProductsReductionCart(OrderShopInterface $order, $orderReductionCart)
{

foreach ($order->getOrderReductionCarts() as $orderReductionCart) {
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) {
if ($orderReductionCart->getUnit() == 'percent') {

$priceWithTax = $this->applyReductionPercent(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) {
if ($orderReductionCart->getUnit() == 'percent') {

$priceWithTax = $this->applyReductionPercent(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue
);
} else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$this->getTotalOrderProducts($order),
$orderReductionCart->getValue()
),
$this->getTaxRateAverage($order)
);
} else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$this->getTotalOrderProducts($order),
$orderReductionCart->getValue()
),
$this->getTaxRateAverage($order)
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$priceWithTax =
$this->applyReductionAmount(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$priceWithTax =
$this->applyReductionAmount(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);

}

}
}
}
}

public function amountOrderProductsReductionCredit(OrderShopInterface $order, $orderReductionCart)
{


if ($orderReductionCart->getUnit() == 'percent') {

$priceWithTax = $this->applyReductionPercent(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue
);
} else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$this->getTotalOrderProducts($order),
$orderReductionCart->getValue()
),
$this->getTaxRateAverage($order)
);
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$priceWithTax =
$this->applyReductionAmount(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);

}
}
}
}

}

Loading…
Cancel
Save