Compare commits

...

46 Commits

Author SHA1 Message Date
87d47fa0d9 feat: remove temporary institution amendment record after saving changes 2025-11-06 12:53:00 +03:30
c7d4481a6d Merge branch 'master' into Feature/InstitutionContract/upgrade
# Conflicts:
#	0_Framework/Application/Sms/ISmsService.cs
#	CompanyManagment.EFCore/Services/SmsService.cs
2025-11-06 12:38:57 +03:30
dff6bc2541 feat: add SMS settings configuration and refactor SMS sending methods for institution creation verification 2025-11-06 12:37:06 +03:30
4b52d144e0 feat: add LawId column to InstitutionContractAmendments migration 2025-11-06 11:57:17 +03:30
90a1683047 feat: add WorkshopName property to institution contract amendment payment workshop response 2025-11-05 18:55:00 +03:30
SamSys
74dca1d2d2 Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-11-04 17:38:29 +03:30
SamSys
a9b4eb6195 some change report admin 2025-11-04 17:37:22 +03:30
SamSys
2125e15fb9 Admin Repoert --> add EmployeeOptionsCheck to report 2025-11-04 17:27:55 +03:30
b7f7d3b223 feat: add HasLeft property to employee settings and update related logic in group settings 2025-11-04 12:15:11 +03:30
d078feccf9 feat: sort institution contract responses by price in descending order 2025-11-02 11:28:29 +03:30
18c27d7a9a fix dates js error 2025-11-02 11:05:27 +03:30
SamSys
c080e11fe0 Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-11-01 13:23:04 +03:30
SamSys
0eb9ecc373 client checkou warning message FrontEnd 2025-11-01 13:21:41 +03:30
470651cb76 feat: add method to remove roll call employee statuses and update handling of left work dates 2025-10-29 18:43:23 +03:30
c6a7e0a0bd feat: add workshop response handling to institution contract amendment payment response 2025-10-29 15:08:14 +03:30
2a9d9574e3 feat: filter employers in institution contract repository to exclude specific contracting party 2025-10-29 12:06:17 +03:30
SamSys
7b1542d5c6 Merge branch 'InsuranceEmployeeShareoCheckout' 2025-10-29 11:11:52 +03:30
SamSys
981fd2d4ee Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-10-29 11:10:15 +03:30
SamSys
7f3f785e39 InsuranceEmployeeShare comput on checkout completed 2025-10-28 19:10:31 +03:30
ca1ef420af feat: add exception for Amir's pizza workshop to adjust roll call date handling 2025-10-28 17:31:43 +03:30
d7baf358cc Merge branch 'Feature/InstitutionContract/print-api' 2025-10-28 14:58:03 +03:30
SamSys
676c8d2fa6 add CheckoutWarningMessage 2025-10-28 14:56:54 +03:30
SamSys
632ab3631b added UseWebSockets 2025-10-28 13:16:56 +03:30
595b2c8a2d feat: update verification date and time properties in institution contract model 2025-10-28 13:15:46 +03:30
fcf2b38457 feat: add previous ID handling and price difference validation to institution contract amendment workshops 2025-10-28 13:13:55 +03:30
c7bace728e feat: integrate workshop repository for roll call workflows 2025-10-28 12:31:08 +03:30
8134216a4a feat: update roll call links to use dynamic domain 2025-10-27 16:46:09 +03:30
SamSys
3d013cfa60 compute insuranceEmployeeShare on checkout 2025-10-27 16:41:02 +03:30
30bfc96cbe Merge branch 'Feature/roll-call/admin-report-api' 2025-10-27 16:29:37 +03:30
7b71bd36b1 feat: add verification status and amendment tracking to institution contract models 2025-10-27 15:22:45 +03:30
5d55118c3c feat: add endpoint to retrieve distinct workshops for roll call reporting 2025-10-27 13:25:20 +03:30
62900a22a1 feat: add amendment verification details retrieval methods and update related classes 2025-10-27 11:30:56 +03:30
280db87408 Merge branch 'Feature/InstitutionContract/print-api' 2025-10-26 14:00:18 +03:30
e6977b29fc feat: add methods for creating institution contract amendment changes and enhance personnel count handling 2025-10-26 14:00:03 +03:30
6e902011ca feat: enhance institution contract verification process and update SMS service methods 2025-10-26 12:21:14 +03:30
7cce903f6e Merge branch 'Feature/InstitutionContract/print-api' into Feature/InstitutionContract/upgrade
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
#	CompanyManagment.Application/InstitutionContractApplication.cs
#	CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
2025-10-26 12:03:39 +03:30
4d6077c93d Merge branch 'refs/heads/master' into Feature/InstitutionContract/upgrade 2025-10-26 11:50:48 +03:30
c5a1e5c274 feat: implement RollCallController and enhance workshop roll call reporting functionality 2025-10-26 11:23:51 +03:30
4c6de6a76f refactor: improve sorting logic in Fine, Loan, and Reward repositories 2025-10-25 17:25:08 +03:30
c36e81e263 feat: update InstitutionContractRepository to enhance workshop change tracking and improve data handling 2025-10-25 15:23:48 +03:30
6b6b0767e3 Merge branch 'master' into Feature/InstitutionContract/print-api 2025-10-23 16:44:36 +03:30
818d88d859 feat: update InstitutionContractAmendmentChange to include roll call options and current workshop ID 2025-10-23 16:32:45 +03:30
6a6e2e532a feat: add print API for institution contracts and include verifier details 2025-10-23 14:13:55 +03:30
1a70569a36 feat: implement amendment completion functionality with payment details 2025-10-23 11:44:12 +03:30
8d24339f04 Merge branch 'master' into Feature/InstitutionContract/upgrade
# Conflicts:
#	ServiceHost/Areas/Admin/Controllers/institutionContractController.cs
2025-10-23 09:29:05 +03:30
bea858d4e7 feat: add AmendmentComplete method and request class to InstitutionContractApplication 2025-10-22 13:33:30 +03:30
77 changed files with 81115 additions and 1342 deletions

View File

@@ -0,0 +1,15 @@
namespace _0_Framework.Application.Enums;
public enum TypeOfCheckoutWarning
{
/// <summary>
/// هشدار های متفرقه
/// </summary>
OthersWarning,
/// <summary>
/// هشدار سهم بیمه کارگر
/// </summary>
InsuranceEmployeeShare,
}

View File

@@ -27,7 +27,8 @@ public interface ISmsService
Task<double> GetCreditAmount();
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.AccessControl;
using _0_Framework.Application;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
@@ -12,25 +13,25 @@ namespace Company.Domain.CheckoutAgg;
public class Checkout : EntityBase
{
private Checkout()
{
}
public Checkout()
{
}
public Checkout(string employeeFullName, string fathersName, string nationalCode, string dateOfBirth,
long employeeId, string workshopName, long workshopId, string contractNo, DateTime contractStart,
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
double monthlySalary, double baseYearsPay, double consumableItems, double housingAllowance,
double overtimePay, double nightworkPay, double fridayPay, double missionPay, double shiftPay,
double familyAllowance, double bonusesPay, double yearsPay, double leavePay,
double insuranceDeduction, double taxDeducation, double installmentDeduction,
double salaryAidDeduction, double absenceDeduction, string sumOfWorkingDays
, string archiveCode, string personnelCode,
, string archiveCode, string personnelCode,
string totalClaims, string totalDeductions, double totalPayment, string signature, double marriedAllowance, bool leaveCheckout,
double creditLeaves, double absencePeriod, double averageHoursPerDay, bool hasRollCall, string overTimeWorkvalue,
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection<CheckoutLoanInstallment> loanInstallments,
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall,TimeSpan employeeMandatoryHours)
ICollection<CheckoutSalaryAid> salaryAids, CheckoutRollCall checkoutRollCall, TimeSpan employeeMandatoryHours, bool hasInsuranceShareTheSameAsList)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -91,6 +92,7 @@ public class Checkout : EntityBase
SalaryAids = salaryAids;
CheckoutRollCall = checkoutRollCall;
EmployeeMandatoryHours = employeeMandatoryHours;
HasInsuranceShareTheSameAsList = hasInsuranceShareTheSameAsList;
}
@@ -99,7 +101,7 @@ public class Checkout : EntityBase
public string Signature { get; private set; }
public string FathersName { get; private set; }
public string NationalCode { get; private set; }
public string DateOfBirth { get; private set; }
public string DateOfBirth { get; private set; }
public long EmployeeId { get; private set; }
public string WorkshopName { get; private set; }
@@ -135,7 +137,7 @@ public class Checkout : EntityBase
public double SalaryAidDeduction { get; private set; }
public double AbsenceDeduction { get; private set; }
public string SumOfWorkingDays { get; private set; }
public string ArchiveCode { get; private set; }
public string PersonnelCode { get; private set; }
@@ -157,58 +159,70 @@ public class Checkout : EntityBase
//میانگین ساعت کار در یک روز
public double AverageHoursPerDay { get; private set; }
public bool HasRollCall { get; private set; }
/// <summary>
/// مقدار اضافه کار
/// </summary>
/// <summary>
/// مقدار اضافه کار
/// </summary>
public string OverTimeWorkValue { get; private set; }
/// <summary>
/// مقدار شبکاری
/// </summary>
/// <summary>
/// مقدار شبکاری
/// </summary>
public string OverNightWorkValue { get; private set; }
/// <summary>
/// مقدار جمعه کاری
/// </summary>
public string FridayWorkValue { get; private set; }
/// <summary>
/// درصد نوبت کاری
/// </summary>
public string RotatingShiftValue { get; private set; }
/// <summary>
/// <summary>
/// مقدار جمعه کاری
/// </summary>
public string FridayWorkValue { get; private set; }
/// <summary>
/// درصد نوبت کاری
/// </summary>
public string RotatingShiftValue { get; private set; }
/// <summary>
/// مقدار غیبت
/// </summary>
public string AbsenceValue { get; private set; }
public string AbsenceValue { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای مزد مرخصی
/// </summary>
public string TotalDayOfLeaveCompute { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای سنوات
/// </summary>
public string TotalDayOfYearsCompute { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
/// </summary>
public string TotalDayOfBunosesCompute { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای مزد مرخصی
/// </summary>
public string TotalDayOfLeaveCompute { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای سنوات
/// </summary>
public string TotalDayOfYearsCompute { get; private set; }
/// <summary>
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
/// </summary>
public string TotalDayOfBunosesCompute { get; private set; }
/// <summary>
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
/// </summary>
public bool HasAmountConflict { get; private set; }
/// <summary>
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
/// </summary>
public bool HasAmountConflict { get; private set; }
/// <summary>
/// ساعت موظفی پرسنل در ماه
/// </summary>
/// <summary>
/// ساعت موظفی پرسنل در ماه
/// </summary>
public TimeSpan EmployeeMandatoryHours { get; set; }
#region valueObjects
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
/// <summary>
/// آیا حق بیمه مشابه لیست بیمه حساب شده؟
/// </summary>
public bool HasInsuranceShareTheSameAsList { get; private set; }
/// <summary>
/// آیا فیش نیاز به بروزرسانی دارد
/// </summary>
public bool IsUpdateNeeded { get; private set; }
public List<CheckoutWarningMessage> CheckoutWarningMessageList { get; set; }
#region valueObjects
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
public CheckoutRollCall CheckoutRollCall { get; private set; }
#endregion
@@ -277,7 +291,7 @@ public class Checkout : EntityBase
var year = contarctStart.ToFarsiYear();
var sumYear = year.Substring(Math.Max(0, year.Length - 2));
ContractNo = archiveCode + "/" + personnelCode + "/" + sumYear + "/" + month;
}
public void Active()
@@ -312,7 +326,7 @@ public class Checkout : EntityBase
}
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids,double salaryAidAmount)
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids, double salaryAidAmount)
{
SalaryAids = salaryAids;
SalaryAidDeduction = salaryAidAmount;
@@ -330,30 +344,45 @@ public class Checkout : EntityBase
public void SetAmountConflict(bool hasAmountConflict)
{
HasAmountConflict = hasAmountConflict;
HasAmountConflict = hasAmountConflict;
}
public void SetEmployeeMandatoryHours(TimeSpan employeeMandatoryHours)
{
EmployeeMandatoryHours = employeeMandatoryHours;
}
public void SetInsuranceShare()
{
HasInsuranceShareTheSameAsList = true;
}
/// <summary>
/// نیاز به آپدیت
/// </summary>
public void SetUpdateNeeded()
{
IsUpdateNeeded = true;
}
}
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;
}
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>
@@ -394,27 +423,27 @@ public class CheckoutRollCall
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;
}
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; }
public long Id { get; set; }
/// <summary>
/// تاریخ
@@ -458,12 +487,12 @@ public class CheckoutRollCallDay
/// <summary>
/// آیا غیبت است
/// </summary>
public bool IsAbsent { get; private set; }
public bool IsAbsent { get; private set; }
/// <summary>
/// آیا جمعه است
/// </summary>
public bool IsFriday { get; private set; }
public bool IsFriday { get; private set; }
/// <summary>
/// آیا تعطیل رسمی است
@@ -475,6 +504,6 @@ public class CheckoutRollCallDay
/// </summary>
public string LeaveType { get; private set; }
public long CheckoutId { get; set; }
public long CheckoutId { get; set; }
}

View File

@@ -0,0 +1,32 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
namespace Company.Domain.CheckoutAgg;
public class CheckoutWarningMessage : EntityBaseWithoutCreationDate
{
public CheckoutWarningMessage(string warningMessage, long checkoutId, TypeOfCheckoutWarning typeOfCheckoutWarning)
{
WarningMessage = warningMessage;
CheckoutId = checkoutId;
TypeOfCheckoutWarning = typeOfCheckoutWarning;
}
/// <summary>
/// پیام هشدار
/// </summary>
public string WarningMessage { get; private set; }
/// <summary>
/// آی دی فیش حقوقی
/// </summary>
public long CheckoutId { get; private set; }
/// <summary>
/// نوع هشدار فیش حقوقی
/// </summary>
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; private set; }
public Checkout Checkout { get; set; }
}

View File

@@ -75,4 +75,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
#endregion
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
}

View File

