瀏覽代碼

Processus de commande

feature/export_comptable
Fab 4 年之前
父節點
當前提交
78fada8ace
共有 1 個檔案被更改,包括 37 行新增34 行删除
  1. +37
    -34
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 37
- 34
ShopBundle/Services/Price/OrderShopPriceUtils.php 查看文件

@@ -2,6 +2,7 @@

namespace Lc\ShopBundle\Price\Services;

use Lc\ShopBundle\Context\OrderReductionCreditInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\OrderShopPriceUtilsInterface;
use Lc\ShopBundle\Model\ReductionCart;
@@ -89,67 +90,69 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

}

public function amountOrderProductsReductionCart(OrderShopInterface $order, $orderReductionCart)
public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart)
{

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

$priceWithTax = $this->applyReductionPercent(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue
$price = $this->applyReductionPercent(
$this->getTotalOrderProducts($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)
);
$price = $orderReductionCart->getValue();
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$priceWithTax =
$this->applyReductionAmount(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);

$price = $orderReductionCart->getValue() / $this->getTaxRateAverage();
}

}
}
}

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

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

$priceWithTax = $this->applyReductionPercent(
$price = $this->applyReductionPercent(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue
$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)
);
$price = $orderReductionCart->getValue() * $this->getTaxRateAverage();
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$priceWithTax =
$this->applyReductionAmount(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);

$price = $orderReductionCart->getValue() ;
}

}
}
}

public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit)
{

if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') {
$amount = $orderReductionCredit->getValue();
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage();
}

return $amount;
}

public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit)
{

if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') {
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage();
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {
$amountWithTax = $orderReductionCredit->getValue();
}
return $amountWithTax;
}
}


Loading…
取消
儲存