ServiceAmount GetList
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using _0_Framework.Domain;
|
using _0_Framework.Application;
|
||||||
|
using _0_Framework.Domain;
|
||||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -33,4 +34,12 @@ public interface IPlanPercentageRepository : IRepository<long, PlanPercentage>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<CreateServiceAmountDto> GetCreateModalData();
|
Task<CreateServiceAmountDto> GetCreateModalData();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست مبالغ سرویس ها
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||||
|
InstitutionPlanSearchModel searchModel);
|
||||||
}
|
}
|
||||||
@@ -49,4 +49,13 @@ public interface IInstitutionPlanApplication
|
|||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<OperationResult> CreateInstitutionPlanPercentage(CreateServiceAmountDto command);
|
Task<OperationResult> CreateInstitutionPlanPercentage(CreateServiceAmountDto command);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست مبالغ سرویس ها
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||||
|
InstitutionPlanSearchModel searchModel);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||||
|
|
||||||
|
public class InstitutionPlanListDto
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تعداد پرسنل
|
||||||
|
/// </summary>
|
||||||
|
public int CountPerson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ قرارداد و تصفیه
|
||||||
|
/// </summary>
|
||||||
|
public string ContractAndCheckout { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ بیمه
|
||||||
|
/// </summary>
|
||||||
|
public string Insurance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ حضورغباب
|
||||||
|
/// </summary>
|
||||||
|
public string RollCall { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ فیش غیر رسمی
|
||||||
|
/// </summary>
|
||||||
|
public string CustomizeCheckout { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||||
|
/// </summary>
|
||||||
|
public string ContractAndCheckoutInPerson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ خدمات حضوری بیمه
|
||||||
|
/// </summary>
|
||||||
|
public string InsuranceInPerson { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Total
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات حضوری
|
||||||
|
/// </summary>
|
||||||
|
public string InPersonSumAmountStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات آنلاین
|
||||||
|
/// </summary>
|
||||||
|
public string OnlineOnlySumAmountStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات حضوری و آنلاین
|
||||||
|
/// </summary>
|
||||||
|
public string OnlineAndInPersonSumAmountStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات حضوری و آنلاین
|
||||||
|
/// double
|
||||||
|
/// </summary>
|
||||||
|
public double OnlineAndInPersonSumAmountDouble { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات حضوری
|
||||||
|
/// double
|
||||||
|
/// </summary>
|
||||||
|
public double InPersonSumAmountDouble { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ کل خدمات آنلاین
|
||||||
|
/// double
|
||||||
|
/// </summary>
|
||||||
|
public double OnlineOnlySumAmountDouble { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using _0_Framework.Application;
|
||||||
|
|
||||||
|
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||||
|
|
||||||
|
public class InstitutionPlanSearchModel : PaginationRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// تعدلد پرسنل برای جستجو
|
||||||
|
/// </summary>
|
||||||
|
public int CountPeron { get; set; }
|
||||||
|
}
|
||||||
@@ -148,5 +148,10 @@ public class InstitutionPlanApplication : IInstitutionPlanApplication
|
|||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<PagedResult<InstitutionPlanListDto>> GetList(InstitutionPlanSearchModel searchModel)
|
||||||
|
{
|
||||||
|
return await _planPercentageRepository.GetList(searchModel);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
using System;
|
using _0_Framework.Application;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using _0_Framework.Application;
|
|
||||||
using _0_Framework.InfraStructure;
|
using _0_Framework.InfraStructure;
|
||||||
using Company.Domain.InstitutionPlanAgg;
|
using Company.Domain.InstitutionPlanAgg;
|
||||||
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CompanyManagment.EFCore.Repository;
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
|||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||||
{
|
{
|
||||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||||
@@ -323,5 +324,89 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
|||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||||
|
InstitutionPlanSearchModel searchModel)
|
||||||
|
{
|
||||||
|
var planPercentage = await _context.PlanPercentages.FirstOrDefaultAsync();
|
||||||
|
if (planPercentage == null)
|
||||||
|
return new PagedResult<InstitutionPlanListDto>();
|
||||||
|
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<InstitutionPlanListDto>();
|
||||||
|
|
||||||
|
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<InstitutionPlanListDto>()
|
||||||
|
{
|
||||||
|
TotalCount = finalResult.Count,
|
||||||
|
List = finalResult
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -43,10 +43,21 @@ public class ServiceAmountsManagement : AdminBaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!_authHelper.HasPermission(315))
|
if (!_authHelper.HasPermission(315))
|
||||||
return new OperationResult().Failed("اجازه دسترسی ندارید");
|
return Forbid();
|
||||||
|
|
||||||
var result = await _institutionPlanApplication.CreateInstitutionPlanPercentage(command);
|
var result = await _institutionPlanApplication.CreateInstitutionPlanPercentage(command);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست مبالغ سرویس ها
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetList")]
|
||||||
|
public async Task<ActionResult<PagedResult<InstitutionPlanListDto>>> GetList(InstitutionPlanSearchModel searchModel)
|
||||||
|
{
|
||||||
|
return await _institutionPlanApplication.GetList(searchModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user