Compare commits
18 Commits
customizeC
...
Fix/Custom
| Author | SHA1 | Date | |
|---|---|---|---|
| 1449e83a0f | |||
|
|
caaace7bcc | ||
|
|
c6142b684e | ||
|
|
ef5f80ba91 | ||
|
|
cac3d47c32 | ||
|
|
e2e0171564 | ||
| 7566268534 | |||
| e9805130ad | |||
| d139a36fba | |||
|
|
a9655d6df5 | ||
| e0bdde8264 | |||
| 67111fff6b | |||
| ef4c9ee201 | |||
| b621a709aa | |||
|
|
1f96f0bc87 | ||
|
|
b8f8485266 | ||
|
|
22c1847cbe | ||
|
|
807afbae18 |
@@ -182,9 +182,10 @@ public class CustomizeCheckoutMandatoryViewModel
|
||||
public int Year { get; set; }
|
||||
public int Month { get; set; }
|
||||
#endregion
|
||||
public List<FineViewModel> FineViewModels { get; set; }
|
||||
public List<RewardViewModel> RewardViewModels { get; set; }
|
||||
public List<LoanInstallmentViewModel> InstallmentViewModels{ get; set; }
|
||||
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
|
||||
|
||||
public List<FineViewModel> FineViewModels { get; set; } = [];
|
||||
public List<RewardViewModel> RewardViewModels { get; set; } = [];
|
||||
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; } = [];
|
||||
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; } = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,9 @@ namespace CompanyManagment.Application
|
||||
StartDate = x.StartDate,
|
||||
EndDateGr = x.EndDateGr > endOfMonth ? endOfMonth : x.EndDateGr.Date,
|
||||
StartDateGr = x.StartDateGr < startOfMonth ? startOfMonth : x.StartDateGr.Date
|
||||
});
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdInDates(workshopId, startOfMonth, endOfMonth);
|
||||
var personnelCodes = _personnelCodeRepository.Search(new PersonnelCodeSearchModel()
|
||||
@@ -264,7 +266,10 @@ namespace CompanyManagment.Application
|
||||
var statusesWithActiveLeftWorks = statuses
|
||||
.Where(status => workshopLeftWorksInMonth.Any(leftWork => leftWork.EmployeeId == status.EmployeeId &&
|
||||
leftWork.StartWorkDateGr.Date <= status.StartDateGr.Date &&
|
||||
leftWork.LeftWorkDateGr.Date >= status.EndDateGr.Date));
|
||||
leftWork.LeftWorkDateGr.Date >= status.EndDateGr.Date)).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var employeesWithCheckout = statusesWithActiveLeftWorks.Where(x => customizeCheckouts.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
@@ -285,6 +290,24 @@ namespace CompanyManagment.Application
|
||||
eligibleEmloyees = eligibleEmloyees.Where(x => !employeesWithoutSalary.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
|
||||
|
||||
#region CustomForKebabMahdi
|
||||
|
||||
if (workshopId == 170)
|
||||
{
|
||||
List<long> employeesIds = [ 45084, 7980, 5976,45214,45215];
|
||||
foreach (var employeesId in employeesIds)
|
||||
{
|
||||
|
||||
var status = new RollCallEmployeeStatusViewModel()
|
||||
{
|
||||
EmployeeId = employeesId,
|
||||
};
|
||||
statusesWithActiveLeftWorks.Add(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
if (!statusesWithActiveLeftWorks.Any())
|
||||
return op.Failed("امکان ایجاد فیش برای تاریخ انتخاب شده وجود ندارد");
|
||||
|
||||
@@ -234,6 +234,24 @@ namespace CompanyManagment.Application
|
||||
leftWork.LeftWorkDateGr.Date >= status.EndDateGr.Date)).ToList();
|
||||
|
||||
|
||||
#region CustomForKebabMahdi
|
||||
|
||||
if (workshopId == 170)
|
||||
{
|
||||
List<long> employeesIds = [45084, 7980, 5976, 45214,45215];
|
||||
foreach (var employeesId in employeesIds)
|
||||
{
|
||||
|
||||
var status = new RollCallEmployeeStatusViewModel()
|
||||
{
|
||||
EmployeeId = employeesId,
|
||||
};
|
||||
statusesWithActiveLeftWorks.Add(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
if (!statusesWithActiveLeftWorks.Any())
|
||||
return op.Failed("امکان ایجاد فیش برای تاریخ انتخاب شده وجود ندارد");
|
||||
|
||||
@@ -146,21 +146,21 @@ namespace CompanyManagment.Application
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditRollCallEmployeeStatus cmd)
|
||||
{
|
||||
OperationResult op = new();
|
||||
RollCallEmployeeStatus entity = _employeeRollCallStatusRepository.Get(cmd.Id);
|
||||
if (entity == null)
|
||||
return op.Failed(ApplicationMessages.RecordNotFound);
|
||||
public OperationResult Edit(EditRollCallEmployeeStatus cmd)
|
||||
{
|
||||
OperationResult op = new();
|
||||
RollCallEmployeeStatus entity = _employeeRollCallStatusRepository.Get(cmd.Id);
|
||||
if (entity == null)
|
||||
return op.Failed(ApplicationMessages.RecordNotFound);
|
||||
|
||||
entity.Edit(cmd.StartDate, cmd.EndDate);
|
||||
_employeeRollCallStatusRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
entity.Edit(cmd.StartDate, cmd.EndDate);
|
||||
_employeeRollCallStatusRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeStatusViewModel> GetAll()
|
||||
{
|
||||
return _employeeRollCallStatusRepository.GetAll();
|
||||
}
|
||||
}
|
||||
public List<RollCallEmployeeStatusViewModel> GetAll()
|
||||
{
|
||||
return _employeeRollCallStatusRepository.GetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,6 +642,13 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
}
|
||||
|
||||
|
||||
public async Task<LeftWork> GetLastLeftWork(long employeeId, long workshopId)
|
||||
{
|
||||
var leftWork =await _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
|
||||
.OrderByDescending(x => x.StartWorkDate).FirstOrDefaultAsync();
|
||||
return leftWork;
|
||||
}
|
||||
|
||||
private bool HasActiveRollCallStatus(long workshopId, long employeeId)
|
||||
{
|
||||
var now = DateTime.Today;
|
||||
@@ -684,10 +691,5 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
|
||||
}
|
||||
#endregion
|
||||
public async Task<LeftWork> GetLastLeftWork(long employeeId, long workshopId)
|
||||
{
|
||||
var leftWork = await _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
|
||||
.OrderByDescending(x => x.StartWorkDate).FirstOrDefaultAsync();
|
||||
return leftWork;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1613,6 +1613,12 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
public CustomizeCheckoutMandatoryViewModel CustomizeCheckoutMandatoryComputeForKebabMahdi(long employeeId, long workshopId,
|
||||
DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
var checkoutEnd = contractEnd;
|
||||
var checkoutStart = contractStart;
|
||||
if (employeeId is 45084 or 7980 or 5976 or 45214 or 45215)
|
||||
{
|
||||
return CheckoutWithoutCalculationForKebabMahdi(workshopId,employeeId,contractStart,contractEnd);
|
||||
}
|
||||
var firstDayOfMonth = $"{(contractStart.ToFarsi())[..8]}/01".ToGeorgianDateTime();
|
||||
|
||||
#region LeftWork
|
||||
@@ -1695,8 +1701,8 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
#endregion
|
||||
|
||||
List<RollCallViewModel> rollCallResult = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date &&
|
||||
x.StartDate.Value.Date <= contractEnd.Date && x.EndDate != null)
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.ShiftDate.Date >= contractStart.Date &&
|
||||
x.ShiftDate.Date <= contractEnd.Date && x.EndDate != null)
|
||||
.Select(x => new RollCallViewModel()
|
||||
{
|
||||
StartDate = x.StartDate,
|
||||
@@ -1964,7 +1970,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
#region SalaryAidDeduction
|
||||
|
||||
var salaryAidViewModel = _context.SalaryAids
|
||||
.Where(x => x.SalaryAidDateTime >= contractStart && x.SalaryAidDateTime <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
.Where(x => x.SalaryAidDateTime >= checkoutStart && x.SalaryAidDateTime <= checkoutEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
@@ -2178,8 +2184,8 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
#region Reward
|
||||
|
||||
var rewardViewModels = _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= contractEnd &&
|
||||
x.GrantDate >= contractStart).Select(x => new RewardViewModel
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
|
||||
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
@@ -2379,7 +2385,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
EmployeeId = employeeId,
|
||||
SumOfWorkingDays = totalDays.ToString(),
|
||||
ContractNo = contract?.ContractNo ?? "-",
|
||||
MonthlySalary = Math.Truncate(dailyWage * mandatoryDays),
|
||||
MonthlySalary = dailyWage * mandatoryDays,
|
||||
PersonnelCode = personnelCode,
|
||||
FineViewModels = fineViewModels,
|
||||
InstallmentViewModels = loanInstallments,
|
||||
@@ -2390,6 +2396,112 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
};
|
||||
}
|
||||
|
||||
private CustomizeCheckoutMandatoryViewModel CheckoutWithoutCalculationForKebabMahdi(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
var firstDayOfMonth = $"{(contractStart.ToFarsi())[..8]}/01".ToGeorgianDateTime();
|
||||
|
||||
CustomizeWorkshopEmployeeSettings customizeWorkshopEmployeeSettings = _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
CustomizeWorkshopSettings customizeWorkshopSettings =
|
||||
_context.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
//ToDo handel exception if is null
|
||||
var monthySalary = customizeWorkshopEmployeeSettings?.Salary ?? 0;
|
||||
var monthDays = customizeWorkshopSettings.MaxMonthDays == MaxMonthDays.ThirtyDaysForAllMonth
|
||||
? 30
|
||||
: firstDayOfMonth.CountMonthDays();
|
||||
double dailyWage = 0;
|
||||
dailyWage = monthySalary / monthDays;
|
||||
|
||||
var totalDays = (int)(contractEnd - contractStart).TotalDays + 1;
|
||||
var mandatoryDays = totalDays;
|
||||
|
||||
|
||||
#region SalaryAidDeduction
|
||||
|
||||
var salaryAidViewModel = _context.SalaryAids
|
||||
.Where(x => x.SalaryAidDateTime >= contractStart && x.SalaryAidDateTime <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
}).ToList();
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Loan
|
||||
|
||||
var loanInstallments = _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate > contractStart && i.InstallmentDate < contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney()
|
||||
}).ToList();
|
||||
|
||||
double loanDeduction = loanInstallments.Sum(x => x.AmountDouble);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fine
|
||||
|
||||
var fineViewModels = _context.Fines.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.FineDate >= contractStart &&
|
||||
x.FineDate <= contractEnd && x.IsActive == IsActive.True).Select(x => new FineViewModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
EmployeeId = x.EmployeeId,
|
||||
CreationDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
double fineDeduction = fineViewModels.Sum(x => x.Amount.MoneyToDouble());
|
||||
|
||||
#endregion
|
||||
#region Reward
|
||||
|
||||
var rewardViewModels = _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= contractEnd &&
|
||||
x.GrantDate >= contractStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
GrantDateGr = x.GrantDate,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
}).ToList();
|
||||
|
||||
double rewardPay = rewardViewModels.Sum(x => x.AmountDouble);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
return new CustomizeCheckoutMandatoryViewModel()
|
||||
{
|
||||
MonthlySalary = dailyWage * mandatoryDays,
|
||||
RewardPay = rewardPay,
|
||||
RewardViewModels = rewardViewModels,
|
||||
SalaryAidDeduction = salaryAidDeduction,
|
||||
SalaryAidViewModels = salaryAidViewModel,
|
||||
InstallmentDeduction = loanDeduction,
|
||||
InstallmentViewModels = loanInstallments,
|
||||
FineDeduction = fineDeduction,
|
||||
FineViewModels = fineViewModels
|
||||
};
|
||||
}
|
||||
|
||||
private void CreateRewardForBirthDay(long employeeId, long workshopId, double amount, int month, int year,
|
||||
DateTime contractStart)
|
||||
{
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
<button type="submit">Upload</button>
|
||||
</form> *@
|
||||
|
||||
@* <form asp-page-handler="ShiftDate" id="8" method="post">
|
||||
<form asp-page-handler="ShiftDate" id="8" method="post">
|
||||
|
||||
<button type="submit">افزودن شیفت دیت</button>
|
||||
</form> *@
|
||||
</form>
|
||||
|
||||
<form asp-page-handler="ShiftDateNew" id="9" method="post">
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.EFCore;
|
||||
@@ -10,237 +11,266 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
{
|
||||
[Authorize]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAndroidApkVersionApplication _application;
|
||||
private readonly IRollCallDomainService _rollCallDomainService;
|
||||
private readonly CompanyContext _context;
|
||||
private readonly AccountContext _accountContext;
|
||||
[Authorize]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAndroidApkVersionApplication _application;
|
||||
private readonly IRollCallDomainService _rollCallDomainService;
|
||||
private readonly CompanyContext _context;
|
||||
private readonly AccountContext _accountContext;
|
||||
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostUpload()
|
||||
{
|
||||
var result = await _application.CreateAndActive(File);
|
||||
ViewData["message"] = result.Message;
|
||||
return Page();
|
||||
}
|
||||
public async Task<IActionResult> OnPostUpload()
|
||||
{
|
||||
var result = await _application.CreateAndActive(File);
|
||||
ViewData["message"] = result.Message;
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
public IActionResult OnPostShiftDate()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
|
||||
public IActionResult OnPostShiftDate()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 2, 19);
|
||||
//var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
|
||||
|
||||
var endedRollCalls = rollCalls.Where(x => x.EndDate != null).ToList();
|
||||
//var endedRollCalls = rollCalls.Where(x => x.EndDate != null).ToList();
|
||||
|
||||
var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
ViewData["message"] = "تومام Refactor";
|
||||
return Page();
|
||||
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
CreateRewardForKebabMahdi().GetAwaiter().GetResult();
|
||||
ViewData["message"] = "ایجاد شد";
|
||||
return Page();
|
||||
}
|
||||
|
||||
}
|
||||
public IActionResult OnPostShiftDateNew()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
var r1 = rollCalls.Take(3000).ToList();
|
||||
|
||||
public IActionResult OnPostShiftDateNew()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
var r1 = rollCalls.Take(3000).ToList();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("endStep 1 ============");
|
||||
SetRollCall(r1);
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("endStep 1 ============");
|
||||
SetRollCall(r1);
|
||||
|
||||
|
||||
ViewData["message"] = "تومام یک";
|
||||
return Page();
|
||||
}
|
||||
ViewData["message"] = "تومام یک";
|
||||
return Page();
|
||||
}
|
||||
|
||||
public IActionResult OnPostShiftDateNew2()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
public IActionResult OnPostShiftDateNew2()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
|
||||
var r2 = rollCalls.Skip(3000).ToList();
|
||||
var r2 = rollCalls.Skip(3000).ToList();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("endStep 2 ============");
|
||||
SetRollCall2(r2);
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("endStep 2 ============");
|
||||
SetRollCall2(r2);
|
||||
|
||||
ViewData["message"] = "تومام دو";
|
||||
return Page();
|
||||
}
|
||||
ViewData["message"] = "تومام دو";
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
#region Create reward for kebab mahdi
|
||||
|
||||
public async System.Threading.Tasks.Task CreateRewardForKebabMahdi()
|
||||
{
|
||||
var esfandCustomizeCheckouts = _context.CustomizeCheckouts
|
||||
.Where(x => x.WorkshopId == 170 && x.MonthInt == 12 && x.YearInt == 1403);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region AccountLeftwork
|
||||
|
||||
private void AddToAccountLeftWork()
|
||||
{
|
||||
List<long> roleIds = [3, 5, 7, 8, 23, 24];
|
||||
var accounts = _accountContext.Accounts
|
||||
.Where(x => roleIds.Contains(x.RoleId)).Where(x => x.AdminAreaPermission == "true");
|
||||
var accountsIds = accounts.Select(x => x.id).ToList();
|
||||
var workshopAccount = _context.WorkshopAccounts
|
||||
.Where(x => accountsIds.Contains(x.AccountId))
|
||||
.GroupBy(x => x.AccountId);
|
||||
|
||||
List<long> oldAccountleftworkActiveNow = [300, 332, 333, 334, 18, 25, 14];
|
||||
List<long> oldAccountleftworkDeActivedNow = [50, 49, 15];
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
var employeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
.Where(x => x.WorkshopId == 170 &&
|
||||
esfandCustomizeCheckouts.Any(c => c.EmployeeId == x.EmployeeId));
|
||||
|
||||
|
||||
foreach (var item in workshopAccount)
|
||||
{
|
||||
var absentEmployees = employeeSettings.Where(x => !_context.RollCalls
|
||||
.Any(a => a.EmployeeId == x.EmployeeId && a.ShiftDate == new DateTime(2025,03,20)))
|
||||
.ToList();
|
||||
|
||||
foreach (var employeeSetting in absentEmployees)
|
||||
{
|
||||
var amount = (int) employeeSetting.Salary / 30;
|
||||
var reward = new Reward(employeeSetting.EmployeeId, 170, amount, "", 0, new DateTime(2025, 3, 21),
|
||||
"بابت تعطیلی روز آخر سال 1403");
|
||||
_context.Rewards.Add(reward);
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
var oldActive = item.FirstOrDefault(x => oldAccountleftworkActiveNow.Contains(x.AccountId));
|
||||
if (oldActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldActive.AccountId)!.RoleId;
|
||||
var startGr = item.Key != 25 ? new DateTime(2024, 07, 22) : new DateTime(2024, 08, 22);
|
||||
//if (item.Key is 380 or 381)
|
||||
// startGr = new DateTime(2025, 02, 19);
|
||||
if (item.Key is 14 or 18)
|
||||
startGr = new DateTime(2020, 05, 21);
|
||||
if (item.Key is 300)
|
||||
startGr = new DateTime(2024, 05, 22);
|
||||
#region AccountLeftwork
|
||||
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, workshop.AccountId, workshop.WorkshopId, roleId, true));
|
||||
private void AddToAccountLeftWork()
|
||||
{
|
||||
List<long> roleIds = [3, 5, 7, 8, 23, 24];
|
||||
var accounts = _accountContext.Accounts
|
||||
.Where(x => roleIds.Contains(x.RoleId)).Where(x => x.AdminAreaPermission == "true");
|
||||
var accountsIds = accounts.Select(x => x.id).ToList();
|
||||
var workshopAccount = _context.WorkshopAccounts
|
||||
.Where(x => accountsIds.Contains(x.AccountId))
|
||||
.GroupBy(x => x.AccountId);
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
var oldDeActive = item.FirstOrDefault(x => oldAccountleftworkDeActivedNow.Contains(x.AccountId));
|
||||
if (oldDeActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldDeActive.AccountId)!.RoleId;
|
||||
var startGr = new DateTime(2022, 03, 21);
|
||||
if (item.Key == 49)
|
||||
startGr = new DateTime(2023, 04, 21);
|
||||
if (item.Key == 50)
|
||||
startGr = new DateTime(2023, 03, 21);
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.Add(new AccountLeftWork(startGr, new DateTime(2024, 07, 21), workshop.AccountId, workshop.WorkshopId, roleId, false));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
List<long> oldAccountleftworkActiveNow = [300, 332, 333, 334, 18, 25, 14];
|
||||
List<long> oldAccountleftworkDeActivedNow = [50, 49, 15];
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine("finished");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RefactorRollcall
|
||||
|
||||
private void RefactorAllTheRollCallsOnEsfand(List<global::Company.Domain.RollCallAgg.RollCall> endedRollCalls,List<global::Company.Domain.RollCallAgg.RollCall> notEndedRollCalls)
|
||||
{
|
||||
var countEndedRollCalls = endedRollCalls.Count;
|
||||
var countNotEndedRollCalls = notEndedRollCalls.Count;
|
||||
|
||||
var step1 = 1;
|
||||
foreach (var rollCall in endedRollCalls)
|
||||
{
|
||||
rollCall.setStartAndEnd(rollCall.StartDate.Value, rollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{step1} - {countEndedRollCalls} ended Edit {rollCall.id}");
|
||||
step1 += 1;
|
||||
}
|
||||
|
||||
var step2 = 1;
|
||||
foreach (var notEndedRollCall in notEndedRollCalls)
|
||||
{
|
||||
notEndedRollCall.SetStartAgain(notEndedRollCall.StartDate.Value);
|
||||
Console.WriteLine($"{step2} - {countNotEndedRollCalls} not ended startAgain {notEndedRollCall.id}");
|
||||
step2 += 1;
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SetRollCall(List<global::Company.Domain.RollCallAgg.RollCall> r1)
|
||||
{
|
||||
|
||||
var endedRollCalls2 = r1.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.ClearTimeDiff();
|
||||
_context.SaveChanges();
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
foreach (var item in workshopAccount)
|
||||
{
|
||||
|
||||
|
||||
private void SetRollCall2(List<global::Company.Domain.RollCallAgg.RollCall> r2)
|
||||
{
|
||||
|
||||
|
||||
var endedRollCalls2 = r2.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
var oldActive = item.FirstOrDefault(x => oldAccountleftworkActiveNow.Contains(x.AccountId));
|
||||
if (oldActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldActive.AccountId)!.RoleId;
|
||||
var startGr = item.Key != 25 ? new DateTime(2024, 07, 22) : new DateTime(2024, 08, 22);
|
||||
//if (item.Key is 380 or 381)
|
||||
// startGr = new DateTime(2025, 02, 19);
|
||||
if (item.Key is 14 or 18)
|
||||
startGr = new DateTime(2020, 05, 21);
|
||||
if (item.Key is 300)
|
||||
startGr = new DateTime(2024, 05, 22);
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
//public async Task<IActionResult> OnPostShiftDate()
|
||||
//{
|
||||
// var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, workshop.AccountId, workshop.WorkshopId, roleId, true));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
var oldDeActive = item.FirstOrDefault(x => oldAccountleftworkDeActivedNow.Contains(x.AccountId));
|
||||
if (oldDeActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldDeActive.AccountId)!.RoleId;
|
||||
var startGr = new DateTime(2022, 03, 21);
|
||||
if (item.Key == 49)
|
||||
startGr = new DateTime(2023, 04, 21);
|
||||
if (item.Key == 50)
|
||||
startGr = new DateTime(2023, 03, 21);
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.Add(new AccountLeftWork(startGr, new DateTime(2024, 07, 21), workshop.AccountId, workshop.WorkshopId, roleId, false));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
}
|
||||
|
||||
// var rollCalls =
|
||||
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
// .ToList();
|
||||
Console.WriteLine("finished");
|
||||
}
|
||||
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.SetShiftDate(_rollCallDomainService);
|
||||
// Console.WriteLine(rollCall.id);
|
||||
// }
|
||||
#endregion
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
// ViewData["message"] = "تومام";
|
||||
// return Page();
|
||||
//}
|
||||
}
|
||||
#region RefactorRollcall
|
||||
|
||||
private void RefactorAllTheRollCallsOnEsfand(List<global::Company.Domain.RollCallAgg.RollCall> endedRollCalls, List<global::Company.Domain.RollCallAgg.RollCall> notEndedRollCalls)
|
||||
{
|
||||
var countEndedRollCalls = endedRollCalls.Count;
|
||||
var countNotEndedRollCalls = notEndedRollCalls.Count;
|
||||
|
||||
var step1 = 1;
|
||||
foreach (var rollCall in endedRollCalls)
|
||||
{
|
||||
rollCall.setStartAndEnd(rollCall.StartDate.Value, rollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{step1} - {countEndedRollCalls} ended Edit {rollCall.id}");
|
||||
step1 += 1;
|
||||
}
|
||||
|
||||
var step2 = 1;
|
||||
foreach (var notEndedRollCall in notEndedRollCalls)
|
||||
{
|
||||
notEndedRollCall.SetStartAgain(notEndedRollCall.StartDate.Value);
|
||||
Console.WriteLine($"{step2} - {countNotEndedRollCalls} not ended startAgain {notEndedRollCall.id}");
|
||||
step2 += 1;
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SetRollCall(List<global::Company.Domain.RollCallAgg.RollCall> r1)
|
||||
{
|
||||
|
||||
var endedRollCalls2 = r1.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.ClearTimeDiff();
|
||||
_context.SaveChanges();
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
private void SetRollCall2(List<global::Company.Domain.RollCallAgg.RollCall> r2)
|
||||
{
|
||||
|
||||
|
||||
var endedRollCalls2 = r2.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
//public async Task<IActionResult> OnPostShiftDate()
|
||||
//{
|
||||
// var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
|
||||
|
||||
// customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
|
||||
// var rollCalls =
|
||||
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
// .ToList();
|
||||
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.SetShiftDate(_rollCallDomainService);
|
||||
// Console.WriteLine(rollCall.id);
|
||||
// }
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
// ViewData["message"] = "تومام";
|
||||
// return Page();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +71,12 @@
|
||||
<script src="~/assetsclient/libs/wordifyfa/wordifyfa.min.js"></script>
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var employeeListAjax = `@Url.Page("./EmployeeList", "EmployeeList")`;
|
||||
var dayOfWeekDataUrl = `@Url.Page("./EmployeeList", "DayOfWeek")`;
|
||||
var saveLeftWorkAjax = `@Url.Page("./EmployeeList", "CreateEmployeeLeftWork")`;
|
||||
var employeeListAjax = `@Url.Page("./EmployeeList", "EmployeeList")`; // EmployeeList Handler
|
||||
var dayOfWeekDataUrl = `@Url.Page("./EmployeeList", "DayOfWeek")`; // EmployeeList Handler
|
||||
var saveLeftWorkAjax = `@Url.Page("./EmployeeList", "CreateEmployeeLeftWork")`; // EmployeeList Handler
|
||||
|
||||
var employeeListHomeAjax = `@Url.Page("/Index", "LeftWorkEmployeeList")`; // Home Handler
|
||||
var dayOfWeekDataHomeUrl = `@Url.Page("/Index", "DayOfWeek")`; // Home Handler
|
||||
var saveLeftWorkHomeAjax = `@Url.Page("/Index", "CreateEmployeeLeftWork")`; // Home Handler
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/Employees/js/ModalCreateLeftWorkEmployee.js?ver=@clientVersion"></script>
|
||||
@@ -268,6 +268,9 @@ function htmlLoadSimpleData(loadRewardListData, responsePageIndex) {
|
||||
${n}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width7">
|
||||
<div class="Rtable-cell--content ">${item.grantDateFa}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell justify-content-start width2">
|
||||
<div class="Rtable-cell--content text-start">${item.employeeFullName}</div>
|
||||
@@ -278,16 +281,18 @@ function htmlLoadSimpleData(loadRewardListData, responsePageIndex) {
|
||||
<div class="Rtable-cell d-md-block d-none width4">
|
||||
<div class="Rtable-cell--content ">${item.title ?? "-"}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width6">
|
||||
<div class="tooltipfull-container">
|
||||
<div class="Rtable-cell--content ellipsed" style="width: 280px;">${item.description}</div>
|
||||
<span class="tooltipfull">
|
||||
<span>${item.description}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width5">
|
||||
<div class="Rtable-cell--content ">${item.amount}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width6">
|
||||
<div class="Rtable-cell--content " style="text-overflow: ellipsis;overflow: hidden;width: 90%;white-space: nowrap;">${item.description}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width7">
|
||||
<div class="Rtable-cell--content ">${item.grantDateFa}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="Rtable-cell width8">
|
||||
<div class="Rtable-cell--content align-items-center justify-content-end d-flex text-end">
|
||||
<button type="button" class="btn-print d-md-none d-none" onclick="printReward()">
|
||||
@@ -434,8 +439,7 @@ function htmlLoadSimpleData(loadRewardListData, responsePageIndex) {
|
||||
pageIndexJs++;
|
||||
});
|
||||
|
||||
|
||||
pageIndexJs = pageIndex + responsePageIndex;
|
||||
//pageIndexJs = pageIndexJs + responsePageIndex;
|
||||
$('#PageIndex').val(pageIndexJs);
|
||||
|
||||
$('#rewardListAjax').append(html);
|
||||
@@ -491,16 +495,15 @@ function htmlLoadWithEmployeeData(loadRewardListData, responsePageIndex) {
|
||||
<div class="Rtable-cell d-md-flex justify-content-center d-none width53">
|
||||
<div class="Rtable-cell--content">${item.personnelCode}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width6">
|
||||
<div class="Rtable-cell--content ">${item.amount}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width7">
|
||||
<div class="Rtable-cell--content " style="text-overflow: ellipsis;overflow: hidden;width: 90%;white-space: nowrap;">${item.description}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width8">
|
||||
<div class="Rtable-cell--content ">${item.grantDateFa}</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell d-md-block d-none width6">
|
||||
<div class="Rtable-cell--content ">${item.amount}</div>
|
||||
</div>
|
||||
<div class="Rtable-cell width9">
|
||||
<div class="Rtable-cell--content align-items-center justify-content-end d-flex text-end">
|
||||
<button type="button" class="btn-print d-md-none d-none" onclick="printReward()">
|
||||
|
||||
BIN
ServiceHost/wwwroot/Excel/Kebab custom shifts.xlsx
Normal file
BIN
ServiceHost/wwwroot/Excel/Kebab custom shifts.xlsx
Normal file
Binary file not shown.
BIN
ServiceHost/wwwroot/Excel/KebabMahdi Custom Salary Sample.xlsx
Normal file
BIN
ServiceHost/wwwroot/Excel/KebabMahdi Custom Salary Sample.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user