Compare commits

..

9 Commits

Author SHA1 Message Date
4b39994de6 feat: add API endpoint for printing multiple contracts 2025-12-20 15:50:34 +03:30
0dd2dc7c43 add workshopCode on client contract print 2025-12-20 15:21:34 +03:30
20c00893b6 feat: add API endpoint for printing contract details and enhance contract print logic 2025-12-20 14:23:23 +03:30
b0d174a575 feat: implement contract printing methods and view models 2025-12-20 13:04:30 +03:30
0fbd5c9d3e Add print methods and ContractPrintViewModel class
Updated the `IContractApplication` interface:
- Added `PrintOneAsync(long id)` and `PrintAllAsync(List<long> ids)` methods.
- Corrected formatting of `DeleteAllContarcts(List<long> ids)`.
- Grouped changes under the `NewChangeByHeydari` region.

Introduced the `ContractPrintViewModel` class (currently empty).

Implemented `PrintOneAsync` and `PrintAllAsync` in `ContractApplication` with `NotImplementedException`.

These changes prepare the codebase for contract printing functionality.
2025-11-11 19:29:51 +03:30
8436f70aa0 Refactor and enhance contract handling logic
- Added `DailyWage`, `AvgWorkingHour`, and `FamilyAllowance` properties to `GetContractListForClientResponse`.
- Refactored `WorkingHoursWeekly` conversion logic by introducing a reusable `WeeklyHourConvertor` method in `ContractRepository`.
- Updated query result mapping to include new properties and utilize `WeeklyHourConvertor` for `AvgWorkingHour`.
- Improved code readability and maintainability by centralizing repetitive logic.
2025-11-11 19:26:45 +03:30
9cf8447a83 feat: add API for retrieving paginated contract list for client with filtering options 2025-11-03 17:49:51 +03:30
e124a4d5d9 feat: implement method to retrieve paginated contract list for client with filtering options 2025-11-03 17:43:50 +03:30
7b9e7881c6 feat: add commented-out method for retrieving contract list for client 2025-11-03 14:45:41 +03:30
46 changed files with 1423 additions and 46310 deletions

View File

@@ -27,8 +27,7 @@ public interface ISmsService
Task<double> GetCreditAmount();
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> SendInstitutionVerificationLink(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

@@ -48,6 +48,10 @@ public interface IContractRepository : IRepository<long, Contract>
bool Remove(long id);
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel);
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
#endregion
#region NewChangeByHeydari
@@ -63,4 +67,8 @@ public interface IContractRepository : IRepository<long, Contract>
ContractViweModel GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
List<ContractViweModel> GetByWorkshopIdInDates(long workshopId, DateTime contractStart, DateTime contractEnd);
#endregion
}
}

View File

@@ -6,6 +6,7 @@ using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.InstitutionContractAgg;
@@ -76,6 +77,4 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
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

