Kaynağa Gözat

[Administration] Documents : possibilité d'afficher le prix au kg dans la colonne "Prix unitaire" des PDF #1395

feature/souke
Guillaume Bourgeois 1 yıl önce
ebeveyn
işleme
0510e9eb97
8 değiştirilmiş dosya ile 97 ekleme ve 28 silme
  1. +16
    -2
      backend/views/document/_download_product_line.php
  2. +12
    -15
      backend/views/document/download.php
  3. +2
    -0
      backend/views/producer/update.php
  4. +14
    -6
      backend/web/css/document/download.css
  5. +7
    -4
      backend/web/sass/document/download.scss
  6. +17
    -0
      common/logic/Order/ProductOrder/Service/ProductOrderSolver.php
  7. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  8. +26
    -0
      console/migrations/m231108_131232_add_column_producer_option_document_display_price_unit_reference.php

+ 16
- 2
backend/views/document/_download_product_line.php Dosyayı Görüntüle

@@ -1,11 +1,15 @@
<?php

use common\helpers\Price;
use common\logic\Order\ProductOrder\Module\ProductOrderModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\Product\Product\Model\Product;
use yii\helpers\Html;

$documentModule = $this->getDocumentModule();
$productModule = $this->getProductModule();
$productOrderModule = ProductOrderModule::getInstance();
$producerModule = ProducerModule::getInstance();

?>

@@ -31,13 +35,23 @@ $productModule = $this->getProductModule();

<?php if($displayPrices): ?>
<td class="align-center column-unit-price">
<?= Price::format($price, $documentPriceDecimals) ?>
<?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?>
<?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder); ?>
<?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?>
<?php if($productOrder->unit == 'piece'): ?>
<?= Price::format($price, $documentPriceDecimals) ?>
<?php if($priceUnitReference): ?>
(<?= $priceUnitReferenceString ?>)
<?php endif; ?>
<?php else: ?>
<?= $priceUnitReferenceString ?>
<?php endif; ?>
</td>
<?php endif; ?>
<td class="align-center column-quantity">
<?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?>
<?= $productModule->getSolver()->strUnit($productOrder->product, 'wording') ?>
</td>
<td class="align-center column-unit"><?= $productModule->getSolver()->strUnit($productOrder->product, 'wording') ?></td>
<?php if($displayPrices): ?>
<?php if($producer->taxRate->value != 0): ?>
<td class="align-center column-tax-rate"><?= $productOrder->taxRate->value * 100 ?> %</td>

+ 12
- 15
backend/views/document/download.php Dosyayı Görüntüle

@@ -90,7 +90,6 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
<?php endif; ?>
<?php endif; ?>
<th>Quantité</th>
<th>Unité</th>
<?php if ($displayPrices): ?>
<?php if ($producer->taxRate->value == 0): ?>
<th>Prix</th>
@@ -117,7 +116,6 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
<td class="align-center"></td>
<?php endif; ?>
<td></td>
<td></td>
<?php if ($displayPrices): ?>
<?php if ($producer->taxRate->value != 0): ?>
<td class="align-center"></td>
@@ -157,7 +155,7 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
<?php if ($producer->taxRate->value != 0): ?>

<tr>
<td class="align-right" colspan="5"><strong>Total HT</strong></td>
<td class="align-right" colspan="4"><strong>Total HT</strong></td>
<td class="align-center">
<?= Price::format($documentModule->getAmount($document, $typeAmount)); ?>
</td>
@@ -167,31 +165,30 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
$taxRateArray = $this-> getTaxRateModule()->findTaxRatesAsArray();
foreach ($documentModule->getTotalVatArray($document, $typeAmount) as $idTaxRate => $totalVat): ?>
<tr>
<td class="align-right" colspan="5">
<td class="align-right" colspan="4">
<strong>TVA <?= $taxRateArray[$idTaxRate]->value * 100 ?> %</strong></td>
<td class="align-center">
<?= Price::format($totalVat); ?>
</td>
</tr>
<?php endforeach; ?>

<!--<tr>
<td class="align-right" colspan="5"><strong>TVA</strong></td>
<td class="align-center">
<?= Price::format($documentModule->getAmountWithTax($document, $typeAmount) - $documentModule->getAmount($document, $typeAmount)) ?>
</td>
</tr>-->
<tr>
<td class="align-right" colspan="5"><strong>Total TTC</strong></td>
<td class="align-center"><?= Price::format($documentModule->getAmountWithTax($document, $typeAmount)) ?></td>
<td class="align-right" colspan="4">
<strong>Total TTC</strong>
</td>
<td class="align-center">
<?= Price::format($documentModule->getAmountWithTax($document, $typeAmount)) ?>
</td>
</tr>
<?php else: ?>
<tr>
<td class="align-right" colspan="4">
<td class="align-right" colspan="3">
<strong>Total</strong><br/>
TVA non applicable
</td>
<td class="align-center"><?= Price::format($documentModule->getAmount($document, $typeAmount)) ?></td>
<td class="align-center">
<?= Price::format($documentModule->getAmount($document, $typeAmount)) ?>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>

