Compare commits
6 Commits
Feature/Em
...
Feature/Ch
| Author | SHA1 | Date | |
|---|---|---|---|
| b29b1335d3 | |||
| 24d41ffc68 | |||
|
|
c6d4d7d473 | ||
| c594cbf523 | |||
| 52976d8965 | |||
| ec97274d5e |
@@ -3,6 +3,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using _0_Framework.Domain;
|
using _0_Framework.Domain;
|
||||||
|
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
using Company.Domain.CheckoutAgg.ValueObjects;
|
using Company.Domain.CheckoutAgg.ValueObjects;
|
||||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||||
using Company.Domain.WorkshopAgg;
|
using Company.Domain.WorkshopAgg;
|
||||||
@@ -29,7 +30,7 @@ public class Checkout : EntityBase
|
|||||||
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
|
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
|
||||||
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
|
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
|
||||||
ICollection<CheckoutLoanInstallment> loanInstallments,
|
ICollection<CheckoutLoanInstallment> loanInstallments,
|
||||||
ICollection<CheckoutSalaryAid> salaryAids)
|
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall)
|
||||||
{
|
{
|
||||||
EmployeeFullName = employeeFullName;
|
EmployeeFullName = employeeFullName;
|
||||||
FathersName = fathersName;
|
FathersName = fathersName;
|
||||||
@@ -88,6 +89,7 @@ public class Checkout : EntityBase
|
|||||||
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
|
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
|
||||||
LoanInstallments = loanInstallments;
|
LoanInstallments = loanInstallments;
|
||||||
SalaryAids = salaryAids;
|
SalaryAids = salaryAids;
|
||||||
|
CheckoutRollCall = checkoutRollCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string EmployeeFullName { get; private set; }
|
public string EmployeeFullName { get; private set; }
|
||||||
@@ -196,7 +198,8 @@ public class Checkout : EntityBase
|
|||||||
|
|
||||||
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
||||||
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
||||||
#endregion
|
public CheckoutRollCall CheckoutRollCall { get; private set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public Workshop Workshop { get; set; }
|
public Workshop Workshop { get; set; }
|
||||||
@@ -308,4 +311,149 @@ public class Checkout : EntityBase
|
|||||||
LoanInstallments = lonaInstallments;
|
LoanInstallments = lonaInstallments;
|
||||||
InstallmentDeduction = installmentsAmount;
|
InstallmentDeduction = installmentsAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetCheckoutRollCall(CheckoutRollCall checkoutRollCall)
|
||||||
|
{
|
||||||
|
CheckoutRollCall = checkoutRollCall;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CheckoutRollCall
|
||||||
|
{
|
||||||
|
private CheckoutRollCall(){}
|
||||||
|
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
|
||||||
|
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
|
||||||
|
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
|
||||||
|
{
|
||||||
|
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
|
||||||
|
TotalPresentTimeSpan = totalPresentTimeSpan;
|
||||||
|
TotalBreakTimeSpan = totalBreakTimeSpan;
|
||||||
|
TotalWorkingTimeSpan = totalWorkingTimeSpan;
|
||||||
|
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
|
||||||
|
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
|
||||||
|
RollCallDaysCollection = rollCallDaysCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت موظفی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalMandatoryTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت حضور
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalPresentTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت استراحت
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalBreakTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت کارکرد
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalWorkingTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت مرخصی استحقاقی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalPaidLeaveTmeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت مرخصی استعلاجی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalSickLeaveTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// روز های حضور غیاب
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<CheckoutRollCallDay> RollCallDaysCollection { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CheckoutRollCallDay
|
||||||
|
{
|
||||||
|
private CheckoutRollCallDay(){}
|
||||||
|
public CheckoutRollCallDay(DateTime date, string firstStartDate, string firstEndDate,
|
||||||
|
string secondStartDate, string secondEndDate, TimeSpan breakTimeSpan,
|
||||||
|
bool isSliced, TimeSpan workingTimeSpan, bool isAbsent, bool isFriday,
|
||||||
|
bool isHoliday, string leaveType)
|
||||||
|
{
|
||||||
|
Date = date;
|
||||||
|
FirstStartDate = firstStartDate;
|
||||||
|
FirstEndDate = firstEndDate;
|
||||||
|
SecondStartDate = secondStartDate;
|
||||||
|
SecondEndDate = secondEndDate;
|
||||||
|
BreakTimeSpan = breakTimeSpan;
|
||||||
|
IsSliced = isSliced;
|
||||||
|
WorkingTimeSpan = workingTimeSpan;
|
||||||
|
IsAbsent = isAbsent;
|
||||||
|
IsFriday = isFriday;
|
||||||
|
IsHoliday = isHoliday;
|
||||||
|
LeaveType = leaveType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تاریخ
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Date { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ورود اول
|
||||||
|
/// </summary>
|
||||||
|
public string FirstStartDate { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// خروج اول
|
||||||
|
/// </summary>
|
||||||
|
public string FirstEndDate { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ورود دوم
|
||||||
|
/// </summary>
|
||||||
|
public string SecondStartDate { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// خروج دوم
|
||||||
|
/// </summary>
|
||||||
|
public string SecondEndDate { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ساعت استراحت
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan BreakTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مقدار زمان کارکرد
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan WorkingTimeSpan { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا منقطع است؟
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSliced { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا غیبت است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAbsent { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا جمعه است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFriday { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا تعطیل رسمی است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsHoliday { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
|
||||||
|
/// </summary>
|
||||||
|
public string LeaveType { get; private set; }
|
||||||
|
|
||||||
|
public long CheckoutId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -137,4 +137,110 @@ public class CheckoutViewModel
|
|||||||
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
|
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
|
||||||
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; }
|
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; }
|
||||||
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
|
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
|
||||||
|
public CheckoutRollCallViewModel CheckoutRollCall { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CheckoutRollCallViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت موظفی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalMandatoryTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت حضور
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalPresentTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت استراحت
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalBreakTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت کارکرد
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalWorkingTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت مرخصی استحقاقی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalPaidLeaveTmeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع ساعت مرخصی استعلاجی
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TotalSickLeaveTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// روز های حضور غیاب
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<CheckoutRollCallDayViewModel> RollCallDaysCollection { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CheckoutRollCallDayViewModel
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تاریخ
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ورود اول
|
||||||
|
/// </summary>
|
||||||
|
public string FirstStartDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// خروج اول
|
||||||
|
/// </summary>
|
||||||
|
public string FirstEndDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ورود دوم
|
||||||
|
/// </summary>
|
||||||
|
public string SecondStartDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// خروج دوم
|
||||||
|
/// </summary>
|
||||||
|
public string SecondEndDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ساعت استراحت
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan BreakTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مقدار زمان کارکرد
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan WorkingTimeSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا منقطع است؟
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSliced { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا غیبت است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAbsent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا جمعه است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFriday { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا تعطیل رسمی است
|
||||||
|
/// </summary>
|
||||||
|
public bool IsHoliday { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
|
||||||
|
/// </summary>
|
||||||
|
public string LeaveType { get; set; }
|
||||||
|
|
||||||
|
public long CheckoutId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CompanyManagment.App.Contracts.Contract;
|
using CompanyManagment.App.Contracts.Contract;
|
||||||
using CompanyManagment.App.Contracts.Employee;
|
using CompanyManagment.App.Contracts.Employee;
|
||||||
|
using CompanyManagment.App.Contracts.RollCall;
|
||||||
using CompanyManagment.App.Contracts.YearlySalary;
|
using CompanyManagment.App.Contracts.YearlySalary;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
@@ -138,4 +139,15 @@ public class CreateCheckout
|
|||||||
|
|
||||||
public string ShiftWork { get; set; }
|
public string ShiftWork { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<GroupedRollCalls> GroupedRollCalls { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalWorkingTimeSpan { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalBreakTimeSpan { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalPresentTimeSpan { get; set; }
|
||||||
|
public TimeSpan TotalPaidLeave { get; set; }
|
||||||
|
public TimeSpan TotalSickLeave { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using CompanyManagment.App.Contracts.Loan;
|
using CompanyManagment.App.Contracts.Loan;
|
||||||
|
using CompanyManagment.App.Contracts.RollCall;
|
||||||
using CompanyManagment.App.Contracts.SalaryAid;
|
using CompanyManagment.App.Contracts.SalaryAid;
|
||||||
using CompanyManagment.App.Contracts.WorkingHoursTemp;
|
using CompanyManagment.App.Contracts.WorkingHoursTemp;
|
||||||
|
|
||||||
@@ -45,6 +46,15 @@ public class ComputingViewModel
|
|||||||
|
|
||||||
public bool HasRotatingShift { get; set; }
|
public bool HasRotatingShift { get; set; }
|
||||||
|
|
||||||
|
public List<GroupedRollCalls> GroupedRollCalls { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalWorkingTimeSpan { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalBreakTimeSpan { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan TotalPresentTimeSpan { get; set; }
|
||||||
|
public TimeSpan TotalPaidLeave { get; set; }
|
||||||
|
public TimeSpan TotalSickLeave { get; set; }
|
||||||
|
|
||||||
//public List<string> holidays;
|
//public List<string> holidays;
|
||||||
}
|
}
|
||||||
@@ -6,10 +6,12 @@ public class ShiftList
|
|||||||
{
|
{
|
||||||
public DateTime Start { get; set; }
|
public DateTime Start { get; set; }
|
||||||
public DateTime End { get; set; }
|
public DateTime End { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
|
public DateTime EndWithOutResTime { get; set; }
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public TimeSpan LateEntryDuration { get; set; }
|
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan LateEntryDuration { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)
|
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ using CompanyManagment.App.Contracts.Checkout;
|
|||||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||||
using CompanyManagment.App.Contracts.Leave;
|
using CompanyManagment.App.Contracts.Leave;
|
||||||
using CompanyManagment.App.Contracts.MandantoryHours;
|
using CompanyManagment.App.Contracts.MandantoryHours;
|
||||||
|
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||||
|
using Company.Domain.EmployeeAgg;
|
||||||
|
using CompanyManagment.App.Contracts.HolidayItem;
|
||||||
|
using CompanyManagment.App.Contracts.RollCall;
|
||||||
|
using CompanyManagment.EFCore.Migrations;
|
||||||
|
using CompanyManagment.EFCore.Repository;
|
||||||
|
using System.Globalization;
|
||||||
|
using Company.Domain.LeaveAgg;
|
||||||
|
using Company.Domain.WorkshopAgg;
|
||||||
|
|
||||||
namespace CompanyManagment.Application;
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
@@ -27,11 +36,13 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
private readonly ILeaveApplication _leaveApplication;
|
private readonly ILeaveApplication _leaveApplication;
|
||||||
private readonly IMandatoryHoursApplication _mandatoryHoursApplication;
|
private readonly IMandatoryHoursApplication _mandatoryHoursApplication;
|
||||||
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
|
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
|
||||||
|
private readonly IRollCallRepository _rollCallRepository;
|
||||||
|
private readonly IHolidayItemApplication _holidayItemApplication;
|
||||||
|
|
||||||
|
|
||||||
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
|
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
|
||||||
ILeftWorkRepository leftWorkRepository,
|
ILeftWorkRepository leftWorkRepository,
|
||||||
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository)
|
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication)
|
||||||
{
|
{
|
||||||
_checkoutRepository = checkoutRepository;
|
_checkoutRepository = checkoutRepository;
|
||||||
_yearlySalaryRepository = yearlySalaryRepository;
|
_yearlySalaryRepository = yearlySalaryRepository;
|
||||||
@@ -41,6 +52,8 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
_leaveApplication = leaveApplication;
|
_leaveApplication = leaveApplication;
|
||||||
_mandatoryHoursApplication = mandatoryHoursApplication;
|
_mandatoryHoursApplication = mandatoryHoursApplication;
|
||||||
_rollCallMandatoryRepository = rollCallMandatoryRepository;
|
_rollCallMandatoryRepository = rollCallMandatoryRepository;
|
||||||
|
_rollCallRepository = rollCallRepository;
|
||||||
|
_holidayItemApplication = holidayItemApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
|
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
|
||||||
@@ -189,6 +202,125 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var firstDayOfMonth = $"{command.ContractStart.Substring(0, 8)}01".ToGeorgianDateTime();
|
||||||
|
var firstDayOfCurrentMonth = new DateTime(syear, smonth, 1, new PersianCalendar());
|
||||||
|
|
||||||
|
LeaveSearchModel sickLeaveSearch = new LeaveSearchModel()
|
||||||
|
{
|
||||||
|
EmployeeId = command.EmployeeId,
|
||||||
|
WorkshopId = command.WorkshopId,
|
||||||
|
StartLeaveGr = command.ContractStartGr,
|
||||||
|
EndLeaveGr = command.ContractEndGr,
|
||||||
|
IsAccepted = true,
|
||||||
|
};
|
||||||
|
var leaves = _leaveApplication.search(sickLeaveSearch);
|
||||||
|
|
||||||
|
firstDayOfMonth.AddMonthsFa(1, out var lastDayOfCurrentMonth);
|
||||||
|
|
||||||
|
lastDayOfCurrentMonth = lastDayOfCurrentMonth.AddDays(-1);
|
||||||
|
|
||||||
|
int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
|
||||||
|
|
||||||
|
var holidays = _holidayItemApplication.Search(new HolidayItemSearchModel()
|
||||||
|
{
|
||||||
|
HolidayYear = command.ContractStartGr.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 => firstDayOfCurrentMonth.AddDays(offset).Date).ToList();
|
||||||
|
|
||||||
|
var absentRecords = completeDaysList
|
||||||
|
.ExceptBy(command.GroupedRollCalls.Select(x => x.CreationDate.Date), y => y.Date)
|
||||||
|
.Select(x =>
|
||||||
|
{
|
||||||
|
var leave = leaves.FirstOrDefault(y =>
|
||||||
|
y.EmployeeId == command.EmployeeId && y.EndLeaveGr.Date >= x.Date && y.StartLeaveGr.Date <= x.Date);
|
||||||
|
var isHoliday = holidays.Any(y => y.HolidaydateGr == x.Date);
|
||||||
|
var isFriday = x.Date.DayOfWeek == DayOfWeek.Friday;
|
||||||
|
var isNormalWorkingDay = isHoliday == false && isFriday == false;
|
||||||
|
return new CheckoutDailyRollCallViewModel()
|
||||||
|
{
|
||||||
|
StartDate1 = null,
|
||||||
|
EndDate1 = null,
|
||||||
|
DateTimeGr = x.Date,
|
||||||
|
DayOfWeek = x.Date.DayOfWeek.ToString(),
|
||||||
|
RollCallDateFa = x.Date.ToFarsi(),
|
||||||
|
LeaveType = leave != null ? leave.LeaveType : "",
|
||||||
|
IsAbsent = leave == null && isNormalWorkingDay
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
var presentDays = command.GroupedRollCalls.Select(x =>
|
||||||
|
{
|
||||||
|
|
||||||
|
var orderedRollcalls = x.ShiftList.OrderBy(y => y.Start);
|
||||||
|
|
||||||
|
var rollCallTimeSpanPerDay = x.SumOneDaySpan;
|
||||||
|
TimeSpan breakTimePerDay = x.BreakTime;
|
||||||
|
|
||||||
|
return new CheckoutDailyRollCallViewModel()
|
||||||
|
{
|
||||||
|
StartDate1 = orderedRollcalls.FirstOrDefault().Start.ToString("HH:mm"),
|
||||||
|
EndDate1 = orderedRollcalls.FirstOrDefault().EndWithOutResTime.ToString("HH:mm"),
|
||||||
|
|
||||||
|
StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.Start.ToString("HH:mm") ?? "",
|
||||||
|
EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndWithOutResTime.ToString("HH:mm") ?? "",
|
||||||
|
|
||||||
|
TotalhourseSpan = rollCallTimeSpanPerDay,
|
||||||
|
|
||||||
|
BreakTimeTimeSpan = breakTimePerDay,
|
||||||
|
|
||||||
|
DayOfWeek = x.CreationDate.DayOfWeek.DayOfWeeKToPersian(),
|
||||||
|
RollCallDateFa = x.CreationDate.Date.ToFarsi(),
|
||||||
|
DateTimeGr = x.CreationDate.Date,
|
||||||
|
IsSliced = x.ShiftList.Count() > 2,
|
||||||
|
IsAbsent = false
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel
|
||||||
|
{
|
||||||
|
StartDate1 = x.StartDate1,
|
||||||
|
EndDate1 = x.EndDate1,
|
||||||
|
EndDate2 = x.EndDate2,
|
||||||
|
StartDate2 = x.StartDate2,
|
||||||
|
TotalWorkingHours = $"{(int)(x.TotalhourseSpan.TotalHours)}:{x.TotalhourseSpan.Minutes:00}",
|
||||||
|
BreakTimeString = $"{(int)(x.BreakTimeTimeSpan.TotalHours)}:{x.BreakTimeTimeSpan.Minutes:00}",
|
||||||
|
TotalhourseSpan = x.TotalhourseSpan,
|
||||||
|
BreakTimeTimeSpan = x.BreakTimeTimeSpan,
|
||||||
|
DayOfWeek = x.DayOfWeek,
|
||||||
|
RollCallDateFa = x.RollCallDateFa,
|
||||||
|
DateTimeGr = x.DateTimeGr,
|
||||||
|
IsSliced = x.IsSliced,
|
||||||
|
IsAbsent = false
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList();
|
||||||
|
result.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.IsHoliday = holidays.Any(y => x.DateTimeGr.Date == y.HolidaydateGr.Date);
|
||||||
|
x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday;
|
||||||
|
});
|
||||||
|
|
||||||
|
var checkoutRollCallDays = result.Select(x => new CheckoutRollCallDay(x.DateTimeGr,
|
||||||
|
x.StartDate1, x.EndDate1, x.StartDate2, x.EndDate2,
|
||||||
|
x.BreakTimeTimeSpan, x.IsSliced, x.TotalhourseSpan, x.IsAbsent, x.IsFriday, x.IsHoliday, x.LeaveType))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(syear, smonth);
|
||||||
|
int mandatoryWholeHours = (int)mandatoryHours;
|
||||||
|
int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
|
||||||
|
|
||||||
|
var totalMandatoryHours = TimeSpan.FromHours(mandatoryWholeHours).Add(TimeSpan.FromMinutes(mandatoryMinutes));
|
||||||
|
var checkoutRollCall = new CheckoutRollCall(totalMandatoryHours, command.TotalPresentTimeSpan, command.TotalBreakTimeSpan,
|
||||||
|
command.TotalWorkingTimeSpan, command.TotalPaidLeave, command.TotalSickLeave, checkoutRollCallDays);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var totalClaimsDouble = monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + command.OvertimePay +
|
var totalClaimsDouble = monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + command.OvertimePay +
|
||||||
command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
|
command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
|
||||||
var totalClaims = totalClaimsDouble.ToMoney();
|
var totalClaims = totalClaimsDouble.ToMoney();
|
||||||
@@ -215,7 +347,9 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
command.ContractId, command.WorkingHoursId, monthlyWage, bacicYears, consumableItem, housingAllowance
|
command.ContractId, command.WorkingHoursId, monthlyWage, bacicYears, consumableItem, housingAllowance
|
||||||
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
|
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
|
||||||
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
|
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
|
||||||
, command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute, loanInstallments, salaryAids);
|
, command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute,
|
||||||
|
loanInstallments, salaryAids,checkoutRollCall);
|
||||||
|
|
||||||
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
|
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
|
||||||
//_checkoutRepository.SaveChanges();
|
//_checkoutRepository.SaveChanges();
|
||||||
|
|
||||||
@@ -326,26 +460,32 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks));
|
var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks));
|
||||||
var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks));
|
var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks));
|
||||||
TimeSpan totalPresent = totalWorking + totalBreakTime;
|
TimeSpan totalPresent = totalWorking + totalBreakTime;
|
||||||
|
if (x.CheckoutRollCall == null)
|
||||||
if (x.HasRollCall)
|
|
||||||
{
|
{
|
||||||
totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - x.TotalHourlyLeave;
|
if (x.HasRollCall)
|
||||||
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
{
|
||||||
totalPresent = totalWorking + totalBreakTime ;
|
totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) -
|
||||||
}
|
x.TotalHourlyLeave;
|
||||||
else
|
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||||
{
|
totalPresent = totalWorking + totalBreakTime;
|
||||||
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
}
|
||||||
totalPresent = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
|
else
|
||||||
totalWorking = totalPresent - totalBreakTime;
|
{
|
||||||
}
|
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||||
|
totalPresent = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
|
||||||
x.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
|
totalWorking = totalPresent - totalBreakTime;
|
||||||
x.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
|
}
|
||||||
x.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
|
|
||||||
x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
|
|
||||||
|
|
||||||
|
x.TotalWorkingTimeStr =
|
||||||
|
Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
|
||||||
|
x.TotalBreakTimeStr =
|
||||||
|
Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
|
||||||
|
x.TotalPresentTimeStr =
|
||||||
|
Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
|
||||||
|
x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +515,7 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
{
|
{
|
||||||
totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - result.TotalHourlyLeave;
|
totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - result.TotalHourlyLeave;
|
||||||
totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
|
||||||
totalPresent = totalWorking + totalBreakTime ;
|
totalPresent = totalWorking + totalBreakTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
|
using _0_Framework.InfraStructure;
|
||||||
using Company.Domain.CheckoutAgg;
|
using Company.Domain.CheckoutAgg;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
@@ -73,5 +74,28 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
|
|||||||
salaryAid.Property(x => x.Amount).HasMaxLength(25);
|
salaryAid.Property(x => x.Amount).HasMaxLength(25);
|
||||||
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
|
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.OwnsOne(x => x.CheckoutRollCall, rollCall =>
|
||||||
|
{
|
||||||
|
rollCall.Property(x => x.TotalPresentTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.Property(x => x.TotalBreakTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.Property(x => x.TotalWorkingTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.Property(x => x.TotalPaidLeaveTmeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.Property(x => x.TotalSickLeaveTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.Property(x => x.TotalMandatoryTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCall.OwnsMany(x => x.RollCallDaysCollection, rollCallDay =>
|
||||||
|
{
|
||||||
|
rollCallDay.HasKey(x => x.Id);
|
||||||
|
rollCallDay.WithOwner().HasForeignKey(x => x.CheckoutId);
|
||||||
|
|
||||||
|
rollCallDay.Property(x => x.WorkingTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCallDay.Property(x => x.BreakTimeSpan).HasTimeSpanConversion();
|
||||||
|
rollCallDay.Property(x => x.FirstStartDate).HasMaxLength(18);
|
||||||
|
rollCallDay.Property(x => x.FirstEndDate).HasMaxLength(18);
|
||||||
|
rollCallDay.Property(x => x.SecondStartDate).HasMaxLength(18);
|
||||||
|
rollCallDay.Property(x => x.SecondEndDate).HasMaxLength(18);
|
||||||
|
rollCallDay.Property(x => x.LeaveType).HasMaxLength(18);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9832
CompanyManagment.EFCore/Migrations/20250611105314_add rollcall in checkout.Designer.cs
generated
Normal file
9832
CompanyManagment.EFCore/Migrations/20250611105314_add rollcall in checkout.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CompanyManagment.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addrollcallincheckout : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalBreakTimeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalMandatoryTimeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalPaidLeaveTmeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalPresentTimeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalSickLeaveTimeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CheckoutRollCall_TotalWorkingTimeSpan",
|
||||||
|
table: "Checkouts",
|
||||||
|
type: "nvarchar(30)",
|
||||||
|
maxLength: 30,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CheckoutRollCallDay",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Date = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
FirstStartDate = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
|
||||||
|
FirstEndDate = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
|
||||||
|
SecondStartDate = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
|
||||||
|
SecondEndDate = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
|
||||||
|
BreakTimeSpan = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||||
|
WorkingTimeSpan = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||||
|
IsSliced = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
IsAbsent = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
IsFriday = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
IsHoliday = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
LeaveType = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
|
||||||
|
CheckoutId = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CheckoutRollCallDay", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CheckoutRollCallDay_Checkouts_CheckoutId",
|
||||||
|
column: x => x.CheckoutId,
|
||||||
|
principalTable: "Checkouts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CheckoutRollCallDay_CheckoutId",
|
||||||
|
table: "CheckoutRollCallDay",
|
||||||
|
column: "CheckoutId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CheckoutRollCallDay");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalBreakTimeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalMandatoryTimeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalPaidLeaveTmeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalPresentTimeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalSickLeaveTimeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckoutRollCall_TotalWorkingTimeSpan",
|
||||||
|
table: "Checkouts");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6168,6 +6168,117 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("Company.Domain.CheckoutAgg.CheckoutRollCall", "CheckoutRollCall", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<long>("Checkoutid")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalBreakTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalMandatoryTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalPaidLeaveTmeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalPresentTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalSickLeaveTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.Property<string>("TotalWorkingTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b1.HasKey("Checkoutid");
|
||||||
|
|
||||||
|
b1.ToTable("Checkouts");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("Checkoutid");
|
||||||
|
|
||||||
|
b1.OwnsMany("Company.Domain.CheckoutAgg.CheckoutRollCallDay", "RollCallDaysCollection", b2 =>
|
||||||
|
{
|
||||||
|
b2.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property<long>("Id"));
|
||||||
|
|
||||||
|
b2.Property<string>("BreakTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b2.Property<long>("CheckoutId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b2.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b2.Property<string>("FirstEndDate")
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.HasColumnType("nvarchar(18)");
|
||||||
|
|
||||||
|
b2.Property<string>("FirstStartDate")
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.HasColumnType("nvarchar(18)");
|
||||||
|
|
||||||
|
b2.Property<bool>("IsAbsent")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b2.Property<bool>("IsFriday")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b2.Property<bool>("IsHoliday")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b2.Property<bool>("IsSliced")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b2.Property<string>("LeaveType")
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.HasColumnType("nvarchar(18)");
|
||||||
|
|
||||||
|
b2.Property<string>("SecondEndDate")
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.HasColumnType("nvarchar(18)");
|
||||||
|
|
||||||
|
b2.Property<string>("SecondStartDate")
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.HasColumnType("nvarchar(18)");
|
||||||
|
|
||||||
|
b2.Property<string>("WorkingTimeSpan")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(30)
|
||||||
|
.HasColumnType("nvarchar(30)");
|
||||||
|
|
||||||
|
b2.HasKey("Id");
|
||||||
|
|
||||||
|
b2.HasIndex("CheckoutId");
|
||||||
|
|
||||||
|
b2.ToTable("CheckoutRollCallDay");
|
||||||
|
|
||||||
|
b2.WithOwner()
|
||||||
|
.HasForeignKey("CheckoutId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b1.Navigation("RollCallDaysCollection");
|
||||||
|
});
|
||||||
|
|
||||||
b.OwnsMany("Company.Domain.CheckoutAgg.ValueObjects.CheckoutLoanInstallment", "LoanInstallments", b1 =>
|
b.OwnsMany("Company.Domain.CheckoutAgg.ValueObjects.CheckoutLoanInstallment", "LoanInstallments", b1 =>
|
||||||
{
|
{
|
||||||
b1.Property<long>("Checkoutid")
|
b1.Property<long>("Checkoutid")
|
||||||
@@ -6255,6 +6366,8 @@ namespace CompanyManagment.EFCore.Migrations
|
|||||||
.HasForeignKey("Checkoutid");
|
.HasForeignKey("Checkoutid");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
b.Navigation("CheckoutRollCall");
|
||||||
|
|
||||||
b.Navigation("LoanInstallments");
|
b.Navigation("LoanInstallments");
|
||||||
|
|
||||||
b.Navigation("SalaryAids");
|
b.Navigation("SalaryAids");
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -125,10 +125,11 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => new GroupedRollCalls()
|
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => new GroupedRollCalls()
|
||||||
{
|
{
|
||||||
CreationDate = x.Key,
|
CreationDate = x.Key,
|
||||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value,EndWithOutResTime = s.ShiftEndWithoutRest.Value}).ToList(),
|
||||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||||
|
|
||||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))
|
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)),
|
||||||
|
BreakTime = x.First().BreakTimeSpan
|
||||||
|
|
||||||
}).OrderBy(x => x.CreationDate).ToList();
|
}).OrderBy(x => x.CreationDate).ToList();
|
||||||
}
|
}
|
||||||
@@ -161,7 +162,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
return new GroupedRollCalls()
|
return new GroupedRollCalls()
|
||||||
{
|
{
|
||||||
CreationDate = x.Key,
|
CreationDate = x.Key,
|
||||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value })
|
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value, EndWithOutResTime = s.EndDate.Value })
|
||||||
.ToList(),
|
.ToList(),
|
||||||
HasFriday = x.Any(s =>
|
HasFriday = x.Any(s =>
|
||||||
s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday ||
|
s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday ||
|
||||||
@@ -243,9 +244,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
double minutesDecimal = (starndardHoursesPerTotalDays - hours) * 60;
|
double minutesDecimal = (starndardHoursesPerTotalDays - hours) * 60;
|
||||||
int minutes = (int)minutesDecimal;
|
int minutes = (int)minutesDecimal;
|
||||||
|
|
||||||
|
TimeSpan totalLeaveSpan = TimeSpan.Zero;
|
||||||
TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0);
|
TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0);
|
||||||
if (leaveSearchResult.Count > 0)
|
if (leaveSearchResult.Count > 0 || hoursesleave.Count > 0)
|
||||||
{
|
{
|
||||||
if (leaveSearchResult.Any(x => x.HasShiftDuration))
|
if (leaveSearchResult.Any(x => x.HasShiftDuration))
|
||||||
{
|
{
|
||||||
@@ -276,8 +277,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
totalLeaveSpan = totalLeave;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int leavingDayCout = 0;
|
int leavingDayCout = 0;
|
||||||
@@ -326,7 +327,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
{
|
{
|
||||||
sumSpans = sumSpans.Add(sumLeave);
|
sumSpans = sumSpans.Add(sumLeave);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
totalLeaveSpan = sumLeave;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -358,9 +361,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
|
|
||||||
|
|
||||||
//***********************************//
|
//***********************************//
|
||||||
var dailyFix = TimeSpan.Parse("07:20");
|
//var dailyFix = TimeSpan.Parse("07:20");
|
||||||
TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays);
|
//TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays);
|
||||||
TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan);
|
//TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan);
|
||||||
|
|
||||||
double mandatoryWorkWithOutleaves = (sumSpansWhitOutleaves.TotalMinutes) / 60;
|
double mandatoryWorkWithOutleaves = (sumSpansWhitOutleaves.TotalMinutes) / 60;
|
||||||
double overTimeWork = 0;
|
double overTimeWork = 0;
|
||||||
@@ -703,11 +706,30 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Result
|
#region Result
|
||||||
|
LeaveSearchModel sickLeaveSearch = new LeaveSearchModel()
|
||||||
|
{
|
||||||
|
EmployeeId = employeeId,
|
||||||
|
WorkshopId = workshopId,
|
||||||
|
LeaveType = "استعلاجی",
|
||||||
|
PaidLeaveType = "روزانه",
|
||||||
|
StartLeaveGr = contractStart,
|
||||||
|
EndLeaveGr = contractEnd,
|
||||||
|
IsAccepted = true,
|
||||||
|
};
|
||||||
|
var sickLeaveSearchResult = _leaveRepository.search(sickLeaveSearch);
|
||||||
|
|
||||||
var res = new ComputingViewModel()
|
var sickLeaveTimeSpans = sickLeaveSearchResult.Select(x =>
|
||||||
|
{
|
||||||
|
var startLeave = contractStart > x.StartLeaveGr ? contractStart : x.StartLeaveGr;
|
||||||
|
var endLeave = contractEnd < x.EndLeaveGr ? contractEnd : x.EndLeaveGr;
|
||||||
|
|
||||||
|
return (endLeave - startLeave).Add(TimeSpan.FromDays(1));
|
||||||
|
});
|
||||||
|
var totalBreakTime = new TimeSpan(groupedRollCall.Sum(x => x.BreakTime.Ticks));
|
||||||
|
var res = new ComputingViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
NumberOfWorkingDays = $"{groupedRollCall.Count}",
|
NumberOfWorkingDays = $"{groupedRollCall.Count}",
|
||||||
@@ -735,8 +757,18 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
TotalHolidayAndNotM = totalHolidaysAndNotM.ToString(),
|
TotalHolidayAndNotM = totalHolidaysAndNotM.ToString(),
|
||||||
DayliFeeComplete = dayliFeeComplete,
|
DayliFeeComplete = dayliFeeComplete,
|
||||||
MarriedAllowance = MarriedAllowanceStr,
|
MarriedAllowance = MarriedAllowanceStr,
|
||||||
RotatingShiftValue = shiftPayValue
|
RotatingShiftValue = shiftPayValue,
|
||||||
};
|
|
||||||
|
#region SaveRollCall
|
||||||
|
|
||||||
|
GroupedRollCalls = groupedRollCall,
|
||||||
|
TotalWorkingTimeSpan = sumSpansWhitOutleaves,
|
||||||
|
TotalBreakTimeSpan = totalBreakTime,
|
||||||
|
TotalPresentTimeSpan = sumSpansWhitOutleaves + totalBreakTime,
|
||||||
|
TotalPaidLeave = totalLeaveSpan,
|
||||||
|
TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x=>x.Ticks)),
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -485,7 +485,10 @@ public class IndexModel : PageModel
|
|||||||
TotalHolidaysAndNotH = mandatoryCompute.TotalHolidayAndNotH,
|
TotalHolidaysAndNotH = mandatoryCompute.TotalHolidayAndNotH,
|
||||||
TotalHolidaysAndNotM = mandatoryCompute.TotalHolidayAndNotM,
|
TotalHolidaysAndNotM = mandatoryCompute.TotalHolidayAndNotM,
|
||||||
DailFeeComplete = mandatoryCompute.DayliFeeComplete,
|
DailFeeComplete = mandatoryCompute.DayliFeeComplete,
|
||||||
Signature = checkout.Signature
|
Signature = checkout.Signature,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
_checkoutApplication.Create(command);
|
_checkoutApplication.Create(command);
|
||||||
//if (checkout.Signature == "1")
|
//if (checkout.Signature == "1")
|
||||||
@@ -963,7 +966,19 @@ public class IndexModel : PageModel
|
|||||||
TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0",
|
TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0",
|
||||||
HolidayWorking = workshop.WorkshopHolidayWorking,
|
HolidayWorking = workshop.WorkshopHolidayWorking,
|
||||||
ShiftWork = workingHours.ShiftWork,
|
ShiftWork = workingHours.ShiftWork,
|
||||||
};
|
|
||||||
|
TotalWorkingTimeSpan=mandatoryCompute.TotalWorkingTimeSpan,
|
||||||
|
|
||||||
|
TotalBreakTimeSpan=mandatoryCompute.TotalBreakTimeSpan,
|
||||||
|
|
||||||
|
TotalPresentTimeSpan=mandatoryCompute.TotalPresentTimeSpan,
|
||||||
|
|
||||||
|
TotalPaidLeave=mandatoryCompute.TotalPaidLeave,
|
||||||
|
|
||||||
|
TotalSickLeave=mandatoryCompute.TotalSickLeave,
|
||||||
|
GroupedRollCalls = mandatoryCompute.GroupedRollCalls,
|
||||||
|
|
||||||
|
};
|
||||||
_checkoutApplication.Create(command);
|
_checkoutApplication.Create(command);
|
||||||
|
|
||||||
//var workshopId = $"{contract.WorkshopIds}";
|
//var workshopId = $"{contract.WorkshopIds}";
|
||||||
|
|||||||
Reference in New Issue
Block a user