|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float { |
|
|
|
|
|
|
|
|
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float |
|
|
|
|
|
{ |
|
|
|
|
|
return 0 ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop):array |
|
|
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop):array |
|
|
|
|
|
|
|
|
return $this->getTotalOrderProducts($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop); |
|
|
return $this->getTotalOrderProducts($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private function getTaxRateAverage(OrderShopInterface $order):float |
|
|
|
|
|
|
|
|
private function getTaxRateAverage(OrderShopInterface $orderShop):float |
|
|
{ |
|
|
{ |
|
|
return $this->getTotalOrderProductsWithTax() / $this->getTotalOrderProducts(); |
|
|
|
|
|
|
|
|
return $this->getTotalOrderProductsWithTax($orderShop) / $this->getTotalOrderProducts($orderShop); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop) |
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop) |
|
|
|
|
|
|
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
$price = $orderReductionCart->getValue(); |
|
|
$price = $orderReductionCart->getValue(); |
|
|
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
$price = $orderReductionCart->getValue() / $this->getTaxRateAverage(); |
|
|
|
|
|
|
|
|
$price = $orderReductionCart->getValue() / $this->getTaxRateAverage($order); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) |
|
|
public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) |
|
|
{ |
|
|
{ |
|
|
|
|
|
$amount = 0; |
|
|
|
|
|
|
|
|
$amount =0; |
|
|
|
|
|
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { |
|
|
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { |
|
|
if ($orderReductionCart->getUnit() == 'percent') { |
|
|
if ($orderReductionCart->getUnit() == 'percent') { |
|
|
|
|
|
|
|
|
$amount = $this->amountReductionByPercentValue( |
|
|
$amount = $this->amountReductionByPercentValue( |
|
|
$this->getTotalOrderProductsWithTax($order), |
|
|
$this->getTotalOrderProductsWithTax($order), |
|
|
$orderReductionCart->getValue() |
|
|
$orderReductionCart->getValue() |
|
|
); |
|
|
); |
|
|
} else if ($orderReductionCart->getUnit() == 'amount') { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
elseif ($orderReductionCart->getUnit() == 'amount') { |
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage(); |
|
|
|
|
|
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
|
|
|
|
|
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage($order); |
|
|
|
|
|
} |
|
|
|
|
|
elseif ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
$amount = $orderReductionCart->getValue() ; |
|
|
$amount = $orderReductionCart->getValue() ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $amount ; |
|
|
return $amount ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
{ |
|
|
{ |
|
|
$amount =0; |
|
|
|
|
|
|
|
|
$amount = 0; |
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
$amount = $orderReductionCredit->getValue(); |
|
|
$amount = $orderReductionCredit->getValue(); |
|
|
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
|
|
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage(); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
|
|
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage($order); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $amount; |
|
|
return $amount; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
{ |
|
|
{ |
|
|
$amount =0; |
|
|
|
|
|
|
|
|
$amountWithTax = 0; |
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage(); |
|
|
|
|
|
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
|
|
|
|
|
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage($order); |
|
|
|
|
|
} |
|
|
|
|
|
elseif ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
$amountWithTax = $orderReductionCredit->getValue(); |
|
|
$amountWithTax = $orderReductionCredit->getValue(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $amountWithTax; |
|
|
return $amountWithTax; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |