Compare commits

...

18 Commits

Author SHA1 Message Date
b2cb3ae173 finish employee unauthorized 2025-06-22 15:05:38 +03:30
a6c25ec8e8 complete front but backend still not finished 2025-06-19 13:51:05 +03:30
7b2eefa954 create employee without auth for client p1 - not finished 2025-06-18 15:31:13 +03:30
3303d4b54a Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-17 13:47:41 +03:30
dba28b4d89 add move task changer in tester 2025-06-16 21:47:28 +03:30
SamSys
41ec3fb9cf InsuranceDeduction OverTime added for checkout 2025-06-16 17:58:55 +03:30
SamSys
7f98cf8f12 Create checkou bug fixed 2025-06-16 13:22:14 +03:30
SamSys
6c8385061e change 2025-06-15 21:02:26 +03:30
SamSys
a49467ee44 EmployeeComputeOption and Workshop new options merged 2025-06-15 21:02:07 +03:30
SamSys
0e66c5e1a0 SaveRollcall checkout merged 2025-06-15 19:16:44 +03:30
SamSys
27a92f5796 changes 2025-06-15 14:32:48 +03:30
6e5788074c fix goverment list calculation for insurance 2025-06-12 00:27:42 +03:30
b29b1335d3 finish saving rollcall to original 2025-06-11 19:00:17 +03:30
24d41ffc68 add rollcall to checkout 2025-06-10 19:10:33 +03:30
SamSys
c6d4d7d473 add checkoutSaveData in MandatoryCompute 2025-06-09 18:46:46 +03:30
c594cbf523 change checkout application 2025-06-09 17:47:23 +03:30
52976d8965 add calculation for create checkout 2025-06-09 16:07:22 +03:30
ec97274d5e add checkout rollcall domain to Checkout 2025-06-09 15:07:06 +03:30
29 changed files with 13098 additions and 2220 deletions

View File

@@ -2,6 +2,7 @@
using AccountManagement.Domain.TaskAgg;
using System;
using System.Collections.Generic;
using System.Linq;
using AccountManagement.Domain.TaskMessageAgg;
namespace AccountManagement.Domain.AssignAgg;
@@ -158,4 +159,24 @@ public class Assign : EntityBase
IsDoneRequest=isDoneRequest;
DoneDescription=doneDescription;
}
public void ChangeAssignedId(long assignedId)
{
AssignedId = assignedId;
}
public void SetAssignerId(long assignerId)
{
AssignerId = assignerId;
}
public void ChangeSender(long senderId)
{
Task.SetSender(senderId);
var taskMessageItemsEnumerable =TaskMessageList.SelectMany(m => m.TaskMessageItemsList);
foreach (var taskMessageItems in taskMessageItemsEnumerable)
{
taskMessageItems.SetSenderId(senderId);
}
}
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using _0_Framework.Domain;
using AccountManagement.Domain.AssignAgg;
using AccountManagement.Domain.TaskMediaAgg;
using AccountManagement.Domain.TaskScheduleAgg;
using OfficeOpenXml.Style;
namespace AccountManagement.Domain.TaskAgg;
@@ -80,4 +82,40 @@ public class Tasks : EntityBase
TaskScheduleId = taskScheduleId;
}
public void ChangeSender(long senderId)
{
var prevSender = SenderId;
var assigners = Assigns.Where(x => x.AssignerId == prevSender).ToList();
foreach (var assigner in assigners)
{
assigner.SetAssignerId(senderId);
}
var senderMessageItem = Assigns
.SelectMany(x=>x.TaskMessageList
.SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.SenderAccountId == prevSender).ToList();
var receiverMessageItem = Assigns.SelectMany(x=>x.TaskMessageList
.SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.ReceiverAccountId == prevSender).ToList();
SenderId = senderId;
foreach (var taskMessageItems in senderMessageItem)
{
taskMessageItems.SetSenderId(senderId);
}
foreach (var taskMessageItems in receiverMessageItem)
{
taskMessageItems.SetReceiver(senderId);
}
}
public void SetSender(long senderId)
{
SenderId = senderId;
}
}

View File