@@ -252,11 +252,6 @@ public class InstitutionContract : EntityBase
{
WorkshopGroup = null;
}
public void AddAmendment(InstitutionContractAmendment amendment)
{
Amendments.Add(amendment);
}
}
public class InstitutionContractAmendment : EntityBase
@@ -264,15 +259,14 @@ public class InstitutionContractAmendment : EntityBase
private InstitutionContractAmendment(){}
public InstitutionContractAmendment(long institutionContractId,
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
List<InstitutionContractAmendmentChange> amendmentChanges, long lawId)
InstitutionContractAmendmentChange amendmentChange, long lawId)
{
InstitutionContractId = institutionContractId;
Installments = installments is { Count: > 0} ? installments : [];
Amount = amount;
HasInstallment = hasInstallment;
AmendmentChanges = amendmentChanges;
AmendmentChanges = [amendmentChange];
LawId = lawId;
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
}
public long InstitutionContractId { get; set; }
@@ -286,15 +280,6 @@ public class InstitutionContractAmendment : EntityBase
public long LawId { get; set; }
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;
@@ -302,22 +287,25 @@ public class InstitutionContractAmendment : EntityBase
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
}
public void Verified()
{
VerificationStatus = InstitutionContractVerificationStatus.Verified;
}
public string VerifierPhoneNumber { get; private set; }
public string VerifierFullName { get; private set; }
public DateTime VerifyCodeCreation { get; set; }
}
public class InstitutionContractAmendmentChange : EntityBase
{
private InstitutionContractAmendmentChange() { }
private InstitutionContractAmendmentChange(InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
private InstitutionContractAmendmentChange(long institutionContractAmendmentId,
InstitutionContractAmendment institutionContractAmendment, InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasRollCallPlan, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
bool? hasRollCallPlan, bool? hasRollCallInPerson,
long? currentWorkshopId, int personnelCountDifference)
long? workshopDetailsId)
{
InstitutionContractAmendmentId = institutionContractAmendmentId;
InstitutionContractAmendment = institutionContractAmendment;
ChangeType = changeType;
ChangeDateGr = changeDateGr;
HasRollCallPlan = hasRollCallPlan;
@@ -327,80 +315,9 @@ public class InstitutionContractAmendmentChange : EntityBase
HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount;
PersonnelCountDifference = personnelCountDifference;
CurrentWorkshopId = currentWorkshopId;
HasRollCallInPerson = hasRollCallInPerson;
WorkshopDetailsId = workshopDetailsId;
}
/// <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; }
@@ -411,8 +328,6 @@ public class InstitutionContractAmendmentChange : EntityBase
/// </summary>
public bool? HasRollCallPlan { get; private set; }
public bool? HasRollCallInPerson { get; set; }
/// <summary>
/// پلن فیش غیر رسمی
/// </summary>
@@ -442,17 +357,11 @@ public class InstitutionContractAmendmentChange : EntityBase
/// تعداد پرسنل
/// </summary>
public int? PersonnelCount { get; private set; }
/// <summary>
/// مقدار تغییرات تعداد پرسنل
/// </summary>
public int PersonnelCountDifference { get; set; }
/// <summary>
/// تعداد کارگاه
/// </summary>
public long? CurrentWorkshopId { get; private set; }
public long? WorkshopDetailsId { 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,bool isAmendment )
int personnelCount, double price )
{
WorkshopName = workshopName;
Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
@@ -17,10 +17,7 @@ public class InstitutionContractWorkshopBase:EntityBase
PersonnelCount = personnelCount;
Price = price;
Employers = [];
IsAmendment = isAmendment;
}
/// <summary>
/// شناسه کارگاه
/// </summary>
@@ -45,11 +42,7 @@ 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,10 +10,9 @@ 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,bool isAmendment) : base(workshopName, hasRollCallPlan,
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
{
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
WorkshopGroup = workshopGroup;

View File

@@ -31,13 +31,6 @@ 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,bool isAmendment =false) : base(workshopName, hasRollCallPlan,
int personnelCount, double price) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
{
WorkshopCreated = false;
}
@@ -31,8 +31,7 @@ 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,
IsAmendment);
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CompanyManagment.App.Contracts.InstitutionContract;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
@@ -17,7 +16,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,x.Id)).ToList();
x.CurrentWorkshopId, 0)).ToList();
InstitutionContractId = institutionContractId;
}
@@ -26,32 +25,17 @@ 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,Guid prevId) : base(
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base(
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
{
Id = prevId;
PriceDifference = priceDifference;
}

View File

@@ -11,23 +11,21 @@ namespace Company.Domain.ReportAgg
{
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
AllReport GetAllActiveWorkshops(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
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,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);

View File

@@ -0,0 +1,12 @@
namespace CompanyManagment.App.Contracts.Contract;
public enum ContractListOrderType
{
ByContractCreationDate,
BySignedContract,
ByUnSignedContract,
ByPersonnelCode,
ByPersonnelCodeDescending,
ByContractStartDate,
ByContractStartDateDescending
}

View File

@@ -0,0 +1,13 @@
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Contract;
public class GetContractListForClientRequest: PaginationRequest
{
public int Year { get; set; }
public int Month { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public long EmployeeId { get; set; }
public ContractListOrderType? OrderType { get; set; }
}

View File

@@ -0,0 +1,15 @@
namespace CompanyManagment.App.Contracts.Contract;
public class GetContractListForClientResponse
{
public long Id { get; set; }
public string PersonnelCode { get; set; }
public string ContractNo { get; set; }
public string EmployeeFullName { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public bool IsSigned { get; set; }
public string DailyWage { get; set; }
public string AvgWorkingHour { get; set; }
public string FamilyAllowance { get; set; }
}

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Workshop;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
@@ -45,16 +47,101 @@ public interface IContractApplication
#region Client
OperationResult Remove(long id);
[Obsolete("این متد منسوخ شده است. لطفاً از متد GetContractListForClient استفاده کنید.")]
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
#endregion
/// <summary>
/// لیست قراردادها برای کلاینت
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<PagedResult<GetContractListForClientResponse>>
GetContractListForClient(GetContractListForClientRequest searchModel);
Task<ContractPrintViewModel> PrintOneAsync(long id);
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
#region NewChangeByHeydari
#endregion
OperationResult DeleteAllContarcts(List<long> ids);
#region NewChangeByHeydari
OperationResult DeleteAllContarcts(List<long> ids);
OperationResult DeleteContarcts(long id);
List<long> CheckHasCheckout(List<long> ids);
List<long> CheckHasSignature(List<long> ids);
List<ContractViweModel> SearchForMainContract(ContractSearchModel searchModel);
#endregion
}
public class ContractPrintViewModel
{
public string ContractNo { get; set; }
public ContractPrintEmployerViewModel Employer { get; set; }
public ContractPrintEmployeeViewModel Employee { get; set; }
public ContractPrintTypeOfContractViewModel TypeOfContract { get; set; }
public ContractPrintFeesViewModel Fees { get; set; }
public string ConditionAndDetials { get; set; }
}
public class ContractPrintFeesViewModel
{
public string DailyWage { get; set; }
public string FamilyAllowance { get; set; }
public string ConsumableItems { get; set; }
public string HousingAllowance { get; set; }
}
public class ContractPrintTypeOfContractViewModel
{
public string ContractType { get; set; }
public string JobName { get; set; }
public string SetContractDate { get; set; }
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }
public string WorkingHoursWeekly { get; set; }
public List<string> WorkshopAddress { get; set; }
}
public class ContractPrintEmployeeViewModel
{
public string FullName { get; set; }
public string NationalCode { get; set; }
public string IdNumber { get; set; }
public string DateOfBirth { get; set; }
public string FatherName { get; set; }
public string LevelOfEducation { get; set; }
public string Address { get; set; }
}
public class ContractPrintEmployerViewModel
{
public LegalType LegalType { get; set; }
public ContractPrintRealEmployerViewModel RealEmployer { get; set; }
public ContractPrintLegalEmployerViewModel LegalEmployer { get; set; }
public string WorkshopName { get; set; }
public string Address { get; set; }
public string WorkshopCode { get; set; }
}
public class ContractPrintLegalEmployerViewModel
{
public string CompanyName { get; set; }
public string NationalId { get; set; }
public string RegisterId { get; set; }
}
public class ContractPrintRealEmployerViewModel
{
public string FullName { get; set; }
public string NationalCode { get; set; }
public string IdNumber { get; set; }
}

View File

@@ -25,5 +25,4 @@ 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,8 +4,6 @@ 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

@@ -244,41 +244,13 @@ 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

View File

@@ -1,28 +1,11 @@
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

@@ -27,8 +27,6 @@ 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; }
@@ -36,8 +34,6 @@ namespace CompanyManagment.App.Contracts.Report
public int CheckoutSignNotDone { get; set; }
public int CheckoutSignDone { get; set; }
public int CheckoutSignToBe { get; set; }
}

View File

@@ -10,23 +10,21 @@ namespace CompanyManagment.App.Contracts.Report
{
Task<AllReport> GetAllActiveWorkshops(string year, string month);
Task<AllReport> GetAllReports(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
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,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
}
}

View File

@@ -2712,7 +2712,9 @@ public class ContractApplication : IContractApplication
var emp = workshopEmpList.Where(x => x.WorkshopId == res.WorkshopIds)
.Select(x => x.EmployerId).ToList();
res.Employers = _employerRepository.GetEmployers(emp);
var workshopSelect = _workshopApplication.GetDetails(res.WorkshopIds);
var workshop = new WorkshopViewModel()
{
@@ -3107,6 +3109,21 @@ public class ContractApplication : IContractApplication
return _contractRepository.SearchForClient(searchModel);
}
public async Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel)
{
return await _contractRepository.GetContractListForClient(searchModel);
}
public async Task<ContractPrintViewModel> PrintOneAsync(long id)
{
return (await _contractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
return await _contractRepository.PrintAllAsync(ids);
}
#endregion
#region NewChangeByHeydari

View File

@@ -1140,7 +1140,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id,entity.id );
await _institutionContractRepository.SaveChangesAsync();
@@ -1377,7 +1377,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
if (contractingParty == null)
throw new NotFoundException("طرف قرارداد یافت نشد");
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
institutionContract.PublicId, contractingParty.id, institutionContract.id);
return new OperationResult().Succcedded();
}
@@ -1387,16 +1387,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication
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

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

