namespace AccountsDAL.DTO.AccountsReports { public class ProfitLossReportDTO { // Sub-account level — the real posted-to account (MACCOUNT row VD.VOUCHERACCOUNTID points // at). Nested beneath EffectiveAccount; equal to it when the account is standalone // (CONTROLACCOUNTID = -1, no separate sub-account level for that row). public int AccountId { get; set; } public string? AccountCode { get; set; } public string? AccountName { get; set; } // Account level — the control account (MACCOUNT.CONTROLACCOUNTID target), or the same // account as above when standalone. See ProfitLossReportQB.EFFECTIVE_ACCOUNT_EXPR. public int EffectiveAccountId { get; set; } public string? EffectiveAccountCode { get; set; } public string? EffectiveAccountName { get; set; } public int AccountGroupId { get; set; } public string? AccountGroupCode { get; set; } public string? AccountGroupName { get; set; } public int AccountScheduleId { get; set; } public string? AccountScheduleCode { get; set; } public string? AccountScheduleName { get; set; } // MACCOUNT.ACCOUNTSCHEDULENATURE: 2=Direct Income, 3=Direct Expense, 4=Indirect Income, // 5=Indirect Expense. 0 (unset) on the synthetic Gross Profit/Net Profit rows. public int AccountScheduleNature { get; set; } // "Trading" (Direct Income/Expense) or "P&L" (Indirect Income/Expense) — legacy's real // functional split, see ProfitLossReportQB.cs class header. public string Section { get; set; } = string.Empty; // "Income"/"Expense" for detail rows (derived from AccountScheduleNature); "Gross Profit"/ // "Net Profit" on the two synthetic summary rows — see RowType. public string NatureType { get; set; } = string.Empty; // "Detail" for every SQL-sourced row; "GrossProfit"/"NetProfit" for the two rows // AccountProfitLossReportDAL inserts in C# after the query runs (same justification as // Trial Balance's Retained-Earnings plug row — not derivable by a GROUP BY/subtotal, since // it's a difference between two subtotals, not a sum). public string RowType { get; set; } = "Detail"; public decimal Debit { get; set; } public decimal Credit { get; set; } } }