Added the Payment Adjustment Head table also new API of get Payment Adjustment Head lists as well added the forgin key in received payment table and API

This commit is contained in:
ashutosh.nehete 2025-10-14 17:57:37 +05:30
parent 4dc37cb0ac
commit 302185808e
16 changed files with 13615 additions and 2 deletions

View File

@ -139,6 +139,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<InvoiceComment> InvoiceComments { get; set; } public DbSet<InvoiceComment> InvoiceComments { get; set; }
public DbSet<InvoiceAttachment> InvoiceAttachments { get; set; } public DbSet<InvoiceAttachment> InvoiceAttachments { get; set; }
public DbSet<ReceivedInvoicePayment> ReceivedInvoicePayments { get; set; } public DbSet<ReceivedInvoicePayment> ReceivedInvoicePayments { get; set; }
public DbSet<PaymentAdjustmentHead> PaymentAdjustmentHeads { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -782,6 +783,65 @@ namespace Marco.Pms.DataAccess.Data
} }
); );
modelBuilder.Entity<PaymentAdjustmentHead>().HasData(
new PaymentAdjustmentHead
{
Id = Guid.Parse("dbdc047f-a2d2-4db0-b0e6-b9d9f923a0f1"),
Name = "Advance payment",
Description = "An advance payment is a sum paid before receiving goods or services, often to secure a transaction or cover initial costs.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("66c3c241-8b52-4327-a5ad-c1faf102583e"),
Name = "Base Amount",
Description = "The base amount refers to the principal sum or original value used as a reference in financial calculations, excluding taxes, fees, or additional charges.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("0d70cb2e-827e-44fc-90a5-c2c55ba51ba9"),
Name = "Tax Deducted at Source (TDS)",
Description = "TDS, or Tax Deducted at Source, is a system under the Indian Income Tax Act where tax is deducted at the point of income generation—such as salary, interest, or rent—and remitted to the government to prevent tax evasion and ensure timely collection.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("95f35acd-d979-4177-91ea-fd03a00e49ff"),
Name = "Retention",
Description = "Retention refers to a company's ability to keep customers, employees, or profits over time, commonly measured as a percentage and critical for long-term business sustainability and growth.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("3f09b19a-8d45-4cf2-be27-f4f09b38b9f7"),
Name = "Tax",
Description = "Tax is a mandatory financial charge imposed by a government on individuals or entities to fund public services and government operations, without direct benefit to the taxpayer.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("ec5e6a5f-ce62-44e5-8911-8426bbb4dde8"),
Name = "Penalty",
Description = "A penalty in the context of taxation is a financial sanction imposed by the government on individuals or entities for non-compliance with tax laws, such as late filing, underreporting income, or failure to pay taxes, and is typically calculated as a percentage of the tax due or a fixed amount.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentAdjustmentHead
{
Id = Guid.Parse("50584332-1cb7-4359-9721-c8ea35040881"),
Name = "Utility fees",
Description = "Utility fees are recurring charges for essential services such as electricity, water, gas, sewage, waste disposal, internet, and telecommunications, typically based on usage and necessary for operating a home or business.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<EntityTypeMaster>().HasData( modelBuilder.Entity<EntityTypeMaster>().HasData(
new EntityTypeMaster new EntityTypeMaster
{ {

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,67 @@
using System;
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_PaymentAdjustmentHead_Master_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PaymentAdjustmentHeads",
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"),
Description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentAdjustmentHeads", x => x.Id);
table.ForeignKey(
name: "FK_PaymentAdjustmentHeads_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "PaymentAdjustmentHeads",
columns: new[] { "Id", "Description", "IsActive", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("0d70cb2e-827e-44fc-90a5-c2c55ba51ba9"), "TDS, or Tax Deducted at Source, is a system under the Indian Income Tax Act where tax is deducted at the point of income generation—such as salary, interest, or rent—and remitted to the government to prevent tax evasion and ensure timely collection.", true, "Tax Deducted at Source (TDS)", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("3f09b19a-8d45-4cf2-be27-f4f09b38b9f7"), "Tax is a mandatory financial charge imposed by a government on individuals or entities to fund public services and government operations, without direct benefit to the taxpayer.", true, "Tax", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("50584332-1cb7-4359-9721-c8ea35040881"), "Utility fees are recurring charges for essential services such as electricity, water, gas, sewage, waste disposal, internet, and telecommunications, typically based on usage and necessary for operating a home or business.", true, "Utility fees", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("66c3c241-8b52-4327-a5ad-c1faf102583e"), "The base amount refers to the principal sum or original value used as a reference in financial calculations, excluding taxes, fees, or additional charges.", true, "Base Amount", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("95f35acd-d979-4177-91ea-fd03a00e49ff"), "Retention refers to a company's ability to keep customers, employees, or profits over time, commonly measured as a percentage and critical for long-term business sustainability and growth.", true, "Retention", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("dbdc047f-a2d2-4db0-b0e6-b9d9f923a0f1"), "An advance payment is a sum paid before receiving goods or services, often to secure a transaction or cover initial costs.", true, "Advance payment", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("ec5e6a5f-ce62-44e5-8911-8426bbb4dde8"), "A penalty in the context of taxation is a financial sanction imposed by the government on individuals or entities for non-compliance with tax laws, such as late filing, underreporting income, or failure to pay taxes, and is typically calculated as a percentage of the tax due or a fixed amount.", true, "Penalty", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.CreateIndex(
name: "IX_PaymentAdjustmentHeads_TenantId",
table: "PaymentAdjustmentHeads",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PaymentAdjustmentHeads");
}
}
}

View File

@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_PaymentAdjustmentHead_ForignKey_In_ReceivedInvoicePayment_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PaymentAdjustmentHeadId",
table: "ReceivedInvoicePayments",
type: "char(36)",
nullable: false,
defaultValue: new Guid("66c3c241-8b52-4327-a5ad-c1faf102583e"),
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_ReceivedInvoicePayments_PaymentAdjustmentHeadId",
table: "ReceivedInvoicePayments",
column: "PaymentAdjustmentHeadId");
migrationBuilder.AddForeignKey(
name: "FK_ReceivedInvoicePayments_PaymentAdjustmentHeads_PaymentAdjust~",
table: "ReceivedInvoicePayments",
column: "PaymentAdjustmentHeadId",
principalTable: "PaymentAdjustmentHeads",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ReceivedInvoicePayments_PaymentAdjustmentHeads_PaymentAdjust~",
table: "ReceivedInvoicePayments");
migrationBuilder.DropIndex(
name: "IX_ReceivedInvoicePayments_PaymentAdjustmentHeadId",
table: "ReceivedInvoicePayments");
migrationBuilder.DropColumn(
name: "PaymentAdjustmentHeadId",
table: "ReceivedInvoicePayments");
}
}
}

View File

@ -501,6 +501,90 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("InvoiceComments"); b.ToTable("InvoiceComments");
}); });
modelBuilder.Entity("Marco.Pms.Model.Collection.PaymentAdjustmentHead", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("PaymentAdjustmentHeads");
b.HasData(
new
{
Id = new Guid("dbdc047f-a2d2-4db0-b0e6-b9d9f923a0f1"),
Description = "An advance payment is a sum paid before receiving goods or services, often to secure a transaction or cover initial costs.",
IsActive = true,
Name = "Advance payment",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("66c3c241-8b52-4327-a5ad-c1faf102583e"),
Description = "The base amount refers to the principal sum or original value used as a reference in financial calculations, excluding taxes, fees, or additional charges.",
IsActive = true,
Name = "Base Amount",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("0d70cb2e-827e-44fc-90a5-c2c55ba51ba9"),
Description = "TDS, or Tax Deducted at Source, is a system under the Indian Income Tax Act where tax is deducted at the point of income generation—such as salary, interest, or rent—and remitted to the government to prevent tax evasion and ensure timely collection.",
IsActive = true,
Name = "Tax Deducted at Source (TDS)",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("95f35acd-d979-4177-91ea-fd03a00e49ff"),
Description = "Retention refers to a company's ability to keep customers, employees, or profits over time, commonly measured as a percentage and critical for long-term business sustainability and growth.",
IsActive = true,
Name = "Retention",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("3f09b19a-8d45-4cf2-be27-f4f09b38b9f7"),
Description = "Tax is a mandatory financial charge imposed by a government on individuals or entities to fund public services and government operations, without direct benefit to the taxpayer.",
IsActive = true,
Name = "Tax",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("ec5e6a5f-ce62-44e5-8911-8426bbb4dde8"),
Description = "A penalty in the context of taxation is a financial sanction imposed by the government on individuals or entities for non-compliance with tax laws, such as late filing, underreporting income, or failure to pay taxes, and is typically calculated as a percentage of the tax due or a fixed amount.",
IsActive = true,
Name = "Penalty",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("50584332-1cb7-4359-9721-c8ea35040881"),
Description = "Utility fees are recurring charges for essential services such as electricity, water, gas, sewage, waste disposal, internet, and telecommunications, typically based on usage and necessary for operating a home or business.",
IsActive = true,
Name = "Utility fees",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
});
});
modelBuilder.Entity("Marco.Pms.Model.Collection.ReceivedInvoicePayment", b => modelBuilder.Entity("Marco.Pms.Model.Collection.ReceivedInvoicePayment", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -526,6 +610,9 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
b.Property<Guid>("PaymentAdjustmentHeadId")
.HasColumnType("char(36)");
b.Property<DateTime>("PaymentReceivedDate") b.Property<DateTime>("PaymentReceivedDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
@ -542,6 +629,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("InvoiceId"); b.HasIndex("InvoiceId");
b.HasIndex("PaymentAdjustmentHeadId");
b.HasIndex("TenantId"); b.HasIndex("TenantId");
b.ToTable("ReceivedInvoicePayments"); b.ToTable("ReceivedInvoicePayments");
@ -5059,6 +5148,17 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Tenant"); b.Navigation("Tenant");
}); });
modelBuilder.Entity("Marco.Pms.Model.Collection.PaymentAdjustmentHead", b =>
{
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.Collection.ReceivedInvoicePayment", b => modelBuilder.Entity("Marco.Pms.Model.Collection.ReceivedInvoicePayment", b =>
{ {
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
@ -5073,6 +5173,12 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Marco.Pms.Model.Collection.PaymentAdjustmentHead", "PaymentAdjustmentHead")
.WithMany()
.HasForeignKey("PaymentAdjustmentHeadId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant") b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany() .WithMany()
.HasForeignKey("TenantId") .HasForeignKey("TenantId")
@ -5083,6 +5189,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Invoice"); b.Navigation("Invoice");
b.Navigation("PaymentAdjustmentHead");
b.Navigation("Tenant"); b.Navigation("Tenant");
}); });

