Addd a table to save logs of expenses

This commit is contained in:
ashutosh.nehete 2025-07-19 16:13:37 +05:30
parent 84f5da25f6
commit c27ffe3a28
5 changed files with 4376 additions and 0 deletions

View File

@ -91,6 +91,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<MPINDetails> MPINDetails { get; set; }
public DbSet<Expenses> Expenses { get; set; }
public DbSet<ExpenseLog> ExpenseLogs { get; set; }
public DbSet<ExpensesTypeMaster> ExpensesTypeMaster { get; set; }
public DbSet<PaymentModeMatser> PaymentModeMatser { get; set; }
public DbSet<ExpensesStatusMaster> ExpensesStatusMaster { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_ExpenseLog_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ExpenseLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpenseId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Action = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Comment = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpenseLogs", x => x.Id);
table.ForeignKey(
name: "FK_ExpenseLogs_Employees_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpenseLogs_Expenses_ExpenseId",
column: x => x.ExpenseId,
principalTable: "Expenses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ExpenseLogs_ExpenseId",
table: "ExpenseLogs",
column: "ExpenseId");
migrationBuilder.CreateIndex(
name: "IX_ExpenseLogs_UpdatedById",
table: "ExpenseLogs",
column: "UpdatedById");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ExpenseLogs");
}
}
}

View File

@ -1288,6 +1288,34 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("BillAttachments");
});
modelBuilder.Entity("Marco.Pms.Model.Expenses.ExpenseLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Action")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Comment")
.HasColumnType("longtext");
b.Property<Guid>("ExpenseId")
.HasColumnType("char(36)");
b.Property<Guid>("UpdatedById")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("ExpenseId");
b.HasIndex("UpdatedById");
b.ToTable("ExpenseLogs");
});
modelBuilder.Entity("Marco.Pms.Model.Expenses.Expenses", b =>
{
b.Property<Guid>("Id")
@ -3657,6 +3685,25 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.Expenses.ExpenseLog", b =>
{
b.HasOne("Marco.Pms.Model.Expenses.Expenses", "Expense")
.WithMany()
.HasForeignKey("ExpenseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Expense");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("Marco.Pms.Model.Expenses.Expenses", b =>
{
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")

View File

@ -0,0 +1,23 @@
using Marco.Pms.Model.Employees;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class ExpenseLog
{
public Guid Id { get; set; }
public Guid ExpenseId { get; set; }
[ValidateNever]
[ForeignKey("ExpenseId")]
public Expenses? Expense { get; set; }
public Guid UpdatedById { get; set; }
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
public string Action { get; set; } = string.Empty;
public string? Comment { get; set; }
}
}