Browse Source

[Backend] Documents : affichage décimales #736

prodstable
Guillaume 2 years ago
parent
commit
455dbeddd9
5 changed files with 17 additions and 8 deletions
  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 View File



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

+ 5
- 2
backend/views/document/download.php View File



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


?> ?>


'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayOrders' => true, 'displayOrders' => true,
'displayPrices' => $displayPrices, 'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
'document' => $document, 'document' => $document,
'productOrder' => $productOrder, 'productOrder' => $productOrder,
'displayPrices' => $displayPrices, 'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
'displayProductDescription' => $displayProductDescription,
'documentPriceDecimals' => $documentPriceDecimals
]) ?> ]) ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>

+ 4
- 0
backend/views/producer/update.php View File

0 => 'Non', 0 => 'Non',
1 => 'Oui' 1 => 'Oui'
]); ?> ]); ?>
<?= $form->field($model, 'document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
]); ?>
<?= $form->field($model, 'document_infos_bottom') <?= $form->field($model, 'document_infos_bottom')
->textarea(['rows' => 15]) ?> ->textarea(['rows' => 15]) ?>
<?= $form->field($model, 'document_infos_quotation') <?= $form->field($model, 'document_infos_quotation')

+ 3
- 3
common/helpers/Price.php View File

class Price 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) public static function round($number)
return $vat; return $vat;
} }


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

+ 4
- 2
common/models/Producer.php View File

'id_tax_rate_default', 'id_tax_rate_default',
'document_quotation_duration', 'document_quotation_duration',
'option_dashboard_number_distributions', 'option_dashboard_number_distributions',
'option_online_payment_minimum_amount'
'option_online_payment_minimum_amount',
'document_price_decimals'
], ],
'integer' 'integer'
], ],
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib', 'latest_version_opendistrib' => 'Dernière version d\'Opendistrib',
'option_csv_separator' => 'Séparateur de colonnes (CSV)', 'option_csv_separator' => 'Séparateur de colonnes (CSV)',
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib', '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…
Cancel
Save