View File

@ -0,0 +1,12 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Collection
{
public class PaymentAdjustmentHead : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = default!;
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
}
}

View File

@ -18,6 +18,11 @@ namespace Marco.Pms.Model.Collection
public double Amount { get; set; } public double Amount { get; set; }
public string Comment { get; set; } = default!; public string Comment { get; set; } = default!;
public bool IsActive { get; set; } = true; public bool IsActive { get; set; } = true;
public Guid PaymentAdjustmentHeadId { get; set; }
[ValidateNever]
[ForeignKey("PaymentAdjustmentHeadId")]
public PaymentAdjustmentHead? PaymentAdjustmentHead { get; set; }
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }
public Guid CreatedById { get; set; } public Guid CreatedById { get; set; }

View File

@ -6,6 +6,7 @@
public required Guid InvoiceId { get; set; } public required Guid InvoiceId { get; set; }
public required DateTime PaymentReceivedDate { get; set; } public required DateTime PaymentReceivedDate { get; set; }
public required string TransactionId { get; set; } public required string TransactionId { get; set; }
public required Guid PaymentAdjustmentHeadId { get; set; }
public required double Amount { get; set; } public required double Amount { get; set; }
public required string Comment { get; set; } public required string Comment { get; set; }
} }

View File

@ -0,0 +1,10 @@
namespace Marco.Pms.Model.ViewModels.Collection
{
public class PaymentAdjustmentHeadVM
{
public Guid Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
}
}

