Procházet zdrojové kódy

Processus de commande

feature/export_comptable
Fab před 4 roky
rodič
revize
ef150e281b
2 změnil soubory, kde provedl 42 přidání a 11 odebrání
  1. +5
    -0
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +37
    -11
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 5
- 0
ShopBundle/Services/Price/OrderProductPriceUtils.php Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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)
{


Načítá se…
Zrušit
Uložit