@@ -125,6 +125,8 @@ public class InstitutionContract : EntityBase
public string VerifyCode { get; private set; }
public DateTime VerifyCodeCreation { get; private set; }
public string VerifierFullName { get; private set; }
public string VerifierPhoneNumber { get; private set; }
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
@@ -225,10 +227,12 @@ public class InstitutionContract : EntityBase
}
public void SetVerifyCode(string code)
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{
VerifyCode = code;
VerifyCodeCreation = DateTime.Now;
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
}
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
@@ -248,6 +252,11 @@ public class InstitutionContract : EntityBase
{
WorkshopGroup = null;
}
public void AddAmendment(InstitutionContractAmendment amendment)
{
Amendments.Add(amendment);
}
}
public class InstitutionContractAmendment : EntityBase
@@ -255,14 +264,15 @@ public class InstitutionContractAmendment : EntityBase
private InstitutionContractAmendment(){}
public InstitutionContractAmendment(long institutionContractId,
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
InstitutionContractAmendmentChange amendmentChange, long lawId)
List<InstitutionContractAmendmentChange> amendmentChanges, long lawId)
{
InstitutionContractId = institutionContractId;
Installments = installments is { Count: > 0} ? installments : [];
Amount = amount;
HasInstallment = hasInstallment;
AmendmentChanges = [amendmentChange];
AmendmentChanges = amendmentChanges;
LawId = lawId;
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
}
public long InstitutionContractId { get; set; }
@@ -276,24 +286,38 @@ public class InstitutionContractAmendment : EntityBase
public long LawId { get; set; }
public void SetVerifyCode(string code)
public string VerifierPhoneNumber { get; private set; }
public string VerifierFullName { get; private set; }
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
public DateTime VerifyCodeCreation { get; set; }
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{
VerifyCode = code;
VerificationCreation = DateTime.Now;
VerifyCodeCreation = DateTime.Now;
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
}
public void Verified()
{
VerificationStatus = InstitutionContractVerificationStatus.Verified;
}
}
public class InstitutionContractAmendmentChange : EntityBase
{
private InstitutionContractAmendmentChange() { }
private InstitutionContractAmendmentChange(long institutionContractAmendmentId,
InstitutionContractAmendment institutionContractAmendment, InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasRollCallPlan, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
private InstitutionContractAmendmentChange(InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
long? workshopDetailsId)
bool? hasRollCallPlan, bool? hasRollCallInPerson,
long? currentWorkshopId, int personnelCountDifference)
{
InstitutionContractAmendmentId = institutionContractAmendmentId;
InstitutionContractAmendment = institutionContractAmendment;
ChangeType = changeType;
ChangeDateGr = changeDateGr;
HasRollCallPlan = hasRollCallPlan;
@@ -303,9 +327,80 @@ public class InstitutionContractAmendmentChange : EntityBase
HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount;
WorkshopDetailsId = workshopDetailsId;
PersonnelCountDifference = personnelCountDifference;
CurrentWorkshopId = currentWorkshopId;
HasRollCallInPerson = hasRollCallInPerson;
}
/// <summary>
/// تغییر تعداد پرسنل
/// </summary>
public static InstitutionContractAmendmentChange CreatePersonCountChange(
DateTime changeDateGr, int personnelCount, int personnelCountDifference,
long currentWorkshopId)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.PersonCount,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: null,
hasContractPlan: null,
hasContractPlanInPerson: null,
hasInsurancePlan: null,
hasInsurancePlanInPerson: null,
personnelCount: personnelCount,
hasRollCallPlan: null,
hasRollCallInPerson: null,
currentWorkshopId: currentWorkshopId,
personnelCountDifference: personnelCountDifference);
}
/// <summary>
/// تغییر خدمات
/// </summary>
public static InstitutionContractAmendmentChange CreateServicesChange(
DateTime changeDateGr, long currentWorkshopId, bool hasRollCallPlan, bool hasRollCallInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
bool hasInsurancePlan, bool hasInsurancePlanInPerson)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.Services,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
hasContractPlan: hasContractPlan,
hasContractPlanInPerson: hasContractPlanInPerson,
hasInsurancePlan: hasInsurancePlan,
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
personnelCount: null,
hasRollCallPlan: hasRollCallPlan,
hasRollCallInPerson: hasRollCallInPerson,
currentWorkshopId: currentWorkshopId,
personnelCountDifference: 0);
}
/// <summary>
/// ایجاد کارگاه جدید
/// </summary>
public static InstitutionContractAmendmentChange CreateWorkshopCreatedChange(
DateTime changeDateGr, bool hasRollCallPlan, bool hasRollCallInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
bool hasInsurancePlan, bool hasInsurancePlanInPerson,int personnelCount)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.WorkshopCreated,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
hasContractPlan: hasContractPlan,
hasContractPlanInPerson: hasContractPlanInPerson,
hasInsurancePlan: hasInsurancePlan,
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
personnelCount: personnelCount,
hasRollCallPlan: hasRollCallPlan,
hasRollCallInPerson: hasRollCallInPerson,
currentWorkshopId: null,
personnelCountDifference: 0);
}
public long InstitutionContractAmendmentId { get; private set; }
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
@@ -316,6 +411,8 @@ public class InstitutionContractAmendmentChange : EntityBase
/// </summary>
public bool? HasRollCallPlan { get; private set; }
public bool? HasRollCallInPerson { get; set; }
/// <summary>
/// پلن فیش غیر رسمی
/// </summary>
@@ -345,11 +442,17 @@ public class InstitutionContractAmendmentChange : EntityBase
/// تعداد پرسنل
/// </summary>
public int? PersonnelCount { get; private set; }
/// <summary>
/// مقدار تغییرات تعداد پرسنل
/// </summary>
public int PersonnelCountDifference { get; set; }
/// <summary>
/// تعداد کارگاه
/// </summary>
public long? WorkshopDetailsId { get; private set; }
public long? CurrentWorkshopId { get; private set; }
}
public enum InstitutionContractAmendmentChangeType

View File

@@ -9,7 +9,7 @@ public class InstitutionContractWorkshopBase:EntityBase
protected InstitutionContractWorkshopBase(){}
public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
int personnelCount, double price )
int personnelCount, double price,bool isAmendment )
{
WorkshopName = workshopName;
Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
@@ -17,7 +17,10 @@ public class InstitutionContractWorkshopBase:EntityBase
PersonnelCount = personnelCount;
Price = price;
Employers = [];
IsAmendment = isAmendment;
}
/// <summary>
/// شناسه کارگاه
/// </summary>
@@ -42,7 +45,11 @@ public class InstitutionContractWorkshopBase:EntityBase
public double Price { get; private set; }
/// <summary>
/// جهت نمایش دادن اینکه آیا این کارگاه مربوط به ارتقا قرارداد است یا خیر
/// </summary>
public bool IsAmendment { get; set; }
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();

View File

@@ -10,9 +10,10 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
int personnelCount, double price,long institutionContractWorkshopGroupId,
InstitutionContractWorkshopGroup workshopGroup,long workshopId,bool isAmendment) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
{
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
WorkshopGroup = workshopGroup;

View File

@@ -31,6 +31,13 @@ public class InstitutionContractWorkshopGroup : EntityBase
InitialWorkshops = initialWorkshops.ToList();
LastModifiedDate = DateTime.Now;
}
public void AddAmendmentWorkshops(List<InstitutionContractWorkshopInitial> amendmentDetails)
{
InitialWorkshops.AddRange(amendmentDetails);
LastModifiedDate = DateTime.Now;
}
public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails)
{

View File

@@ -11,9 +11,9 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price) : base(workshopName, hasRollCallPlan,
int personnelCount, double price,bool isAmendment =false) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
{
WorkshopCreated = false;
}
@@ -31,7 +31,8 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
WorkshopCreated = true;
WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId,
IsAmendment);
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CompanyManagment.App.Contracts.InstitutionContract;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
@@ -16,7 +17,7 @@ public class InstitutionContractAmendmentTemp
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
x.CurrentWorkshopId, 0)).ToList();
x.CurrentWorkshopId, 0,x.Id)).ToList();
InstitutionContractId = institutionContractId;
}
@@ -25,17 +26,32 @@ public class InstitutionContractAmendmentTemp
public Guid Id { get; private set; }
public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; }
public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; }
public InstitutionContractPaymentMonthlyViewModel MonthlyPayment { get; set; }
public InstitutionContractPaymentOneTimeViewModel OneTimePayment { get; set; }
public long InstitutionContractId { get; private set; }
public int MonthDifference { get; set; }
public void AddPaymentDetails(InstitutionContractPaymentMonthlyViewModel resMonthly, InstitutionContractPaymentOneTimeViewModel resOneTime, int monthDiff)
{
MonthlyPayment = resMonthly;
OneTimePayment = resOneTime;
MonthDifference = monthDiff;
}
}
public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop
{
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base(
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference,Guid prevId) : base(
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
{
Id = prevId;
PriceDifference = priceDifference;
}

View File

@@ -51,6 +51,14 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
List<EmployeeInsurancListDataViewModel> GetEmployeeInsuranceDataAmonthAgo(DateTime currentMonthStartDate, long workshopId);
#endregion
/// <summary>
/// دریافت اطلاعات بیمه کارکنان برای استفاده در فیش حقوقی
/// </summary>
/// <param name="startDate"></param>
/// <param name="workshopId"></param>
/// <returns></returns>
List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId);
/// <summary>
/// بدست آوردن اطلاعات محاسباتی ماه پرسنل برای ویرایش
/// </summary>

View File

@@ -11,21 +11,23 @@ namespace Company.Domain.ReportAgg
{
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
AllReport GetAllActiveWorkshops(string year, string month);
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);

View File

@@ -26,5 +26,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg
List<RollCallEmployeeStatusViewModel> GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr);
List<RollCallEmployeeStatusViewModel> GetByWorkshopIdInDates(long workshopId, DateTime start, DateTime end);
bool IsActiveInPeriod(long employeeId, long workshopId, DateTime startDate, DateTime endDate);
}
void RemoveRange(IEnumerable<RollCallEmployeeStatus> rollCallEmployeeStatusList);
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.RollCall;
@@ -133,6 +134,15 @@ public class CheckoutViewModel
/// </summary>
public string TotalPaidLeave { get; set; }
/// <summary>
/// آیا فیش نیاز به بروزرسانی دارد
/// </summary>
public bool IsUpdateNeeded { get; set; }
/// <summary>
/// لیست پیام های هشدار فیش حقوقی
/// </summary>
public List<CheckoutWarningMessageModel> CheckoutWarningMessageList { get; set; }
public bool HasSignCheckout { get; set; }

View File

@@ -0,0 +1,25 @@
using _0_Framework.Application.Enums;
namespace CompanyManagment.App.Contracts.Checkout;
/// <summary>
/// مدل هشدار فیش حقوقی
/// </summary>
public class CheckoutWarningMessageModel
{
/// <summary>
/// پیام هشدار
/// </summary>
public string WarningMessage { get; set; }
/// <summary>
/// آی دی فیش حقوقی
/// </summary>
public long CheckoutId { get; set; }
/// <summary>
/// نوع هشدار فیش حقوقی
/// </summary>
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; set; }
}

View File

@@ -25,4 +25,5 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
public int LeavePermittedDays { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
public List<DayOfWeek> WeeklyOffDays { get; set; }
public bool HasLeft { get; set; }
}

View File

@@ -4,6 +4,8 @@ public class GetInstitutionVerificationDetailsWorkshopsViewModel
{
public string Name { get; set; }
public int PersonnelCount { get; set; }
public WorkshopServicesViewModel OldServices { get; set; }
public WorkshopServicesViewModel Services { get; set; }
public string Price { get; set; }
}

View File

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan;
@@ -77,6 +78,8 @@ public interface IInstitutionContractApplication
/// <returns>لیست قراردادها برای چاپ</returns>
List<InstitutionContractViewModel> PrintAll(List<long> id);
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
/// <summary>
/// چاپ یک قرارداد
/// </summary>
@@ -241,6 +244,62 @@ public interface IInstitutionContractApplication
#endregion
Task<OperationResult> ResendVerifyLink(long institutionContractId);
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
/// <summary>
/// دیتای پرینت قرارداد مالی
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
}
public class GetInstitutionAmendmentVerificationDetailsViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string AmendmentCreationDate { get; set; }
public string AmendmentStart { get; set; }
public string AmendmentEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public List<InstitutionContractInstallmentViewModel> Installments { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractAmendmentCompleteRequest
{
public Guid TempId { get; set; }
public bool IsInstallment { get; set; }
public long LawId { get; set; }
}
public class InstitutionContractPrintViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string CreationDate { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public string VerifyCode { get; set; }
public string VerifyDate { get; set; }
public string VerifyTime { get; set; }
public string VerifierFullName { get; set; }
public string VerifierPhoneNumber { get; set; }
public LawViewModel LawViewModel { get; set; }
public string Obligation { get; set; }
}
public class InsertAmendmentTempWorkshopResponse

View File

@@ -1,11 +1,28 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InsitutionContractAmendmentPaymentResponse
{
public List<InsitutionContractAmendmentPaymentWorkshopResponse> workshops { get; set; }
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public string OneMonthAmount { get; set; }
public string TotalAmount { get; set; }
}
public class InsitutionContractAmendmentPaymentWorkshopResponse
{
public string WorkshopName { get; set; }
public WorkshopServicesViewModel OldServices { get; set; }
public WorkshopServicesViewModel NewServices { get; set; }
public bool IsNewWorkshop { get; set; }
public int PrevPersonnelCount { get; set; }
public int NewPersonnelCount { get; set; }
public double Price { get; set; }
}

View File

@@ -31,6 +31,50 @@ public interface IInsuranceListApplication
double GetRoundValue(double value);
OperationResult ConfirmInsuranceList(long id);
#region New
/// <summary>
/// دستمزد روزانه مشاغل مقطوع بیمه
/// </summary>
/// <param name="year"></param>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="startDateGr"></param>
/// <param name="endDateGr"></param>
/// <param name="jobId"></param>
/// <param name="population"></param>
/// <param name="insuranceJobId"></param>
/// <returns></returns>
double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr,
DateTime? endDateGr, long jobId, string population, long? insuranceJobId);
/// <summary>
/// محاسبه مزایای ماهانه
/// </summary>
/// <param name="endMonthCurrentDay"></param>
/// <param name="consumableItemsItemValue"></param>
/// <param name="housingAllowanceItemValue"></param>
/// <param name="maritalStatus"></param>
/// <param name="countWorkingDays"></param>
/// <param name="typeOfInsuranceSendWorkshop"></param>
/// <param name="jobId"></param>
/// <param name="employeeId"></param>
/// <param name="includeStatus"></param>
/// <returns></returns>
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue,
double housingAllowanceItemValue, double maritalStatus, int countWorkingDays,
string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus);
/// <summary>
///
/// </summary>
/// <param name="yearlysalaryItemValue"></param>
/// <param name="employeeId"></param>
/// <param name="workshopId"></param>
/// <param name="year"></param>
/// <returns></returns>
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year);
#endregion
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);
//farokhiChanges

View File

@@ -27,6 +27,8 @@ namespace CompanyManagment.App.Contracts.Report
public int ContractSignNotDone { get; set; }
public int ContractSignDone { get; set; }
public int ContractSignToBe { get; set; }
//تصفیه
public int AllCheckout { get; set; }
public int CheckoutNotDone { get; set; }
@@ -34,6 +36,8 @@ namespace CompanyManagment.App.Contracts.Report
public int CheckoutSignNotDone { get; set; }
public int CheckoutSignDone { get; set; }
public int CheckoutSignToBe { get; set; }
}

View File

@@ -10,21 +10,23 @@ namespace CompanyManagment.App.Contracts.Report
{
Task<AllReport> GetAllActiveWorkshops(string year, string month);
Task<AllReport> GetAllReports(string year, string month);
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList);
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
}
}

View File

@@ -193,8 +193,19 @@ public class CheckoutApplication : ICheckoutApplication
//حق بیمه سهم کارگر
#region InsuranceDeduction
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
double insuranceDeduction = 0;
bool hasInsuranceShareTheSameAsList = false;
if (command.InsuranceDeduction == 0)
{
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
}
else
{
insuranceDeduction = command.InsuranceDeduction;
hasInsuranceShareTheSameAsList = true;
}
#endregion
@@ -375,7 +386,7 @@ public class CheckoutApplication : ICheckoutApplication
, 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,checkoutRollCall,command.EmployeeMandatoryHours);
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours, hasInsuranceShareTheSameAsList);
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
//_checkoutRepository.SaveChanges();

View File

