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



//Disponibilité par unité de référence //Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); $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); $orderProduct->getProduct()->getProductFamily()->setAvailableQuantity($newAvailability);


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

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

$orderProduct, $orderProduct,
$this->getPrice($orderProduct), $this->getPrice($orderProduct),
$this->getPriceWithTax($orderProduct), $this->getPriceWithTax($orderProduct),
1,
null, null,
false false
); );
$orderProduct, $orderProduct,
$this->getTotal($orderProduct), $this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct), $this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder(),
null, null,
false false
); );
return $this->applyReductionCatalog( return $this->applyReductionCatalog(
$orderProduct, $orderProduct,
$this->getTotal($orderProduct), $this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct)
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder()
); );
} }



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

return round((($price * $percent)) / 100, 2); 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) { if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue(); $reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit(); $reductionCatalogUnit = $reductionCatalog->getUnit();
$priceWithTax = $this->applyTax( $priceWithTax = $this->applyTax(
$this->applyReductionAmount( $this->applyReductionAmount(
$price, $price,
$reductionCatalogValue
$reductionCatalogValue * $quantity
), ),
$entity->getTaxRateInherited()->getValue() $entity->getTaxRateInherited()->getValue()
); );
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { } elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount( $priceWithTax = $this->applyReductionAmount(
$priceWithTax, $priceWithTax,
$reductionCatalogValue
$reductionCatalogValue * $quantity
); );
} }
} }

Loading…
Cancel
Save