✨ feat(Dashboard): Affiche le CA actuel, le CA prévu et l'écart sur le tableau de bord.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Controller\Artemis;
|
|||||||
use App\Controller\Artemis\Intranet\FaultController;
|
use App\Controller\Artemis\Intranet\FaultController;
|
||||||
use App\Entity\Customer;
|
use App\Entity\Customer;
|
||||||
use App\Entity\CustomerAdvertPayment;
|
use App\Entity\CustomerAdvertPayment;
|
||||||
|
use App\Entity\CustomerOrder;
|
||||||
use App\Repository\ComputeRepository;
|
use App\Repository\ComputeRepository;
|
||||||
use App\Repository\CustomerAdvertPaymentRepository;
|
use App\Repository\CustomerAdvertPaymentRepository;
|
||||||
use App\Repository\CustomerDevisRepository;
|
use App\Repository\CustomerDevisRepository;
|
||||||
@@ -127,7 +128,23 @@ class DashboardController extends AbstractController
|
|||||||
}
|
}
|
||||||
$faults = $faults + $sub;
|
$faults = $faults + $sub;
|
||||||
}
|
}
|
||||||
|
$totalCaPrevu = 0;
|
||||||
|
foreach ($customerAdvertPaymentRepository->currentMonth() as $payment) {
|
||||||
|
$sub = 0;
|
||||||
|
foreach ($payment->getCustomerAdvertPaymentLines() as $line) {
|
||||||
|
$sub = $sub + $line->getPriceHt()*1.20;
|
||||||
|
}
|
||||||
|
$totalCaPrevu = $totalCaPrevu + $sub;
|
||||||
|
}
|
||||||
|
$totalCaCurrent= 0;
|
||||||
|
/** @var CustomerOrder $payment */
|
||||||
|
foreach ($customerOrderRepository->currentMonth() as $payment) {
|
||||||
|
$sub = 0;
|
||||||
|
foreach ($payment->getCustomerOrderLines() as $line) {
|
||||||
|
$sub = $sub + $line->getPriceHt()*1.20;
|
||||||
|
}
|
||||||
|
$totalCaCurrent = $totalCaCurrent + $sub;
|
||||||
|
}
|
||||||
return $this->render('artemis/dashboard.twig',[
|
return $this->render('artemis/dashboard.twig',[
|
||||||
'invoiceList' => $invoiceList,
|
'invoiceList' => $invoiceList,
|
||||||
'advertList' => $advertList,
|
'advertList' => $advertList,
|
||||||
@@ -136,6 +153,9 @@ class DashboardController extends AbstractController
|
|||||||
'remaining_amount' => $remaining_amount,
|
'remaining_amount' => $remaining_amount,
|
||||||
'servers' => $servers,
|
'servers' => $servers,
|
||||||
'dns' => $dns,
|
'dns' => $dns,
|
||||||
|
'totalCaPrevu' => $totalCaPrevu,
|
||||||
|
'totalCaCurrent' => $totalCaCurrent,
|
||||||
|
'diffCa' => $totalCaPrevu - $totalCaCurrent,
|
||||||
'faults' => $faults,
|
'faults' => $faults,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,18 @@ class CustomerAdvertPaymentRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
|
public function currentMonth()
|
||||||
|
{
|
||||||
|
$t = new \DateTime();
|
||||||
|
$t->setDate($t->format('Y'), $t->format('m'),1);
|
||||||
|
$tV = new \DateTime();
|
||||||
|
$tV->setDate($t->format('Y'), $t->format('m'),31);
|
||||||
|
return $this->createQueryBuilder('cp')
|
||||||
|
->andWhere('cp.createAt BETWEEN :start AND :end')
|
||||||
|
->setParameter('start',$t)
|
||||||
|
->setParameter('end', $tV)
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,17 @@ class CustomerOrderRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
|
public function currentMonth()
|
||||||
|
{
|
||||||
|
$t = new \DateTime();
|
||||||
|
$t->setDate($t->format('Y'), $t->format('m'),1);
|
||||||
|
$tV = new \DateTime();
|
||||||
|
$tV->setDate($t->format('Y'), $t->format('m'),31);
|
||||||
|
return $this->createQueryBuilder('cp')
|
||||||
|
->andWhere('cp.createAt BETWEEN :start AND :end')
|
||||||
|
->setParameter('start',$t)
|
||||||
|
->setParameter('end', $tV)
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,12 +160,12 @@
|
|||||||
|
|
||||||
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
||||||
<p class="text-sm text-gray-500 dark:text-gray-400">CA En Cours</p>
|
<p class="text-sm text-gray-500 dark:text-gray-400">CA En Cours</p>
|
||||||
<p class="text-2xl font-bold text-green-500">0 €</p>
|
<p class="text-2xl font-bold text-green-500">{{ totalCaCurrent|format_currency('EUR') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
||||||
<p class="text-sm text-gray-500 dark:text-gray-400">CA Prévu</p>
|
<p class="text-sm text-gray-500 dark:text-gray-400">CA Prévu</p>
|
||||||
<p class="text-2xl font-bold text-blue-400">0 €</p>
|
<p class="text-2xl font-bold text-blue-400">{{ totalCaPrevu|format_currency('EUR') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800">
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800 border-l-4 border-yellow-500">
|
<div class="p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800 border-l-4 border-yellow-500">
|
||||||
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Écart / Objectif Prévu</p>
|
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Écart / Objectif Prévu</p>
|
||||||
<p class="text-2xl font-bold text-yellow-500">
|
<p class="text-2xl font-bold text-yellow-500">
|
||||||
0 €
|
{{ diffCa|format_currency('EUR') }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
<p class="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
||||||
(Reste à atteindre ce mois)
|
(Reste à atteindre ce mois)
|
||||||
@@ -294,11 +294,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<p class="text-sm text-gray-600 dark:text-gray-400">Total Coûts / CA :</p>
|
<p class="text-sm text-gray-600 dark:text-gray-400">Total Coûts / CA :</p>
|
||||||
<p class="text-xl font-bold text-green-500">63.5%</p>
|
<p class="text-xl font-bold text-green-500">0%</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs text-gray-400 dark:text-gray-500 mt-3">
|
<p class="text-xs text-gray-400 dark:text-gray-500 mt-3">
|
||||||
(Coût Infra 28.5% + Coût Salarial 35.0%)
|
(Coût Infra 0% + Coût Salarial 0%)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user