Add workshop total amount details: include price properties in InstitutionContract and implement GetContractWorkshopsDetails method

This commit is contained in:
2025-11-18 14:53:08 +03:30
parent 07851ff7c8
commit 8b39eed7bb
6 changed files with 93 additions and 5 deletions

View File

@@ -77,4 +77,5 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
}

View File

@@ -1,4 +1,7 @@
using System.Collections.Generic;
using System.Security.AccessControl;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Server.HttpSys;
namespace CompanyManagment.App.Contracts.InstitutionContract;
@@ -105,22 +108,31 @@ public class WorkshopServicesViewModel
{
public bool Insurance { get; set; }
public string InsuranceLabel => "ارسال لیست بیمه";
public string InsurancePrice { get; set; }
public bool InsuranceInPerson { get; set; }
public string InsuranceInPersonLabel => "خدمات مستقیم";
public string InsuranceInPersonPrice { get; set; }
public bool Contract { get; set; }
public string ContractLabel => "قرارداد و تصفیه حساب";
public string ContractPrice { get; set; }
public bool ContractInPerson { get; set; }
public string ContractInPersonLabel => "خدمات مستقیم";
public string ContractInPersonPrice { get; set; }
public bool RollCall { get; set; }
public string RollCallLabel => "ساعت حضور و غیاب";
public string RollCallPrice { get; set; }
public bool RollCallInPerson { get; set; }
public string RollCallInPersonLabel => "خدمات مستقیم";
public string RollCallInPersonPrice { get; set; }
public bool CustomizeCheckout { get; set; }
public string CustomizeCheckoutLabel => "فیش غیر رسمی";
public string CustomizeCheckoutPrice { get; set; }
}

View File

@@ -251,8 +251,17 @@ public interface IInstitutionContractApplication
/// <param name="id"></param>
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
}
public class GetInstitutionContractWorkshopsDetails
{
public List<InstitutionContractListWorkshop> Workshops { get; set; }
}
public class InstitutionContractPrintViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }

View File

@@ -1387,6 +1387,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id)
{
return _institutionContractRepository.GetContractWorkshopsDetails(id);
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,

View File

@@ -2771,6 +2771,61 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
return res;
}
public async Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id)
{
var institutionContract = await _context.InstitutionContractSet
.Include(x => x.WorkshopGroup)
.ThenInclude(x => x.InitialWorkshops)
.FirstOrDefaultAsync(x => x.id == id);
if (institutionContract == null)
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
var workshops = institutionContract.WorkshopGroup.InitialWorkshops
.Select(x =>
{
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(new WorkshopTempViewModel()
{
CountPerson = x.PersonnelCount,
ContractAndCheckout = x.Services.Contract,
ContractAndCheckoutInPerson = x.Services.ContractInPerson,
Insurance = x.Services.Insurance,
InsuranceInPerson = x.Services.InsuranceInPerson,
RollCall = x.Services.RollCall,
RollCallInPerson = x.Services.RollCallInPerson,
CustomizeCheckout = x.Services.CustomizeCheckout,
});
return new InstitutionContractListWorkshop()
{
EmployeeCount = x.PersonnelCount,
Price = x.Price.ToMoney(),
WorkshopName = x.WorkshopName,
WorkshopServices = new WorkshopServicesViewModel()
{
Contract = x.Services.Contract,
ContractPrice =plan.ContractAndCheckout ,
ContractInPerson = x.Services.ContractInPerson,
ContractInPersonPrice = plan.ContractAndCheckoutInPerson,
CustomizeCheckout = x.Services.CustomizeCheckout,
CustomizeCheckoutPrice = plan.CustomizeCheckout,
Insurance = x.Services.Insurance,
InsurancePrice =plan.Insurance ,
InsuranceInPerson = x.Services.InsuranceInPerson,
InsuranceInPersonPrice = plan.InsuranceInPerson,
RollCall = x.Services.RollCall,
RollCallPrice =plan.RollCall ,
RollCallInPerson = x.Services.RollCallInPerson,
RollCallInPersonPrice = "0",
}
};
}).ToList();
return new GetInstitutionContractWorkshopsDetails()
{
Workshops = workshops
};
}
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,

View File

@@ -88,6 +88,11 @@ public class institutionContractController : AdminBaseController
return await _institutionContractApplication.GetListStats(searchModel);
}
public async Task<ActionResult<GetInstitutionContractWorkshopsDetails>> GetWorkshopsDetials(long id)
{
var result = await _institutionContractApplication.GetContractWorkshopsDetails(id);
return result;
}
/// <summary>
/// ویرایش
@@ -218,6 +223,7 @@ public class institutionContractController : AdminBaseController
[HttpDelete("{id}")]
public async Task<ActionResult<OperationResult>> Remove(long id)
{
return BadRequest("امکان حذف قرارداد وجود ندارد");
_institutionContractApplication.RemoveContract(id);
return new OperationResult().Succcedded();