View File

@@ -14,8 +14,6 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
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

@@ -1,83 +0,0 @@
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

@@ -1,22 +0,0 @@
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

@@ -1,30 +0,0 @@
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

@@ -1,20 +0,0 @@
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

@@ -3288,11 +3288,6 @@ 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)");
@@ -3332,9 +3327,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<long?>("CurrentWorkshopId")
.HasColumnType("bigint");
b.Property<bool?>("HasContractPlan")
.HasColumnType("bit");
@@ -3350,9 +3342,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool?>("HasInsurancePlanInPerson")
.HasColumnType("bit");
b.Property<bool?>("HasRollCallInPerson")
.HasColumnType("bit");
b.Property<bool?>("HasRollCallPlan")
.HasColumnType("bit");
@@ -3362,8 +3351,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<int?>("PersonnelCount")
.HasColumnType("int");
b.Property<int>("PersonnelCountDifference")
.HasColumnType("int");
b.Property<long?>("WorkshopDetailsId")
.HasColumnType("bigint");
b.HasKey("id");
@@ -3430,9 +3419,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount")
.HasColumnType("int");
@@ -3498,9 +3484,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount")
.HasColumnType("int");

View File

@@ -5,6 +5,8 @@ using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Exceptions;
using _0_Framework.InfraStructure;
using Company.Domain.ContractAgg;
using Company.Domain.empolyerAgg;
@@ -1081,30 +1083,7 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
var weeklyDouble = 0.0;
var weekly = c.WorkingHoursWeekly;
if (!string.IsNullOrWhiteSpace(weekly) &&
weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
{
if (weekly.Contains("/"))
{
weeklyDouble = double.Parse(weekly);
var minute = (int)((weeklyDouble % 1) * 60);
var hour = (int)(weeklyDouble);
c.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
}
else if (weekly.Contains("."))
{
weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
var minute = (int)((weeklyDouble % 1) * 60);
var hour = (int)(weeklyDouble);
c.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
}
else
{
c.WorkingHoursWeekly = c.WorkingHoursWeekly + " " + "ساعت";
}
}
c.WorkingHoursWeekly = WeeklyHourConvertor(weekly);
var emp = workshopEmpList.Where(x => x.WorkshopId == c.WorkshopIds)
.Select(x => x.EmployerId).ToList();
c.Employers = _employerRepository.GetEmployers(emp);
@@ -1161,6 +1140,37 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
return query;
}
private static string WeeklyHourConvertor(string weekly)
{
double weeklyDouble;
if (!string.IsNullOrWhiteSpace(weekly) &&
weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
{
if (weekly.Contains("/"))
{
weeklyDouble = double.Parse(weekly);
var minute = (int)((weeklyDouble % 1) * 60);
var hour = (int)(weeklyDouble);
return hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
}
else if (weekly.Contains("."))
{
weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
var minute = (int)((weeklyDouble % 1) * 60);
var hour = (int)(weeklyDouble);
return hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
}
else
{
return weekly + " " + "ساعت";
}
}
return "";
}
public IQueryable<WorkshopEmployerViewModel> GetWorkshopEmployer()
{
return _context.WorkshopEmployers.Select(x => new WorkshopEmployerViewModel
@@ -1506,6 +1516,195 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
}
public async Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel)
{
var workshopId = _authHelper.GetWorkshopId();
var query = _context.Contracts
.Where(c => c.WorkshopIds == workshopId);
#region Search
if (searchModel.EmployeeId > 0)
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
if (!string.IsNullOrWhiteSpace(searchModel.StartDate) && string.IsNullOrWhiteSpace(searchModel.EndDate))
{
if (!searchModel.StartDate.TryToGeorgianDateTime(out var startDate))
throw new BadRequestException("تاریخ شروع وارد شده معتبر نمی باشد.");
if (!searchModel.EndDate.TryToGeorgianDateTime(out var endDate))
throw new BadRequestException("تاریخ پایان وارد شده معتبر نمی باشد.");
query = query.Where(x => x.ContarctStart <=endDate && x.ContractEnd >= startDate);
}
if (searchModel.Year>0 && searchModel.Month >0)
{
var startDateFa = $"{searchModel.Year:0000}/{searchModel.Month:00}/01";
if (!startDateFa.TryToGeorgianDateTime(out var startDate))
throw new BadRequestException("سال و ماه وارد شده معتبر نمی باشد.");
if(!startDateFa.FindeEndOfMonth().TryToGeorgianDateTime(out var endDate))
throw new BadRequestException("سال و ماه وارد شده معتبر نمی باشد.");
query = query.Where(x => x.ContarctStart <=endDate && x.ContractEnd >= startDate);
}
if (searchModel.OrderType != null)
{
switch (searchModel.OrderType)
{
case ContractListOrderType.ByContractCreationDate:
query = query.OrderBy(x => x.CreationDate);
break;
case ContractListOrderType.ByContractStartDate:
query = query.OrderBy(x => x.ContarctStart);
break;
case ContractListOrderType.ByContractStartDateDescending:
query = query.OrderByDescending(x=>x.ContarctStart);
break;
case ContractListOrderType.ByPersonnelCode:
query = query.OrderBy(x => x.PersonnelCode);
break;
case ContractListOrderType.ByPersonnelCodeDescending:
query = query.OrderByDescending(x => x.PersonnelCode);
break;
case ContractListOrderType.BySignedContract:
query = query.OrderByDescending(x => x.Signature == "1");
break;
case ContractListOrderType.ByUnSignedContract:
query = query.OrderBy(x => x.Signature == "1");
break;
}
}
else
{
query = query.OrderByDescending(x => x.id);
}
#endregion
var pagedList =await query
.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
var employeeIds = pagedList.Select(x => x.EmployeeId).ToList();
var employees = await _context.Employees
.Where(x => employeeIds.Contains(x.id)).Select(x => new
{
Id = x.id,
x.FullName
}).ToListAsync();
var result = new PagedResult<GetContractListForClientResponse>
{
TotalCount = await query.CountAsync(),
List = pagedList.Select(c =>
{
var employeeFullName = employees
.FirstOrDefault(e => e.Id == c.EmployeeId)?.FullName ?? "";
return new GetContractListForClientResponse
{
Id = c.id,
PersonnelCode = c.PersonnelCode.ToString(),
ContractStart = c.ContarctStart.ToFarsi(),
ContractEnd = c.ContractEnd.ToFarsi(),
ContractNo = c.ContractNo,
IsSigned = c.Signature == "1",
EmployeeFullName = employeeFullName,
AvgWorkingHour = WeeklyHourConvertor(c.WorkingHoursWeekly),
DailyWage = c.DayliWage,
FamilyAllowance = c.FamilyAllowance
};
}).ToList()
};
return result;
}
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
var query =await _context.Contracts.Include(x => x.Employer)
.Include(x => x.Employee).Where(x => ids.Contains(x.id))
.ToListAsync();
var workshopIds = query.Select(x => x.WorkshopIds).Distinct().ToList();
var workshops = await _context.Workshops
.Where(x => workshopIds.Contains(x.id))
.ToListAsync();
List<long> exceptionWorkshops = [516,63,38,39];
var res = query.Select(x =>
{
var workshop = workshops.FirstOrDefault(w => w.id == x.WorkshopIds);
var employerRes = new ContractPrintEmployerViewModel()
{
WorkshopName = workshop!.WorkshopName,
Address =$"{workshop.State} - {workshop.City} - {workshop.Address}",
LegalType = x.Employer.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
LegalEmployer = x.Employer.IsLegal == "حقیقی"
? null
: new ContractPrintLegalEmployerViewModel()
{
NationalId = x.Employer.NationalId,
RegisterId = x.Employer.RegisterId,
CompanyName = x.Employer.LName,
},
RealEmployer = x.Employer.IsLegal == "حقیقی"
? new ContractPrintRealEmployerViewModel()
{
FullName = x.Employer.FullName,
IdNumber = x.Employer.IdNumber,
NationalCode = x.Employer.Nationalcode
}
: null,
WorkshopCode = workshop.InsuranceCode
};
var employeeRes = new ContractPrintEmployeeViewModel()
{
Address =$"{x.Employee.State} - {x.Employee.City} - {x.Employee.Address}" ,
FullName = x.Employee.FullName,
IdNumber = x.Employee.IdNumber,
NationalCode = x.Employee.NationalCode,
DateOfBirth = x.Employee.DateOfBirth.ToFarsi(),
FatherName = x.Employee.FatherName,
LevelOfEducation = x.Employee.LevelOfEducation
};
var typeOfContract = new ContractPrintTypeOfContractViewModel()
{
ContarctStart = x.ContarctStart.ToFarsi(),
ContractEnd = x.ContractEnd.ToFarsi(),
JobName = x.JobType,
ContractType = x.ContractType,
SetContractDate = x.SetContractDate.ToFarsi(),
WorkingHoursWeekly = WeeklyHourConvertor(x.WorkingHoursWeekly),
WorkshopAddress = [x.WorkshopAddress1, x.WorkshopAddress2],
};
ContractPrintFeesViewModel fees= new ContractPrintFeesViewModel()
{
DailyWage = x.DayliWage,
FamilyAllowance = x.FamilyAllowance,
HousingAllowance = x.HousingAllowance,
ConsumableItems = x.ConsumableItems,
};
return new ContractPrintViewModel()
{
Employer = employerRes,
Employee = employeeRes,
TypeOfContract = typeOfContract,
Fees = fees,
ContractNo = x.ContractNo,
ConditionAndDetials = exceptionWorkshops.Contains(x.WorkshopIds) ? "بر اساس ماده 190 قانون کار جمهوری اسلامی ایران ، پرسنل اقرار مینماید کلیه مبالغ پیش بینی شده در قانون کار را وفق قرارداد منعقده دریافت مینماید. این مبالغ قسمتی بصورت مستقیم از سوی کارفرما و قسمتی بر اساس شرایط کارگاه از محل درآمد حاصله از مشتری اخذ میگردد . با توجه به شرایط کارگاه کلیه مبالغ بصورت واریز به حساب و وجه نقد رایج کشور ، تواما به پرسنل پرداخت میگردد. امضا تصفیه حساب دارای مبالغ ، توسط پرسنل نشانگر تصفیه قطعی ایشان میباشد.": "",
};
}).ToList();
return res;
}
#endregion
#region NewChangeByHeydari