@@ -19,4 +19,13 @@ public class TaskMessageItems:EntityBase
public TaskMessage TaskMessage { get; set; }
public void SetSenderId(long senderId)
{
SenderAccountId = senderId;
}
public void SetReceiver(long receiverId)
{
ReceiverAccountId = receiverId;
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using _0_Framework.Application;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
using Company.Domain.WorkshopAgg;
@@ -29,7 +30,7 @@ public class Checkout : EntityBase
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection<CheckoutLoanInstallment> loanInstallments,
ICollection<CheckoutSalaryAid> salaryAids)
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -88,6 +89,7 @@ public class Checkout : EntityBase
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
LoanInstallments = loanInstallments;
SalaryAids = salaryAids;
CheckoutRollCall = checkoutRollCall;
}
public string EmployeeFullName { get; private set; }
@@ -196,7 +198,8 @@ public class Checkout : EntityBase
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
#endregion
public CheckoutRollCall CheckoutRollCall { get; private set; }
#endregion
public Workshop Workshop { get; set; }
@@ -308,4 +311,149 @@ public class Checkout : EntityBase
LoanInstallments = lonaInstallments;
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; }
}

View File

@@ -137,4 +137,110 @@ public class CheckoutViewModel
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
public List<LoanInstallmentViewModel> InstallmentViewModels { 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; }
}

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.YearlySalary;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -138,4 +139,20 @@ public class CreateCheckout
public string ShiftWork { get; set; }
/// <summary>
/// محاسبه اضافه کار در بیمه
/// </summary>
public bool HasInsuranceChekoutOverTime {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; }
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.SalaryAid;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -45,6 +46,15 @@ public class ComputingViewModel
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;
}

View File

@@ -28,6 +28,8 @@ public class CreateEmployeeByClient
public List<AddEmployeeDocumentItem> EmployeeDocumentItems { get; set; }
public bool HasEmployeeDocument { get; set; }
public bool HasRollCallService { get; set; }
public bool CanceledAuthorize { get; set; }
public string BirthDate { get; set; }
}

View File

@@ -17,6 +17,7 @@ public record EmployeeByNationalCodeInWorkshopViewModel
public long PersonnelCode { get; set; }
public List<EmployeeByNationalCodeEmployeeBankInfoViewModel> EmployeeBankInfos { get; set; }
public EmployeeByNationalCodeEmployeeDocumentViewModel EmployeeDocument { get; set; }
public bool AuthorizedCanceled { get; set; }
}

View File

@@ -6,10 +6,12 @@ public class ShiftList
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
/// <summary>
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
/// </summary>
public TimeSpan LateEntryDuration { get; set; }
public DateTime EndWithOutResTime { get; set; }
/// <summary>
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
/// </summary>
public TimeSpan LateEntryDuration { get; set; }
/// <summary>
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)

View File

@@ -14,6 +14,15 @@ using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Leave;
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;
@@ -27,11 +36,13 @@ public class CheckoutApplication : ICheckoutApplication
private readonly ILeaveApplication _leaveApplication;
private readonly IMandatoryHoursApplication _mandatoryHoursApplication;
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
private readonly IRollCallRepository _rollCallRepository;
private readonly IHolidayItemApplication _holidayItemApplication;
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
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;
_yearlySalaryRepository = yearlySalaryRepository;
@@ -41,6 +52,8 @@ public class CheckoutApplication : ICheckoutApplication
_leaveApplication = leaveApplication;
_mandatoryHoursApplication = mandatoryHoursApplication;
_rollCallMandatoryRepository = rollCallMandatoryRepository;
_rollCallRepository = rollCallRepository;
_holidayItemApplication = holidayItemApplication;
}
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
@@ -156,10 +169,16 @@ public class CheckoutApplication : ICheckoutApplication
//فوق العاده جمعه کاری
command.FridayPay = fridayPercent * command.friday;
}
//حق بیمه سهم کارگر
var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance) * 7 / 100;
//حق بیمه سهم کارگر
#region InsuranceDeduction
if (command.OvertimePay > 0 && command.AbsenceDeduction > 0)
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
#endregion
if (command.OvertimePay > 0 && command.AbsenceDeduction > 0)
{
if (command.AbsenceDeduction >= command.OvertimePay)
{
@@ -189,6 +208,125 @@ public class CheckoutApplication : ICheckoutApplication
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 +
command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
var totalClaims = totalClaimsDouble.ToMoney();
@@ -215,7 +353,9 @@ public class CheckoutApplication : ICheckoutApplication
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.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.SaveChanges();
@@ -326,26 +466,32 @@ public class CheckoutApplication : ICheckoutApplication
var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks));
var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks));
TimeSpan totalPresent = totalWorking + totalBreakTime;
if (x.HasRollCall)
if (x.CheckoutRollCall == null)
{
totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - x.TotalHourlyLeave;
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
totalPresent = totalWorking + totalBreakTime ;
}
else
{
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
totalPresent = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
totalWorking = totalPresent - totalBreakTime;
}
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, "-");
if (x.HasRollCall)
{
totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) -
x.TotalHourlyLeave;
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
totalPresent = totalWorking + totalBreakTime;
}
else
{
totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
totalPresent = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
totalWorking = totalPresent - totalBreakTime;
}
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;
}
@@ -375,7 +521,7 @@ public class CheckoutApplication : ICheckoutApplication
{
totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - result.TotalHourlyLeave;
totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
totalPresent = totalWorking + totalBreakTime ;
totalPresent = totalWorking + totalBreakTime;
}
else
{

View File

@@ -995,10 +995,24 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
//{
// return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد");
//}
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode);
var workshop = _WorkShopRepository.GetDetails(command.WorkshopId);
if (employee == null)
if (employee == null && command.CanceledAuthorize)
{
var birthDate = command.BirthDate.ToGeorgianDateTime();
var dateOfIssue = new DateTime(1922, 1, 1);
employee = new Employee(command.FirstName, command.LastName, null, birthDate,
dateOfIssue, null, command.NationalCode, null, command.Gender, "ایرانی", null, null);
_EmployeeRepository.Create(employee);
_EmployeeRepository.SaveChanges();
}
if (employee == null)
{
return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
}
@@ -1241,6 +1255,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (employee == null)
{
var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (personalInfo.ResponseContext.Status.Code == 14)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",new EmployeeByNationalCodeInWorkshopViewModel(){AuthorizedCanceled = true});
}
if (personalInfo.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");

View File

@@ -176,6 +176,8 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
_leftWorkTempRepository.Remove(leftWorkTemp);
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
return op.Succcedded();
}

