set Salary in create employee by Client merged
This commit is contained in:
@@ -213,6 +213,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
|
||||
.ToList(), earlyExit.Value);
|
||||
}
|
||||
|
||||
public void UpdateIsShiftChange()
|
||||
{
|
||||
var groupSetting = CustomizeWorkshopGroupSettings;
|
||||
@@ -269,4 +270,10 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
|
||||
IsShiftChanged = isShiftChange;
|
||||
}
|
||||
|
||||
|
||||
public void SetSalary(double salary)
|
||||
{
|
||||
Salary = salary;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InsuranceJob;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
|
||||
namespace Company.Domain.InsurancJobAgg;
|
||||
|
||||
@@ -13,10 +14,16 @@ public interface IInsuranceJobRepositpry:IRepository<long, InsuranceJob>
|
||||
{
|
||||
//OperationResult Create(CreateInsurancJob command);
|
||||
// OperationResult Edit(EditInsurancJob command);
|
||||
EditInsuranceJob GetDetails(long id);
|
||||
EditInsuranceJob GetDetails(long id, string year, string month);
|
||||
List<InsuranceJobViewModel> GetInsurancJob();
|
||||
List<InsuranceJobViewModel> Search(InsuranceJobSearchModel searchModel);
|
||||
OperationResult CreateInsuranceJob(CreateInsuranceJob command);
|
||||
List<(long id, string date)> GetOldYersInsuranceItemIds();
|
||||
OperationResult CopyFromLastYear(CopyFromLastYearViewModel command);
|
||||
OperationResult RecoveryOldData1403();
|
||||
OperationResult Remove(long id);
|
||||
OperationResult EditInsuranceJob(EditInsuranceJob command);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,11 @@ public interface IInsuranceJobItemRepositpry : IRepository<long, InsuranceJobIte
|
||||
{
|
||||
void CreateInsuranceJobItem(InsuranceJobItemViewModel model);
|
||||
DetailsInsuranceJobItem GetDetails(long id);
|
||||
List<InsuranceJobItemViewModel> GetInsuranceJobItemByInsuranceJobId(long Id);
|
||||
List<InsuranceJobItemViewModel> GetInsuranceJobItemByInsuranceJobId(long Id, string year, string month);
|
||||
List<InsuranceJobItemViewModel> Search(InsuranceJobItemSearchModel searchModel);
|
||||
InsuranceJobItemViewModel GetInsuranceJobItemByInsuranceJobIdForFixedSalary(long insuranceJobId, long jobId);
|
||||
InsuranceJobItemViewModel GetInsuranceJobItemByInsuranceJobIdForFixedSalary(long insuranceJobId, long jobId,
|
||||
string year, string month);
|
||||
|
||||
(List<string> workshopList, bool hasAnyWorkshop) GetWorkshopUsedThisInsuranceJob(long insuranceJobId);
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.InsuranceJobAndJobsAgg;
|
||||
using Company.Domain.InsurancJobAgg;
|
||||
@@ -8,13 +9,15 @@ namespace Company.Domain.InsuranceJobItemAgg;
|
||||
|
||||
public class InsuranceJobItem : EntityBase
|
||||
{
|
||||
public InsuranceJobItem(double percentageLessThan, double salaeyLessThan, double percentageMoreThan, double salaryMoreThan, long insuranceJobId)
|
||||
public InsuranceJobItem(double percentageLessThan, double salaeyLessThan, double percentageMoreThan, double salaryMoreThan, long insuranceJobId, DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
PercentageLessThan = percentageLessThan;
|
||||
SalaeyLessThan = salaeyLessThan;
|
||||
PercentageMoreThan = percentageMoreThan;
|
||||
SalaryMoreThan = salaryMoreThan;
|
||||
InsuranceJobId = insuranceJobId;
|
||||
StartDate = startDate;
|
||||
EndDate = endDate;
|
||||
}
|
||||
|
||||
public double PercentageLessThan { get; private set; }
|
||||
@@ -22,6 +25,9 @@ public class InsuranceJobItem : EntityBase
|
||||
public double PercentageMoreThan { get; private set; }
|
||||
public double SalaryMoreThan { get; private set; }
|
||||
|
||||
public DateTime? StartDate { get; private set; }
|
||||
public DateTime? EndDate { get; private set; }
|
||||
|
||||
public long InsuranceJobId { get; private set; }
|
||||
public InsuranceJob InsuranceJob { get; set; }
|
||||
public List<InsuranceJobAndJobs> InsuranceJobAndJobs { get; set; }
|
||||
@@ -31,12 +37,14 @@ public class InsuranceJobItem : EntityBase
|
||||
InsuranceJobAndJobs = new List<InsuranceJobAndJobs>();
|
||||
}
|
||||
|
||||
public void Edit(double percentageLessThan, double salaeyLessThan, double percentageMoreThan, double salaryMoreThan, long insuranceJobId)
|
||||
public void Edit(double percentageLessThan, double salaeyLessThan, double percentageMoreThan, double salaryMoreThan, long insuranceJobId, DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
PercentageLessThan = percentageLessThan;
|
||||
SalaeyLessThan = salaeyLessThan;
|
||||
PercentageMoreThan = percentageMoreThan;
|
||||
SalaryMoreThan = salaryMoreThan;
|
||||
InsuranceJobId = insuranceJobId;
|
||||
StartDate = startDate;
|
||||
EndDate = endDate;
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,5 @@ public interface ILeftWorkRepository : IRepository<long, LeftWork>
|
||||
#endregion
|
||||
|
||||
Task<LeftWork> GetLastLeftWork(long employeeId, long workshopId);
|
||||
List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ public class CustomizeWorkshopGroupSettingsViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public double Salary { get; set; }
|
||||
public string SalaryStr { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public bool MainGroup { get; set; }
|
||||
public List<CustomizeWorkshopShiftViewModel> RollCallWorkshopShifts { get; set; }
|
||||
@@ -18,4 +19,5 @@ public class CustomizeWorkshopGroupSettingsViewModel
|
||||
public BreakTime BreakTime { get; set; }
|
||||
public FridayWork FridayWork { get; set; }
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
public int LeavePermitted { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.DateSalary;
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.DateSalary;
|
||||
|
||||
public class DateSalaryViewModel
|
||||
{
|
||||
@@ -7,4 +9,6 @@ public class DateSalaryViewModel
|
||||
public string Month { get; set; }
|
||||
public string StartDateFa { get; set; }
|
||||
public string EndDateFa { get; set; }
|
||||
public DateTime StartDateGr { get; set; }
|
||||
public DateTime EndDateGr { get; set; }
|
||||
}
|
||||
@@ -28,6 +28,10 @@ public class CreateEmployeeByClient
|
||||
public List<AddEmployeeDocumentItem> EmployeeDocumentItems { get; set; }
|
||||
public bool HasEmployeeDocument { get; set; }
|
||||
public bool HasRollCallService { get; set; }
|
||||
public bool HasCustomizeCheckoutService { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InsuranceJob;
|
||||
|
||||
public class CopyFromLastYearViewModel
|
||||
{
|
||||
public string StartDate { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
|
||||
public long InsuranceJobItemId { get; set; }
|
||||
|
||||
public SelectList InsuranceJobItemViewModels { get; set; }
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
using CompanyManagment.App.Contracts.Job;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InsuranceJob;
|
||||
|
||||
@@ -14,7 +15,20 @@ public class CreateInsuranceJob
|
||||
public long YearlySalaryId { get; set; }
|
||||
public string EconomicCode { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public long JobId { get; set; }
|
||||
|
||||
public string StartDateFa { get; set; }
|
||||
public string EndDateFa { get; set; }
|
||||
public List<JobViewModel> Jobs { get; set; }
|
||||
public List<InsuranceJobItemViewModel> InsuranceJobItems { get; set; }
|
||||
|
||||
public List<string> WorkshopList { get; set; }
|
||||
public bool HasAnyWorkshop { get; set; }
|
||||
|
||||
public long InsuranceJobItemId { get; set; }
|
||||
|
||||
public SelectList InsuranceJobItemViewModels { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -10,9 +10,12 @@ namespace CompanyManagment.App.Contracts.InsuranceJob;
|
||||
|
||||
public interface IInsuranceJobApplication
|
||||
{
|
||||
List<(long id, string date)> GetOldYersInsuranceItemIds();
|
||||
OperationResult CopyFromLastYear(CopyFromLastYearViewModel command);
|
||||
OperationResult RecoveryOldData1403();
|
||||
OperationResult Create(CreateInsuranceJob command);
|
||||
OperationResult Edit(EditInsuranceJob command);
|
||||
EditInsuranceJob GetDetails(long id);
|
||||
EditInsuranceJob GetDetails(long id,string year, string month);
|
||||
List<InsuranceJobViewModel> GetInsurancJob();
|
||||
|
||||
List<InsuranceJobViewModel> Search(InsuranceJobSearchModel searchModel);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InsuranceJob;
|
||||
|
||||
@@ -13,4 +14,7 @@ public class InsuranceJobViewModel
|
||||
//public long YearlySalaryId { get; set; }
|
||||
public string EconomicCode { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public List<InsuranceJobItemViewModel> InsuranceJobItemViewModels { get; set; }
|
||||
|
||||
}
|
||||
@@ -11,14 +11,32 @@ namespace CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
public class InsuranceJobItemViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آیای این درصد در لیست مبالغ مبلغ پر شده دارد
|
||||
/// </summary>
|
||||
public bool IsPercentageLessThanUse { get; set; }
|
||||
public double PercentageLessThan { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آیای این درصد در لیست مبالغ مبلغ پر شده دارد
|
||||
/// </summary>
|
||||
public bool IsPercentageMoreThanUse { get; set; }
|
||||
public double PercentageMoreThan { get; set; }
|
||||
|
||||
public double SalaeyLessThan { get; set; }
|
||||
public double SalaryMoreThan { get; set; }
|
||||
public string SalaeyLessThanString { get; set; }
|
||||
public string SalaryMoreThanString { get; set; }
|
||||
public long InsuranceJobId { get; set; }
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
public List<long> JobIds { get; set; }
|
||||
public List<JobViewModel> JobList { get; set; }
|
||||
}
|
||||
@@ -16,6 +16,9 @@ public interface ILeftWorkApplication
|
||||
EditLeftWork GetDetails(long id);
|
||||
LeftWorkViewModel CheckoutleftWorkCheck(DateTime contractStart, long workshopId, long employeeId);
|
||||
List<LeftWorkViewModel> search(LeftWorkSearchModel searchModel);
|
||||
|
||||
|
||||
List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel);
|
||||
Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel);
|
||||
string StartWork(long employeeId, long workshopId, string leftWork);
|
||||
OperationResult RemoveLeftWork(long id);
|
||||
|
||||
@@ -65,4 +65,6 @@ public class RollCallViewModel
|
||||
/// مدت زمان استراحت
|
||||
/// </summary>
|
||||
public TimeSpan BreakTimeSpan { get; set; }
|
||||
|
||||
public DateTime? ShiftEndWithoutRest { get; set; }
|
||||
}
|
||||
@@ -346,9 +346,21 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa);
|
||||
int mandatoryWholeHours = (int)mandatoryHours;
|
||||
int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
|
||||
var totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
|
||||
var totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||
var totalPresent = totalWorking + totalBreakTime;
|
||||
TimeSpan totalWorking;
|
||||
TimeSpan totalBreakTime;
|
||||
TimeSpan totalPresent;
|
||||
if (result.HasRollCall)
|
||||
{
|
||||
totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
|
||||
totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||
totalPresent = totalWorking + totalBreakTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||
totalPresent = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
|
||||
totalWorking = totalPresent - totalBreakTime;
|
||||
}
|
||||
|
||||
result.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
|
||||
result.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
|
||||
|
||||
@@ -19,12 +19,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Hangfire.States;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -372,10 +373,10 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
}
|
||||
|
||||
if (customizeWorkshopGroupSettings.MainGroup)
|
||||
{
|
||||
var createDefaultEmployee = CreateEmployeeSettings(command);
|
||||
return createDefaultEmployee;
|
||||
}
|
||||
{
|
||||
var createDefaultEmployee = CreateEmployeeSettings(command);
|
||||
return createDefaultEmployee;
|
||||
}
|
||||
|
||||
|
||||
List<CustomizeWorkshopEmployeeSettingsShift> shiftCollection = new List<CustomizeWorkshopEmployeeSettingsShift>();
|
||||
@@ -557,7 +558,13 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
_customizeWorkshopEmployeeSettingsRepository.Create(entity);
|
||||
|
||||
entity.SimpleEdit(shiftCollection, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, isChanged, command.FridayWork, command.HolidayWork, rotatingShift);
|
||||
entity.SimpleEdit(shiftCollection, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, isChanged, command.FridayWork, command.HolidayWork, rotatingShift);
|
||||
var employeeSalary = command.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary > 0)
|
||||
{
|
||||
entity.SetSalary(employeeSalary);
|
||||
}
|
||||
|
||||
_customizeWorkshopGroupSettingsRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
@@ -681,7 +688,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command,
|
||||
List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
@@ -712,15 +719,15 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
{
|
||||
|
||||
groupSettingsShifts = command.ShiftViewModel.Select(x =>
|
||||
{
|
||||
if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start))
|
||||
throw new InvalidDataException();
|
||||
if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end))
|
||||
throw new InvalidDataException();
|
||||
{
|
||||
if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start))
|
||||
throw new InvalidDataException();
|
||||
if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end))
|
||||
throw new InvalidDataException();
|
||||
|
||||
return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement);
|
||||
return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement);
|
||||
|
||||
}).ToList();
|
||||
}).ToList();
|
||||
|
||||
if (groupSettingsShifts.All(x => workshopSettings.CustomizeWorkshopSettingsShifts.Any(y => x.Equals(y)))
|
||||
&& command.WorkshopShiftStatus == workshopSettings.WorkshopShiftStatus && command.FridayWork == workshopSettings.FridayWork &&
|
||||
@@ -1589,10 +1596,6 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
return _customizeWorkshopGroupSettingsRepository.GetEmployeesGroupSettingsByEmployeeId(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
return _customizeWorkshopGroupSettingsRepository.HasAnyEmployeeWithoutGroup(workshopId);
|
||||
}
|
||||
public OperationResult<List<long>> ValidateReCalculateValueForGroupEdit(List<ReCalculateRollCallValues> commands,
|
||||
long workshopId)
|
||||
{
|
||||
@@ -1623,10 +1626,16 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
employeeIdsHasCheckout = employeeIdsHasCheckout.Distinct().ToList();
|
||||
return isSuccess ?
|
||||
operationResult.Succcedded(employeeIdsHasCheckout)
|
||||
operationResult.Succcedded(employeeIdsHasCheckout)
|
||||
:
|
||||
operationResult.Failed("پرسنل هایی دارای فیش هستند لطفا نسبت به تعیین تکلیف این ها اقدام نمایید", employeeIdsHasCheckout);
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
return _customizeWorkshopGroupSettingsRepository.HasAnyEmployeeWithoutGroup(workshopId);
|
||||
}
|
||||
|
||||
public bool CheckEmployeeShiftHasChanged(EditCustomizeEmployeeSettings command)
|
||||
{
|
||||
return _customizeWorkshopEmployeeSettingsRepository.CheckEmployeeShiftHasChanged(command);
|
||||
|
||||
@@ -1,35 +1,38 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.EFCore;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using CompanyManagment.EFCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
using EmployeeInsuranceRecord = Company.Domain.EmployeeInsuranceRecordAgg.EmployeeInsuranceRecord;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
using CompanyManagment.App.Contracts.EmployeeBankInformation;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using System.Transactions;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using RollCallEmployee = Company.Domain.RollCallEmployeeAgg.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using System.Reflection;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -37,6 +40,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
private readonly IEmployeeRepository _EmployeeRepository;
|
||||
private readonly IWorkshopRepository _WorkShopRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IPersonnelCodeRepository _personnelCodeRepository;
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly CompanyContext _context;
|
||||
public bool nationalCodValid = false;
|
||||
public bool idnumberIsOk = true;
|
||||
@@ -54,16 +60,25 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly IUidService _uidService;
|
||||
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IPersonnelCodeRepository _personnelCodeRepository;
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
private readonly IEmployeeAuthorizeTempRepository _employeeAuthorizeTempRepository;
|
||||
private readonly IRollCallServiceRepository _rollCallServiceRepository;
|
||||
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository) : base(context)
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository,
|
||||
ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository,
|
||||
IEmployeeClientTempRepository employeeClientTempRepository, IWebHostEnvironment webHostEnvironment,
|
||||
IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository,
|
||||
ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository,
|
||||
ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication,
|
||||
IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository,
|
||||
IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository,
|
||||
IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, IRollCallServiceRepository rollCallServiceRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
this._leftWorkRepository = leftWorkRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
@@ -73,18 +88,15 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_uidService = uidService;
|
||||
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
_rollCallServiceRepository = rollCallServiceRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateEmployee command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
if (_EmployeeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null && x.IsActiveString == "true"))
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber !=null))
|
||||
@@ -102,7 +114,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
if (command.Address != null && command.State == null)
|
||||
{
|
||||
@@ -141,8 +153,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -194,9 +206,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return opration.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
@@ -221,9 +233,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return opration.Succcedded(employeeData.id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public OperationResult Edit(EditEmployee command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -232,11 +245,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_EmployeeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id && x.IsActiveString == "true"))
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber != null && x.id != command.Id))
|
||||
// return opration.Failed("شماره شناسنامه وارد شده تکراری است");
|
||||
|
||||
|
||||
if (command.Address != null && command.State == null)
|
||||
{
|
||||
StatCity = false;
|
||||
@@ -274,8 +287,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -328,7 +341,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
@@ -336,7 +349,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
dateOfIssue,
|
||||
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,
|
||||
command.Phone, command.Address,
|
||||
command.State,command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
||||
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
||||
command.FieldOfStudy, command.BankCardNumber,
|
||||
command.BankBranch, command.InsuranceCode, command.InsuranceHistoryByYear,
|
||||
command.InsuranceHistoryByMonth, command.NumberOfChildren, command.OfficePhone
|
||||
@@ -349,7 +362,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return opration.Succcedded();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public EditEmployee GetDetails(long id)
|
||||
@@ -357,6 +370,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return _EmployeeRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public EditEmployee GetDetailsIgnoreQueryFilter(long id)
|
||||
{
|
||||
return _EmployeeRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -395,8 +413,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
public async Task<List<EmployeeViewModel>> Search(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var res=await _EmployeeRepository.Search(searchModel);
|
||||
|
||||
var res = await _EmployeeRepository.Search(searchModel);
|
||||
|
||||
foreach (var item in res)
|
||||
{
|
||||
var children = _context.EmployeeChildrenSet.Count(x => x.EmployeeId == item.Id);
|
||||
@@ -687,8 +705,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -817,8 +835,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -898,11 +916,17 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Pooya
|
||||
|
||||
|
||||
public List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
public EmployeeViewModel GetEmployeeByNationalCodeIfHasActiveLeftWork(string nationalCode, List<long> workshopIds)
|
||||
{
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
@@ -910,7 +934,6 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
||||
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
||||
}
|
||||
|
||||
public EmployeeViewModel GetEmployeeByNationalCodeIfHasLeftWork(string nationalCode, List<long> workshopIds)
|
||||
{
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
@@ -918,11 +941,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkedEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
||||
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
||||
}
|
||||
public List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeViewModel> GetRangeByIds(IEnumerable<long> employeeIds)
|
||||
{
|
||||
@@ -958,6 +978,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
@@ -1041,6 +1062,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
_personnelCodeRepository.SaveChanges();
|
||||
}
|
||||
|
||||
var rollCallService = _rollCallServiceRepository.GetActiveServiceByWorkshopId(command.WorkshopId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture1) == false &&
|
||||
string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture2) == false)
|
||||
@@ -1050,14 +1072,14 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
var filePath1 = Path.Combine(directoryPath) + $@"\1.jpg";
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture1, filePath1);
|
||||
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture1, filePath1);
|
||||
|
||||
|
||||
var filePath2 = Path.Combine(directoryPath) + $@"\2.jpg";
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture2, filePath2);
|
||||
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture2, filePath2);
|
||||
|
||||
|
||||
|
||||
var rollCallEmployee =
|
||||
@@ -1090,6 +1112,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (rollCallService?.HasCustomizeCheckoutService == "true")
|
||||
{
|
||||
var employeeSalary = command.CreateCustomizeEmployeeSettings.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary < 1)
|
||||
{
|
||||
return op.Failed("لطفا حقوق پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
}
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id))
|
||||
{
|
||||
@@ -1117,6 +1149,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
else if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (rollCallService?.HasCustomizeCheckoutService == "true")
|
||||
{
|
||||
var employeeSalary = command.CreateCustomizeEmployeeSettings.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary < 1)
|
||||
{
|
||||
return op.Failed("لطفا حقوق پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
}
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id))
|
||||
{
|
||||
@@ -1210,6 +1252,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
byte[] bytes = Convert.FromBase64String(subBase64);
|
||||
System.IO.File.WriteAllBytes(filePath, bytes);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate, long workshopId)
|
||||
{
|
||||
@@ -1499,9 +1542,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
employee.EditAuthorizeEmployee(employee.DateOfIssue, employee.PlaceOfIssue,
|
||||
employee.Phone, employee.Address, employee.State, employee.City, command.MaritalStatus,
|
||||
command.MilitaryService, employee.LevelOfEducation, employee.FieldOfStudy,
|
||||
command.MilitaryService, employee.LevelOfEducation, employee.FieldOfStudy,
|
||||
employee.BankCardNumber, employee.BankBranch, employee.InsuranceCode,
|
||||
employee.InsuranceHistoryByYear, employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.InsuranceHistoryByYear, employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
@@ -1615,6 +1658,5 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -19,6 +19,21 @@ public class InsuranceJobApplication: IInsuranceJobApplication
|
||||
_insuranceJobItemRepositpry = insuranceJobItemRepositpry;
|
||||
}
|
||||
|
||||
public List<(long id, string date)> GetOldYersInsuranceItemIds()
|
||||
{
|
||||
return _insuranceJobRepositpry.GetOldYersInsuranceItemIds();
|
||||
}
|
||||
|
||||
public OperationResult CopyFromLastYear(CopyFromLastYearViewModel command)
|
||||
{
|
||||
return _insuranceJobRepositpry.CopyFromLastYear(command);
|
||||
}
|
||||
|
||||
public OperationResult RecoveryOldData1403()
|
||||
{
|
||||
return _insuranceJobRepositpry.RecoveryOldData1403();
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateInsuranceJob command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -32,6 +47,10 @@ public class InsuranceJobApplication: IInsuranceJobApplication
|
||||
if (_insuranceJobRepositpry.Exists(x => x.InsuranceJobTitle == command.InsuranceJobTitle))
|
||||
return opration.Failed("عنوان صنف و درجه تکراری است");
|
||||
|
||||
|
||||
if (command.InsuranceJobItemId == 0)
|
||||
return opration.Failed("بازه را انتخاب کنید");
|
||||
|
||||
//if (_insuranceJobRepositpry.Exists(x => x.EconomicCode == command.EconomicCode))
|
||||
// return opration.Failed("کد اقتصادی تکراری است");
|
||||
|
||||
@@ -116,9 +135,9 @@ public class InsuranceJobApplication: IInsuranceJobApplication
|
||||
return opration.Failed("ویرایش با خطا مواجه شد.");
|
||||
}
|
||||
}
|
||||
public EditInsuranceJob GetDetails(long id)
|
||||
public EditInsuranceJob GetDetails(long id, string year, string month)
|
||||
{
|
||||
return _insuranceJobRepositpry.GetDetails(id);
|
||||
return _insuranceJobRepositpry.GetDetails(id, year,month);
|
||||
}
|
||||
|
||||
public List<InsuranceJobViewModel> GetInsurancJob()
|
||||
|
||||
@@ -1680,6 +1680,7 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
{
|
||||
|
||||
double? result = 0;
|
||||
string month = $"{startDateGr.ToFarsi()}".Substring(5, 2);
|
||||
//اگر مشاغل مقطوع بود و شغلش کارفرما بود
|
||||
// در جدول لیست بیمه قبلی چک شود
|
||||
try
|
||||
@@ -1726,7 +1727,7 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
|
||||
{
|
||||
var inJob = _insuranceJobItemRepository
|
||||
.GetInsuranceJobItemByInsuranceJobId((long)workshop.InsuranceJobId);
|
||||
.GetInsuranceJobItemByInsuranceJobId((long)workshop.InsuranceJobId,year, month);
|
||||
if (workshop.Population == "MoreThan500")
|
||||
{
|
||||
var max = inJob.MaxBy(x => x.PercentageMoreThan);
|
||||
@@ -1775,9 +1776,9 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
else
|
||||
{
|
||||
|
||||
var searchModel = new InsuranceJobItemSearchModel();
|
||||
searchModel.InsuranceJobId = (long)insuranceJobId;
|
||||
var JobItem = _insuranceJobItemRepository.GetInsuranceJobItemByInsuranceJobIdForFixedSalary((long)insuranceJobId, jobId);
|
||||
var searchModel = new InsuranceJobItemSearchModel();
|
||||
searchModel.InsuranceJobId = (long)insuranceJobId;
|
||||
var JobItem = _insuranceJobItemRepository.GetInsuranceJobItemByInsuranceJobIdForFixedSalary((long)insuranceJobId, jobId, year, month);
|
||||
|
||||
if (JobItem != null && JobItem.Id != 0)
|
||||
{
|
||||
|
||||
@@ -211,6 +211,14 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
return _leftWorkRepository.search(searchModel);
|
||||
}
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
|
||||
return _leftWorkRepository.SearchCreateContract(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
var res = search(searchModel);
|
||||
|
||||
@@ -11,6 +11,9 @@ public class InsuranceJobeItemMapping : IEntityTypeConfiguration<InsuranceJobIte
|
||||
builder.ToTable("InsuranceJobItems");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.StartDate).IsRequired(false);
|
||||
builder.Property(x => x.EndDate).IsRequired(false);
|
||||
|
||||
builder.HasOne(x => x.InsuranceJob)
|
||||
.WithMany(x => x.InsuranceJobItemList)
|
||||
.HasForeignKey(x => x.InsuranceJobId);
|
||||
|
||||
9539
CompanyManagment.EFCore/Migrations/20250517165553_add startEndToInsuranceJobItems.Designer.cs
generated
Normal file
9539
CompanyManagment.EFCore/Migrations/20250517165553_add startEndToInsuranceJobItems.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addstartEndToInsuranceJobItems : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "EndDate",
|
||||
table: "InsuranceJobItems",
|
||||
type: "datetime2",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "StartDate",
|
||||
table: "InsuranceJobItems",
|
||||
type: "datetime2",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EndDate",
|
||||
table: "InsuranceJobItems");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StartDate",
|
||||
table: "InsuranceJobItems");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3293,6 +3293,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("EndDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("InsuranceJobId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -3308,6 +3311,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("SalaryMoreThan")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("StartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InsuranceJobId");
|
||||
|
||||
@@ -546,16 +546,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
SumOfWorkingDays = "-",
|
||||
OverTimeWorkValue = x.OverTimeWorkValue,
|
||||
OverNightWorkValue = x.OverNightWorkValue,
|
||||
FridayWorkValue = x.FridayWorkValue,
|
||||
RotatingShiftValue = x.RotatingShiftValue,
|
||||
AbsenceValue = x.AbsenceValue,
|
||||
MaritalStatus = "",
|
||||
TotalDayOfLeaveCompute = x.TotalDayOfLeaveCompute,
|
||||
TotalDayOfYearsCompute = x.TotalDayOfYearsCompute,
|
||||
TotalDayOfBunosesCompute = x.TotalDayOfBunosesCompute,
|
||||
TotalDayOfLeaveCompute = "-",
|
||||
TotalDayOfYearsCompute = "-",
|
||||
TotalDayOfBunosesCompute = "-",
|
||||
InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
@@ -661,6 +661,49 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
// ch.TotalDeductions = "";
|
||||
// ch.TotalPayment = "";
|
||||
//}
|
||||
|
||||
#region Leave
|
||||
|
||||
var leavesQuery = _context.LeaveList
|
||||
.Where(x => x.EmployeeId == ch.EmployeeId && x.WorkshopId == ch.WorkshopId &&
|
||||
x.StartLeave <= ch.ContractEndGr && x.EndLeave >= ch.ContractStartGr)
|
||||
.AsNoTracking();
|
||||
|
||||
var paidLeave = leavesQuery.Where(x => x.LeaveType == "استحقاقی");
|
||||
var sickLeave = leavesQuery.Where(x => x.LeaveType == "استعلاجی").ToList();
|
||||
|
||||
|
||||
var dailyPaidLeave = paidLeave.Where(x => x.PaidLeaveType == "روزانه").ToList();
|
||||
var hourlyPaidLeave = paidLeave.Where(x => x.PaidLeaveType == "ساعتی").ToList();
|
||||
|
||||
var sickLeaveTimeSpans = sickLeave.Select(x =>
|
||||
{
|
||||
var startLeave = ch.ContractStartGr > x.StartLeave ? ch.ContractStartGr : x.StartLeave;
|
||||
var endLeave = ch.ContractEndGr < x.EndLeave ? ch.ContractEndGr : x.EndLeave;
|
||||
|
||||
return (endLeave - startLeave).Add(TimeSpan.FromDays(1));
|
||||
});
|
||||
|
||||
ch.TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
|
||||
var hourlyPaidLeaveTimeSpans = hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan());
|
||||
|
||||
var dailyPaidLeaveTimeSpans = dailyPaidLeave.Select(x =>
|
||||
{
|
||||
var startLeave = ch.ContractStartGr > x.StartLeave ? ch.ContractStartGr : x.StartLeave;
|
||||
var endLeave = ch.ContractEndGr < x.EndLeave ? ch.ContractEndGr : x.EndLeave;
|
||||
return (endLeave - startLeave).Add(TimeSpan.FromDays(1));
|
||||
});
|
||||
|
||||
var totalPaidLeaveTimeSpans = hourlyPaidLeaveTimeSpans.Concat(dailyPaidLeaveTimeSpans);
|
||||
|
||||
ch.TotalPaidLeave = new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
if (ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
@@ -841,16 +884,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
SumOfWorkingDays = "-",
|
||||
OverTimeWorkValue = x.OverTimeWorkValue,
|
||||
OverNightWorkValue = x.OverNightWorkValue,
|
||||
FridayWorkValue = x.FridayWorkValue,
|
||||
RotatingShiftValue = x.RotatingShiftValue,
|
||||
AbsenceValue = x.AbsenceValue,
|
||||
MaritalStatus = "",
|
||||
TotalDayOfLeaveCompute = x.TotalDayOfLeaveCompute,
|
||||
TotalDayOfYearsCompute = x.TotalDayOfYearsCompute,
|
||||
TotalDayOfBunosesCompute = x.TotalDayOfBunosesCompute,
|
||||
TotalDayOfLeaveCompute = "-",
|
||||
TotalDayOfYearsCompute = "-",
|
||||
TotalDayOfBunosesCompute = "-",
|
||||
InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
@@ -1098,21 +1141,24 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
||||
|
||||
var rollCallTimeSpanPerDay =
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks));
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => y.ShiftEndWithoutRest == null ? (y.EndDate - y.StartDate).Value!.Ticks : (y.ShiftEndWithoutRest - y.StartDate)!.Value.Ticks));
|
||||
var breakTimePerDay = new TimeSpan(x.Sum(r => r.BreakTimeSpan.Ticks));
|
||||
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.Skip(1).FirstOrDefault();
|
||||
|
||||
var firstRCEndDate = firstRollCall.ShiftEndWithoutRest ?? firstRollCall.EndDate;
|
||||
var secondRCEndDate = secondRollCall.ShiftEndWithoutRest ?? secondRollCall.EndDate;
|
||||
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate1 = firstRollCall?.EndDate?.ToString("HH:mm") ?? "",
|
||||
EndDate1 =firstRCEndDate?.ToString("HH:mm") ?? "",
|
||||
|
||||
StartDate2 = secondRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = secondRollCall?.EndDate?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = secondRCEndDate?.ToString("HH:mm") ?? "",
|
||||
|
||||
TotalhourseSpan = rollCallTimeSpanPerDay - breakTimePerDay,
|
||||
TotalhourseSpan = rollCallTimeSpanPerDay,
|
||||
|
||||
BreakTimeTimeSpan = breakTimePerDay,
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ namespace CompanyManagment.EFCore.Repository
|
||||
}
|
||||
|
||||
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 12)
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 13)
|
||||
{
|
||||
var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime();
|
||||
queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate);
|
||||
|
||||
@@ -8,364 +8,351 @@ using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewM
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, IAuthHelper authHelper, IEmployeeRepository employeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IAuthHelper _authHelper = authHelper;
|
||||
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth)
|
||||
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, IAuthHelper authHelper, IEmployeeRepository employeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
|
||||
.FirstOrDefault();
|
||||
if (entity == null)
|
||||
return new();
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IAuthHelper _authHelper = authHelper;
|
||||
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
|
||||
|
||||
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Select(y => y.EmployeeId)
|
||||
.ToList();
|
||||
var employees = _employeeRepository.GetBy(employeeIds);
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth)
|
||||
{
|
||||
Id = entity.id,
|
||||
Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
|
||||
{
|
||||
var employee = employees.First(e => e.Id == y.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = y.id,
|
||||
EmployeeId = y.EmployeeId,
|
||||
IsSettingChanged = y.IsSettingChanged,
|
||||
IsShiftChanged = y.IsShiftChanged,
|
||||
Name = $"{employee}",
|
||||
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Salary = y.Salary,
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
|
||||
.FirstOrDefault();
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
};
|
||||
}).ToList(),
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
IrregularShift = x.IrregularShift,
|
||||
Salary = x.Salary,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.
|
||||
Select(r=>new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm"), EndTime = r.EndTime.ToString("HH:mm")}).ToList()
|
||||
}).ToList(),
|
||||
|
||||
};
|
||||
}
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
|
||||
.FirstOrDefault();
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = entity.id,
|
||||
Offset = entity.EndTimeOffSet,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
|
||||
{
|
||||
var employee = _employeeRepository.Get(y.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = y.id,
|
||||
EmployeeId = y.EmployeeId,
|
||||
IsSettingChanged = y.IsSettingChanged,
|
||||
IsShiftChanged = y.IsShiftChanged,
|
||||
Name = $"{employee?.FName} {employee?.LName}",
|
||||
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Salary = y.Salary,
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = y.LeavePermittedDays,
|
||||
IrregularShift = y.IrregularShift,
|
||||
WorkshopShiftStatus = y.WorkshopShiftStatus
|
||||
};
|
||||
}).ToList(),
|
||||
Salary = x.Salary,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift
|
||||
|
||||
|
||||
|
||||
}).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Select(y => y.EmployeeId)
|
||||
.ToList();
|
||||
var employees = _employeeRepository.GetBy(employeeIds);
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value,
|
||||
LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value,
|
||||
EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
Value = entity.BonusesPay.Value,
|
||||
BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
Value = entity.ShiftPay.Value,
|
||||
ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value,
|
||||
PaymentType = entity.BaseYearsPay.PaymentType
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new()
|
||||
{
|
||||
Value = entity.LeavePay.Value,
|
||||
LeavePayType = entity.LeavePay.LeavePayType
|
||||
},
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
Currency = entity.Currency,
|
||||
MaxMonthDays = entity.MaxMonthDays,
|
||||
Id = entity.id,
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
BonusesPaysInEndOfMonth = entity.BonusesPaysInEndOfMonth,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus
|
||||
|
||||
};
|
||||
return viewModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm"),
|
||||
Placement = x.Placement
|
||||
}).ToList(),
|
||||
Id = entity.id,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
FridayWork = entity.FridayWork,
|
||||
HolidayWork = entity.HolidayWork
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId)
|
||||
{
|
||||
|
||||
|
||||
var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
where groupSetting.IsShiftChange // Filter parent tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged// Filter child tables where isChange is true
|
||||
join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped
|
||||
select new ChangedGroupedViewModel
|
||||
{
|
||||
GroupName = grouped.First().GroupName,
|
||||
EmployeeName = grouped.Select(e => e.FullName).ToList()
|
||||
};
|
||||
|
||||
return result.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
|
||||
{
|
||||
var customizeWorkshopSettings = _companyContext.CustomizeWorkshopSettings
|
||||
.AsNoTracking().AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.Select(x => new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
GroupSettings = x.CustomizeWorkshopGroupSettingsCollection.Select(g =>
|
||||
Id = entity.id,
|
||||
Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = g.id,
|
||||
IrregularShift = g.IrregularShift,
|
||||
WorkshopShiftStatus = g.WorkshopShiftStatus,
|
||||
GroupName = g.GroupName,
|
||||
MainGroup = g.MainGroup,
|
||||
RollCallWorkshopShifts = g.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
IrregularShift = x.IrregularShift,
|
||||
Salary = x.Salary,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
StartTime = s.StartTime.ToString("HH:mm"),
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
}).ToList(),
|
||||
BreakTime = g.BreakTime,
|
||||
HolidayWork = g.HolidayWork,
|
||||
FridayWork = g.FridayWork,
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime = r.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.
|
||||
Select(r=>new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm"), EndTime = r.EndTime.ToString("HH:mm")}).ToList()
|
||||
}).ToList(),
|
||||
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
return customizeWorkshopSettings;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
|
||||
{
|
||||
var employee = _companyContext.CustomizeWorkshopSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
if (employee == null)
|
||||
return new();
|
||||
|
||||
var employeeName = _companyContext.Employees.Select(x => new { x.FullName, x.id })
|
||||
.FirstOrDefault(x => x.id == employee.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
};
|
||||
}
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
|
||||
{
|
||||
Id = employee.id,
|
||||
EmployeeId = employee.EmployeeId,
|
||||
IsSettingChanged = employee.IsSettingChanged,
|
||||
IsShiftChanged = employee.IsShiftChanged,
|
||||
Name = employeeName?.FullName,
|
||||
RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
|
||||
.FirstOrDefault();
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = entity.id,
|
||||
Offset = entity.EndTimeOffSet,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
|
||||
{
|
||||
var employee = _employeeRepository.Get(y.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = y.id,
|
||||
EmployeeId = y.EmployeeId,
|
||||
IsSettingChanged = y.IsSettingChanged,
|
||||
IsShiftChanged = y.IsShiftChanged,
|
||||
Name = $"{employee?.FName} {employee?.LName}",
|
||||
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Salary = y.Salary,
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = y.LeavePermittedDays,
|
||||
IrregularShift = y.IrregularShift,
|
||||
WorkshopShiftStatus = y.WorkshopShiftStatus
|
||||
};
|
||||
}).ToList(),
|
||||
Salary = x.Salary,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r=>new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift
|
||||
|
||||
|
||||
|
||||
}).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value,
|
||||
LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value,
|
||||
EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
Value = entity.BonusesPay.Value,
|
||||
BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
Value = entity.ShiftPay.Value,
|
||||
ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value,
|
||||
PaymentType = entity.BaseYearsPay.PaymentType
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new()
|
||||
{
|
||||
Value = entity.LeavePay.Value,
|
||||
LeavePayType = entity.LeavePay.LeavePayType
|
||||
},
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
Currency = entity.Currency,
|
||||
MaxMonthDays = entity.MaxMonthDays,
|
||||
Id = entity.id,
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
BonusesPaysInEndOfMonth = entity.BonusesPaysInEndOfMonth,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus
|
||||
|
||||
};
|
||||
return viewModel;
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettings GetBy(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
StartTime = x.StartTime.ToString("HH:mm"),
|
||||
Placement = x.Placement
|
||||
}).ToList(),
|
||||
Salary = employee.Salary
|
||||
};
|
||||
}
|
||||
Id = entity.id,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
FridayWork = entity.FridayWork,
|
||||
HolidayWork = entity.HolidayWork
|
||||
|
||||
#region Pooya
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId)
|
||||
{
|
||||
var query = _companyContext.CustomizeWorkshopGroupSettings.Where(x => x.MainGroup == false).Include(x => x)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection).Where(x => x.CustomizeWorkshopEmployeeSettingsCollection.Any(y =>
|
||||
};
|
||||
}
|
||||
|
||||
public List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId)
|
||||
{
|
||||
|
||||
|
||||
var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
where groupSetting.IsShiftChange // Filter parent tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged// Filter child tables where isChange is true
|
||||
join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped
|
||||
select new ChangedGroupedViewModel
|
||||
{
|
||||
GroupName = grouped.First().GroupName,
|
||||
EmployeeName = grouped.Select(e => e.FullName).ToList()
|
||||
};
|
||||
|
||||
return result.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
|
||||
{
|
||||
var customizeWorkshopSettings = _companyContext.CustomizeWorkshopSettings
|
||||
.AsNoTracking().AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.Select(x => new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
GroupSettings = x.CustomizeWorkshopGroupSettingsCollection.Select(g =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = g.id,
|
||||
IrregularShift = g.IrregularShift,
|
||||
WorkshopShiftStatus = g.WorkshopShiftStatus,
|
||||
GroupName = g.GroupName,
|
||||
MainGroup = g.MainGroup,
|
||||
Salary = g.Salary,
|
||||
SalaryStr = g.Salary.ToMoney(),
|
||||
LeavePermitted = g.LeavePermittedDays,
|
||||
RollCallWorkshopShifts = g.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
StartTime = s.StartTime.ToString("HH:mm"),
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
}).ToList(),
|
||||
BreakTime = g.BreakTime,
|
||||
HolidayWork = g.HolidayWork,
|
||||
FridayWork = g.FridayWork,
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r=>new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime= r.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
|
||||
}).ToList(),
|
||||
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
return customizeWorkshopSettings;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
|
||||
{
|
||||
var employee = _companyContext.CustomizeWorkshopSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
if (employee == null)
|
||||
return new();
|
||||
|
||||
var employeeName = _companyContext.Employees.Select(x => new { x.FullName, x.id })
|
||||
.FirstOrDefault(x => x.id == employee.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = employee.id,
|
||||
EmployeeId = employee.EmployeeId,
|
||||
IsSettingChanged = employee.IsSettingChanged,
|
||||
IsShiftChanged = employee.IsShiftChanged,
|
||||
Name = employeeName?.FullName,
|
||||
RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Salary = employee.Salary
|
||||
};
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId)
|
||||
{
|
||||
var query = _companyContext.CustomizeWorkshopGroupSettings.Where(x => x.MainGroup == false).Include(x => x)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection).Where(x => x.CustomizeWorkshopEmployeeSettingsCollection.Any(y =>
|
||||
y.WorkshopId == workshopId)).SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.Salary > 0).Select(x =>
|
||||
.Where(x => x.Salary > 0).Select(x =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
@@ -374,31 +361,26 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
EmployeeId = x.EmployeeId,
|
||||
BreakTime = x.BreakTime
|
||||
});
|
||||
return query.ToList();
|
||||
}
|
||||
return query.ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId).Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).SelectMany(x => x.CustomizeWorkshopGroupSettingsCollection
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId).Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).SelectMany(x => x.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(y => y.CustomizeWorkshopEmployeeSettingsCollection))
|
||||
.Select(x => new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
{
|
||||
BreakTime = x.BreakTime,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
Salary = x.Salary,
|
||||
GroupSettingsId = x.CustomizeWorkshopGroupSettingId
|
||||
}).ToList();
|
||||
}
|
||||
.Select(x => new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
{
|
||||
BreakTime = x.BreakTime,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
Salary = x.Salary,
|
||||
GroupSettingsId = x.CustomizeWorkshopGroupSettingId
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettings GetBy(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.AsSplitQuery()
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -43,6 +43,9 @@ public class DateSalaryRepository : RepositoryBase<long, DateSalary>, IDateSalar
|
||||
Year = x.Year,
|
||||
StartDateFa = x.StartDateFa,
|
||||
EndDateFa = x.EndDateFa,
|
||||
StartDateGr = x.StartDateGr,
|
||||
EndDateGr = x.EndDateGr
|
||||
|
||||
});
|
||||
var list = query.OrderByDescending(x => x.Id).ToList();
|
||||
|
||||
@@ -51,7 +54,7 @@ public class DateSalaryRepository : RepositoryBase<long, DateSalary>, IDateSalar
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
list = list.Where(x => x.Year == searchModel.Month).OrderByDescending(x => x.Year).ToList();
|
||||
return list;
|
||||
return list.OrderByDescending(x=>x.StartDateGr).ToList();
|
||||
}
|
||||
public DateSalaryViewModel GetDateSalaryViewModel(DateSalarySearchModel searchModel)
|
||||
{
|
||||
@@ -106,7 +109,7 @@ public class DateSalaryRepository : RepositoryBase<long, DateSalary>, IDateSalar
|
||||
var dateSalary = Get(command.Id);
|
||||
dateSalary.Edit(command.StartDateFa, command.EndDateFa);
|
||||
SaveChanges();
|
||||
command.DateSalaryItems = command.DateSalaryItems.Where(x => x.Salary > 0).ToList();
|
||||
//command.DateSalaryItems = command.DateSalaryItems.Where(x => x.Salary > 0).ToList();
|
||||
foreach (var item in command.DateSalaryItems)
|
||||
{
|
||||
if (item.Id == 0)
|
||||
|
||||
@@ -6,8 +6,10 @@ using _0_Framework.InfraStructure;
|
||||
|
||||
using Company.Domain.InsuranceJobAndJobsAgg;
|
||||
using Company.Domain.InsuranceJobItemAgg;
|
||||
using CompanyManagment.App.Contracts.DateSalaryItem;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
using CompanyManagment.App.Contracts.Job;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -22,8 +24,8 @@ public class InsuranceJobItemRepository : RepositoryBase<long, InsuranceJobItem>
|
||||
public void CreateInsuranceJobItem(InsuranceJobItemViewModel model)
|
||||
{
|
||||
|
||||
InsuranceJobItem incuranceJobItemObj = new InsuranceJobItem(model.PercentageLessThan, model.SalaeyLessThan,
|
||||
model.PercentageMoreThan, model.SalaryMoreThan, model.InsuranceJobId);
|
||||
InsuranceJobItem incuranceJobItemObj = new InsuranceJobItem(0, 0,
|
||||
0, 0, model.InsuranceJobId, model.StartDate,model.EndDate);
|
||||
_context.InsuranceJobItems.Add(incuranceJobItemObj);
|
||||
_context.SaveChanges();
|
||||
List<InsuranceJobAndJobs> insuranceJobAndJobsList = new List<InsuranceJobAndJobs>();
|
||||
@@ -44,7 +46,7 @@ public class InsuranceJobItemRepository : RepositoryBase<long, InsuranceJobItem>
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<InsuranceJobItemViewModel> GetInsuranceJobItemByInsuranceJobId(long Id)
|
||||
public List<InsuranceJobItemViewModel> GetInsuranceJobItemByInsuranceJobId(long Id, string year, string month)
|
||||
{
|
||||
|
||||
//var list = _context.InsuranceJobItems.Where(x => x.InsuranceJobId == Id).ToList().Select(x=>new InsuranceJobItemViewModel()
|
||||
@@ -91,21 +93,37 @@ public class InsuranceJobItemRepository : RepositoryBase<long, InsuranceJobItem>
|
||||
|
||||
// list.Add(obj);
|
||||
//}
|
||||
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(x => x.InsuranceJobId == Id).ToList();
|
||||
var searcheDate = ($"{year}/{month}/01").ToGeorgianDateTime();
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(i => i.InsuranceJobId == Id && i.StartDate <= searcheDate && i.EndDate >= searcheDate).ToList();
|
||||
var list = new List<InsuranceJobItemViewModel>();
|
||||
var usedParcentsInDateSalaryItems = _context.DateSalaries
|
||||
.Where(x => x.StartDateGr <= searcheDate && x.EndDateGr >= searcheDate)
|
||||
.Include(x => x.DateSalaryItemList)
|
||||
.SelectMany(x => x.DateSalaryItemList)
|
||||
.ToList();
|
||||
|
||||
foreach (var item in insuranceJobItems)
|
||||
{
|
||||
double lessThan = usedParcentsInDateSalaryItems.Any(x => x.Percent == item.PercentageLessThan && x.Salary > 0)
|
||||
? usedParcentsInDateSalaryItems.FirstOrDefault(x => x.Percent == item.PercentageLessThan).Salary
|
||||
: 0;
|
||||
|
||||
double moreThan = usedParcentsInDateSalaryItems.Any(x => x.Percent == item.PercentageMoreThan && x.Salary > 0)
|
||||
? usedParcentsInDateSalaryItems.FirstOrDefault(x => x.Percent == item.PercentageMoreThan).Salary
|
||||
: 0;
|
||||
var obj = new InsuranceJobItemViewModel();
|
||||
obj.Id = item.id;
|
||||
obj.PercentageLessThan = item.PercentageLessThan;
|
||||
obj.IsPercentageLessThanUse = lessThan > 0 ;
|
||||
obj.PercentageMoreThan = item.PercentageMoreThan;
|
||||
obj.IsPercentageMoreThanUse = moreThan > 0;
|
||||
obj.SalaeyLessThan = item.SalaeyLessThan;
|
||||
obj.SalaryMoreThan = item.SalaryMoreThan;
|
||||
obj.SalaeyLessThanString = item.SalaryMoreThan.ToMoney();
|
||||
obj.SalaryMoreThanString = item.SalaryMoreThan.ToMoney();
|
||||
obj.SalaeyLessThanString = lessThan > 0 ? lessThan.ToMoney() : "0";
|
||||
obj.SalaryMoreThanString = moreThan > 0 ? moreThan.ToMoney() : "0";
|
||||
obj.InsuranceJobId = item.InsuranceJobId;
|
||||
obj.StartDate = item.StartDate;
|
||||
obj.EndDate = item.EndDate;
|
||||
obj.JobIds = _context.InsuranceJobAndJobsSet.Where(p => p.InsuranceJobItemId == item.id)
|
||||
.Select(p => p.JobId).ToList();
|
||||
obj.JobList = _context.Jobs.Where(x => obj.JobIds.Contains(x.id)).ToList().Select(x =>
|
||||
@@ -122,10 +140,11 @@ public class InsuranceJobItemRepository : RepositoryBase<long, InsuranceJobItem>
|
||||
}
|
||||
|
||||
|
||||
public InsuranceJobItemViewModel GetInsuranceJobItemByInsuranceJobIdForFixedSalary(long insuranceJobId, long jobId)
|
||||
public InsuranceJobItemViewModel GetInsuranceJobItemByInsuranceJobIdForFixedSalary(long insuranceJobId, long jobId, string year, string month)
|
||||
{
|
||||
var searcheDate = ($"{year}/{month}/01").ToGeorgianDateTime();
|
||||
var insuranceJobItemViewModel = new InsuranceJobItemViewModel();
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(x => x.InsuranceJobId == insuranceJobId).ToList();
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(i => i.InsuranceJobId == insuranceJobId && i.StartDate <= searcheDate && i.EndDate >= searcheDate).ToList();
|
||||
var insuranceJobItemIds = insuranceJobItems.Select(x => x.id).ToList();
|
||||
var jobAndJob = _context.InsuranceJobAndJobsSet
|
||||
.Where(x => insuranceJobItemIds.Contains(x.InsuranceJobItemId) && x.JobId == jobId).FirstOrDefault();
|
||||
@@ -146,6 +165,17 @@ public class InsuranceJobItemRepository : RepositoryBase<long, InsuranceJobItem>
|
||||
return insuranceJobItemViewModel;
|
||||
}
|
||||
|
||||
public (List<string> workshopList, bool hasAnyWorkshop) GetWorkshopUsedThisInsuranceJob(long insuranceJobId)
|
||||
{
|
||||
var workshops = _context.Workshops.Where(x => x.InsuranceJobId == insuranceJobId);
|
||||
if (!workshops.Any())
|
||||
{
|
||||
return (new List<string>(), false);
|
||||
}
|
||||
|
||||
return (workshops.Select(x => x.WorkshopFullName).ToList(), true);
|
||||
}
|
||||
|
||||
public List<InsuranceJobItemViewModel> Search(InsuranceJobItemSearchModel searchModel)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -3,11 +3,17 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.DateSalaryAgg;
|
||||
using Company.Domain.DateSalaryItemAgg;
|
||||
using Company.Domain.InsuranceJobAndJobsAgg;
|
||||
using Company.Domain.InsuranceJobItemAgg;
|
||||
using Company.Domain.InsurancJobAgg;
|
||||
using Company.Domain.PercentageAgg;
|
||||
using CompanyManagment.App.Contracts.InsuranceJob;
|
||||
using CompanyManagment.App.Contracts.InsuranceJobItem;
|
||||
using CompanyManagment.App.Contracts.Percentage;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -15,16 +21,21 @@ namespace CompanyManagment.EFCore.Repository;
|
||||
public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsuranceJobRepositpry
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
private readonly TestDbContext _testDbContext;
|
||||
private readonly IInsuranceJobItemRepositpry _insuranceJobItemRepositpry;
|
||||
private readonly IPercentageRepository _percentageRepository;
|
||||
public InsuranceJobRepository(CompanyContext context, IInsuranceJobItemRepositpry insuranceJobItemRepositpry , IPercentageRepository percentageRepository) : base(context)
|
||||
private readonly IDateSalaryItemRepository _dateSalaryItemRepository;
|
||||
|
||||
public InsuranceJobRepository(CompanyContext context, IInsuranceJobItemRepositpry insuranceJobItemRepositpry, IPercentageRepository percentageRepository, TestDbContext testDbContext, IDateSalaryItemRepository dateSalaryItemRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_insuranceJobItemRepositpry = insuranceJobItemRepositpry;
|
||||
_percentageRepository = percentageRepository;
|
||||
_testDbContext = testDbContext;
|
||||
_dateSalaryItemRepository = dateSalaryItemRepository;
|
||||
}
|
||||
|
||||
public EditInsuranceJob GetDetails(long id)
|
||||
public EditInsuranceJob GetDetails(long id, string year, string month)
|
||||
{
|
||||
var insuranceJob = new EditInsuranceJob();
|
||||
var details = Get(id);
|
||||
@@ -32,7 +43,13 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
insuranceJob.Year = details.Year;
|
||||
insuranceJob.EconomicCode = details.EconomicCode;
|
||||
insuranceJob.InsuranceJobTitle = details.InsuranceJobTitle;
|
||||
insuranceJob.InsuranceJobItems = _insuranceJobItemRepositpry.GetInsuranceJobItemByInsuranceJobId(id);
|
||||
insuranceJob.InsuranceJobItems = _insuranceJobItemRepositpry.GetInsuranceJobItemByInsuranceJobId(id, year, month);
|
||||
var workshopsUsedThis = _insuranceJobItemRepositpry.GetWorkshopUsedThisInsuranceJob(id);
|
||||
var item = insuranceJob.InsuranceJobItems.FirstOrDefault();
|
||||
insuranceJob.StartDateFa = item != null ? $"{item.StartDate.ToFarsi()}" : "-";
|
||||
insuranceJob.EndDateFa = item != null ? $"{item.EndDate.ToFarsi()}" : "-";
|
||||
insuranceJob.WorkshopList = workshopsUsedThis.workshopList;
|
||||
insuranceJob.HasAnyWorkshop = workshopsUsedThis.hasAnyWorkshop;
|
||||
return insuranceJob;
|
||||
}
|
||||
|
||||
@@ -49,16 +66,33 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
|
||||
public List<InsuranceJobViewModel> Search(InsuranceJobSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InsuranceJobs.Select(x => new InsuranceJobViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
InsuranceJobTitle = x.InsuranceJobTitle,
|
||||
EconomicCode = x.EconomicCode
|
||||
});
|
||||
|
||||
string now = Tools.ToFarsi(DateTime.Now);
|
||||
string year = now.Substring(0, 4);
|
||||
string month = now.Substring(5, 2);
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Year))
|
||||
year = searchModel.Year;
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
month = searchModel.Month;
|
||||
|
||||
|
||||
var searcheDate = ($"{year}/{month}/01").ToGeorgianDateTime();
|
||||
var query = _context.InsuranceJobs
|
||||
.Include(x => x.InsuranceJobItemList).Where(x => x.InsuranceJobItemList.Any(i => i.StartDate <= searcheDate && i.EndDate >= searcheDate))
|
||||
.Select(x => new InsuranceJobViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
InsuranceJobTitle = x.InsuranceJobTitle,
|
||||
EconomicCode = x.EconomicCode,
|
||||
Year = year,
|
||||
Month = month,
|
||||
|
||||
|
||||
});
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EconomicCode))
|
||||
query = query.Where(x => x.EconomicCode.Contains(searchModel.EconomicCode));
|
||||
|
||||
query = query.Where(x => x.EconomicCode.Contains(searchModel.EconomicCode));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.InsuranceJobTitle))
|
||||
query = query.Where(x => x.InsuranceJobTitle.Contains(searchModel.InsuranceJobTitle));
|
||||
|
||||
@@ -67,7 +101,21 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
|
||||
public OperationResult CreateInsuranceJob(CreateInsuranceJob command)
|
||||
{
|
||||
OperationResult result = new OperationResult();
|
||||
OperationResult result = new OperationResult();
|
||||
var insuranceJobItemObj = _insuranceJobItemRepositpry.Get(command.InsuranceJobItemId);
|
||||
if (insuranceJobItemObj == null)
|
||||
return result.Failed("آیتم شغلی انتخاب شده وجود ندارد");
|
||||
|
||||
List<double> percentaegJoin = new List<double>();
|
||||
var percentageLessThan = command.InsuranceJobItems.Select(x => x.PercentageLessThan).ToList();
|
||||
var percentageMoreThan = command.InsuranceJobItems.Select(x => x.PercentageMoreThan).ToList();
|
||||
if (percentageMoreThan != null)
|
||||
{
|
||||
percentaegJoin = percentageLessThan
|
||||
.Concat(percentageMoreThan)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
using (var transaction = _context.Database.BeginTransaction())
|
||||
{
|
||||
try
|
||||
@@ -80,6 +128,8 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
item.PercentageLessThan = item.PercentageLessThan;
|
||||
item.PercentageMoreThan = item.PercentageMoreThan;
|
||||
item.InsuranceJobId = insuranceJobObj.id;
|
||||
item.StartDate = insuranceJobItemObj.StartDate;
|
||||
item.EndDate = insuranceJobItemObj.EndDate;
|
||||
_insuranceJobItemRepositpry.CreateInsuranceJobItem(item);
|
||||
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageLessThan))
|
||||
@@ -93,16 +143,39 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
var percentage2 = new Percentage(item.PercentageMoreThan);
|
||||
_percentageRepository.Create(percentage2);
|
||||
}
|
||||
|
||||
|
||||
_percentageRepository.SaveChanges();
|
||||
}
|
||||
|
||||
var dateSalary = _context.DateSalaries.FirstOrDefault(x =>
|
||||
x.StartDateGr == insuranceJobItemObj.StartDate && x.EndDateGr == insuranceJobItemObj.EndDate);
|
||||
var percentages = _context.Percentages.Select(x => new { x.id, x.Percent }).ToList();
|
||||
var dateSalaryItemList = new List<DateSalaryItem>();
|
||||
foreach (var percent in percentaegJoin)
|
||||
{
|
||||
var percentageId = percentages.FirstOrDefault(x => x.Percent == percent);
|
||||
if (percentageId != null)
|
||||
{
|
||||
|
||||
var dateSalaryItem = new DateSalaryItem(percent, percentageId.id, 0, dateSalary.id);
|
||||
dateSalaryItemList.Add(dateSalaryItem);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (dateSalaryItemList.Count > 0)
|
||||
{
|
||||
_context.DateSalaryItems.AddRange(dateSalaryItemList);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
// SaveChanges();
|
||||
transaction.Commit();
|
||||
result.IsSuccedded = true;
|
||||
result.Message = "ثبت اطلاعات با موفقیت انجام شد";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
transaction.Rollback();
|
||||
result.Failed("ثبت اطلاعات با خطا مواجه شد");
|
||||
}
|
||||
@@ -110,19 +183,240 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
return result;
|
||||
}
|
||||
|
||||
public OperationResult Remove(long id)
|
||||
public List<(long id, string date)> GetOldYersInsuranceItemIds()
|
||||
{
|
||||
var res = _context.InsuranceJobItems.Where(x=>x.StartDate != null && x.EndDate != null)
|
||||
.GroupBy(x => x.StartDate)
|
||||
.Select(g => g.First())
|
||||
.ToList().Select(x => new InsuranceJobItemViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
|
||||
|
||||
}).OrderByDescending(x=>x.StartDate);
|
||||
|
||||
return res.Select(x => (x.Id, $"{(x.StartDate.HasValue ? x.StartDate.Value.ToFarsi() : "نامشخص")} - {(x.EndDate.HasValue ? x.EndDate.Value.ToFarsi() : "نامشخص")}")).ToList();
|
||||
|
||||
}
|
||||
|
||||
public OperationResult CopyFromLastYear(CopyFromLastYearViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.InsuranceJobItemId == 0)
|
||||
return op.Failed("بازه را انتخاب کنید");
|
||||
DateTime startDateGr = new DateTime();
|
||||
DateTime endDateGr = new DateTime();
|
||||
try
|
||||
{
|
||||
startDateGr = command.StartDate.ToGeorgianDateTime();
|
||||
endDateGr = command.EndDate.ToGeorgianDateTime();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("تاریخ به درستی وارد نشده است");
|
||||
|
||||
}
|
||||
|
||||
|
||||
var chekExist = _insuranceJobItemRepositpry.Exists(x => x.StartDate < endDateGr && x.EndDate > startDateGr);
|
||||
if (chekExist)
|
||||
return op.Failed("بازه تاریخ وارد شده با بازه های قبلی تداخل دارد");
|
||||
|
||||
var insuranceJobItemObj = _insuranceJobItemRepositpry.Get(command.InsuranceJobItemId);
|
||||
if (insuranceJobItemObj == null)
|
||||
return op.Failed("آیتم شغلی انتخاب شده وجود ندارد");
|
||||
var insuranceJobItemList = _context.InsuranceJobItems
|
||||
.Include(jobs => jobs.InsuranceJobAndJobs)
|
||||
.Where(x => x.StartDate == insuranceJobItemObj.StartDate).Select(x => new InsuranceJobItemViewModel()
|
||||
{
|
||||
PercentageLessThan = x.PercentageLessThan,
|
||||
PercentageMoreThan = x.PercentageMoreThan,
|
||||
InsuranceJobId = x.InsuranceJobId,
|
||||
StartDate = startDateGr,
|
||||
EndDate = endDateGr,
|
||||
JobIds = x.InsuranceJobAndJobs.Select(j => j.JobId).ToList()
|
||||
}).ToList();
|
||||
|
||||
if (!insuranceJobItemList.Any())
|
||||
return op.Failed("خطا");
|
||||
List<double> percentaegJoin = new List<double>();
|
||||
var percentageLessThan = insuranceJobItemList.Select(x => x.PercentageLessThan).ToList();
|
||||
var percentageMoreThan = insuranceJobItemList.Select(x => x.PercentageMoreThan).ToList();
|
||||
if (percentageMoreThan != null)
|
||||
{
|
||||
percentaegJoin = percentageLessThan
|
||||
.Concat(percentageMoreThan)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
using (var transaction = _context.Database.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
foreach (var item in insuranceJobItemList)
|
||||
{
|
||||
|
||||
_insuranceJobItemRepositpry.CreateInsuranceJobItem(item);
|
||||
|
||||
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageLessThan))
|
||||
{
|
||||
var percentage = new Percentage(item.PercentageLessThan);
|
||||
_percentageRepository.Create(percentage);
|
||||
}
|
||||
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageMoreThan))
|
||||
{
|
||||
var percentage2 = new Percentage(item.PercentageMoreThan);
|
||||
_percentageRepository.Create(percentage2);
|
||||
}
|
||||
|
||||
_percentageRepository.SaveChanges();
|
||||
}
|
||||
|
||||
var dateSalary = new DateSalary(command.StartDate, command.EndDate);
|
||||
_context.DateSalaries.Add(dateSalary);
|
||||
_context.SaveChanges();
|
||||
var percentages = _context.Percentages.Select(x=> new{x.id, x.Percent}).ToList();
|
||||
var dateSalaryItemList = new List<DateSalaryItem>();
|
||||
foreach (var percent in percentaegJoin)
|
||||
{
|
||||
var percentageId = percentages.FirstOrDefault(x => x.Percent == percent);
|
||||
if (percentageId != null)
|
||||
{
|
||||
|
||||
var dateSalaryItem = new DateSalaryItem(percent, percentageId.id, 0, dateSalary.id);
|
||||
dateSalaryItemList.Add(dateSalaryItem);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (dateSalaryItemList.Count > 0)
|
||||
{
|
||||
_context.DateSalaryItems.AddRange(dateSalaryItemList);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// SaveChanges();
|
||||
transaction.Commit();
|
||||
op.IsSuccedded = true;
|
||||
op.Message = "ثبت اطلاعات با موفقیت انجام شد";
|
||||
return op;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return op.Failed("ثبت اطلاعات با خطا مواجه شد");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public OperationResult RecoveryOldData1403()
|
||||
{
|
||||
|
||||
OperationResult result = new OperationResult();
|
||||
using (var transaction = _context.Database.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(x=>x.InsuranceJobId==id).ToList();
|
||||
var res = _testDbContext.InsuranceJobItems.Include(x => x.InsuranceJobAndJobs).ToList();
|
||||
foreach (var item in res)
|
||||
{
|
||||
var createItem = new InsuranceJobItem(item.PercentageLessThan, 0, item.PercentageMoreThan, 0,
|
||||
item.InsuranceJobId, item.StartDate, item.EndDate);
|
||||
_context.InsuranceJobItems.Add(createItem);
|
||||
_context.SaveChanges();
|
||||
Console.WriteLine(createItem.InsuranceJobId + " " + createItem.PercentageLessThan);
|
||||
List<InsuranceJobAndJobs> insuranceJobAndJobsList = new List<InsuranceJobAndJobs>();
|
||||
foreach (var jobItem in item.InsuranceJobAndJobs)
|
||||
{
|
||||
var insuranceJobAndJobsObj = new InsuranceJobAndJobs();
|
||||
insuranceJobAndJobsObj.JobId = jobItem.JobId;
|
||||
insuranceJobAndJobsObj.InsuranceJobItemId = createItem.id;
|
||||
insuranceJobAndJobsList.Add(insuranceJobAndJobsObj);
|
||||
}
|
||||
_context.InsuranceJobAndJobsSet.AddRange(insuranceJobAndJobsList);
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageLessThan))
|
||||
{
|
||||
var percentage = new Percentage(item.PercentageLessThan);
|
||||
_percentageRepository.Create(percentage);
|
||||
}
|
||||
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageMoreThan))
|
||||
{
|
||||
var percentage2 = new Percentage(item.PercentageMoreThan);
|
||||
_percentageRepository.Create(percentage2);
|
||||
}
|
||||
|
||||
_percentageRepository.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
result.IsSuccedded = true;
|
||||
result.Message = "حذف اطلاعات با موفقیت انجام شد";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
transaction.Rollback();
|
||||
result.Failed("ثبت اطلاعات با خطا مواجه شد");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
public OperationResult Remove(long id)
|
||||
{
|
||||
OperationResult result = new OperationResult();
|
||||
var insuranceJobItems = _context.InsuranceJobItems.Where(x => x.InsuranceJobId == id).ToList();
|
||||
var start = insuranceJobItems.FirstOrDefault()!.StartDate;
|
||||
var end = insuranceJobItems.FirstOrDefault()!.StartDate;
|
||||
var usedParcentsInDateSalaryItems = _context.DateSalaries
|
||||
.Where(x => x.StartDateGr == start && x.EndDateGr >= end)
|
||||
.Include(x => x.DateSalaryItemList)
|
||||
.SelectMany(x => x.DateSalaryItemList)
|
||||
.ToList();
|
||||
var itemsLessThan = insuranceJobItems.Select(x => x.PercentageLessThan).ToList();
|
||||
var itemsMoreThan = insuranceJobItems.Select(x => x.PercentageMoreThan).ToList();
|
||||
bool lessThan = usedParcentsInDateSalaryItems.Any(x => itemsLessThan.Contains(x.Percent) && x.Salary > 0);
|
||||
bool moreThan = usedParcentsInDateSalaryItems.Any(x => itemsMoreThan.Contains(x.Percent) && x.Salary > 0);
|
||||
if (lessThan || moreThan)
|
||||
return result.Failed("درصد های این صنف دارای مبلغ می باشند");
|
||||
|
||||
var percentaegJoin = itemsLessThan
|
||||
.Concat(itemsMoreThan)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
using (var transaction = _context.Database.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_context.InsuranceJobItems.RemoveRange(insuranceJobItems);
|
||||
|
||||
var insuranceJobObj = Get(id);
|
||||
_context.InsuranceJobs.Remove(insuranceJobObj);
|
||||
|
||||
|
||||
|
||||
var toBeRemove = usedParcentsInDateSalaryItems.Where(x => percentaegJoin.Contains(x.Percent)).Select(x=>x.id);
|
||||
var dateSalaryItemToBeRemovde = _context.DateSalaryItems.Where(x => toBeRemove.Contains(x.id));
|
||||
_context.DateSalaryItems.RemoveRange(dateSalaryItemToBeRemovde);
|
||||
|
||||
_context.SaveChanges();
|
||||
transaction.Commit();
|
||||
result.IsSuccedded = true;
|
||||
@@ -147,33 +441,54 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
{
|
||||
var insuranceJob = Get(command.Id);
|
||||
insuranceJob.Edit(command.InsuranceJobTitle, command.YearlySalaryId, command.EconomicCode, command.Year);
|
||||
|
||||
var insuranceJobItemsIds = _context.InsuranceJobItems.Where(x => x.InsuranceJobId == command.Id).Select(x=>x.id).ToList();
|
||||
//List<long> deleteIds = new List<long>();
|
||||
var searcheDate = ($"{command.Year}/{command.Month}/01").ToGeorgianDateTime();
|
||||
var insuranceJobItems = _context.InsuranceJobItems
|
||||
.Include(x=>x.InsuranceJobAndJobs)
|
||||
.Where(i => i.InsuranceJobId == command.Id && i.StartDate <= searcheDate && i.EndDate >= searcheDate);
|
||||
|
||||
DateTime? startDate = insuranceJobItems.Select(x => x.StartDate).FirstOrDefault();
|
||||
DateTime? endDate = insuranceJobItems.Select(x => x.EndDate).FirstOrDefault();
|
||||
var insuranceJobItemsIds = insuranceJobItems.Select(x => x.id).ToList();
|
||||
|
||||
var usedParcentsInDateSalaryItems = _context.DateSalaries
|
||||
.Where(x => x.StartDateGr <= searcheDate && x.EndDateGr >= searcheDate)
|
||||
.Include(x => x.DateSalaryItemList)
|
||||
.SelectMany(x => x.DateSalaryItemList)
|
||||
.ToList();
|
||||
//var editedJobItems = command.InsuranceJobItems.Where(x => x.Id != 0).ToList();
|
||||
//var newAdedJobItems = command.InsuranceJobItems.Where(x => x.Id == 0).ToList();
|
||||
|
||||
//foreach (var item in insuranceJobItems)
|
||||
//{
|
||||
|
||||
//}
|
||||
foreach (var item in command.InsuranceJobItems)
|
||||
{
|
||||
long deleteId = insuranceJobItemsIds.Where(x => x==item.Id).FirstOrDefault();
|
||||
if (deleteId !=0)
|
||||
{ insuranceJobItemsIds.Remove(deleteId);}
|
||||
long deleteId = insuranceJobItemsIds.Where(x => x == item.Id).FirstOrDefault();
|
||||
if (deleteId != 0)
|
||||
{
|
||||
insuranceJobItemsIds.Remove(deleteId);
|
||||
}
|
||||
|
||||
if (item.Id == 0)
|
||||
{
|
||||
item.PercentageLessThan = item.PercentageLessThan;
|
||||
item.PercentageMoreThan = item.PercentageMoreThan;
|
||||
item.InsuranceJobId = command.Id;
|
||||
item.StartDate = startDate;
|
||||
item.EndDate = endDate;
|
||||
_insuranceJobItemRepositpry.CreateInsuranceJobItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
var insuranceJobItem = _insuranceJobItemRepositpry.Get(item.Id);
|
||||
insuranceJobItem.Edit(item.PercentageLessThan, item.SalaeyLessThan, item.PercentageMoreThan, item.SalaryMoreThan, command.Id);
|
||||
insuranceJobItem.Edit(item.PercentageLessThan, item.SalaeyLessThan, item.PercentageMoreThan, item.SalaryMoreThan, command.Id, startDate, endDate);
|
||||
|
||||
#region JobAndJob
|
||||
|
||||
var jobAndJobList = _context.InsuranceJobAndJobsSet .Where(x => x.InsuranceJobItemId == item.Id).ToList();
|
||||
var jobAndJobList = _context.InsuranceJobAndJobsSet.Where(x => x.InsuranceJobItemId == item.Id).ToList();
|
||||
_context.InsuranceJobAndJobsSet.RemoveRange(jobAndJobList);
|
||||
List <InsuranceJobAndJobs> insuranceJobAndJobsList = new List<InsuranceJobAndJobs>();
|
||||
List<InsuranceJobAndJobs> insuranceJobAndJobsList = new List<InsuranceJobAndJobs>();
|
||||
foreach (var item2 in item.JobIds)
|
||||
{
|
||||
var insuranceJobAndJobsObj = new InsuranceJobAndJobs();
|
||||
@@ -186,25 +501,59 @@ public class InsuranceJobRepository : RepositoryBase<long, InsuranceJob>, IInsur
|
||||
}
|
||||
|
||||
#region Percentage
|
||||
var percentage = new Percentage(item.PercentageLessThan);
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageLessThan))
|
||||
{
|
||||
var percentage = new Percentage(item.PercentageLessThan);
|
||||
|
||||
_percentageRepository.Create(percentage);
|
||||
}
|
||||
var percentage2 = new Percentage(item.PercentageMoreThan);
|
||||
if (!_percentageRepository.Exists(x => x.Percent == item.PercentageMoreThan))
|
||||
{
|
||||
var percentage2 = new Percentage(item.PercentageMoreThan);
|
||||
|
||||
_percentageRepository.Create(percentage2);
|
||||
}
|
||||
_percentageRepository.SaveChanges();
|
||||
_percentageRepository.SaveChanges();
|
||||
#endregion
|
||||
|
||||
|
||||
#region DateSalaryItems
|
||||
|
||||
var checkExitLeesThan = usedParcentsInDateSalaryItems.Any(x => x.Percent == item.PercentageLessThan);
|
||||
if (!checkExitLeesThan && usedParcentsInDateSalaryItems.Any())
|
||||
{
|
||||
|
||||
if(percentage.id == 0)
|
||||
percentage.id = _percentageRepository.Search(new PercentageSearchModel(){Percent = item.PercentageLessThan }).FirstOrDefault()!.Id;
|
||||
|
||||
var dateSalaryId =usedParcentsInDateSalaryItems.FirstOrDefault()!.DateSalaryId;
|
||||
var dateSalaryItem = new DateSalaryItem(item.PercentageLessThan, percentage.id, 0, dateSalaryId);
|
||||
_dateSalaryItemRepository.Create(dateSalaryItem);
|
||||
|
||||
}
|
||||
|
||||
var checkExitMoreThan = usedParcentsInDateSalaryItems.Any(x => x.Percent == item.PercentageMoreThan);
|
||||
if (!checkExitMoreThan && usedParcentsInDateSalaryItems.Any())
|
||||
{
|
||||
if (percentage2.id == 0)
|
||||
percentage2.id = _percentageRepository.Search(new PercentageSearchModel() { Percent = item.PercentageMoreThan }).FirstOrDefault()!.Id;
|
||||
|
||||
var dateSalaryId = usedParcentsInDateSalaryItems.FirstOrDefault()!.DateSalaryId;
|
||||
var dateSalaryItem = new DateSalaryItem(item.PercentageMoreThan, percentage2.id, 0, dateSalaryId);
|
||||
_dateSalaryItemRepository.Create(dateSalaryItem);
|
||||
|
||||
}
|
||||
|
||||
_dateSalaryItemRepository.SaveChanges();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
#region removeJobItems
|
||||
var deleteList = _context.InsuranceJobItems.Where(x => insuranceJobItemsIds.Contains(x.id)).ToList();
|
||||
_context.InsuranceJobItems.RemoveRange(deleteList);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
transaction.Commit();
|
||||
|
||||
@@ -410,8 +410,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
|
||||
// (startLeav >= x.ContractStart && endLeav <= x.ContractEnd) ||
|
||||
// (startLeav < x.ContractStart && endLeav <= x.ContractEnd && endLeav >= x.ContractStart) ||
|
||||
// (startLeav < x.ContractStart && endLeav > x.ContractEnd)).ToList();
|
||||
var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
|
||||
.Where(x => startLeav <= x.ContractEnd).ToList();
|
||||
var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId && startLeav <= x.ContractEnd).ToList();
|
||||
if (checkoutExist.Count > 0)
|
||||
{
|
||||
res.HasChekout = true;
|
||||
|
||||
@@ -173,7 +173,7 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
}
|
||||
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -649,6 +649,38 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
return leftWork;
|
||||
}
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
var vipGroup = _context.CustomizeWorkshopEmployeeSettings.Where(x => x.CustomizeWorkshopGroupSettingId == 117)
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
var query = _context.LeftWorkList.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
LeftWorkDate = x.LeftWorkDate.ToFarsi(),
|
||||
StartWorkDate = x.StartWorkDate.ToFarsi(),
|
||||
LeftWorkDateGr = x.LeftWorkDate,
|
||||
StartWorkDateGr = x.StartWorkDate,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
AddBonusesPay = x.AddBonusesPay,
|
||||
AddYearsPay = x.AddYearsPay,
|
||||
AddLeavePay = x.AddLeavePay,
|
||||
JobId = x.JobId,
|
||||
JobName = _context.Jobs.FirstOrDefault(j => j.id == x.JobId).JobName
|
||||
|
||||
|
||||
}).Where(x=> !vipGroup.Contains(x.EmployeeId));
|
||||
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId == 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId == 0)
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
return query.OrderByDescending(x => x.StartWorkDateGr).ToList();
|
||||
}
|
||||
|
||||
private bool HasActiveRollCallStatus(long workshopId, long employeeId)
|
||||
{
|
||||
var now = DateTime.Today;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -151,6 +151,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
//حضور غیاب در پرینت فیش حقوقی رسمی
|
||||
public List<CheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(long employeeId, long workshopId, DateTime startMonthDay, DateTime endMonthDay)
|
||||
{
|
||||
var firstDayOfMonth = $"{startMonthDay.ToFarsi().Substring(0,8)}01".ToGeorgianDateTime();
|
||||
|
||||
//گرفتن ساعت استراحت پرسنل از تنظیمات
|
||||
#region breakTime
|
||||
@@ -169,8 +170,8 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.EndLeave.Date >= startMonthDay.Date &&
|
||||
x.StartLeave.Date <= endMonthDay.Date).ToList();
|
||||
|
||||
var year = Convert.ToInt32(startMonthDay.ToFarsi().Substring(0, 4));
|
||||
var month = Convert.ToInt32(startMonthDay.ToFarsi().Substring(5, 2));
|
||||
var year = Convert.ToInt32(firstDayOfMonth.ToFarsi().Substring(0, 4));
|
||||
var month = Convert.ToInt32(firstDayOfMonth.ToFarsi().Substring(5, 2));
|
||||
var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar());
|
||||
|
||||
|
||||
@@ -193,7 +194,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
HolidayYear = startMonthDay.ToFarsiYear()
|
||||
});
|
||||
//all the dates from start to end, to be compared with present days to get absent dates
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date).ToList();
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => firstDayOfCurrentMonth.AddDays(offset).Date).ToList();
|
||||
|
||||
var absentRecords = completeDaysList
|
||||
.ExceptBy(rollCalls.Select(x => x.ShiftDate.Date), y => y.Date)
|
||||
|
||||
44
CompanyManagment.EFCore/TestDbContext.cs
Normal file
44
CompanyManagment.EFCore/TestDbContext.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Company.Domain.InsuranceJobItemAgg;
|
||||
using Company.Domain.InsurancJobAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using CompanyManagment.EFCore.Mapping;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
|
||||
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
|
||||
namespace CompanyManagment.EFCore
|
||||
{
|
||||
public class TestDbContext : DbContext
|
||||
{
|
||||
public DbSet<InsuranceJobItem> InsuranceJobItems { get; set; }
|
||||
public DbSet<InsuranceJob> InsuranceJobs { get; set; }
|
||||
public DbSet<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettings { get; set; }
|
||||
public DbSet<CustomizeWorkshopSettings> CustomizeWorkshopSettings { get; set; }
|
||||
|
||||
public TestDbContext(DbContextOptions<TestDbContext> options) : base(options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public TestDbContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
var assembly = typeof(PersonalContractingpartyMapping).Assembly;
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
21
PersonalContractingParty.Config/TestDbBootStrapper.cs
Normal file
21
PersonalContractingParty.Config/TestDbBootStrapper.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Company.Domain.InsuranceJobItemAgg;
|
||||
using Company.Domain.InsurancJobAgg;
|
||||
using CompanyManagment.App.Contracts.InsuranceJob;
|
||||
using CompanyManagment.Application;
|
||||
using CompanyManagment.EFCore;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
|
||||
public class TestDbBootStrapper
|
||||
{
|
||||
public static void Configure(IServiceCollection services, string connectionString)
|
||||
{
|
||||
services.AddTransient<IInsuranceJobApplication, InsuranceJobApplication>();
|
||||
services.AddTransient<IInsuranceJobRepositpry, InsuranceJobRepository>();
|
||||
services.AddTransient<IInsuranceJobItemRepositpry, InsuranceJobItemRepository>();
|
||||
services.AddDbContext<TestDbContext>(x => x.UseSqlServer(connectionString));
|
||||
}
|
||||
}
|
||||
@@ -381,8 +381,7 @@
|
||||
method="get"
|
||||
data-ajax="true"
|
||||
data-ajax-method="get"
|
||||
data-ajax-update="#mainPanel"
|
||||
data-ajax-mode="replace"
|
||||
data-ajax-update="#mainPanel"data-ajax-mode="replace"
|
||||
data-ajax-url="@Url.Page("./CheckoutPrintAll", "PrintAll")">
|
||||
@for (var j = 0; j < btn.CheckoutIdList.Count; j++)
|
||||
{
|
||||
|
||||
@@ -412,7 +412,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373;color: #fff;">غیبت</span>
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373 !important;color: #fff !important;-webkit-print-color-adjust: exact; print-color-adjust: exact;">غیبت</span>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
@@ -434,7 +434,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 41px; display: block; border-radius: 50px; background-color: #fff; color: #737373;border: 1px solid #737373;">
|
||||
<span style="width: 41px; display: block; border-radius: 50px; background-color: #fff; color: #737373;border: 1px solid #737373;-webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
@Model.MonthlyRollCall[i].LeaveType
|
||||
</span>
|
||||
</div>
|
||||
@@ -499,7 +499,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373;color: #fff;">غیبت</span>
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373 !important;color: #fff !important;-webkit-print-color-adjust: exact; print-color-adjust: exact;">غیبت</span>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
@@ -521,7 +521,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 41px; display: block; border-radius: 50px; background-color: #fff; color: #737373;border: 1px solid #737373;">
|
||||
<span style="width: 41px; display: block; border-radius: 50px; background-color: #fff; color: #737373;border: 1px solid #737373;-webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
@day.LeaveType
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373;color: #fff;">غیبت</span>
|
||||
<span style="width: 40px;display: block;border-radius: 50px;background-color: #737373 !important;color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;">غیبت</span>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
@@ -481,7 +481,7 @@
|
||||
{
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<span style="width: 38px;display: block;border-radius: 50px;background-color: #737373;color: #fff;">غیبت</span>
|
||||
<span style="width: 38px;display: block;border-radius: 50px;background-color: #737373 !important;color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;">غیبت</span>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" style="font-size: 8px; text-align: center; border-width: 2px 0 2px 2px; border-color: #DDDCDC; border-style: solid; -webkit-print-color-adjust: exact; print-color-adjust: exact;">
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
@model CompanyManagment.App.Contracts.InsuranceJob.CopyFromLastYearViewModel
|
||||
@{
|
||||
<style>
|
||||
.input {
|
||||
border: 1px solid #0000004a;
|
||||
border-radius: 7px;
|
||||
padding: 7px;
|
||||
width: 100%;
|
||||
background: whitesmoke;
|
||||
}
|
||||
|
||||
.input:focus {
|
||||
box-shadow: 0 2px 5px 0 rgb(136 137 141), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<div class="modal-header" id="createContractingParty">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<form asp-page="./Index" asp-page-handler="CopyFromLastYear" autocomplete="off"
|
||||
method="post"
|
||||
data-ajax="true"
|
||||
data-callback=""
|
||||
data-action="Refresh"
|
||||
enctype="multipart/form-data">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<fieldset style="border: 1px solid #999797; border-radius: 10px; padding: revert;padding-bottom: 30px">
|
||||
<legend style="margin-bottom: 5px; font-size: large; border-bottom: 0px; color: #505458; width: 394px; text-align: center;"> ساخت لیست اصناف با استفاده از داده های قبلی</legend>
|
||||
|
||||
<div class="flexible-wrap">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xs-12">
|
||||
<div class="form-group">
|
||||
|
||||
<select class="form-control select-city" asp-for="InsuranceJobItemId" asp-items='@Model.InsuranceJobItemViewModels'>
|
||||
<option value="0">انتخاب بازه زمانی</option>
|
||||
</select>
|
||||
<span asp-validation-for="InsuranceJobItemId" class="error"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 inputs">
|
||||
<input type="text" style="text-align: center" id="fromDate" placeholder="تاریخ شروع" asp-for="StartDate" class="input upper-in date">
|
||||
</div>
|
||||
<div class="col-md-6 inputs">
|
||||
<input type="text" style="text-align: center" id="toDate" placeholder="تاریخ پایان" asp-for="EndDate" class="input upper-in date" style="direction: rtl;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
@*<input type="hidden" asp-for="id" value="id"/>*@
|
||||
|
||||
<div class="modal-footer">
|
||||
@*<button type="button" class="btn btn-default waves-effect" data-dismiss="modal">بستن</button>*@
|
||||
<button type="submit" class="btn btn-success btn-rounded waves-effect waves-light" id="save"> ذخیره </button>
|
||||
<button type="button" class="btn btn-default btn-rounded waves-effect waves-light m-b-5" data-dismiss="modal">بستن </button>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".select-city").select2({
|
||||
language: "fa",
|
||||
dir: "rtl"
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$(".date").mask("0000/00/00");
|
||||
});
|
||||
|
||||
|
||||
$(".date").keyup(function() {
|
||||
const value = $(this).val();
|
||||
const lengthValue = value.length;
|
||||
|
||||
if (lengthValue == 10) {
|
||||
if (!dateValidCheck(this)) {
|
||||
$(this).addClass("errored");
|
||||
} else {
|
||||
$(this).removeClass("errored");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -25,12 +25,31 @@
|
||||
<label>عنوان صنف و درجه</label>
|
||||
<input type="text" placeholder="" class="input" id="insuranceJobTitle" asp-for="InsuranceJobTitle" tabindex="1">
|
||||
</div>
|
||||
<div class="col-md-12 inputs" style="display: flex;">
|
||||
<label> کد اقتصادی </label>
|
||||
<input type="text" placeholder="" class="input" style="direction: rtl;" id="economicCode" asp-for="EconomicCode" tabindex="2">
|
||||
</div>
|
||||
<div class="col-md-12 inputs" style="display: flex;">
|
||||
<label> کد اقتصادی </label>
|
||||
<input type="text" placeholder="" class="input" style="direction: rtl;" id="economicCode" asp-for="EconomicCode" tabindex="2">
|
||||
</div>
|
||||
|
||||
@* <div class="col-md-6 inputs">
|
||||
<input type="text" style="text-align: center" id="fromDate" placeholder="تاریخ شروع" asp-for="StartDateFa" class="input upper-in date">
|
||||
</div>
|
||||
<div class="col-md-6 inputs">
|
||||
<input type="text" style="text-align: center" id="toDate" placeholder="تاریخ پایان" asp-for="EndDateFa" class="input upper-in date" style="direction: rtl;">
|
||||
</div> *@
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xs-12">
|
||||
<div class="form-group">
|
||||
|
||||
<div class="col-md-12 inputs" id="table-container">
|
||||
<select class="form-control select-city" id="insuranceJobItemIdselected" asp-for="InsuranceJobItemId" asp-items='@Model.InsuranceJobItemViewModels'>
|
||||
<option value="0">انتخاب بازه زمانی</option>
|
||||
</select>
|
||||
<span asp-validation-for="InsuranceJobItemId" class="error"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 inputs" id="table-container">
|
||||
<table id="worksTable" class="table table-bordered table-striped">
|
||||
<thead style="background-color: #a9fcff">
|
||||
<tr>
|
||||
@@ -97,7 +116,8 @@
|
||||
<script src="~/lib/select2/js/select2.js"></script>
|
||||
<script src="~/lib/select2/js/i18n/fa.js"></script>
|
||||
<link href="~/AdminTheme/assets/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="~/lib/select2/css/select2.css" rel="stylesheet"/>
|
||||
<link href="~/lib/select2/css/select2.css" rel="stylesheet"/>
|
||||
<script src="~/AdminTheme/js/numeral.min.js"></script>
|
||||
//<script src="~/AdminTheme/js/numeral.min.js"></script>
|
||||
}
|
||||
<script>
|
||||
@@ -155,14 +175,43 @@
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$(".date").mask("0000/00/00");
|
||||
});
|
||||
|
||||
|
||||
$(".date").keyup(function() {
|
||||
const value = $(this).val();
|
||||
const lengthValue = value.length;
|
||||
|
||||
if (lengthValue == 10) {
|
||||
if (!dateValidCheck(this)) {
|
||||
$(this).addClass("errored");
|
||||
} else {
|
||||
$(this).removeClass("errored");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sendData() {
|
||||
if (!$('#save').is('[disabled=disabled]')) {
|
||||
const fromDate = $("#fromDate").val();
|
||||
const toDate = $("#toDate").val();
|
||||
console.log(fromDate);
|
||||
console.log(toDate);
|
||||
|
||||
|
||||
var allInputsFilled = true;
|
||||
$('.ratioLess, .ratioMore , #EconomicCode , #InsuranceJobTitle').each(function() {
|
||||
if ($(this).val() === '' || $(this).val() === 0) {
|
||||
allInputsFilled = false;
|
||||
$(this).addClass('errored');
|
||||
|
||||
} else {
|
||||
$(this).removeClass('errored');
|
||||
}
|
||||
@@ -177,13 +226,19 @@
|
||||
$(this).removeClass('errored');
|
||||
}
|
||||
});
|
||||
|
||||
if (!allInputsFilled) {
|
||||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', "لطفا تمام فیلد ها را تکمیل کنید");
|
||||
} else {
|
||||
$.Notification.autoHideNotify('error', 'top right', 'پیام سیستم ', "لطفا خطاها را برطرف کنید");
|
||||
|
||||
}
|
||||
else {
|
||||
var itemId = Number($("#insuranceJobItemIdselected").val());
|
||||
$('#divData').html('');
|
||||
$("#save").prop("disabled", true);
|
||||
$('#divData').append(`<input type="hidden" name="EconomicCode" id="EconomicCode" value="${$("#economicCode").val()}" />`);
|
||||
$('#divData').append(`<input type="hidden" name="InsuranceJobTitle" id="InsuranceJobTitle" value="${$("#insuranceJobTitle").val()}" />`);
|
||||
$('#divData').append(`<input type="hidden" name="insuranceJobItemId" id="insuranceJobItemId" value="${itemId}" />`);
|
||||
|
||||
|
||||
$("#worksTable tbody").find('tr').each(function(i) {
|
||||
const ratioLess = $(this).find("input.ratioLess").val();
|
||||
@@ -208,14 +263,122 @@
|
||||
|
||||
|
||||
});
|
||||
// $('#send').click();
|
||||
$('#createForm').submit();
|
||||
if (allInputsFilled) {
|
||||
$('#createForm').submit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function checkLength(value, maxLength) {
|
||||
var lengthValue = value.length;
|
||||
if (maxLength == lengthValue)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
function dateValidCheckByValue(value) {
|
||||
let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g],
|
||||
arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g],
|
||||
fixNumbers = function (str) {
|
||||
if (typeof str === 'string') {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
||||
let getdate = value;
|
||||
|
||||
//console.log(getdate);
|
||||
//console.log(getdate.length);
|
||||
|
||||
let m1, m2;
|
||||
let y1, y2, y3, y4;
|
||||
let d1, d2;
|
||||
let s1, s2;
|
||||
for (var i = 0; i < getdate.length; i++) {
|
||||
if (i === 0) {
|
||||
y1 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 1) {
|
||||
y2 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 2) {
|
||||
y3 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 3) {
|
||||
y4 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 4) {
|
||||
s1 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 5) {
|
||||
m1 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 6) {
|
||||
m2 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 7) {
|
||||
s2 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 8) {
|
||||
d1 = fixNumbers(getdate[i]);
|
||||
}
|
||||
if (i === 9) {
|
||||
d2 = fixNumbers(getdate[i]);
|
||||
}
|
||||
|
||||
}
|
||||
let yRes = y1 + y2 + y3 + y4;
|
||||
let year = parseInt(yRes);
|
||||
let mRes = m1 + m2;
|
||||
let month = parseInt(mRes);
|
||||
let dRes = d1 + d2;
|
||||
let day = parseInt(dRes);
|
||||
let fixResult = yRes + s1 + mRes + s2 + dRes;
|
||||
let test1 = checkEnValid(value);
|
||||
|
||||
let isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult);
|
||||
|
||||
|
||||
if (isValid && test1) {
|
||||
//element.style.backgroundColor = '#a6e9a6';
|
||||
start1valid = true;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (value != "") {
|
||||
//element.style.backgroundColor = '#f94c4c';
|
||||
//$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید");
|
||||
start1valid = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return start1valid;
|
||||
|
||||
}
|
||||
function getNumberValue(value) {
|
||||
|
||||
var result = '';
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
var x = value.charAt(i);
|
||||
if (x != '٬' && x != ',')
|
||||
result = result + x;
|
||||
}
|
||||
return Number(result);
|
||||
}
|
||||
|
||||
|
||||
$('#createForm').submit(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,11 +5,26 @@
|
||||
<link href="@Href("~/admintheme/css/index.css")" rel="stylesheet"/>
|
||||
<div id="index" class="row">
|
||||
<div class="col-sm-12 m-r-10">
|
||||
<p class="pull-right">
|
||||
<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index", "Create")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus"></i> مشاغل مقطوع </a>
|
||||
@*<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index","CreateInformation")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus" ></i> ثبت اطلاعات مقطوع </a>*@
|
||||
</p>
|
||||
</div>
|
||||
<p class="pull-right">
|
||||
<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index", "Create")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus"></i> ایجاد صنف جدید </a>
|
||||
@*<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index","CreateInformation")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus" ></i> ثبت اطلاعات مقطوع </a>*@
|
||||
</p>
|
||||
|
||||
<p class="pull-right">
|
||||
|
||||
<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index", "CopyFromLastYear")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus"></i> کپی از اصناف سال قبل </a>
|
||||
@*<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index","CreateInformation")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus" ></i> ثبت اطلاعات مقطوع </a>*@
|
||||
</p>
|
||||
|
||||
@* <p class="pull-right">
|
||||
|
||||
<a asp-page="/Company/InsuranceJob/Index" asp-page-handler="OldDataRecovery1403" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus"></i> ریکاوری دیتای سال 1403 </a>
|
||||
|
||||
</p> *@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="panel-group panel-group-joined" id="accordion-test">
|
||||
<div class="panel panel-default">
|
||||
@@ -96,9 +111,11 @@
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5px;">#</th>
|
||||
<th style="width: 5px;">#</th>
|
||||
<th style="width: 20px;"> سال</th>
|
||||
<th style="width: 300px;">عنوان صنف و درجه </th>
|
||||
<th style="width: 200px;"> کد اقتصادی </th>
|
||||
<th style="width: 180px;"> کد اقتصادی </th>
|
||||
|
||||
<th style="width: 300px;">عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -109,19 +126,26 @@
|
||||
@foreach (var item in Model.InsuranceJobList)
|
||||
{
|
||||
<tr>
|
||||
<td style="width: 5px;"> @index</td>
|
||||
<td style="width: 5px;"> @index</td>
|
||||
<td style="width: 20px;">
|
||||
|
||||
|
||||
<span> @item.Year</span>
|
||||
|
||||
</td>
|
||||
<td style="width: 300px;">
|
||||
<div class="tooltipfull-container">
|
||||
<p class="text-ellipsis-name">@item.InsuranceJobTitle</p>
|
||||
<span class="tooltipfull"> @item.InsuranceJobTitle</span>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 200px;">
|
||||
<div class="tooltipfull-container">
|
||||
<p class="text-ellipsis-code">@item.EconomicCode</p>
|
||||
<span class="tooltipfull"> @item.EconomicCode</span>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 180px;">
|
||||
<div class="tooltipfull-container">
|
||||
<p class="text-ellipsis-code">@item.EconomicCode</p>
|
||||
<span class="tooltipfull"> @item.EconomicCode</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td style="width: 300px;">
|
||||
<a class="btn btn-danger ionRad pull-left op-btn rad" onclick="removeInsuranceJob(@item.Id)">
|
||||
<i class="fa fa-trash faSize"></i>
|
||||
@@ -131,7 +155,7 @@
|
||||
<i class="fa fa-file-text ionSize"></i>
|
||||
</a>
|
||||
<a class="btn btn-warning pull-left op-btn rad"
|
||||
href="#showmodal=@Url.Page("./Index", "Edit", new { item.Id })">
|
||||
href="#showmodal=@Url.Page("./Index", "Edit", new { item.Id, item.Year, item.Month })">
|
||||
<i class="fa fa-edit faSize"></i>
|
||||
</a>
|
||||
</td>
|
||||
@@ -175,8 +199,13 @@
|
||||
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||||
data: { "id": id },
|
||||
success: function(response) {
|
||||
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
|
||||
$('.btn-success').click();
|
||||
if(response.isSuccedded){
|
||||
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
|
||||
window.location.reload();
|
||||
}else{
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
|
||||
}
|
||||
|
||||
},
|
||||
failure: function(response) {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
|
||||
|
||||
@@ -6,6 +6,7 @@ using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using MD.PersianDateTime.Standard;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Pages.Company.InsuranceJob;
|
||||
|
||||
@@ -36,7 +37,11 @@ public class IndexModel : PageModel
|
||||
|
||||
public void OnGet(InsuranceJobSearchModel searchModel)
|
||||
{
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
if(!string.IsNullOrWhiteSpace(searchModel.Year))
|
||||
Console.WriteLine(searchModel.Year);
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
Console.WriteLine(searchModel.Month);
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
|
||||
var insuranceJobs = _insuranceJobApplication.Search(searchModel);
|
||||
InsuranceJobList = insuranceJobs;
|
||||
@@ -44,10 +49,14 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetCreate()
|
||||
{
|
||||
var model = new CreateInsuranceJob
|
||||
var dats = _insuranceJobApplication.GetOldYersInsuranceItemIds()
|
||||
.Select(x => new { Id = x.id, Date = x.date })
|
||||
.ToList();
|
||||
var model = new CreateInsuranceJob
|
||||
{
|
||||
// Jobs = _jobApplication.GetJob()
|
||||
};
|
||||
model.InsuranceJobItemViewModels = new SelectList(dats, "Id", "Date");
|
||||
return Partial("./Create", model);
|
||||
}
|
||||
|
||||
@@ -57,17 +66,43 @@ public class IndexModel : PageModel
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
//public async Task<IActionResult> OnPostJobListByText(string textSearch)
|
||||
//{
|
||||
// var jobs = _jobApplication.GetJobListByText(textSearch);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// IsSuccedded = true,
|
||||
// mylist = jobs,
|
||||
// });
|
||||
//}
|
||||
public IActionResult OnGetCopyFromLastYear()
|
||||
{
|
||||
var dats = _insuranceJobApplication.GetOldYersInsuranceItemIds()
|
||||
.Select(x => new { Id = x.id, Date = x.date })
|
||||
.ToList();
|
||||
var model = new CopyFromLastYearViewModel()
|
||||
{
|
||||
InsuranceJobItemId = 0,
|
||||
StartDate = "",
|
||||
EndDate = "",
|
||||
InsuranceJobItemViewModels = new SelectList(dats,"Id", "Date"),
|
||||
};
|
||||
return Partial("./CopyFromLastYear", model);
|
||||
}
|
||||
public IActionResult OnPostCopyFromLastYear(CopyFromLastYearViewModel commnad)
|
||||
{
|
||||
var res = _insuranceJobApplication.CopyFromLastYear(commnad);
|
||||
return new JsonResult(res);
|
||||
}
|
||||
|
||||
public IActionResult OnPostJobListByText(string textSearch)
|
||||
public IActionResult OnGetOldDataRecovery1403()
|
||||
{
|
||||
var res = _insuranceJobApplication.RecoveryOldData1403();
|
||||
|
||||
return new JsonResult(res);
|
||||
}
|
||||
//public async Task<IActionResult> OnPostJobListByText(string textSearch)
|
||||
//{
|
||||
// var jobs = _jobApplication.GetJobListByText(textSearch);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// IsSuccedded = true,
|
||||
// mylist = jobs,
|
||||
// });
|
||||
//}
|
||||
|
||||
public IActionResult OnPostJobListByText(string textSearch)
|
||||
{
|
||||
var jobs = _jobApplication.GetJobListByText(textSearch);
|
||||
|
||||
@@ -99,9 +134,9 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetDetails(long id)
|
||||
public IActionResult OnGetDetails(long id, string year, string month)
|
||||
{
|
||||
var details = _insuranceJobApplication.GetDetails(id);
|
||||
var details = _insuranceJobApplication.GetDetails(id, year, month);
|
||||
return Partial("Details", details);
|
||||
}
|
||||
|
||||
@@ -157,15 +192,18 @@ public class IndexModel : PageModel
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
public IActionResult OnGetEdit(long id)
|
||||
public IActionResult OnGetEdit(long id,string year, string month)
|
||||
{
|
||||
var model = new EditInsuranceJob();
|
||||
model = _insuranceJobApplication.GetDetails(id);
|
||||
model = _insuranceJobApplication.GetDetails(id, year, month);
|
||||
model.Year = year;
|
||||
model.Month = month;
|
||||
return Partial("./Edit", model);
|
||||
}
|
||||
|
||||
public IActionResult OnPostEdit(EditInsuranceJob command)
|
||||
{
|
||||
|
||||
var result = _insuranceJobApplication.Edit(command);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
@model CompanyManagment.App.Contracts.DateSalary.CreateDateSalaryForInsuranceJob
|
||||
|
||||
@{
|
||||
<style>
|
||||
.disabled {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
background-color: #b2b2b2 !important;
|
||||
border-color: grey !important;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
<link href="@Href("~/admintheme/css/information-insurance-jobs.css")" rel="stylesheet"/>
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="container">
|
||||
@@ -9,10 +18,10 @@
|
||||
<form>
|
||||
<div class="form">
|
||||
<div class="col-md-6 inputs">
|
||||
<input type="text" id="fromDate" placeholder="تاریخ شروع" class="input upper-in date" value="@Model.StartDateFa">
|
||||
<input type="text" id="fromDate" placeholder="تاریخ شروع" class="input upper-in date disabled" value="@Model.StartDateFa">
|
||||
</div>
|
||||
<div class="col-md-6 inputs">
|
||||
<input type="text" id="toDate" placeholder="تاریخ پایان" class="input upper-in date" style="direction: rtl;" value="@Model.EndDateFa">
|
||||
<input type="text" id="toDate" placeholder="تاریخ پایان" class="input upper-in date disabled" style="direction: rtl;" value="@Model.EndDateFa">
|
||||
</div>
|
||||
<div class="col-md-12 inputs" id="table-container">
|
||||
<table id="table" class="table edit-table table-bordered table-striped">
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<link href="@Href("~/admintheme/css/index.css")" rel="stylesheet"/>
|
||||
<div id="index" class="row">
|
||||
<div class="col-sm-12 m-r-10">
|
||||
<p class="pull-right">
|
||||
@* <p class="pull-right">
|
||||
<a href="#showmodal=@Url.Page("/Company/InsuranceJob/Index", "CreateInformation")" class="btn btn-rounded waves-effect waves-light m-b-5 btn-show-modal"><i class="fa fa-user-plus"></i> ثبت مبالغ مشاغل مقطوع </a>
|
||||
</p>
|
||||
</p> *@
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="panel-group panel-group-joined" id="accordion-test">
|
||||
@@ -118,9 +118,9 @@
|
||||
<td>@item.StartDateFa</td>
|
||||
<td>@item.EndDateFa</td>
|
||||
<td>
|
||||
<a class="btn btn-danger ionRad pull-left op-btn rad" onclick="removeInsuranceJobAmount(@item.Id)">
|
||||
@* <a class="btn btn-danger ionRad pull-left op-btn rad" onclick="removeInsuranceJobAmount(@item.Id)">
|
||||
<i class="fa fa-trash faSize"></i>
|
||||
</a>
|
||||
</a> *@
|
||||
<a class="btn btn-warning pull-left op-btn rad"
|
||||
href="#showmodal=@Url.Page("./Index", "Edit", new { item.Id })">
|
||||
<i class="fa fa-edit faSize"></i>
|
||||
|
||||
@@ -65,20 +65,20 @@ public class IndexModel : PageModel
|
||||
|
||||
var searchModelPercentage = new PercentageSearchModel();
|
||||
var percentageList = _percentageApplication.Search(searchModelPercentage);
|
||||
var percentagIds = dateSalaryItems.Select(x => x.PercentageId).ToList();
|
||||
var percentages = percentageList.Where(x => !percentagIds.Contains(x.Id)).ToList();
|
||||
//var percentagIds = dateSalaryItems.Select(x => x.PercentageId).ToList();
|
||||
//var percentages = percentageList.Where(x => !percentagIds.Contains(x.Id)).ToList();
|
||||
|
||||
foreach (var item in percentages)
|
||||
{
|
||||
var obj = new DateSalaryItemViewModel();
|
||||
obj.Percent = item.Percent;
|
||||
obj.PercentageId = item.Id;
|
||||
obj.Salary = null;
|
||||
obj.DateSalaryId = id;
|
||||
obj.Id = 0;
|
||||
obj.StrSalary = "";
|
||||
dateSalaryItems.Add(obj);
|
||||
}
|
||||
//foreach (var item in percentages)
|
||||
//{
|
||||
// var obj = new DateSalaryItemViewModel();
|
||||
// obj.Percent = item.Percent;
|
||||
// obj.PercentageId = item.Id;
|
||||
// obj.Salary = null;
|
||||
// obj.DateSalaryId = id;
|
||||
// obj.Id = 0;
|
||||
// obj.StrSalary = "";
|
||||
// dateSalaryItems.Add(obj);
|
||||
//}
|
||||
|
||||
var list = new CreateDateSalaryForInsuranceJob();
|
||||
list.EndDateFa = dateSalary.EndDateFa;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class AutoExtensionModel : PageModel
|
||||
{
|
||||
WorkshopId = id
|
||||
};
|
||||
var LeftWorkList = _leftWorkApplication.search(LeftWorkSerchModel);
|
||||
var LeftWorkList = _leftWorkApplication.SearchCreateContract(LeftWorkSerchModel);
|
||||
var personnelCodeSearch = new PersonnelCodeSearchModel
|
||||
{
|
||||
WorkshopId = id
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px;padding: 0 12px;">
|
||||
<fieldset style="border: 1px solid black !important;-webkit-print-color-adjust: exact;print-color-adjust: exact; border-radius: 10px 10px 10px 10px; margin: 0px 0px; overflow: hidden;padding: 0;">
|
||||
<fieldset style="border: 1px solid black !important;-webkit-print-color-adjust: exact;print-color-adjust: exact; border-radius: 10px 10px 10px 10px; margin: 0px 0px; overflow: hidden;padding: 0; line-height:normal;">
|
||||
<table style="/* table-layout: fixed; */ width: 100%">
|
||||
|
||||
<tr style="border-bottom: 1px solid; height: 25px; border-collapse: separate; background-color: #cdcdcd !important; -webkit-print-color-adjust: exact;print-color-adjust: exact; ">
|
||||
|
||||
@@ -44,14 +44,20 @@
|
||||
<div>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-3">گروهبندی حضور و غیاب</button>
|
||||
</div>
|
||||
@if (Model.HasCustomizeCheckoutService)
|
||||
{
|
||||
<div>
|
||||
<button class="stepStatus" id="step-4">فیش حقوقی غیر رسمی</button>
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-4">آپلود عکس حضور و غیاب</button>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-5">آپلود عکس حضور و غیاب</button>
|
||||
</div>
|
||||
<div class="employeePart">
|
||||
<button class="stepStatus" id="step-5">حساب بانکی پرسنل</button>
|
||||
<button class="stepStatus" id="step-6">حساب بانکی پرسنل</button>
|
||||
</div>
|
||||
<div class="employeePart">
|
||||
<button class="stepStatus" id="step-6">آپلود مدارک</button>
|
||||
<button class="stepStatus" id="step-7">آپلود مدارک</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,20 +152,53 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="step4" class="step m-auto">
|
||||
<div class="container p-0 m-0 @(Model.HasRollCallService ? "" : "disable")" id="step-form4">
|
||||
|
||||
@if (Model.HasCustomizeCheckoutService)
|
||||
{
|
||||
<div id="step4" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="tempCheckoutEmployeeSetting">
|
||||
<partial name="Company/Employees/_Partials/TempCheckout" model="@Model" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep4">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep4">مرحله بعد</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
<button type="button" class="stepBtn saveData SaveFullData" id="saveFullData4">
|
||||
<span>ذخیره</span>
|
||||
<div class="spinner-loading loading" style="display: none;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
<div id="step5" class="step m-auto">
|
||||
<div class="container p-0 m-0 @(Model.HasRollCallService ? "" : "disable")" id="step-form5">
|
||||
<partial name="Company/Employees/_Partials/ModalUploadImagePersonnel" model="@Model"/>
|
||||
</div>
|
||||
<div class="stepBtnHolder3">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep4">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="prevStep5">مرحله قبل</button>
|
||||
@if (rollCallPath == "/Client/Company/RollCall/EmployeeUploadPicture")
|
||||
{
|
||||
<button type="button" class="stepBtn disable">مرحله بعد</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="stepBtn" id="nextStep4">مرحله بعد</button>
|
||||
<button type="button" class="stepBtn" id="nextStep5">مرحله بعد</button>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
@@ -176,7 +215,7 @@
|
||||
|
||||
@if (rollCallPath != "/Client/Company/RollCall/EmployeeUploadPicture")
|
||||
{
|
||||
<div id="step5" class="step w-100 overflow-y-auto">
|
||||
<div id="step6" class="step w-100 overflow-y-auto overflow-x-hidden">
|
||||
<div class="container p-0 m-0" id="step-form5">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -188,8 +227,8 @@
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep5">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep5">مرحله بعد</button>
|
||||
<button type="button" class="stepBtn" id="prevStep6">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep6">مرحله بعد</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
@@ -203,8 +242,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="step6" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form6">
|
||||
<div id="step7" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form7">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="uploadDocument">
|
||||
@@ -215,8 +254,8 @@
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep6">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn disable" id="nextStep6">پایان</button>
|
||||
<button type="button" class="stepBtn" id="prevStep7">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn disable" id="nextStep7">پایان</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
@@ -284,6 +323,8 @@
|
||||
var workshopSettingListAjax = `@Url.Page("/Company/Employees/EmployeeList", "WorkshopSettingList")`; // EmployeeList Handler
|
||||
var workshopSettingListAjaxRollCall = `@Url.Page("/Company/RollCall/EmployeeUploadPicture", "WorkshopSettingList")`; // RollCall Handler
|
||||
var workshopSettingListAjaxHome = `@Url.Page("/Index", "WorkshopSettingList")`; // Home Handler
|
||||
|
||||
var hasCustomizeCheckoutService = `@Model.HasCustomizeCheckoutService`;
|
||||
|
||||
// @* var workshopSettingEmployeeSelecting = @Html.Raw(Json.Serialize(Model.EmployeeSettings)); *@
|
||||
</script>
|
||||
|
||||
@@ -24,257 +24,260 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
[Authorize]
|
||||
[NeedsPermission(SubAccountPermissionHelper.PersonnelListPermissionCode)]
|
||||
public class EmployeeListModel : PageModel
|
||||
{
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
private readonly IBankApplication _bankApplication;
|
||||
private readonly IEmployeeBankInformationApplication _employeeBankInformationApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IJobApplication _jobApplication;
|
||||
{
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
private readonly IBankApplication _bankApplication;
|
||||
private readonly IEmployeeBankInformationApplication _employeeBankInformationApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IJobApplication _jobApplication;
|
||||
private readonly ILeftWorkTempApplication _leftWorkTempApplication;
|
||||
private readonly IRollCallServiceApplication _rollCallServiceApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public PersonnelInfoViewModel Employees;
|
||||
public bool HasEmployees;
|
||||
public long WorkshopId;
|
||||
public string WorkshopFullName;
|
||||
public EmployeeSearchModel SearchModel;
|
||||
public bool HasEmployees;
|
||||
public long WorkshopId;
|
||||
public string WorkshopFullName;
|
||||
public EmployeeSearchModel SearchModel;
|
||||
|
||||
public EmployeeListModel(IBankApplication bankApplication,IEmployeeBankInformationApplication employeeBankInformationApplication,IEmployeeDocumentsApplication employeeDocumentsApplication,IAuthHelper authHelper,IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IPersonnelCodeApplication personnelCodeApplication, IJobApplication jobApplication, ILeftWorkTempApplication leftWorkTempApplication, IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_workshopApplication = workshopApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_contextAccessor = contextAccessor;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_jobApplication = jobApplication;
|
||||
_leftWorkTempApplication = leftWorkTempApplication;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_authHelper = authHelper;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_bankApplication = bankApplication;
|
||||
public EmployeeListModel(IBankApplication bankApplication, IEmployeeBankInformationApplication employeeBankInformationApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IAuthHelper authHelper, IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IPersonnelCodeApplication personnelCodeApplication, IJobApplication jobApplication, ILeftWorkTempApplication leftWorkTempApplication, IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_workshopApplication = workshopApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_contextAccessor = contextAccessor;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_jobApplication = jobApplication;
|
||||
_leftWorkTempApplication = leftWorkTempApplication;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_authHelper = authHelper;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_bankApplication = bankApplication;
|
||||
|
||||
|
||||
|
||||
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
|
||||
if (_workshopId < 1)
|
||||
throw new InvalidDataException("اختلال در کارگاه");
|
||||
if (_workshopId < 1)
|
||||
throw new InvalidDataException("اختلال در کارگاه");
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
var workshop = _workshopApplication.GetWorkshopInfo(_workshopId);
|
||||
WorkshopFullName = workshop.WorkshopFullName;
|
||||
WorkshopId = workshop.Id;
|
||||
public void OnGet()
|
||||
{
|
||||
var workshop = _workshopApplication.GetWorkshopInfo(_workshopId);
|
||||
WorkshopFullName = workshop.WorkshopFullName;
|
||||
WorkshopId = workshop.Id;
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeeListAjax(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var personnelSearchModel = new PersonnelInfoSearchModel()
|
||||
{
|
||||
WorkshopId = _workshopId,
|
||||
};
|
||||
public IActionResult OnGetEmployeeListAjax(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var personnelSearchModel = new PersonnelInfoSearchModel()
|
||||
{
|
||||
WorkshopId = _workshopId,
|
||||
};
|
||||
|
||||
var result = _workshopApplication.GetPersonnelInfoRemastered(personnelSearchModel);
|
||||
var result = _workshopApplication.GetPersonnelInfoRemastered(personnelSearchModel);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
||||
result = result.Where(x => x.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
||||
result = result.Where(x => x.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||
result = result.Where(x => x.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||
result = result.Where(x => x.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
||||
|
||||
var resultData = new PersonnelInfoViewModel()
|
||||
{
|
||||
PersonnelInfoViewModels = result.OrderByDescending(x => x.CreatedByClient).ThenByDescending(x => x.LefWorkTemp).ThenBy(x => x.Black ? 1 : 0).ThenBy(x => x.PersonnelCode).ToList(),
|
||||
};
|
||||
var resultData = new PersonnelInfoViewModel()
|
||||
{
|
||||
PersonnelInfoViewModels = result.OrderByDescending(x => x.CreatedByClient).ThenByDescending(x => x.LefWorkTemp).ThenBy(x => x.Black ? 1 : 0).ThenBy(x => x.PersonnelCode).ToList(),
|
||||
};
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetPrintOnePersonnelInfo(long employeeId)
|
||||
{
|
||||
var result = _employeeApplication.GetDetails(employeeId);
|
||||
return Partial("PrintOnePersonnelInfo", result);
|
||||
}
|
||||
public IActionResult OnGetPrintOnePersonnelInfo(long employeeId)
|
||||
{
|
||||
var result = _employeeApplication.GetDetails(employeeId);
|
||||
return Partial("PrintOnePersonnelInfo", result);
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeeDataByNationalCode(string nationalCode)
|
||||
{
|
||||
var workshopIds = _workshopApplication.GetWorkshopAccount().Select(workshop => workshop.Id).ToList();
|
||||
public IActionResult OnGetEmployeeDataByNationalCode(string nationalCode)
|
||||
{
|
||||
var workshopIds = _workshopApplication.GetWorkshopAccount().Select(workshop => workshop.Id).ToList();
|
||||
|
||||
var resultData = _employeeApplication.GetEmployeeByNationalCodeIfHasLeftWork(nationalCode, workshopIds);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetWorkshopSettingList()
|
||||
{
|
||||
var resultData = _customizeWorkshopSettingsApplication.GetWorkshopIncludeGroupsByWorkshopId(_workshopId);
|
||||
if (resultData != null)
|
||||
{
|
||||
resultData.GroupSettings = resultData?.GroupSettings.Where(x => !x.MainGroup).ToList();
|
||||
public IActionResult OnGetWorkshopSettingList()
|
||||
{
|
||||
var resultData = _customizeWorkshopSettingsApplication.GetWorkshopIncludeGroupsByWorkshopId(_workshopId);
|
||||
if (resultData != null)
|
||||
{
|
||||
resultData.GroupSettings = resultData?.GroupSettings.Where(x => !x.MainGroup).ToList();
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetCreateEmployee()
|
||||
{
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(_workshopId) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(_workshopId);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(_workshopId);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
public IActionResult OnPostCreateEmployee(CreateEmployeeByClient command)
|
||||
{
|
||||
command.WorkshopId = _workshopId;
|
||||
{
|
||||
command.WorkshopId = _workshopId;
|
||||
var result = _employeeApplication.CreateEmployeeByClient(command);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
});
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode,string birthDate)
|
||||
{
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate)
|
||||
{
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, _workshopId);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetJobSearch(string jobName)
|
||||
{
|
||||
var jobViewModels = _jobApplication.GetJobListByText(jobName);
|
||||
public IActionResult OnGetJobSearch(string jobName)
|
||||
{
|
||||
var jobViewModels = _jobApplication.GetJobListByText(jobName);
|
||||
|
||||
return new JsonResult(jobViewModels);
|
||||
}
|
||||
return new JsonResult(jobViewModels);
|
||||
}
|
||||
|
||||
//step 4
|
||||
public IActionResult OnGetDetailsAjax(long employeeId)
|
||||
{
|
||||
var resultData = _employeeBankInformationApplication.GetByEmployeeId(_workshopId, employeeId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData
|
||||
});
|
||||
}
|
||||
//public IActionResult OnPostCreate(CreateEmployeeInformation command)
|
||||
//{
|
||||
// command.WorkshopId = _workshopId;
|
||||
// if (!string.IsNullOrWhiteSpace(command.CardNumber))
|
||||
// command.CardNumber = command.CardNumber.Replace("-", "");
|
||||
//step 4
|
||||
public IActionResult OnGetDetailsAjax(long employeeId)
|
||||
{
|
||||
var resultData = _employeeBankInformationApplication.GetByEmployeeId(_workshopId, employeeId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData
|
||||
});
|
||||
}
|
||||
//public IActionResult OnPostCreate(CreateEmployeeInformation command)
|
||||
//{
|
||||
// command.WorkshopId = _workshopId;
|
||||
// if (!string.IsNullOrWhiteSpace(command.CardNumber))
|
||||
// command.CardNumber = command.CardNumber.Replace("-", "");
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(command.ShebaNumber))
|
||||
// command.ShebaNumber = command.ShebaNumber.Replace("-", "");
|
||||
// if (!string.IsNullOrWhiteSpace(command.ShebaNumber))
|
||||
// command.ShebaNumber = command.ShebaNumber.Replace("-", "");
|
||||
|
||||
// var result = _employeeBankInformationApplication.Create(command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostDelete(long id)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.Remove(id);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
// var result = _employeeBankInformationApplication.Create(command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostDelete(long id)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.Remove(id);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
|
||||
public IActionResult OnGetBankListAjax()
|
||||
{
|
||||
var resultData = _bankApplication.Search("");
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
public IActionResult OnGetBankListAjax()
|
||||
{
|
||||
var resultData = _bankApplication.Search("");
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
//public IActionResult OnPostGroupCreate(List<CreateEmployeeInformation> command)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.GroupCreate(_workshopId, command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostGroupCreate(List<CreateEmployeeInformation> command)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.GroupCreate(_workshopId, command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
|
||||
//step 5
|
||||
public IActionResult OnPostCreateUploadDocument(AddEmployeeDocumentItem command)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId <= 0)
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = false,
|
||||
message = "کارگاهی یافت نشد",
|
||||
});
|
||||
command.WorkshopId = workshopId;
|
||||
//step 5
|
||||
public IActionResult OnPostCreateUploadDocument(AddEmployeeDocumentItem command)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId <= 0)
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = false,
|
||||
message = "کارگاهی یافت نشد",
|
||||
});
|
||||
command.WorkshopId = workshopId;
|
||||
|
||||
|
||||
var result = _employeeDocumentsApplication.AddEmployeeDocumentItemForClient(command);
|
||||
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(command.EmployeeId, workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
imageSrc = employeeDocument
|
||||
});
|
||||
}
|
||||
|
||||
//public IActionResult OnPostSaveSubmit(SubmitEmployeeDocuments cmd)
|
||||
//{
|
||||
// var result = _employeeDocumentsApplication.SubmitDocumentItemsByClient(cmd);
|
||||
var result = _employeeDocumentsApplication.AddEmployeeDocumentItemForClient(command);
|
||||
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(command.EmployeeId, workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
imageSrc = employeeDocument
|
||||
});
|
||||
}
|
||||
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostSaveSubmit(SubmitEmployeeDocuments cmd)
|
||||
//{
|
||||
// var result = _employeeDocumentsApplication.SubmitDocumentItemsByClient(cmd);
|
||||
|
||||
//public IActionResult OnPostRemoveEmployeeDocumentByLabel(long employeeId, DocumentItemLabel label)
|
||||
//{
|
||||
// var workshopId = _passwordHasher.SlugDecrypt(_authHelper.GetWorkshopSlug());
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
|
||||
// var result = _employeeDocumentsApplication.DeleteEmployeeMultipleUnsubmittedDocumentsByLabel(workshopId, employeeId,
|
||||
// label);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostRemoveEmployeeDocumentByLabel(long employeeId, DocumentItemLabel label)
|
||||
//{
|
||||
// var workshopId = _passwordHasher.SlugDecrypt(_authHelper.GetWorkshopSlug());
|
||||
|
||||
// var result = _employeeDocumentsApplication.DeleteEmployeeMultipleUnsubmittedDocumentsByLabel(workshopId, employeeId,
|
||||
// label);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message
|
||||
// });
|
||||
//}
|
||||
|
||||
#region Left Work
|
||||
public IActionResult OnGetCreateLeftWorkEmployee()
|
||||
@@ -282,7 +285,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
var command = new CreateLeftWorkTemp();
|
||||
return Partial("ModalCreateLeftWorkEmployee", command);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeList()
|
||||
{
|
||||
var employees = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId);
|
||||
@@ -293,13 +296,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
data = employees
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeListLeftWorkTemp()
|
||||
{
|
||||
var exists = _leftWorkTempApplication.GetLeftWorksByWorkshopId(_workshopId);
|
||||
|
||||
var employees = (await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId))
|
||||
.Where(x=> exists.All(a => a.EmployeeId != x.Id)).ToList();
|
||||
.Where(x => exists.All(a => a.EmployeeId != x.Id)).ToList();
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
@model CompanyManagment.App.Contracts.Employee.CreateEmployeeByClient
|
||||
|
||||
|
||||
@{
|
||||
string clientVersion = _0_Framework.Application.Version.StyleVersion;
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/pages/employees/css/createbankinfomodal.css?ver=@clientVersion" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
.disableColor {
|
||||
border: 1px solid #C6C6C6 !important;
|
||||
background-color: #F0F0F0 !important;
|
||||
}
|
||||
|
||||
.msgStepTempCheckout {
|
||||
border: 1px solid #C6C6C6;
|
||||
border-radius: 9px;
|
||||
width: 60%;
|
||||
margin: 35px auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
}
|
||||
@*
|
||||
<div class="text-center">
|
||||
<div>
|
||||
<p class="m-0 pdHeaderTitle1">ایجاد شماره حساب پرسنل</p>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">نام گروه</span>
|
||||
<input type="text" class="form-control text-center disable disableColor" id="groupNameTemp" placeholder="-" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">حقوق تعیین شده در این گروه</span>
|
||||
<input type="text" class="form-control text-center disable disableColor" id="priceTemp" placeholder="-" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">مرخصی مجاز تعیین شده در این گروه</span>
|
||||
<input class="form-control text-center disable disableColor" id="leavePermitted" placeholder="-" style="direction: ltr;" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">حقوق پرسنل</span>
|
||||
<input class="form-control text-center disable disableColor" id="personnelSalary" name="Command.CreateCustomizeEmployeeSettings.Salary" placeholder="-" style="direction: ltr" />
|
||||
</div>
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">مجاز مرخصی</span>
|
||||
<input class="form-control text-center disable disableColor" id="leavePermittedDays" name="Command.CreateCustomizeEmployeeSettings.LeavePermittedDays" placeholder="-" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative" id="has-group" style="display: block;">
|
||||
<div class="text-center p-4 msgStepTempCheckout">
|
||||
<span class="spanTitleText">به دلیل عدم انتخاب گروهبندی حضور و غیاب، امکان ثبت حقوق برای پرسنل وجود ندارد.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// var getDetailsAjaxUrl = `@Url.Page("/Company/Employees/EmployeeList", "DetailsAjax")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/employees/js/TempCheckout.js?ver=@clientVersion"></script>
|
||||
@@ -732,6 +732,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(_workshopId) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(_workshopId);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(_workshopId);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("../Employees/CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,10 @@ namespace ServiceHost.Areas.Client.Pages
|
||||
long workshopIDecrypt = _passwordHasher.SlugDecrypt(workshopSlug);
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(workshopIDecrypt) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(workshopIDecrypt);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopIDecrypt);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("./Company/Employees/CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@ builder.Services.AddRazorPages()
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddHttpClient("holidayApi", c => c.BaseAddress = new System.Uri("https://api.github.com"));
|
||||
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
|
||||
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
|
||||
PersonalBootstrapper.Configure(builder.Services, connectionString);
|
||||
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
|
||||
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
|
||||
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
|
||||
QueryBootstrapper.Configure(builder.Services);
|
||||
|
||||
@@ -12,14 +12,18 @@
|
||||
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
|
||||
|
||||
//server
|
||||
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;"
|
||||
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;",
|
||||
|
||||
|
||||
//local
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;"
|
||||
|
||||
//mahan Docker
|
||||
//"MesbahDb": "Data Source=localhost,5069;Initial Catalog=mesbah_db;User ID=sa;Password=YourPassword123;TrustServerCertificate=True;"
|
||||
},
|
||||
|
||||
"GoogleRecaptchaV3": {
|
||||
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",
|
||||
"SecretKey": "6Lfhp_AnAAAAANjDDY6DPrbbUQS7k6ZCRmrVP5Lb"
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
//"MesbahDb": "Data Source=.\\MSSQLSERVER2019;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=mesbah_db;Password=sa142857$@;"
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
//testDb
|
||||
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;"
|
||||
},
|
||||
"BackupOptions": {
|
||||
"DbName": "mesbah_db",
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
.main-title {
|
||||
position: absolute;
|
||||
width: 434px;
|
||||
width: 469px;
|
||||
font-size: 20px;
|
||||
background-color: inherit;
|
||||
left: 50%;
|
||||
@@ -180,9 +180,9 @@ input.no-spinner {
|
||||
border: 1px solid #9393938a;
|
||||
}
|
||||
#worksTable th {
|
||||
background-color: #aaecf9;
|
||||
text-align: center;
|
||||
color: #010838;
|
||||
background-color: #a5cfd7 !important;
|
||||
text-align: center;
|
||||
color: #010838;
|
||||
}
|
||||
|
||||
#worksTable thead {
|
||||
|
||||
@@ -232,9 +232,18 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// This should be checked the hasCustomizeCheckoutService for step4 / TempCheckout
|
||||
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
if (hasCustomizeCheckoutService==='True') {
|
||||
console.log(hasCustomizeCheckoutService);
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
}
|
||||
} else {
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,46 +290,58 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
|
||||
class Step4 extends ModalState {
|
||||
class Step4 extends ModalState {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step4").show();
|
||||
$(".step").hide();
|
||||
$("#step4").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-4").addClass("active");
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-4").addClass("active");
|
||||
checkStepStatus();
|
||||
checkPicture();
|
||||
}
|
||||
|
||||
|
||||
next() {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
if (checkStepTempCheckout()) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
|
||||
prev() {
|
||||
if (checkPicture()) {
|
||||
//if (checkStepTempCheckout()) {
|
||||
this.modal.setState(this.modal.step3);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
class Step5 extends ModalState {
|
||||
render() {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step5").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-5").addClass("active");
|
||||
checkStepStatus();
|
||||
}
|
||||
checkPicture();
|
||||
}
|
||||
|
||||
next() {
|
||||
this.modal.setState(this.modal.step6);
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step6);
|
||||
}
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step4);
|
||||
// This should be checked the hasCustomizeCheckoutService for step4 / TempCheckout
|
||||
if (hasCustomizeCheckoutService === 'True') {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
}
|
||||
} else {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,12 +353,31 @@ $(document).ready(function () {
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-6").addClass("active");
|
||||
checkStepStatus();
|
||||
}
|
||||
|
||||
next() {
|
||||
this.modal.setState(this.modal.step7);
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
|
||||
class Step7 extends ModalState {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step7").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-7").addClass("active");
|
||||
checkStepStatus();
|
||||
|
||||
checkStep5();
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step5);
|
||||
this.modal.setState(this.modal.step6);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +389,7 @@ $(document).ready(function () {
|
||||
this.step4 = new Step4(this);
|
||||
this.step5 = new Step5(this);
|
||||
this.step6 = new Step6(this);
|
||||
this.step7 = new Step7(this);
|
||||
this.currentState = this.step1;
|
||||
|
||||
this.formData = {};
|
||||
@@ -420,7 +461,10 @@ function saveFullData() {
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.BreakTime.BreakTimeValue", $("#TimeOnly").val());
|
||||
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.FridayWork", $('#Friday1').prop('checked') ? "Default" : "WorkInFriday");
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.HolidayWork", $('#HolidayWork1').prop('checked') ? "Default" : "WorkInHolidays");
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.HolidayWork", $('#HolidayWork1').prop('checked') ? "Default" : "WorkInHolidays");
|
||||
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.Salary", $('#personnelSalary').val());
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.LeavePermittedDays", $('#leavePermittedDays').val());
|
||||
|
||||
let pic1 = $("#pic1").attr('src');
|
||||
let pic2 = $("#pic2").attr('src');
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
$(document).ready(function() {
|
||||
$("#personnelSalary").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
numeral: true,
|
||||
numeralThousandsGroupStyle: 'thousand'
|
||||
});
|
||||
});
|
||||
|
||||
$("#leavePermittedDays").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
element.mask("000");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function checkStepTempCheckout() {
|
||||
var workshopSettingSelect = $('#workshopSettingSelect').val();
|
||||
if (workshopSettingSelect === "0") {
|
||||
return true;
|
||||
} else {
|
||||
if ($("#personnelSalary").val() === "") {
|
||||
showAlert('لطفا حقوق پرسنل را وارد نمائید.', $("#personnelSalary"));
|
||||
return false;
|
||||
}
|
||||
if ($("#leavePermittedDays").val() === "") {
|
||||
showAlert('لطفا تعداد روز مجاز مرخصی را وارد نمائید.', $("#leavePermittedDays"));
|
||||
return false;
|
||||
}
|
||||
if ($("#personnelSalary").val() !== "" && $("#leavePermittedDays").val() !== "") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -771,6 +771,14 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
if (id === 0) {
|
||||
$('#GroupId').val(0);
|
||||
$('#footer-section').hide();
|
||||
|
||||
//Step (TempCheckout)
|
||||
$("#groupNameTemp").val("-");
|
||||
$("#priceTemp").val("-");
|
||||
$("#leavePermitted").val("-");
|
||||
$("#personnelSalary").val("-").addClass("disable").addClass("disableColor");
|
||||
$("#leavePermittedDays").val("-").addClass("disable").addClass("disableColor");
|
||||
$("#has-group").show();
|
||||
}
|
||||
|
||||
if ($("#workshopSettingSelect").val() === "0") {
|
||||
@@ -803,7 +811,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
success: function (response) {
|
||||
const workshopSettingGroupSelecting = response.data;
|
||||
|
||||
console.log(workshopSettingGroupSelecting);
|
||||
var regularShiftsIndex = 0;
|
||||
var rotatingShiftsIndex = 0;
|
||||
|
||||
@@ -811,7 +819,19 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
workshopSettingGroupSelecting.groupSettings.forEach(function (itemGroupSettings) {
|
||||
|
||||
if (itemGroupSettings.id === id) {
|
||||
if ($('#workshopSettingSelect').find(':selected').data('name-group') === "بدون گروه") {
|
||||
|
||||
if (id !== 0) {
|
||||
//Step (TempCheckout)
|
||||
$("#groupNameTemp").val(itemGroupSettings.groupName);
|
||||
$("#priceTemp").val(itemGroupSettings.salaryStr);
|
||||
$("#leavePermitted").val(itemGroupSettings.leavePermitted);
|
||||
$("#personnelSalary").val('').removeClass("disable").removeClass("disableColor");
|
||||
$("#leavePermittedDays").val('').removeClass("disable").removeClass("disableColor");
|
||||
$("#has-group").hide();
|
||||
}
|
||||
|
||||
|
||||
if ($('#workshopSettingSelect').find(':selected').data('name-group') === "بدون گروه") {
|
||||
$('#stepWorkTimeOptionRadio').hide();
|
||||
$('#step_workTimeOptionNull').hide();
|
||||
$('#step_workTimeOption').hide();
|
||||
@@ -819,6 +839,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
$('#step_workTimeOptionIrregular').hide();
|
||||
$('#step_workTimeOptionWithoutGroup').show();
|
||||
$('#footer-section').hide();
|
||||
|
||||
} else {
|
||||
if (itemGroupSettings.workshopShiftStatus === 0) {
|
||||
|
||||
@@ -927,8 +948,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
|
||||
$('#step_workTimeOptionIrregular').hide();
|
||||
$('#step_workTimeOptionIrregular').html(loadIrregularHtml());
|
||||
|
||||
|
||||
|
||||
updateAddButtonText(regularShiftsIndex);
|
||||
if ((regularShiftsIndex) === 3) {
|
||||
$(".btnAddTimeWork").hide();
|
||||
@@ -938,8 +958,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
// Update Remove button enable/disable state
|
||||
updateRemoveButtons();
|
||||
loadCleaveClasses();
|
||||
|
||||
} else if (itemGroupSettings.workshopShiftStatus === 1) {
|
||||
} else if (itemGroupSettings.workshopShiftStatus === 1) {
|
||||
|
||||
//radio btn
|
||||
$("#organized").prop('checked', false);
|
||||
|
||||
@@ -89,7 +89,7 @@ $(document).ready(function () {
|
||||
|
||||
// بررسی فرمتهای تصویر (jpeg, jpg, png)
|
||||
if (validExtensions.includes(extension)) {
|
||||
if (fileInputFile.size > 5000000) {
|
||||
if (fileInputFile.size > 10000000) {
|
||||
showAlertMessage('.alert-msg', 'لطفا فایل حجم کمتر از 5 مگابایت را آپلود کنید.', 3500);
|
||||
$(this).val('');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user