View File

@ -7,6 +7,7 @@ namespace Marco.Pms.Model.ViewModels.Collection
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid InvoiceId { get; set; } public Guid InvoiceId { get; set; }
public DateTime PaymentReceivedDate { get; set; } public DateTime PaymentReceivedDate { get; set; }
public PaymentAdjustmentHeadVM? PaymentAdjustmentHead { get; set; }
public string TransactionId { get; set; } = default!; public string TransactionId { get; set; } = default!;
public double Amount { get; set; } public double Amount { get; set; }
public string? Comment { get; set; } public string? Comment { get; set; }

View File

@ -890,6 +890,7 @@ namespace Marco.Pms.Services.Controllers
{ {
await using var context = await _dbContextFactory.CreateDbContextAsync(); await using var context = await _dbContextFactory.CreateDbContextAsync();
return await context.ReceivedInvoicePayments return await context.ReceivedInvoicePayments
.Include(rip => rip.PaymentAdjustmentHead)
.Include(rip => rip.CreatedBy).ThenInclude(e => e!.JobRole) .Include(rip => rip.CreatedBy).ThenInclude(e => e!.JobRole)
.AsNoTracking() .AsNoTracking()
.Where(rip => rip.InvoiceId == invoiceId && rip.TenantId == tenantId) .Where(rip => rip.InvoiceId == invoiceId && rip.TenantId == tenantId)

View File

@ -975,5 +975,15 @@ namespace Marco.Pms.Services.Controllers
} }
#endregion #endregion
#region =================================================================== Payment Adjustment Head APIs ===================================================================
[HttpGet("payment-adjustment-head/list")]
public async Task<IActionResult> GetpaymentAdjustmentHeadsList([FromQuery] bool isActive = true)
{
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _masterService.GetPaymentAdjustmentHeadListAsync(isActive, loggedInEmployee, tenantId);
return StatusCode(response.StatusCode, response);
}
#endregion
} }
} }