View File

@@ -1,5 +1,6 @@
using System;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.CheckoutAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -73,5 +74,28 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
salaryAid.Property(x => x.Amount).HasMaxLength(25);
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);
});
});
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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");
}
}
}

View File

@@ -6197,6 +6197,117 @@ namespace CompanyManagment.EFCore.Migrations
.OnDelete(DeleteBehavior.Cascade)
.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 =>
{
b1.Property<long>("Checkoutid")
@@ -6284,6 +6395,8 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("Checkoutid");
});
b.Navigation("CheckoutRollCall");
b.Navigation("LoanInstallments");
b.Navigation("SalaryAids");

File diff suppressed because it is too large Load Diff

View File

@@ -125,10 +125,11 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => new GroupedRollCalls()
{
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 != null ? s.ShiftEndWithoutRest.Value : new DateTime()}).ToList(),
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();
}
@@ -161,7 +162,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
return new GroupedRollCalls()
{
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(),
HasFriday = x.Any(s =>
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;
int minutes = (int)minutesDecimal;
TimeSpan totalLeaveSpan = TimeSpan.Zero;
TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0);
if (leaveSearchResult.Count > 0)
if (leaveSearchResult.Count > 0 || hoursesleave.Count > 0)
{
if (leaveSearchResult.Any(x => x.HasShiftDuration))
{
@@ -276,8 +277,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
}
}
totalLeaveSpan = totalLeave;
}
else
{
int leavingDayCout = 0;
@@ -326,7 +327,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
{
sumSpans = sumSpans.Add(sumLeave);
}
}
totalLeaveSpan = sumLeave;
}
}
@@ -358,9 +361,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
//***********************************//
var dailyFix = TimeSpan.Parse("07:20");
TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays);
TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan);
//var dailyFix = TimeSpan.Parse("07:20");
//TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays);
//TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan);
double mandatoryWorkWithOutleaves = (sumSpansWhitOutleaves.TotalMinutes) / 60;
double overTimeWork = 0;
@@ -733,11 +736,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}",
@@ -765,8 +787,18 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
TotalHolidayAndNotM = totalHolidaysAndNotM.ToString(),
DayliFeeComplete = dayliFeeComplete,
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
return res;
@@ -2302,6 +2334,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
EndDate = shift2EndGr,
ShiftSpan = (shift2EndGr - shift2StartGr),
ShiftDate = shift1?.ShiftDate ?? shift2EndGr,
ShiftEndWithoutRest = shift2EndGr,
});
}
else
@@ -2317,7 +2350,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
EndDate = shift2EndGr,
ShiftSpan = (shift2EndGr - hourseLeaveTypeResult.EndLeaveGr),
ShiftDate = shift1?.EndDate ?? shift2EndGr,
});
ShiftEndWithoutRest = shift2EndGr,
});
}
else if (hourseLeaveTypeResult.StartLeaveGr > shift2StartGr && hourseLeaveTypeResult.EndLeaveGr < shift2EndGr)
{
@@ -2329,7 +2363,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
EndDate = hourseLeaveTypeResult.StartLeaveGr,
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift2StartGr),
ShiftDate = shift1?.EndDate ?? shift2EndGr,
});
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr,
});
result.Add(new RollCallViewModel()
{
@@ -2337,7 +2372,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
EndDate = shift2EndGr,
ShiftSpan = (shift2EndGr - hourseLeaveTypeResult.EndLeaveGr),
ShiftDate = shift1?.EndDate ?? shift2EndGr,
});
ShiftEndWithoutRest = shift2EndGr,
});
}
else if (hourseLeaveTypeResult.StartLeaveGr > shift2StartGr && hourseLeaveTypeResult.EndLeaveGr >= shift2EndGr)
{
@@ -2350,7 +2386,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
EndDate = hourseLeaveTypeResult.StartLeaveGr,
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift2StartGr),
ShiftDate = shift1?.EndDate ?? shift2EndGr,
});
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr,
});
}

