Explorar el Código

Processus de commande

feature/export_comptable
Fab hace 4 años
padre
commit
ef150e281b
Se han modificado 2 ficheros con 42 adiciones y 11 borrados
  1. +5
    -0
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +37
    -11
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 5
- 0
ShopBundle/Services/Price/OrderProductPriceUtils.php Ver fichero

@@ -77,5 +77,10 @@ class OrderProductPriceUtils
$this->getTotalWithTax($orderProduct)
);
}

//inclus toujours les réductions catalogues
public function getTotalTaxes(OrderProductInterface $orderProduct){
return $this->getTotalWithTaxAndReduction($orderProduct) - $this->getTotalWithReduction($orderProduct);
}
}


+ 37
- 11
ShopBundle/Services/Price/OrderShopPriceUtils.php Ver fichero

@@ -16,41 +16,67 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
$this->orderProductPriceUtils = $orderProductPriceUtils ;
}

public function getTotal(OrderShopInterface $orderShop)
//Inclus les ReductionCatalog des OrderProducts
public function getTotalOrderProducts(OrderShopInterface $orderShop):float
{
// A tester calculer ce montant en faisant TotalOrderWithTax - TotalOrderTaxes

$total = 0;
foreach ($orderShop->getOrderProducts() as $orderProduct) {
$total += $this->orderProductPriceUtils->getTotalWithReduction($orderProduct);
}
return $total;
}

public function getTotalWithReductionCatalog(OrderShopInterface $orderShop)
public function getTotalOrderProductsWithTax(OrderShopInterface $orderShop):float
{
$total = 0;
foreach ($orderShop->getOrderProducts() as $orderProduct) {
$total += $this->orderProductPriceUtils->getTotalWithTaxAndReduction($orderProduct);
}
return $total;

}

public function getTotalWithReductionCart(OrderShopInterface $orderShop)
{

public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float {
}

public function getTotalWithReductions(OrderShopInterface $orderShop)
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop):array
{
$orderProductsTaxes = [];
foreach ($orderShop->getOrderProducts() as $orderProduct) {

}
$idTaxRate = $orderProduct->getTaxRate()->getId() ;

public function getTotalWithTax(OrderShopInterface $orderShop)
{
if(!isset($orderProductsTaxes[$idTaxRate])) {
$orderProductsTaxes[$idTaxRate] = [
'label' => $orderProduct->getTaxRate()->getValue() . '%',
'totalOrderProducts' => 0,
'totalTaxes' => 0,
];
}

$orderProductsTaxes[$idTaxRate]['totalOrderProducts'] += $this->orderProductPriceUtils->getTotalWithReduction($orderProduct) * $this->getReductionsCoef($orderShop);
$orderProductsTaxes[$idTaxRate]['totalTaxes'] += $this->orderProductPriceUtils->getTotalTaxes($orderProduct) * $this->getReductionsCoef($orderShop) ;
}

return $orderProductsTaxes ;
}

public function getTotalWithTaxAndReductionCatalog(OrderShopInterface $orderShop)
private function getReductionsCoef(OrderShopInterface $orderShop) :float
{

return $this->getTotalOrderProducts($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop);
}

public function getTotalWithTaxAndReductionCart(OrderShopInterface $orderShop)


public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop)
{

}


public function getTotalWithTaxAndReductions(OrderShopInterface $orderShop)
{


Cargando…
Cancelar
Guardar