@@ -1140,7 +1140,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id,entity.id );
await _institutionContractRepository.SaveChangesAsync();
@@ -1203,7 +1203,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
throw new NotFoundException("طرف قرارداد یافت نشد");
var code = new Random().Next(1000, 9999).ToString();
institutionContract.SetVerifyCode(code);
var contractingPartyFullName = contractingParty.IsLegal == "حقیقی"
? contractingParty.FName + " " + contractingParty.LName
: contractingParty.CeoFName + " " + contractingParty.CeoLName;
institutionContract.SetVerifyCode(code,contractingPartyFullName ,contractingParty.Phone);
var transaction = await _institutionContractRepository.BeginTransactionAsync();
try
@@ -1372,11 +1377,26 @@ public class InstitutionContractApplication : IInstitutionContractApplication
if (contractingParty == null)
throw new NotFoundException("طرف قرارداد یافت نشد");
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
institutionContract.PublicId, contractingParty.id, institutionContract.id);
return new OperationResult().Succcedded();
}
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
{
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId)
{
return await _institutionContractRepository.GetAmendmentVerificationDetails(id,amendmentId);
}
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
{
await _institutionContractRepository.AmendmentComplete(request);
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,

View File

@@ -1707,7 +1707,7 @@ public class InsuranceListApplication : IInsuranceListApplication
return result;
}
private double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
public double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
{
double? result = 0;
@@ -1858,7 +1858,7 @@ public class InsuranceListApplication : IInsuranceListApplication
/// <param name="jobId"></param>
/// <param name="employeeId"></param>
/// <returns></returns>
private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
{
//ToDo
//افزودن شرط مشمول مزایای
@@ -1898,7 +1898,7 @@ public class InsuranceListApplication : IInsuranceListApplication
private double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
{
double dailyWage = yearlysalaryItemValue;
InsuranceListSearchModel searchModel = new InsuranceListSearchModel();

View File

@@ -30,13 +30,14 @@ public class LeftWorkApplication : ILeftWorkApplication
private readonly IEmployeeRepository _employeeRepository;
private readonly IWorkshopRepository _workshopRepository;
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
IContractApplication contractApplication, IWorkingHoursApplication workingHoursApplication,
IWorkingHoursItemsApplication workingHoursItemsApplication, IEmployeeRepository employeeRepository,
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
IRollCallEmployeeRepository rollCallEmployeeRepository)
{
_leftWorkRepository = leftWorkRepository;
_contractRepository = contractRepository;
@@ -51,7 +52,6 @@ public class LeftWorkApplication : ILeftWorkApplication
public OperationResult Create(CreateLeftWork command)
{
// var Contracts = _contractRepository.Search(new ContractSearchModel()
// {
// EmployeeId = command.EmployeeId,
@@ -70,7 +70,6 @@ public class LeftWorkApplication : ILeftWorkApplication
var start = command.StartWorkDate.ToGeorgianDateTime();
//if (_leftWorkRepository.Exists(x =>
// x.StartWorkDate > start && x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
// return operation.Failed("تاریخ وارد شده کوچکتر از سابقه شروع به کار قبلی است");
@@ -112,16 +111,17 @@ public class LeftWorkApplication : ILeftWorkApplication
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
var workshopName = workshop.WorkshopFullName;
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
var workshopName = workshop.WorkshopFullName;
var leftWork = new LeftWork(left, start, command.WorkshopId,
command.EmployeeId, employeeFullName, workshopName, command.JobId, command.IncludeStatus,
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,workshop.ComputeOptions,workshop.BonusesOptions);
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, workshop.ComputeOptions,
workshop.BonusesOptions);
_leftWorkRepository.Create(leftWork);
_leftWorkRepository.SaveChanges();
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
return operation.Succcedded();
return operation.Succcedded();
}
//public OperationResult Create(CreateLeftWork command)
@@ -193,8 +193,8 @@ public class LeftWorkApplication : ILeftWorkApplication
command.EmployeeId, command.JobId, command.IncludeStatus, command.AddBonusesPay, command.AddYearsPay,
command.AddLeavePay);
_leftWorkRepository.SaveChanges();
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
return operation.Succcedded();
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
return operation.Succcedded();
}
public EditLeftWork GetDetails(long id)
@@ -214,11 +214,9 @@ public class LeftWorkApplication : ILeftWorkApplication
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
{
return _leftWorkRepository.SearchCreateContract(searchModel);
}
public async Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel)
{
@@ -228,7 +226,6 @@ public class LeftWorkApplication : ILeftWorkApplication
public string GetBeforeDate(string date)
{
var persianBefore = "";
var year = Convert.ToInt32(date.Substring(0, 4));
var month = Convert.ToInt32(date.Substring(5, 2));
@@ -255,10 +252,8 @@ public class LeftWorkApplication : ILeftWorkApplication
}
public void LeftWorkExtension(long contractId, string CStart, string CEnd)
{
var step1 = _contractApplication.GetDetails(contractId);
var step2 = _workingHoursApplication.GetByContractId(contractId);
var step3 = _workingHoursItemsApplication.GetWorkingHoursItems();
@@ -380,13 +375,11 @@ public class LeftWorkApplication : ILeftWorkApplication
ContarctStart = CStart,
ContractEnd = CEnd,
GetWorkDateHide = step1.GetWorkDate,
};
var step5 = _contractApplication.MandatoryHours(computing);
string workingDays = string.Empty;
if (step5.NumberOfWorkingDays == "0")
{
workingDays = step5.ComplexNumberOfWorkingDays;
}
else
@@ -477,8 +470,6 @@ public class LeftWorkApplication : ILeftWorkApplication
OverTimeWorkM = step5.OverTimeWorkM == "0" ? "" : step5.OverTimeWorkM,
OverNightWorkH = step5.OverNightWorkH == "0" ? "" : step5.OverNightWorkH,
OverNightWorkM = step5.OverNightWorkM == "0" ? "" : step5.OverNightWorkM,
};
var resss = _contractApplication.Create(createNew);
}
@@ -529,7 +520,9 @@ public class LeftWorkApplication : ILeftWorkApplication
item.LeftWorkDate = string.IsNullOrWhiteSpace(item.LeftWorkDate) ? "1500/01/01" : item.LeftWorkDate;
var left = item.LeftWorkDate.ToGeorgianDateTime();
var start = item.StartWorkDate.ToGeorgianDateTime();
if (_leftWorkRepository.Exists(x => x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id!=item.Id))
if (_leftWorkRepository.Exists(x =>
x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId &&
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
return operation.Failed("وارد کردن تاریخ پایان کار اجباری است ");
if (_leftWorkRepository.Exists(x =>
x.StartWorkDate == start && x.EmployeeId == informationLeftwork.EmployeeId &&
@@ -540,17 +533,23 @@ public class LeftWorkApplication : ILeftWorkApplication
x.EmployeeId == informationLeftwork.EmployeeId &&
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
return operation.Failed("شروع به کار قبلی این شخص ترک کار ندارد ");
if (_leftWorkRepository.Exists(x => x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
if (_leftWorkRepository.Exists(x =>
x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start &&
x.EmployeeId == informationLeftwork.EmployeeId &&
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
}
}
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
if (informationLeftwork != null && operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId);
return operation;
}
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
if (informationLeftwork != null && operation.IsSuccedded)
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId,
informationLeftwork.WorkshopId);
return operation;
}
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId,
List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
{
var operation = new OperationResult();
@@ -560,7 +559,9 @@ public class LeftWorkApplication : ILeftWorkApplication
{
foreach (var item2 in item.LeftWorkViewModels)
{
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate) ? "1500/01/01" : item2.LeftWorkDate;
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate)
? "1500/01/01"
: item2.LeftWorkDate;
var left = item2.LeftWorkDate.ToGeorgianDateTime();
var start = item2.StartWorkDate.ToGeorgianDateTime();
if (_leftWorkRepository.Exists(x =>
@@ -586,14 +587,16 @@ public class LeftWorkApplication : ILeftWorkApplication
}
}
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups);
if (operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
return operation;
}
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId,
commandPersonnelCode, leftWorkGroups);
if (operation.IsSuccedded)
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
return operation;
}
public OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type)
{
return _leftWorkRepository.CheckDeleteLeftWork( workshopId, employeeId, date.ToGeorgianDateTime(),type);
return _leftWorkRepository.CheckDeleteLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
}
public OperationResult CheckEditLeftWork(long workshopId, long employeeId, string date, int type)
@@ -607,21 +610,23 @@ public class LeftWorkApplication : ILeftWorkApplication
}
#region Pooya
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
{
//get last leftworks for employee in all workshops
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
{
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
return new LeftWorkViewModel()
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId })
.GroupBy(x => x.WorkshopId).Select(x =>
{
EmployeeId = employeeId,
WorkshopId = x.Key,
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
StartWorkDateGr = leftWork.StartWorkDateGr
};
}).ToList();
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
return new LeftWorkViewModel()
{
EmployeeId = employeeId,
WorkshopId = x.Key,
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
StartWorkDateGr = leftWork.StartWorkDateGr
};
}).ToList();
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
@@ -632,17 +637,90 @@ public class LeftWorkApplication : ILeftWorkApplication
x.WorkshopId,
x.EmployeeId,
y.LeftWorkDateGr,
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z =>
z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
});
//shaping up the list to send as parameter to repository
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = x.LeftWorkDateGr,
RollCallStatusId = x.Status.Id
}).ToList();
if(newRollCallRecords.Count > 0)
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x =>
new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = x.LeftWorkDateGr,
RollCallStatusId = x.Status.Id
}).ToList();
if (newRollCallRecords.Count > 0)
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
foreach (var rollCallEmployeeViewModel in rollCallsEmployee)
{
var maxLeftWork = leftWorks.FirstOrDefault(x => x.WorkshopId == rollCallEmployeeViewModel.WorkshopId);
if (maxLeftWork == null)
{
continue;
}
var employeeStatus = _rollCallEmployeeRepository.GetBy(rollCallEmployeeViewModel.EmployeeId,
rollCallEmployeeViewModel.WorkshopId);
var rollCallEmployeeStatusList = employeeStatus.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
}
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
{
//get last leftworks for employee in all workshops
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
{ EmployeeId = employeeId, WorkshopId = workshopId })
.Select(x => new LeftWorkViewModel()
{
EmployeeId = employeeId,
WorkshopId = x.WorkshopId,
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
StartWorkDateGr = x.StartWorkDateGr
}).ToList();
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
// {
// x.WorkshopId,
// x.EmployeeId,
// y.LeftWorkDateGr,
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
// });
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
#endregion

View File

@@ -27,26 +27,30 @@ namespace CompanyManagment.Application;
public class LeftWorkTempApplication : ILeftWorkTempApplication
{
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
private readonly ILeftWorkRepository _leftWorkRepository;
private readonly IWorkshopRepository _workshopRepository;
private readonly IEmployeeRepository _employeeRepository;
private readonly IJobRepository _jobRepository;
private readonly ICheckoutRepository _checkoutRepository;
private readonly IContractRepository _contractRepository;
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
private readonly ILeftWorkRepository _leftWorkRepository;
private readonly IWorkshopRepository _workshopRepository;
private readonly IEmployeeRepository _employeeRepository;
private readonly IJobRepository _jobRepository;
private readonly ICheckoutRepository _checkoutRepository;
private readonly IContractRepository _contractRepository;
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository, ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository, IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository, IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
{
_leftWorkTempRepository = leftWorkTempRepository;
_leftWorkRepository = leftWorkRepository;
_workshopRepository = workshopRepository;
_employeeRepository = employeeRepository;
_jobRepository = jobRepository;
_checkoutRepository = checkoutRepository;
_contractRepository = contractRepository;
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository,
ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository,
IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository,
IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
IRollCallEmployeeRepository rollCallEmployeeRepository)
{
_leftWorkTempRepository = leftWorkTempRepository;
_leftWorkRepository = leftWorkRepository;
_workshopRepository = workshopRepository;
_employeeRepository = employeeRepository;
_jobRepository = jobRepository;
_checkoutRepository = checkoutRepository;
_contractRepository = contractRepository;
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
_rollCallEmployeeRepository = rollCallEmployeeRepository;
}
@@ -59,15 +63,16 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
{
#region Validation
if (_leftWorkTempRepository.Exists(x=>x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
if (_leftWorkTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
{
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
}
if (command.LeftWorkTime.TryToGeorgianDateTime(out var leftWorkDateGr) == false)
{
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
}
if (command.LastDayStanding.TryToGeorgianDateTime(out var lastDayStandingDateGr) == false)
{
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
@@ -101,7 +106,6 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
}
//if (leftWork.StartWorkDate >= leftWorkDateGr)
//{
// return op.Failed("ترک کار نمیتواند کوچک تر یا مساوی شروع به کار باشد");
@@ -121,10 +125,10 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
// return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای قرارداد میباشد");
//}
#endregion
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr, lastDayStandingDateGr,
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr,
lastDayStandingDateGr,
command.WorkshopId, employeeId, leftWork.JobId);
await _leftWorkTempRepository.CreateAsync(leftWorkTemp);
@@ -135,61 +139,63 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
}
public Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId, long workshopId)
{
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
}
{
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
}
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
{
var op = new OperationResult();
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
{
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
}
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
{
var op = new OperationResult();
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
{
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
}
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
{
return op.Failed("اطلاعات وارد شده نامعتبر است");
}
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
{
return op.Failed("اطلاعات وارد شده نامعتبر است");
}
if (_leftWorkRepository.Exists(x => x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId && x.LeftWorkDate >= startDateGr))
{
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
}
if (_leftWorkRepository.Exists(x =>
x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId &&
x.LeftWorkDate >= startDateGr))
{
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
}
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
{
return op.Failed("سمت وارد شده نامعتبر است");
}
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
{
return op.Failed("سمت وارد شده نامعتبر است");
}
var defaultTime = new DateTime(2121, 03, 21);
var defaultTime = new DateTime(2121, 03, 21);
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
await _leftWorkRepository.CreateAsync(newLeftWork);
_leftWorkTempRepository.Remove(leftWorkTemp);
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
await _leftWorkRepository.CreateAsync(newLeftWork);
_leftWorkTempRepository.Remove(leftWorkTemp);
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
if (rollCallStatus != null)
{
var startWork = newLeftWork.StartWorkDate;
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
if (rollCallStatus != null)
{
var startWork = newLeftWork.StartWorkDate;
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
}
}
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
return op.Succcedded();
}
return op.Succcedded();
}
public async Task<OperationResult> AcceptLeftWork(AcceptLeftWorkTemp command)
{
@@ -237,9 +243,12 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
x.WorkshopId == leftWorkTemp.WorkshopId &&
x.ContractStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
{
return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
return op.Failed(
"این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
}
var transaction = await _rollCallEmployeeStatusRepository.BeginTransactionAsync();
leftWork.Edit(leftWorkDateGr, leftWork.StartWorkDate, leftWork.WorkshopId, leftWork.EmployeeId, leftWork.JobId,
leftWork.IncludeStatus, leftWork.AddBonusesPay, leftWork.AddYearsPay, leftWork.AddLeavePay);
@@ -247,8 +256,9 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId);
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId, leftWork.WorkshopId);
await transaction.CommitAsync();
return op.Succcedded();
}
@@ -259,45 +269,59 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
public List<LeftWorkTempViewModel> GetLeftWorksByWorkshopId(long workshopId)
{
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
}
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
{
//get last leftworks for employee in all workshops
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
{
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
return new LeftWorkViewModel()
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
{ EmployeeId = employeeId, WorkshopId = workshopId })
.Select(x => new LeftWorkViewModel()
{
EmployeeId = employeeId,
WorkshopId = x.Key,
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
StartWorkDateGr = leftWork.StartWorkDateGr
};
}).ToList();
WorkshopId = x.WorkshopId,
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
StartWorkDateGr = x.StartWorkDateGr
}).ToList();
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
.Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId)).ToList();
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
{
x.WorkshopId,
x.EmployeeId,
y.LeftWorkDateGr,
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
});
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
// {
// x.WorkshopId,
// x.EmployeeId,
// y.LeftWorkDateGr,
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
// });
//shaping up the list to send as parameter to repository
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
LeaveDate = x.LeftWorkDateGr,
RollCallStatusId = x.Status.Id
}).ToList();
if (newRollCallRecords.Count > 0)
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
}

View File

@@ -29,67 +29,67 @@ public class ReportApplication : IReportApplication
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
}
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
public async Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
{
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
return await _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
}
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
public async Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
{
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
return await _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
}
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
public async Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
{
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
return await _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
}
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
public async Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
{
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
return await _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
}
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
public async Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId)
{
return _reportRepository.GetEmployeeContract(year, month, workshopId);
return await _reportRepository.GetEmployeeContract(year, month, workshopId);
}
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
public async Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId)
{
return _reportRepository.GetEmployeeContractSign(year, month, workshopId);
return await _reportRepository.GetEmployeeContractSign(year, month, workshopId);
}
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
public async Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId)
{
return _reportRepository.GetEmployeeCheckout(year, month, workshopId);
return await _reportRepository.GetEmployeeCheckout(year, month, workshopId);
}
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
public async Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId)
{
return _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
return await _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
}
#region Print
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
public async Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList)
{
return _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
return await _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
}
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
public async Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList)
{
return _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
return await _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
}
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList)
{
return _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
return await _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
}
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList)
{
return _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
return await _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
}
#endregion

View File

@@ -230,6 +230,8 @@ public class CompanyContext : DbContext
#endregion
public DbSet<CheckoutWarningMessage> CheckoutWarningMessages { get; set; }
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }

View File

