Added the TDSpercentage file in expense table

This commit is contained in:
ashutosh.nehete 2025-11-04 12:47:48 +05:30
parent ad3166c4d4
commit 8ce05840c5
15 changed files with 7860 additions and 105 deletions

View File

@ -120,6 +120,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<AdvancePaymentTransaction> AdvancePaymentTransactions { get; set; } public DbSet<AdvancePaymentTransaction> AdvancePaymentTransactions { get; set; }
public DbSet<StatusUpdateLog> StatusUpdateLogs { get; set; } public DbSet<StatusUpdateLog> StatusUpdateLogs { get; set; }
public DbSet<RecurringPaymentStatus> RecurringPaymentStatus { get; set; }
public DbSet<FCMTokenMapping> FCMTokenMappings { get; set; } public DbSet<FCMTokenMapping> FCMTokenMappings { get; set; }
@ -492,6 +493,64 @@ namespace Marco.Pms.DataAccess.Data
}); });
modelBuilder.Entity<CurrencyMaster>().HasData(
new CurrencyMaster
{
Id = Guid.Parse("78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"),
CurrencyCode = "INR",
CurrencyName = "Indian Rupee",
Symbol = "₹",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("2f672568-a67b-4961-acb2-a8c7834e1762"),
CurrencyCode = "USD",
CurrencyName = "US Dollar",
Symbol = "$",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("4d1155bb-1448-4d97-a732-96c92eb99c45"),
CurrencyCode = "EUR",
CurrencyName = "Euro",
Symbol = "€",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("3e456237-ef06-4ea1-a261-188c9b0c6df6"),
CurrencyCode = "GBP",
CurrencyName = "Pound Sterling",
Symbol = "£",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("297e237a-56d3-48f6-b39d-ec3991dea8bf"),
CurrencyCode = "JPY",
CurrencyName = "Japanese Yen",
Symbol = "¥",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("efe9b4f6-64d6-446e-a42d-1c7aaf6dd70d"),
CurrencyCode = "RUB",
CurrencyName = "Russian Ruble",
Symbol = "₽",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("b960166a-f7e9-49e3-bb4b-28511f126c08"),
CurrencyCode = "CNY",
CurrencyName = "Chinese Yuan (Renminbi)",
Symbol = "¥",
IsActive = true
}
);
modelBuilder.Entity<ExpensesStatusMaster>().HasData( modelBuilder.Entity<ExpensesStatusMaster>().HasData(
new ExpensesStatusMaster new ExpensesStatusMaster
@ -1100,6 +1159,29 @@ namespace Marco.Pms.DataAccess.Data
} }
); );
modelBuilder.Entity<RecurringPaymentStatus>().HasData(
new RecurringPaymentStatus
{
Id = Guid.Parse("da462422-13b2-45cc-a175-910a225f6fc8"),
Name = "Activated"
},
new RecurringPaymentStatus
{
Id = Guid.Parse("3ec864d2-8bf5-42fb-ba70-5090301dd816"),
Name = "De-Activated"
},
new RecurringPaymentStatus
{
Id = Guid.Parse("306856fb-5655-42eb-bf8b-808bb5e84725"),
Name = "Completed"
},
new RecurringPaymentStatus
{
Id = Guid.Parse("8bfc9346-e092-4a80-acbf-515ae1ef6868"),
Name = "Paused"
}
);
modelBuilder.Entity<Module>().HasData( modelBuilder.Entity<Module>().HasData(
new Module new Module
{ {
@ -1134,6 +1216,7 @@ namespace Marco.Pms.DataAccess.Data
// Project Module // Project Module
new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Project Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Project Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), Description = "Expense Management is the systematic process of tracking, controlling, and reporting business-related expenditures.", Name = "Expense Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), Description = "Expense Management is the systematic process of tracking, controlling, and reporting business-related expenditures.", Name = "Expense Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("86e80017-0698-4efe-93d0-806de67266e0"), Description = "Recurring Template Management is the automated creation and scheduling of repetitive tasks, processes, or transactions using predefined templates at set intervals to ensure consistent and efficient workflow execution without manual recreation each time.", Name = "Recurring Template Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), Description = "Collection Management is a feature that enables organizations to track, organize, and manage the status and recovery of receivables or assets efficiently throughout their lifecycle, supporting systematic follow-up and resolution of outstanding accounts.", Name = "Collection Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), Description = "Collection Management is a feature that enables organizations to track, organize, and manage the status and recovery of receivables or assets efficiently throughout their lifecycle, supporting systematic follow-up and resolution of outstanding accounts.", Name = "Collection Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true }, new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
@ -1206,6 +1289,11 @@ namespace Marco.Pms.DataAccess.Data
new FeaturePermission { Id = new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Process", Description = "Allows a user to handle post-approval actions such as recording payments, updating financial records, or marking expenses as reimbursed or settled." }, new FeaturePermission { Id = new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Process", Description = "Allows a user to handle post-approval actions such as recording payments, updating financial records, or marking expenses as reimbursed or settled." },
new FeaturePermission { Id = new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Manage", Description = "Allows a user to configure and control system settings, such as managing expense types, payment modes, permissions, and overall workflow rules." }, new FeaturePermission { Id = new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Manage", Description = "Allows a user to configure and control system settings, such as managing expense types, payment modes, permissions, and overall workflow rules." },
// Recurring Template Management
new FeaturePermission { Id = new Guid("6382ea8b-aff2-4cd2-a48f-a652b35825d8"), FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"), IsEnabled = true, Name = "Manage Recurring", Description = "Manage Recurring Template payment permission allows authorized users to set up, modify, and execute automated recurring payments using predefined templates, ensuring secure and controlled handling of repetitive financial transactions." },
new FeaturePermission { Id = new Guid("7ddf2fba-c44d-4fe3-b4ec-690ff70be2e3"), FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"), IsEnabled = true, Name = "View All Recurring", Description = "The \"View All Recurring Template payment permission\" generally allows users to see and access all recurring payment templates in the system, enabling them to review, manage, and process recurring transactions efficiently." },
new FeaturePermission { Id = new Guid("e5d21efe-573d-4a16-a0f8-414d3e442e78"), FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"), IsEnabled = true, Name = "View Self Recurring", Description = "View Self Recurring Template payment permission allows a user to view and access their own recurring payment templates without editing rights." },
// Collection Management Feature // Collection Management Feature
new FeaturePermission { Id = new Guid("dbf17591-09fe-4c93-9e1a-12db8f5cc5de"), FeatureId = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), IsEnabled = true, Name = "Collection Admin", Description = "Collection Admin is a permission that grants a user full administrative control over collections, including creating, editing, managing access, and deleting collections within a system." }, new FeaturePermission { Id = new Guid("dbf17591-09fe-4c93-9e1a-12db8f5cc5de"), FeatureId = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), IsEnabled = true, Name = "Collection Admin", Description = "Collection Admin is a permission that grants a user full administrative control over collections, including creating, editing, managing access, and deleting collections within a system." },
new FeaturePermission { Id = new Guid("c8d7eea5-4033-4aad-9ebe-76de49896830"), FeatureId = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), IsEnabled = true, Name = "View Collection", Description = "View Collection is a permission that allows users to see and browse assets or items within a collection without making any modifications or edits to its contents." }, new FeaturePermission { Id = new Guid("c8d7eea5-4033-4aad-9ebe-76de49896830"), FeatureId = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), IsEnabled = true, Name = "View Collection", Description = "View Collection is a permission that allows users to see and browse assets or items within a collection without making any modifications or edits to its contents." },
@ -1219,65 +1307,6 @@ namespace Marco.Pms.DataAccess.Data
new FeaturePermission { Id = new Guid("7a6cf830-0008-4e03-b31d-0d050cb634f4"), FeatureId = new Guid("6d4c82d6-dbce-48ab-b8b8-f785f4d8c914"), IsEnabled = true, Name = "View Organization", Description = "Allow the user to view information of the organization" } new FeaturePermission { Id = new Guid("7a6cf830-0008-4e03-b31d-0d050cb634f4"), FeatureId = new Guid("6d4c82d6-dbce-48ab-b8b8-f785f4d8c914"), IsEnabled = true, Name = "View Organization", Description = "Allow the user to view information of the organization" }
); );
modelBuilder.Entity<CurrencyMaster>().HasData(
new CurrencyMaster
{
Id = Guid.Parse("78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"),
CurrencyCode = "INR",
CurrencyName = "Indian Rupee",
Symbol = "₹",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("2f672568-a67b-4961-acb2-a8c7834e1762"),
CurrencyCode = "USD",
CurrencyName = "US Dollar",
Symbol = "$",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("4d1155bb-1448-4d97-a732-96c92eb99c45"),
CurrencyCode = "EUR",
CurrencyName = "Euro",
Symbol = "€",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("3e456237-ef06-4ea1-a261-188c9b0c6df6"),
CurrencyCode = "GBP",
CurrencyName = "Pound Sterling",
Symbol = "£",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("297e237a-56d3-48f6-b39d-ec3991dea8bf"),
CurrencyCode = "JPY",
CurrencyName = "Japanese Yen",
Symbol = "¥",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("efe9b4f6-64d6-446e-a42d-1c7aaf6dd70d"),
CurrencyCode = "RUB",
CurrencyName = "Russian Ruble",
Symbol = "₽",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("b960166a-f7e9-49e3-bb4b-28511f126c08"),
CurrencyCode = "CNY",
CurrencyName = "Chinese Yuan (Renminbi)",
Symbol = "¥",
IsActive = true
}
);
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,191 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_TDSPercentage_Field_In_Expense_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RecurringPayments_ExpensesStatusMaster_ExpenseStatusId",
table: "RecurringPayments");
migrationBuilder.DropForeignKey(
name: "FK_RecurringPayments_ExpensesStatusMaster_StatusId",
table: "RecurringPayments");
migrationBuilder.DropIndex(
name: "IX_RecurringPayments_ExpenseStatusId",
table: "RecurringPayments");
migrationBuilder.DropColumn(
name: "ExpenseStatusId",
table: "RecurringPayments");
migrationBuilder.AddColumn<double>(
name: "TDSPercentage",
table: "PaymentRequests",
type: "double",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "PaymentRequestId",
table: "Expenses",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<double>(
name: "TDSPercentage",
table: "Expenses",
type: "double",
nullable: true);
migrationBuilder.CreateTable(
name: "RecurringPaymentStatus",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_RecurringPaymentStatus", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "Features",
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
values: new object[] { new Guid("86e80017-0698-4efe-93d0-806de67266e0"), "Recurring Template Management is the automated creation and scheduling of repetitive tasks, processes, or transactions using predefined templates at set intervals to ensure consistent and efficient workflow execution without manual recreation each time.", true, new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), "Recurring Template Management" });
migrationBuilder.InsertData(
table: "RecurringPaymentStatus",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ new Guid("306856fb-5655-42eb-bf8b-808bb5e84725"), "Completed" },
{ new Guid("3ec864d2-8bf5-42fb-ba70-5090301dd816"), "De-Activated" },
{ new Guid("8bfc9346-e092-4a80-acbf-515ae1ef6868"), "Paused" },
{ new Guid("da462422-13b2-45cc-a175-910a225f6fc8"), "Activated" }
});
migrationBuilder.InsertData(
table: "FeaturePermissions",
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
values: new object[,]
{
{ new Guid("6382ea8b-aff2-4cd2-a48f-a652b35825d8"), "Manage Recurring Template payment permission allows authorized users to set up, modify, and execute automated recurring payments using predefined templates, ensuring secure and controlled handling of repetitive financial transactions.", new Guid("86e80017-0698-4efe-93d0-806de67266e0"), true, "Manage Recurring" },
{ new Guid("7ddf2fba-c44d-4fe3-b4ec-690ff70be2e3"), "The \"View All Recurring Template payment permission\" generally allows users to see and access all recurring payment templates in the system, enabling them to review, manage, and process recurring transactions efficiently.", new Guid("86e80017-0698-4efe-93d0-806de67266e0"), true, "View All Recurring" },
{ new Guid("e5d21efe-573d-4a16-a0f8-414d3e442e78"), "View Self Recurring Template payment permission allows a user to view and access their own recurring payment templates without editing rights.", new Guid("86e80017-0698-4efe-93d0-806de67266e0"), true, "View Self Recurring" }
});
migrationBuilder.CreateIndex(
name: "IX_Expenses_PaymentRequestId",
table: "Expenses",
column: "PaymentRequestId");
migrationBuilder.AddForeignKey(
name: "FK_Expenses_PaymentRequests_PaymentRequestId",
table: "Expenses",
column: "PaymentRequestId",
principalTable: "PaymentRequests",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecurringPayments_RecurringPaymentStatus_StatusId",
table: "RecurringPayments",
column: "StatusId",
principalTable: "RecurringPaymentStatus",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Expenses_PaymentRequests_PaymentRequestId",
table: "Expenses");
migrationBuilder.DropForeignKey(
name: "FK_RecurringPayments_RecurringPaymentStatus_StatusId",
table: "RecurringPayments");
migrationBuilder.DropTable(
name: "RecurringPaymentStatus");
migrationBuilder.DropIndex(
name: "IX_Expenses_PaymentRequestId",
table: "Expenses");
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("6382ea8b-aff2-4cd2-a48f-a652b35825d8"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("7ddf2fba-c44d-4fe3-b4ec-690ff70be2e3"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("e5d21efe-573d-4a16-a0f8-414d3e442e78"));
migrationBuilder.DeleteData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("86e80017-0698-4efe-93d0-806de67266e0"));
migrationBuilder.DropColumn(
name: "TDSPercentage",
table: "PaymentRequests");
migrationBuilder.DropColumn(
name: "PaymentRequestId",
table: "Expenses");
migrationBuilder.DropColumn(
name: "TDSPercentage",
table: "Expenses");
migrationBuilder.AddColumn<Guid>(
name: "ExpenseStatusId",
table: "RecurringPayments",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_RecurringPayments_ExpenseStatusId",
table: "RecurringPayments",
column: "ExpenseStatusId");
migrationBuilder.AddForeignKey(
name: "FK_RecurringPayments_ExpensesStatusMaster_ExpenseStatusId",
table: "RecurringPayments",
column: "ExpenseStatusId",
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecurringPayments_ExpensesStatusMaster_StatusId",
table: "RecurringPayments",
column: "StatusId",
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1955,6 +1955,30 @@ namespace Marco.Pms.DataAccess.Migrations
Name = "Manage" Name = "Manage"
}, },
new new
{
Id = new Guid("6382ea8b-aff2-4cd2-a48f-a652b35825d8"),
Description = "Manage Recurring Template payment permission allows authorized users to set up, modify, and execute automated recurring payments using predefined templates, ensuring secure and controlled handling of repetitive financial transactions.",
FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"),
IsEnabled = true,
Name = "Manage Recurring"
},
new
{
Id = new Guid("7ddf2fba-c44d-4fe3-b4ec-690ff70be2e3"),
Description = "The \"View All Recurring Template payment permission\" generally allows users to see and access all recurring payment templates in the system, enabling them to review, manage, and process recurring transactions efficiently.",
FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"),
IsEnabled = true,
Name = "View All Recurring"
},
new
{
Id = new Guid("e5d21efe-573d-4a16-a0f8-414d3e442e78"),
Description = "View Self Recurring Template payment permission allows a user to view and access their own recurring payment templates without editing rights.",
FeatureId = new Guid("86e80017-0698-4efe-93d0-806de67266e0"),
IsEnabled = true,
Name = "View Self Recurring"
},
new
{ {
Id = new Guid("dbf17591-09fe-4c93-9e1a-12db8f5cc5de"), Id = new Guid("dbf17591-09fe-4c93-9e1a-12db8f5cc5de"),
Description = "Collection Admin is a permission that grants a user full administrative control over collections, including creating, editing, managing access, and deleting collections within a system.", Description = "Collection Admin is a permission that grants a user full administrative control over collections, including creating, editing, managing access, and deleting collections within a system.",
@ -2344,6 +2368,9 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<Guid>("PaymentModeId") b.Property<Guid>("PaymentModeId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<Guid?>("PaymentRequestId")
.HasColumnType("char(36)");
b.Property<bool>("PreApproved") b.Property<bool>("PreApproved")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
@ -2363,6 +2390,9 @@ namespace Marco.Pms.DataAccess.Migrations
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<double?>("TDSPercentage")
.HasColumnType("double");
b.Property<Guid>("TenantId") b.Property<Guid>("TenantId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
@ -2391,6 +2421,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("PaymentModeId"); b.HasIndex("PaymentModeId");
b.HasIndex("PaymentRequestId");
b.HasIndex("ProcessedById"); b.HasIndex("ProcessedById");
b.HasIndex("ProjectId"); b.HasIndex("ProjectId");
@ -2589,6 +2621,9 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<Guid?>("RecurringPaymentId") b.Property<Guid?>("RecurringPaymentId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<double?>("TDSPercentage")
.HasColumnType("double");
b.Property<Guid>("TenantId") b.Property<Guid>("TenantId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
@ -2683,9 +2718,6 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<Guid?>("ExpenseCategoryId") b.Property<Guid?>("ExpenseCategoryId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<Guid>("ExpenseStatusId")
.HasColumnType("char(36)");
b.Property<int>("Frequency") b.Property<int>("Frequency")
.HasColumnType("int"); .HasColumnType("int");
@ -2749,8 +2781,6 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("ExpenseCategoryId"); b.HasIndex("ExpenseCategoryId");
b.HasIndex("ExpenseStatusId");
b.HasIndex("ProjectId"); b.HasIndex("ProjectId");
b.HasIndex("StatusId"); b.HasIndex("StatusId");
@ -2762,6 +2792,43 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("RecurringPayments"); b.ToTable("RecurringPayments");
}); });
modelBuilder.Entity("Marco.Pms.Model.Expenses.RecurringPaymentStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("RecurringPaymentStatus");
b.HasData(
new
{
Id = new Guid("da462422-13b2-45cc-a175-910a225f6fc8"),
Name = "Activated"
},
new
{
Id = new Guid("3ec864d2-8bf5-42fb-ba70-5090301dd816"),
Name = "De-Activated"
},
new
{
Id = new Guid("306856fb-5655-42eb-bf8b-808bb5e84725"),
Name = "Completed"
},
new
{
Id = new Guid("8bfc9346-e092-4a80-acbf-515ae1ef6868"),
Name = "Paused"
});
});
modelBuilder.Entity("Marco.Pms.Model.Expenses.StatusPermissionMapping", b => modelBuilder.Entity("Marco.Pms.Model.Expenses.StatusPermissionMapping", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -3459,6 +3526,14 @@ namespace Marco.Pms.DataAccess.Migrations
Name = "Expense Management" Name = "Expense Management"
}, },
new new
{
Id = new Guid("86e80017-0698-4efe-93d0-806de67266e0"),
Description = "Recurring Template Management is the automated creation and scheduling of repetitive tasks, processes, or transactions using predefined templates at set intervals to ensure consistent and efficient workflow execution without manual recreation each time.",
IsActive = true,
ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"),
Name = "Recurring Template Management"
},
new
{ {
Id = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"), Id = new Guid("fc586e7d-ed1a-45e5-bb51-9f34af98ec13"),
Description = "Collection Management is a feature that enables organizations to track, organize, and manage the status and recovery of receivables or assets efficiently throughout their lifecycle, supporting systematic follow-up and resolution of outstanding accounts.", Description = "Collection Management is a feature that enables organizations to track, organize, and manage the status and recovery of receivables or assets efficiently throughout their lifecycle, supporting systematic follow-up and resolution of outstanding accounts.",
@ -6352,6 +6427,10 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Marco.Pms.Model.Expenses.PaymentRequest", "PaymentRequest")
.WithMany()
.HasForeignKey("PaymentRequestId");
b.HasOne("Marco.Pms.Model.Employees.Employee", "ProcessedBy") b.HasOne("Marco.Pms.Model.Employees.Employee", "ProcessedBy")
.WithMany() .WithMany()
.HasForeignKey("ProcessedById"); .HasForeignKey("ProcessedById");
@ -6388,6 +6467,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("PaymentMode"); b.Navigation("PaymentMode");
b.Navigation("PaymentRequest");
b.Navigation("ProcessedBy"); b.Navigation("ProcessedBy");
b.Navigation("Project"); b.Navigation("Project");
@ -6574,17 +6655,11 @@ namespace Marco.Pms.DataAccess.Migrations
.WithMany() .WithMany()
.HasForeignKey("ExpenseCategoryId"); .HasForeignKey("ExpenseCategoryId");
b.HasOne("Marco.Pms.Model.Master.ExpensesStatusMaster", "ExpenseStatus")
.WithMany()
.HasForeignKey("ExpenseStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Projects.Project", "Project") b.HasOne("Marco.Pms.Model.Projects.Project", "Project")
.WithMany() .WithMany()
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
b.HasOne("Marco.Pms.Model.Master.ExpensesStatusMaster", "Status") b.HasOne("Marco.Pms.Model.Expenses.RecurringPaymentStatus", "Status")
.WithMany() .WithMany()
.HasForeignKey("StatusId") .HasForeignKey("StatusId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -6606,8 +6681,6 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("ExpenseCategory"); b.Navigation("ExpenseCategory");
b.Navigation("ExpenseStatus");
b.Navigation("Project"); b.Navigation("Project");
b.Navigation("Status"); b.Navigation("Status");

View File

@ -5,6 +5,7 @@
public Guid ExpenseId { get; set; } public Guid ExpenseId { get; set; }
public Guid StatusId { get; set; } public Guid StatusId { get; set; }
public string? Comment { get; set; } public string? Comment { get; set; }
public double? TDSPercentage { get; set; }
public string? ReimburseTransactionId { get; set; } public string? ReimburseTransactionId { get; set; }
public DateTime? ReimburseDate { get; set; } public DateTime? ReimburseDate { get; set; }
public Guid? ReimburseById { get; set; } public Guid? ReimburseById { get; set; }

View File

@ -6,6 +6,7 @@
public Guid StatusId { get; set; } public Guid StatusId { get; set; }
public string? Comment { get; set; } public string? Comment { get; set; }
public string? PaidTransactionId { get; set; } public string? PaidTransactionId { get; set; }
public double? TDSPercentage { get; set; }
public DateTime? PaidAt { get; set; } public DateTime? PaidAt { get; set; }
public Guid? PaidById { get; set; } public Guid? PaidById { get; set; }
} }

View File

@ -47,6 +47,10 @@
public static readonly Guid DownloadDocument = Guid.Parse("404373d0-860f-490e-a575-1c086ffbce1d"); public static readonly Guid DownloadDocument = Guid.Parse("404373d0-860f-490e-a575-1c086ffbce1d");
public static readonly Guid VerifyDocument = Guid.Parse("13a1f30f-38d1-41bf-8e7a-b75189aab8e0"); public static readonly Guid VerifyDocument = Guid.Parse("13a1f30f-38d1-41bf-8e7a-b75189aab8e0");
public static readonly Guid ManageRecurring = Guid.Parse("6382ea8b-aff2-4cd2-a48f-a652b35825d8");
public static readonly Guid ViewAllRecurring = Guid.Parse("7ddf2fba-c44d-4fe3-b4ec-690ff70be2e3");
public static readonly Guid ViewSelfRecurring = Guid.Parse("e5d21efe-573d-4a16-a0f8-414d3e442e78");
public static readonly Guid CollectionAdmin = Guid.Parse("dbf17591-09fe-4c93-9e1a-12db8f5cc5de"); public static readonly Guid CollectionAdmin = Guid.Parse("dbf17591-09fe-4c93-9e1a-12db8f5cc5de");
public static readonly Guid ViewCollection = Guid.Parse("c8d7eea5-4033-4aad-9ebe-76de49896830"); public static readonly Guid ViewCollection = Guid.Parse("c8d7eea5-4033-4aad-9ebe-76de49896830");
public static readonly Guid CreateCollection = Guid.Parse("b93141fd-dbd3-4051-8f57-bf25d18e3555"); public static readonly Guid CreateCollection = Guid.Parse("b93141fd-dbd3-4051-8f57-bf25d18e3555");

View File

@ -61,7 +61,13 @@ namespace Marco.Pms.Model.Expenses
public string? GSTNumber { get; set; } public string? GSTNumber { get; set; }
public string SupplerName { get; set; } = string.Empty; public string SupplerName { get; set; } = string.Empty;
public double Amount { get; set; } public double Amount { get; set; }
public double? TDSPercentage { get; set; }
public int? NoOfPersons { get; set; } public int? NoOfPersons { get; set; }
public Guid? PaymentRequestId { get; set; }
[ValidateNever]
[ForeignKey("PaymentRequestId")]
public PaymentRequest? PaymentRequest { get; set; }
public Guid StatusId { get; set; } public Guid StatusId { get; set; }
[ValidateNever] [ValidateNever]

View File

@ -22,6 +22,7 @@ namespace Marco.Pms.Model.Expenses
[ForeignKey("CurrencyId")] [ForeignKey("CurrencyId")]
public CurrencyMaster? Currency { get; set; } public CurrencyMaster? Currency { get; set; }
public double Amount { get; set; } public double Amount { get; set; }
public double? TDSPercentage { get; set; }
public DateTime DueDate { get; set; } public DateTime DueDate { get; set; }
public Guid? ProjectId { get; set; } public Guid? ProjectId { get; set; }

View File

@ -37,11 +37,6 @@ namespace Marco.Pms.Model.Expenses
[ValidateNever] [ValidateNever]
[ForeignKey("ExpenseCategoryId")] [ForeignKey("ExpenseCategoryId")]
public ExpensesTypeMaster? ExpenseCategory { get; set; } public ExpensesTypeMaster? ExpenseCategory { get; set; }
public Guid ExpenseStatusId { get; set; }
[ValidateNever]
[ForeignKey("ExpenseStatusId")]
public ExpensesStatusMaster? ExpenseStatus { get; set; }
public Guid StatusId { get; set; } public Guid StatusId { get; set; }
[ValidateNever] [ValidateNever]

View File

@ -8,7 +8,7 @@ namespace Marco.Pms.Model.ViewModels.Expanses
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public ProjectInfoVM? Project { get; set; } public ProjectInfoVM? Project { get; set; }
public ExpensesCategoryMasterVM? ExpensesCategory { get; set; } public ExpensesCategoryMasterVM? ExpenseCategory { get; set; }
public PaymentModeMatserVM? PaymentMode { get; set; } public PaymentModeMatserVM? PaymentMode { get; set; }
public BasicEmployeeVM? PaidBy { get; set; } public BasicEmployeeVM? PaidBy { get; set; }
public BasicEmployeeVM? CreatedBy { get; set; } public BasicEmployeeVM? CreatedBy { get; set; }

View File

@ -47,8 +47,8 @@ namespace Marco.Pms.Services.Controllers
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
[HttpGet("details")] [HttpGet("details/{id?}")]
public async Task<IActionResult> GetExpenseDetails([FromQuery] Guid? id, [FromQuery] string? expenseUId) public async Task<IActionResult> GetExpenseDetails(Guid? id, [FromQuery] string? expenseUId)
{ {
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _expensesService.GetExpenseDetailsAsync(id, expenseUId, loggedInEmployee, tenantId); var response = await _expensesService.GetExpenseDetailsAsync(id, expenseUId, loggedInEmployee, tenantId);
@ -199,9 +199,22 @@ namespace Marco.Pms.Services.Controllers
} }
#endregion #endregion
#region =================================================================== Recurring Payment Functions ===================================================================
[HttpPost("recurring-payment/create")]
public async Task<IActionResult> CreateRecurringPayment([FromBody] RecurringTemplateDto model)
{
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _expensesService.CreateRecurringPaymentAsync(model, loggedInEmployee, tenantId);
return StatusCode(response.StatusCode, response);
}
#endregion
#region =================================================================== Advance Payment Functions =================================================================== #region =================================================================== Advance Payment Functions ===================================================================
[HttpGet("/get/transactions/{employeeId}")] [HttpGet("get/transactions/{employeeId}")]
public async Task<IActionResult> GetAdvancePaymentTransaction(Guid employeeId) public async Task<IActionResult> GetAdvancePaymentTransaction(Guid employeeId)
{ {
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();

View File

@ -1258,6 +1258,7 @@ namespace Marco.Pms.Services.Helpers
{ {
var response = _mapper.Map<ExpenseDetailsMongoDB>(m); var response = _mapper.Map<ExpenseDetailsMongoDB>(m);
response.ExpenseUId = $"{m.UIDPrefix}/{m.UIDPostfix:D5}";
response.Project = projects.Where(p => p.Id == m.ProjectId).Select(p => _mapper.Map<ProjectBasicMongoDB>(p)).FirstOrDefault() ?? new ProjectBasicMongoDB(); response.Project = projects.Where(p => p.Id == m.ProjectId).Select(p => _mapper.Map<ProjectBasicMongoDB>(p)).FirstOrDefault() ?? new ProjectBasicMongoDB();
response.PaidBy = paidBys.Where(p => p.Id == m.PaidById).Select(p => _mapper.Map<BasicEmployeeMongoDB>(p)).FirstOrDefault() ?? new BasicEmployeeMongoDB(); response.PaidBy = paidBys.Where(p => p.Id == m.PaidById).Select(p => _mapper.Map<BasicEmployeeMongoDB>(p)).FirstOrDefault() ?? new BasicEmployeeMongoDB();
response.CreatedBy = createdBys.Where(e => e.Id == m.CreatedById).Select(e => _mapper.Map<BasicEmployeeMongoDB>(e)).FirstOrDefault() ?? new BasicEmployeeMongoDB(); response.CreatedBy = createdBys.Where(e => e.Id == m.CreatedById).Select(e => _mapper.Map<BasicEmployeeMongoDB>(e)).FirstOrDefault() ?? new BasicEmployeeMongoDB();
@ -1386,6 +1387,7 @@ namespace Marco.Pms.Services.Helpers
var response = _mapper.Map<ExpenseDetailsMongoDB>(model); var response = _mapper.Map<ExpenseDetailsMongoDB>(model);
response.ExpenseUId = $"{model.UIDPrefix}/{model.UIDPostfix:D5}";
response.Project = _mapper.Map<ProjectBasicMongoDB>(project); response.Project = _mapper.Map<ProjectBasicMongoDB>(project);
response.PaidBy = _mapper.Map<BasicEmployeeMongoDB>(paidBy); response.PaidBy = _mapper.Map<BasicEmployeeMongoDB>(paidBy);
response.CreatedBy = _mapper.Map<BasicEmployeeMongoDB>(createdBy); response.CreatedBy = _mapper.Map<BasicEmployeeMongoDB>(createdBy);

View File

@ -267,6 +267,14 @@ namespace Marco.Pms.Services.MappingProfiles
#endregion #endregion
#region ======================================================= Recurring Request =======================================================
CreateMap<RecurringTemplateDto, RecurringPayment>();
//CreateMap<RecurringPayment, PaymentRequestVM>();
//CreateMap<RecurringPayment, PaymentRequestDetailsVM>();
#endregion
CreateMap<AdvancePaymentTransaction, AdvancePaymentTransactionVM>(); CreateMap<AdvancePaymentTransaction, AdvancePaymentTransactionVM>();
#endregion #endregion

View File

@ -219,13 +219,11 @@ namespace Marco.Pms.Services.Service
totalEntites = await expensesQuery.CountAsync(); totalEntites = await expensesQuery.CountAsync();
var paginatedQuery = expensesQuery // 5. --- Execute Query and Map Results ---
var expensesList = await expensesQuery
.OrderByDescending(e => e.CreatedAt) .OrderByDescending(e => e.CreatedAt)
.Skip((pageNumber - 1) * pageSize) .Skip((pageNumber - 1) * pageSize)
.Take(pageSize); .Take(pageSize).ToListAsync();
// 5. --- Execute Query and Map Results ---
var expensesList = await paginatedQuery.ToListAsync();
if (!expensesList.Any()) if (!expensesList.Any())
{ {
@ -234,7 +232,12 @@ namespace Marco.Pms.Services.Service
} }
//expenseVM = await GetAllExpnesRelatedTables(expensesList, tenantId); //expenseVM = await GetAllExpnesRelatedTables(expensesList, tenantId);
expenseVM = _mapper.Map<List<ExpenseList>>(expensesList); expenseVM = expensesList.Select(e =>
{
var result = _mapper.Map<ExpenseList>(e);
result.ExpenseUId = $"{e.UIDPrefix}/{e.UIDPostfix:D5}";
return result;
}).ToList();
totalPages = (int)Math.Ceiling((double)totalEntites / pageSize); totalPages = (int)Math.Ceiling((double)totalEntites / pageSize);
} }
@ -312,7 +315,7 @@ namespace Marco.Pms.Services.Service
.Include(e => e.PaymentMode) .Include(e => e.PaymentMode)
.Include(e => e.ExpenseCategory) .Include(e => e.ExpenseCategory)
.Include(e => e.Status) .Include(e => e.Status)
.AsNoTracking().FirstOrDefaultAsync(e => (e.Id == id || e.ExpenseUId == expenseUId) && e.TenantId == tenantId); .AsNoTracking().FirstOrDefaultAsync(e => (e.Id == id || (e.UIDPrefix + "/" + e.UIDPostfix.ToString().PadLeft(5, '0')) == expenseUId) && e.TenantId == tenantId);
if (expense == null) if (expense == null)
{ {
@ -489,15 +492,6 @@ namespace Marco.Pms.Services.Service
await using var dbContext = await _dbContextFactory.CreateDbContextAsync(); await using var dbContext = await _dbContextFactory.CreateDbContextAsync();
return await dbContext.PaymentModeMatser.AsNoTracking().FirstOrDefaultAsync(pm => pm.Id == dto.PaymentModeId); return await dbContext.PaymentModeMatser.AsNoTracking().FirstOrDefaultAsync(pm => pm.Id == dto.PaymentModeId);
}); });
var expenseUIdTask = Task.Run(async () =>
{
await using var dbContext = await _dbContextFactory.CreateDbContextAsync();
var result = await dbContext.Expenses
.Where(e => !string.IsNullOrWhiteSpace(e.ExpenseUId)).ToListAsync();
return result
.Select(e => ExtractNumber(e.ExpenseUId))
.OrderByDescending(id => id).FirstOrDefault();
});
var statusMappingTask = Task.Run(async () => var statusMappingTask = Task.Run(async () =>
{ {
await using var dbContext = await _dbContextFactory.CreateDbContextAsync(); await using var dbContext = await _dbContextFactory.CreateDbContextAsync();
@ -517,7 +511,7 @@ namespace Marco.Pms.Services.Service
// Await all prerequisite checks at once. // Await all prerequisite checks at once.
await Task.WhenAll(hasUploadPermissionTask, projectTask, expenseCategoriesTask, paymentModeTask, statusMappingTask, paidByTask, expenseUIdTask); await Task.WhenAll(hasUploadPermissionTask, projectTask, expenseCategoriesTask, paymentModeTask, statusMappingTask, paidByTask);
// 2. Aggregate and Check Results // 2. Aggregate and Check Results
if (!await hasUploadPermissionTask) if (!await hasUploadPermissionTask)
@ -532,7 +526,6 @@ namespace Marco.Pms.Services.Service
var paymentMode = await paymentModeTask; var paymentMode = await paymentModeTask;
var statusMapping = await statusMappingTask; var statusMapping = await statusMappingTask;
var paidBy = await paidByTask; var paidBy = await paidByTask;
var lastExpenseUId = expenseUIdTask.Result;
if (project == null) validationErrors.Add("Project not found."); if (project == null) validationErrors.Add("Project not found.");
if (paidBy == null) validationErrors.Add("Paid by employee not found"); if (paidBy == null) validationErrors.Add("Paid by employee not found");
@ -549,7 +542,6 @@ namespace Marco.Pms.Services.Service
return ApiResponse<object>.ErrorResponse("Invalid input data.", errorMessage, 400); return ApiResponse<object>.ErrorResponse("Invalid input data.", errorMessage, 400);
} }
var currentexpenseUId = (lastExpenseUId + 1).ToString("D5");
string uIDPrefix = $"EX/{DateTime.Now:MMyy}"; string uIDPrefix = $"EX/{DateTime.Now:MMyy}";
@ -561,7 +553,6 @@ namespace Marco.Pms.Services.Service
// 3. Entity Creation // 3. Entity Creation
var expense = _mapper.Map<Expenses>(dto); var expense = _mapper.Map<Expenses>(dto);
expense.ExpenseUId = $"EX-{currentexpenseUId}";
expense.UIDPostfix = uIDPostfix; expense.UIDPostfix = uIDPostfix;
expense.UIDPrefix = uIDPrefix; expense.UIDPrefix = uIDPrefix;
expense.CreatedById = loggedInEmployee.Id; expense.CreatedById = loggedInEmployee.Id;
@ -587,12 +578,13 @@ namespace Marco.Pms.Services.Service
await _cache.AddExpenseByObjectAsync(expense); await _cache.AddExpenseByObjectAsync(expense);
var response = _mapper.Map<ExpenseList>(expense); var response = _mapper.Map<ExpenseList>(expense);
response.ExpenseUId = $"{expense.UIDPrefix}/{expense.UIDPostfix:D5}";
response.PaidBy = _mapper.Map<BasicEmployeeVM>(paidBy); response.PaidBy = _mapper.Map<BasicEmployeeVM>(paidBy);
response.Project = _mapper.Map<ProjectInfoVM>(project); response.Project = _mapper.Map<ProjectInfoVM>(project);
response.Status = _mapper.Map<ExpensesStatusMasterVM>(statusMapping!.Status); response.Status = _mapper.Map<ExpensesStatusMasterVM>(statusMapping!.Status);
response.NextStatus = _mapper.Map<List<ExpensesStatusMasterVM>>(statusMapping.NextStatus); response.NextStatus = _mapper.Map<List<ExpensesStatusMasterVM>>(statusMapping.NextStatus);
response.PaymentMode = _mapper.Map<PaymentModeMatserVM>(paymentMode); response.PaymentMode = _mapper.Map<PaymentModeMatserVM>(paymentMode);
response.ExpensesCategory = _mapper.Map<ExpensesCategoryMasterVM>(expenseCategory); response.ExpenseCategory = _mapper.Map<ExpensesCategoryMasterVM>(expenseCategory);
_logger.LogInfo("Successfully created Expense {ExpenseId} for Project {ProjectId}.", expense.Id, expense.ProjectId); _logger.LogInfo("Successfully created Expense {ExpenseId} for Project {ProjectId}.", expense.Id, expense.ProjectId);
return ApiResponse<object>.SuccessResponse(response, "Expense created successfully.", 201); return ApiResponse<object>.SuccessResponse(response, "Expense created successfully.", 201);
@ -805,6 +797,7 @@ namespace Marco.Pms.Services.Service
// 7. Add Reimbursement if applicable // 7. Add Reimbursement if applicable
if (model.StatusId == Processed) if (model.StatusId == Processed)
{ {
expense.TDSPercentage = model.TDSPercentage;
var reimbursement = new ExpensesReimburse var reimbursement = new ExpensesReimburse
{ {
ReimburseTransactionId = model.ReimburseTransactionId!, ReimburseTransactionId = model.ReimburseTransactionId!,
@ -1481,7 +1474,11 @@ namespace Marco.Pms.Services.Service
var updateLogsTask = Task.Run(async () => var updateLogsTask = Task.Run(async () =>
{ {
await using var context = await _dbContextFactory.CreateDbContextAsync(); await using var context = await _dbContextFactory.CreateDbContextAsync();
return await context.StatusUpdateLogs.Include(sul => sul.UpdatedBy).Where(sul => sul.EntityId == paymentRequest.Id && sul.TenantId == tenantId).ToListAsync(); return await context.StatusUpdateLogs
.Include(sul => sul.UpdatedBy)
.Where(sul => sul.EntityId == paymentRequest.Id && sul.TenantId == tenantId)
.OrderByDescending(sul => sul.UpdatedAt)
.ToListAsync();
}); });
await Task.WhenAll(nextStatusTask, documentTask, updateLogsTask); await Task.WhenAll(nextStatusTask, documentTask, updateLogsTask);
@ -1820,6 +1817,7 @@ namespace Marco.Pms.Services.Service
paymentRequest.PaidAt = model.PaidAt; paymentRequest.PaidAt = model.PaidAt;
paymentRequest.PaidById = model.PaidById; paymentRequest.PaidById = model.PaidById;
paymentRequest.PaidTransactionId = model.PaidTransactionId; paymentRequest.PaidTransactionId = model.PaidTransactionId;
paymentRequest.TDSPercentage = model.TDSPercentage;
var lastTransaction = await _context.AdvancePaymentTransactions.OrderByDescending(apt => apt.CreatedAt).FirstOrDefaultAsync(apt => apt.TenantId == tenantId); var lastTransaction = await _context.AdvancePaymentTransactions.OrderByDescending(apt => apt.CreatedAt).FirstOrDefaultAsync(apt => apt.TenantId == tenantId);
double lastBalance = 0; double lastBalance = 0;
@ -2284,7 +2282,7 @@ namespace Marco.Pms.Services.Service
} }
} }
response.PaymentMode = paymentModes.Where(pm => pm.Id == m.PaymentModeId).Select(pm => _mapper.Map<PaymentModeMatserVM>(pm)).FirstOrDefault(); response.PaymentMode = paymentModes.Where(pm => pm.Id == m.PaymentModeId).Select(pm => _mapper.Map<PaymentModeMatserVM>(pm)).FirstOrDefault();
response.ExpensesCategory = expenseCategories.Where(ec => ec.Id == m.ExpenseCategoryId).Select(ec => _mapper.Map<ExpensesCategoryMasterVM>(ec)).FirstOrDefault(); response.ExpenseCategory = expenseCategories.Where(ec => ec.Id == m.ExpenseCategoryId).Select(ec => _mapper.Map<ExpensesCategoryMasterVM>(ec)).FirstOrDefault();
return response; return response;
}).ToList(); }).ToList();
@ -2349,6 +2347,7 @@ namespace Marco.Pms.Services.Service
var response = _mapper.Map<ExpenseDetailsMongoDB>(model); var response = _mapper.Map<ExpenseDetailsMongoDB>(model);
response.ExpenseUId = $"{model.UIDPrefix}/{model.UIDPostfix:D5}";
response.Project = _mapper.Map<ProjectBasicMongoDB>(model.Project); response.Project = _mapper.Map<ProjectBasicMongoDB>(model.Project);
response.PaidBy = _mapper.Map<BasicEmployeeMongoDB>(model.PaidBy); response.PaidBy = _mapper.Map<BasicEmployeeMongoDB>(model.PaidBy);
response.CreatedBy = _mapper.Map<BasicEmployeeMongoDB>(model.CreatedBy); response.CreatedBy = _mapper.Map<BasicEmployeeMongoDB>(model.CreatedBy);