View File

@@ -56,7 +56,7 @@ public class IndexModel : PageModel
private readonly IWorkshopApplication _workshopApplication;
private readonly IYearlySalaryApplication _yearlySalaryApplication;
private readonly IYearlySalaryRepository _yearlySalaryRepository;
public List<CheckoutViewModel> chekoutlist;
public List<ComputingViewModel> ComputingView;
@@ -485,7 +485,10 @@ public class IndexModel : PageModel
TotalHolidaysAndNotH = mandatoryCompute.TotalHolidayAndNotH,
TotalHolidaysAndNotM = mandatoryCompute.TotalHolidayAndNotM,
DailFeeComplete = mandatoryCompute.DayliFeeComplete,
Signature = checkout.Signature
Signature = checkout.Signature,
};
_checkoutApplication.Create(command);
//if (checkout.Signature == "1")
@@ -963,7 +966,21 @@ public class IndexModel : PageModel
TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0",
HolidayWorking = workshop.WorkshopHolidayWorking,
ShiftWork = workingHours.ShiftWork,
};
TotalWorkingTimeSpan=mandatoryCompute.TotalWorkingTimeSpan,
TotalBreakTimeSpan=mandatoryCompute.TotalBreakTimeSpan,
TotalPresentTimeSpan=mandatoryCompute.TotalPresentTimeSpan,
TotalPaidLeave=mandatoryCompute.TotalPaidLeave,
TotalSickLeave=mandatoryCompute.TotalSickLeave,
GroupedRollCalls = mandatoryCompute.GroupedRollCalls,
HasInsuranceChekoutOverTime = workshop.InsuranceCheckoutOvertime
};
_checkoutApplication.Create(command);
//var workshopId = $"{contract.WorkshopIds}";

View File