@@ -50,12 +50,18 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
builder.Property(x => x.TotalDayOfLeaveCompute).HasMaxLength(10);
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
builder.Property(x => x.EmployeeMandatoryHours).HasTimeSpanConversion();
builder.HasOne(x => x.Workshop)
.WithMany(x => x.Checkouts)
.HasForeignKey(x => x.WorkshopId);
builder.HasMany(x => x.CheckoutWarningMessageList)
.WithOne(x => x.Checkout)
.HasForeignKey(x => x.CheckoutId);
builder.OwnsMany(x => x.LoanInstallments, installments =>
{
installments.Property(x => x.AmountForMonth).HasMaxLength(25);

View File

@@ -0,0 +1,26 @@
using System;
using _0_Framework.Application.Enums;
using Company.Domain.CheckoutAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class CheckoutWarningMessageMapping : IEntityTypeConfiguration<CheckoutWarningMessage>
{
public void Configure(EntityTypeBuilder<CheckoutWarningMessage> builder)
{
builder.ToTable("CheckoutWarningMessage");
builder.HasKey(x => x.id);
builder.Property(x => x.WarningMessage).HasMaxLength(150);
builder.Property(x => x.TypeOfCheckoutWarning).HasConversion(
v => v.ToString(),
v => (TypeOfCheckoutWarning)Enum.Parse(typeof(TypeOfCheckoutWarning), v)).HasMaxLength(30);
builder.HasOne(x => x.Checkout)
.WithMany(x => x.CheckoutWarningMessageList)
.HasForeignKey(x => x.CheckoutId);
}
}

View File

@@ -12,6 +12,10 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
builder.HasKey(x => x.id);
builder.Property(x => x.VerifyCode).HasMaxLength(10);
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.Property(x=>x.VerificationStatus).HasConversion<string>().HasMaxLength(50);
builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Amendments)

View File

@@ -30,6 +30,8 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
builder.Property(x => x.VerifyCode).HasMaxLength(20);
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);

View File

@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddVerifierdetailsininstituioncontractandamendment : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "VerifierFullName",
table: "InstitutionContracts",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierPhoneNumber",
table: "InstitutionContracts",
type: "nvarchar(20)",
maxLength: 20,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierFullName",
table: "InstitutionContractAmendments",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierPhoneNumber",
table: "InstitutionContractAmendments",
type: "nvarchar(20)",
maxLength: 20,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "VerifyCodeCreation",
table: "InstitutionContractAmendments",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "VerifierFullName",
table: "InstitutionContracts");
migrationBuilder.DropColumn(
name: "VerifierPhoneNumber",
table: "InstitutionContracts");
migrationBuilder.DropColumn(
name: "VerifierFullName",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "VerifierPhoneNumber",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "VerifyCodeCreation",
table: "InstitutionContractAmendments");
}
}
}

View File

@@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddIsAmendmentininstitutioncontractWorkshopDetials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "WorkshopDetailsId",
table: "InstitutionContractAmendmentChange",
newName: "CurrentWorkshopId");
migrationBuilder.AddColumn<bool>(
name: "IsAmendment",
table: "InstitutionContractWorkshopInitials",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsAmendment",
table: "InstitutionContractWorkshopCurrents",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "VerificationStatus",
table: "InstitutionContractAmendments",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<bool>(
name: "HasRollCallInPerson",
table: "InstitutionContractAmendmentChange",
type: "bit",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PersonnelCountDifference",
table: "InstitutionContractAmendmentChange",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsAmendment",
table: "InstitutionContractWorkshopInitials");
migrationBuilder.DropColumn(
name: "IsAmendment",
table: "InstitutionContractWorkshopCurrents");
migrationBuilder.DropColumn(
name: "VerificationStatus",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "HasRollCallInPerson",
table: "InstitutionContractAmendmentChange");
migrationBuilder.DropColumn(
name: "PersonnelCountDifference",
table: "InstitutionContractAmendmentChange");
migrationBuilder.RenameColumn(
name: "CurrentWorkshopId",
table: "InstitutionContractAmendmentChange",
newName: "WorkshopDetailsId");
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class hasInsuranceShareTheSameAsList_checkoutTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "HasInsuranceShareTheSameAsList",
table: "Checkouts",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HasInsuranceShareTheSameAsList",
table: "Checkouts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class CheckoutWarningMessage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsUpdateNeeded",
table: "Checkouts",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "CheckoutWarningMessage",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WarningMessage = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: true),
CheckoutId = table.Column<long>(type: "bigint", nullable: false),
TypeOfCheckoutWarning = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckoutWarningMessage", x => x.id);
table.ForeignKey(
name: "FK_CheckoutWarningMessage_Checkouts_CheckoutId",
column: x => x.CheckoutId,
principalTable: "Checkouts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CheckoutWarningMessage_CheckoutId",
table: "CheckoutWarningMessage",
column: "CheckoutId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CheckoutWarningMessage");
migrationBuilder.DropColumn(
name: "IsUpdateNeeded",
table: "Checkouts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class institutioncontractAmendmentlawid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ignorelawid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "LawId",
table: "InstitutionContractAmendments",
type: "bigint",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LawId",
table: "InstitutionContractAmendments");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class lawIdtest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -415,6 +415,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool>("HasAmountConflict")
.HasColumnType("bit");
b.Property<bool>("HasInsuranceShareTheSameAsList")
.HasColumnType("bit");
b.Property<bool>("HasRollCall")
.HasColumnType("bit");
@@ -431,6 +434,9 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<bool>("IsUpdateNeeded")
.HasColumnType("bit");
b.Property<bool>("LeaveCheckout")
.HasColumnType("bit");
@@ -543,6 +549,33 @@ namespace CompanyManagment.EFCore.Migrations
b.ToTable("Checkouts", (string)null);
});
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("CheckoutId")
.HasColumnType("bigint");
b.Property<string>("TypeOfCheckoutWarning")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("WarningMessage")
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.HasKey("id");
b.HasIndex("CheckoutId");
b.ToTable("CheckoutWarningMessage", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b =>
{
b.Property<long>("id")
@@ -3205,6 +3238,14 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(122)
.HasColumnType("nvarchar(122)");
b.Property<string>("VerifierFullName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("VerifierPhoneNumber")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("VerifyCode")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
@@ -3247,10 +3288,26 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("VerificationCreation")
.HasColumnType("datetime2");
b.Property<string>("VerificationStatus")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VerifierFullName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("VerifierPhoneNumber")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("VerifyCode")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<DateTime>("VerifyCodeCreation")
.HasColumnType("datetime2");
b.HasKey("id");
b.HasIndex("InstitutionContractId");
@@ -3275,6 +3332,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<long?>("CurrentWorkshopId")
.HasColumnType("bigint");
b.Property<bool?>("HasContractPlan")
.HasColumnType("bit");
@@ -3290,6 +3350,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool?>("HasInsurancePlanInPerson")
.HasColumnType("bit");
b.Property<bool?>("HasRollCallInPerson")
.HasColumnType("bit");
b.Property<bool?>("HasRollCallPlan")
.HasColumnType("bit");
@@ -3299,8 +3362,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<int?>("PersonnelCount")
.HasColumnType("int");
b.Property<long?>("WorkshopDetailsId")
.HasColumnType("bigint");
b.Property<int>("PersonnelCountDifference")
.HasColumnType("int");
b.HasKey("id");
@@ -3367,6 +3430,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount")
.HasColumnType("int");
@@ -3432,6 +3498,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount")
.HasColumnType("int");
@@ -7192,6 +7261,17 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("Workshop");
});
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
{
b.HasOne("Company.Domain.CheckoutAgg.Checkout", "Checkout")
.WithMany("CheckoutWarningMessageList")
.HasForeignKey("CheckoutId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Checkout");
});
modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b =>
{
b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee")
@@ -10711,6 +10791,11 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("PetitionsList");
});
modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b =>
{
b.Navigation("CheckoutWarningMessageList");
});
modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b =>
{
b.Navigation("ContractingPartyBankAccounts");

View File

@@ -524,6 +524,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
entity.SetLoanInstallment(command.LoanInstallments, command.InstallmentDeduction);
entity.SetCheckoutRollCall(command.CheckoutRollCall);
entity.SetEmployeeMandatoryHours(command.EmployeeMandatoryHours);
if(command.HasInsuranceShareTheSameAsList)
entity.SetInsuranceShare();
await _context.SaveChangesAsync();
}
@@ -1689,7 +1691,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
return new List<CheckoutViewModel>();
}
#endregion
var query = _context.CheckoutSet
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
.AsSplitQuery().Select(x => new CheckoutViewModel()
{
Id = x.id,
@@ -1724,7 +1726,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
SalaryAidDateTimeGe = s.SalaryAidDateTime
}).ToList(),
HasAmountConflict = x.HasAmountConflict
HasAmountConflict = x.HasAmountConflict,
IsUpdateNeeded = x.IsUpdateNeeded,
CheckoutWarningMessageList = x.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
if (searchModel.EmployeeId > 0)
@@ -1992,7 +2001,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
// );
var checkouts =
_context.CheckoutSet.Where(x => workshopAcounts.Contains(x.WorkshopId))
_context.CheckoutSet.Include(w=>w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
.Join(_context.Workshops.AsSplitQuery(),
ch => ch.WorkshopId,
workshop => workshop.id,
@@ -2261,7 +2270,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
CreationDate = x.ch.CreationDate,
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
IsBlockCantracingParty = x.contractingParty.IsBlock,
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
IsUpdateNeeded = x.ch.IsUpdateNeeded,
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm=> new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
@@ -2299,7 +2315,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
CreationDate = x.ch.CreationDate,
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
IsBlockCantracingParty = x.contractingParty.IsBlock,
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
IsUpdateNeeded = x.ch.IsUpdateNeeded,
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
}).OrderByDescending(x => x.Id)
.GroupBy(x => x.Id)
@@ -2365,7 +2388,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
CreationDate = x.ch.CreationDate,
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
IsBlockCantracingParty = x.contractingParty.IsBlock,
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
IsUpdateNeeded = x.ch.IsUpdateNeeded,
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
.OrderByDescending(x => x.ContractStartGr).ToList();
@@ -2398,7 +2428,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
CreationDate = x.ch.CreationDate,
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
IsBlockCantracingParty = x.contractingParty.IsBlock,
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
IsUpdateNeeded = x.ch.IsUpdateNeeded,
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
}).GroupBy(x => x.Id)
.Select(x => x.First()).ToList()

View File

