mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
Add possibility to force the number of decimal in function price()
This commit is contained in:
@@ -2360,17 +2360,18 @@ function vatrate($rate,$addpercent=false,$info_bits=0)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction qui formate un montant pour visualisation
|
* Fonction qui formate un montant pour visualisation
|
||||||
* \remarks Fonction utilisee dans les pdf et les pages html
|
* Fonction utilisee dans les pdf et les pages html
|
||||||
* \param amount Montant a formater
|
* @param amount Montant a formater
|
||||||
* \param html Type de formatage, html ou pas (par defaut)
|
* @param html Type de formatage, html ou pas (par defaut)
|
||||||
* \param outlangs Objet langs pour formatage text
|
* @param outlangs Objet langs pour formatage text
|
||||||
* \param trunc 1=Tronque affichage si trop de decimales,0=Force le non troncage
|
* @param trunc 1=Tronque affichage si trop de decimales,0=Force le non troncage
|
||||||
* \param rounding Minimum number of decimal. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
|
* @param rounding Minimum number of decimal. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
|
||||||
* \return string Chaine avec montant formate
|
* @param forcerounding Force the number of decimal
|
||||||
* \seealso price2num Revert function of price
|
* @return string Chaine avec montant formate
|
||||||
|
* @see price2num Revert function of price
|
||||||
*/
|
*/
|
||||||
function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1)
|
function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
@@ -2413,6 +2414,9 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If force rounding
|
||||||
|
if ($forcerounding >= 0) $nbdecimal = $forcerounding;
|
||||||
|
|
||||||
// Format number
|
// Format number
|
||||||
if ($html)
|
if ($html)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user