瀏覽代碼

[Administration] Distributions > Récapitulatif commandes : ajout d'une colonne BL #1184

feature/souke
Guillaume Bourgeois 1 年之前
父節點
當前提交
fe8b7e6441
共有 7 個文件被更改,包括 347 次插入293 次删除
  1. +0
    -257
      backend/views/distribution/report.php
  2. +5
    -0
      backend/views/producer/update.php
  3. +1
    -8
      common/logic/Distribution/Distribution/Service/DistributionReportGridPdfGenerator.php
  4. +293
    -23
      common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php
  5. +18
    -3
      common/logic/Order/Order/Service/OrderSolver.php
  6. +4
    -2
      common/logic/Producer/Producer/Model/Producer.php
  7. +26
    -0
      console/migrations/m230906_060202_add_column_producer_option_export_display_column_delivery_note.php

+ 0
- 257
backend/views/distribution/report.php 查看文件

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

/**
Copyright distrib (2018)

contact@opendistrib.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/


use common\helpers\Price;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Wrapper\ProductManager;
use common\logic\User\UserProducer\Model\UserProducer;

$productManager = ProductManager::getInstance();
$orderManager = OrderManager::getInstance();

$dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek];
$html = '' ;
$count = count($productsArray) ;
$limit = 100 ;
$isBig = $count > $limit ;

// par point de vente
foreach ($pointsSaleArray as $pointSale) {
if (count($pointSale->orders)) {
$html .= '<h3>'.$pointSale->name.'</h3>' ;
$colCredit = ($pointSale->credit) ? '<th>Crédit</th>' : '' ;
$html .= '<table class="">'
. '<thead>'
. '<tr>'
. '<th>Client</th>'
. '<th>Produits</th>'
. ($isBig ? '<th>Produits</th>' : '')
. '<th>Commentaire</th>'
. $colCredit
. '<th>Montant</th>'
. '</tr>'
. '<tbody>';
foreach ($pointSale->orders as $order) {
$html .= '<tr>' ;
$strUser = '';

// username
$strUser .= $orderManager->getOrderUsername($order) ;
if(strlen($order->comment_point_sale))
{
$strUser .= '<br /><em>'.$order->comment_point_sale.'</em>' ;
}
// téléphone
if (isset($order->user) && strlen($order->user->phone)) {
$strUser .= '<br />' . $order->user->phone . '';
}

// référence
if($producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY && $order->reference && strlen($order->reference) > 0) {
$strUser .= '<br />'.$order->reference ;
}

$html .= '<td>'.$strUser.'</td>';
// produits
$strProducts = '';
foreach ($productsArray as $product) {
$add = false;
foreach ($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = ( $productManager->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= '('.$productOrder->quantity .$unit.') '.$productManager->getNameExport($product) . '<br />';
$add = true;
}
}
}
$html .= '<td>'.substr($strProducts, 0, strlen($strProducts) - 6).'</td>';
if($isBig) {
$html .= '<td></td>' ;
}
$html .= '<td>'.$orderManager->getCommentReport($order).'</td>';
if($pointSale->credit) {
$credit = '' ;

if(isset($order->user) && $order->user->id) {
$userProducer = UserProducer::searchOne([
'id_user' => $order->user->id
]);

if($userProducer) {
$credit = number_format($userProducer->credit,2).' €' ;
}
}

$html .= '<td>'.$credit.'</td>' ;
}
$html .= '<td><strong>'.number_format($order->amount_with_tax, 2) . ' € ';

if($orderManager->getPaymentStatus($order) == Order::PAYMENT_PAID)
{
$html .= '(débité)' ;
}
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_UNPAID && $orderManager->getOrderAmount($order, Order::AMOUNT_PAID))
{
$html .= '(reste '.$orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING, true).' à débiter)' ;
}
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{
$html .= '(surplus : '.$orderManager->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à recréditer)' ;
}
$html .= '</strong></td>' ;
$html .= '</tr>' ;
}

$html .= '<tr><td><strong>Total</strong></td>' ;
$strProducts = '';
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $orderManager->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$strProducts .= '(' .$quantity .$theUnit.') '.$productManager->getNameExport($product) . '<br />';
}
}

if($isBig && $cpt == $limit) {
$strProducts .= '</td><td>' ;
}

$cpt ++ ;
}

$html .= '<td>'.$strProducts.'</td><td></td>' ;
if($pointSale->credit) {
$html .= '<td></td>' ;
}
$html .= '<td><strong>'.Price::format($pointSale->revenues_with_tax) . '</strong></td>';
$html .= '</tbody></table><pagebreak>' ;
}
}

// par point de vente

$html .= '<h3>Points de vente</h3>' ;
$html .= '<table class="">'
. '<thead>'
. '<tr>'
. '<th>Point de vente</th>'
. '<th>Produits</th>'
. ( $isBig ? '<th>Produits</th>' : '')
. '<th>Montant</th>'
. '</tr>'
. '<tbody>';

$revenues = 0 ;
foreach ($pointsSaleArray as $pointSale)
{
if (count($pointSale->orders))
{
$html .= '<tr><td>'.$pointSale->name.'</td><td>' ;

$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $orderManager->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$productManager->getNameExport($product) . '<br />';
}
}

if($isBig && $cpt == $limit) {
$html .= '</td><td>' ;
}

$cpt ++ ;
}
//$html = substr($html, 0, strlen($html) - 6) ;
$html .= '</td><td>'.Price::format($pointSale->revenues_with_tax, 2).'</td></tr>' ;
$revenues += $pointSale->revenues_with_tax ;
}
}

// total
$html .= '<tr><td><strong>Total</strong></td><td>' ;

$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $orderManager->getProductQuantity($product, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->name . '<br />';
}
}
if($isBig && $cpt == $limit) {
$html .= '</td><td>' ;
}

$cpt ++ ;
}

$html .= '</td><td><strong>'.number_format($revenues, 2).' €</strong></td></tr>' ;

$html .= '</tbody></table>' ;

echo $html ;

?>

+ 5
- 0
backend/views/producer/update.php 查看文件

@@ -306,6 +306,11 @@ $this->addBreadcrumb($this->getTitle());
0 => 'Non',
1 => 'Oui'
], []); ?>
<?= $form->field($model, 'option_export_display_column_delivery_note')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>

<h4>Divers</h4>
<?= $form->field($model, 'option_order_reference_type')

+ 1
- 8
common/logic/Distribution/Distribution/Service/DistributionReportGridPdfGenerator.php 查看文件

@@ -78,7 +78,6 @@ class DistributionReportGridPdfGenerator extends AbstractGenerator
$orientationPdf = Pdf::ORIENT_LANDSCAPE;
}

// get your HTML raw content without any layouts or scripts
$content = \Yii::$app->getView()->render($viewPdf, [
'date' => $distribution->date,
'distribution' => $distribution,
@@ -92,17 +91,11 @@ class DistributionReportGridPdfGenerator extends AbstractGenerator

$dateStr = date('d/m/Y', strtotime($distribution->date));

if ($save) {
$destination = Pdf::DEST_FILE;
} else {
$destination = Pdf::DEST_BROWSER;
}

$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => $orientationPdf,
'destination' => $destination,
'destination' => $save ? Pdf::DEST_FILE : Pdf::DEST_BROWSER,
'filename' => \Yii::getAlias(
'@app/web/pdf/Commandes-' . $distribution->date . '-' . $producer->id . '.pdf'
),

+ 293
- 23
common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php 查看文件

@@ -2,22 +2,36 @@

namespace common\logic\Distribution\Distribution\Service;

use common\helpers\Price;
use common\logic\AbstractGenerator;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository;
use common\logic\Document\Document\Service\DocumentSolver;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Repository\OrderRepository;
use common\logic\Order\Order\Service\OrderBuilder;
use common\logic\Order\Order\Service\OrderSolver;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\PointSale\PointSale\Repository\PointSaleRepository;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Repository\ProductRepository;
use common\logic\Product\Product\Service\ProductSolver;
use common\logic\User\UserProducer\Model\UserProducer;
use kartik\mpdf\Pdf;

class DistributionReportPdfGenerator extends AbstractGenerator
{
const LIMIT_PRODUCTS = 100;

protected OrderRepository $orderRepository;
protected OrderBuilder $orderBuilder;
protected ProductRepository $productRepository;
protected ProductDistributionRepository $productDistributionRepository;
protected PointSaleRepository $pointSaleRepository;
protected OrderSolver $orderSolver;
protected ProductSolver $productSolver;
protected DocumentSolver $documentSolver;

public function loadDependencies(): void
{
@@ -26,6 +40,9 @@ class DistributionReportPdfGenerator extends AbstractGenerator
$this->productRepository = $this->loadService(ProductRepository::class);
$this->productDistributionRepository = $this->loadService(ProductDistributionRepository::class);
$this->pointSaleRepository = $this->loadService(PointSaleRepository::class);
$this->orderSolver = $this->loadService(OrderSolver::class);
$this->productSolver = $this->loadService(ProductSolver::class);
$this->documentSolver = $this->loadService(DocumentSolver::class);
}

public function generateDistributionReportPdf(Distribution $distribution, bool $save = false)
@@ -38,39 +55,31 @@ class DistributionReportPdfGenerator extends AbstractGenerator
foreach ($pointsSaleArray as $pointSale) {
$this->orderBuilder->initPointSaleOrders($pointSale, $ordersArray);
}

$viewPdf = '@backend/views/distribution/report';
$orientationPdf = Pdf::ORIENT_PORTRAIT;
$isBig = count($productsArray) > self::LIMIT_PRODUCTS;

if ($producer->slug == 'bourlinguepacotille') {
$viewPdf = '@backend/views/distribution/report-bourlingue';
$orientationPdf = Pdf::ORIENT_LANDSCAPE;
$content = \Yii::$app->getView()->render($viewPdf, [
'date' => $distribution->date,
'distribution' => $distribution,
'selectedProductsArray' => $selectedProductsArray,
'pointsSaleArray' => $pointsSaleArray,
'productsArray' => $productsArray,
'ordersArray' => $ordersArray,
'producer' => $producer
]);
}

// get your HTML raw content without any layouts or scripts
$content = \Yii::$app->getView()->render($viewPdf, [
'date' => $distribution->date,
'distribution' => $distribution,
'selectedProductsArray' => $selectedProductsArray,
'pointsSaleArray' => $pointsSaleArray,
'productsArray' => $productsArray,
'ordersArray' => $ordersArray,
'producer' => $producer
]);

$dateStr = date('d/m/Y', strtotime($distribution->date));

if ($save) {
$destination = Pdf::DEST_FILE;
} else {
$destination = Pdf::DEST_BROWSER;
else {
$orientationPdf = Pdf::ORIENT_PORTRAIT;
$content = $this->buildReportHtml($pointsSaleArray, $productsArray, $ordersArray, $isBig);
}

$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => $orientationPdf,
'destination' => $destination,
'destination' => $save ? Pdf::DEST_FILE : Pdf::DEST_BROWSER,
'filename' => \Yii::getAlias(
'@app/web/pdf/Commandes-' . $distribution->date . '-' . $this->getProducerContextId() . '.pdf'
),
@@ -103,11 +112,272 @@ class DistributionReportPdfGenerator extends AbstractGenerator
}
',
'methods' => [
'SetHeader' => ['Commandes du ' . $dateStr],
'SetHeader' => ['Commandes du ' . date('d/m/Y', strtotime($distribution->date))],
'SetFooter' => ['{PAGENO}'],
]
]);

return $pdf->render();
}

public function buildReportHtml(array $pointsSaleArray, array $productsArray, array $ordersArray, bool $isBig): string
{
$html = $this->buildReportPointsSaleHtml($pointsSaleArray, $productsArray, $isBig);
$html .= $this->buildReportPointsSaleTotalHtml($pointsSaleArray, $productsArray, $ordersArray, $isBig);
return $html;
}

public function buildReportPointsSaleHtml(array $pointsSaleArray, array $productsArray, bool $isBig): string
{
$producer = $this->getProducerContext();
$html = '' ;
foreach ($pointsSaleArray as $pointSale) {
if (count($pointSale->orders)) {

$html .= '<h3>'.$pointSale->name.'</h3>' ;
$columnDeliveryNote = ($producer->option_export_display_column_delivery_note) ? '<th>BL</th>' : '';
$colCredit = ($pointSale->credit) ? '<th>Crédit</th>' : '' ;

$html .= '<table class="">'
. '<thead>'
. '<tr>'
. '<th>Client</th>'
. '<th>Produits</th>'
. ($isBig ? '<th>Produits</th>' : '')
. '<th>Commentaire</th>'
. $columnDeliveryNote
. $colCredit
. '<th>Montant</th>'
. '</tr>'
. '</thead>'
. '<tbody>';

foreach ($pointSale->orders as $order) {
$html .= '<tr>' ;
$html .= $this->columnUsername($order);
$html .= $this->columnOrderProducts($order, $productsArray);
$html .= $this->columnIfIsBig($isBig);
$html .= $this->columnComment($order);
$html .= $this->columnDeliveryNote($order);
$html .= $this->columnCredit($order, $pointSale);
$html .= $this->columnOrderAmount($order);
$html .= '</tr>' ;
}

$html .= '<tr><td><strong>Total</strong></td>' ;

$strProducts = '';
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$strProducts .= '(' .$quantity .$theUnit.') '.$this->productSolver->getNameExport($product) . '<br />';
}
}

if($isBig && $cpt == self::LIMIT_PRODUCTS) {
$strProducts .= '</td><td>' ;
}

$cpt ++ ;
}

$html .= '<td>'.$strProducts.'</td><td></td>' ;
if($pointSale->credit) {
$html .= '<td></td>' ;
}
if($producer->option_export_display_column_delivery_note) {
$html .= '<td></td>' ;
}
$html .= '<td><strong>'.Price::format($pointSale->revenues_with_tax) . '</strong></td>';

$html .= '</tbody></table><pagebreak>' ;
}
}

return $html;
}

public function columnUsername(Order $order): string
{
$producer = $this->getProducerContext();

$strUser = $this->orderSolver->getOrderUsername($order) ;
if(strlen($order->comment_point_sale))
{
$strUser .= '<br /><em>'.$order->comment_point_sale.'</em>' ;
}

if (isset($order->user) && strlen($order->user->phone)) {
$strUser .= '<br />' . $order->user->phone . '';
}

if($producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY && $order->reference && strlen($order->reference) > 0) {
$strUser .= '<br />'.$order->reference ;
}

return '<td>'.$strUser.'</td>';
}

public function columnOrderProducts(Order $order, array $productsArray): string
{
$strProducts = '';
foreach ($productsArray as $product) {
foreach ($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = ( $this->productSolver->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= '('.$productOrder->quantity .$unit.') '.$this->productSolver->getNameExport($product) . '<br />';
}
}
}

return '<td>'.substr($strProducts, 0, strlen($strProducts) - 6).'</td>';
}

public function columnIfIsBig(bool $isBig): string
{
if($isBig) {
return '<td></td>' ;
}

return '';
}

public function columnComment(Order $order): string
{
return '<td>'.$this->orderSolver->getCommentReport($order).'</td>';;
}

public function columnDeliveryNote(Order $order): string
{
$producer = $this->getProducerContext();
if($producer->option_export_display_column_delivery_note) {
$contentColumnDeliveryNote = '';
if($order->deliveryNote) {
if($this->documentSolver->isStatusDraft($order->deliveryNote)) {
$contentColumnDeliveryNote = 'Brouillon';
}
elseif($this->documentSolver->isStatusValid($order->deliveryNote)) {
$contentColumnDeliveryNote = 'Oui';
}
}
return '<td>'.$contentColumnDeliveryNote.'</td>';
}

return '';
}

public function columnCredit(Order $order, PointSale $pointSale): string
{
if($pointSale->credit) {
$credit = '' ;

if(isset($order->user) && $order->user->id) {
$userProducer = UserProducer::searchOne([
'id_user' => $order->user->id
]);

if($userProducer) {
$credit = number_format($userProducer->credit,2).' €' ;
}
}

return '<td>'.$credit.'</td>' ;
}

return '';
}

public function columnOrderAmount(Order $order): string
{
$html = '<td><strong>'.number_format($order->amount_with_tax, 2) . ' € ';

if($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_PAID)
{
$html .= '(débité)' ;
}
elseif($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_UNPAID && $this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID))
{
$html .= '(reste '.$this->orderSolver->getOrderAmount($order, Order::AMOUNT_REMAINING, true).' à débiter)' ;
}
elseif($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{
$html .= '(surplus : '.$this->orderSolver->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à recréditer)' ;
}

$html .= '</strong></td>' ;

return $html;
}

public function buildReportPointsSaleTotalHtml(array $pointsSaleArray, array $productsArray, array $ordersArray, bool $isBig): string
{
$html = '';
$html .= '<h3>Points de vente</h3>' ;
$html .= '<table class="">'
. '<thead>'
. '<tr>'
. '<th>Point de vente</th>'
. '<th>Produits</th>'
. ( $isBig ? '<th>Produits</th>' : '')
. '<th>Montant</th>'
. '</tr>'
. '<tbody>';

$revenues = 0 ;
foreach ($pointsSaleArray as $pointSale)
{
if (count($pointSale->orders))
{
$html .= '<tr><td>'.$pointSale->name.'</td><td>' ;

$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$this->productSolver->getNameExport($product) . '<br />';
}
}

if($isBig && $cpt == self::LIMIT_PRODUCTS) {
$html .= '</td><td>' ;
}

$cpt ++ ;
}

$html .= '</td><td>'.Price::format($pointSale->revenues_with_tax, 2).'</td></tr>' ;
$revenues += $pointSale->revenues_with_tax ;
}
}

// total
$html .= '<tr><td><strong>Total</strong></td><td>' ;

$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->name . '<br />';
}
}
if($isBig && $cpt == self::LIMIT_PRODUCTS) {
$html .= '</td><td>' ;
}

$cpt ++ ;
}

$html .= '</td><td><strong>'.number_format($revenues, 2).' €</strong></td></tr>' ;

$html .= '</tbody></table>' ;

return $html;
}
}

+ 18
- 3
common/logic/Order/Order/Service/OrderSolver.php 查看文件

@@ -124,9 +124,24 @@ class OrderSolver extends AbstractService implements SolverInterface

public function isLinkedToValidDocument(Order $order): bool
{
return ($order->deliveryNote && $this->documentSolver->isStatusValid($order->deliveryNote))
|| ($order->quotation && $this->documentSolver->isStatusValid($order->quotation))
|| ($order->invoice && $this->documentSolver->isStatusValid($order->invoice));
return ($this->isLinkedToValidDeliveryNote($order)
|| $this->isLinkedToValidQuotation($order)
|| $this->isLinkedToValidInvoice($order));
}

public function isLinkedToValidDeliveryNote(Order $order): bool
{
return $order->deliveryNote && $this->documentSolver->isStatusValid($order->deliveryNote);
}

public function isLinkedToValidQuotation(Order $order): bool
{
return $order->quotation && $this->documentSolver->isStatusValid($order->quotation);
}

public function isLinkedToValidInvoice(Order $order): bool
{
return $order->invoice && $this->documentSolver->isStatusValid($order->invoice);
}

public function getCommentReport(Order $order): string

+ 4
- 2
common/logic/Producer/Producer/Model/Producer.php 查看文件

@@ -255,7 +255,8 @@ class Producer extends ActiveRecordCommon
'option_billing_reduction',
'option_export_evoliz',
'option_display_message_new_opendistrib_version',
'option_billing_permanent_transfer'
'option_billing_permanent_transfer',
'option_export_display_column_delivery_note'
],
'boolean'
],
@@ -419,7 +420,8 @@ class Producer extends ActiveRecordCommon
'contact_email' => 'Email de contact',
'admin_comment' => 'Commentaire',
'dolibarr_socid' => 'Dolibarr : id user',
'dolibarr_product_id' => 'Dolibarr : id produit'
'dolibarr_product_id' => 'Dolibarr : id produit',
'option_export_display_column_delivery_note' => "Récapitulatif PDF : afficher une colonne bon de livraison",
];
}


+ 26
- 0
console/migrations/m230906_060202_add_column_producer_option_export_display_column_delivery_note.php 查看文件

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

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m230906_060202_add_column_producer_option_export_display_column_delivery_note
*/
class m230906_060202_add_column_producer_option_export_display_column_delivery_note extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_export_display_column_delivery_note', Schema::TYPE_BOOLEAN);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'option_export_display_column_delivery_note');
}
}

Loading…
取消
儲存