Enhance financial report accuracy by including closing journals in profit and loss calculations and trial balances; add idempotency check for journal entry creation.
This commit is contained in:
@@ -5,8 +5,8 @@ using QuestPDF.Infrastructure;
|
||||
|
||||
namespace General_Ledger_Service.Services.PdfDocuments
|
||||
{
|
||||
// 05_LKAS_Report_PDF_Templates.md Section 6 - one continuous table (not separate boxed
|
||||
// sections per account), account boundaries marked by an inline full-width group-header row.
|
||||
// One continuous table of transaction lines, no grouping by account: each row carries its own
|
||||
// account (code + name), same layout as the CSV and the on-screen report.
|
||||
// Response is already sorted by accountCode then entryDate - no re-sorting needed here.
|
||||
public class GeneralLedgerPdfDocument(string companyName, string currencyCode, DateOnly periodStart, DateOnly periodEnd, List<GeneralLedgerLineDto> rows) : IDocument
|
||||
{
|
||||
@@ -26,39 +26,31 @@ namespace General_Ledger_Service.Services.PdfDocuments
|
||||
{
|
||||
columns.RelativeColumn(2);
|
||||
columns.RelativeColumn(4);
|
||||
columns.RelativeColumn(4);
|
||||
columns.RelativeColumn(3);
|
||||
columns.RelativeColumn(2);
|
||||
columns.RelativeColumn(2);
|
||||
columns.RelativeColumn(2);
|
||||
});
|
||||
|
||||
table.Header(header =>
|
||||
{
|
||||
header.Cell().Text("Date").Bold();
|
||||
header.Cell().Text("Account").Bold();
|
||||
header.Cell().Text("Particulars").Bold();
|
||||
header.Cell().Text("Description/Reference (J.R.)").Bold();
|
||||
header.Cell().AlignRight().Text("Debit").Bold();
|
||||
header.Cell().AlignRight().Text("Credit").Bold();
|
||||
header.Cell().AlignRight().Text("Balance").Bold();
|
||||
header.Cell().ColumnSpan(6).PaddingTop(3).LineHorizontal(1);
|
||||
});
|
||||
|
||||
string? currentAccountCode = null;
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (row.AccountCode != currentAccountCode)
|
||||
{
|
||||
currentAccountCode = row.AccountCode;
|
||||
table.Cell().ColumnSpan(6).Background(Colors.Grey.Lighten3).Padding(3)
|
||||
.Text($"Account: {row.AccountCode} — {row.AccountName}").Bold();
|
||||
}
|
||||
|
||||
table.Cell().Text(row.EntryDate.ToString("yyyy-MM-dd"));
|
||||
table.Cell().Text($"{row.AccountCode} {row.AccountName}");
|
||||
table.Cell().Text(row.Narration ?? string.Empty);
|
||||
table.Cell().Text(row.JournalNo);
|
||||
table.Cell().AlignRight().Text(PdfFormatting.FormatAmountOrBlank(row.DebitAmount));
|
||||
table.Cell().AlignRight().Text(PdfFormatting.FormatAmountOrBlank(row.CreditAmount));
|
||||
table.Cell().AlignRight().Text(PdfFormatting.FormatAmount(row.RunningBalance));
|
||||
}
|
||||
|
||||
table.Cell().ColumnSpan(6).PaddingTop(3).LineHorizontal(1);
|
||||
|
||||
Reference in New Issue
Block a user