Parcourir la source

Processus de commande

feature/export_comptable
Fab il y a 4 ans
Parent
révision
29570e2a08
1 fichiers modifiés avec 55 ajouts et 24 suppressions
  1. +55
    -24
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 55
- 24
ShopBundle/Services/Price/OrderShopPriceUtils.php Voir le fichier

@@ -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()
);

}
}
}
}

}

Chargement…
Annuler
Enregistrer