+ 2
- 0
backend/views/producer/update.php Dosyayı Görüntüle

@@ -413,6 +413,8 @@ $this->addBreadcrumb($this->getTitle());
2 => '2',
3 => '3'
]); ?>
<?= $form->field($model, 'option_document_display_price_unit_reference')
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'document_infos_top')
->textarea(['rows' => 8])
->hint("Affichées juste en dessous de l'adresse"); ?>

+ 14
- 6
backend/web/css/document/download.css Dosyayı Görüntüle

@@ -97,11 +97,19 @@ body {
.document-download #block-products table td {
font-size: 11px;
}
/* line 105, ../../sass/document/download.scss */
.document-download #block-products table td.column-unit-price, .document-download #block-products table td.column-quantity, .document-download #block-products table td.column-unit, .document-download #block-products table td.column-tax-rate, .document-download #block-products table td.column-price {
/* line 103, ../../sass/document/download.scss */
.document-download #block-products table td.column-unit-price {
width: 120px;
}
/* line 107, ../../sass/document/download.scss */
.document-download #block-products table td.column-tax-rate, .document-download #block-products table td.column-price {
width: 70px;
}
/* line 116, ../../sass/document/download.scss */
/* line 112, ../../sass/document/download.scss */
.document-download #block-products table td.column-quantity {
width: 80px;
}
/* line 119, ../../sass/document/download.scss */
.document-download .block-infos {
margin-bottom: 15px;
border: solid 1px #c0c0c0;
@@ -109,19 +117,19 @@ body {
background-color: transparent;
font-size: 11px;
}
/* line 123, ../../sass/document/download.scss */
/* line 126, ../../sass/document/download.scss */
.document-download .block-infos strong {
font-size: 12px;
}

/* line 129, ../../sass/document/download.scss */
/* line 132, ../../sass/document/download.scss */
#footer {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
padding-top: 10px;
border-top: solid 1px gray;
}
/* line 135, ../../sass/document/download.scss */
/* line 138, ../../sass/document/download.scss */
#footer .infos-bottom {
font-size: 12px;
line-height: 18px;

+ 7
- 4
backend/web/sass/document/download.scss Dosyayı Görüntüle

@@ -98,17 +98,20 @@ body {
td {
font-size: 11px;

&.column-product {
&.column-product {}

&.column-unit-price {
width: 120px;
}

&.column-unit-price,
&.column-quantity,
&.column-unit,
&.column-tax-rate,
&.column-price {
width: 70px;
}

&.column-quantity {
width: 80px;
}
}
}
}

+ 17
- 0
common/logic/Order/ProductOrder/Service/ProductOrderSolver.php Dosyayı Görüntüle

@@ -69,4 +69,21 @@ class ProductOrderSolver extends AbstractService implements SolverInterface

return $productOrder->price;
}

public function getPriceUnitReference(ProductOrder $productOrder): ?float
{
if($productOrder->unit == 'piece') {
if($productOrder->product->weight) {
$price = (1000 * $productOrder->price) / $productOrder->product->weight;
}
else {
return null;
}
}
else {
$price = $productOrder->price;
}

return $price;
}
}

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Dosyayı Görüntüle

@@ -276,7 +276,8 @@ class Producer extends ActiveRecordCommon
'option_display_message_new_opendistrib_version',
'option_billing_permanent_transfer',
'option_export_display_column_delivery_note',
'option_invoice_only_based_on_delivery_notes'
'option_invoice_only_based_on_delivery_notes',
'option_document_display_price_unit_reference'
],
'boolean'
],
@@ -451,6 +452,7 @@ class Producer extends ActiveRecordCommon
'option_invoice_only_based_on_delivery_notes' => 'Facturer uniquement sur la base des bons de livraison',
'option_document_width_logo' => 'Largeur du logo dans les documents',
'export_shopping_cart_labels_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne",
'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme",
];
}


+ 26
- 0
console/migrations/m231108_131232_add_column_producer_option_document_display_price_unit_reference.php Dosyayı Görüntüle

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

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

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

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

Yükleniyor…
İptal
Kaydet