FormatMoney
Definition
- Namespace
- Resto.Front.PrintTemplates.Cheques.Razor
string TemplateBase<T>.FormatMoney(decimal money)
Definition
- Namespace
- Resto.Front.PrintTemplates.Cheques.Razor
Formats money using the current currency precision and minimum denomination.
string TemplateBase<T>.FormatMoney(decimal money)
- Returns
string- Nullability
- Not specified
- Declared in
- Resto.Front.PrintTemplates.Cheques.Razor.TemplateBase<T>
- Model purpose
- Base class for Legacy Razor print templates. Model contains the document data of type T. Provides formatting and markup output methods.
Parameters
decimal money- Amount in the selected currency; this method does not convert currencies.
Return value
The rounded amount with the current currency number of fractional digits.
Remarks
Rounds midpoint values away from zero. Uses CurrentCulture, including its decimal and digit-group separators; does not append a currency symbol. First rounds to currency precision, then to MinimumDenomination when it is nonzero. Currency display flags do not hide the fractional part.
Exceptions
System.InvalidOperationException- The engine currency provider has not been initialized.
System.Collections.Generic.KeyNotFoundException- The current currency ISO code is absent from the engine currency catalog.
System.ArgumentOutOfRangeException- The configured minimum denomination is negative.
System.OverflowException- Rounding to the configured denomination exceeds the Decimal range.
Example
// en-GB, precision: 2, minimum denomination: 0.05 FormatMoney(12.33m); // "12.35"
string TemplateBase<T>.FormatMoney(decimal money, string isoName)
Definition
- Namespace
- Resto.Front.PrintTemplates.Cheques.Razor
Formats money using the fractional precision of an explicitly specified currency.
string TemplateBase<T>.FormatMoney(decimal money, string isoName)
- Returns
string- Nullability
- Not specified
- Declared in
- Resto.Front.PrintTemplates.Cheques.Razor.TemplateBase<T>
- Model purpose
- Base class for Legacy Razor print templates. Model contains the document data of type T. Provides formatting and markup output methods.
Parameters
decimal money- Amount in the selected currency; this method does not convert currencies.
string isoName- Case-sensitive ISO code from the engine currency catalog, for example RUB or JPY; must not be null.
Return value
A numeric string with the specified currency precision.
Remarks
Rounds midpoint values away from zero. Uses CurrentCulture, including its decimal and digit-group separators; does not append a currency symbol. Does not apply the current currency minimum denomination, convert the amount, or change culture according to the ISO code.
Exceptions
System.ArgumentNullException- isoName is null.
System.Collections.Generic.KeyNotFoundException- isoName is not present in the engine currency catalog.
Example
// en-GB FormatMoney(12.345m, "RUB"); // "12.35" FormatMoney(12.345m, "JPY"); // "12"