@@ -19,39 +19,41 @@ using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext, IRollCallEmployeeRepository _rollCallEmployeeRepository)
public class CustomizeWorkshopGroupSettingsRepository(
CompanyContext companyContext,
IRollCallEmployeeRepository _rollCallEmployeeRepository)
: RepositoryBase<long, CustomizeWorkshopGroupSettings>(companyContext),
ICustomizeWorkshopGroupSettingsRepository
{
private readonly CompanyContext _companyContext = companyContext;
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository = _rollCallEmployeeRepository;
public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id)
{
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopSettings)
.FirstOrDefault(x => x.id == id);
.FirstOrDefault(x => x.id == id);
}
public CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId)
{
return _companyContext.CustomizeWorkshopGroupSettings
.Include(x=>x.CustomizeWorkshopSettings)
.Include(x=> x.CustomizeWorkshopEmployeeSettingsCollection)
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
return _companyContext.CustomizeWorkshopGroupSettings
.Include(x => x.CustomizeWorkshopSettings)
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
}
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long customizeWorkshopSettingId)
{
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
if (workshopSettings == null)
return new();
var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery().Include(x=>x.CustomizeWorkshopGroupSettings)
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
.Select(x=>x.EmployeeId).ToList();
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
.Select(x => x.EmployeeId).ToList();
var workshopId = workshopSettings.WorkshopId;
var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
@@ -81,79 +83,81 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
var dateNow = DateTime.Now.Date;
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
// .Select(x => x.EmployeeId).ToList();
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
// .Select(x => x.EmployeeId).ToList();
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
//var employees = rollCallEmployees
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
// .Select(x => new EmployeeViewModel()
// {
// EmployeeFullName = x.EmployeeFullName,
// Id = x.EmployeeId
// }).ToList();
//var employees = rollCallEmployees
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
// .Select(x => new EmployeeViewModel()
// {
// EmployeeFullName = x.EmployeeFullName,
// Id = x.EmployeeId
// }).ToList();
var employees = _companyContext.RollCallEmployees
.Include(x =>
x.EmployeesStatus)
.Where(
x =>
x.WorkshopId == workshopId &&
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
x.HasUploadedImage == "true")
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery()
.Include(x => x.CustomizeWorkshopGroupSettings)
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
cws => cws.EmployeeId,
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
.Where(x => x.cws == null).Select(x=> new EmployeeViewModel()
{
var employees = _companyContext.RollCallEmployees
.Include(x =>
x.EmployeesStatus)
.Where(x =>
x.WorkshopId == workshopId &&
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
x.HasUploadedImage == "true")
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery()
.Include(x => x.CustomizeWorkshopGroupSettings)
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
rollCallEmployee => rollCallEmployee.EmployeeId,
cws => cws.EmployeeId,
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
.Where(x => x.cws == null).Select(x => new EmployeeViewModel()
{
EmployeeFullName = x.rollCallEmployee.EmployeeFullName,
Id = x.rollCallEmployee.EmployeeId
});
});
return employees.ToList();
return employees.ToList();
}
public bool HasAnyEmployeeWithoutGroup(long workshopId)
{
var dateNow = DateTime.Now.Date;
var dateNow = DateTime.Now.Date;
var leftWork = _companyContext.LeftWorkList.Where(x =>
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
.Include(x =>
x.EmployeesStatus)
.Where(
x =>
x.WorkshopId == workshopId &&
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
x.HasUploadedImage == "true"&&
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery()
.Include(x => x.CustomizeWorkshopGroupSettings)
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
cws => cws.EmployeeId,
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
.Any(x => x.cws == null);
return rollCallEmployeesWithoutCWS;
.Include(x =>
x.EmployeesStatus)
.Where(x =>
x.WorkshopId == workshopId &&
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
x.HasUploadedImage == "true" &&
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery()
.Include(x => x.CustomizeWorkshopGroupSettings)
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
rollCallEmployee => rollCallEmployee.EmployeeId,
cws => cws.EmployeeId,
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
.Any(x => x.cws == null);
return rollCallEmployeesWithoutCWS;
}
public CustomizeWorkshopGroupSettings GetWithEmployees(long groupId)
{
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == groupId);
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(
long groupSettingsId)
{
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
@@ -169,23 +173,26 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
{
EmployeeId = x.EmployeeId,
Id = x.id,
IsShiftChanged = x.IsShiftChanged,
IsSettingChanged = x.IsSettingChanged,
Name = y.FullName,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
Placement = z.Placement,
StartTime = z.StartTime.ToString("HH:mm")
}).ToList()
}).ToList();
EmployeeId = x.EmployeeId,
Id = x.id,
IsShiftChanged = x.IsShiftChanged,
IsSettingChanged = x.IsSettingChanged,
Name = y.FullName,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
Placement = z.Placement,
StartTime = z.StartTime.ToString("HH:mm")
}).ToList()
}).ToList();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(
long groupSettingsId)
{
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
@@ -201,38 +208,52 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
{
EmployeeId = x.EmployeeId,
Id = x.id,
IsSettingChanged = x.IsSettingChanged,
IsShiftChanged = x.IsShiftChanged,
Name = y.FullName,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
Placement = z.Placement,
StartTime = z.StartTime.ToString("HH:mm")
}).ToList()
}).ToList();
EmployeeId = x.EmployeeId,
Id = x.id,
IsSettingChanged = x.IsSettingChanged,
IsShiftChanged = x.IsShiftChanged,
Name = y.FullName,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
Placement = z.Placement,
StartTime = z.StartTime.ToString("HH:mm")
}).ToList()
}).ToList();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
{
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == groupSettingsId);
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == groupSettingsId);
if (entity == null)
return new();
var employees = entity.CustomizeWorkshopEmployeeSettingsCollection;
if (employees.Count == 0)
return [];
var workshopId = employees.FirstOrDefault()?.WorkshopId??0;
if (workshopId == 0)
return [];
var employeeIds = employees.Select(x => x.EmployeeId).ToList();
var employeeIds = employees.Select(x => x.EmployeeId);
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
.Select(x => new { x.id, x.FullName }).ToList();
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
var leftWork = _companyContext.LeftWorkList.Where(x =>
x.WorkshopId == workshopId &&
employeeIds.Contains(x.EmployeeId)).ToList();
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel
@@ -243,82 +264,86 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
Salary = x.Salary,
IsSettingChanged = x.IsSettingChanged,
IsShiftChanged = x.IsShiftChanged,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
StartTime = z.StartTime.ToString("HH:mm"),
Placement = z.Placement
}).ToList(),
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts
.Select(z => new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime.ToString("HH:mm"),
StartTime = z.StartTime.ToString("HH:mm"),
Placement = z.Placement
}).ToList(),
IrregularShift = x.IrregularShift,
WorkshopShiftStatus = x.WorkshopShiftStatus,
LeavePermittedDays = x.LeavePermittedDays,
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
.Select(r => new CustomizeRotatingShiftsViewModel
{
StartTime = r.StartTime.ToString("HH:mm"),
EndTime = r.EndTime.ToString("HH:mm")
}).ToList(),
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
});
return joinedList.ToList();
return joinedList.OrderBy(x=>x.HasLeft).ToList();
}
public EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId)
{
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
return new EditCustomizeWorkshopGroupSettings()
{
//FridayWork = entity.FridayWork,
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
LateToWork = new()
{
{
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
Value = entity.LateToWork.Value, LateToWorkType = entity.LateToWork.LateToWorkType
},
HolidayWork = entity.HolidayWork,
FineAbsenceDeduction = new()
{
{
Value = entity.FineAbsenceDeduction.Value,
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
},
EarlyExit = new()
{
{
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
Value = entity.EarlyExit.Value, EarlyExitType = entity.EarlyExit.EarlyExitType
},
BonusesPay = new()
{
{
Value = entity.BonusesPay.Value, BonusesPayType = entity.BonusesPay.BonusesPayType,
PaymentType = entity.BonusesPay.PaymentType
},
ShiftPay = new()
{
{
Value = entity.ShiftPay.Value, ShiftPayType = entity.ShiftPay.ShiftPayType,
ShiftType = entity.ShiftPay.ShiftType
},
InsuranceDeduction = new()
{
{
Value = entity.InsuranceDeduction.Value,
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
},
OverTimePay = new()
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
BaseYearsPay = new()
{
{
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
Value = entity.BaseYearsPay.Value
},
NightWorkPay = new()
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
LeavePay =new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
MarriedAllowance = new()
{
{
Value = entity.MarriedAllowance.Value,
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
},
FamilyAllowance = new()
{
{
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
Value = entity.FamilyAllowance.Value
},
@@ -332,23 +357,27 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
IsShiftChanged = entity.IsShiftChange,
ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.Select(x =>
new CustomizeWorkshopShiftViewModel()
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
{
EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement,
StartTime = x.StartTime.ToString("HH:mm")
}).ToList(),
LeavePermittedDays = entity.LeavePermittedDays,
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x=> new CustomizeRotatingShiftsViewModel()
{
EndTime = x.EndTime.ToString("HH:mm"),
StartTime = x.StartTime.ToString("HH:mm")
}).ToList(),
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x =>
new CustomizeRotatingShiftsViewModel()
{
EndTime = x.EndTime.ToString("HH:mm"),
StartTime = x.StartTime.ToString("HH:mm")
}).ToList(),
OffDayOfWeeks = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
};
}
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(long workshopSettingsId)
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(
long workshopSettingsId)
{
return _companyContext.CustomizeWorkshopGroupSettings
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
return _companyContext.CustomizeWorkshopGroupSettings
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
}
public void Remove(long groupId)
@@ -360,7 +389,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
_companyContext.SaveChanges();
}
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId)
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId,
long workshopId)
{
return _companyContext.CustomizeWorkshopGroupSettings
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)

View File

@@ -124,7 +124,7 @@ public class FineRepository : RepositoryBase<long, Fine>, IFineRepository
}
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
var list = query.ToList().Select(x => new FineViewModel()
var list = query.OrderByDescending(x=>x.FineDate).ToList().Select(x => new FineViewModel()
{
Amount = x.Amount.ToMoney(),
AmountDouble = x.Amount,

View File

@@ -25,6 +25,7 @@ using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan;
@@ -48,6 +49,16 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
private readonly IPlanPercentageRepository _planPercentageRepository;
private readonly ISmsService _smsService;
private readonly InstitutionContratVerificationParty _firstParty = new()
{
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
PhoneNumber = "09111485044",
CeoName = "سید حسن مصباح",
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
NationalCodeOrNationalId = "14009970584",
LegalType = LegalType.Legal
};
public InstitutionContractRepository(CompanyContext context, IEmployerRepository employerRepository,
IWorkshopRepository workshopRepository, IMongoDatabase database,
IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context)
@@ -1799,15 +1810,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
},
FirstParty = new InstitutionContratVerificationParty()
{
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
PhoneNumber = "09111111111",
CeoName = "سید حسن مصباح",
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
NationalCodeOrNationalId = "1111111111",
LegalType = LegalType.Legal
}
FirstParty =_firstParty
};
return res;
@@ -2338,7 +2341,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
@@ -2370,6 +2373,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
x.WorkshopId??0,x.id)).ToList();
await _institutionAmendmentTemp
.DeleteManyAsync(x => x.InstitutionContractId == institutionContractId);;
var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId);
@@ -2452,12 +2457,14 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
if (endDay > startDay)
monthDiff++;
var sumOneMonth = institutionContractAmendmentTemp.NewWorkshops.Sum(x => x.PriceDifference);
var sumOneMonth = institutionContractAmendmentTemp
.NewWorkshops.Sum(x => x.PriceDifference);
var baseAmount = monthDiff * sumOneMonth;
var tax = baseAmount*0.10;
var totalPayment = tax+baseAmount;
var res = new InsitutionContractAmendmentPaymentResponse()
{
@@ -2465,6 +2472,41 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
ContractEnd = amendmentEnd.ToFarsi(),
OneMonthAmount = sumOneMonth.ToMoney(),
TotalAmount = baseAmount.ToMoney(),
workshops = institutionContractAmendmentTemp.NewWorkshops
.Select(x=>
{
var prevWorkshop = institutionContractAmendmentTemp.PrevWorkshops
.FirstOrDefault(w=> w.Id == x.Id);
var isNewWorkshop = prevWorkshop == null;
return new InsitutionContractAmendmentPaymentWorkshopResponse()
{
WorkshopName = x.WorkshopName,
IsNewWorkshop = isNewWorkshop,
NewPersonnelCount = x.CountPerson,
PrevPersonnelCount = prevWorkshop?.CountPerson??0,
Price = x.PriceDifference,
OldServices = prevWorkshop != null? new WorkshopServicesViewModel()
{
Contract = prevWorkshop.ContractAndCheckout,
ContractInPerson = prevWorkshop.ContractAndCheckoutInPerson,
CustomizeCheckout = prevWorkshop.CustomizeCheckout,
Insurance = prevWorkshop.Insurance,
InsuranceInPerson = prevWorkshop.InsuranceInPerson,
RollCall = prevWorkshop.RollCall,
RollCallInPerson = prevWorkshop.RollCallInPerson,
}: new WorkshopServicesViewModel(),
NewServices = new WorkshopServicesViewModel()
{
Contract = x.ContractAndCheckout,
ContractInPerson = x.ContractAndCheckoutInPerson,
CustomizeCheckout = x.CustomizeCheckout,
Insurance = x.Insurance,
InsuranceInPerson = x.InsuranceInPerson,
RollCall = x.RollCall,
RollCallInPerson = x.RollCallInPerson,
},
};
}).OrderByDescending(x=>x.Price).ToList()
};
res.OneTime = new InstitutionContractPaymentOneTimeViewModel()
@@ -2511,6 +2553,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
};
}
institutionContractAmendmentTemp.AddPaymentDetails(res.Monthly, res.OneTime, monthDiff);
await _institutionAmendmentTemp
.ReplaceOneAsync(x => x.Id == institutionContractAmendmentTemp.Id, institutionContractAmendmentTemp);
return res;
}
@@ -2549,7 +2598,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
request.Insurance, request.InsuranceInPerson,
request.RollCall, request.RollCallInPerson,
request.CustomizeCheckout, price,
request.WorkshopId,0,price);
request.WorkshopId,0,price,Guid.NewGuid());
workshopTemp = newWorkshopTemp;
@@ -2561,9 +2610,24 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}
else
{
var prevWorkshop = amendmentTemp.PrevWorkshops
.FirstOrDefault(x => x.Id == workshopTemp.Id);
var differencePrice = 0d;
if (prevWorkshop != null)
{
differencePrice = price - prevWorkshop.Price;
}
else
{
differencePrice = price;
}
amendmentTemp.NewWorkshops.Remove(workshopTemp);
var differencePrice = price - workshopTemp.Price;
if (differencePrice<0)
{
differencePrice = 0;
}
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
request.Insurance, request.InsuranceInPerson,
@@ -2619,10 +2683,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
Id = x.id,
Text = x.WorkshopFullName
});
var employers = _context.Employers.Select(x => new InstitutionContractSelectListViewModel()
//کارفرما ها به غیر از آن هایی که به طرف حساب ---- وصل هستند
var employers = _context.Employers.Where(x=>x.ContractingPartyId != 30428)
.Select(x => new InstitutionContractSelectListViewModel()
{
Id = x.id,
Text = x.FName + " " + x.LName
Text = x.FullName
});
var representatives = _context.RepresentativeSet.Select(x => new InstitutionContractSelectListViewModel()
{
@@ -2653,6 +2719,253 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
return list.DistinctBy(x => x.Id).ToList();
}
public async Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
var query =_context.InstitutionContractSet
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.InitialWorkshops)
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.CurrentWorkshops)
.Where(x=>ids.Contains(x.id));
var contractingPartyIds = query.Select(x => x.ContractingPartyId).ToList();
var contractingParties = await _context.PersonalContractingParties
.Where(x => contractingPartyIds.Contains(x.id))
.ToListAsync();
var list = query.ToList();
if (list.Count == 0)
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
var res = new List<InstitutionContractPrintViewModel>();
foreach (var institution in list)
{
var contractingParty = contractingParties.FirstOrDefault(x => x.id == institution.ContractingPartyId);
if (contractingParty == null)
{
throw new NotFoundException("طرف حساب یافت نشد");
}
var law = await _context.Laws
.FirstOrDefaultAsync(x => x.id == institution.LawId);
var secondParty = new InstitutionContratVerificationParty()
{
Address = contractingParty.Address,
PhoneNumber = contractingParty.Phone,
CeoName = contractingParty.IsLegal == "حقیقی"
? $"{contractingParty.FName} {contractingParty.LName}"
: $"{contractingParty.CeoFName} {contractingParty.CeoLName}",
CompanyNameOrFullName = contractingParty.IsLegal == "حقیقی"
? $"{contractingParty.FName} {contractingParty.LName}"
: contractingParty.LName,
NationalCodeOrNationalId =
contractingParty.IsLegal == "حقیقی" ? contractingParty.Nationalcode : contractingParty.NationalId,
LegalType = contractingParty.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
};
var lawViewModel = new LawViewModel()
{
Id = law.id,
CreatedAt = law.CreationDate,
HeadTitle = law.HeadTitle,
IsActive = law.IsActive,
Items = law.Items.Select(x => new LawItemViewModel()
{
Details = x.Details,
Header = x.Header
}).ToList(),
Notifications = law.Notifications,
Title = law.Title,
Type = law.Type,
Version = law.Version
};
var item = new InstitutionContractPrintViewModel()
{
ContractStart = institution.ContractStartFa,
ContractEnd = institution.ContractEndFa,
ContractNo = institution.ContractNo,
CreationDate = institution.CreationDate.ToFarsi(),
FirstParty = _firstParty,
SecondParty = secondParty,
LawViewModel = lawViewModel,
Obligation = institution.Obligation.ToMoney(),
PaymentPrice = institution.TotalAmount.ToMoney(),
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
TaxPrice = institution.ValueAddedTax.ToMoney(),
VerifierFullName = institution.VerifierFullName,
VerifierPhoneNumber = institution.VerifierPhoneNumber,
VerifyCode = institution.VerifyCode,
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
Workshops = institution.WorkshopGroup.CurrentWorkshops
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
{
Name = x.WorkshopName,
PersonnelCount = x.PersonnelCount,
Services = new WorkshopServicesViewModel()
{
Contract = x.Services.Contract,
ContractInPerson = x.Services.ContractInPerson,
CustomizeCheckout = x.Services.CustomizeCheckout,
Insurance = x.Services.Insurance,
InsuranceInPerson = x.Services.InsuranceInPerson,
RollCall = x.Services.RollCall,
RollCallInPerson = x.Services.RollCallInPerson
},
Price = x.Price.ToMoney()
}).ToList()
};
res.Add(item);
}
return res;
}
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
{
var amendmentTemp = await _institutionAmendmentTemp
.Find(x=>x.Id == request.TempId).FirstOrDefaultAsync();
if (amendmentTemp == null)
throw new BadRequestException("دیتای وارد شده نامعتبر است");
var institutionContract = await _context.InstitutionContractSet
.Include(x=>x.Amendments)
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.CurrentWorkshops)
.FirstOrDefaultAsync(x => x.id == amendmentTemp.InstitutionContractId);
List<InstitutionContractInstallment> installments = [];
double amount = 0;
if (request.IsInstallment)
{
installments = amendmentTemp.MonthlyPayment.Installments.Select(x=>
new InstitutionContractInstallment(x.InstalmentDate.ToGeorgianDateTime(),
x.InstallmentAmountStr.MoneyToDouble(), "")).ToList();
amount = amendmentTemp.MonthlyPayment.PaymentAmount.MoneyToDouble();
}
else
{
amount = amendmentTemp.OneTimePayment.PaymentAmount.MoneyToDouble();
}
var newWorkshops = amendmentTemp
.NewWorkshops.Where(x=>x.CurrentWorkshopId ==0).ToList();
var newWorkshopTempIds = newWorkshops.Select(x=>x.Id).ToList();
var changes = newWorkshops.Select(x=>
InstitutionContractAmendmentChange.CreateWorkshopCreatedChange(DateTime.Now,x.RollCall,x.RollCallInPerson,x.CustomizeCheckout,
x.ContractAndCheckout,x.ContractAndCheckoutInPerson,x.Insurance,x.InsuranceInPerson,x.CountPerson)).ToList();
var changedWorkshops = amendmentTemp.NewWorkshops
.Where(x => !newWorkshopTempIds.Contains(x.Id)).ToList();
foreach (var changedWorkshop in changedWorkshops)
{
var prev = amendmentTemp.PrevWorkshops.FirstOrDefault(x => x.Id == changedWorkshop.Id);
if (prev == null)
throw new BadRequestException("دیتای وارد شده ناقص ذخیره شده است");
// مقایسه مقادیر بولین بین prev و changedWorkshop برای تشخیص تغییرات
var changedBooleans = new Dictionary<string, (bool Previous, bool Current)>();
if (prev.CustomizeCheckout != changedWorkshop.CustomizeCheckout)
changedBooleans.Add("CustomizeCheckout", (prev.CustomizeCheckout, changedWorkshop.CustomizeCheckout));
if (prev.ContractAndCheckout != changedWorkshop.ContractAndCheckout)
changedBooleans.Add("ContractAndCheckout", (prev.ContractAndCheckout, changedWorkshop.ContractAndCheckout));
if (prev.ContractAndCheckoutInPerson != changedWorkshop.ContractAndCheckoutInPerson)
changedBooleans.Add("ContractAndCheckoutInPerson", (prev.ContractAndCheckoutInPerson, changedWorkshop.ContractAndCheckoutInPerson));
if (prev.Insurance != changedWorkshop.Insurance)
changedBooleans.Add("Insurance", (prev.Insurance, changedWorkshop.Insurance));
if (prev.InsuranceInPerson != changedWorkshop.InsuranceInPerson)
changedBooleans.Add("InsuranceInPerson", (prev.InsuranceInPerson, changedWorkshop.InsuranceInPerson));
if (prev.RollCall != changedWorkshop.RollCall)
changedBooleans.Add("RollCall", (prev.RollCall, changedWorkshop.RollCall));
if (prev.RollCallInPerson != changedWorkshop.RollCallInPerson)
changedBooleans.Add("RollCallInPerson", (prev.RollCallInPerson, changedWorkshop.RollCallInPerson));
// اگر تغییری وجود داشته باشد، آن را به لیست تغییرات اضافه کن
if (changedBooleans.Any())
{
var change = InstitutionContractAmendmentChange.CreateServicesChange(
DateTime.Now,
changedWorkshop.WorkshopId,
changedWorkshop.RollCall,
changedWorkshop.RollCallInPerson,
changedWorkshop.CustomizeCheckout,
changedWorkshop.ContractAndCheckout,
changedWorkshop.ContractAndCheckoutInPerson,
changedWorkshop.Insurance,
changedWorkshop.InsuranceInPerson);
changes.Add(change);
}
if (changedWorkshop.CountPerson != prev.CountPerson)
{
var difference = changedWorkshop.CountPerson - prev.CountPerson;
var change = InstitutionContractAmendmentChange.CreatePersonCountChange(
DateTime.Now,
changedWorkshop.CountPerson,
difference,changedWorkshop.WorkshopId);
changes.Add(change);
}
}
var amendment = new InstitutionContractAmendment(institutionContract.id,installments,amount,
request.IsInstallment,changes,request.LawId);
institutionContract.AddAmendment(amendment);
await _smsService.SendInstitutionAmendmentVerificationLink(
institutionContract.VerifierPhoneNumber,
institutionContract.ContractingPartyName,
institutionContract.PublicId,
institutionContract.ContractingPartyId,
institutionContract.id
);
await _institutionAmendmentTemp.DeleteOneAsync(x=>x.Id == amendmentTemp.Id);
await _context.SaveChangesAsync();
}
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id,
long amendmentId)
{
var institutionContract = await _context.InstitutionContractSet
.Include(x => x.Amendments)
.FirstOrDefaultAsync(x => x.PublicId == id);
if (institutionContract == null)
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
var amendment = institutionContract.Amendments
.FirstOrDefault(x => x.id == amendmentId);
if (amendment == null)
throw new NotFoundException("ارتقا یافت نشد");
if (amendment.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
throw new BadRequestException("این ارتقا قبلا تایید شده است");
throw new NotImplementedException();
}

View File

@@ -7,11 +7,14 @@ using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.InfraStructure;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.CheckoutAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.EmployeeChildrenAgg;
using Company.Domain.EmployeeInsurancListDataAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.InsuranceListAgg;
using Company.Domain.InsuranceWorkshopAgg;
using Company.Domain.InsuranceYearlySalaryAgg;
@@ -132,6 +135,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
var id = insuranceListObj.id;
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
{
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
var checkouts = _context.CheckoutSet.Where(x =>
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
x.IsActiveString == "true");
foreach (var item in command.EmployeeInsurancListDataList)
{
if (item.EmployeeInsurancListDataId == 0)
@@ -158,6 +166,29 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears,
item.MarriedAllowance, item.OverTimePay, item.FamilyAllowance);
}
if (checkouts.Any())
{
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
if (checkout != null)
{
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
{
checkout.SetUpdateNeeded();
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
{
var createWarrning =
new CheckoutWarningMessage(
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
_context.CheckoutWarningMessages.Add(createWarrning);
}
_context.SaveChanges();
}
}
}
}
_employeeInsurancListDataRepository.SaveChanges();
@@ -698,6 +729,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
var id = insuranceListObj.id;
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
{
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
var checkouts = _context.CheckoutSet.Where(x =>
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
x.IsActiveString == "true");
foreach (var item in command.EmployeeInsurancListDataList)
{
var employeeInsurancListData = new EmployeeInsurancListData(id,
@@ -711,6 +747,28 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears, item.MarriedAllowance,
item.OverTimePay, item.FamilyAllowance);
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
if (checkouts.Any())
{
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
if (checkout != null)
{
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
{
checkout.SetUpdateNeeded();
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
{
var createWarrning =
new CheckoutWarningMessage(
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
_context.CheckoutWarningMessages.Add(createWarrning);
}
_context.SaveChanges();
}
}
}
}
_employeeInsurancListDataRepository.SaveChanges();
@@ -1411,6 +1469,27 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
}
public List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId)
{
var res = _context.InsuranceListSet
.Where(x => x.StartDate <= startDate && x.EndDate >= startDate &&
x.WorkshopId == workshopId)
.Join(_context.EmployeeInsurancListDataSet,
insuranceList => insuranceList.id,
employeeInsurancListData => employeeInsurancListData.InsuranceListId,
(insuranceList, employeeInsurancListData) => new EmployeeInsurancListDataViewModel
{
InsuranceListId = insuranceList.id,
EmployeeId = employeeInsurancListData.EmployeeId,
WorkingDays = employeeInsurancListData.WorkingDays,
BenefitsIncludedNonContinuous = employeeInsurancListData.BenefitsIncludedNonContinuous,
InsuranceShare = employeeInsurancListData.InsuranceShare,
});
return res.ToList();
}
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceDataForEdit(long insuranceListId,
DateTime startDate, DateTime endDate)
{

View File

@@ -97,7 +97,7 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate);
}
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
var list = query.ToList().Select(x => new LoanViewModel()
var list = query.OrderByDescending(x=>x.StartInstallmentPayment).ToList().Select(x => new LoanViewModel()
{
Amount = x.Amount.ToMoney(),
AmountDouble = x.Amount,

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ using _0_Framework.InfraStructure;
using Company.Domain.RewardAgg;
using CompanyManagment.App.Contracts.Reward;
using Microsoft.EntityFrameworkCore;
using SharpCompress.Compressors.Xz;
namespace CompanyManagment.EFCore.Repository;
@@ -119,12 +120,12 @@ public class RewardRepository : RepositoryBase<long, Reward>, IRewardRepository
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
var list = query.ToList().Select(x => new RewardViewModel
var list = query.ToList().OrderByDescending(x=>x.GrantDate).Select(x => new RewardViewModel
{
WorkshopId = x.WorkshopId,
Amount = x.Amount.ToMoney(),
AmountDouble = x.Amount,
Description = x.Description,
Description = x.Description ?? "",
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
EmployeeId = x.EmployeeId,
GrantDateFa = x.GrantDate.ToFarsi(),

View File

@@ -478,7 +478,8 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
public RollCallEmployee GetBy(long employeeId, long workshopId)
{
return _context.RollCallEmployees.Include(x => x.EmployeesStatus).FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
return _context.RollCallEmployees.Include(x => x.EmployeesStatus)
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
}
#endregion

View File

@@ -18,6 +18,8 @@ public class SmsService : ISmsService
{
private readonly IConfiguration _configuration;
private readonly ISmsResultRepository _smsResultRepository;
private readonly bool _isDevEnvironment;
private readonly List<string> _testNumbers;
public SmsIr SmsIr { get; set; }
@@ -27,6 +29,33 @@ public class SmsService : ISmsService
_smsResultRepository = smsResultRepository;
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
// خواندن تنظیمات SMS از appsettings
var smsSettings = _configuration.GetSection("SmsSettings");
_isDevEnvironment = smsSettings.GetValue<bool>("IsTestMode");
_testNumbers = smsSettings.GetSection("TestNumbers").Get<List<string>>() ?? new List<string>();
}
/// <summary>
/// متد مرکزی برای ارسال پیامک که محیط dev را چک می‌کند
/// </summary>
private async Task<SmsIrResult<VerifySendResult>> VerifySendSmsAsync(string number, int templateId, VerifySendParameter[] parameters)
{
// اگر محیط dev است و شماره‌های تست وجود دارد، به شماره‌های تست ارسال می‌شود
if (_isDevEnvironment && _testNumbers is { Count: > 0 })
{
// ارسال به همه شماره‌های تست
SmsIrResult<VerifySendResult> lastResult = null;
foreach (var testNumber in _testNumbers)
{
lastResult = await SmsIr.VerifySendAsync(testNumber, templateId, parameters);
}
return lastResult; // برگرداندن نتیجه آخرین ارسال
}
else
{
// ارسال به شماره واقعی
return await SmsIr.VerifySendAsync(number, templateId, parameters);
}
}
public void Send(string number, string message)
@@ -56,12 +85,7 @@ public class SmsService : ISmsService
}
public bool VerifySend(string number, string message)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
var verificationSendResult = smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -90,11 +114,7 @@ public class SmsService : ISmsService
public bool LoginSend(string number, string message)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
var verificationSendResult = smsIr.VerifySendAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -119,11 +139,8 @@ public class SmsService : ISmsService
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var result = new SentSmsViewModel();
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
Thread.Sleep(2000);
if (sendResult.Message == "موفق")
@@ -148,9 +165,8 @@ public class SmsService : ISmsService
var checkLength = fullName.Length;
if (checkLength > 25)
fullName = fullName.Substring(0, 24);
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var sendResult = smsIr.VerifySendAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
Console.WriteLine(userName + " - " + sendResult.Result.Status);
@@ -332,18 +348,39 @@ public class SmsService : ISmsService
}
}
public async Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
{
var guidStr=institutionId.ToString();
var firstPart = guidStr.Substring(0, 15);
var secondPart = guidStr.Substring(15);
var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
{
new("FULLNAME", fullName),
new("CODE1",firstPart),
new("CODE2",secondPart)
});
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ایجاد قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
return verificationSendResult.Status == 0;
}
public async Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
long contractingPartyId, long institutionContractId)
{
var guidStr=institutionId.ToString();
var firstPart = guidStr.Substring(0, 15);
var secondPart = guidStr.Substring(15);
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
{
new("FULLNAME", fullName),
new("CODE1",firstPart),
new("CODE2",secondPart)
});
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ارتقا قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
@@ -353,7 +390,7 @@ public class SmsService : ISmsService
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId)
{
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
{
new("VERIFYCODE", code)
});

