@model PowderCoating.Application.DTOs.Accounting.AccountLedgerDto @using PowderCoating.Core.Enums @{ ViewData["Title"] = $"Ledger — {Model.AccountNumber} {Model.Name}"; ViewData["PageIcon"] = "bi-journal-text"; ViewData["PageHelpTitle"] = "Account Ledger"; ViewData["PageHelpContent"] = "A chronological list of every transaction posted to this account. Click any Reference to open the source record. Debit increases asset and expense accounts; credit increases liability, equity, and revenue accounts. Use the date range or quick buttons (This Month, YTD, etc.) to narrow the view."; string typeColor = Model.AccountType switch { AccountType.Asset => "success", AccountType.Liability => "danger", AccountType.Equity => "primary", AccountType.Revenue => "info", AccountType.CostOfGoods => "warning", AccountType.Expense => "secondary", _ => "secondary" }; string typeIcon = Model.AccountType switch { AccountType.Asset => "bi-safe", AccountType.Liability => "bi-credit-card", AccountType.Equity => "bi-bar-chart-line", AccountType.Revenue => "bi-graph-up-arrow", AccountType.CostOfGoods => "bi-box-seam", AccountType.Expense => "bi-receipt-cutoff", _ => "bi-journal" }; string typeLabel = Model.AccountType.ToDisplayName(); // Derive from AccountSubType (more reliable than AccountType which users can misconfigure) bool normalDebitBalance = Model.AccountSubType == AccountSubType.Cash || Model.AccountSubType == AccountSubType.Checking || Model.AccountSubType == AccountSubType.Savings || Model.AccountSubType == AccountSubType.AccountsReceivable || Model.AccountSubType == AccountSubType.Inventory || Model.AccountSubType == AccountSubType.FixedAsset || Model.AccountSubType == AccountSubType.OtherCurrentAsset || Model.AccountSubType == AccountSubType.OtherAsset || Model.AccountSubType == AccountSubType.CostOfGoodsSold || (int)Model.AccountSubType >= 50; // all Expense subtypes string balanceLabel = normalDebitBalance ? "Debit Balance" : "Credit Balance"; // Quick-range helpers for the filter bar var today = DateTime.Today; var thisMonthFrom = new DateTime(today.Year, today.Month, 1).ToString("yyyy-MM-dd"); var thisMonthTo = today.ToString("yyyy-MM-dd"); var lastMonthFrom = new DateTime(today.Year, today.Month, 1).AddMonths(-1).ToString("yyyy-MM-dd"); var lastMonthTo = new DateTime(today.Year, today.Month, 1).AddDays(-1).ToString("yyyy-MM-dd"); var qtdFrom = new DateTime(today.Year, ((today.Month - 1) / 3) * 3 + 1, 1).ToString("yyyy-MM-dd"); var ytdFrom = new DateTime(today.Year, 1, 1).ToString("yyyy-MM-dd"); }
No transactions found for this account in the selected period.
| Date | Reference | Source | Description | Debit | Credit | Balance |
|---|---|---|---|---|---|---|
| @Model.From.ToString("MM/dd/yyyy") | — | Opening Balance | Balance brought forward as of @Model.From.ToString("MMM d, yyyy") | @Model.OpeningBalance.ToString("C") | ||
| @entry.Date.ToString("MM/dd/yyyy") | @if (entry.LinkController != null && entry.LinkId.HasValue) { @entry.Reference } else { @entry.Reference } | @{ string sourceBadge = entry.Source switch { "Invoice" => "bg-info-subtle text-info", "Invoice Payment" => "bg-success-subtle text-success", "Customer Payment" => "bg-success-subtle text-success", "Bill" => "bg-warning-subtle text-warning", "Bill Payment" => "bg-danger-subtle text-danger", "Expense" => "bg-secondary-subtle text-secondary", "Sales Tax" => "bg-primary-subtle text-primary", _ => "bg-secondary-subtle text-secondary" }; } @entry.Source | @entry.Description | @if (entry.Debit > 0) { @entry.Debit.ToString("C") } | @if (entry.Credit > 0) { @entry.Credit.ToString("C") } | @entry.RunningBalance.ToString("C") |
| Period Totals | @Model.PeriodDebits.ToString("C") | @Model.PeriodCredits.ToString("C") | @Model.ClosingBalance.ToString("C") | |||