Przeglądaj źródła

Nombre de commandes semaines passés

feature/export_comptable
Fab 4 lat temu
rodzic
commit
5084925134
2 zmienionych plików z 3 dodań i 41 usunięć
  1. +1
    -37
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +2
    -4
      ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig

+ 1
- 37
ShopBundle/Controller/Backend/ProductFamilyController.php Wyświetl plik

@@ -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;
}

}


+ 2
- 4
ShopBundle/Resources/views/backend/productfamily/panel_stock.html.twig Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz