merge from master
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
@@ -17,4 +18,12 @@ public interface IPlanPercentageRepository : IRepository<long, PlanPercentage>
|
||||
/// <param name="countPeron"></param>
|
||||
/// <returns></returns>
|
||||
List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت مبالغ سرویس ها برای هر کارگاه
|
||||
/// بر اساس تعداد پرسنل کارگاه
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
using _0_Framework.Domain;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IWorkshopServicesTempRepository : IRepository<long, WorkshopServicesTemp>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// حذف کامل سرویس های کارگاه
|
||||
/// </summary>
|
||||
/// <param name="workshopTempId"></param>
|
||||
public void RemoveServices(long workshopTempId);
|
||||
}
|
||||
@@ -11,6 +11,10 @@ namespace Company.Domain.YearlySalaryAgg;
|
||||
|
||||
public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
|
||||
{
|
||||
/// <summary>
|
||||
/// تست محاسبه مزد پایه
|
||||
/// </summary>
|
||||
void TestDayliFeeCompute();
|
||||
List<string> GetYears();
|
||||
List<YearlySalaryViewModel> GetYearlySalary();
|
||||
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
@@ -25,4 +26,12 @@ public interface IInstitutionPlanApplication
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
EditInstitutionPlanPercentage GetByFirst();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت مبالغ سرویس ها برای هر کارگاه
|
||||
/// بر اساس تعداد پرسنل کارگاه
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
|
||||
}
|
||||
@@ -96,6 +96,27 @@ public class InstitutionPlanViewModel
|
||||
/// مبلغ کل خدمات حضوری و آنلاین
|
||||
/// </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
|
||||
|
||||
|
||||
|
||||
@@ -52,15 +52,15 @@ public class CreateWorkshopTemp
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری قرداد و تصفیه
|
||||
///// </summary>
|
||||
//public bool ContractAndCheckoutInPersonPercent { get; set; }
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری بیمه
|
||||
///// </summary>
|
||||
//public bool InsuranceInPersonPercent { get; set; }
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
@@ -28,7 +29,21 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTemp"></param>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp);
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTempId);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش کارگاه و سرویس های آن
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateOrUpdateWorkshopTemp(List<WorkshopTempViewModel> command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت جمع کل خدمات برای یک کارگاه
|
||||
/// </summary>
|
||||
/// <param name="workshop"></param>
|
||||
/// <returns></returns>
|
||||
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel workshop);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class ReviewAndPaymentViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// جمع کل برای یک ماه
|
||||
/// double
|
||||
/// </summary>
|
||||
public double TotalPayment1MonthDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای یک ماه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string TotalPayment1MonthStr { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 3 ماه
|
||||
/// double
|
||||
/// </summary>
|
||||
public double TotalPayment3MonthsDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 3 ماه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string TotalPayment3MonthsStr { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 6 ماه
|
||||
/// double
|
||||
/// </summary>
|
||||
public double TotalPayment6MonthsDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 6 ماه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string TotalPayment6MonthsStr { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 12 ماه
|
||||
/// double
|
||||
/// </summary>
|
||||
public double TotalPayment12MonthsDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل برای 12 ماه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string TotalPayment12MonthsStr { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت یکجا
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double OneTimePaymentDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت یکجا
|
||||
/// string
|
||||
/// </summary>
|
||||
public string OneTimePaymentStr { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت مرحله ای
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double MonthlyPaymentDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت مرحله ای
|
||||
/// string
|
||||
/// </summary>
|
||||
public string MonthlyPaymentStr { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// بازه قرداد
|
||||
/// با عدد مشخص میشود
|
||||
/// مثلا یک ماه عدد 1
|
||||
/// </summary>
|
||||
public string PeriodModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مدل پرداخت
|
||||
/// پر میشود OneTime پرداخت یکجا با کلمه
|
||||
/// پر میشود Monthly پرداخت مرحله ای با کلمه
|
||||
/// </summary>
|
||||
public string PaymentModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارگاه های ایجاد شده
|
||||
/// </summary>
|
||||
public List<WorkshopTempViewModel> WorkshopTempViewList { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using System;
|
||||
|
||||
public class WorkshopServicesTempViewModel
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class WorkshopServicesTempViewModel : CreateWorkshopServicesTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationDate{ get; set; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -78,4 +79,9 @@ public class InstitutionPlanApplication : IInstitutionPlanApplication
|
||||
{
|
||||
return _planPercentageRepository.GetByFirst();
|
||||
}
|
||||
|
||||
public InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command)
|
||||
{
|
||||
return _planPercentageRepository.GetInstitutionPlanForWorkshop(command);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PersianTools.Core;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -14,12 +18,19 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
private readonly IContractingPartyTempRepository _contractingPartyTempRepository;
|
||||
private readonly IPersonalContractingPartyRepository _personalContractingPartyRepository;
|
||||
private readonly IUidService _uidService;
|
||||
private readonly IWorkshopTempRepository _workshopTempRepository;
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
private readonly IWorkshopServicesTempRepository _workshopServicesTempRepository;
|
||||
|
||||
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService)
|
||||
|
||||
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService, IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository, IWorkshopServicesTempRepository workshopServicesTempRepository)
|
||||
{
|
||||
_contractingPartyTempRepository = contractingPartyTempRepository;
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
_uidService = uidService;
|
||||
_workshopTempRepository = workshopTempRepository;
|
||||
_planPercentageRepository = planPercentageRepository;
|
||||
_workshopServicesTempRepository = workshopServicesTempRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +40,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
/// <param name="dateOfBirth"></param>
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode , string dateOfBirth, string mobile)
|
||||
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile)
|
||||
{
|
||||
var op = new OperationResult<ContractingPartyTempViewModel>();
|
||||
|
||||
@@ -39,14 +50,14 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
string.IsNullOrWhiteSpace(mobile))
|
||||
return op.Failed("هیچ یک از فیلد ها نمیتواند خالی باشد");
|
||||
|
||||
|
||||
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
return op.Failed("کد ملی نا معتبر است");
|
||||
|
||||
if(!dateOfBirth.IsPersianDateValid())
|
||||
if (!dateOfBirth.IsPersianDateValid())
|
||||
return op.Failed("تاریخ تولد نا معتبر است");
|
||||
|
||||
if(!mobile.IsMobileValid())
|
||||
if (!mobile.IsMobileValid())
|
||||
return op.Failed("شماره همراه نا معتبر است");
|
||||
#endregion
|
||||
|
||||
@@ -70,8 +81,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
|
||||
if (getExistTemp != null)
|
||||
{
|
||||
|
||||
if(getExistTemp.DateOfBirth != dateOfBirthGr)
|
||||
|
||||
if (getExistTemp.DateOfBirth != dateOfBirthGr)
|
||||
return op.Failed("تاریخ تولد مطابقت ندارد");
|
||||
if (getExistTemp.Phone != mobile)
|
||||
return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
|
||||
@@ -82,13 +93,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
|
||||
if (isMachMobilAndNationalCode == null)
|
||||
return op.Failed("خطا در سرویس احراز هویت");
|
||||
if(!isMachMobilAndNationalCode.IsMatched)
|
||||
if (!isMachMobilAndNationalCode.IsMatched)
|
||||
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
|
||||
|
||||
//دریافت اطلاعات احراز هویت
|
||||
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
|
||||
|
||||
if(apiRespons == null)
|
||||
if (apiRespons == null)
|
||||
return op.Failed("خطا در سرویس احراز هویت");
|
||||
if (apiRespons.ResponseContext.Status.Code != 0)
|
||||
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
|
||||
@@ -104,41 +115,265 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
apiRespons.IdentificationInformation.ShenasnameSeri,
|
||||
apiRespons.IdentificationInformation.ShenasnameSerial, apiRespons.BasicInformation.GenderEnum,
|
||||
dateOfBirthGr);
|
||||
await _contractingPartyTempRepository.CreateAsync(createTemp);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
await _contractingPartyTempRepository.CreateAsync(createTemp);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
var result = new ContractingPartyTempViewModel();
|
||||
result.Id = createTemp.id;
|
||||
result.FName = createTemp.FName;
|
||||
result.LName = createTemp.LName;
|
||||
result.DateOfBirthFa = dateOfBirth;
|
||||
result.IdNumber = idNumber;
|
||||
var result = new ContractingPartyTempViewModel();
|
||||
result.Id = createTemp.id;
|
||||
result.FName = createTemp.FName;
|
||||
result.LName = createTemp.LName;
|
||||
result.DateOfBirthFa = dateOfBirth;
|
||||
result.IdNumber = idNumber;
|
||||
|
||||
return op.Succcedded(result);
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل اطلاعات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="city"></param>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<OperationResult> UpdateAddress(long id, string state, string city, string address)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get(id);
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get(id);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(state) || string.IsNullOrWhiteSpace(city) || string.IsNullOrWhiteSpace(address))
|
||||
return op.Failed("اطلاعات ادرس را تکمیل کنید");
|
||||
if (string.IsNullOrWhiteSpace(state) || string.IsNullOrWhiteSpace(city) || string.IsNullOrWhiteSpace(address))
|
||||
return op.Failed("اطلاعات ادرس را تکمیل کنید");
|
||||
|
||||
contractingPartyTemp.UpdateAddress(state,city,address);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
contractingPartyTemp.UpdateAddress(state, city, address);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp)
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTempId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش کارگاه و سرویس های آن
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult> CreateOrUpdateWorkshopTemp(List<WorkshopTempViewModel> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var updateWorkshopList = command.Where(x => x.Id > 0).ToList();
|
||||
var createNewWorkshopList = command.Where(x => x.Id == 0).ToList();
|
||||
|
||||
if (updateWorkshopList.Count == 0 && createNewWorkshopList.Count == 0)
|
||||
return op.Failed("هیچ مجموعه ای ایجاد نشده است");
|
||||
|
||||
#region Update
|
||||
if (updateWorkshopList.Count > 0)
|
||||
{
|
||||
|
||||
foreach (var workshop in updateWorkshopList)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
return op.Failed("نام مجموعه نمی تواند خالی باشد");
|
||||
if (workshop.CountPerson == 0)
|
||||
op.Failed($"تعداد پرسنل مجوعه {workshop.WorkshopName} صفر است");
|
||||
if (workshop.ContractAndCheckout == false && workshop.CustomizeCheckout == false &&
|
||||
workshop.RollCall == false && workshop.Insurance == false)
|
||||
op.Failed($"برای مجموعه {workshop.WorkshopName} هیچ سرویسی انتخاب نشده است");
|
||||
var existWorkshops = _workshopTempRepository.Get(workshop.Id);
|
||||
if (existWorkshops != null)
|
||||
{
|
||||
if (workshop.ContractAndCheckout)
|
||||
workshop.ContractAndCheckoutInPerson = true;
|
||||
if (workshop.Insurance)
|
||||
workshop.InsuranceInPerson = true;
|
||||
|
||||
//دریافت مبالغ سرویس ها
|
||||
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(workshop);
|
||||
if (plan.OnlineAndInPersonSumAmountDouble > 0)
|
||||
{
|
||||
//ویرایش مشخصات کارگاه
|
||||
existWorkshops.Edit(workshop.WorkshopName, workshop.CountPerson, plan.OnlineAndInPersonSumAmountDouble);
|
||||
await _workshopTempRepository.SaveChangesAsync();
|
||||
|
||||
//حذف سرویس های قبلی
|
||||
_workshopServicesTempRepository.RemoveServices(workshop.Id);
|
||||
|
||||
//سرویس قرداد
|
||||
if (workshop.ContractAndCheckout)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson, workshop.Id));
|
||||
//سرویس خدمات حضوری قرارداد
|
||||
if (workshop.ContractAndCheckoutInPerson)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, workshop.Id));
|
||||
|
||||
//سرویس بیمه
|
||||
if (workshop.Insurance)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("Insurance", workshop.CountPerson, workshop.Id));
|
||||
//سرویس خدمات حضوری بیمه
|
||||
if (workshop.InsuranceInPerson)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson, workshop.Id));
|
||||
|
||||
//سرویس حضورغیاب
|
||||
if (workshop.RollCall)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("RollCall", workshop.CountPerson, workshop.Id));
|
||||
//سرویس فیش غیر رسمی
|
||||
if (workshop.CustomizeCheckout)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson, workshop.Id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
|
||||
if (createNewWorkshopList.Count > 0)
|
||||
{
|
||||
foreach (var workshop in createNewWorkshopList)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
return op.Failed("نام مجموعه نمی تواند خالی باشد");
|
||||
if (workshop.CountPerson == 0)
|
||||
op.Failed($"تعداد پرسنل مجوعه {workshop.WorkshopName} صفر است");
|
||||
if (workshop.ContractAndCheckout == false && workshop.CustomizeCheckout == false &&
|
||||
workshop.RollCall == false && workshop.Insurance == false)
|
||||
op.Failed($"برای مجموعه {workshop.WorkshopName} هیچ سرویسی انتخاب نشده است");
|
||||
|
||||
if (workshop.ContractAndCheckout)
|
||||
workshop.ContractAndCheckoutInPerson = true;
|
||||
if (workshop.Insurance)
|
||||
workshop.InsuranceInPerson = true;
|
||||
|
||||
//دریافت مبالغ سرویس ها
|
||||
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(workshop);
|
||||
if (plan.OnlineAndInPersonSumAmountDouble > 0)
|
||||
{
|
||||
|
||||
|
||||
var createNewWorkshopTemp = new WorkshopTemp(workshop.WorkshopName, workshop.CountPerson,
|
||||
workshop.ContractingPartyTempId, plan.OnlineAndInPersonSumAmountDouble);
|
||||
await _workshopTempRepository.CreateAsync(createNewWorkshopTemp);
|
||||
await _workshopTempRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
//سرویس قرداد
|
||||
if (workshop.ContractAndCheckout)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
//سرویس خدمات حضوری قرارداد
|
||||
if (workshop.ContractAndCheckoutInPerson)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
|
||||
//سرویس بیمه
|
||||
if (workshop.Insurance)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("Insurance", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
//سرویس خدمات حضوری بیمه
|
||||
if (workshop.InsuranceInPerson)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
|
||||
//سرویس حضورغیاب
|
||||
if (workshop.RollCall)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("RollCall", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
//سرویس فیش غیر رسمی
|
||||
if (workshop.CustomizeCheckout)
|
||||
await _workshopServicesTempRepository.CreateAsync(
|
||||
new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت جمع کل خدمات برای یک کارگاه
|
||||
/// </summary>
|
||||
/// <param name="workshop"></param>
|
||||
/// <returns></returns>
|
||||
public InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel workshop)
|
||||
{
|
||||
return _planPercentageRepository.GetInstitutionPlanForWorkshop(workshop);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// بررسی و پرداخت
|
||||
/// اطلاعات کامل مبالغ
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId)
|
||||
{
|
||||
//دریافت کارگاه ها
|
||||
var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
|
||||
|
||||
double totalPayment1MonthDouble = 0;
|
||||
|
||||
//بدست آوردن جمع کل برای یک ماه
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
|
||||
}
|
||||
|
||||
|
||||
var result = new ReviewAndPaymentViewModel();
|
||||
|
||||
result.TotalPayment1MonthDouble = totalPayment1MonthDouble;
|
||||
result.TotalPayment1MonthStr = totalPayment1MonthDouble.ToMoney();
|
||||
|
||||
result.TotalPayment3MonthsDouble = totalPayment1MonthDouble * 3;
|
||||
result.TotalPayment3MonthsStr = result.TotalPayment3MonthsDouble.ToMoney();
|
||||
|
||||
result.TotalPayment6MonthsDouble = totalPayment1MonthDouble * 6;
|
||||
result.TotalPayment6MonthsStr = result.TotalPayment6MonthsDouble.ToMoney();
|
||||
|
||||
result.TotalPayment12MonthsDouble = totalPayment1MonthDouble * 12;
|
||||
result.TotalPayment12MonthsStr = result.TotalPayment12MonthsDouble.ToMoney();
|
||||
|
||||
|
||||
result.PeriodModel = "1";
|
||||
result.PaymentModel = "OneTime";
|
||||
|
||||
result.OneTimePaymentDouble = totalPayment1MonthDouble;
|
||||
result.OneTimePaymentStr = totalPayment1MonthDouble.ToMoney();
|
||||
|
||||
result.MonthlyPaymentDouble = totalPayment1MonthDouble;
|
||||
result.MonthlyPaymentStr = totalPayment1MonthDouble.ToMoney();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -167,4 +169,98 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
return plans;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command)
|
||||
{
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
if (planPercentage == null)
|
||||
return new InstitutionPlanViewModel();
|
||||
|
||||
var dailyWageYearlySalery = _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefault(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
if (dailyWageYearlySalery == null)
|
||||
return new InstitutionPlanViewModel();
|
||||
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
|
||||
if (command.CountPerson > 0)
|
||||
{
|
||||
var planByCountPerson = _context.InstitutionPlans
|
||||
.Where(x => x.CountPerson == command.CountPerson)
|
||||
.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble = command.ContractAndCheckout ?
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage) : 0,
|
||||
|
||||
InsuranceDouble = command.Insurance ? (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
|
||||
RollCallDouble = command.RollCall ? (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = command.ContractAndCheckoutInPerson ? (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
|
||||
InsuranceInPersonDouble = command.InsuranceInPerson ? (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
if(planByCountPerson == null)
|
||||
return new InstitutionPlanViewModel();
|
||||
//مبلغ کل خدمات حضوری
|
||||
var inPersonSumAmount = planByCountPerson.ContractAndCheckoutDouble + planByCountPerson.InsuranceDouble +
|
||||
planByCountPerson.ContractAndCheckoutInPersonDouble +
|
||||
planByCountPerson.InsuranceInPersonDouble;
|
||||
|
||||
// مبلغ کل خدمات آنلاین و حضوری
|
||||
var onlineAndInPersonSumAmount = planByCountPerson.ContractAndCheckoutDouble +
|
||||
planByCountPerson.InsuranceDouble +
|
||||
planByCountPerson.ContractAndCheckoutInPersonDouble + planByCountPerson.InsuranceInPersonDouble +
|
||||
planByCountPerson.RollCallDouble + planByCountPerson.CustomizeCheckoutDouble;
|
||||
|
||||
|
||||
//مبلغ کل خدمات آنلاین
|
||||
var onlineOnlySumAmount = planByCountPerson.ContractAndCheckoutDouble + planByCountPerson.InsuranceDouble + planByCountPerson.RollCallDouble +
|
||||
planByCountPerson.CustomizeCheckoutDouble;
|
||||
|
||||
return new InstitutionPlanViewModel()
|
||||
{
|
||||
CountPerson = planByCountPerson.CountPerson,
|
||||
|
||||
ContractAndCheckout = planByCountPerson.ContractAndCheckoutDouble > 0 ? planByCountPerson.ContractAndCheckoutDouble.ToMoney() : "0",
|
||||
|
||||
Insurance = planByCountPerson.InsuranceDouble > 0 ? planByCountPerson.InsuranceDouble.ToMoney() : "0",
|
||||
|
||||
RollCall = planByCountPerson.RollCallDouble > 0 ? planByCountPerson.RollCallDouble.ToMoney() : "0",
|
||||
|
||||
CustomizeCheckout = planByCountPerson.CustomizeCheckoutDouble > 0 ? planByCountPerson.CustomizeCheckoutDouble.ToMoney() : "0",
|
||||
|
||||
ContractAndCheckoutInPerson = planByCountPerson.ContractAndCheckoutInPersonDouble > 0 ? planByCountPerson.ContractAndCheckoutInPersonDouble.ToMoney() : "0",
|
||||
|
||||
InsuranceInPerson = planByCountPerson.InsuranceInPersonDouble > 0 ? planByCountPerson.InsuranceInPersonDouble.ToMoney() : "0",
|
||||
|
||||
InPersonSumAmountDouble = inPersonSumAmount,
|
||||
InPersonSumAmountStr = inPersonSumAmount > 0 ? inPersonSumAmount.ToMoney() : "0",
|
||||
|
||||
OnlineAndInPersonSumAmountDouble = onlineAndInPersonSumAmount,
|
||||
OnlineAndInPersonSumAmountStr = onlineAndInPersonSumAmount > 0 ? onlineAndInPersonSumAmount.ToMoney() : "0",
|
||||
|
||||
OnlineOnlySumAmountDouble = onlineOnlySumAmount,
|
||||
OnlineOnlySumAmountStr = onlineOnlySumAmount > 0 ? onlineOnlySumAmount.ToMoney() : "0"
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
return new InstitutionPlanViewModel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class WorkshopServicesTempRepository : RepositoryBase<long, WorkshopServicesTemp>, IWorkshopServicesTempRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public WorkshopServicesTempRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public void RemoveServices(long workshopTempId)
|
||||
{
|
||||
var getServices = _context.WorkshopServicesTemps.Where(x => x.WorkshopTempId == workshopTempId);
|
||||
if (getServices.Any())
|
||||
{
|
||||
_context.WorkshopServicesTemps.RemoveRange(getServices);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,22 +41,4 @@ public class WorkshopTempRepository : RepositoryBase<long, WorkshopTemp>, IWorks
|
||||
}
|
||||
|
||||
|
||||
//public async Task<OperationResult> CreateOrUpdateWorkshopTemp(List<CreateWorkshopTemp> command)
|
||||
//{
|
||||
// var op = new OperationResult();
|
||||
// if (command.Count == 0)
|
||||
// return op.Failed("هیچ مجموعه ای ایجاد نشده است");
|
||||
// foreach (var workshop in command)
|
||||
// {
|
||||
// if(!string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
// return op.Failed("نام مجموعه نمیتواند خالی باشد");
|
||||
// if (workshop.CountPerson == 0)
|
||||
// op.Failed($"تعداد پرسنل مجوعه {workshop.WorkshopName} صفر است");
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// return op.Succcedded();
|
||||
//}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -452,6 +452,9 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<ITemporaryClientRegistrationApplication, TemporaryClientRegistrationApplication>();
|
||||
services.AddTransient<IContractingPartyTempRepository, ContractingPartyTempRepository>();
|
||||
|
||||
services.AddTransient<IWorkshopTempRepository, WorkshopTempRepository>();
|
||||
services.AddTransient<IWorkshopServicesTempRepository, WorkshopServicesTempRepository>();
|
||||
|
||||
#endregion
|
||||
services.AddTransient<IRollCallDomainService, RollCallDomainService>();
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ public class IndexModel : PageModel
|
||||
foundMandatoryCompute.SalaryCompute.MoneyToDouble(), foundMandatoryCompute.SumTime44, foundMandatoryCompute.OfficialHoliday,
|
||||
int.Parse(foundMandatoryCompute.NumberOfFriday), foundMandatoryCompute.TotalHolidayAndNotH, foundMandatoryCompute.TotalHolidayAndNotM,
|
||||
foundMandatoryCompute.Basic, foundMandatoryCompute.FridayStartToEnd, foundMandatoryCompute.DayliFeeComplete, hasRollCall, workshop.WorkshopHolidayWorking);
|
||||
double foundMontlySalary = MontlyYearsBunos.MontlyWage;
|
||||
double foundMontlySalary = MontlyYearsBunos.MontlyWage + MontlyYearsBunos.BasicYears;
|
||||
int foundTotaldays = Convert.ToInt32(MontlyYearsBunos.SumOfWorkingDay);
|
||||
double foundDayliWage = foundMontlySalary / foundTotaldays;
|
||||
if (bunosesPay.NotCompleted)
|
||||
|
||||
@@ -14,6 +14,7 @@ using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.ReportAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using Company.Domain.YearlySalaryAgg;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
@@ -49,14 +50,14 @@ namespace ServiceHost.Pages
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
|
||||
private readonly IYearlySalaryRepository _yearlySalaryRepository;
|
||||
|
||||
|
||||
|
||||
|
||||
public IndexModel(ILogger<IndexModel> logger, IAccountApplication accountApplication, IGoogleRecaptcha googleRecaptcha, ISmsService smsService, IWorker worker,
|
||||
IAuthHelper authHelper, ICameraAccountApplication cameraAccountApplication, IWebHostEnvironment webHostEnvironment,
|
||||
IAndroidApkVersionApplication androidApkVersionApplication, ITemporaryClientRegistrationApplication clientRegistrationApplication)
|
||||
IAndroidApkVersionApplication androidApkVersionApplication, ITemporaryClientRegistrationApplication clientRegistrationApplication, IYearlySalaryRepository yearlySalaryRepository)
|
||||
{
|
||||
_logger = logger;
|
||||
_accountApplication = accountApplication;
|
||||
@@ -68,10 +69,12 @@ namespace ServiceHost.Pages
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_androidApkVersionApplication = androidApkVersionApplication;
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_yearlySalaryRepository = yearlySalaryRepository;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
//_yearlySalaryRepository.TestDayliFeeCompute();
|
||||
bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user