View File

@@ -19,41 +19,39 @@ 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);
@@ -83,81 +81,79 @@ public class CustomizeWorkshopGroupSettingsRepository(
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);
.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;
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)
@@ -173,26 +169,23 @@ public class CustomizeWorkshopGroupSettingsRepository(
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
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()
{
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();
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)
@@ -208,52 +201,38 @@ public class CustomizeWorkshopGroupSettingsRepository(
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
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()
{
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();
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 names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
.Select(x => new { x.id, x.FullName }).ToList();
var employeeIds = employees.Select(x => x.EmployeeId);
var leftWork = _companyContext.LeftWorkList.Where(x =>
x.WorkshopId == workshopId &&
employeeIds.Contains(x.EmployeeId)).ToList();
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel
@@ -264,86 +243,82 @@ public class CustomizeWorkshopGroupSettingsRepository(
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(),
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
});
return joinedList.OrderBy(x=>x.HasLeft).ToList();
return joinedList.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
},
@@ -357,27 +332,23 @@ public class CustomizeWorkshopGroupSettingsRepository(
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)
@@ -389,8 +360,7 @@ public class CustomizeWorkshopGroupSettingsRepository(
_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

@@ -29,6 +29,7 @@ using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -2341,7 +2342,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
@@ -2373,8 +2374,6 @@ 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);
@@ -2457,14 +2456,12 @@ 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()
{
@@ -2472,41 +2469,6 @@ 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()
@@ -2553,13 +2515,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
};
}
institutionContractAmendmentTemp.AddPaymentDetails(res.Monthly, res.OneTime, monthDiff);
await _institutionAmendmentTemp
.ReplaceOneAsync(x => x.Id == institutionContractAmendmentTemp.Id, institutionContractAmendmentTemp);
return res;
}
@@ -2598,7 +2553,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
request.Insurance, request.InsuranceInPerson,
request.RollCall, request.RollCallInPerson,
request.CustomizeCheckout, price,
request.WorkshopId,0,price,Guid.NewGuid());
request.WorkshopId,0,price);
workshopTemp = newWorkshopTemp;
@@ -2610,24 +2565,9 @@ 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);
if (differencePrice<0)
{
differencePrice = 0;
}
var differencePrice = price - workshopTemp.Price;
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
request.Insurance, request.InsuranceInPerson,
@@ -2828,146 +2768,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
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();
}
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,6 @@ 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; }
@@ -29,33 +27,6 @@ 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)
@@ -85,7 +56,12 @@ public class SmsService : ISmsService
}
public bool VerifySend(string number, string message)
{
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", 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) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -114,7 +90,11 @@ public class SmsService : ISmsService
public bool LoginSend(string number, string message)
{
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", 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) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -139,8 +119,11 @@ public class SmsService : ISmsService
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var result = new SentSmsViewModel();
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
Thread.Sleep(2000);
if (sendResult.Message == "موفق")
@@ -165,8 +148,9 @@ public class SmsService : ISmsService
var checkLength = fullName.Length;
if (checkLength > 25)
fullName = fullName.Substring(0, 24);
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
var sendResult = smsIr.VerifySendAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
Console.WriteLine(userName + " - " + sendResult.Result.Status);
@@ -348,39 +332,18 @@ public class SmsService : ISmsService
}
}
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
public async Task<bool> SendInstitutionVerificationLink(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[]
var verificationSendResult =await SmsIr.VerifySendAsync(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();
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, "لینک تاییدیه ارتقا قرارداد مالی",
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
@@ -390,7 +353,7 @@ public class SmsService : ISmsService
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId)
{
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
{
new("VERIFYCODE", code)
});

View File

@@ -541,52 +541,18 @@ 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}")]

