Update submodule references for OCORE, OCORE_Charting, OCORE_web, and OCORE_web_pdf to latest commits
Playwright Tests / test (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
This commit is contained in:
+27
-6
@@ -131,19 +131,40 @@ public static class FuchsPdf
|
||||
public static string Currency(object? input, string returnobject = "?")
|
||||
{
|
||||
if (input == null || input is DBNull) return returnobject;
|
||||
if (decimal.TryParse(input.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out var d))
|
||||
return d.ToString("0.00 \u20ac", DeCulture);
|
||||
return returnobject;
|
||||
return ParseDec(input, out var d) ? d.ToString("0.00 \u20ac", DeCulture) : returnobject;
|
||||
}
|
||||
|
||||
public static string TranslatePaymentTerm(string pt) =>
|
||||
pt.Replace("wd", " Werktagen").Replace("d", " Tagen").Replace("wk", " Wochen").ne("10 Tagen");
|
||||
|
||||
/// <summary>
|
||||
/// Parses a numeric value coming from JSON deserialization (long/double), SQL
|
||||
/// (decimal), or an already-invariant numeric string. Numeric CLR types are
|
||||
/// converted directly rather than round-tripped through <c>object.ToString()</c>:
|
||||
/// that stringifies using the server's <em>current thread culture</em> (e.g.
|
||||
/// de-DE, where 22.6 becomes "22,6"), which <see cref="NumberStyles.Any"/> +
|
||||
/// <see cref="CultureInfo.InvariantCulture"/> then misreads \u2014 the comma is taken
|
||||
/// as a thousands separator, not a decimal point, inflating amounts ~100x
|
||||
/// (19,00 \u2192 1900) and corrupting sums built from such values.
|
||||
/// </summary>
|
||||
public static bool ParseDec(object? input, out decimal val)
|
||||
{
|
||||
val = 0;
|
||||
return input != null && decimal.TryParse(
|
||||
input.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out val);
|
||||
switch (input)
|
||||
{
|
||||
case null:
|
||||
val = 0; return false;
|
||||
case decimal d:
|
||||
val = d; return true;
|
||||
case double dbl:
|
||||
val = (decimal)dbl; return true;
|
||||
case float flt:
|
||||
val = (decimal)flt; return true;
|
||||
case int or long or short or byte or sbyte or uint or ulong or ushort:
|
||||
val = Convert.ToDecimal(input, CultureInfo.InvariantCulture); return true;
|
||||
default:
|
||||
return decimal.TryParse(
|
||||
input.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out val);
|
||||
}
|
||||
}
|
||||
|
||||
// ── HTML split helper (for multi-line PDF cells) ──────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user