View File

@ -269,6 +269,8 @@ namespace Marco.Pms.Services.MappingProfiles
CreateMap<InvoiceComment, InvoiceCommentVM>(); CreateMap<InvoiceComment, InvoiceCommentVM>();
CreateMap<InvoiceAttachment, InvoiceAttachmentVM>(); CreateMap<InvoiceAttachment, InvoiceAttachmentVM>();
CreateMap<PaymentAdjustmentHead, PaymentAdjustmentHeadVM>();
#endregion #endregion
#region ======================================================= Master ======================================================= #region ======================================================= Master =======================================================

View File

@ -12,6 +12,7 @@ using Marco.Pms.Model.Master;
using Marco.Pms.Model.MongoDBModels.Utility; using Marco.Pms.Model.MongoDBModels.Utility;
using Marco.Pms.Model.Utilities; using Marco.Pms.Model.Utilities;
using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Activities;
using Marco.Pms.Model.ViewModels.Collection;
using Marco.Pms.Model.ViewModels.DocumentManager; using Marco.Pms.Model.ViewModels.DocumentManager;
using Marco.Pms.Model.ViewModels.Master; using Marco.Pms.Model.ViewModels.Master;
using Marco.Pms.Services.Service.ServiceInterfaces; using Marco.Pms.Services.Service.ServiceInterfaces;
@ -2652,8 +2653,6 @@ namespace Marco.Pms.Services.Service
#endregion #endregion
#region =================================================================== Document Type APIs =================================================================== #region =================================================================== Document Type APIs ===================================================================
public async Task<ApiResponse<object>> GetDocumentTypeMasterListAsync(Guid? documentCategoryId, Employee loggedInEmployee, Guid tenantId) public async Task<ApiResponse<object>> GetDocumentTypeMasterListAsync(Guid? documentCategoryId, Employee loggedInEmployee, Guid tenantId)
{ {
try try
@ -2881,6 +2880,48 @@ namespace Marco.Pms.Services.Service
#endregion #endregion
#region =================================================================== Payment Adjustment Head APIs ===================================================================
/// <summary>
/// Retrieves a list of payment adjustment heads for a specific tenant with optional active status filtering.
/// </summary>
/// <param name="isActive">Filter for active/inactive payment adjustment heads</param>
/// <param name="loggedInEmployee">The employee making the request (for auditing/authorization)</param>
/// <param name="tenantId">The tenant identifier to scope the data</param>
/// <returns>An API response containing the list of payment adjustment head view models</returns>
/// <remarks>
/// This method performs database-level filtering and uses projection to minimize data transfer.
/// Consider implementing pagination for tenants with large numbers of payment adjustment heads.
/// </remarks>
public async Task<ApiResponse<object>> GetPaymentAdjustmentHeadListAsync(bool isActive, Employee loggedInEmployee, Guid tenantId)
{
try
{
// Log the request details for auditing and troubleshooting
_logger.LogInfo("Fetching payment adjustment heads for tenant {TenantId} with IsActive={IsActive}", tenantId, isActive);
var paymentAdjustmentHeads = await _context.PaymentAdjustmentHeads
.AsNoTracking() // Improve performance by disabling change tracking for read-only operations
.Where(pah => pah.TenantId == tenantId && pah.IsActive == isActive)
.Select(pah => _mapper.Map<PaymentAdjustmentHeadVM>(pah))
.ToListAsync();
_logger.LogInfo("Successfully retrieved {Count} payment adjustment heads for tenant {TenantId}", paymentAdjustmentHeads.Count, tenantId);
return ApiResponse<object>.SuccessResponse(
paymentAdjustmentHeads.OrderBy(pah => pah.Name).ToList(),
$"Payment Adjustment Heads fetched successfully. Count: {paymentAdjustmentHeads.Count}",
200);
}
catch (Exception ex)
{
// Log the full exception with context for better troubleshooting
_logger.LogError(ex, "Error occurred while fetching payment adjustment heads for tenant {TenantId}. IsActive: {IsActive}", tenantId, isActive);
return ApiResponse<object>.ErrorResponse("An error occurred", "Unable to fetch payment adjustment heads", 500);
}
}
#endregion
#region =================================================================== Helper Function =================================================================== #region =================================================================== Helper Function ===================================================================
private static object ExceptionMapper(Exception ex) private static object ExceptionMapper(Exception ex)
{ {

View File

@ -46,6 +46,7 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
Task<ApiResponse<object>> DeleteActivityGroupAsync(Guid id, bool isActive, Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> DeleteActivityGroupAsync(Guid id, bool isActive, Employee loggedInEmployee, Guid tenantId);
#endregion #endregion
#region =================================================================== Contact Category APIs =================================================================== #region =================================================================== Contact Category APIs ===================================================================
Task<ApiResponse<object>> CreateContactCategory(CreateContactCategoryDto contactCategoryDto, Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> CreateContactCategory(CreateContactCategoryDto contactCategoryDto, Employee loggedInEmployee, Guid tenantId);
Task<ApiResponse<object>> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto, Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> UpdateContactCategory(Guid id, UpdateContactCategoryDto contactCategoryDto, Employee loggedInEmployee, Guid tenantId);
@ -104,5 +105,9 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
Task<ApiResponse<object>> UpdateDocumentTypeMasterAsync(Guid id, CreateDocumentTypeDto model, Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> UpdateDocumentTypeMasterAsync(Guid id, CreateDocumentTypeDto model, Employee loggedInEmployee, Guid tenantId);
Task<ApiResponse<object>> DeleteDocumentTypeMasterAsync(Guid id, bool isActive, Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> DeleteDocumentTypeMasterAsync(Guid id, bool isActive, Employee loggedInEmployee, Guid tenantId);
#endregion #endregion
#region =================================================================== Payment Adjustment Head APIs ===================================================================
Task<ApiResponse<object>> GetPaymentAdjustmentHeadListAsync(bool isActive, Employee loggedInEmployee, Guid tenantId);
#endregion
} }
} }