@@ -189,6 +189,7 @@ public class IndexModel : PageModel
double benefitsIncludedContinuous = 0;
double sumOfIncludedKarfarma = 0;
var hasKarfarma = false;
var karfamaCount = 0;
double countWithoutLeft = 0;
double sumOfBaseYears = 0;
double sumOfMarriedAllowance = 0;
@@ -254,7 +255,15 @@ public class IndexModel : PageModel
if (employeeDetailsForInsuranceList[i].JobCode == "024398") //کارفرما
{
hasKarfarma = true;
sumOfIncludedKarfarma = employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
sumOfIncludedKarfarma += employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
karfamaCount++;
}
else
{
//Mahan Changes
//مجموع حقوق ماهیانه خالص
sumOfMonthlySalaryWithoutBaseYears +=
GetRoundValueWhitGovermentlist(yearlySalaryDailyWage * employeeDetailsForInsuranceList[i].WorkingDays, typeOfInsuranceSendWorkshop);
}
sumOfWorkingDays = sumOfWorkingDays + employeeDetailsForInsuranceList[i].WorkingDays;
@@ -265,10 +274,7 @@ public class IndexModel : PageModel
sumOfDailyWagePlusBaseYear += employeeDetailsForInsuranceList[i].DailyWagePlusBaseYears;
//Mahan Changes
//مجموع حقوق ماهیانه خالص
sumOfMonthlySalaryWithoutBaseYears +=
GetRoundValueWhitGovermentlist(yearlySalaryDailyWage * employeeDetailsForInsuranceList[i].WorkingDays, typeOfInsuranceSendWorkshop);
if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود
sumOfBenefitIncludedAndNotIncluded += employeeDetailsForInsuranceList[i].IncludedAndNotIncluded;
@@ -283,48 +289,85 @@ public class IndexModel : PageModel
var totalEmployee = sumOfEmployees;
//sumOfEmployees = sumOfEmployees - countWithoutLeft;
#region heydari
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 5 && !hasKarfarma)
//console.log(1);
employerShare = 0;
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 6 && hasKarfarma)
var workingEmployeesCount = sumOfEmployees - countWithoutLeft; //تعداد کارگران بدون ترک کار
if (hasKarfarma)
{
//console.log(sumOfIncludedKarfarma);
var result = sumOfIncludedKarfarma * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
workingEmployeesCount -= karfamaCount; //تعداد کارگران بدون ترک کار و بدون کارفرما
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft >= 6 && !hasKarfarma)
{
//ابتدا جمع کل مزایا به دست می آید
//جمع کل مزایا تقسیم بر تعداد کارگران منهای کسانی که ترک کار کرده اند.
//حاصل عبارت بالا در 5 ضرب میشو یعنی میانگینی برای محاسبه قیمت 5 نفر حساب می کنیم تا از طریق دولت پرداخت شود
var result = (sumOfIncluded - sumOfIncluded / (sumOfEmployees - countWithoutLeft) * 5) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft > 6 && hasKarfarma)
{
// console.log(4);
//مجموع حقوق و مزایای ماهانه مشمول - حقوق و مزایای ماهانه مشمول کارفرما
var sum = sumOfIncluded - sumOfIncludedKarfarma; //ستون مربوط به کارفرما محاسبه نمی شود
var result = (sum - sum / (sumOfEmployees - countWithoutLeft - 1) * 5 + sumOfIncludedKarfarma) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
//اگر گارگاه کمک دولت بود بعد از اجرای فرمول ها
//بیست درصد از اختلاف ( مجموع حقوق خالص با مجموع مزایای مشمول ) به سهم کارفرما اضافه میشود
if (typeOfInsuranceSendWorkshop == "Govermentlist")
{
var result = ((sumOfIncluded - sumOfMonthlySalaryWithoutBaseYears) * 20 / 100);
employerShare += GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
if (workingEmployeesCount <= 5)
{
var result = ((sumOfIncluded - sumOfMonthlySalaryWithoutBaseYears) * 20 / 100);
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
if (hasKarfarma)
{
employerShare += (sumOfIncludedKarfarma * 20 / 100);
}
}
else
{
var governmentPay = (sumOfMonthlySalaryWithoutBaseYears / workingEmployeesCount) * 5;
var extraAmount = sumOfMonthlySalaryWithoutBaseYears - governmentPay;
var employeeSumOfIncluded = sumOfIncluded - sumOfIncludedKarfarma;
var employeesBenefits = employeeSumOfIncluded - sumOfMonthlySalaryWithoutBaseYears;
var result = extraAmount + employeesBenefits;
employerShare = result * 20 / 100;
if (hasKarfarma)
{
var karfarmaShare = sumOfIncludedKarfarma * 20 / 100;
employerShare += GetRoundValueWhitGovermentlist(karfarmaShare, typeOfInsuranceSendWorkshop);
}
}
}
#endregion
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 5 && !hasKarfarma)
//{
// employerShare = 0;
//}
////console.log(1);
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 6 && hasKarfarma)
//{
// //console.log(sumOfIncludedKarfarma);
// var result = sumOfIncludedKarfarma * 20 / 100;
// employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft >= 6 && !hasKarfarma)
//{
// //ابتدا جمع کل مزایا به دست می آید
// //جمع کل مزایا تقسیم بر تعداد کارگران منهای کسانی که ترک کار کرده اند.
// //حاصل عبارت بالا در 5 ضرب میشو یعنی میانگینی برای محاسبه قیمت 5 نفر حساب می کنیم تا از طریق دولت پرداخت شود
// var result = (sumOfIncluded - sumOfIncluded / (sumOfEmployees - countWithoutLeft) * 5) * 20 / 100;
// employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft > 6 && hasKarfarma)
//{
// // console.log(4);
// //مجموع حقوق و مزایای ماهانه مشمول - حقوق و مزایای ماهانه مشمول کارفرما
// var sum = sumOfIncluded - sumOfIncludedKarfarma; //ستون مربوط به کارفرما محاسبه نمی شود
// var result = (sum - sum / (sumOfEmployees - countWithoutLeft - 1) * 5 + sumOfIncludedKarfarma) * 20 / 100;
// employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
//}
////اگر گارگاه کمک دولت بود بعد از اجرای فرمول ها
////بیست درصد از اختلاف ( مجموع حقوق خالص با مجموع مزایای مشمول ) به سهم کارفرما اضافه میشود
//if (typeOfInsuranceSendWorkshop == "Govermentlist")
//{
//}
//sumOfIncluded مجموع حقوق و مزایای ماهیانه مشمول
// عادی

