@@ -87,7 +87,7 @@ class DashboardAdminController extends BackendController | |||
public function actionAjaxStatisticsHtml() | |||
{ | |||
return \Yii::$app->cache->getOrSet('dashboard_statistics12', function () { | |||
return \Yii::$app->cache->getOrSet('dashboard_statistics14', function () { | |||
$producerModule = $this->getProducerModule(); | |||
$pointSaleModule = $this->getPointSaleModule(); | |||
$userModule = $this->getUserModule(); | |||
@@ -99,7 +99,7 @@ class DashboardAdminController extends BackendController | |||
$averageOrdersPerDay = $orderModule->countGlobalUserOrdersAverageLastSevenDays(); | |||
$turnoverLastThirtyDays = $orderModule->getRepository()->getTurnoverLastThirtyDays(); | |||
$resultMatomoApiVisitSummary = json_decode(file_get_contents(\Yii::$app->parameterBag->get('matomoApiVisitSummaryUrl'))); | |||
$numberVisitsDay = $resultMatomoApiVisitSummary->nb_uniq_visitors / 30; | |||
$numberVisitsDay = intval($resultMatomoApiVisitSummary->nb_uniq_visitors / 30); | |||
$amountBilledLastMonth = $producerModule->getRepository()->getAmountBilledLastMonth(); | |||
$amountToBillCurrentMonth = $producerModule->getRepository()->getAmountToBillCurrentMonth(); | |||
$amountProducerUnpaidInvoices = $producerModule->getDolibarrUtils()->getAmountProducerInvoicesUnpaid(); |
@@ -5,26 +5,6 @@ use common\helpers\Price; | |||
?> | |||
<div class="row"> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
Price::format($turnoverLastThirtyDays, 0), | |||
'CA producteurs sur les 30 derniers jours', | |||
'aqua', | |||
'line-chart', | |||
Yii::$app->urlManager->createUrl('stats-admin/turnover') | |||
) ?> | |||
</div> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
$averageOrdersPerDay, | |||
'Commandes clients / jour sur les 7 derniers jours', | |||
'aqua', | |||
'shopping-cart', | |||
Yii::$app->urlManager->createUrl('stats-admin/turnover') | |||
) ?> | |||
</div> | |||
</div> | |||
<div class="row"> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
@@ -52,6 +32,17 @@ use common\helpers\Price; | |||
'map-marker' | |||
) ?> | |||
</div> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
$averageOrdersPerDay, | |||
'Commandes clients / jour sur les 7 derniers jours', | |||
'aqua', | |||
'shopping-cart', | |||
Yii::$app->urlManager->createUrl('stats-admin/turnover') | |||
) ?> | |||
</div> | |||
</div> | |||
<div class="row"> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
$numberVisitsDay, | |||
@@ -60,6 +51,15 @@ use common\helpers\Price; | |||
'eye' | |||
) ?> | |||
</div> | |||
<div class="col-lg-6 col-xs-6"> | |||
<?= AdminLTE::smallBox( | |||
Price::format($turnoverLastThirtyDays, 0), | |||
'CA total producteurs sur les 30 derniers jours', | |||
'aqua', | |||
'line-chart', | |||
Yii::$app->urlManager->createUrl('stats-admin/turnover') | |||
) ?> | |||
</div> | |||
</div> | |||
<div class="row"> | |||
<div class="col-lg-6 col-xs-6"> |
@@ -36,7 +36,7 @@ class DolibarrProducerUtils extends AbstractManager | |||
$invoicesArray = $this->getDolibarrProducerInvoices($producer); | |||
foreach($invoicesArray as $invoice) { | |||
if($invoice['remaintopay'] > 0) { | |||
if(isset($invoice['remaintopay']) && $invoice['remaintopay'] > 0) { | |||
$unpaidInvoicesArray[] = $invoice; | |||
} | |||
} | |||
@@ -72,7 +72,9 @@ class DolibarrProducerUtils extends AbstractManager | |||
$unpaidInvoicesArray = $this->getDolibarrInvoicesUnpaid(); | |||
foreach($unpaidInvoicesArray as $unpaidInvoice) { | |||
$amount += $unpaidInvoice['remaintopay']; | |||
if(isset($unpaidInvoice['remaintopay'])) { | |||
$amount += $unpaidInvoice['remaintopay']; | |||
} | |||
} | |||
return $amount; |
@@ -185,7 +185,7 @@ class SiteController extends FrontendController | |||
public function actionAbout() | |||
{ | |||
$aboutFewNumbers = Yii::$app->cache->getOrSet('about_few_numbers7', function () { | |||
$aboutFewNumbers = Yii::$app->cache->getOrSet('about_few_numbers10', function () { | |||
$producerModule = $this->getProducerModule(); | |||
$pointSaleModule = $this->getPointSaleModule(); | |||
$userModule = $this->getUserModule(); | |||
@@ -197,17 +197,19 @@ class SiteController extends FrontendController | |||
$countPointSalesActive = $pointSaleModule->countPointSalesActiveLastThreeMonths(); | |||
$countUsersActive = $userModule->countUsersActiveLastThreeMonths(); | |||
$averageOrdersPerDay = $orderModule->countGlobalUserOrdersAverageLastSevenDays(); | |||
$averageTurnover = $orderModule->getAverageTurnoverLastThreeMonths(); | |||
// $averageTurnover = $orderModule->getAverageTurnoverLastThreeMonths(); | |||
$turnoverLastThirtyDays = $orderModule->getRepository()->getTurnoverLastThirtyDays(); | |||
$resultMatomoApiVisitSummary = json_decode(file_get_contents(Yii::$app->parameterBag->get('matomoApiVisitSummaryUrl'))); | |||
$numberVisitsMonth = $resultMatomoApiVisitSummary->nb_uniq_visitors; | |||
$numberVisitsByDay = intval($resultMatomoApiVisitSummary->nb_uniq_visitors / 30); | |||
return $this->renderPartial('_about_few_numbers', [ | |||
'countProducersActive' => $countProducersActive, | |||
'countPointSalesActive' => $countPointSalesActive, | |||
'countUsersActive' => $countUsersActive, | |||
'averageOrdersPerDay' => $averageOrdersPerDay, | |||
'averageTurnover' => $averageTurnover, | |||
'numberVisitsMonth' => $numberVisitsMonth, | |||
//'averageTurnover' => $averageTurnover, | |||
'turnoverLastThirtyDays' => $turnoverLastThirtyDays, | |||
'numberVisitsByDay' => $numberVisitsByDay, | |||
'timeSavedByProducersAverage' => $timeSavedByProducersAverage, | |||
'countProducersWithOptionTimeSaved' => $countProducersWithOptionTimeSaved | |||
]); |
@@ -15,13 +15,13 @@ | |||
<?= few_numbers_item(few_numbers_format_number($averageOrdersPerDay), 'Commandes clients / jour', 'en moyenne sur les 7 derniers jours'); ?> | |||
</div> | |||
<div class="row"> | |||
<?= few_numbers_item(few_numbers_format_number($averageTurnover).' €', 'CA producteurs / mois', 'moyenne sur les 3 derniers mois'); ?> | |||
<?= few_numbers_item(few_numbers_format_number($numberVisitsMonth), 'Visiteurs', 'le mois dernier'); ?> | |||
<?= few_numbers_item(few_numbers_format_number($numberVisitsByDay), 'Visiteurs / jour', 'en moyenne sur les 30 derniers jours'); ?> | |||
<?= few_numbers_item(few_numbers_format_number($turnoverLastThirtyDays).' €', 'CA total producteurs', 'sur les 30 derniers jours'); ?> | |||
</div> | |||
<?php if($countProducersWithOptionTimeSaved): ?> | |||
<div class="row"> | |||
<!--<div class="row"> | |||
<?= few_numbers_item($timeSavedByProducersAverage.' h', 'Heures gagnées par semaine', 'moyenne sur '.$countProducersWithOptionTimeSaved.' producteur'.(($countProducersWithOptionTimeSaved) ? 's' : '')); ?> | |||
</div> | |||
</div>--> | |||
<?php endif; ?> | |||
</div> | |||
</div> |