Przeglądaj źródła

Merge Export comptable

feature/tableau_edition_avancee
Fab 4 lat temu
rodzic
commit
7c09238d20
7 zmienionych plików z 123 dodań i 34 usunięć
  1. +10
    -0
      ShopBundle/Model/OrderShop.php
  2. +14
    -0
      ShopBundle/Repository/CreditHistoryRepository.php
  3. +2
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  4. +1
    -1
      ShopBundle/Resources/views/backend/default/layout/layout.html.twig
  5. +18
    -9
      ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig
  6. +76
    -22
      ShopBundle/Services/Price/OrderShopPriceUtils.php
  7. +2
    -2
      ShopBundle/Services/Price/PriceUtils.php

+ 10
- 0
ShopBundle/Model/OrderShop.php Wyświetl plik

@@ -513,6 +513,16 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
return $this;
}

public function getDocumentInvoice(): Document
{
foreach($this->getDocuments() as $document) {
if($document->getType() == Document::TYPE_INVOICE) {
return $document ;
}
}

return false ;
}

/**
* @return Collection|Ticket[]

+ 14
- 0
ShopBundle/Repository/CreditHistoryRepository.php Wyświetl plik

@@ -18,6 +18,20 @@ class CreditHistoryRepository extends BaseRepository implements DefaultRepositor
return CreditHistoryInterface::class;
}

public function findAllByDateStartEnd($merchant, $dateStart, $dateEnd)
{
return $this->createQueryBuilder('e')
->innerJoin('e.userMerchant', 'user_merchant')
->andWhere('user_merchant.merchant = :merchant')
->setParameter(':merchant', $merchant)
->andWhere('e.createdAt >= :dateStart')
->andWhere('e.createdAt <= :dateEnd')
->setParameter(':dateStart', $dateStart)
->setParameter(':dateEnd', $dateEnd)
->addOrderBy('e.createdAt', 'ASC')
->getQuery()->getResult();
}

public function findAllByUserMerchant($userMerchant)
{
return $this->createQueryBuilder('e')

+ 2
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml Wyświetl plik

@@ -279,6 +279,8 @@ field:
total: Total
products: Produits
purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs"
dateStart: Date de début
dateEnd: Date de fin

PointSale:
code: Code

+ 1
- 1
ShopBundle/Resources/views/backend/default/layout/layout.html.twig Wyświetl plik

@@ -186,7 +186,7 @@
</div>

{% block content_reminders %}
{% if reminders|length >0 %}
{% if reminders is defined and reminders|length >0 %}
<div class="head-reminders card card-outline card-danger">
{% include '@LcShop/backend/default/block/list_reminders.html.twig' %}
</div>

+ 18
- 9
ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig Wyświetl plik

@@ -66,12 +66,15 @@
</div>
{% endif %}#}

{# {% set labelHelp = 'field.'~easyadmin['entity']['name']~'.'~name~'Help' %}
{% if labelHelp|trans({}, 'lcshop') == labelHelp %}{% set labelHelp = 'form.field.default.'~name~'Help' %}{% endif %}
{% if labelHelp|trans({}, 'lcshop') != labelHelp %}
<small class="form-text text-muted">{{ labelHelp|trans({}, 'lcshop')|raw }}</small>

{% if easyadmin is defined %}
{% set labelHelp = 'field.'~easyadmin['entity']['name']~'.'~name~'Help' %}
{% if labelHelp|trans({}, 'lcshop') == labelHelp %}{% set labelHelp = 'form.field.default.'~name~'Help' %}{% endif %}
{% if labelHelp|trans({}, 'lcshop') != labelHelp %}
<small class="form-text text-muted">{{ labelHelp|trans({}, 'lcshop')|raw }}</small>
{% endif %}
{% endif %}
#}
{{- form_errors(form) -}}
</div>
</div>
@@ -127,14 +130,20 @@
{% if 'field.MerchantConfig.' in label %}
{% set name_trad = label|replace({'field.MerchantConfig.': ''}) %}
{% set trad = name_trad|lc_trad(easyadmin['entity']['name'], 'field') %}
{% elseif easyadmin['entity']['name'] is defined %}
{% set trad = name|lc_trad(easyadmin['entity']['name'], 'field') %}

{% else %}
{% set trad = label %}
{% if easyadmin is defined %}
{% set trad = name|lc_trad(easyadmin['entity']['name'], 'field') %}
{% else %}
{% set trad = name|lc_trad('', 'field') %}
{% endif %}

{% endif %}

{%- endif -%}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ trad }}</{{ element|default('label') }}>
{% if trad is defined %}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ trad }}</{{ element|default('label') }}>
{% endif %}
{%- endif -%}
{%- endblock form_label %}


+ 76
- 22
ShopBundle/Services/Price/OrderShopPriceUtils.php Wyświetl plik

@@ -30,7 +30,6 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}


//Inclus les ReductionCatalog des OrderProducts
public function getMarginOrderProducts(OrderShopInterface $orderShop): float
{
@@ -41,6 +40,33 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}

public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop): float
{
$total = $this->getMarginOrderProducts($orderShop);

$totalReductionAmount = 0;
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart);
}

foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit);
}

$total -= $totalReductionAmount;

return $total;
}

public function getMarginOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProductsWithReductions($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop) * 100);
} else {
return 0;
}
}

public function getMarginOrderProductsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
@@ -48,15 +74,33 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
} else {
return 0;
}

}

public function getBrandTaxesOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProducts($orderShop) / $this->getTotalBuyingPriceOrderProducts($orderShop->getOrderProducts()) * 100);
} else {
return 0;
}
}

public function getTotalOrderProductsWithTax(OrderShopInterface $orderShop): float
{
return $this->getTotalOrderProductsWithTaxByOrderProducts($orderShop->getOrderProducts());
}

public function getTotalBuyingPriceOrderProducts($orderProducts): float
{
$total = 0;

foreach ($orderProducts as $orderProduct) {
$total += $this->orderProductPriceUtils->getTotalBuyingPrice($orderProduct);
}

return $total;
}

public function getTotalBuyingPriceOrderProductsWithTax($orderProducts): float
{
$total = 0;
@@ -162,26 +206,6 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}


public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop): float
{
$total = $this->getMarginOrderProducts($orderShop);

$totalReductionAmount = 0;
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart);
}

foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit);
}

$total -= $totalReductionAmount;

return $total;
}


public function getTotalOrderProductsWithTaxAndReductionCarts(OrderShopInterface $orderShop)
{
$total = $this->getTotalOrderProductsWithTax($orderShop);
@@ -276,5 +300,35 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

return $amountWithTax;
}

public function getTotalReductions(OrderShopInterface $orderShop)
{
$total = 0 ;

foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$total += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart) ;
}

foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit) ;
}

return $total ;
}

public function getTotalReductionsWithTax(OrderShopInterface $orderShop)
{
$total = 0 ;

foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$total += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart) ;
}

foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit) ;
}

return $total ;
}
}


+ 2
- 2
ShopBundle/Services/Price/PriceUtils.php Wyświetl plik

@@ -35,7 +35,7 @@ class PriceUtils implements PriceUtilsInterface
$service = 'orderProductPriceUtils';
}

if ($entity instanceof OrderShopInterface || is_array($entity)) {
if ($entity instanceof OrderShopInterface || is_iterable($entity) || is_array($entity)) {
$service = 'orderShopPriceUtils';
}

@@ -51,7 +51,7 @@ class PriceUtils implements PriceUtilsInterface
}
} else {
if (!strlen($service)) {
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré.");
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré");
} else {
if (!method_exists($this->$service, $name)) {
throw new \ErrorException("PriceUtils : la méthode " . $name . " du service " . $service . " n'existe pas.");

Ładowanie…
Anuluj
Zapisz