浏览代码

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

master
Guillaume 4 年前
父节点
当前提交
88ee5a6a65
共有 3 个文件被更改,包括 8 次插入42 次删除
  1. +1
    -37
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +5
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  3. +2
    -4
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig

+ 1
- 37
ShopBundle/Controller/Backend/ProductFamilyController.php 查看文件

@@ -331,7 +331,7 @@ class ProductFamilyController extends AdminController
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
'sortableProductsField' => $sortableProductsField,
'totalProductOrdered' => $this->getTotalProductOrdered($entity)
'totalProductOrdered' => $this->orderUtils->getTotalProductOrderedLastWeeks($entity)
];

return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
@@ -413,42 +413,6 @@ class ProductFamilyController extends AdminController
}


public function getTotalProductOrdered($entity)
{
$orderShopRepo = $this->em->getRepository(OrderShopInterface::class);
$totalProductOrdered = array();
$currentWeekNumber = $this->orderUtils->getWeekNumberCurrentOrder();
$totalProductOrdered['total'][$currentWeekNumber +1] = 0;
$totalProductOrdered['total'][$currentWeekNumber ] = 0;

foreach ($entity->getProducts() as $product) {
//Les commandes sont ouvertes ont récupèrent les commandes en cours et celle de la semaine dernière
if ($this->orderUtils->isOpenSale()) {
$totalProductOrdered[$product->getId()][$currentWeekNumber +1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber +1, $product->getId());
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());

if ($entity->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE) {
$ratioByMeasure = $product->getQuantity() / $product->getUnitInherited()->getCoefficient();
$totalProductOrdered['total'][$currentWeekNumber +1] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber +1, $product->getId()) * $ratioByMeasure;
$totalProductOrdered['total'][$currentWeekNumber] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId()) * $ratioByMeasure;
} else {
$totalProductOrdered['total'][$currentWeekNumber +1] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber+1, $product->getId());
$totalProductOrdered['total'][$currentWeekNumber] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
}

} else {
$totalProductOrdered[$product->getId()][$currentWeekNumber +1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber+1, $product->getId());
if ($entity->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE) {
$ratioByMeasure = $product->getQuantity() / $product->getUnitInherited()->getCoefficient();
$totalProductOrdered['total'][$currentWeekNumber+1] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber+1, $product->getId()) * $ratioByMeasure;
}else{
$totalProductOrdered['total'][$currentWeekNumber+1] += $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber+1, $product->getId());
}
}

}
return $totalProductOrdered;
}

}


+ 5
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml 查看文件

@@ -223,6 +223,7 @@ field:
isPublic: Publique
isDepository: Dépôt
productCategories: Catégories
currentStock: Stock en cours
category: Catégorie
parent: Parent
date: Date
@@ -286,7 +287,9 @@ field:
priceByRefUnit: Prix de vente / unité de référence
buyingPriceByRefUnit: Prix d'achat / unité de référence
availableQuantity: Quantité disponible
availableQuantityDefault: Quantité disponible par défaut
currentStock: Stock actuel
totalOrdered: Historique des commandes
availableQuantityDefault: Quantité par défaut
quantity: Quantité
behaviorCountStock: Gestion du stock
differentSupplierTaxRate: TVA différente pour le producteur
@@ -335,6 +338,7 @@ field:
exportNote: Note à l'export
quantityLabel: Label quantité
quantityLabelHelp: Volumes / Poids .. (utiliser dans les caractéristiques du produit)
actions: Actions
Reduction:
usersActive: Filtrer sur les utilisateurs
groupUsersActive: Filtrer sur les groupes d'utilisateurs

+ 2
- 4
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig 查看文件

@@ -61,10 +61,8 @@
{{ form_help(form.availableQuantityDefault) }}
</div>
</div>
<p v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' ">
{% for quantityProductsOrder in totalProductOrdered %}
{{ product_family_macros.total_order_product(quantityProductsOrder) }}
{% endfor %}
<p v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' || behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}' ">
{{ product_family_macros.total_order_product_family(totalProductOrdered['total'], entity) }}
</p>
</div>


正在加载...
取消
保存