Parcourir la source

[Administration] Distributions > CA : affichage du CA journalier en TTC et HT

feature/souke
Guillaume Bourgeois il y a 9 mois
Parent
révision
256cfeb9f1
3 fichiers modifiés avec 13 ajouts et 5 suppressions
  1. +5
    -1
      backend/controllers/DistributionController.php
  2. +5
    -2
      backend/views/distribution/index.php
  3. +3
    -2
      domain/Product/Product/ProductSolver.php

+ 5
- 1
backend/controllers/DistributionController.php Voir le fichier

@@ -288,19 +288,23 @@ class DistributionController extends BackendController

// montant et poids des commandes
$revenues = 0;
$revenuesWithTax = 0;
$weight = 0;
if ($ordersArray) {
foreach ($ordersArray as $order) {
$orderModule->initOrder($order);
if (is_null($order->date_delete)) {
$revenues += $orderModule->getOrderAmountWithTax($order);
$revenues += $orderModule->getOrderAmount($order);
$revenuesWithTax += $orderModule->getOrderAmountWithTax($order);
$weight += $order->weight;
}
}
}
$distributionJsonData['revenues'] = Price::format($revenues);
$distributionJsonData['revenues_with_tax'] = Price::format($revenuesWithTax);
$distributionJsonData['weight'] = number_format($weight, 2);
$distributionJsonData['potential_revenues'] = Price::format($productModule->getProductDistributionPotentialRevenues($productsArray));
$distributionJsonData['potential_revenues_with_tax'] = Price::format($productModule->getProductDistributionPotentialRevenues($productsArray, true));
$distributionJsonData['potential_weight'] = number_format($productModule->getProductDistributionPotentialWeight($productsArray), 2);

return $distributionJsonData;

+ 5
- 2
backend/views/distribution/index.php Voir le fichier

@@ -205,8 +205,11 @@ $this->setPageTitle('Distributions') ;
<div id="summary-ca-weight" class="info-box col-md-4">
<span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span>
<div class="info-box-content">
<span class="info-box-text">CA (TTC)</span>
<span class="info-box-number">{{ distribution.revenues }} <span class="normal" v-if="distribution.potential_revenues != '0,00 €'">/ {{ distribution.potential_revenues }}</span></span>
<span class="info-box-text">CA (HT)</span>
<span class="info-box-number">
<span data-toggle="tooltip" data-placement="bottom" :data-original-title="distribution.revenues_with_tax+' TTC'">{{ distribution.revenues }}</span>
<span class="normal" v-if="distribution.potential_revenues != '0,00 €'">/ <span data-toggle="tooltip" data-placement="bottom" :data-original-title="distribution.potential_revenues_with_tax+' TTC'">{{ distribution.potential_revenues }}</span></span>
</span>
<span class="info-box-text">Poids</span>
<span class="info-box-number">{{ distribution.weight }} kg <span class="normal" v-if="distribution.potential_weight > 0">/ {{ distribution.potential_weight }} kg</span></span>
</div>

+ 3
- 2
domain/Product/Product/ProductSolver.php Voir le fichier

@@ -275,13 +275,14 @@ class ProductSolver extends AbstractService implements SolverInterface
return $productArrayFilter;
}

public function getProductDistributionPotentialRevenues(array $productsArray)
public function getProductDistributionPotentialRevenues(array $productsArray, bool $withTax = false)
{
$potentialRevenues = 0;

foreach ($productsArray as $product) {
if (isset($product['productDistribution'][0]) && $product['productDistribution'][0]['active'] && $product['productDistribution'][0]['quantity_max']) {
$potentialRevenues += $product['productDistribution'][0]['quantity_max'] * $product['price'];
$price = $withTax ? $product['price_with_tax'] : $product['price'];
$potentialRevenues += $product['productDistribution'][0]['quantity_max'] * $price;
}
}


Chargement…
Annuler
Enregistrer