瀏覽代碼

Merge branch 'develop'

master
Guillaume Bourgeois 7 月之前
父節點
當前提交
4a18ccd598
共有 15 個文件被更改,包括 102 次插入113927 次删除
  1. +2
    -2
      backend/controllers/DashboardAdminController.php
  2. +8
    -13
      backend/controllers/DocumentController.php
  3. +20
    -20
      backend/views/dashboard-admin/_statistics.php
  4. +10
    -0
      backend/views/document/download.php
  5. +2
    -2
      backend/web/js/vuejs/distribution-index.js
  6. +1
    -1
      common/config/params.php
  7. +26
    -0
      common/versions/24.4.A.php
  8. +1
    -1
      domain/Distribution/Distribution/Export/DistributionReportGridPdfGenerator.php
  9. +1
    -1
      domain/Distribution/Distribution/Export/DistributionReportPdfGenerator.php
  10. +15
    -0
      domain/Document/DeliveryNote/DeliveryNoteRepository.php
  11. +1
    -0
      domain/Document/Invoice/InvoiceSolver.php
  12. +4
    -2
      domain/Producer/Producer/DolibarrProducerUtils.php
  13. +7
    -5
      frontend/controllers/SiteController.php
  14. +4
    -4
      frontend/views/site/_about_few_numbers.php
  15. +0
    -113876
      producer/runtime/logs/app.log

+ 2
- 2
backend/controllers/DashboardAdminController.php 查看文件

@@ -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();

+ 8
- 13
backend/controllers/DocumentController.php 查看文件

@@ -416,7 +416,8 @@ class DocumentController extends BackendController
$documentModule = $this->getDocumentModule();
$orderModule = $this->getOrderModule();
$producerModule = $this->getProducerModule();
$producerCurrent = $this->getProducerCurrent();
$invoiceModule = $this->getInvoiceModule();
$deliveryNoteModule = $this->getDeliveryNoteModule();

\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

@@ -441,25 +442,19 @@ class DocumentController extends BackendController
];

if ($classDocument == 'Invoice') {
$options = [
'orderby' => 'distribution.date ASC',
'join_with' => ['user AS user_delivery_note', 'orders', 'producer']
];
$deliveryNotesCreateArray = DeliveryNote::searchAll([
'id_user' => $user->id,
'status' => Document::STATUS_VALID,
'ignore_when_invoicing' => null
], $options);
$deliveryNotesUpdateArray = DeliveryNote::searchAll([
'id_user' => $user->id,
'status' => Document::STATUS_VALID,
'order.id_invoice' => $idDocument,
'ignore_when_invoicing' => null
], $options);
], [
'orderby' => 'distribution.date ASC',
'join_with' => ['user AS user_delivery_note', 'orders', 'producer']
]);
$invoice = $idDocument ? $invoiceModule->getRepository()->findOneInvoiceById($idDocument) : null;
$deliveryNotesUpdateArray = $invoice ? $deliveryNoteModule->getRepository()->findDeliveryNotesByInvoice($invoice) : null;
$json['delivery_note_create_array'] = $this->initDeliveryNoteArray('create', $deliveryNotesCreateArray);
$json['delivery_note_update_array'] = $this->initDeliveryNoteArray('update', $deliveryNotesUpdateArray);


