@model PowderCoating.Core.Entities.JournalEntry @using PowderCoating.Core.Enums @{ ViewData["Title"] = $"Journal Entry {Model.EntryNumber}"; var accountMap = ViewBag.AccountMap as Dictionary ?? new Dictionary(); bool isPosted = Model.Status == JournalEntryStatus.Posted; bool isDraft = Model.Status == JournalEntryStatus.Draft; bool isReversed = Model.Status == JournalEntryStatus.Reversed; bool alreadyReversed = ViewBag.ReversalEntryNumber != null; }
Back

@Model.EntryNumber

@if (isDraft) { Draft } else if (isPosted) { Posted } else { Reversed } @if (Model.IsReversal) { Reversal of @ViewBag.ReversalOfNumber }
@if (isDraft) {
@Html.AntiForgeryToken()
@Html.AntiForgeryToken()
} @if (isPosted && !alreadyReversed) {
@Html.AntiForgeryToken()
} @if (alreadyReversed) { View Reversal (@ViewBag.ReversalEntryNumber) }
@if (TempData["Success"] != null) {
@TempData["Success"]
} @if (TempData["Error"] != null) {
@TempData["Error"]
}
Entry Number
@Model.EntryNumber
Date
@Model.EntryDate.ToString("MMMM d, yyyy")
@if (!string.IsNullOrWhiteSpace(Model.Reference)) {
Reference
@Model.Reference
} @if (!string.IsNullOrWhiteSpace(Model.Description)) {
Description
@Model.Description
}
@if (isPosted && Model.PostedAt.HasValue) {
Posted
@Model.PostedAt.Value.ToLocalTime().ToString("MMM d, yyyy h:mm tt")
by @Html.Raw(Model.PostedBy ?? "—")
}
Created
@Model.CreatedAt.ToLocalTime().ToString("MMM d, yyyy")
Lines @{ var totalDebits = Model.Lines.Sum(l => l.DebitAmount); var totalCredits = Model.Lines.Sum(l => l.CreditAmount); bool balanced = totalDebits == totalCredits; }
Debits: @totalDebits.ToString("C") Credits: @totalCredits.ToString("C") @if (balanced) { Balanced } else { Out of Balance }
@foreach (var line in Model.Lines.OrderBy(l => l.LineOrder)) { }
Account Description Debit Credit
@if (accountMap.TryGetValue(line.AccountId, out var accountName)) { @accountName } else { #@line.AccountId } @line.Description @if (line.DebitAmount > 0) { @line.DebitAmount.ToString("C") } @if (line.CreditAmount > 0) { @line.CreditAmount.ToString("C") }
Totals @totalDebits.ToString("C") @totalCredits.ToString("C")