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