Explorar el Código

Correctif PriceUtils

feature/export_comptable
Guillaume hace 4 años
padre
commit
dd282b8568
Se han modificado 1 ficheros con 20 adiciones y 13 borrados
  1. +20
    -13
      ShopBundle/Services/PriceUtils.php

+ 20
- 13
ShopBundle/Services/PriceUtils.php Ver fichero

@@ -52,7 +52,7 @@ class PriceUtils
{
if($entity instanceof ProductPropertyInterface) {
if($entity->getBehaviorPriceInherited() == 'by-piece') {
return ($this->getPriceInherited($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityInherited() ;
return ($this->getPrice($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityInherited() ;
}
elseif($entity->getBehaviorPriceInherited() == 'by-reference-unit') {
return $entity->getPriceByRefUnitInherited() ;
@@ -113,21 +113,28 @@ class PriceUtils
}
}

private function getPriceWithTaxAndReductionCatalog($entity, $price, $priceWithTax): ?float
public function getPriceWithTaxAndReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null): ?float
{
if($entity instanceof ProductPropertyInterface) {
$reductionCatalog = $entity->getReductionCatalogInherited() ;

if($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue() ;
$reductionCatalogUnit = $reductionCatalog->getUnit() ;
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ;
}
if($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue() ;
$reductionCatalogUnit = $reductionCatalog->getUnit() ;
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ;
}
else {
if($entity instanceof ProductPropertyInterface) {
$reductionCatalog = $entity->getReductionCatalogInherited() ;

if($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue() ;
$reductionCatalogUnit = $reductionCatalog->getUnit() ;
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ;
}
}

if($entity instanceof OrderProductInterface) {
// OrderProductReductionCatalog
$reductionCatalog = null ;
if($entity instanceof OrderProductInterface) {
// OrderProductReductionCatalog
$reductionCatalog = null ;
}
}

if(isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) {

Cargando…
Cancelar
Guardar