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