View File

@@ -458,7 +458,7 @@
<span class="btn btn-deactive waves-effect waves-light contractDuration" data-duration="12">1 ساله</span>
</div>
<div>
<span class="btn btn-deactive waves-effect waves-light contractDuration" data-duration="permanent">دائمی</span>
<span class="btn btn-deactive waves-effect waves-light contractDuration disable" data-duration="permanent">دائمی</span>
</div>
<input type="hidden" id="asp-contract-hidden" asp-for="Command.ContractTerm" />
</div>

View File

@@ -33,8 +33,8 @@
</div>
</div>
<div class="col-6 col-md-12 pe-1 custom-pe-md-3 form-personal my-1">
<div class="input-group shadow-none disable">
<div class="col-6 col-md-12 pe-1 custom-pe-md-3 form-personal my-1">
<div id="nationalCodeS2Section" class="input-group shadow-none disable">
<label class="input-group-text d-flex justify-content-center align-items-center" for="nationalCodeStep2">کد ملی</label>
<input class="form-control text-center" name="Command.NationalCode" pattern="[0-9]*" inputmode="numeric" id="nationalCodeStep2" style="direction: ltr">
</div>
@@ -45,7 +45,7 @@
<div class="col-6 col-md-12 ps-1 custom-ps-md-3 form-personal my-1">
<div class="input-group shadow-none disable">
<div id="birthDateS2Section" class="input-group shadow-none disable">
<label class="input-group-text d-flex justify-content-center align-items-center" for="birthDateStep2">تاریخ تولد</label>
<input class="form-control text-center" name="Command.BirthDate" pattern="[0-9]*" inputmode="numeric" id="birthDateStep2" style="direction: ltr">
</div>
@@ -70,8 +70,8 @@
</div>
</div>
<div class="col-lg-6 col-6 form-personal checkByNationalCode disable mightBeNullDB2 my-1">
<div class="input-group">
<div id="genderS2Section" class="col-lg-6 col-6 form-personal checkByNationalCode disable mightBeNullDB2 my-1">
<div class="input-group validGender">
<label class="input-group-text d-flex justify-content-center align-items-center">جنسیت</label>
<div class="inputGroup-sizing-marriage d-flex align-items-center justify-content-center">
<input class="form-check-input genderStatus" type="radio" id="gender1" name="Command.Gender" value="مرد" required>
@@ -89,7 +89,7 @@
</div>
</div>
<div class="col-lg-6 col-6 checkByNationalCode disable mightBeNullDB3 form-personal my-1" style="padding-right: 0;">
<div id="marriageS2Section" class="col-lg-6 col-6 checkByNationalCode disable mightBeNullDB3 form-personal my-1" style="padding-right: 0;">
<div class="input-group validMariage">
<label class="input-group-text d-flex justify-content-center align-items-center">وضیعت تاهل</label>
<div class="inputGroup-sizing-marriage d-flex align-items-center justify-content-center">
@@ -111,28 +111,28 @@
</div>
</div>
<div class="col-6 col-md-12 pe-1 custom-pe-md-3 checkByNationalCode mightBeNullDB4 disable">
<div id="nameS2Section" class="col-6 col-md-12 pe-1 custom-pe-md-3 checkByNationalCode mightBeNullDB4 disable">
<div class="col-12 my-1">
<span class="spanTitleText">نام پرسنل</span>
<input type="text" class="form-control" id="firstName" name="Command.FirstName" />
</div>
</div>
<div class="col-6 col-md-12 ps-1 custom-ps-md-3 checkByNationalCode mightBeNullDB5 disable">
<div id="fNameS2Section" class="col-6 col-md-12 ps-1 custom-ps-md-3 checkByNationalCode mightBeNullDB5 disable">
<div class="col-12 my-1">
<span class="spanTitleText">نام خانوادگی پرسنل</span>
<input type="text" id="lastName" class="form-control" name="Command.LastName" />
</div>
</div>
<div class="col-6 col-md-12 pe-1 custom-pe-md-3 checkByNationalCode checkByHistoryCode2 mightBeNullDB6 disable">
<div id="startworkS2Section" class="col-6 col-md-12 pe-1 custom-pe-md-3 checkByNationalCode checkByHistoryCode2 mightBeNullDB6 disable">
<div class="col-12 my-1">
<span class="spanTitleText">تاریخ شروع بکار</span>
<input type="text" class="form-control startLeftWorkDate text-center" pattern="[0-9]*" inputmode="numeric" id="startWork" name="Command.StartLeftWork" style="direction: ltr" />
</div>
</div>
<div class="col-6 col-md-12 ps-1 custom-ps-md-3 checkByNationalCode checkByHistoryCode2 mightBeNullDB6 disable">
<div id="jobS2Section" class="col-6 col-md-12 ps-1 custom-ps-md-3 checkByNationalCode checkByHistoryCode2 mightBeNullDB6 disable">
<div class="col-12 my-1">
<span class="spanTitleText">انتخاب سمت</span>
<div class="sematValid" style="border-radius: 7px;">
@@ -142,7 +142,7 @@
</div>
</div>
</div>
<input type="checkbox" id="canceledAuthorizedStep2" name="Command.CanceledAuthorize" style="display: none;" value="false" />
<div class="spinner-loading loading" style="display: none;">
<span class="spinner-border spinner-border-sm text-white" role="status" aria-hidden="true"></span>

