Kaynağa Gözat

[Backend] Documents : affichage décimales #736

refactoring
Guillaume 1 yıl önce
ebeveyn
işleme
455dbeddd9
5 değiştirilmiş dosya ile 17 ekleme ve 8 silme
  1. +1
    -1
      backend/views/document/_download_product_line.php
  2. +5
    -2
      backend/views/document/download.php
  3. +4
    -0
      backend/views/producer/update.php
  4. +3
    -3
      common/helpers/Price.php
  5. +4
    -2
      common/models/Producer.php

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

@@ -20,7 +20,7 @@

<?php if($displayPrices): ?>
<td class="align-center">
<?= Price::format($price) ?>
<?= Price::format($price, $documentPriceDecimals) ?>
</td>
<?php endif; ?>
<td class="align-center">

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

@@ -2,6 +2,7 @@

$displayPrices = Yii::$app->controller->getClass() != 'DeliveryNote' || (Yii::$app->controller->getClass() == 'DeliveryNote' && Producer::getConfig('document_display_prices_delivery_note'));
$displayProductDescription = Producer::getConfig('document_display_product_description');
$documentPriceDecimals = (int) Producer::getConfig('document_price_decimals');

?>

@@ -105,7 +106,8 @@ $displayProductDescription = Producer::getConfig('document_display_product_descr
'productOrder' => $productOrder,
'displayOrders' => true,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>
@@ -117,7 +119,8 @@ $displayProductDescription = Producer::getConfig('document_display_product_descr
'document' => $document,
'productOrder' => $productOrder,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>

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

@@ -463,6 +463,10 @@ $this->addBreadcrumb($this->getTitle());
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
]); ?>
<?= $form->field($model, 'document_infos_bottom')
->textarea(['rows' => 15]) ?>
<?= $form->field($model, 'document_infos_quotation')

+ 3
- 3
common/helpers/Price.php Dosyayı Görüntüle

@@ -41,9 +41,9 @@ namespace common\helpers;
class Price
{

public static function format($number)
public static function format($number, $decimals = 2)
{
return self::numberTwoDecimals($number).' €';
return self::numberTwoDecimals($number, $decimals).' €';
}

public static function round($number)
@@ -74,7 +74,7 @@ class Price
return $vat;
}

public static function numberTwoDecimals($number)
public static function numberTwoDecimals($number, $decimals = 2)
{
return number_format(( ($number * 100)) / 100, 2) ;
}

+ 4
- 2
common/models/Producer.php Dosyayı Görüntüle

@@ -163,7 +163,8 @@ class Producer extends ActiveRecordCommon
'id_tax_rate_default',
'document_quotation_duration',
'option_dashboard_number_distributions',
'option_online_payment_minimum_amount'
'option_online_payment_minimum_amount',
'document_price_decimals'
],
'integer'
],
@@ -401,7 +402,8 @@ class Producer extends ActiveRecordCommon
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib',
'option_csv_separator' => 'Séparateur de colonnes (CSV)',
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib',
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum'
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum',
'document_price_decimals' => 'Prix : nombre de décimales affichées'
];
}


Yükleniyor…
İptal
Kaydet