diff --git a/0_Framework/Application/Sms/ISmsService.cs b/0_Framework/Application/Sms/ISmsService.cs index 9ce58010..94e31299 100644 --- a/0_Framework/Application/Sms/ISmsService.cs +++ b/0_Framework/Application/Sms/ISmsService.cs @@ -28,7 +28,6 @@ public interface ISmsService Task GetCreditAmount(); public Task SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms = null); - public Task SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId); public Task SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName, long contractingPartyId, long institutionContractId); 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/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs index f7a96cae..dd90736f 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs @@ -11,6 +11,8 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson, int personnelCount, double price,long institutionContractWorkshopGroupId, + InstitutionContractWorkshopGroup workshopGroup,long workshopId,bool isAmendment, long initialWorkshopId) : base(workshopName, hasRollCallPlan, + int personnelCount, double price,long institutionContractWorkshopGroupId, InstitutionContractWorkshopGroup workshopGroup,long workshopId,long initialWorkshopId,bool isAmendment) : base(workshopName, hasRollCallPlan, hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment) diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs index 5387faed..bd0dfeb9 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs @@ -32,7 +32,7 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson, Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance, Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId, - id,IsAmendment); + IsAmendment, id); WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList()); } 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/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs index 1afc5592..fe1889da 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using _0_Framework.Application; using _0_Framework.Application.Sms; using CompanyManagment.App.Contracts.Checkout; -using CompanyManagment.App.Contracts.Law; using CompanyManagment.App.Contracts.TemporaryClientRegistration; using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.WorkshopPlan; @@ -268,12 +267,10 @@ public interface IInstitutionContractApplication Task GetIdByInstallmentId(long installmentId); /// /// تایید قرارداد مالی به صورت دستی - /// /// /// + /// Task VerifyInstitutionContractManually(long institutionContractId); - - } public class GetInstitutionAmendmentVerificationDetailsViewModel @@ -293,11 +290,6 @@ public class GetInstitutionAmendmentVerificationDetailsViewModel } - - - - - public class InstitutionContractAmendmentCompleteRequest { public Guid TempId { get; set; } @@ -312,12 +304,3 @@ public class GetInstitutionContractWorkshopsDetails public List Workshops { get; set; } } - - - - - - - - - diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractPrintViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractPrintViewModel.cs index 05bef59d..238fc4d1 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractPrintViewModel.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractPrintViewModel.cs @@ -25,4 +25,6 @@ public class InstitutionContractPrintViewModel public string VerifierPhoneNumber { get; set; } public LawViewModel LawViewModel { get; set; } public string Obligation { get; set; } + public string OneMonthWithoutTax { get; set; } + public string OneMonthTax { get; set; } } \ 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..f6055430 --- /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 CountPerson { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index 08a3aa18..6a71c2b8 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -1537,6 +1537,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault(); } + public async Task SetPendingWorkflow(long entityId,InstitutionContractSigningType signingType) { var op = new OperationResult(); @@ -1557,17 +1558,23 @@ public class InstitutionContractApplication : IInstitutionContractApplication var currentWorkshops = institutionContract.WorkshopGroup.CurrentWorkshops.ToList(); foreach (var createdWorkshop in initialCreatedWorkshops) { - if (currentWorkshops.Any(x => x.InitialWorkshopId == createdWorkshop.id)) + if (currentWorkshops.Any(x => x.WorkshopId == createdWorkshop.WorkshopId)) + { continue; - + } + var currentWorkshop = new InstitutionContractWorkshopCurrent(createdWorkshop.WorkshopName, createdWorkshop.Services.RollCall, createdWorkshop.Services.RollCallInPerson, createdWorkshop.Services.CustomizeCheckout, createdWorkshop.Services.Contract, - createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance, + createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance, createdWorkshop.Services.InsuranceInPerson,createdWorkshop.PersonnelCount, createdWorkshop.Price, createdWorkshop.InstitutionContractWorkshopGroupId,createdWorkshop.WorkshopGroup, + createdWorkshop.WorkshopId!.Value, false,createdWorkshop.id); createdWorkshop.WorkshopId!.Value, createdWorkshop.id,false); institutionContract.WorkshopGroup.AddCurrentWorkshop(currentWorkshop); + + + } if (institutionContract.WorkshopGroup.InitialWorkshops.All(x => x.WorkshopCreated && x.WorkshopId is > 0)) 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 a7b5b7e1..3050b957 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -3387,13 +3387,13 @@ public class InstitutionContractRepository : RepositoryBasex.Id == amendmentTemp.Id); await _context.SaveChangesAsync(); @@ -4613,6 +4613,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 @@ -4687,13 +4689,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, @@ -4708,6 +4710,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) @@ -4718,6 +4721,12 @@ public class InstitutionContractRepository : RepositoryBase + x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList(); + + //حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه + institutionContracts = institutionContracts.Except(paidInFull).ToList(); #region RollCallServicCompute @@ -4765,8 +4774,7 @@ public class InstitutionContractRepository : RepositoryBase @@ -4800,8 +4808,7 @@ public class InstitutionContractRepository : RepositoryBase @@ -4828,12 +4835,17 @@ public class InstitutionContractRepository : RepositoryBase x.ContractingPartyId == item.ContractingPartyId) .Select(x => x.id).ToListAsync(); diff --git a/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs b/CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs index 2657de37..57d41be0 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.CountPerson > 0) + plans = plans.Where(x => x.CountPerson == searchModel.CountPerson); + + 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..d8bbc852 --- /dev/null +++ b/ServiceHost/Areas/Admin/Controllers/ServiceAmountsManagement.cs @@ -0,0 +1,64 @@ +using _0_Framework.Application; +using AccountManagement.Application.Contracts.Ticket; +using CompanyManagment.App.Contracts.InstitutionContract; +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 diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs index a198bbe5..9cd23c91 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs +++ b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs @@ -1045,7 +1045,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk x.PersonnelCount, x.Price, x.InstitutionContractWorkshopGroupId, group, - x.WorkshopId.Value,x.id,false); + x.WorkshopId.Value,false,x.id); entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList()); return entity; diff --git a/ServiceHost/Conventions/ParameterBindingConvention.cs b/ServiceHost/Conventions/ParameterBindingConvention.cs index ccc0fa73..aded0e88 100644 --- a/ServiceHost/Conventions/ParameterBindingConvention.cs +++ b/ServiceHost/Conventions/ParameterBindingConvention.cs @@ -70,7 +70,8 @@ public class ParameterBindingConvention : IApplicationModelConvention { if (selector.AttributeRouteModel?.Template != null) { - if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase)) + if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) || + selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase)) return true; } } @@ -80,7 +81,8 @@ public class ParameterBindingConvention : IApplicationModelConvention { if (selector.AttributeRouteModel?.Template != null) { - if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase)) + if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) || + selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase)) return true; } }