1229081436
- IsCleared + ClearedDate added to Payment, BillPayment, Expense entities - BankReconciliation entity (account, statement date, beginning/ending balance, status) - BankReconciliationStatus enum (InProgress, Completed) - Migration AddBankReconciliation: new BankReconciliations table + IsCleared/ClearedDate columns - IUnitOfWork/UnitOfWork wired with BankReconciliations repo - BankReconciliationsController: Index, Create, Reconcile, ToggleCleared (AJAX), Complete, Report - Reconcile view: deposit/payment checkboxes with live running balance and difference via JS - Complete is gated: only enabled when difference == $0.00 - Nav: Bank Reconciliation added to Finance section in _Layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
167 lines
6.4 KiB
C#
167 lines
6.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddBankReconciliation : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ClearedDate",
|
|
table: "Payments",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsCleared",
|
|
table: "Payments",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ClearedDate",
|
|
table: "Expenses",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsCleared",
|
|
table: "Expenses",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ClearedDate",
|
|
table: "BillPayments",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsCleared",
|
|
table: "BillPayments",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "BankReconciliations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
AccountId = table.Column<int>(type: "int", nullable: false),
|
|
StatementDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
BeginningBalance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
EndingBalance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CompletedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
CompanyId = table.Column<int>(type: "int", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
|
DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
DeletedBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BankReconciliations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_BankReconciliations_Accounts_AccountId",
|
|
column: x => x.AccountId,
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8472));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8478));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8479));
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_BankReconciliations_AccountId",
|
|
table: "BankReconciliations",
|
|
column: "AccountId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "BankReconciliations");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ClearedDate",
|
|
table: "Payments");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsCleared",
|
|
table: "Payments");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ClearedDate",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsCleared",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ClearedDate",
|
|
table: "BillPayments");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsCleared",
|
|
table: "BillPayments");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(6994));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(7001));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(7003));
|
|
}
|
|
}
|
|
}
|