Implement preferred precisions.

- NEU: Für bestimmte Laborwerte ist die bevorzugte Nachkommastellenzahl hinterlegt (z.B. Kreatinin mit nur einer Nachkommastelle).
This commit is contained in:
Daniel Kraus
2015-08-25 20:25:29 +02:00
parent 8eefb8a6f2
commit cf01130491
6 changed files with 89 additions and 23 deletions

View File

@ -153,7 +153,16 @@ namespace zaaReloaded2.Formatter
{
// Format the numerical value; this will convert
// decimal points to commas as needed.
value = String.Format("{0}", LabItem.NumericalValue);
int precision = LabItem.PreferredPrecision;
if (precision >= 0)
{
value = LabItem.NumericalValue.ToString("F" + precision);
}
else
{
// PreferredPrecision is negative, i.e. use precision as-is
value = String.Format("{0}", LabItem.NumericalValue);
}
}
else
{