ソースを参照

Nouveau système PriceUtils

feature/export_comptable
Guillaume 4年前
コミット
865d454616
4個のファイルの変更248行の追加0行の削除
  1. +94
    -0
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +64
    -0
      ShopBundle/Services/Price/OrderShopPriceUtils.php
  3. +36
    -0
      ShopBundle/Services/Price/PriceUtilsTrait.php
  4. +54
    -0
      ShopBundle/Services/Price/ProductPriceUtils.php

+ 94
- 0
ShopBundle/Services/Price/OrderProductPriceUtils.php ファイルの表示

@@ -0,0 +1,94 @@
<?php

namespace Lc\ShopBundle\Price\Services;

use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;

class OrderProductPriceUtils
{
use PriceUtilsTrait ;

protected $productPriceUtils ;

public function __construct(ProductPriceUtils $productPriceUtils)
{
$this->productPriceUtils = $productPriceUtils ;
}

public function getPrice(OrderProductInterface $orderProduct)
{

}

public function getPriceWithTax(OrderProductInterface $orderProduct)
{

}

public function getPriceWithTaxAndReduction(OrderProductInterface $orderProduct)
{

}

public function getPriceByRefUnit(OrderProductInterface $orderProduct)
{

}

public function getPriceByRefUnitWithTax(OrderProductInterface $orderProduct)
{

}

public function getPriceByRefUnitWithTaxAndReduction(OrderProductInterface $orderProduct)
{

}

public function getTotal(OrderProductInterface $orderProduct)
{

}

public function getTotalWithReductionCatalog(OrderProductInterface $orderProduct)
{

}

public function getTotalWithReductionCart(OrderProductInterface $orderProduct)
{

}

public function getTotalWithReductions(OrderProductInterface $orderProduct)
{

}

public function getTotalWithTax(OrderProductInterface $orderProduct)
{

}

public function getTotalWithTaxAndReductionCatalog(OrderProductInterface $orderProduct)
{

}

public function getTotalWithTaxAndReductionCart(OrderProductInterface $orderProduct)
{

}

public function getTotalWithTaxAndReductions(OrderProductInterface $orderProduct)
{

}
}


+ 64
- 0
ShopBundle/Services/Price/OrderShopPriceUtils.php ファイルの表示

@@ -0,0 +1,64 @@
<?php

namespace Lc\ShopBundle\Price\Services;

use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;

class OrderShopPriceUtils
{
use PriceUtilsTrait ;

protected $orderProductPriceUtils ;

public function __construct(OrderProductPriceUtils $orderProductPriceUtils)
{
$this->orderProductPriceUtils = $orderProductPriceUtils ;
}

public function getTotal(OrderShopInterface $orderShop)
{

}

public function getTotalWithReductionCatalog(OrderShopInterface $orderShop)
{

}

public function getTotalWithReductionCart(OrderShopInterface $orderShop)
{

}

public function getTotalWithReductions(OrderShopInterface $orderShop)
{

}

public function getTotalWithTax(OrderShopInterface $orderShop)
{

}

public function getTotalWithTaxAndReductionCatalog(OrderShopInterface $orderShop)
{

}

public function getTotalWithTaxAndReductionCart(OrderShopInterface $orderShop)
{

}

public function getTotalWithTaxAndReductions(OrderShopInterface $orderShop)
{

}
}


+ 36
- 0
ShopBundle/Services/Price/PriceUtilsTrait.php ファイルの表示

@@ -0,0 +1,36 @@
<?php

namespace Lc\ShopBundle\Price\Services;

trait PriceUtilsTrait
{
public function applyTax($price, $taxRateValue)
{
return $this->round($this->applyPercent($price, $taxRateValue));
}

public function applyReductionPercent($price, $percentage)
{
return $this->applyPercent($price, -$percentage);
}

public function applyReductionAmount($price, $amount)
{
return $price - $amount;
}

public function applyPercent($price, $percentage)
{
return $price * ($percentage / 100 + 1);
}

public function applyPercentNegative($price, $percentage)
{
return $price / ($percentage / 100 + 1);
}

public function round($price)
{
return round((($price * 100)) / 100, 2);
}
}

+ 54
- 0
ShopBundle/Services/Price/ProductPriceUtils.php ファイルの表示

@@ -0,0 +1,54 @@
<?php

namespace Lc\ShopBundle\Price\Services;

use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;

class ProductPriceUtils
{
use PriceUtilsTrait ;

public function getPrice(ProductPropertyInterface $product)
{
if ($product->getBehaviorPriceInherited() == 'by-piece') {
return $product->getPriceInherited();
}
elseif ($product->getBehaviorPriceInherited() == 'by-reference-unit') {
if ($product->getQuantityInherited() > 0) {
return $product->getPriceByRefUnitInherited() * ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient());
}
}
}

public function getPriceWithTax(ProductPropertyInterface $product)
{

}

public function getPriceWithTaxAndReduction(ProductPropertyInterface $product)
{

}

public function getPriceByRefUnit(ProductPropertyInterface $product)
{

}

public function getPriceByRefUnitWithTax(ProductPropertyInterface $product)
{

}

public function getPriceByRefUnitWithTaxAndReduction(ProductPropertyInterface $product)
{

}
}


読み込み中…
キャンセル
保存