View File

@@ -9,20 +9,20 @@ using WorkFlow.Application.Contracts.WorkFlow;
namespace Query.AdminReports.Handlers
{
public interface IGetWorkshopWithRollCallHandler
{
List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters);
}
public interface IGetWorkshopWithRollCallHandler
{
List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters);
}
public class GetWorkshopWithRollCallHandler: IGetWorkshopWithRollCallHandler
{
public class GetWorkshopWithRollCallHandler : IGetWorkshopWithRollCallHandler
{
private readonly CompanyContext _companyContext;
private readonly IWorkFlowApplication workFlowApplication;
public GetWorkshopWithRollCallHandler(CompanyContext companyContext, IWorkFlowApplication workFlowApplication)
{
_companyContext = companyContext;
this.workFlowApplication = workFlowApplication;
_companyContext = companyContext;
this.workFlowApplication = workFlowApplication;
}
public List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters)
@@ -30,7 +30,6 @@ namespace Query.AdminReports.Handlers
var now = DateTime.Now.Date;
var lastWeek = now.AddDays(-7);
//workshop filter by parameters
var rollCallServiceQuery = _companyContext.RollCallServices.AsSplitQuery();
@@ -46,35 +45,49 @@ namespace Query.AdminReports.Handlers
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.ServiceType == parameters.RollCallServiceType);
if (parameters.FilterMode == FilterMode.Active)
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.StartService.Date <= now && x.EndService.Date >= now);
else if (parameters.FilterMode == FilterMode.DeActive)
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.EndService.Date < now || x.StartService.Date > now);
rollCallServiceQuery =
rollCallServiceQuery.Where(x => x.StartService.Date <= now && x.EndService.Date >= now);
var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id, (rcs, workshop) =>
new WorkshopWithRollCallServiceQueryModel()
{
WorkshopId = workshop.id,
RollCallServiceType = rcs.ServiceType,
WorkshopName = workshop.WorkshopFullName,
MaxPersonValid = rcs.MaxPersonValid,
IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now,
ServiceStart = rcs.StartService,
ServiceEnd = rcs.EndService
});
else if (parameters.FilterMode == FilterMode.DeActive)
rollCallServiceQuery =
rollCallServiceQuery.Where(x => x.EndService.Date < now || x.StartService.Date > now);
var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id,
(rcs, workshop) =>
new WorkshopWithRollCallServiceQueryModel()
{
WorkshopId = workshop.id,
RollCallServiceType = rcs.ServiceType,
WorkshopName = workshop.WorkshopFullName,
MaxPersonValid = rcs.MaxPersonValid,
IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now,
ServiceStart = rcs.StartService,
ServiceEnd = rcs.EndService
});
//workshop population
var workshopLeftWorks = _companyContext.Workshops.AsSplitQuery().Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
.Select(x => new
{
WorkshopId = x.id,
LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now).Select(y => y.EmployeeId),
LeftWorkInsurances = x.LeftWorkInsurances.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null)).Select(y => y.EmployeeId)
}).ToList();
var workshopLeftWorks = _companyContext.Workshops.AsSplitQuery()
.Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks)
.Include(x => x.LeftWorkInsurances)
.Select(x => new
{
WorkshopId = x.id,
LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now)
.Select(y => y.EmployeeId),
LeftWorkInsurances = x.LeftWorkInsurances
.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null))
.Select(y => y.EmployeeId)
}).ToList();
var workshopsWorkingEmployeesList = workshopLeftWorks
.Select(x => new { x.WorkshopId, TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count(), EmployeeIds = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct() }).ToList();
.Select(x =>
new
{
x.WorkshopId,
TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count(),
EmployeeIds = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct()
}).ToList();
var activeEmployees = _companyContext.RollCallEmployees.AsSplitQuery()
@@ -83,15 +96,25 @@ namespace Query.AdminReports.Handlers
workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId))
.Select(x => new { x.WorkshopId, x.EmployeeId });
var lastWeekRollCalls = _companyContext.RollCalls.AsSplitQuery().Where(x => x.StartDate.HasValue && x.StartDate.Value >= lastWeek
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).GroupBy(x => x.EmployeeId).Select(x => x.Key);
var lastWeekRollCalls = _companyContext.RollCalls.AsSplitQuery()
.Where(x => x.StartDate.HasValue &&
x.StartDate.Value >= lastWeek
&& workshopsWithService
.Any(y => y.WorkshopId == x.WorkshopId))
.GroupBy(x => x.EmployeeId)
.Select(x => x.Key);
var leaves = _companyContext.LeaveList.AsSplitQuery().Where(x => x.StartLeave <= lastWeek && x.EndLeave >= now && (x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه")
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => x.EmployeeId);
var leaves = _companyContext.LeaveList.AsSplitQuery().Where(x =>
x.StartLeave <= lastWeek && x.EndLeave >= now &&
(x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه")
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId))
.Select(x => x.EmployeeId);
var activeEmployeesList = activeEmployees.ToList().Where(x => workshopsWorkingEmployeesList.Any(w => w.WorkshopId == x.WorkshopId && w.EmployeeIds.Contains(x.EmployeeId)));
var activeEmployeesList = activeEmployees.ToList().Where(x =>
workshopsWorkingEmployeesList.Any(w =>
w.WorkshopId == x.WorkshopId && w.EmployeeIds.Contains(x.EmployeeId)));
var lastWeekRollCallsList = lastWeekRollCalls.ToList();
var leavesList = leaves.ToList();
var workshopsWithServiceList = workshopsWithService.ToList();
@@ -107,12 +130,13 @@ namespace Query.AdminReports.Handlers
MaxPersonValid = x.MaxPersonValid,
WorkshopName = x.WorkshopName,
ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId),
ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId &&
ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y =>
y.WorkshopId == x.WorkshopId &&
lastWeekRollCallsList.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)),
TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.TotalWorkingEmployeesCount ?? 0,
TotalEmployeesCount = workshopsWorkingEmployeesList
.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.TotalWorkingEmployeesCount ?? 0,
//UndoneWorkFlowsCount = workFlowApplication.GetAllWorkFlowCount(x.WorkshopId).Result
}).OrderByDescending(x => x.IsActive).ToList();
}
}
}
}

