瀏覽代碼

[Backend] Documents : affichage décimales #736

refactoring
Guillaume 1 年之前
父節點
當前提交
455dbeddd9
共有 5 個文件被更改,包括 17 次插入8 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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'
];
}


Loading…
取消
儲存