Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Guillaume 4 years ago
parent
commit
14f38b3f52
4 changed files with 13 additions and 7 deletions
  1. +1
    -1
      ShopBundle/Controller/Backend/OrderController.php
  2. +1
    -1
      ShopBundle/Form/Backend/ReductionCommon/UnitType.php
  3. +6
    -0
      ShopBundle/Resources/views/backend/order/macros.html.twig
  4. +5
    -5
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 1
- 1
ShopBundle/Controller/Backend/OrderController.php View File

if ($formOrderReductionCredit->isSubmitted() && $formOrderReductionCredit->isValid()) { if ($formOrderReductionCredit->isSubmitted() && $formOrderReductionCredit->isValid()) {
$reductionCredit = $formOrderReductionCredit->get('reductionCredit')->getData(); $reductionCredit = $formOrderReductionCredit->get('reductionCredit')->getData();
$orderShop->reductionError = array(); $orderShop->reductionError = array();
if ($this->orderUtils->isReductionCreditAllowToBeAddToOrder($orderShop, $reductionCredit)) {
if ($this->orderUtils->isReductionCreditAllowAddToOrder($orderShop, $reductionCredit)) {
$orderReductionCredit = $this->orderUtils->createOrderReductionCredit($orderShop, $reductionCredit); $orderReductionCredit = $this->orderUtils->createOrderReductionCredit($orderShop, $reductionCredit);
$this->em->persist($orderReductionCredit); $this->em->persist($orderReductionCredit);
$this->em->flush(); $this->em->flush();

+ 1
- 1
ShopBundle/Form/Backend/ReductionCommon/UnitType.php View File

{ {
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
dump($options);
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event, $options) { $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event, $options) {
$builder = $event->getForm()->getParent(); $builder = $event->getForm()->getParent();



+ 6
- 0
ShopBundle/Resources/views/backend/order/macros.html.twig View File

<td>${orderReductionCart.amount}€</td> <td>${orderReductionCart.amount}€</td>
</tr> </tr>
</template> </template>
<template v-for="(orderReductionCredit, key) in order.orderReductionCredits">
<tr>
<th>${orderReductionCredit.title}</th>
<td>${orderReductionCredit.amount}€</td>
</tr>
</template>
<tr> <tr>
<th>Total produits après réductions TTC </th> <th>Total produits après réductions TTC </th>
<td>${order.totalOrderProductsWithTaxAndReductions}€</td> <td>${order.totalOrderProductsWithTaxAndReductions}€</td>

+ 5
- 5
ShopBundle/Services/Price/OrderShopPriceUtils.php View File

); );
} else if ($orderReductionCart->getUnit() == 'amount') { } else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$price = $orderReductionCart->getValue();
$amount = $orderReductionCart->getValue();
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { } else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$price = $orderReductionCart->getValue() / $this->getTaxRateAverage($order);
$amount = $this->round($orderReductionCart->getValue() / $this->getTaxRateAverage($order));
} }


} }
} }
elseif ($orderReductionCart->getUnit() == 'amount') { elseif ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage($order);
$amount = $this->round($orderReductionCart->getValue() * $this->getTaxRateAverage($order));
} }
elseif ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { elseif ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$amount = $orderReductionCart->getValue() ; $amount = $orderReductionCart->getValue() ;
$amount = $orderReductionCredit->getValue(); $amount = $orderReductionCredit->getValue();
} }
else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage($order);
$amount = $this->round($orderReductionCredit->getValue() / $this->getTaxRateAverage($order));
} }


return $amount; return $amount;
{ {
$amountWithTax = 0; $amountWithTax = 0;
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') {
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage($order);
$amountWithTax = $this->round($orderReductionCredit->getValue() * $this->getTaxRateAverage($order));
} }
elseif ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { elseif ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {
$amountWithTax = $orderReductionCredit->getValue(); $amountWithTax = $orderReductionCredit->getValue();

Loading…
Cancel
Save