View File

@@ -13,15 +13,8 @@
public int ActiveEmployeesWithRollCallInLastWeekCount { get; set; }
public int UndoneWorkFlowsCount { get; set; }
public float ActiveEmployeesWithRollCallPercentage
{
get
{
return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100;
}
}
public float ActiveEmployeesWithRollCallPercentage => ActiveEmployeesCount == 0 ? 0f : ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100f;
public int MaxPersonValid { get; set; }
public bool IsActive { get; set; }

View File

@@ -0,0 +1,49 @@
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using Microsoft.AspNetCore.Mvc;
using Query.AdminReports.Handlers;
using Query.AdminReports.Models;
using ServiceHost.BaseControllers;
using WorkFlow.Application.Contracts.WorkFlow;
namespace ServiceHost.Areas.Admin.Controllers;
public class RollCallController:AdminBaseController
{
private readonly IGetWorkshopWithRollCallHandler _workshopWithRollCallHandler;
private readonly IWorkFlowApplication _workFlowApplication;
private readonly long _currentAccountId;
public RollCallController(IGetWorkshopWithRollCallHandler workshopWithRollCallHandler,IAuthHelper _authHelper, IWorkFlowApplication workFlowApplication)
{
_workshopWithRollCallHandler = workshopWithRollCallHandler;
_workFlowApplication = workFlowApplication;
_currentAccountId = _authHelper.CurrentAccountId();
}
[HttpGet("report")]
public ActionResult<List<WorkshopWithRollCallServiceQueryModel>> GetRollCallReport([FromQuery] WorkshopWithRollCallServiceQueryParameters searchModel)
{
var result = _workshopWithRollCallHandler.Handle(searchModel);
return result;
}
[HttpGet("report/workshops-select-list")]
public ActionResult<List<WorkshopSelectList>> GetWorkshopsSelectList()
{
var result = _workshopWithRollCallHandler.Handle(new WorkshopWithRollCallServiceQueryParameters())
.Select(x => new WorkshopSelectList
{
Id = x.WorkshopId,
WorkshopFullName = x.WorkshopName
}).Distinct().ToList();
return result;
}
[HttpGet("repoert/workfloecount/{workshopId}")]
public async Task<ActionResult<int>> GetWorkFlowCountByWorkshopId(long workshopId)
{
var result = await _workFlowApplication.GetAllWorkFlowCount(workshopId, _currentAccountId);
return result;
}
}

View File

@@ -541,18 +541,52 @@ public class institutionContractController : AdminBaseController
var res =await _institutionContractApplication.InsertAmendmentTempWorkshops(request);
return res;
}
[HttpDelete("amendment/remove-temp-workshops/{workshopTempId:guid}")]
public async Task<ActionResult> RemoveAmendmentWorkshops(Guid workshopTempId)
{
await _institutionContractApplication.RemoveAmendmentWorkshops(workshopTempId);
return Ok();
}
[HttpPost("amendment/payment-details")]
public async Task<ActionResult<InsitutionContractAmendmentPaymentResponse>> GetAmendmentPaymentDetails([FromBody]InsitutionContractAmendmentPaymentRequest request)
{
var res =await _institutionContractApplication.GetAmendmentPaymentDetails(request);
return res;
}
[HttpPost("amendment/complete")]
public async Task<ActionResult> AmendmentComplete(
[FromBody] InstitutionContractAmendmentCompleteRequest request)
{
await _institutionContractApplication.AmendmentComplete(request);
return Ok();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("/api/institutionContract/amendment-Verification/{id:guid}/{amendmentId:long}")]
[AllowAnonymous]
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id,long amendmentId)
{
return await _institutionContractApplication.GetAmendmentVerificationDetails(id,amendmentId);
}
[HttpPost("/api/institutionContract/Verify-amendment")]
[AllowAnonymous]
public async Task<ActionResult<OperationResult>> VerifyAmendment([FromBody] InstitutionVerificationRequest command)
{
throw new NotImplementedException();
//var res = await _institutionContractApplication.AmendmentVerifyOtp(command.Id, command.Code);
//return res;
}
[HttpGet("edit-old/{id}")]
@@ -744,6 +778,12 @@ public class institutionContractController : AdminBaseController
return result;
}
[HttpGet("print/{id}")]
public async Task<ActionResult<InstitutionContractPrintViewModel>> PrintOne(long id)
{
var res =await _institutionContractApplication.PrintOneAsync(id);
return res;
}
}

View File

