Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Fab 4 years ago
parent
commit
0244f01587
3 changed files with 9 additions and 5 deletions
  1. +1
    -1
      ShopBundle/Services/Order/OrderUtilsStockTrait.php
  2. +4
    -1
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  3. +4
    -3
      ShopBundle/Services/Price/PriceUtilsTrait.php

+ 1
- 1
ShopBundle/Services/Order/OrderUtilsStockTrait.php View File

@@ -19,7 +19,7 @@ trait OrderUtilsStockTrait

//Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient());
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient()));
$orderProduct->getProduct()->getProductFamily()->setAvailableQuantity($newAvailability);

$this->em->persist($orderProduct->getProduct()->getProductFamily());

+ 4
- 1
ShopBundle/Services/Price/OrderProductPriceUtils.php View File

@@ -56,6 +56,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getPrice($orderProduct),
$this->getPriceWithTax($orderProduct),
1,
null,
false
);
@@ -95,6 +96,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder(),
null,
false
);
@@ -113,7 +115,8 @@ class OrderProductPriceUtils
return $this->applyReductionCatalog(
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct)
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder()
);
}


+ 4
- 3
ShopBundle/Services/Price/PriceUtilsTrait.php View File

@@ -42,8 +42,9 @@ trait PriceUtilsTrait
return round((($price * $percent)) / 100, 2);
}

public function applyReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null, $withTax = true): ?float
public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true): ?float
{

if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
@@ -80,14 +81,14 @@ trait PriceUtilsTrait
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$price,
$reductionCatalogValue
$reductionCatalogValue * $quantity
),
$entity->getTaxRateInherited()->getValue()
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
$priceWithTax,
$reductionCatalogValue
$reductionCatalogValue * $quantity
);
}
}

Loading…
Cancel
Save