$json['orders_create_array'] = [];
$json['orders_update_array'] = [];
if(!$producerModule->getConfig('option_invoice_only_based_on_delivery_notes')) {

+ 20
- 20
backend/views/dashboard-admin/_statistics.php 查看文件

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

+ 10
- 0
backend/views/document/download.php 查看文件

@@ -8,6 +8,7 @@ $producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();
$documentModule = $this->getDocumentModule();
$orderModule = $this->getOrderModule();
$deliveryNoteModule = $this->getDeliveryNoteModule();

$isDocumentDeliveryNote = $documentModule->getSolver()->isDocumentDeliveryNote($document);
$displayPrices = !$isDocumentDeliveryNote || ($isDocumentDeliveryNote && $producerModule->getConfig('document_display_prices_delivery_note'));
@@ -68,6 +69,15 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
<strong>Libellé : </strong>
<?= $document->name; ?>
</div>
<?php if ($documentModule->getSolver()->isDocumentInvoice($document)): ?>
<?php $deliveryNotesUpdateArray = $deliveryNoteModule->getRepository()->findDeliveryNotesByInvoice($document); ?>
<?php if($deliveryNotesUpdateArray && count($deliveryNotesUpdateArray)): ?>
<strong>Bons de livraison : </strong>
<?php foreach($deliveryNotesUpdateArray as $key => $deliveryNote): ?>
<?= $deliveryNote->reference ?><?php if ($key !== array_key_last($deliveryNotesUpdateArray)): ?>, <?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<?php if (strlen($document->comment)): ?>
<div class="comment">
<br>

+ 2
- 2
backend/web/js/vuejs/distribution-index.js 查看文件

@@ -655,7 +655,7 @@ var app = new Vue({
totalActivePointSale: function () {
var total = 0;
for (var i = 0; i < this.orders.length; i++) {
if (this.orders[i].id_point_sale == this.idActivePointSale) {
if (this.orders[i].id_point_sale == this.idActivePointSale && !this.orders[i].date_delete) {
total += parseFloat(this.orders[i].amount);
}
}
@@ -664,7 +664,7 @@ var app = new Vue({
weightActivePointSale: function () {
var weight = 0;
for (var i = 0; i < this.orders.length; i++) {
if (this.orders[i].id_point_sale == this.idActivePointSale) {
if (this.orders[i].id_point_sale == this.idActivePointSale && !this.orders[i].date_delete) {
weight += parseFloat(this.orders[i].weight);
}
}

+ 1
- 1
common/config/params.php 查看文件

@@ -37,7 +37,7 @@
*/

return [
'version' => '24.3.A',
'version' => '24.4.A',
'maintenanceMode' => false,
'siteName' => 'Opendistrib',
'tinyMcePlugins' => 'preview searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link lists wordcount help',

+ 26
- 0
common/versions/24.4.A.php 查看文件

@@ -0,0 +1,26 @@
<?php

require_once dirname(__FILE__).'/_macros.php';

version(
'15/04/2024',
[
[
"[Administration] Distributions > Exports PDF : ajout heure exate de génération des exports",
"[Administration] Factures : intégration des numéros de BL",
],
[
"[Administration] Distributions : correctif CA par point de vente",
"[Site] À propos : correctif chiffres"
]
],
[
[
],
[
]
],
$userCurrent
);

?>

+ 1
- 1
domain/Distribution/Distribution/Export/DistributionReportGridPdfGenerator.php 查看文件

@@ -148,7 +148,7 @@ class DistributionReportGridPdfGenerator extends AbstractGenerator implements Di
',
'methods' => [
'SetHeader' => ['Commandes du ' . $dateStr],
'SetFooter' => ['{PAGENO}'],
'SetFooter' => ['Généré le {DATE j/m/Y à H:i} / Page {PAGENO}/{nbpg}'],
]
]);


+ 1
- 1
domain/Distribution/Distribution/Export/DistributionReportPdfGenerator.php 查看文件

@@ -126,7 +126,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator implements Distri
',
'methods' => [
'SetHeader' => ['Commandes du ' . date('d/m/Y', strtotime($distribution->date))],
'SetFooter' => ['{PAGENO}'],
'SetFooter' => ['Généré le {DATE j/m/Y à H:i} / Page {PAGENO}/{nbpg}'],
]
]);


+ 15
- 0
domain/Document/DeliveryNote/DeliveryNoteRepository.php 查看文件

@@ -2,6 +2,8 @@

namespace domain\Document\DeliveryNote;

use domain\Document\Document\Document;
use domain\Document\Invoice\Invoice;
use domain\Order\Order\Order;
use domain\_\AbstractRepository;

@@ -55,4 +57,17 @@ class DeliveryNoteRepository extends AbstractRepository

return $deliveryNoteExist;
}

public function findDeliveryNotesByInvoice(Invoice $invoice): array
{
return DeliveryNote::searchAll([
'id_user' => $invoice->id_user,
'status' => Document::STATUS_VALID,
'order.id_invoice' => $invoice->id,
'ignore_when_invoicing' => null
], [
'orderby' => 'distribution.date ASC',
'join_with' => ['user AS user_delivery_note', 'orders', 'producer']
]);
}
}

+ 1
- 0
domain/Document/Invoice/InvoiceSolver.php 查看文件

@@ -23,4 +23,5 @@ class InvoiceSolver extends DocumentSolver
{
return $this->getInvoiceAmountPaid($invoice) >= Price::numberTwoDecimals($this->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL));
}

}

+ 4
- 2
domain/Producer/Producer/DolibarrProducerUtils.php 查看文件

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

+ 7
- 5
frontend/controllers/SiteController.php 查看文件

@@ -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
]);

+ 4
- 4
frontend/views/site/_about_few_numbers.php 查看文件

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

+ 0
- 113876
producer/runtime/logs/app.log
文件差異過大導致無法顯示
查看文件


Loading…
取消
儲存