View File

@@ -38,13 +38,19 @@
</div>
<div class="col-12 form-personal my-1">
<div class="input-group shadow-none">
<label class="input-group-text d-flex justify-content-center align-items-center custom-size" for="birthDate">تاریخ تولد</label>
<input class="form-control text-center" id="birthDate" pattern="[0-9]*" inputmode="numeric" style="direction: ltr">
</div>
<div class="valid-feedback">
تاریخ تولد را وارد کنید
</div>
<div class="input-group shadow-none">
<label class="input-group-text d-flex justify-content-center align-items-center custom-size" for="birthDate">تاریخ تولد</label>
<input class="form-control text-center" id="birthDate" pattern="[0-9]*" inputmode="numeric" style="direction: ltr">
</div>
<div class="valid-feedback">
تاریخ تولد را وارد کنید
</div>
</div>
<div id="AuthorizedCanceled" class="col-12 p-2 disable">
<input id="authorizedCheckboxInput" type="checkbox"/>
<label>ثبت مشخصات پرسنل بدون احراز هویت</label>
</div>
</div>

View File

@@ -381,7 +381,6 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
}
}
result = _rollCallEmployeeApplication.UploadedImage(employeeId, workshopId);
if (result.IsSuccedded == false)
{

View File

@@ -1,6 +1,8 @@
using System.Diagnostics;
using AccountMangement.Infrastructure.EFCore;
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using CompanyManagment.EFCore;
using Microsoft.EntityFrameworkCore;
using ServiceHost.Areas.AdminNew.Pages.Company.RollCall;
namespace ServiceHost.Test;
@@ -9,18 +11,43 @@ public class Tester
{
private readonly IAdminMonthlyOverviewApplication _adminMonthlyOverviewApplication;
private readonly CompanyContext _companyContext;
public Tester(IAdminMonthlyOverviewApplication adminMonthlyOverviewApplication, CompanyContext companyContext)
private readonly AccountContext _accountContext;
public Tester(IAdminMonthlyOverviewApplication adminMonthlyOverviewApplication, CompanyContext companyContext, AccountContext accountContext)
{
_adminMonthlyOverviewApplication = adminMonthlyOverviewApplication;
_companyContext = companyContext;
_accountContext = accountContext;
}
public async Task Test()
{
// await AdminMonthlyOverviewTest();
//await MoveTasksToAnotherPerson(423, 434);
}
}
public async Task MoveTasksToAnotherPerson(long oldAccount, long newAccount)
{
var receivedTasks = await _accountContext.Assigns.Include(x => x.Task)
.Include(x => x.TaskMessageList)
.ThenInclude(x => x.TaskMessageItemsList).Where(x => x.AssignedId == oldAccount && !x.IsDone && !x.IsCancel).ToListAsync();
foreach (var receivedTaskAssign in receivedTasks)
{
receivedTaskAssign.ChangeAssignedId(newAccount);
}
await _accountContext.SaveChangesAsync();
var senderTasks = await _accountContext.Tasks.Include(x=>x.Assigns)
.ThenInclude(x => x.TaskMessageList)
.ThenInclude(x => x.TaskMessageItemsList).Where(x => x.SenderId == oldAccount && x.Assigns.Any(a=>!a.IsDone && !a.IsCancel) ).ToListAsync();
foreach (var task in senderTasks)
{
task.ChangeSender(newAccount);
}
await _accountContext.SaveChangesAsync();
}
private async Task AdminMonthlyOverviewTest()
{
var acc = _companyContext.WorkshopAccounts.FirstOrDefault(x => x.AccountId == 322);

View File

@@ -12,7 +12,7 @@
//"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]18[3019]#@ATt;TrustServerCertificate=true;",
//local

View File

@@ -5,7 +5,7 @@ $(document).ready(function () {
language: "fa",
dir: "rtl"
});
var jobsLoadAjaxURL = '';
var jobsLoadAjaxURL = '';
if (currentUrl.includes("/Client#showmodal=/Client?handler=CreateEmployee")) {
jobsLoadAjaxURL = jobsLoadHomeAjaxUrl;
} else if (currentUrl.includes("/Client/Company/Employees/EmployeeList")) {
@@ -76,7 +76,7 @@ function checkInputs() {
const startWork = $("#startWork").val().trim();
const startWorkIsValidDate = /^\d{4}[-\/]\d{2}[-\/]\d{2}$/.test(startWork);
const semat = $("#sematSelect").val();
debugger;
let isEmpty = false;
if (!genderSelected || !maritalStatusSelected || !nationality || !fName || !lName || !startWork || !startWorkIsValidDate || semat === "0") {
@@ -88,7 +88,18 @@ function checkInputs() {
validateField(".validMariage", "لطفا وضعیت تاهل را مشخص کنید.");
return false;
}
if (!$("input[name='Command.Gender']:checked").val()) {
validateField(".validGender", "لطفا جنسیت را مشخص کنید.");
return false;
}
if (fName === "") {
validateField("#firstName", "لطفا نام پرسنل را وارد کنید.");
return false;
}
if (lName === "") {
validateField("#lastName", "لطفا نام خانوادگی پرسنل را وارد کنید.");
return false;
}
if (startWork === "") {
validateField("#startWork", "لطفا تاریخ شروع بکار را مشخص کنید");
return false;

View File

@@ -44,6 +44,8 @@ $(document).ready(function () {
lastNationalCode = "";
}
});
});
function checkNationalCodeAndBirthday() {
@@ -82,7 +84,7 @@ function checkNationalCode(nationalCode, birthDate) {
$("#IdentityLoading").show();
$.ajax({
async: false,
//async: false,
url: checkNationalUrl,
method: "GET",
data: { nationalCode: nationalCode, birthDate: birthDate },
@@ -180,7 +182,24 @@ function checkNationalCode(nationalCode, birthDate) {
$("#IdentityLoading").hide();
}
} else {
}
else if (response.data.authorizedCanceled) {
$(".checkByHistoryCode2").removeClass("disable");
$("#AuthorizedCanceled").removeClass("disable");
$("#canceledAuthorizedStep2").prop("checked", true);
$("#canceledAuthorizedStep2").val("true");
$('.alert-msg').show();
$('.alert-msg p').text(response.message);
setTimeout(function () {
$('.alert-msg').hide();
$('.alert-msg p').text(response.message);
}, 3500);
$("#IdentityLoading").hide();
}
else {
//$(".saveData").prop("disabled", true);
$(".checkByNationalCode").each(function () {
$(this).addClass("disable");
@@ -213,4 +232,48 @@ function checkNationalCode(nationalCode, birthDate) {
goToStep2 = false;
}
});
}
$('#authorizedCheckboxInput').change(function () {
if ($(this).is(':checked')) {
let nationalCode = $("#nationalCode").val().trim();
let birthDate = $("#birthDate").val().trim();
if (nationalCode === "") {
validateField("#nationalCode", "لطفا شماره ملی پرسنل را وارد کنید.");
$("#authorizedCheckboxInput").prop("checked", false);
return;
} else if (!/^\d{10}$/.test(nationalCode)) {
validateField("#nationalCode", "شماره ملی باید ۱۰ رقم باشد.");
$("#authorizedCheckboxInput").prop("checked", false);
return;
}
if (birthDate === "") {
validateField("#birthDate", "لطفا تاریخ تولد پرسنل را وارد کنید.");
$("#authorizedCheckboxInput").prop("checked", false);
return;
} else if (!/^\d{4}[-\/]\d{2}[-\/]\d{2}$/.test(birthDate) || birthDate.length !== 10) {
validateField("#birthDate", "تاریخ تولد را به درستی وارد کنید.");
$("#authorizedCheckboxInput").prop("checked", false);
return;
}
$("#nationalCodeS2Section").removeClass("disable");
$("#birthDateS2Section").removeClass("disable");
$("#genderS2Section").removeClass("disable");
$("#marriageS2Section").removeClass("disable");
$("#nameS2Section").removeClass("disable");
$("#fNameS2Section").removeClass("disable");
$("#startworkS2Section").removeClass("disable");
$("#jobS2Section").removeClass("disable");
$("#nationalCodeStep2").val(nationalCode);
$("#birthDateStep2").val(birthDate);
goToStep2 = true;
$("#nextStep1").click();
}
});
}