Distribution_GL Initialization
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace General_Ledger_Service.Services.PdfDocuments
|
||||
{
|
||||
// Shared amount-formatting rules for every report PDF (05_LKAS_Report_PDF_Templates.md
|
||||
// Section 9): thousands separator, 2 decimal places, round-half-up, negatives in
|
||||
// parentheses. Same rounding rule as CLAUDE.md Rule 13's FormatCellValue.
|
||||
public static class PdfFormatting
|
||||
{
|
||||
public static string FormatAmount(decimal value)
|
||||
{
|
||||
var rounded = Math.Round(value, 2, MidpointRounding.AwayFromZero);
|
||||
return rounded < 0 ? $"({Math.Abs(rounded):N2})" : rounded.ToString("N2");
|
||||
}
|
||||
|
||||
// Blank instead of "0.00" - Trial Balance's Debit/Credit split (Section 2).
|
||||
public static string FormatAmountOrBlank(decimal value) =>
|
||||
value == 0 ? string.Empty : FormatAmount(value);
|
||||
|
||||
// "—" instead of "0.00" - Tax Summary's Output/Input Tax columns (Section 8).
|
||||
public static string FormatAmountOrDash(decimal value) =>
|
||||
value == 0 ? "—" : FormatAmount(value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user