240 lines
12 KiB
Plaintext
240 lines
12 KiB
Plaintext
@model PowderCoating.Application.DTOs.Accounting.BalanceSheetDto
|
|
@{
|
|
ViewData["Title"] = "Balance Sheet";
|
|
ViewData["PageIcon"] = "bi-scale";
|
|
var today = DateTime.Today;
|
|
}
|
|
|
|
<style>
|
|
@@media print {
|
|
.no-print { display: none !important; }
|
|
.card { border: 1px solid #dee2e6 !important; box-shadow: none !important; }
|
|
body { font-size: 12px; }
|
|
}
|
|
.report-section-header { background: #f8f9fa; font-weight: 600; }
|
|
.report-subtotal-row { border-top: 1px solid #dee2e6; font-weight: 600; }
|
|
.report-total-row { border-top: 2px solid #343a40; font-weight: 700; background: #f1f3f5; }
|
|
.bs-balanced { color: #198754; }
|
|
.bs-unbalanced { color: #dc3545; }
|
|
</style>
|
|
|
|
<!-- Header -->
|
|
<div class="d-flex align-items-center gap-2 mb-3 no-print">
|
|
<a asp-action="Index" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left"></i></a>
|
|
<p class="text-muted mb-0">As of @Model.AsOf.ToString("MMMM d, yyyy")</p>
|
|
<div class="ms-auto d-flex gap-2">
|
|
<a href="@Url.Action("BalanceSheetPdf", new { asOf = Model.AsOf.ToString("yyyy-MM-dd") })"
|
|
class="btn btn-sm btn-outline-danger no-print" target="_blank">
|
|
<i class="bi bi-file-pdf me-1"></i>Download PDF
|
|
</a>
|
|
<a href="@Url.Action("BalanceSheetPdf", new { asOf = Model.AsOf.ToString("yyyy-MM-dd"), inline = true })"
|
|
class="btn btn-sm btn-outline-secondary no-print" target="_blank">
|
|
<i class="bi bi-printer me-1"></i>Print
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date filter -->
|
|
<div class="card shadow-sm mb-4 no-print">
|
|
<div class="card-body py-3">
|
|
<form method="get" class="row g-2 align-items-end">
|
|
<div class="col-auto">
|
|
<label class="form-label form-label-sm mb-1">As of Date</label>
|
|
<input type="date" name="asOf" class="form-control form-control-sm" value="@Model.AsOf.ToString("yyyy-MM-dd")" />
|
|
</div>
|
|
<div class="col-auto">
|
|
<button type="submit" class="btn btn-primary btn-sm"><i class="bi bi-funnel me-1"></i>Run Report</button>
|
|
</div>
|
|
<div class="col-auto ms-2">
|
|
<div class="btn-group btn-group-sm">
|
|
<a href="@Url.Action("BalanceSheet", new { asOf = today.ToString("yyyy-MM-dd") })" class="btn btn-outline-secondary">Today</a>
|
|
<a href="@Url.Action("BalanceSheet", new { asOf = new DateTime(today.Year, today.Month, 1).AddDays(-1).ToString("yyyy-MM-dd") })" class="btn btn-outline-secondary">End of Last Month</a>
|
|
<a href="@Url.Action("BalanceSheet", new { asOf = new DateTime(today.Year, 12, 31).ToString("yyyy-MM-dd") })" class="btn btn-outline-secondary">Year End</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Print header -->
|
|
<div class="text-center mb-4 d-none d-print-block">
|
|
<h4 class="fw-bold">@Model.CompanyName</h4>
|
|
<h5>Balance Sheet</h5>
|
|
<p class="text-muted">As of @Model.AsOf.ToString("MMMM d, yyyy")</p>
|
|
</div>
|
|
|
|
<!-- KPI row -->
|
|
<div class="row g-3 mb-4 no-print">
|
|
<div class="col-md-4">
|
|
<div class="card shadow-sm text-center h-100 border-primary border-opacity-25">
|
|
<div class="card-body py-3">
|
|
<div class="h5 text-primary fw-bold mb-1">@Model.TotalAssets.ToString("C")</div>
|
|
<div class="text-muted small">Total Assets</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card shadow-sm text-center h-100 border-danger border-opacity-25">
|
|
<div class="card-body py-3">
|
|
<div class="h5 text-danger fw-bold mb-1">@Model.TotalLiabilities.ToString("C")</div>
|
|
<div class="text-muted small">Total Liabilities</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card shadow-sm text-center h-100 border-success border-opacity-25">
|
|
<div class="card-body py-3">
|
|
<div class="h5 text-success fw-bold mb-1">@Model.TotalEquity.ToString("C")</div>
|
|
<div class="text-muted small">Total Equity</div>
|
|
@if (!Model.IsBalanced)
|
|
{
|
|
<small class="text-danger"><i class="bi bi-exclamation-triangle me-1"></i>Sheet does not balance</small>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-4">
|
|
<!-- ASSETS column -->
|
|
<div class="col-lg-6">
|
|
<div class="card shadow-sm h-100">
|
|
<div class="card-header fw-semibold">
|
|
<i class="bi bi-safe text-primary me-2"></i>Assets
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-sm align-middle mb-0">
|
|
<tbody>
|
|
@{
|
|
void RenderSection(string title, List<PowderCoating.Application.DTOs.Accounting.FinancialReportLine> lines, string subtotalLabel)
|
|
{
|
|
if (!lines.Any()) return;
|
|
<tr class="report-section-header">
|
|
<td colspan="2" class="py-2 small text-uppercase text-muted">@title</td>
|
|
</tr>
|
|
foreach (var line in lines)
|
|
{
|
|
<tr>
|
|
<td class="ps-3">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
|
|
<td class="text-end">@line.Amount.ToString("C")</td>
|
|
</tr>
|
|
}
|
|
<tr class="report-subtotal-row">
|
|
<td class="ps-3 fw-semibold">@subtotalLabel</td>
|
|
<td class="text-end fw-semibold">@lines.Sum(l => l.Amount).ToString("C")</td>
|
|
</tr>
|
|
<tr><td colspan="2" class="py-1"></td></tr>
|
|
}
|
|
}
|
|
@{ RenderSection("Current Assets", Model.CurrentAssets, "Total Current Assets"); }
|
|
@{ RenderSection("Fixed Assets", Model.FixedAssets, "Total Fixed Assets"); }
|
|
@{ RenderSection("Other Assets", Model.OtherAssets, "Total Other Assets"); }
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="report-total-row">
|
|
<td>Total Assets</td>
|
|
<td class="text-end text-primary">@Model.TotalAssets.ToString("C")</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- LIABILITIES + EQUITY column -->
|
|
<div class="col-lg-6">
|
|
<!-- Liabilities -->
|
|
<div class="card shadow-sm mb-4">
|
|
<div class="card-header fw-semibold">
|
|
<i class="bi bi-credit-card text-danger me-2"></i>Liabilities
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-sm align-middle mb-0">
|
|
<tbody>
|
|
@{
|
|
void RenderLiabSection(string title, List<PowderCoating.Application.DTOs.Accounting.FinancialReportLine> lines, string subtotalLabel)
|
|
{
|
|
if (!lines.Any()) return;
|
|
<tr class="report-section-header">
|
|
<td colspan="2" class="py-2 small text-uppercase text-muted">@title</td>
|
|
</tr>
|
|
foreach (var line in lines)
|
|
{
|
|
<tr>
|
|
<td class="ps-3">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
|
|
<td class="text-end">@line.Amount.ToString("C")</td>
|
|
</tr>
|
|
}
|
|
<tr class="report-subtotal-row">
|
|
<td class="ps-3 fw-semibold">@subtotalLabel</td>
|
|
<td class="text-end fw-semibold">@lines.Sum(l => l.Amount).ToString("C")</td>
|
|
</tr>
|
|
<tr><td colspan="2" class="py-1"></td></tr>
|
|
}
|
|
}
|
|
@{ RenderLiabSection("Current Liabilities", Model.CurrentLiabilities, "Total Current Liabilities"); }
|
|
@{ RenderLiabSection("Long-Term Liabilities", Model.LongTermLiabilities, "Total Long-Term Liabilities"); }
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="report-total-row">
|
|
<td>Total Liabilities</td>
|
|
<td class="text-end text-danger">@Model.TotalLiabilities.ToString("C")</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Equity -->
|
|
<div class="card shadow-sm">
|
|
<div class="card-header fw-semibold">
|
|
<i class="bi bi-bar-chart-line text-success me-2"></i>Equity
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-sm align-middle mb-0">
|
|
<tbody>
|
|
@if (Model.EquityLines.Any())
|
|
{
|
|
<tr class="report-section-header">
|
|
<td colspan="2" class="py-2 small text-uppercase text-muted">Owner's Equity</td>
|
|
</tr>
|
|
@foreach (var line in Model.EquityLines)
|
|
{
|
|
<tr>
|
|
<td class="ps-3">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
|
|
<td class="text-end">@line.Amount.ToString("C")</td>
|
|
</tr>
|
|
}
|
|
}
|
|
<tr class="@(Model.RetainedEarnings < 0 ? "text-danger" : "")">
|
|
<td class="ps-3"><span class="text-muted">Retained Earnings (Net Income)</span></td>
|
|
<td class="text-end">@Model.RetainedEarnings.ToString("C")</td>
|
|
</tr>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="report-total-row">
|
|
<td>Total Equity</td>
|
|
<td class="text-end text-success">@Model.TotalEquity.ToString("C")</td>
|
|
</tr>
|
|
<tr class="report-total-row" style="border-top:3px double #343a40;">
|
|
<td>Total Liabilities & Equity</td>
|
|
<td class="text-end @(Model.IsBalanced ? "bs-balanced" : "bs-unbalanced")">
|
|
@Model.TotalLiabilitiesAndEquity.ToString("C")
|
|
@if (!Model.IsBalanced)
|
|
{
|
|
<i class="bi bi-exclamation-triangle ms-1" title="Sheet does not balance — check account setup"></i>
|
|
}
|
|
</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-muted small mt-3 no-print">
|
|
<i class="bi bi-info-circle me-1"></i>
|
|
Generated @DateTime.Now.ToString("MMM d, yyyy h:mm tt") · Balances include opening balances plus all recorded transactions through @Model.AsOf.ToString("MMM d, yyyy").
|
|
</div>
|