@@ -32,6 +32,12 @@ using ServiceHost.Hubs;
using System.Diagnostics.Contracts;
using WorkFlow.Application.Contracts.WorkFlow;
using System.Globalization;
using Company.Domain.LeftWorkInsuranceAgg;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.InsuranceListAgg;
using CompanyManagment.App.Contracts.InsuranceList;
using CompanyManagment.EFCore.Repository;
using System.Linq;
namespace ServiceHost.Areas.Admin.Pages.Company.Checkouts;
@@ -59,6 +65,9 @@ public class IndexModel : PageModel
private readonly IYearlySalaryApplication _yearlySalaryApplication;
private readonly IYearlySalaryRepository _yearlySalaryRepository;
private readonly IWorkFlowApplication _workFlowApplication;
private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
private readonly IInsuranceListApplication _insuranceListApplication;
private readonly IInsuranceListRepository _insuranceListRepository;
public List<CheckoutViewModel> chekoutlist;
@@ -100,7 +109,7 @@ public class IndexModel : PageModel
ILeaveApplication leaveApplication, IHubContext<CheckoutHub> hubContext,
IEmployeeComputeOptionsApplication employeeComputeOptionsApplication,
IRollCallMandatoryApplication rollCallMandatoryApplication,
IRollCallEmployeeStatusApplication rollCallEmployeeStatusApp, IWorkFlowApplication workFlowApplication)
IRollCallEmployeeStatusApplication rollCallEmployeeStatusApp, IWorkFlowApplication workFlowApplication, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IInsuranceListApplication insuranceListApplication, IInsuranceListRepository insuranceListRepository)
{
_contractApplication = contractApplication;
_workshopApplication = workshopApplication;
@@ -124,6 +133,9 @@ public class IndexModel : PageModel
_rollCallMandatoryApplication = rollCallMandatoryApplication;
_rollCallEmployeeStatusApp = rollCallEmployeeStatusApp;
_workFlowApplication = workFlowApplication;
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
_insuranceListApplication = insuranceListApplication;
_insuranceListRepository = insuranceListRepository;
}
public string Message { get; set; }
@@ -165,7 +177,7 @@ public class IndexModel : PageModel
var searchResult = await _checkoutApplication.SearchCheckoutOptimized(searchModel);
var result = new MainViewModel();
var result = new CompanyManagment.App.Contracts.Checkout.MainViewModel();
result.IsSysManager = accountId is 2 or 3;
result.MainList = searchResult;
if (searchModel.WorkshopId != 0 || searchModel.EmployeeId != 0)
@@ -759,11 +771,36 @@ public class IndexModel : PageModel
var maxNumber = Convert.ToDouble(ContractsId.Count());
if (ContractsId.Count > 0)
{
#region Insurance
var watch = new Stopwatch();
watch.Start();
var contractpData = _contractApplication.GetDetails(ContractsId[0]);
var startMonthFa = $"{ConvertYear}/{ConvertMonth.PadLeft(2, '0')}/01";
DateTime startDateGr = startMonthFa.ToGeorgianDateTime();
DateTime endDateGr = startMonthFa.FindeEndOfMonth().ToGeorgianDateTime();
int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2));
var insuranceListData =
_insuranceListRepository.EmployeeInsuranceDataBy(startDateGr, contractpData.WorkshopIds);
var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, ConvertYear);
var insuranceEmployeeData =
_leftWorkInsuranceRepository.GetEmployeeInsuranceLeftWorksAndInformation(contractpData.WorkshopIds, startDateGr,
endDateGr);
Console.WriteLine("checkout-test-timer" + watch.Elapsed);
watch.Stop();
#endregion
//int i = 0;
foreach (var item in ContractsId)
{
var contract = _contractApplication.GetDetails(item);
//var workingHours = _workingHoursApplication.GetByContractId(contract.Id);
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(contract.Id);
var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth,
@@ -992,7 +1029,78 @@ public class IndexModel : PageModel
officialHoliday, totalHoursH, totalHoursM, consumableItemDouble, housingAllowanceDouble,
familyAllowanceDouble, marriedAllowanceDouble, workshop.IsOldContract);
#region Insurance
double insuranceShare = 0;
//اگر پرسنل داری شروع بکار بیمه بود
var insuranceEmployeeDataItem =
insuranceEmployeeData.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
//اگر لیست بیمه برای پرسنل ساخته شده بود
var insuranceListDataWithDetails =
insuranceListData.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
if (insuranceListDataWithDetails != null)
{
insuranceShare = insuranceListDataWithDetails.InsuranceShare;
}
else
{
if (insuranceEmployeeDataItem != null && insuranceEmployeeDataItem.StartWorkDateGr <= separation.ContractEndGr)
{
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(insuranceEmployeeDataItem.StartWorkDateGr, separation.LeftWorkDate, startDateGr, endDateGr, insuranceEmployeeDataItem.EmployeeId);
var leftWorkFa = workingDays.hasLeftWorkInMonth ? separation.LeftWorkDate.ToFarsi() : "";
//به دست آوردن دستمزد روزانه با توجه به اینکه کارگاه مشاغل مقطوع است یا خیر
double dailyWage = 0;
if (workshop.FixedSalary)
{
var res = _insuranceListApplication.GetDailyWageFixedSalary(ConvertYear, workshop.Id, insuranceEmployeeDataItem.EmployeeId, startDateGr,
endDateGr, insuranceEmployeeDataItem.JobId, workshop.Population, workshop.InsuranceJobId);
dailyWage = res ?? 0;
}
else
{
var res = _insuranceListApplication.ComputeDailyWage(yearlysaleries.DayliWage, insuranceEmployeeDataItem.EmployeeId, workshop.Id, ConvertYear);
dailyWage = res;
}
//بدست آوردن پایه سنوات
var baseYears = _insuranceListRepository.GetEmployeeInsuranceBaseYear(insuranceEmployeeDataItem.EmployeeId, workshop.Id,
workingDays.countWorkingDays, startDateGr, endDateGr, workingDays.startWork, workingDays.endWork, workingDays.hasLeftWorkInMonth);
//جمع مزد روزانه و پایه سنوات
var dailyWagePlusBaseYears = dailyWage + baseYears.baseYear;
//دستمزد ماهانه با محاسبه پایه سنوات
var monthlySalary = _insuranceListApplication.GetRoundValue(dailyWagePlusBaseYears * workingDays.countWorkingDays);
//حق تاهل
var marriedAllowance = employee.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0;
//محاسبه مزایای ماهانه
var monthlyBenefits = _insuranceListApplication.GetMonthlyBenefits(endOfMonth, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marriedAllowance, workingDays.countWorkingDays, workshop.TypeOfInsuranceSend, insuranceEmployeeDataItem.JobId, insuranceEmployeeDataItem.EmployeeId, insuranceEmployeeDataItem.IncludeStatus);
if (workshop.InsuranceCheckoutOvertime)
{
monthlyBenefits = _insuranceListApplication.GetRoundValue(monthlyBenefits += overTimeWorking);
}
//محاسبه جمع مزایای مشمول و دستمزد ماهانه
var benefitsIncludedContinuous = monthlyBenefits + monthlySalary;
//محاسبه حق بیمه سهم بیمه شده
insuranceShare = (benefitsIncludedContinuous * 7) / 100;
}
}
#endregion
var command = new CreateCheckout
{
EmployeeFullName = employee.EmployeeFullName,
@@ -1098,7 +1206,11 @@ public class IndexModel : PageModel
DailySalaryAffected = mandatoryCompute.DailySalaryAffected,
#region InsuranceShare
InsuranceDeduction = _insuranceListApplication.GetRoundValue(insuranceShare),
#endregion

View File

@@ -2,8 +2,135 @@
@{
<style>
.btn-lime {
background-color: #84cc16;
border: 1px solid #84cc16;
background-color: #84cc16;
border: 1px solid #84cc16;
}
.fulltext {
opacity: 0;
white-space: nowrap;
}
.ellipsed {
display: block;
width: 100%;
text-overflow: ellipsis;
overflow-x: clip;
white-space: nowrap;
}
.date-box {
display: flex;
align-items: center;
}
.tooltipfull-containerText {
cursor: pointer;
position: absolute;
display: inline-block;
right: -2px;
top: 13px;
}
.tooltip {
opacity: 0;
z-index: 99;
color: #fff;
width: 220px;
display: block;
font-size: 14px;
font-family: 'IranSans';
padding: 5px 10px;
border-radius: 3px;
text-align: center;
/*text-shadow: 1px 1px 2px #111;*/
background: #e67e22;
border: 1px solid #e67e22;
box-shadow: 0 0 3px rgba(0,0,0,0.5);
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
-ms-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -50px;
bottom: 40px;
}
.tooltip:before, .tooltip:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #e67e22;
position: absolute;
bottom: -10px;
left: 70%;
}
.tooltip-container:hover .tooltip, a:hover .tooltip {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.tooltipfull {
opacity: 0;
z-index: 99;
color: #fff;
/* width: 180px;*/
display: block;
font-size: 12px;
font-family: 'IranSans';
padding: 5px 10px;
border-radius: 15px;
text-align: center;
/*text-shadow: 1px 1px 2px #111;*/
background: #950000;
border: 1px solid #950000;
box-shadow: 0 0 3px rgba(0,0,0,0.5);
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
/* -ms-transition: all .2s ease-in-out;*/
transition: all .2s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
right: -2px;
bottom: 20px;
white-space: nowrap;
}
.tooltipfull:before, .tooltipfull:after {
content: '';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #950000;
position: absolute;
bottom: -10px;
left: 50%;
}
.tooltipfull-containerText:hover .tooltipfull, a:hover .tooltipfull {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
</style>
@@ -102,14 +229,41 @@
<td class="code-td">
<span class="ellipsed">
@item.Month
@{
<span>&nbsp;</span>
if(item.IsUpdateNeeded){
<i style="color: #cb1c1c; font-size:17px !important" class="fa fa-exclamation-triangle" aria-hidden="true"></i>
}
}
</span>
<div class="tooltipfull-containerText">
<p class="fulltext">
@item.Month
</p>
<span class="tooltipfull">
@item.Month
</span>
@{
if (item.IsUpdateNeeded)
{
foreach (var warning in item.CheckoutWarningMessageList)
{
<p class="fulltext">
@warning.WarningMessage
</p>
<span class="tooltipfull" style="right: -103px;bottom: 20px;">
@warning.WarningMessage
</span>
}
}
else
{
<p class="fulltext">
@item.Month
</p>
<span class="tooltipfull">
@item.Month
</span>
}
}
</div>
</td>
<td class="name-td">

View File

@@ -287,7 +287,7 @@
<div class="textsChart">
<p class="alltxt">
<span style="width: 40px;display: inline-block;">@Model.ContrcatDone</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.ContractSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
</p>
<p class="alldonetxt">
<span style="width: 40px;display: inline-block;">@Model.ContractSignDone</span> : <span style="width: 62px;display: inline-block;color: #283344;">انجام شده</span>
@@ -353,7 +353,7 @@
<div class="textsChart">
<p class="alltxt">
<span style="width: 40px;display: inline-block;">@Model.CheckoutDone</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.CheckoutSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
</p>
<p class="alldonetxt">
<span style="width: 40px;display: inline-block;">@Model.CheckoutSignDone</span> : <span style="width: 62px;display: inline-block;color: #283344;">انجام شده</span>

View File

@@ -1,4 +1,5 @@
using _0_Framework.Application;
using AccountMangement.Infrastructure.EFCore;
using CompanyManagment.App.Contracts.Report;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.YearlySalary;
@@ -42,6 +43,7 @@ public class IndexModel : PageModel
public int ContrcatDone { get; set; }
public int ContractSignNotDone { get; set; }
public int ContractSignDone { get; set; }
public int ContractSignToBe { get; set; }
//تصفیه
public int AllCheckout { get; set; }
@@ -49,8 +51,9 @@ public class IndexModel : PageModel
public int CheckoutDone { get; set; }
public int CheckoutSignNotDone { get; set; }
public int CheckoutSignDone { get; set; }
public int CheckoutSignToBe { get; set; }
public async Task OnGet(string year, string month)
public async Task OnGet(string year, string month)
{
YearlyList = _yearlySalaryApplication.GetYears();
var allReports = await _reportApplication.GetAllReports(year, month);
@@ -73,19 +76,23 @@ public class IndexModel : PageModel
ContrcatDone = allReports.ContrcatDone;
ContractSignNotDone = allReports.ContractSignNotDone;
ContractSignDone = allReports.ContractSignDone;
AllCheckout = allReports.AllCheckout;
ContractSignToBe = allReports.ContractSignToBe;
AllCheckout = allReports.AllCheckout;
CheckoutNotDone = allReports.CheckoutNotDone;
CheckoutDone = allReports.CheckoutDone;
CheckoutSignNotDone = allReports.CheckoutSignNotDone;
CheckoutSignDone = allReports.CheckoutSignDone;
CheckoutSignToBe = allReports.CheckoutSignToBe;
}
#region workshopFirstLoad
public IActionResult OnGetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
{
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -96,7 +103,7 @@ public class IndexModel : PageModel
public IActionResult OnGetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
{
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -107,7 +114,7 @@ public class IndexModel : PageModel
public IActionResult OnGetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
{
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -118,7 +125,7 @@ public class IndexModel : PageModel
public IActionResult OnGetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
{
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -133,7 +140,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContract(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -143,7 +150,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContractSign(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -153,7 +160,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckout(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -163,7 +170,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckoutSign(string year, string month, long workshopId, long accountId)
{
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
return new JsonResult(new
{
success = true,
@@ -180,14 +187,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds);
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
return Partial("PrintAll", res);
}
public IActionResult OnGetPrintAllContractSignDone(string year, string month, long accountId, string workshopList)
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds);
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
return Partial("PrintAll", res);
}
@@ -195,14 +202,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds);
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
return Partial("PrintAll", res);
}
public IActionResult OnGetPrintAllCheckoutSignDone(string year, string month, long accountId, string workshopList)
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds);
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
return Partial("PrintAll", res);
}
//================Employee
@@ -211,7 +218,7 @@ public class IndexModel : PageModel
public IActionResult OnGetPrintEmployeeContract(string year, string month, long workshopId, string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -235,7 +242,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -258,7 +265,7 @@ public class IndexModel : PageModel
public IActionResult OnGetPrintEmployeeCheckout(string year, string month, long workshopId, string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
var final = new PrintEmployeeNotDone
{
@@ -277,7 +284,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
var final = new PrintEmployeeNotDone
{

View File

@@ -176,7 +176,7 @@
@* قراردادهای موسسه</a> *@
@* </li> *@
<li permission="308">
<a class="clik3" asp-area="AdminNew" asp-page="/Company/RollCall/Index">
<a class="clik3" href="https://admin@(AppSetting.Value.Domain)/rollcall">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
</svg>

View File

@@ -737,7 +737,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
x.PersonnelCount,
x.Price, x.InstitutionContractWorkshopGroupId,
group,
x.WorkshopId.Value);
x.WorkshopId.Value,false);
entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList());
return entity;

View File

@@ -238,7 +238,7 @@
@* </a> *@
@* </li> *@
<li permission="308">
<a class="clik3" asp-area="AdminNew" asp-page="/Company/RollCall/Index">
<a class="clik3" href="https://admin@(AppSetting.Value.Domain)/rollcall">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
</svg>

View File

@@ -8,6 +8,9 @@
Layout = "Shared/_ClientLayout";
ViewData["Title"] = " - " + "فیش حقوقی";
int i = 0;
const string hasAmountConflictText = "توجه داشته باشید این فیش حقوقی دارای تغییرات اعمال نشده میباشد. جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید!";
const string needUpdateText = "جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید";
}
@section Styles {
@@ -335,7 +338,7 @@
</span>
</div>
<div class="Rtable-cell column-heading d-none d-lg-block width11"> </div>
<div class="Rtable-cell column-heading d-none d-lg-block width2" >شماره پرسنلی</div>
<div class="Rtable-cell column-heading d-none d-lg-block width2">شماره پرسنلی</div>
<div class="Rtable-cell column-heading d-none d-md-block width3">سال</div>
<div class="Rtable-cell column-heading d-none d-md-block width4">ماه</div>
<div class="Rtable-cell column-heading d-none d-md-block width5">شماره قرارداد</div>
@@ -364,7 +367,10 @@
<div class="Rtable-cell d-lg-block d-none width11">
<div class="Rtable-cell--heading"> </div>
<div class="Rtable-cell--content">
@if (item.HasAmountConflict)
@if (item.IsUpdateNeeded || item.HasAmountConflict)
{
<svg xmlns="http://www.w3.org/2000/svg"
width="24" height="24" fill="red"
@@ -373,11 +379,30 @@
style="cursor: pointer; margin-left: 10px;"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="توجه داشته باشید این فیش حقوقی دارای تغییرات اعمال نشده میباشد. جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید!">
<path d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zm.1-5.995a.905.905 0 0 1 1.8 0l-.35 3.5a.552.552 0 0 1-1.1 0l-.35-3.5z"/>
title='@{
var tooltipText = ""; int messCounter = 1;
if (item.HasAmountConflict && !item.IsUpdateNeeded)
{
tooltipText += @hasAmountConflictText;
}else if (item.HasAmountConflict && item.IsUpdateNeeded)
{
foreach (var warning in item.CheckoutWarningMessageList) { tooltipText += " " + messCounter + " - " + warning.WarningMessage; messCounter++;}
tooltipText += " " + @needUpdateText; }
else if (!item.HasAmountConflict && item.IsUpdateNeeded)
{ foreach (var warning in item.CheckoutWarningMessageList) { tooltipText += " " + messCounter + " - " + warning.WarningMessage; messCounter++; }
tooltipText += " " + @needUpdateText;}
@Html.Raw(tooltipText)
}'>
<path d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" />
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zm.1-5.995a.905.905 0 0 1 1.8 0l-.35 3.5a.552.552 0 0 1-1.1 0l-.35-3.5z" />
</svg>
}
</div>
</div>
<div class="Rtable-cell d-lg-block d-none width2">

View File

@@ -356,6 +356,7 @@ else
app.UseExceptionHandler(options => { }); // این خط CustomExceptionHandler رو فعال می‌کنه
app.UseRouting();
app.UseWebSockets();
app.UseAuthentication();
app.UseAuthorization();

View File

@@ -38,6 +38,10 @@
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
},
"SmsSettings": {
"IsTestMode": true,
"TestNumbers": [ "09116967898", "09116067106", "09114221321" ]
}
}

View File

@@ -31,5 +31,9 @@
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
},
"SmsSettings": {
"IsTestMode": false,
"TestNumbers": []
}
}

View File

@@ -66,8 +66,7 @@ $(document).ready(function () {
let value = convertPersianNumbersToEnglish(element.val());
element.val(value);
});
new Cleave('.dateInput', {
new Cleave(this, {
delimiters: ['/', '/'],
blocks: [4, 2, 2],
numericOnly: true
@@ -78,6 +77,7 @@ $(document).ready(function () {
// datePattern: ['Y', 'm', 'd']
// });
});
//******************** انتخاب همه ی چک باکس ها ********************
$(".checkAll").change(function () {

View File

@@ -254,14 +254,14 @@ function loadEmployeeAjax(groupSettingId) {
<input type="text" class="form-control" id="searchEmployee" placeholder="جستجو ..." />
</div>
</div>`;
console.log(responseDataEmployee);
responseDataEmployee.forEach(function (itemEmployee) {
if (itemEmployee.isShiftChanged === true) {
isShiftChangedGlobal = true;
}
htmlEmployee += `<div></div>
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" data-employee-id="${itemEmployee.employeeId}">
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee ${itemEmployee.hasLeft?'disable':''}" data-employee-id="${itemEmployee.employeeId}">
<div class="Rtable-cell width1 widthMobile1">
<div class="Rtable-cell--content">
<span class="d-flex justify-content-center row-index2">

View File

@@ -1,6 +1,7 @@
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.RollCallAgg.DomainService;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.EmployeeDocuments;
using WorkFlow.Application.Contracts.RollCallConfirmedAbsence;
using WorkFlow.Application.Contracts.RollCallConfirmedWithoutLunchBreak;
@@ -23,7 +24,9 @@ public class WorkFlowApplication : IWorkFlowApplication
private readonly IRollCallDomainService _rollCallDomainService;
private readonly IRollCallConfirmedWithoutLunchBreakRepository _rollCallConfirmedWithoutLunchBreakRepository;
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
public WorkFlowApplication(IRollCallConfirmedAbsenceRepository absenceRepository, IWorkFlowRollCallACL rollCallACL, IWorkFlowCheckoutACL checkoutACL, IWorkFlowCustomizedWorkshopSettingsACL customizedWorkshopSettingsACL, IRollCallConfirmedWithoutLunchBreakRepository rollCallConfirmedWithoutLunchBreakRepository, IRollCallDomainService rollCallDomainService, IEmployeeDocumentsApplication employeeDocumentsApplication)
private readonly IWorkshopRepository _workshopRepository;
public WorkFlowApplication(IRollCallConfirmedAbsenceRepository absenceRepository, IWorkFlowRollCallACL rollCallACL, IWorkFlowCheckoutACL checkoutACL, IWorkFlowCustomizedWorkshopSettingsACL customizedWorkshopSettingsACL, IRollCallConfirmedWithoutLunchBreakRepository rollCallConfirmedWithoutLunchBreakRepository, IRollCallDomainService rollCallDomainService, IEmployeeDocumentsApplication employeeDocumentsApplication, IWorkshopRepository workshopRepository)
{
_absenceRepository = absenceRepository;
_rollCallACL = rollCallACL;
@@ -32,6 +35,7 @@ public class WorkFlowApplication : IWorkFlowApplication
_rollCallConfirmedWithoutLunchBreakRepository = rollCallConfirmedWithoutLunchBreakRepository;
_rollCallDomainService = rollCallDomainService;
_employeeDocumentsApplication = employeeDocumentsApplication;
_workshopRepository = workshopRepository;
}
public async Task<OperationResult> CreateRollCallConfirmedAbsence(CreateRollCallConfirmedAbsence command)
@@ -416,10 +420,17 @@ public class WorkFlowApplication : IWorkFlowApplication
/// </summary>
public async Task<List<DailyRollCallWorkFlowViewModel>> GetUndefinedRollCalls(long workshopId)
{
var now = DateTime.Now;
DateTime.Now.Date.AddMonthsFa(-2, out var twoMonthsAgo);
//استثنا برای کارگاه پیتزا امیر برای برای نمایش ندادن کارپوشه قبل از 1 آبان 1404
if(workshopId == 367 && twoMonthsAgo< new DateTime(2025,10,23))
{
twoMonthsAgo = new DateTime(2025,10,23);
}
var lastCheckouts = _checkoutACL.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, twoMonthsAgo, now);
List<DailyRollCallWorkFlowViewModel> rollCalls = _rollCallACL.GetUndefinedRollCalls(workshopId, twoMonthsAgo, now.AddDays(-1).Date);
var activeEmployees = _rollCallACL.GetActiveWorkshopRollCallEmployees(workshopId, twoMonthsAgo, now);
@@ -443,10 +454,17 @@ public class WorkFlowApplication : IWorkFlowApplication
/// </summary>
public async Task<List<DailyRollCallWorkFlowViewModel>> GetRollCallWorkFlowsCutByBgService(long workshopId)
{
var now = DateTime.Now;
DateTime.Now.Date.AddMonthsFa(-2, out var twoMonthsAgo);
//استثنا برای کارگاه پیتزا امیر برای برای نمایش ندادن کارپوشه قبل از 1 آبان 1404
if(workshopId == 367 && twoMonthsAgo< new DateTime(2025,10,23))
{
twoMonthsAgo = new DateTime(2025,10,23);
}
var lastCheckouts = _checkoutACL.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, twoMonthsAgo, now);
var rollCalls = _rollCallACL.GetRollCallWorkFlowsCutByBgService(workshopId, twoMonthsAgo, now.AddDays(-1).Date);
var activeEmployees = _rollCallACL.GetActiveWorkshopRollCallEmployees(workshopId, twoMonthsAgo, now);
@@ -468,6 +486,11 @@ public class WorkFlowApplication : IWorkFlowApplication
public async Task<int> CountCutByBgServiceLastMonth(long workshopId)
{
var workshop = _workshopRepository.Get(workshopId);
if (workshop == null || workshop.IsStaticCheckout)
return 0;
DateTime lastMonthEnd = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime().AddDays(-1);
var now = lastMonthEnd;
var twoMonthsAgo = ($"{lastMonthEnd.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
@@ -496,7 +519,11 @@ public class WorkFlowApplication : IWorkFlowApplication
/// </summary>
public async Task<int> CountAbsentRollCallLastMonth(long workshopId)
{
var workshop = _workshopRepository.Get(workshopId);
if (workshop == null || workshop.IsStaticCheckout)
return 0;
DateTime lastMonthEnd = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime().AddDays(-1);
var now = lastMonthEnd;
var twoMonthsAgo = ($"{lastMonthEnd.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
@@ -558,6 +585,11 @@ public class WorkFlowApplication : IWorkFlowApplication
public async Task<int> CountEmployeesWithoutLunchBreakLastMonth(long workshopId)
{
var workshop = _workshopRepository.Get(workshopId);
if (workshop == null || workshop.IsStaticCheckout)
return 0;
DateTime lastMonthEnd = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime().AddDays(-1);
var now = lastMonthEnd;
var twoMonthsAgo = ($"{lastMonthEnd.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
@@ -596,6 +628,11 @@ public class WorkFlowApplication : IWorkFlowApplication
public async Task<int> CountUndefinedLastMonth(long workshopId)
{
var workshop = _workshopRepository.Get(workshopId);
if (workshop == null || workshop.IsStaticCheckout)
return 0;
DateTime lastMonthEnd = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime().AddDays(-1);
var now = lastMonthEnd;
var twoMonthsAgo = ($"{lastMonthEnd.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
@@ -625,11 +662,17 @@ public class WorkFlowApplication : IWorkFlowApplication
/// </summary>
public async Task<List<DailyRollCallWorkFlowViewModel>> GetAbsentRollCallWorkFlows(long workshopId)
{
var now = DateTime.Now;
DateTime.Now.Date.AddMonthsFa(-2, out var twoMonthsAgo);
//استثنا برای کارگاه پیتزا امیر برای برای نمایش ندادن کارپوشه قبل از 1 آبان 1404
if(workshopId == 367 && twoMonthsAgo< new DateTime(2025,10,23))
{
twoMonthsAgo = new DateTime(2025,10,23);
}
var lastCheckouts = _checkoutACL.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, twoMonthsAgo, now);
@@ -689,10 +732,16 @@ public class WorkFlowApplication : IWorkFlowApplication
/// </summary>
public async Task<List<DailyRollCallConfirmedWithoutLunchBreakViewModel>> GetEmployeesWithoutLunchBreak(long workshopId)
{
var now = DateTime.Now.Date;
now.AddMonthsFa(-2, out var twoMonthsAgo);
//استثنا برای کارگاه پیتزا امیر برای برای نمایش ندادن کارپوشه قبل از 1 آبان 1404
if(workshopId == 367 && twoMonthsAgo< new DateTime(2025,10,23))
{
twoMonthsAgo = new DateTime(2025,10,23);
}
var lastCheckouts = _checkoutACL.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, twoMonthsAgo, now);
var notSlicedRollCalls = _rollCallACL.GetNotSlicedRollCallsByWorkshopId(workshopId, twoMonthsAgo, now.AddDays(-1).Date);
var employeesWithoutBreakTime = _customizedWorkshopSettingsACL.GetEmployeesWithoutBreakTime(workshopId);