View File

@@ -287,7 +287,7 @@
<div class="textsChart">
<p class="alltxt">
<span style="width: 40px;display: inline-block;">@Model.ContractSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.ContrcatDone</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.CheckoutSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.CheckoutDone</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,5 +1,4 @@
using _0_Framework.Application;
using AccountMangement.Infrastructure.EFCore;
using CompanyManagment.App.Contracts.Report;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.YearlySalary;
@@ -43,7 +42,6 @@ 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; }
@@ -51,9 +49,8 @@ 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);
@@ -76,23 +73,19 @@ public class IndexModel : PageModel
ContrcatDone = allReports.ContrcatDone;
ContractSignNotDone = allReports.ContractSignNotDone;
ContractSignDone = allReports.ContractSignDone;
ContractSignToBe = allReports.ContractSignToBe;
AllCheckout = allReports.AllCheckout;
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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -103,7 +96,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -114,7 +107,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -125,7 +118,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -140,7 +133,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContract(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -150,7 +143,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContractSign(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -160,7 +153,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckout(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -170,7 +163,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckoutSign(string year, string month, long workshopId, long accountId)
{
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -187,14 +180,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds);
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).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds);
return Partial("PrintAll", res);
}
@@ -202,14 +195,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds);
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).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds);
return Partial("PrintAll", res);
}
//================Employee
@@ -218,7 +211,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).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -242,7 +235,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -265,7 +258,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).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
var final = new PrintEmployeeNotDone
{
@@ -284,7 +277,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
var final = new PrintEmployeeNotDone
{

View File

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

View File

@@ -0,0 +1,39 @@
using _0_Framework.Application;
using Company.Domain.ContractAgg;
using CompanyManagment.App.Contracts.Contract;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers;
public class ContractController:ClientBaseController
{
private readonly IContractApplication _contractApplication;
public ContractController(IContractApplication contractApplication)
{
_contractApplication = contractApplication;
}
[HttpGet]
public async Task<ActionResult<PagedResult<GetContractListForClientResponse>>> GetList(
GetContractListForClientRequest searchModel)
{
var res = await _contractApplication
.GetContractListForClient(searchModel);
return res;
}
[HttpGet("print/{id}")]
public async Task<ActionResult<ContractPrintViewModel>> PrintOne(long id)
{
var res = await _contractApplication.PrintOneAsync(id);
return res;
}
[HttpGet("print")]
public async Task<ActionResult<List<ContractPrintViewModel>>> PrintAll([FromQuery] List<long> ids)
{
var res = await _contractApplication.PrintAllAsync(ids);
return res;
}
}

View File

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

View File

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

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 ${itemEmployee.hasLeft?'disable':''}" data-employee-id="${itemEmployee.employeeId}">
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" 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">