using System; namespace PayRollBLL.SAP.Builders { /// /// Shared amount-to-string formatting for all SAP infotype builders. /// SAP OData services require numeric amounts as JSON strings, not JSON numbers. /// internal static class SapFmt { /// /// Formats a whole-rupee amount (salary, tax, PF, PT). /// Always produces an integer string — e.g. 1022305.0 → "1022305". /// internal static string Integer(double value) => ((long)Math.Round(value, MidpointRounding.AwayFromZero)).ToString(); /// /// Formats an amount that may carry fractional rupees (rent, investments, deductions). /// Strips trailing zeros — e.g. 8300.0 → "8300", 8300.5 → "8300.5", 8300.55 → "8300.55". /// internal static string Amount(double value) => value == Math.Floor(value) ? ((long)value).ToString() : value.ToString("0.##"); } }