diff --git a/0_Framework/Application/StaticWorkshopAccounts.cs b/0_Framework/Application/StaticWorkshopAccounts.cs
index c42fa9bd..44491a69 100644
--- a/0_Framework/Application/StaticWorkshopAccounts.cs
+++ b/0_Framework/Application/StaticWorkshopAccounts.cs
@@ -39,4 +39,15 @@ public static class StaticWorkshopAccounts
/// که کاربر همچنان به کارگاه دسترسی دارد
///
public static DateTime ContinuesWorkingDate = new DateTime(2150, 1, 1);
+
+
+ ///
+ /// لیستی آی دی نقش هایی که مسئول بیمه کارگاه هستند
+ /// 7 : بیمه ارشد
+ /// 8 : بیمه ساده
+ ///
+ public static List InsuranceAccountsRoleIds = [7, 8];
+
+
+
}
\ No newline at end of file
diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs
index b97ff4f8..b4487ac7 100644
--- a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs
+++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Jobs/JobSchedulerRegistrator.cs
@@ -1,5 +1,6 @@
using _0_Framework.Application;
+using _0_Framework.Application.Sms;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionContractAgg;
using Hangfire;
@@ -13,13 +14,15 @@ public class JobSchedulerRegistrator
private readonly IInstitutionContractRepository _institutionContractRepository;
private static DateTime? _lastRunCreateTransaction;
private static DateTime? _lastRunSendMonthlySms;
+ private readonly ISmsService _smsService;
- public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository)
+ public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
_institutionContractRepository = institutionContractRepository;
+ _smsService = smsService;
}
public void Register()
@@ -91,8 +94,8 @@ public class JobSchedulerRegistrator
}
catch (Exception e)
{
- //_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
-
+ await _smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
+
}
}
diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs
new file mode 100644
index 00000000..ddb1796b
--- /dev/null
+++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/NullBoardNotificationPublisher.cs
@@ -0,0 +1,10 @@
+using GozareshgirProgramManager.Application.Interfaces;
+using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
+
+public class NullBoardNotificationPublisher:IBoardNotificationPublisher
+{
+ public Task SendProjectStatusChanged(long userId, TaskSectionStatus oldStatus, TaskSectionStatus newStatus, Guid sectionId)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs
index 3cb83458..c08fcf29 100644
--- a/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs
+++ b/BackgroundInstitutionContract/BackgroundInstitutionContract.Task/Program.cs
@@ -8,6 +8,7 @@ using BackgroundInstitutionContract.Task.Jobs;
using CompanyManagment.App.Contracts.Hubs;
using CompanyManagment.EFCore.Services;
using GozareshgirProgramManager.Application._Bootstrapper;
+using GozareshgirProgramManager.Application.Interfaces;
using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
using GozareshgirProgramManager.Infrastructure;
using GozareshgirProgramManager.Infrastructure.Persistence.Seed;
@@ -31,7 +32,7 @@ builder.Services.AddTransient();
builder.Services.AddTransient();
builder.Services.AddTransient();
builder.Services.Configure(builder.Configuration);
-
+builder.Services.AddScoped();
#region MongoDb
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
diff --git a/Company.Domain/InstitutionPlanAgg/IPlanPercentageRepository.cs b/Company.Domain/InstitutionPlanAgg/IPlanPercentageRepository.cs
index b8406a4f..9395f968 100644
--- a/Company.Domain/InstitutionPlanAgg/IPlanPercentageRepository.cs
+++ b/Company.Domain/InstitutionPlanAgg/IPlanPercentageRepository.cs
@@ -1,7 +1,9 @@
-using _0_Framework.Domain;
+using _0_Framework.Application;
+using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionPlan;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Company.Domain.InstitutionPlanAgg;
@@ -26,4 +28,18 @@ public interface IPlanPercentageRepository : IRepository
///
///
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
+
+ ///
+ /// دریافت دیتای مودال ایجاد
+ ///
+ ///
+ Task GetCreateModalData();
+
+ ///
+ /// دریافت لیست مبالغ سرویس ها
+ ///
+ ///
+ ///
+ Task> GetList(
+ InstitutionPlanSearchModel searchModel);
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs
index 2b3032cc..1e7ee84c 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractViewModel.cs
@@ -76,5 +76,7 @@ public class InstitutionContractViewModel
public bool IsInstallment { get; set; }
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
+ public InstitutionContractSigningType? SigningType { get; set; }
+
public List InstallmentList { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionPlan/CreateServiceAmountDto.cs b/CompanyManagment.App.Contracts/InstitutionPlan/CreateServiceAmountDto.cs
new file mode 100644
index 00000000..6800b2f5
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionPlan/CreateServiceAmountDto.cs
@@ -0,0 +1,51 @@
+namespace CompanyManagment.App.Contracts.InstitutionPlan;
+
+public class CreateServiceAmountDto
+{
+ ///
+ /// آی دی
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// قرارداد و تصفیه
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string ContractAndCheckoutPercentStr { get; set; }
+
+ ///
+ /// بیمه
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string InsurancePercentStr { get; set; }
+
+ ///
+ /// حضورغباب
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string RollCallPercentStr { get; set; }
+
+ ///
+ /// فیش غیر رسمی
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string CustomizeCheckoutPercentStr { get; set; }
+
+ ///
+ /// خدمات حضوری قرداد و تصفیه
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string ContractAndCheckoutInPersonPercentStr { get; set; }
+
+ ///
+ /// خدمات حضوری بیمه
+ /// درصد از مزد روزانه
+ /// string
+ ///
+ public string InsuranceInPersonPercentStr { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionPlan/IInstitutionPlanApplication.cs b/CompanyManagment.App.Contracts/InstitutionPlan/IInstitutionPlanApplication.cs
index 2e2293c0..0a359530 100644
--- a/CompanyManagment.App.Contracts/InstitutionPlan/IInstitutionPlanApplication.cs
+++ b/CompanyManagment.App.Contracts/InstitutionPlan/IInstitutionPlanApplication.cs
@@ -1,6 +1,7 @@
-using System.Collections.Generic;
-using _0_Framework.Application;
+using _0_Framework.Application;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
+using System.Collections.Generic;
+using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.InstitutionPlan;
@@ -34,4 +35,27 @@ public interface IInstitutionPlanApplication
///
///
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
+
+
+ ///
+ /// دریافت دیتای درصد سرویس برای مودال ایجاد
+ ///
+ ///
+ Task GetCreateModalData();
+
+ ///
+ /// ایجاد درصد سرویس
+ ///
+ ///
+ ///
+ Task CreateInstitutionPlanPercentage(CreateServiceAmountDto command);
+
+
+ ///
+ /// دریافت لیست مبالغ سرویس ها
+ ///
+ ///
+ ///
+ Task> GetList(
+ InstitutionPlanSearchModel searchModel);
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanListDto.cs b/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanListDto.cs
new file mode 100644
index 00000000..d8d9f389
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanListDto.cs
@@ -0,0 +1,84 @@
+namespace CompanyManagment.App.Contracts.InstitutionPlan;
+
+public class InstitutionPlanListDto
+{
+
+
+ ///
+ /// تعداد پرسنل
+ ///
+ public int CountPerson { get; set; }
+
+ ///
+ /// مبلغ قرارداد و تصفیه
+ ///
+ public string ContractAndCheckout { get; set; }
+
+ ///
+ /// مبلغ بیمه
+ ///
+ public string Insurance { get; set; }
+
+ ///
+ /// مبلغ حضورغباب
+ ///
+ public string RollCall { get; set; }
+
+ ///
+ /// مبلغ فیش غیر رسمی
+ ///
+ public string CustomizeCheckout { get; set; }
+
+ ///
+ /// مبلغ خدمات حضوری قرداد و تصفیه
+ ///
+ public string ContractAndCheckoutInPerson { get; set; }
+
+ ///
+ /// مبلغ خدمات حضوری بیمه
+ ///
+ public string InsuranceInPerson { get; set; }
+
+
+
+
+ #region Total
+
+
+ ///
+ /// مبلغ کل خدمات حضوری
+ ///
+ public string InPersonSumAmountStr { get; set; }
+
+ ///
+ /// مبلغ کل خدمات آنلاین
+ ///
+ public string OnlineOnlySumAmountStr { get; set; }
+
+ ///
+ /// مبلغ کل خدمات حضوری و آنلاین
+ ///
+ public string OnlineAndInPersonSumAmountStr { get; set; }
+
+ ///
+ /// مبلغ کل خدمات حضوری و آنلاین
+ /// double
+ ///
+ public double OnlineAndInPersonSumAmountDouble { get; set; }
+
+
+ ///
+ /// مبلغ کل خدمات حضوری
+ /// double
+ ///
+ public double InPersonSumAmountDouble { get; set; }
+
+ ///
+ /// مبلغ کل خدمات آنلاین
+ /// double
+ ///
+ public double OnlineOnlySumAmountDouble { get; set; }
+
+
+ #endregion
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanSearchModel.cs b/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanSearchModel.cs
new file mode 100644
index 00000000..34e5d347
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionPlan/InstitutionPlanSearchModel.cs
@@ -0,0 +1,11 @@
+using _0_Framework.Application;
+
+namespace CompanyManagment.App.Contracts.InstitutionPlan;
+
+public class InstitutionPlanSearchModel : PaginationRequest
+{
+ ///
+ /// تعدلد پرسنل برای جستجو
+ ///
+ public int CountPeron { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.Application/InstitutionPlanApplication.cs b/CompanyManagment.Application/InstitutionPlanApplication.cs
index 6137c992..2b4aba06 100644
--- a/CompanyManagment.Application/InstitutionPlanApplication.cs
+++ b/CompanyManagment.Application/InstitutionPlanApplication.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.InstitutionPlanAgg;
using CompanyManagment.App.Contracts.InstitutionPlan;
@@ -84,4 +85,73 @@ public class InstitutionPlanApplication : IInstitutionPlanApplication
{
return _planPercentageRepository.GetInstitutionPlanForWorkshop(command);
}
+
+
+ #region ForApi
+
+ public async Task GetCreateModalData()
+ {
+ return await _planPercentageRepository.GetCreateModalData();
+ }
+
+
+ public async Task CreateInstitutionPlanPercentage(CreateServiceAmountDto command)
+ {
+ var op = new OperationResult();
+ if (string.IsNullOrWhiteSpace(command.ContractAndCheckoutInPersonPercentStr) || command.ContractAndCheckoutInPersonPercentStr == "0" ||
+ string.IsNullOrWhiteSpace(command.ContractAndCheckoutPercentStr) || (command.ContractAndCheckoutPercentStr == "0" ||
+ string.IsNullOrWhiteSpace(command.CustomizeCheckoutPercentStr) || command.CustomizeCheckoutPercentStr == "0" ||
+ string.IsNullOrWhiteSpace(command.InsuranceInPersonPercentStr) || command.InsuranceInPersonPercentStr == "0" ||
+ string.IsNullOrWhiteSpace(command.InsurancePercentStr) || command.InsurancePercentStr == "0" ||
+ string.IsNullOrWhiteSpace(command.RollCallPercentStr) || command.RollCallPercentStr == "0"))
+ return op.Failed("هیچ یک از فیلدها نمیتوانند صفر باشند");
+
+ int contractAndCheckoutInPersonPercent = 0;
+ int contractAndCheckoutPercent = 0;
+ int customizeCheckoutPercent = 0;
+ int insuranceInPersonPercent = 0;
+ int insurancePercent = 0;
+ int rollCallPercent = 0;
+
+ try
+ {
+ contractAndCheckoutInPersonPercent = Convert.ToInt32(command.ContractAndCheckoutInPersonPercentStr);
+ contractAndCheckoutPercent = Convert.ToInt32(command.ContractAndCheckoutPercentStr);
+ customizeCheckoutPercent = Convert.ToInt32(command.CustomizeCheckoutPercentStr);
+ insuranceInPersonPercent = Convert.ToInt32(command.InsuranceInPersonPercentStr);
+ insurancePercent = Convert.ToInt32(command.InsurancePercentStr);
+ rollCallPercent = Convert.ToInt32(command.RollCallPercentStr);
+ }
+ catch (Exception e)
+ {
+ return op.Failed("لطفا عدد معتبر وارد کنید");
+
+ }
+
+ var firstPlan =await _planPercentageRepository.GetCreateModalData();
+ if (firstPlan != null)
+ {
+ var planPercentage = _planPercentageRepository.Get(firstPlan.Id);
+ planPercentage.Edit(contractAndCheckoutPercent, insurancePercent, rollCallPercent, customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
+ _planPercentageRepository.SaveChanges();
+ }
+ else
+ {
+ var create = new PlanPercentage(contractAndCheckoutPercent, insurancePercent, rollCallPercent,
+ customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
+ await _planPercentageRepository.CreateAsync(create);
+ await _planPercentageRepository.SaveChangesAsync();
+ }
+
+
+
+ return op.Succcedded();
+ }
+
+ public async Task> GetList(InstitutionPlanSearchModel searchModel)
+ {
+ return await _planPercentageRepository.GetList(searchModel);
+ }
+
+ #endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
index af34b1b3..6ae60e32 100644
--- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
+++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
@@ -4364,6 +4364,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
}).Where(x =>
- x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0)
+ x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
.ToListAsync();
#endregion
@@ -4438,13 +4440,13 @@ public class InstitutionContractRepository : RepositoryBase futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList();
List deatcivedContract = await _context.InstitutionContractSet
.Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) &&
- x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0)
+ x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
.Select(x => new InstitutionContractViewModel
{
Id = x.id,
@@ -4459,6 +4461,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
@@ -4469,6 +4472,12 @@ public class InstitutionContractRepository : RepositoryBase
+ x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
+
+ //حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
+ institutionContracts = institutionContracts.Except(paidInFull).ToList();
#region RollCallServicCompute
@@ -4516,8 +4525,7 @@ public class InstitutionContractRepository : RepositoryBase
@@ -4551,8 +4559,7 @@ public class InstitutionContractRepository : RepositoryBase
@@ -4579,12 +4586,17 @@ public class InstitutionContractRepository : RepositoryBase x.ContractingPartyId == item.ContractingPartyId)
.Select(x => x.id).ToListAsync();
diff --git a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs
index da63d47b..727fe0a4 100644
--- a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs
+++ b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs
@@ -1820,19 +1820,24 @@ public class InsuranceListRepository : RepositoryBase, IIns
return res;
}
- public async Task> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
+ public async Task> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
{
if (string.IsNullOrEmpty(searchModel.Month) || string.IsNullOrEmpty(searchModel.Year))
{
return [];
}
+
+ var workshopsHasInsuranceAccount = await _accountContext
+ .AccountLeftWorks
+ .Where(x => StaticWorkshopAccounts.InsuranceAccountsRoleIds.Contains(x.RoleId) && x.IsActive)
+ .Select(x => x.WorkshopId).Distinct().ToListAsync();
var acountId = _authHelper.CurrentAccountId();
- var accountWorkshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId)
+ var accountWorkshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId && workshopsHasInsuranceAccount.Contains(x.WorkshopId))
.Select(x => x.WorkshopId);
var firstDayOfMonth = $"{searchModel.Year}/{searchModel.Month}/01".ToGeorgianDateTime();
var insuranceWorkshops = _context.Workshops
- .Where(x => x.InsuranceCode != null && x.InsuranceCode.Length >= 10 && accountWorkshopIds.Contains(x.id) &&
+ .Where(x => accountWorkshopIds.Contains(x.id) &&
x.IsActiveString == "true");
@@ -1855,7 +1860,7 @@ public class InsuranceListRepository : RepositoryBase, IIns
WorkShopId = result.id,
WorkShopCode = result.InsuranceWorkshopInfo != null
? result.InsuranceWorkshopInfo.InsuranceCode
- : result.InsuranceCode,
+ : string.IsNullOrWhiteSpace(result.InsuranceCode) ? "کد کارگاهی ندارد" : result.InsuranceCode,
WorkShopName = result.InsuranceWorkshopInfo != null
? result.InsuranceWorkshopInfo.WorkshopName
: result.WorkshopFullName,
diff --git a/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs b/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
index 2657de37..b5b6db6b 100644
--- a/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
+++ b/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
@@ -1,12 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using _0_Framework.Application;
+using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.InstitutionPlanAgg;
+using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
namespace CompanyManagment.EFCore.Repository;
@@ -44,6 +46,7 @@ public class PlanPercentageRepository : RepositoryBase, IP
}).FirstOrDefault();
}
+
public List GetInstitutionPlanList(int pageIndex, int countPeron)
{
var planPercentage = _context.PlanPercentages.FirstOrDefault();
@@ -303,4 +306,107 @@ public class PlanPercentageRepository : RepositoryBase, IP
return new InstitutionPlanViewModel();
}
+
+
+ #region ForApi
+
+ public async Task GetCreateModalData()
+ {
+ return await _context.PlanPercentages.Select(x => new CreateServiceAmountDto()
+ {
+ Id = x.id,
+ ContractAndCheckoutInPersonPercentStr = $"{x.ContractAndCheckoutInPersonPercent}",
+ CustomizeCheckoutPercentStr = $"{x.CustomizeCheckoutPercent}",
+ ContractAndCheckoutPercentStr = $"{x.ContractAndCheckoutPercent}",
+ InsuranceInPersonPercentStr = $"{x.InsuranceInPersonPercent}",
+ InsurancePercentStr = $"{x.InsurancePercent}",
+ RollCallPercentStr = $"{x.RollCallPercent}",
+ }).FirstOrDefaultAsync();
+ }
+
+
+ public async Task> GetList(
+ InstitutionPlanSearchModel searchModel)
+ {
+ var planPercentage = await _context.PlanPercentages.FirstOrDefaultAsync();
+ if (planPercentage == null)
+ return new PagedResult();
+ var dailyWageYearlySalery = await _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefaultAsync(x =>
+ x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
+ if (dailyWageYearlySalery == null)
+ return new PagedResult();
+
+ var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
+ .Select(x => x.ItemValue).FirstOrDefault();
+
+ var plans = _context.InstitutionPlans.AsQueryable();
+ if (searchModel.CountPeron > 0)
+ plans = plans.Where(x => x.CountPerson == searchModel.CountPeron);
+
+ var planQueryFilter =await plans.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
+ var planResult = planQueryFilter.Select(plan =>
+ new InstitutionPlanViewModel
+ {
+ CountPerson = plan.CountPerson,
+
+ ContractAndCheckoutDouble =
+ ((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson *
+ plan.IncreasePercentage),
+
+ InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
+ plan.IncreasePercentage),
+
+ RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
+ plan.IncreasePercentage),
+
+ CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) *
+ plan.CountPerson *
+ plan.IncreasePercentage),
+
+ ContractAndCheckoutInPersonDouble =
+ (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
+ plan.IncreasePercentage),
+
+ InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) *
+ plan.CountPerson *
+ plan.IncreasePercentage)
+ }).ToList();
+
+ var finalResult = planResult.Select(plan => new InstitutionPlanListDto()
+ {
+ CountPerson = plan.CountPerson,
+
+ ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
+
+ Insurance = plan.InsuranceDouble.ToMoney(),
+
+ RollCall = plan.RollCallDouble.ToMoney(),
+
+ CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
+
+ ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
+
+ InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
+
+ InPersonSumAmountStr =
+ (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble +
+ plan.InsuranceInPersonDouble).ToMoney(),
+
+ OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble +
+ plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble +
+ plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
+
+ OnlineOnlySumAmountStr =
+ (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble +
+ plan.CustomizeCheckoutDouble).ToMoney(),
+ }).ToList();
+
+ return new PagedResult()
+ {
+ TotalCount = finalResult.Count,
+ List = finalResult
+ };
+
+ }
+ #endregion
}
\ No newline at end of file
diff --git a/ServiceHost/Areas/Admin/Controllers/ServiceAmountsManagement.cs b/ServiceHost/Areas/Admin/Controllers/ServiceAmountsManagement.cs
new file mode 100644
index 00000000..bc0c6dcf
--- /dev/null
+++ b/ServiceHost/Areas/Admin/Controllers/ServiceAmountsManagement.cs
@@ -0,0 +1,63 @@
+using _0_Framework.Application;
+using AccountManagement.Application.Contracts.Ticket;
+using CompanyManagment.App.Contracts.InstitutionPlan;
+using CompanyManagment.App.Contracts.Workshop;
+using Microsoft.AspNetCore.Mvc;
+using ServiceHost.BaseControllers;
+
+namespace ServiceHost.Areas.Admin.Controllers;
+
+public class ServiceAmountsManagement : AdminBaseController
+{
+ private readonly IInstitutionPlanApplication _institutionPlanApplication;
+ private readonly IAuthHelper _authHelper;
+
+ public ServiceAmountsManagement(IInstitutionPlanApplication institutionPlanApplication, IAuthHelper authHelper)
+ {
+ _institutionPlanApplication = institutionPlanApplication;
+ _authHelper = authHelper;
+ }
+
+
+ ///
+ /// دریافت دیتای مودال ایجاد
+ ///
+ ///
+ [HttpGet("GetCreateModalData")]
+ public async Task> GetCreateModalData()
+ {
+ if(!_authHelper.HasPermission(315))
+ return Forbid();
+ var data = await _institutionPlanApplication.GetCreateModalData();
+
+ return data;
+ }
+
+ ///
+ /// ذخیره درصدها
+ ///
+ ///
+ ///
+ [HttpPost("CreateServicePercentage")]
+ public async Task> CreateServicePercentage([FromBody] CreateServiceAmountDto command)
+ {
+
+ if (!_authHelper.HasPermission(315))
+ return Forbid();
+
+ var result = await _institutionPlanApplication.CreateInstitutionPlanPercentage(command);
+
+ return result;
+ }
+
+ ///
+ /// دریافت لیست مبالغ سرویس ها
+ ///
+ ///
+ ///
+ [HttpGet("GetList")]
+ public async Task>> GetList(InstitutionPlanSearchModel searchModel)
+ {
+ return await _institutionPlanApplication.GetList(searchModel);
+ }
+}
\ No newline at end of file