FormatAmount
Definition
- Namespace
- Resto.Front.PrintTemplates.Cheques.Razor
Formats an item quantity with zero or three decimal places.
string TemplateBaseCore<T>.FormatAmount(decimal amount)
- Returns
string- Nullability
- Not specified
- Declared in
- Resto.Front.PrintTemplates.Cheques.Razor.TemplateBaseCore<T>
- Model purpose
- Base class for RazorEngineCore print templates. Model contains the document data of type T. Provides formatting and markup output methods.
Parameters
decimal amount- Quantity to display; negative and zero values are accepted.
Return value
An integer string for an integral input; otherwise a fixed-point string with three decimal places.
Remarks
Uses CurrentCulture for the decimal separator, without digit grouping. The integral check precedes formatting: 1.0001 is printed with three decimal places, not as an integer. Formatting rounding follows the runtime numeric formatter.
Example
// en-GB FormatAmount(2m); // "2" FormatAmount(1.25m); // "1.250"