public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2) | public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2) | ||||
{ | { | ||||
$productsSalesStatistic = new ProductsSalesStatistic($this->entityManager, $entity, $nbWeek); | |||||
$productsSalesStatistic = new ProductsSalesStatistic($this->entityManager, $entity, $nbWeek, $this->productSolver); | |||||
$productsSalesStatistic->init($section, $this->orderShopSolver, $this->openingResolver); | $productsSalesStatistic->init($section, $this->orderShopSolver, $this->openingResolver); | ||||
$productsSalesStatistic->populateProperties($this->orderShopStore); | $productsSalesStatistic->populateProperties($this->orderShopStore); | ||||
} | } | ||||
} | |||||
} |
return $duplicateAction; | return $duplicateAction; | ||||
} | } | ||||
public function getCurrentSection(){ | |||||
return $this->get(SectionResolver::class)->getCurrent(); | |||||
} | |||||
} | } | ||||
*/ | */ | ||||
protected $behaviorStockCycle; | protected $behaviorStockCycle; | ||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $availabilityRenewedThisWeek; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAvailabilityRenewedThisWeek(): ?bool | |||||
{ | |||||
return $this->availabilityRenewedThisWeek; | |||||
} | |||||
public function setAvailabilityRenewedThisWeek(?bool $availabilityRenewedThisWeek): self | |||||
{ | |||||
$this->availabilityRenewedThisWeek = $availabilityRenewedThisWeek; | |||||
return $this; | |||||
} | |||||
public function getBehaviorDisplaySale(): ?string | public function getBehaviorDisplaySale(): ?string | ||||
{ | { | ||||
return $this->behaviorDisplaySale; | return $this->behaviorDisplaySale; |
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | ||||
{ | { | ||||
if($this->section) { | |||||
$query->filterBySection($this->section); | |||||
} | |||||
$query->filterBySection($this->section); | |||||
return $query; | return $query; | ||||
} | } | ||||
import Chart from 'chart'; | |||||
export class CaracStatistics { | export class CaracStatistics { | ||||
static initBtnShowTotalOrderProduct(){ | static initBtnShowTotalOrderProduct(){ | ||||
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ | $('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ | ||||
$btn = $(this); | |||||
var $btn = $(this); | |||||
var url = $(this).data('url'); | var url = $(this).data('url'); | ||||
$('#modal-products-sales-statistic').remove(); | $('#modal-products-sales-statistic').remove(); | ||||
$.ajax({ | $.ajax({ | ||||
success: function (response) { | success: function (response) { | ||||
$('body').append(response.data); | $('body').append(response.data); | ||||
$('#modal-products-sales-statistic').modal('show'); | $('#modal-products-sales-statistic').modal('show'); | ||||
initModalProductsSalesStatistic(response.statistics); | |||||
CaracStatistics.initModalProductsSalesStatistic(response.statistics); | |||||
} | } | ||||
}); | }); | ||||
}); | }); | ||||
$('#table-products-sales-statistic-'+$(this).data('property-name')).show() | $('#table-products-sales-statistic-'+$(this).data('property-name')).show() | ||||
if (chart) chart.destroy(); | if (chart) chart.destroy(); | ||||
$(this).removeClass('btn-secondary'); | $(this).removeClass('btn-secondary'); | ||||
chart = drawProductsSalesStatistic(statistics,$(this).data('property-name')) | |||||
chart = CaracStatistics.drawProductsSalesStatistic(statistics,$(this).data('property-name')) | |||||
}); | }); | ||||
$('.btn-products-sales-statistic').first().click(); | $('.btn-products-sales-statistic').first().click(); | ||||
flash_message: | flash_message: | ||||
error: | |||||
formValidation: Une erreur est survenue lors de la soumission du formulaire | |||||
settings_saved: Paramètres mis à jour | settings_saved: Paramètres mis à jour | ||||
duplicateToOtherMerchant: "Le document a bien été dupliqué sur le marchand : %merchant%" | duplicateToOtherMerchant: "Le document a bien été dupliqué sur le marchand : %merchant%" | ||||
duplicateToOtherSection: "Le document a bien été dupliqué sur la section : %section%" | duplicateToOtherSection: "Le document a bien été dupliqué sur la section : %section%" | ||||
favorite: Définir comme favoris | favorite: Définir comme favoris | ||||
duplicateToOtherMerchant: Dupliquer sur un autre marchand | duplicateToOtherMerchant: Dupliquer sur un autre marchand | ||||
duplicateToOtherSection: Dupliquer sur une autre section | duplicateToOtherSection: Dupliquer sur une autre section | ||||
editProductFamily: Éditer le produit | |||||
setting_definition: | setting_definition: | ||||
merchant: | merchant: |
{% embed "@LcSov/adminlte/embed/modal.twig" %} | {% embed "@LcSov/adminlte/embed/modal.twig" %} | ||||
{% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} | {% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} | ||||
{% trans_default_domain 'lcshop' %} | |||||
{% block size %}modal-lg{% endblock %} | {% block size %}modal-lg{% endblock %} | ||||
{% block id %}modal-products-sales-statistic{% endblock %} | {% block id %}modal-products-sales-statistic{% endblock %} | ||||
{% block title %}Total ventes/semaines : {{ productFamily.title }}{% endblock %} | {% block title %}Total ventes/semaines : {{ productFamily.title }}{% endblock %} |
$solver = $this->getSolver($product); | $solver = $this->getSolver($product); | ||||
if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { | if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { | ||||
dump($product); | |||||
return $solver->getBuyingPriceInherited($product); | return $solver->getBuyingPriceInherited($product); | ||||
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { | } elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { | ||||
if ($solver->getQuantityInherited($product) > 0) { | if ($solver->getQuantityInherited($product) > 0) { |
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | ||||
use Lc\CaracoleBundle\Resolver\OpeningResolver; | use Lc\CaracoleBundle\Resolver\OpeningResolver; | ||||
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | ||||
use Lc\CaracoleBundle\Solver\Product\ProductSolver; | |||||
use Lc\CaracoleBundle\Statistic\Statistic; | use Lc\CaracoleBundle\Statistic\Statistic; | ||||
class ProductsSalesStatistic extends Statistic | class ProductsSalesStatistic extends Statistic | ||||
protected $productFamily; | protected $productFamily; | ||||
protected $cycleNumbers = array(); | protected $cycleNumbers = array(); | ||||
protected $productIds = array(); | protected $productIds = array(); | ||||
protected ProductSolver $productSolver; | |||||
public function __construct(EntityManagerInterface $entityManager, $productFamily, $nbCycle) | |||||
public function __construct(EntityManagerInterface $entityManager, $productFamily, $nbCycle, ProductSolver $productSolver) | |||||
{ | { | ||||
parent::__construct($entityManager); | parent::__construct($entityManager); | ||||
$this->nbCycle = $nbCycle; | $this->nbCycle = $nbCycle; | ||||
$this->productFamily = $productFamily; | $this->productFamily = $productFamily; | ||||
$this->productSolver = $productSolver; | |||||
$this->createProperties(); | $this->createProperties(); | ||||
} | } | ||||
$this->setData($result['productId'], $result['cycleNumber'], $result['quantity']); | $this->setData($result['productId'], $result['cycleNumber'], $result['quantity']); | ||||
$product = $this->productIds[$result['productId']]; | $product = $this->productIds[$result['productId']]; | ||||
if ($this->productFamily->getBehaviorDisplaySale() == ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE) { | if ($this->productFamily->getBehaviorDisplaySale() == ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE) { | ||||
$ratioByMeasure = $product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient(); | |||||
$ratioByMeasure = $this->productSolver->getQuantityInherited($product) / $this->productSolver->getUnitInherited($product)->getCoefficient(); | |||||
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']) * $ratioByMeasure); | $this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']) * $ratioByMeasure); | ||||
} else { | } else { | ||||
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity'])); | $this->setData('total_sales', $result['cycleNumber'], intval($result['quantity'])); |
<?php | |||||
namespace Lc\CaracoleBundle\Twig; | |||||
use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | |||||
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | |||||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | |||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore; | |||||
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | |||||
use Lc\CaracoleBundle\Repository\Section\SectionStore; | |||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||||
use Lc\CaracoleBundle\Resolver\VisitorResolver; | |||||
use Lc\SovBundle\Solver\Setting\SettingSolver; | |||||
use Symfony\Component\Security\Core\Security; | |||||
use Twig\Extension\AbstractExtension; | |||||
use Twig\TwigFunction; | |||||
class ToolsTwigExtension extends AbstractExtension | |||||
{ | |||||
public function getFunctions() | |||||
{ | |||||
return array( | |||||
new TwigFunction('die', [$this, 'simuleDie']), | |||||
); | |||||
} | |||||
public function simuleDie(string $message = null) | |||||
{ | |||||
die($message); | |||||
} | |||||
} |