Compare commits
7 Commits
Feature/Ch
...
Feature/lo
| Author | SHA1 | Date | |
|---|---|---|---|
| fa4c39904a | |||
| 0e7787dd56 | |||
| 87c3cebb60 | |||
| 607c0780b6 | |||
| ef49302f8a | |||
| 4ab9f60932 | |||
| 9cfae54db3 |
@@ -2,8 +2,6 @@
|
||||
|
||||
public enum TypeOfSmsSetting
|
||||
{
|
||||
//همه انواع پیامک
|
||||
All = 0,
|
||||
|
||||
/// <summary>
|
||||
/// پیامک
|
||||
@@ -25,7 +23,7 @@ public enum TypeOfSmsSetting
|
||||
|
||||
/// <summary>
|
||||
/// پیامک
|
||||
/// هشدار بدهی
|
||||
/// هشدار اول
|
||||
/// </summary>
|
||||
Warning,
|
||||
|
||||
@@ -40,14 +38,4 @@ public enum TypeOfSmsSetting
|
||||
/// </summary>
|
||||
InstitutionContractConfirm,
|
||||
|
||||
/// <summary>
|
||||
/// ارسال کد تاییدیه قرارداد مالی
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationCode,
|
||||
|
||||
/// <summary>
|
||||
/// یادآور وظایف
|
||||
/// </summary>
|
||||
TaskReminder,
|
||||
|
||||
}
|
||||
@@ -18,17 +18,3 @@ public class ApiResultViewModel
|
||||
public string DeliveryColor { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ApiReportDto
|
||||
{
|
||||
public int MessageId { get; set; }
|
||||
|
||||
public long Mobile { get; set; }
|
||||
|
||||
public string SendUnixTime { get; set; }
|
||||
public string DeliveryState { get; set; }
|
||||
public string DeliveryUnixTime { get; set; }
|
||||
public string DeliveryColor { get; set; }
|
||||
|
||||
}
|
||||
@@ -19,13 +19,6 @@ public interface ISmsService
|
||||
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||
|
||||
#region ForApi
|
||||
|
||||
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
|
||||
|
||||
#endregion
|
||||
|
||||
string DeliveryStatus(byte? dv);
|
||||
string DeliveryColorStatus(byte? dv);
|
||||
string UnixTimeStampToDateTime(int? unixTimeStamp);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
@@ -13,21 +12,19 @@ public class JobSchedulerRegistrator
|
||||
private readonly IBackgroundJobClient _backgroundJobClient;
|
||||
private readonly SmsReminder _smsReminder;
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||
private static DateTime? _lastRunCreateTransaction;
|
||||
private static DateTime? _lastRunSendMonthlySms;
|
||||
private readonly ISmsService _smsService;
|
||||
private readonly ILogger<JobSchedulerRegistrator> _logger;
|
||||
|
||||
|
||||
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger)
|
||||
{
|
||||
_smsReminder = smsReminder;
|
||||
_backgroundJobClient = backgroundJobClient;
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_smsService = smsService;
|
||||
_logger = logger;
|
||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||
}
|
||||
|
||||
public void Register()
|
||||
@@ -61,43 +58,17 @@ public class JobSchedulerRegistrator
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.SendWarningSms",
|
||||
() => SendWarningSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
//RecurringJob.AddOrUpdate(
|
||||
// "InstitutionContract.SendWarningSms",
|
||||
// () => SendWarningSms(),
|
||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
//);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.SendLegalActionSms",
|
||||
() => SendLegalActionSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.Block",
|
||||
() => Block(),
|
||||
"*/30 * * * *" // هر 30 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.UnBlock",
|
||||
() => UnBlock(),
|
||||
"*/10 * * * *"
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.DeActiveInstitutionEndOfContract",
|
||||
() => DeActiveInstitutionEndOfContract(),
|
||||
"*/30 * * * *"
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.BlueDeActiveAfterZeroDebt",
|
||||
() => BlueDeActiveAfterZeroDebt(),
|
||||
"*/10 * * * *"
|
||||
);
|
||||
//RecurringJob.AddOrUpdate(
|
||||
// "InstitutionContract.SendLegalActionSms",
|
||||
// () => SendLegalActionSms(),
|
||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
//);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +134,7 @@ public class JobSchedulerRegistrator
|
||||
|
||||
try
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.SendMonthlySms(now);
|
||||
await _institutionContractRepository.SendMonthlySms(now);
|
||||
_lastRunSendMonthlySms = now;
|
||||
Console.WriteLine("Send Monthly sms executed");
|
||||
|
||||
@@ -185,7 +156,7 @@ public class JobSchedulerRegistrator
|
||||
public async System.Threading.Tasks.Task SendReminderSms()
|
||||
{
|
||||
_logger.LogInformation("SendReminderSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendReminderSmsForBackgroundTask();
|
||||
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -196,7 +167,7 @@ public class JobSchedulerRegistrator
|
||||
public async System.Threading.Tasks.Task SendBlockSms()
|
||||
{
|
||||
_logger.LogInformation("SendBlockSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendBlockSmsForBackgroundTask();
|
||||
await _institutionContractRepository.SendBlockSmsForBackgroundTask();
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +179,7 @@ public class JobSchedulerRegistrator
|
||||
public async System.Threading.Tasks.Task SendInstitutionContractConfirmSms()
|
||||
{
|
||||
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendInstitutionContractConfirmSmsTask();
|
||||
await _institutionContractRepository.SendInstitutionContractConfirmSmsTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -219,86 +190,14 @@ public class JobSchedulerRegistrator
|
||||
public async System.Threading.Tasks.Task SendWarningSms()
|
||||
{
|
||||
_logger.LogInformation("SendWarningSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.Warning);
|
||||
await _institutionContractRepository.SendWarningSmsTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پیامک اقدام قضایی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||
{
|
||||
_logger.LogInformation("SendWarningSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// بلاگ سازی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task Block()
|
||||
{
|
||||
_logger.LogInformation("block job run");
|
||||
var now = DateTime.Now;
|
||||
var executeDate = now.ToFarsi().Substring(8, 2);
|
||||
if (executeDate == "20")
|
||||
{
|
||||
if (now.Hour >= 9 && now.Hour < 10)
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.Block(now);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// آنبلاک
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task UnBlock()
|
||||
{
|
||||
_logger.LogInformation("UnBlock job run");
|
||||
|
||||
await _institutionContractSmsServiceRepository.UnBlock();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// غیر فعال سازی قراداد های پایان یافته
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task DeActiveInstitutionEndOfContract()
|
||||
{
|
||||
_logger.LogInformation("DeActiveInstitutionEndOfContract job run");
|
||||
|
||||
|
||||
var now = DateTime.Now;
|
||||
var executeDate = now.ToFarsi().Substring(8, 2);
|
||||
if (executeDate == "01")
|
||||
{
|
||||
if (now.Hour >= 9 && now.Hour < 10)
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.DeActiveInstitutionEndOfContract(now);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// غیرفعال سازس قرارداد های آبی که بدهی ندارند
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 800)]
|
||||
public async System.Threading.Tasks.Task BlueDeActiveAfterZeroDebt()
|
||||
{
|
||||
_logger.LogInformation("BlueDeActiveAfterZeroDebt job run");
|
||||
await _institutionContractSmsServiceRepository.BlueDeActiveAfterZeroDebt();
|
||||
await _institutionContractRepository.SendLegalActionSmsTask();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,6 +80,4 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
#endregion
|
||||
|
||||
Task<Checkout> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate);
|
||||
Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,
|
||||
CheckoutListClientSearchModel searchModel);
|
||||
}
|
||||
@@ -91,7 +91,65 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
|
||||
|
||||
#region ReminderSMS
|
||||
/// <summary>
|
||||
/// دریافت لیست - ارسال پیامک
|
||||
/// فراخوانی از سمت بک گراند سرویس
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> SendReminderSmsForBackgroundTask();
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک صورت حساب ماهانه
|
||||
/// </summary>
|
||||
/// <param name="now"></param>
|
||||
/// <returns></returns>
|
||||
Task SendMonthlySms(DateTime now);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendBlockSmsForBackgroundTask();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست واجد شرایط بلاک
|
||||
/// جهت ارسال پیامک مسدودی
|
||||
/// </summary>
|
||||
/// <param name="checkDate"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودی
|
||||
/// </summary>
|
||||
/// <param name="smsListData"></param>
|
||||
/// <param name="typeOfSms"></param>
|
||||
/// <param name="sendMessStart"></param>
|
||||
/// <param name="sendMessEnd"></param>
|
||||
/// <returns></returns>
|
||||
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
||||
string sendMessStart, string sendMessEnd);
|
||||
|
||||
/// <summary>
|
||||
///دریافت لیست بدهکارن
|
||||
/// جهت ارسال پیامک
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک های یاد آور بدهی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک یادآور تایید قراداد مالی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendInstitutionContractConfirmSmsTask();
|
||||
#endregion
|
||||
|
||||
#region CreateMontlyTransaction
|
||||
|
||||
@@ -104,12 +162,24 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
|
||||
#endregion
|
||||
|
||||
#region WarningSms
|
||||
/// <summary>
|
||||
/// پیامک های هشدار
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendWarningSmsTask();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region legalAction
|
||||
/// <summary>
|
||||
/// پیامک اقدام قضائی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendLegalActionSmsTask();
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
public interface IInstitutionContractSmsServiceRepository : IRepository<long, InstitutionContract>
|
||||
{
|
||||
#region reminderSMs
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک یادآور تایید قراداد مالی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendInstitutionContractConfirmSmsTask();
|
||||
#endregion
|
||||
|
||||
//هشدار و اقدام قضایی
|
||||
#region WarningOrLegalActionSmsListData
|
||||
/// <summary>
|
||||
/// اجرای تسک پیامک هشدار یا اقدام قضایی
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task SendWarningOrLegalActionSmsTask(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست بدهکاران آبی جهت هشدار یا اقدام قضایی
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsListData>> GetWarningOrLegalActionSmsListData(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک هشدار یا اقدام قضایی
|
||||
/// </summary>
|
||||
/// <param name="smsListData"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task SendWarningOrLegalActionSms(List<SmsListData> smsListData, TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
#endregion
|
||||
|
||||
//بلاک - آنبلاک - پیامک بلاک -
|
||||
// غیر فعال سازی قراداد های پایان یافته
|
||||
#region Block
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendBlockSmsForBackgroundTask();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست واجد شرایط بلاک
|
||||
/// جهت ارسال پیامک مسدودی
|
||||
/// </summary>
|
||||
/// <param name="checkDate"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک مسدودی
|
||||
/// </summary>
|
||||
/// <param name="smsListData"></param>
|
||||
/// <param name="typeOfSms"></param>
|
||||
/// <param name="sendMessStart"></param>
|
||||
/// <param name="sendMessEnd"></param>
|
||||
/// <returns></returns>
|
||||
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
||||
string sendMessStart, string sendMessEnd);
|
||||
|
||||
/// <summary>
|
||||
/// بلاک سازی
|
||||
/// </summary>
|
||||
/// <param name="checkDate"></param>
|
||||
/// <returns></returns>
|
||||
Task Block(DateTime checkDate);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست بدهکارانی که باید بلاک شوند
|
||||
/// </summary>
|
||||
/// <param name="checkDate"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<long>> GetToBeBlockList(DateTime checkDate);
|
||||
|
||||
/// <summary>
|
||||
/// آنبلاک
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task UnBlock();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// غیر فعالسازی قرارداد های پایان یافته
|
||||
/// </summary>
|
||||
/// <param name="checkDate"></param>
|
||||
/// <returns></returns>
|
||||
Task DeActiveInstitutionEndOfContract(DateTime checkDate);
|
||||
|
||||
/// <summary>
|
||||
/// غیرفعال سازس قرارداد های آبی که بدهی ندارند
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task BlueDeActiveAfterZeroDebt();
|
||||
#endregion
|
||||
|
||||
|
||||
#region ReminderSMS
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست - ارسال پیامک
|
||||
/// فراخوانی از سمت بک گراند سرویس
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> SendReminderSmsForBackgroundTask();
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک صورت حساب ماهانه
|
||||
/// </summary>
|
||||
/// <param name="now"></param>
|
||||
/// <returns></returns>
|
||||
Task SendMonthlySms(DateTime now);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///دریافت لیست بدهکارن
|
||||
/// جهت ارسال پیامک
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک های یاد آور بدهی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,30 +1,10 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public interface ISmsResultRepository : IRepository<long, SmsResult>
|
||||
{
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامکها
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اکسپند لیست هر تاریخ
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
|
||||
#endregion
|
||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||
}
|
||||
@@ -62,40 +62,4 @@ public interface ICheckoutApplication
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
#endregion
|
||||
|
||||
Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,
|
||||
CheckoutListClientSearchModel searchModel);
|
||||
}
|
||||
|
||||
public class CheckoutListClientSearchModel:PaginationRequest
|
||||
{
|
||||
public long? EmployeeId { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string StartDate { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
public CheckoutClientListOrderType? OrderType { get; set; }
|
||||
}
|
||||
|
||||
public class CheckoutListClientDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string EmployeeName { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public bool Signature { get; set; }
|
||||
}
|
||||
|
||||
public enum CheckoutClientListOrderType
|
||||
{
|
||||
ByCheckoutCreationDate,
|
||||
BySignedCheckout,
|
||||
ByUnSignedCheckout,
|
||||
ByPersonnelCode,
|
||||
ByPersonnelCodeDescending,
|
||||
ByCheckoutStartDate,
|
||||
ByCheckoutStartDateDescending
|
||||
}
|
||||
@@ -21,6 +21,6 @@ public class LoanGroupedViewModel
|
||||
{
|
||||
public List<LoanGroupedByDateViewModel> GroupedByDate { get; set; }
|
||||
public List<LoanGroupedByEmployeeViewModel>GroupedByEmployee { get; set; }
|
||||
public List<LoanViewModel> LoanListViewModel { get; set; }
|
||||
public PagedResult<LoanViewModel> LoanListViewModel { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,6 @@ public class LoanSearchViewModel
|
||||
public string EndDate { get; set; }
|
||||
|
||||
public int PageIndex { get; set; }
|
||||
public int PageSize { get; set; } = 30;
|
||||
public bool ShowAsGrouped { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت ارسال پیامک
|
||||
/// </summary>
|
||||
public enum SendStatus
|
||||
{
|
||||
All=0,
|
||||
/// <summary>
|
||||
/// موفق
|
||||
/// </summary>
|
||||
Success,
|
||||
//ناموفق
|
||||
Failed,
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
|
||||
public class SmsReportDto
|
||||
{
|
||||
/// <summary>
|
||||
/// تاریخ ارسال
|
||||
/// </summary>
|
||||
public string SentDate { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SmsReportListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// آی دی پیامک در sms.ir
|
||||
/// </summary>
|
||||
public int MessageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت ارسال
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع پیامک
|
||||
/// </summary>
|
||||
public string TypeOfSms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره موبایل
|
||||
/// </summary>
|
||||
public string Mobile { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ساعت و دقیقه
|
||||
/// </summary>
|
||||
public string HourAndMinute { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
|
||||
public class SmsReportSearchModel
|
||||
{
|
||||
//نوع پیامک
|
||||
public TypeOfSmsSetting TypeOfSms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت ارسال پیامک
|
||||
/// </summary>
|
||||
public SendStatus SendStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره موبایل
|
||||
/// </summary>
|
||||
public string Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPatyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// سال
|
||||
/// </summary>
|
||||
public string Year { get; set; }
|
||||
/// <summary>
|
||||
/// ماه
|
||||
/// </summary>
|
||||
public string Month { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شروع
|
||||
/// </summary>
|
||||
public string StartDateFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ پایان
|
||||
/// </summary>
|
||||
public string EndDateFa { get; set; }
|
||||
}
|
||||
@@ -1,34 +1,14 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SmsResult;
|
||||
|
||||
public interface ISmsResultApplication
|
||||
{
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامکها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اکسپند لیست هر تاریخ
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
|
||||
#endregion
|
||||
|
||||
OperationResult Create(CreateSmsResult command);
|
||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||
}
|
||||
@@ -706,10 +706,5 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
|
||||
}
|
||||
|
||||
public async Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,CheckoutListClientSearchModel searchModel)
|
||||
{
|
||||
return await _checkoutRepository.GetListForClient(workshopId, searchModel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -17,23 +15,6 @@ public class SmsResultApplication : ISmsResultApplication
|
||||
_smsResultRepository = smsResultRepository;
|
||||
}
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||||
{
|
||||
return await _smsResultRepository.GetSmsReportList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
{
|
||||
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
public OperationResult Create(CreateSmsResult command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using _0_Framework.Application;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -16,13 +15,11 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
{
|
||||
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
|
||||
{
|
||||
_smsSettingsRepository = smsSettingsRepository;
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +116,12 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
|
||||
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
return await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
|
||||
return await _institutionContractRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
|
||||
}
|
||||
|
||||
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
return await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||
return await _institutionContractRepository.GetBlockListData(DateTime.Now);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +134,7 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
|
||||
if (command.Any())
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
||||
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
||||
return op.Succcedded();
|
||||
}
|
||||
else
|
||||
@@ -156,7 +153,7 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
string sendMessEnd = "پایان مسدودی آنی ";
|
||||
if (command.Any())
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
||||
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
||||
sendMessEnd);
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Exceptions;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
@@ -51,11 +50,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
|
||||
public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration,
|
||||
ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication,
|
||||
IRollCallRepository rollCallRepository, IRollCallMandatoryRepository rollCallMandatoryRepository,
|
||||
IRollCallEmployeeRepository rollCallEmployeeRepository) : base(context)
|
||||
public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration, ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication, IRollCallRepository rollCallRepository, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallEmployeeRepository rollCallEmployeeRepository) : base(context)
|
||||
{
|
||||
|
||||
_authHelper = authHelper;
|
||||
_context = context;
|
||||
_configuration = configuration;
|
||||
@@ -74,8 +71,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
/// <param name="سال به صورت رشته عددی"></param>
|
||||
/// <param name="ماه بصورت رشته عددی"></param>
|
||||
/// <returns></returns>
|
||||
public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double
|
||||
Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month)
|
||||
public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(month);
|
||||
|
||||
@@ -94,8 +90,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
}
|
||||
|
||||
|
||||
return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,
|
||||
res.YearsPay);
|
||||
return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,res.YearsPay);
|
||||
}
|
||||
|
||||
public EditCheckout GetDetails(long id)
|
||||
@@ -141,6 +136,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractEndGr = x.ContractEnd,
|
||||
ContractStart = x.ContractStart.ToFarsi(),
|
||||
ContractEnd = x.ContractEnd.ToFarsi()
|
||||
|
||||
})
|
||||
.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
@@ -156,8 +152,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
/// <param name="contractEnd"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId,
|
||||
string year, string month, string contractStart,
|
||||
public async Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId, string year, string month, string contractStart,
|
||||
string contractEnd)
|
||||
{
|
||||
DateTime startSreach;
|
||||
@@ -170,6 +165,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (month == "0" && year == "0")
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
@@ -199,8 +195,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
startSreach = startStr.ToGeorgianDateTime();
|
||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
var timer = new Stopwatch();
|
||||
timer.Start();
|
||||
|
||||
@@ -215,9 +211,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
contractWorkshop => contractWorkshop.contract.EmployeeId,
|
||||
employee => employee.id,
|
||||
(contractWorkshop, employee) => new { contractWorkshop, employee })
|
||||
.Join(
|
||||
_context.LeftWorkList.AsSplitQuery().Where(l =>
|
||||
l.WorkshopId == workshopId && l.StartWorkDate < endSearch && l.LeftWorkDate > startSreach),
|
||||
.Join(_context.LeftWorkList.AsSplitQuery().Where(l => l.WorkshopId == workshopId && l.StartWorkDate < endSearch && l.LeftWorkDate > startSreach),
|
||||
contractWorkshopEmployee => contractWorkshopEmployee.contractWorkshop.contract.EmployeeId,
|
||||
leftwork => leftwork.EmployeeId,
|
||||
(contractWorkshopEmployee, leftwork) => new { contractWorkshopEmployee, leftwork })
|
||||
@@ -227,15 +221,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
personnelCode => personnelCode.EmployeeId,
|
||||
(contractWorkshopEmployeeleftWork, personnelCode) =>
|
||||
new { contractWorkshopEmployeeleftWork, personnelCode })
|
||||
|
||||
.GroupJoin(_context.CheckoutSet.AsSplitQuery(),
|
||||
contractWorkshopEmployeeleftWorkPersonnelCode => contractWorkshopEmployeeleftWorkPersonnelCode
|
||||
.contractWorkshopEmployeeleftWork.contractWorkshopEmployee.contractWorkshop.contract.id,
|
||||
checkout => checkout.ContractId,
|
||||
(contractWorkshopEmployeeleftWorkPersonnelCode, checkout) =>
|
||||
new { contractWorkshopEmployeeleftWorkPersonnelCode, checkout })
|
||||
|
||||
.GroupJoin(_context.EmployeeComputeOptionsSet.Where(o => o.WorkshopId == workshopId),
|
||||
x => x.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.leftwork
|
||||
.EmployeeId,
|
||||
x => x.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.leftwork.EmployeeId,
|
||||
option => option.EmployeeId,
|
||||
(x, options) => new { x.checkout, x.contractWorkshopEmployeeleftWorkPersonnelCode, options })
|
||||
.SelectMany(
|
||||
@@ -255,11 +250,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
DateTime currentStart = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
|
||||
DateTime currentEnd = ($"{DateTime.Now.ToFarsi().FindeEndOfMonth()}").ToGeorgianDateTime();
|
||||
|
||||
var chekoutCreated = result.checkout.FirstOrDefault(x =>
|
||||
x.ContractStart < endSearch && x.ContractEnd > startSreach && x.IsActiveString == "true");
|
||||
var chekoutCreated = result.checkout.FirstOrDefault(x => x.ContractStart < endSearch && x.ContractEnd > startSreach && x.IsActiveString == "true");
|
||||
|
||||
if (chekoutCreated != null)
|
||||
{
|
||||
|
||||
return new CreateCheckoutListViewModel
|
||||
{
|
||||
Id = chekoutCreated.ContractId,
|
||||
@@ -278,7 +273,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
EmployeeHasCreateCheckout = true
|
||||
};
|
||||
}
|
||||
|
||||
var employeeJoin = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||
.contractWorkshopEmployee.employee.id;
|
||||
|
||||
@@ -289,13 +283,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
var startStatusSearch = leftWork.StartWorkDate > startSreach && leftWork.StartWorkDate <= endSearch
|
||||
? leftWork.StartWorkDate
|
||||
: startSreach;
|
||||
var endStatusSearch = leftWork.HasLeft && leftWork.LeftWorkDate > startSreach &&
|
||||
leftWork.LeftWorkDate <= endSearch
|
||||
var endStatusSearch = leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch
|
||||
? leftWork.LeftWorkDate.AddDays(-1)
|
||||
: startSreach;
|
||||
bool hasRollCall =
|
||||
_rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startStatusSearch,
|
||||
endStatusSearch);
|
||||
_rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startStatusSearch, endStatusSearch);
|
||||
|
||||
bool extension = true;
|
||||
bool laterThanEnd = false;
|
||||
@@ -308,11 +300,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.contractWorkshopEmployee.contractWorkshop.contract.ContarctStart;
|
||||
var contractEndGr = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||
.contractWorkshopEmployee.contractWorkshop.contract.ContractEnd;
|
||||
|
||||
#region HasRollCall
|
||||
|
||||
if (hasRollCall)
|
||||
{
|
||||
|
||||
// اگر ترک کار کرده بود
|
||||
// اگر ترک کارش در بازه انتخاب شده بود
|
||||
if (leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch)
|
||||
@@ -330,6 +322,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
? leftWork.StartWorkDate.ToFarsi()
|
||||
: startSreach.ToFarsi();
|
||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,6 +334,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
? leftWork.StartWorkDate.ToFarsi()
|
||||
: startSreach.ToFarsi();
|
||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||
|
||||
}
|
||||
}
|
||||
else if (endSearch < currentStart)
|
||||
@@ -363,6 +357,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
: startSreach.ToFarsi();
|
||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||
}
|
||||
|
||||
}
|
||||
else if (leftWork.HasLeft && leftWork.LeftWorkDate <= startSreach)
|
||||
{
|
||||
@@ -370,6 +365,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
extension = false;
|
||||
description = "به دلیل ترک کار پیش از تاریخ انتخاب شده مجاز به ایجاد فیش نمی باشید";
|
||||
leftWorkDate = leftWork.LeftWorkDate.ToFarsi();
|
||||
|
||||
}
|
||||
else if (!leftWork.HasLeft && startSreach == currentStart)
|
||||
{
|
||||
@@ -380,9 +376,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
? leftWork.StartWorkDate.ToFarsi()
|
||||
: startSreach.ToFarsi();
|
||||
contractEnd = endSearch.ToFarsi();
|
||||
|
||||
}
|
||||
else if (!leftWork.HasLeft && startSreach < currentStart)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (contractStartGr <= startSreach && contractStartGr > endSearch)
|
||||
{
|
||||
laterThanEnd = true;
|
||||
@@ -397,11 +397,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
contractStart = leftWork.StartWorkDate > startSreach
|
||||
? leftWork.StartWorkDate.ToFarsi()
|
||||
: startSreach.ToFarsi();
|
||||
contractEnd = (leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch)
|
||||
? leftWork.LeftWorkDate.AddDays(-1).ToFarsi()
|
||||
: endSearch.ToFarsi();
|
||||
contractEnd = (leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch) ? leftWork.LeftWorkDate.AddDays(-1).ToFarsi() : endSearch.ToFarsi();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -467,11 +468,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
contractEnd = endSearch.ToFarsi();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
return new CreateCheckoutListViewModel
|
||||
{
|
||||
Id = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||
@@ -495,14 +498,15 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractStart = contractStart,
|
||||
ContractEnd = contractEnd,
|
||||
LeftWorkDate = leftWorkDate,
|
||||
EmployeeHasCreateCheckout = result.option != null
|
||||
? result.option.CreateCheckout
|
||||
: result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||
.contractWorkshopEmployee.contractWorkshop.workshop.CreateCheckout
|
||||
EmployeeHasCreateCheckout = result.option != null ? result.option.CreateCheckout : result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.contractWorkshopEmployee.contractWorkshop.workshop.CreateCheckout
|
||||
|
||||
};
|
||||
|
||||
}).Where(x => x.EmployeeHasCreateCheckout).OrderByDescending(x => x.Extension).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
Console.WriteLine("process : " + timer.Elapsed);
|
||||
|
||||
return new CreateCheckoutListViewModel()
|
||||
@@ -513,6 +517,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
public async Task CreateCkeckout(Checkout command)
|
||||
{
|
||||
|
||||
var creationDates = DateTime.Now;
|
||||
|
||||
//var result = await _context.Database.ExecuteSqlInterpolatedAsync($"EXEC InsertQuery_Checkout {id},{employeeFullName},{isActiveString},{signature},{fathersName},{nationalCode},{dateOfBirth},{employeeId},{workshopName},{workshopId},{contractNo},{contractStart},{contractEnd},{month},{year},{contractId},{workingHoursId},{monthlySalary},{baseYearsPay},{consumableItems},{housingAllowance},{overtimePay},{nightworkPay},{fridayPay},{missionPay},{shiftPay},{familyAllowance},{bonusesPay},{yearsPay},{leavePay},{insuranceDeduction},{taxDeducation},{installmentDeduction},{salaryAidDeduction},{absenceDeduction},{creationDate},{archiveCode},{personnelCode},{sumOfWorkingDays},{totalClaims},{taxDeducation},{totalPayment}");
|
||||
@@ -531,6 +536,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
if(command.HasInsuranceShareTheSameAsList)
|
||||
entity.SetInsuranceShare();
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -672,6 +678,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
query = query.Where(x => x.ContractStartGr >= startyearGr && x.ContractEndGr <= endYearGr).ToList();
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
return query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
@@ -790,6 +799,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
endDate >= x.ContractEndGr && startDate < x.ContractEndGr).ToList();
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
return query.OrderBy(x => x.PersonnelCodeInt).ToList();
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
||||
@@ -803,12 +813,17 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
return query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||
|
||||
}
|
||||
|
||||
return query.OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(100).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//foreach(var items in query)
|
||||
//{
|
||||
// var employeId = _context.WorkshopEmployers?.Where(x => x.WorkshopId == items.WorkshopId)
|
||||
@@ -850,6 +865,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractNo = x.ContractNo,
|
||||
ContractId = x.ContractId,
|
||||
HasRollCall = x.HasRollCall
|
||||
|
||||
});
|
||||
|
||||
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId != 0)
|
||||
@@ -868,12 +884,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
var start = searchModel.ContractStart.ToGeorgianDateTime();
|
||||
var end = searchModel.ContractEnd.ToGeorgianDateTime();
|
||||
query = query.Where(x =>
|
||||
x.ContractStartGr == start && x.ContractEndGr == end && x.EmployeeId == searchModel.EmployeeId &&
|
||||
x.WorkshopId == searchModel.WorkshopId);
|
||||
query = query.Where(x => x.ContractStartGr == start && x.ContractEndGr == end && x.EmployeeId == searchModel.EmployeeId && x.WorkshopId == searchModel.WorkshopId);
|
||||
}
|
||||
|
||||
return query.OrderBy(x => x.ContractStartGr).ToList();
|
||||
|
||||
}
|
||||
|
||||
public List<CheckoutViewModel> PrintAll(List<long> id)
|
||||
@@ -954,8 +969,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
CheckoutRollCall = item.CheckoutRollCall != null
|
||||
? new CheckoutRollCallViewModel()
|
||||
CheckoutRollCall = item.CheckoutRollCall != null ? new CheckoutRollCallViewModel()
|
||||
{
|
||||
TotalPresentTimeSpan = item.CheckoutRollCall.TotalPresentTimeSpan,
|
||||
TotalBreakTimeSpan = item.CheckoutRollCall.TotalBreakTimeSpan,
|
||||
@@ -963,8 +977,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
TotalPaidLeaveTmeSpan = item.CheckoutRollCall.TotalPaidLeaveTmeSpan,
|
||||
TotalMandatoryTimeSpan = item.CheckoutRollCall.TotalMandatoryTimeSpan,
|
||||
TotalSickLeaveTimeSpan = item.CheckoutRollCall.TotalSickLeaveTimeSpan,
|
||||
RollCallDaysCollection = item.CheckoutRollCall.RollCallDaysCollection.Select(d =>
|
||||
new CheckoutRollCallDayViewModel()
|
||||
RollCallDaysCollection = item.CheckoutRollCall.RollCallDaysCollection.Select(d => new CheckoutRollCallDayViewModel()
|
||||
{
|
||||
WorkingTimeSpan = d.WorkingTimeSpan,
|
||||
BreakTimeSpan = d.BreakTimeSpan,
|
||||
@@ -981,12 +994,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
SecondEndDate = d.SecondEndDate,
|
||||
SecondStartDate = d.SecondStartDate,
|
||||
}).ToList(),
|
||||
}
|
||||
: null,
|
||||
|
||||
} : null,
|
||||
HasAmountConflict =item.HasAmountConflict,
|
||||
EmployeeMandatoryHoursTimeSpan = item.EmployeeMandatoryHours,
|
||||
EmployeeMandatoryHoursStr = Tools.ToFarsiHoursAndMinutes(
|
||||
Convert.ToInt32(item.EmployeeMandatoryHours.TotalHours), item.EmployeeMandatoryHours.Minutes, "-")
|
||||
EmployeeMandatoryHoursStr = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(item.EmployeeMandatoryHours.TotalHours),item.EmployeeMandatoryHours.Minutes,"-")
|
||||
};
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
ch.WorkshopName = workshopName.WorkshopName;
|
||||
@@ -1110,8 +1122,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
var totalPaidLeaveTimeSpans = hourlyPaidLeaveTimeSpans.Concat(dailyPaidLeaveTimeSpans);
|
||||
ch.TotalHourlyLeave = new TimeSpan(hourlyPaidLeaveTimeSpans.Sum(x => x.Ticks));
|
||||
ch.TotalPaidLeave =
|
||||
new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
ch.TotalPaidLeave = new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1129,9 +1142,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ch.TotalBreakTimeStr = ch.CheckoutRollCall.TotalBreakTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalPresentTimeStr = ch.CheckoutRollCall.TotalPresentTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalMandatoryTimeStr = ch.CheckoutRollCall.TotalMandatoryTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(
|
||||
Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours),
|
||||
ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-");
|
||||
ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours), ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-");
|
||||
ch.MonthlyRollCall = ch.CheckoutRollCall.RollCallDaysCollection
|
||||
.Select(x => new CheckoutDailyRollCallViewModel
|
||||
{
|
||||
@@ -1152,12 +1163,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
BreakTimeString = $"{(int)(x.BreakTimeSpan.TotalHours)}:{x.BreakTimeSpan.Minutes:00}",
|
||||
RollCallDateFa = x.Date.ToFarsi()
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId,
|
||||
ch.ContractStartGr, ch.ContractEndGr);
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
else
|
||||
{
|
||||
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
||||
@@ -1166,11 +1178,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
||||
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
||||
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
||||
ch.MonthlyRollCall =
|
||||
ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||
ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||
}
|
||||
}
|
||||
|
||||
query.Add(ch);
|
||||
}
|
||||
|
||||
@@ -1181,7 +1191,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
printNumer += 1;
|
||||
rec.PrintCounter = printNumer;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
@@ -1207,6 +1216,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
Id = x.id,
|
||||
EmployerFullName = x.FName + " " + x.LName,
|
||||
IsLegal = x.IsLegal,
|
||||
|
||||
}).Where(x => emp.Contains(x.Id)).ToList();
|
||||
if (employerlist.Count > 0)
|
||||
{
|
||||
@@ -1235,8 +1245,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
//}
|
||||
|
||||
|
||||
var leaveList = _context.LeaveList.Where(x =>
|
||||
x.WorkshopId == ch.WorkshopId && x.EmployeeId == ch.EmployeeId && x.LeaveType == "استحقاقی");
|
||||
var leaveList = _context.LeaveList.Where(x => x.WorkshopId == ch.WorkshopId && x.EmployeeId == ch.EmployeeId && x.LeaveType == "استحقاقی");
|
||||
var leaveViewModel = new List<LeaveViewModel>();
|
||||
|
||||
foreach (var list in leaveList)
|
||||
@@ -1361,6 +1370,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
|
||||
}).SingleOrDefault(x => x.Id == id);
|
||||
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
@@ -1380,7 +1390,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
};
|
||||
employers.Add(employer);
|
||||
}
|
||||
|
||||
ch.MaritalStatus = _context.Employees.Find(ch.EmployeeId)?.MaritalStatus;
|
||||
ch.EmployerList = employers;
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
||||
@@ -1475,8 +1484,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
ch.TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
|
||||
var hourlyPaidLeaveTimeSpans =
|
||||
hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan()).ToList();
|
||||
var hourlyPaidLeaveTimeSpans = hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan()).ToList();
|
||||
|
||||
var dailyPaidLeaveTimeSpans = dailyPaidLeave.Select(x =>
|
||||
{
|
||||
@@ -1489,19 +1497,20 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ch.TotalHourlyLeave = new TimeSpan(hourlyPaidLeaveTimeSpans.Sum(x => x.Ticks));
|
||||
ch.TotalPaidLeave = new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
if (ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
ch.TotalDeductions = "";
|
||||
ch.TotalPayment = "";
|
||||
}
|
||||
|
||||
if (ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId,
|
||||
ch.ContractStartGr, ch.ContractEndGr);
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
else
|
||||
{
|
||||
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
||||
@@ -1510,15 +1519,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
||||
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
||||
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
||||
ch.MonthlyRollCall =
|
||||
ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||
ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
private List<CheckoutDailyRollCallViewModel> ConvertStaticToRollCall(CreateWorkingHoursTemp workingHours,
|
||||
bool workshopHolidayWorking)
|
||||
private List<CheckoutDailyRollCallViewModel> ConvertStaticToRollCall(CreateWorkingHoursTemp workingHours, bool workshopHolidayWorking)
|
||||
{
|
||||
var rollCalls = _rollCallMandatoryRepository.ConvertStaticHoursToRollCall(workingHours,
|
||||
workshopHolidayWorking);
|
||||
@@ -1551,8 +1557,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
|
||||
|
||||
|
||||
var holidays = _context.HolidayItems.Where(x => x.HolidayYear.Contains(year.ToString())).Select(x =>
|
||||
new HolidayItemViewModel
|
||||
var holidays = _context.HolidayItems.Where(x => x.HolidayYear.Contains(year.ToString())).Select(x => new HolidayItemViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
Holidaydate = x.Holidaydate.ToFarsi(),
|
||||
@@ -1565,8 +1570,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
holidays = [];
|
||||
|
||||
//all the dates from start to end, to be compared with present days to get absent dates
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date)
|
||||
.ToList();
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date).ToList();
|
||||
|
||||
var absentRecords = completeDaysList
|
||||
.ExceptBy(rollCalls.Select(x => x.ShiftDate.Date), y => y.Date)
|
||||
@@ -1592,13 +1596,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
var presentDays = rollCalls.GroupBy(x => x.ShiftDate.Date).Select(x =>
|
||||
{
|
||||
|
||||
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
||||
|
||||
var rollCallTimeSpanPerDay =
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y =>
|
||||
y.ShiftEndWithoutRest == null
|
||||
? (y.EndDate - y.StartDate).Value!.Ticks
|
||||
: (y.ShiftEndWithoutRest - y.StartDate)!.Value.Ticks));
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => y.ShiftEndWithoutRest == null ? (y.EndDate - y.StartDate).Value!.Ticks : (y.ShiftEndWithoutRest - y.StartDate)!.Value.Ticks));
|
||||
var breakTimePerDay = new TimeSpan(x.Sum(r => r.BreakTimeSpan.Ticks));
|
||||
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
@@ -1612,6 +1614,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
secondRCEndDate = secondRollCall.ShiftEndWithoutRest ?? secondRollCall.EndDate;
|
||||
|
||||
|
||||
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||
@@ -1683,15 +1686,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
return new List<CheckoutViewModel>();
|
||||
}
|
||||
|
||||
var employers =
|
||||
_context.Employers.Where(x => x.ContractingPartyId == contracingPartyAcc.PersonalContractingPartyId)
|
||||
.Select(x => x.id).ToList();
|
||||
_context.Employers.Where(x => x.ContractingPartyId == contracingPartyAcc.PersonalContractingPartyId).Select(x => x.id).ToList();
|
||||
if (employers.Count < 1)
|
||||
{
|
||||
return new List<CheckoutViewModel>();
|
||||
}
|
||||
|
||||
var workshopIds = _context.WorkshopEmployers.Where(x => employers.Contains(x.EmployerId))
|
||||
.Select(x => x.WorkshopId).ToList();
|
||||
var checkValid = workshopIds.Any(x => x == searchModel.WorkshopId);
|
||||
@@ -1699,9 +1699,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
return new List<CheckoutViewModel>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
||||
.AsSplitQuery().Select(x => new CheckoutViewModel()
|
||||
{
|
||||
@@ -1743,7 +1741,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
if (searchModel.EmployeeId > 0)
|
||||
{
|
||||
@@ -1857,20 +1857,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
default:
|
||||
y2 = $"{searchModel.Year}/{searchModel.Month}/29";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var start = y.ToGeorgianDateTime();
|
||||
var end = y2.ToGeorgianDateTime();
|
||||
|
||||
query = query.Where(x =>
|
||||
x.ContractStartGr >= start && x.ContractStartGr < end && x.ContractEndGr > start &&
|
||||
x.ContractEndGr <= end ||
|
||||
x.ContractStartGr <= start && x.ContractEndGr >= end ||
|
||||
start <= x.ContractStartGr && end > x.ContractStartGr ||
|
||||
end >= x.ContractEndGr && start < x.ContractEndGr);
|
||||
query = query.Where(x => x.ContractStartGr >= start && x.ContractStartGr < end && x.ContractEndGr > start && x.ContractEndGr <= end ||
|
||||
x.ContractStartGr <= start && x.ContractEndGr >= end || start <= x.ContractStartGr && end > x.ContractStartGr || end >= x.ContractEndGr && start < x.ContractEndGr);
|
||||
}
|
||||
|
||||
if (searchModel.SearchAll)
|
||||
return query.OrderByDescending(x => x.Id).ToList();
|
||||
switch (searchModel.Sorting)
|
||||
@@ -1901,6 +1897,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
break;
|
||||
default: return query.OrderByDescending(x => x.Id).Skip(searchModel.PageIndex).Take(30).ToList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1930,10 +1928,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var checkout = _context.CheckoutSet.Where(x => x.id == id)?.FirstOrDefault();
|
||||
_context.CheckoutSet.Remove(checkout);
|
||||
_context.SaveChanges();
|
||||
return op.Succcedded(-1, "حذف با موفقیت انجام شد.");
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -1951,7 +1951,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
notRemoveList.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return notRemoveList;
|
||||
}
|
||||
|
||||
@@ -2011,8 +2010,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
// );
|
||||
|
||||
var checkouts =
|
||||
_context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
||||
.Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
_context.CheckoutSet.Include(w=>w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
.Join(_context.Workshops.AsSplitQuery(),
|
||||
ch => ch.WorkshopId,
|
||||
workshop => workshop.id,
|
||||
@@ -2035,8 +2033,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
res.ch,
|
||||
res.workshop,
|
||||
option = _context.EmployeeComputeOptionsSet.FirstOrDefault(x =>
|
||||
x.WorkshopId == res.ch.WorkshopId && x.EmployeeId == res.ch.EmployeeId),
|
||||
option = _context.EmployeeComputeOptionsSet.FirstOrDefault(x=>x.WorkshopId == res.ch.WorkshopId &&x.EmployeeId == res.ch.EmployeeId),
|
||||
res.workshopEmployer,
|
||||
contractingParty = _context.PersonalContractingParties
|
||||
.Include(p => p.Employers)
|
||||
@@ -2053,18 +2050,15 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
checkouts = checkouts.Where(x => x.ch.WorkshopId == searchModel.WorkshopId);
|
||||
}
|
||||
|
||||
if (searchModel.EmployeeId != 0)
|
||||
{
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
checkouts = checkouts.Where(x => x.ch.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId != 0)
|
||||
{
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
checkouts = checkouts.Where(x =>
|
||||
x.contractingParty.Employers.Select(c => c.id).Contains(searchModel.EmployerId));
|
||||
checkouts = checkouts.Where(x => x.contractingParty.Employers.Select(c => c.id).Contains(searchModel.EmployerId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo))
|
||||
@@ -2074,6 +2068,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if (searchModel.IsActiveString == null)
|
||||
//{
|
||||
// checkouts = checkouts.Where(x => x.ch.IsActiveString == "true");
|
||||
@@ -2105,6 +2100,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
checkouts = checkouts.Where(x => x.ch.ContractStart >= startyearGr && x.ch.ContractEnd <= endYearGr);
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
checkouts = checkouts.OrderByDescending(x => x.ch.ContractEnd);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
@@ -2224,6 +2220,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
endDate >= x.ch.ContractEnd && startDate < x.ch.ContractEnd);
|
||||
//if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
// checkouts = checkouts.OrderBy(x => x.ch.PersonnelCodeInt);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
||||
@@ -2243,20 +2240,22 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
||||
{
|
||||
hasSearch = true;
|
||||
var employeeList = _context.Employees.Where(x =>
|
||||
(!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id)
|
||||
.ToList();
|
||||
var employeeList = _context.Employees.Where(x => (!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id).ToList();
|
||||
checkouts = checkouts.Where(x => employeeList.Contains(x.ch.EmployeeId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
if (!hasSearch && !hasEmployeeOrWorkshpSearch)
|
||||
{
|
||||
|
||||
return checkouts.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
|
||||
Id = x.ch.id,
|
||||
EmployeeFullName = x.ch.EmployeeFullName,
|
||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||
@@ -2282,21 +2281,26 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
||||
new CheckoutWarningMessageModel
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm=> new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
|
||||
.OrderByDescending(x => x.Id).ThenByDescending(x => x.Year)
|
||||
.ThenBy(x => x.PersonnelCodeInt)
|
||||
.Take(50).ToList();
|
||||
|
||||
}
|
||||
else if (hasSearch && !hasEmployeeOrWorkshpSearch)
|
||||
{
|
||||
|
||||
var result = checkouts.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
|
||||
Id = x.ch.id,
|
||||
EmployeeFullName = x.ch.EmployeeFullName,
|
||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||
@@ -2322,17 +2326,19 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
||||
new CheckoutWarningMessageModel
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).OrderByDescending(x => x.Id)
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First());
|
||||
|
||||
|
||||
|
||||
if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) && string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
{
|
||||
@@ -2342,8 +2348,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||
}
|
||||
else if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.Month) && !string.IsNullOrWhiteSpace(searchModel.Year))
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) && !string.IsNullOrWhiteSpace(searchModel.Month) && !string.IsNullOrWhiteSpace(searchModel.Year))
|
||||
{
|
||||
//اگر فقط سال و ماه رو سرچ کرد
|
||||
return result.Take(300)
|
||||
@@ -2361,11 +2366,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
return result.ToList().OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||
|
||||
}
|
||||
else if (hasEmployeeOrWorkshpSearch && !hasSearch)
|
||||
{
|
||||
|
||||
return checkouts.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
|
||||
Id = x.ch.id,
|
||||
EmployeeFullName = x.ch.EmployeeFullName,
|
||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||
@@ -2391,12 +2399,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
||||
new CheckoutWarningMessageModel
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
|
||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||
}
|
||||
@@ -2404,6 +2413,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
return checkouts.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
|
||||
Id = x.ch.id,
|
||||
EmployeeFullName = x.ch.EmployeeFullName,
|
||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||
@@ -2429,21 +2439,26 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
||||
new CheckoutWarningMessageModel
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id)
|
||||
.Select(x => x.First()).ToList()
|
||||
.OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<List<CheckoutViewModel>> SearchForMainCheckout(CheckoutSearchModel searchModel)
|
||||
{
|
||||
|
||||
|
||||
bool hasSearch = false;
|
||||
bool hasEmployeeOrWorkshpSearch = false;
|
||||
//List<CheckoutViewModel> query = null;
|
||||
@@ -2461,8 +2476,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.Select(x => x.WorkshopId).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
var query = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
//var start = ;
|
||||
@@ -2485,9 +2503,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
IsActiveString = x.IsActiveString,
|
||||
Signature = x.Signature,
|
||||
CreationDate = x.CreationDate,
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo) && searchModel.ContractId != 0)
|
||||
query = query.Where(x =>
|
||||
x.ContractNo == searchModel.ContractNo && x.ContractId == searchModel.ContractId);
|
||||
@@ -2496,13 +2518,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
}
|
||||
|
||||
if (searchModel.EmployeeId != 0)
|
||||
{
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId != 0)
|
||||
{
|
||||
hasEmployeeOrWorkshpSearch = true;
|
||||
@@ -2546,6 +2566,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
query = query.Where(x => x.ContractStartGr >= startyearGr && x.ContractEndGr <= endYearGr);
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
@@ -2665,6 +2686,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
endDate >= x.ContractEndGr && startDate < x.ContractEndGr);
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
query = query.OrderBy(x => x.PersonnelCodeInt);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
||||
@@ -2679,18 +2701,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
||||
{
|
||||
hasSearch = true;
|
||||
var employeeList = _context.Employees.Where(x =>
|
||||
(!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id)
|
||||
.ToList();
|
||||
var employeeList = _context.Employees.Where(x => (!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id).ToList();
|
||||
query = query.Where(x => employeeList.Contains(x.EmployeeId));
|
||||
}
|
||||
|
||||
if (hasSearch)
|
||||
return query.OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||
@@ -2701,17 +2721,22 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(50).ToList();
|
||||
|
||||
// Console.WriteLine("return" + watch.Elapsed);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)>
|
||||
GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
return _context.CheckoutSet.AsSplitQuery().Where(x =>
|
||||
x.ContractEnd.Date >= start && x.ContractStart.Date <= end && x.WorkshopId == workshopId).Select(x => new
|
||||
|
||||
|
||||
|
||||
return _context.CheckoutSet.AsSplitQuery().Where(x => x.ContractEnd.Date >= start && x.ContractStart.Date <= end && x.WorkshopId == workshopId).Select(x => new
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
CheckoutEnd = x.ContractEnd,
|
||||
@@ -2726,88 +2751,5 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
x.ContractEnd >= inDate);
|
||||
}
|
||||
|
||||
public async Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,
|
||||
CheckoutListClientSearchModel searchModel)
|
||||
{
|
||||
var query = _context.CheckoutSet.Where(x => x.WorkshopId == workshopId);
|
||||
if (searchModel.EmployeeId is > 0)
|
||||
{
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.StartDate) && !string.IsNullOrWhiteSpace(searchModel.EndDate))
|
||||
{
|
||||
if (!searchModel.StartDate.TryToGeorgianDateTime(out var startDateGr))
|
||||
throw new BadRequestException("تاریخ شروع جستجو نامعتبر است");
|
||||
|
||||
if (!searchModel.EndDate.TryToGeorgianDateTime(out var endDateGr))
|
||||
{
|
||||
throw new BadRequestException("تاریخ پایان جستجو نامعتبر است");
|
||||
}
|
||||
|
||||
query = query.Where(x => x.ContractStart <= endDateGr && x.ContractEnd >= startDateGr);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Year))
|
||||
{
|
||||
query = query.Where(x => x.Year == searchModel.Year);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
{
|
||||
var searchedMonth = Convert.ToInt32(searchModel.Month).ToFarsiMonthByIntNumber();
|
||||
|
||||
query = query.Where(x => x.Month == searchedMonth);
|
||||
}
|
||||
|
||||
query = searchModel.OrderType switch
|
||||
{
|
||||
CheckoutClientListOrderType.ByCheckoutCreationDate =>
|
||||
query.OrderBy(x => x.CreationDate),
|
||||
|
||||
CheckoutClientListOrderType.ByCheckoutStartDate =>
|
||||
query.OrderBy(x => x.ContractStart),
|
||||
|
||||
CheckoutClientListOrderType.ByCheckoutStartDateDescending =>
|
||||
query.OrderByDescending(x => x.ContractStart),
|
||||
|
||||
CheckoutClientListOrderType.ByPersonnelCode =>
|
||||
query.OrderBy(x => x.PersonnelCode),
|
||||
|
||||
CheckoutClientListOrderType.ByPersonnelCodeDescending =>
|
||||
query.OrderByDescending(x => x.PersonnelCode),
|
||||
|
||||
CheckoutClientListOrderType.BySignedCheckout =>
|
||||
query.OrderByDescending(x => x.Signature == "1"),
|
||||
|
||||
CheckoutClientListOrderType.ByUnSignedCheckout =>
|
||||
query.OrderBy(x => x.Signature == "1"),
|
||||
|
||||
_ => query.OrderByDescending(x => x.id)
|
||||
};
|
||||
|
||||
var list =await query.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
|
||||
var resList = list.Select(x => new CheckoutListClientDto()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractStart = x.ContractStart.ToFarsi(),
|
||||
ContractEnd = x.ContractEnd.ToFarsi(),
|
||||
Year = x.Year,
|
||||
Month = x.Month,
|
||||
ContractNo = x.ContractNo,
|
||||
EmployeeName = x.EmployeeFullName,
|
||||
Signature = x.Signature == "1"
|
||||
}).ToList();
|
||||
|
||||
var res = new PagedResult<CheckoutListClientDto>
|
||||
{
|
||||
TotalCount = await query.CountAsync(),
|
||||
List = resList
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -171,12 +171,17 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate);
|
||||
}
|
||||
|
||||
result.LoanListViewModel = query.OrderByDescending(x => x.StartInstallmentPayment).Skip(searchModel.PageIndex)
|
||||
result.LoanListViewModel = new PagedResult<LoanViewModel>()
|
||||
{
|
||||
TotalCount = query.Count(),
|
||||
List = query.OrderByDescending(x => x.StartInstallmentPayment)
|
||||
.ApplyPagination(searchModel.PageIndex, searchModel.PageSize)
|
||||
.Take(30).ToList()
|
||||
.Select(x => new LoanViewModel()
|
||||
{
|
||||
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode
|
||||
.ToString(),
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountPerMonth = x.AmountPerMonth.ToMoney(),
|
||||
StartDateTime = x.StartInstallmentPayment.ToFarsi(),
|
||||
@@ -186,7 +191,9 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
EmployeeId = x.EmployeeId,
|
||||
YearFa = pc.GetYear(x.StartInstallmentPayment).ToString(),
|
||||
|
||||
}).ToList();
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
using _0_Framework.Application;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application.Enums;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -22,260 +15,6 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
_context = context;
|
||||
}
|
||||
|
||||
#region ForApi
|
||||
|
||||
|
||||
|
||||
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||||
{
|
||||
|
||||
// مرحله 1: همه رکوردها را با projection ساده بگیرید
|
||||
var rawQuery = await _context.SmsResults
|
||||
.Select(x => new
|
||||
{
|
||||
x.id,
|
||||
x.ContractingPatyId,
|
||||
x.Mobile,
|
||||
x.Status,
|
||||
x.TypeOfSms,
|
||||
x.CreationDate,
|
||||
DateOnly = x.CreationDate.Date // فقط تاریخ بدون ساعت
|
||||
})
|
||||
.AsNoTracking()
|
||||
.ToListAsync(); // اینجا SQL اجرا میشود و همه دادهها به client میآیند
|
||||
|
||||
if (searchModel.ContractingPatyId > 0)
|
||||
{
|
||||
rawQuery = rawQuery.Where(x => x.ContractingPatyId == searchModel.ContractingPatyId).ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Mobile))
|
||||
{
|
||||
rawQuery = rawQuery.Where(x => x.Mobile.Contains(searchModel.Mobile)).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms != TypeOfSmsSetting.All && searchModel.TypeOfSms != TypeOfSmsSetting.Warning)
|
||||
{
|
||||
var typeOfSms = "All";
|
||||
switch (searchModel.TypeOfSms)
|
||||
{
|
||||
case TypeOfSmsSetting.InstitutionContractDebtReminder:
|
||||
typeOfSms = "یادآور بدهی ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.MonthlyInstitutionContract:
|
||||
typeOfSms = "صورت حساب ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.BlockContractingParty:
|
||||
typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
break;
|
||||
case TypeOfSmsSetting.LegalAction:
|
||||
typeOfSms = "اقدام قضایی";
|
||||
break;
|
||||
case TypeOfSmsSetting.InstitutionContractConfirm:
|
||||
typeOfSms = "یادآور تایید قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
|
||||
typeOfSms = "کد تاییدیه قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.TaskReminder:
|
||||
typeOfSms = "یادآور وظایف";
|
||||
break;
|
||||
}
|
||||
|
||||
rawQuery = rawQuery.Where(x => x.TypeOfSms == typeOfSms).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
|
||||
{
|
||||
rawQuery = rawQuery.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.SendStatus != SendStatus.All)
|
||||
{
|
||||
var status = "All";
|
||||
|
||||
switch (searchModel.SendStatus)
|
||||
{
|
||||
case SendStatus.Success: status = "موفق";
|
||||
break;
|
||||
case SendStatus.Failed: status = "ناموفق";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
rawQuery = rawQuery.Where(x => x.Status == status).ToList();
|
||||
|
||||
}
|
||||
#region searchByDate
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.StartDateFa) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.EndDateFa))
|
||||
{
|
||||
if (searchModel.StartDateFa.TryToGeorgianDateTime(out var startGr) == false ||
|
||||
searchModel.EndDateFa.TryToGeorgianDateTime(out var endGr) == false)
|
||||
return new List<SmsReportDto>();
|
||||
|
||||
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
{
|
||||
var start = searchModel.Year + "/" + searchModel.Month + "/01";
|
||||
var end = start.FindeEndOfMonth();
|
||||
var startGr = start.ToGeorgianDateTime();
|
||||
var endGr = end.ToGeorgianDateTime();
|
||||
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
{
|
||||
var start = searchModel.Year + "/01/01";
|
||||
var findEndOfYear = searchModel.Year + "/12/01";
|
||||
var end = findEndOfYear.FindeEndOfMonth();
|
||||
var startGr = start.ToGeorgianDateTime();
|
||||
var endGr = end.ToGeorgianDateTime();
|
||||
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// مرحله 2: گروهبندی و انتخاب آخرین رکورد هر روز روی Client
|
||||
var grouped = rawQuery
|
||||
.GroupBy(x => x.DateOnly)
|
||||
.Select(g => g.OrderByDescending(x => x.CreationDate).First())
|
||||
.OrderByDescending(x => x.CreationDate)
|
||||
.ToList();
|
||||
|
||||
// مرحله 3: تبدیل به DTO و ToFarsi
|
||||
var result = grouped.Select(x => new SmsReportDto
|
||||
{
|
||||
SentDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(date))
|
||||
return new List<SmsReportListDto>();
|
||||
|
||||
if (date.TryToGeorgianDateTime(out var searchDate) == false)
|
||||
return new List<SmsReportListDto>();
|
||||
|
||||
var query = await _context.SmsResults.Where(x => x.CreationDate.Date == searchDate.Date)
|
||||
.Select(x =>
|
||||
new
|
||||
{
|
||||
x.id,
|
||||
x.MessageId,
|
||||
x.Status,
|
||||
x.TypeOfSms,
|
||||
x.ContractingPartyName,
|
||||
x.Mobile,
|
||||
x.ContractingPatyId,
|
||||
x.InstitutionContractId,
|
||||
x.CreationDate,
|
||||
x.CreationDate.Hour,
|
||||
x.CreationDate.Minute
|
||||
|
||||
}).AsNoTracking()
|
||||
.ToListAsync(); ;
|
||||
|
||||
if (searchModel.ContractingPatyId > 0)
|
||||
{
|
||||
query = query.Where(x => x.ContractingPatyId == searchModel.ContractingPatyId).ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Mobile))
|
||||
{
|
||||
query = query.Where(x => x.Mobile.Contains(searchModel.Mobile)).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms != TypeOfSmsSetting.All && searchModel.TypeOfSms != TypeOfSmsSetting.Warning)
|
||||
{
|
||||
var typeOfSms = "All";
|
||||
switch (searchModel.TypeOfSms)
|
||||
{
|
||||
case TypeOfSmsSetting.InstitutionContractDebtReminder:
|
||||
typeOfSms = "یادآور بدهی ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.MonthlyInstitutionContract:
|
||||
typeOfSms = "صورت حساب ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.BlockContractingParty:
|
||||
typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
break;
|
||||
case TypeOfSmsSetting.LegalAction:
|
||||
typeOfSms = "اقدام قضایی";
|
||||
break;
|
||||
case TypeOfSmsSetting.InstitutionContractConfirm:
|
||||
typeOfSms = "یادآور تایید قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
|
||||
typeOfSms = "کد تاییدیه قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.TaskReminder:
|
||||
typeOfSms = "یادآور وظایف";
|
||||
break;
|
||||
}
|
||||
|
||||
query = query.Where(x => x.TypeOfSms == typeOfSms).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
|
||||
{
|
||||
query = query.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.SendStatus != SendStatus.All)
|
||||
{
|
||||
var status = "All";
|
||||
|
||||
switch (searchModel.SendStatus)
|
||||
{
|
||||
case SendStatus.Success:
|
||||
status = "موفق";
|
||||
break;
|
||||
case SendStatus.Failed:
|
||||
status = "ناموفق";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
query = query.Where(x => x.Status == status).ToList();
|
||||
|
||||
}
|
||||
|
||||
if (query.Count == 0)
|
||||
return new List<SmsReportListDto>();
|
||||
|
||||
var result = query.OrderByDescending(x => x.CreationDate.Hour)
|
||||
.ThenByDescending(x => x.CreationDate.Minute).Select(x =>
|
||||
new SmsReportListDto()
|
||||
{
|
||||
Id = x.id,
|
||||
MessageId = x.MessageId,
|
||||
Status = x.Status,
|
||||
TypeOfSms = x.TypeOfSms,
|
||||
ContractingPartyName = x.ContractingPartyName,
|
||||
Mobile = x.Mobile,
|
||||
HourAndMinute = x.CreationDate.TimeOfDay.ToString(@"hh\:mm"),
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||
{
|
||||
|
||||
|
||||
@@ -207,11 +207,16 @@ public class SmsService : ISmsService
|
||||
}
|
||||
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||
{
|
||||
|
||||
|
||||
if(startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
|
||||
return new List<ApiResultViewModel>();
|
||||
|
||||
var st = new DateTime(2024, 6, 2);
|
||||
var ed = new DateTime(2024, 7, 1);
|
||||
if (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
|
||||
{
|
||||
st = startDate.ToGeorgianDateTime();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
|
||||
{
|
||||
ed = endDate.ToGeorgianDateTime();
|
||||
}
|
||||
var res = new List<ApiResultViewModel>();
|
||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
@@ -243,44 +248,6 @@ public class SmsService : ISmsService
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate)
|
||||
{
|
||||
|
||||
|
||||
if (startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
|
||||
return new List<ApiReportDto>();
|
||||
|
||||
var res = new List<ApiReportDto>();
|
||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
|
||||
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
|
||||
int pageNumber = 2;
|
||||
int pageSize = 100; // max: 100
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||
|
||||
MessageReportResult[] messages = response.Data;
|
||||
foreach (var message in messages)
|
||||
{
|
||||
var appendData = new ApiReportDto()
|
||||
{
|
||||
MessageId = message.MessageId,
|
||||
|
||||
Mobile = message.Mobile,
|
||||
|
||||
SendUnixTime = UnixTimeStampToDateTime(message.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(message.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
|
||||
};
|
||||
res.Add(appendData);
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string DeliveryStatus(byte? dv)
|
||||
{
|
||||
string mess = "";
|
||||
|
||||
@@ -563,7 +563,6 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
|
||||
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
|
||||
|
||||
services.AddTransient<IInstitutionContractSmsServiceRepository, InstitutionContractSmsServiceRepository>();
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -209,38 +209,22 @@ public class CreateOrEditCheckoutCommandHandler : IBaseCommandHandler<CreateOrEd
|
||||
}
|
||||
|
||||
}
|
||||
////حقوق نهایی
|
||||
//var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
||||
//// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||
//monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
||||
//حقوق نهایی
|
||||
var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
||||
// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||
monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
||||
|
||||
////حقوق کسر شده
|
||||
//var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
||||
|
||||
//new chang salary compute
|
||||
var monthlySalaryPay = totalHoursWorked * monthlySalaryDefined;
|
||||
//حقوق کسر شده
|
||||
var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
||||
|
||||
//زمان باقی مانده
|
||||
var remainingTime = totalHoursWorked - mandatoryHours;
|
||||
|
||||
|
||||
//تناسب به دقیقه
|
||||
#region MyRegion
|
||||
|
||||
//var monthlySalaryDefinedTest = monthlySalaryDefined * mandatoryHours;
|
||||
//var monthlySalaryPayTest = totalHoursWorked * monthlySalaryDefined;
|
||||
////// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||
//monthlySalaryPayTest = monthlySalaryPayTest > monthlySalaryDefinedTest ? monthlySalaryDefinedTest : monthlySalaryPayTest;
|
||||
//////حقوق کسر شده
|
||||
//var deductionFromSalaryTest = monthlySalaryDefinedTest - monthlySalaryPayTest;
|
||||
|
||||
#endregion
|
||||
|
||||
var computeResult = new ComputeResultDto
|
||||
{
|
||||
MandatoryHours = mandatoryHours,
|
||||
MonthlySalaryPay = monthlySalaryPay,
|
||||
DeductionFromSalary = 0 /*deductionFromSalary*/,
|
||||
DeductionFromSalary = deductionFromSalary,
|
||||
RemainingHours = remainingTime
|
||||
};
|
||||
Console.WriteLine(mandatoryHours);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using DNTPersianUtils.Core;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PersianDateTime = PersianTools.Core.PersianDateTime;
|
||||
using PersianTools.Core;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
||||
|
||||
@@ -46,8 +45,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
||||
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
|
||||
|
||||
|
||||
//var lastMonthStart = lastMonth;
|
||||
var lastMonthEnd = ((selectedDate.ToFarsi().FindeEndOfMonth())).ToGeorgianDateTime();
|
||||
var lastMonthStart = lastMonth;
|
||||
var lastMonthEnd = lastMonth;
|
||||
|
||||
var query =
|
||||
await (from u in _context.Users
|
||||
@@ -61,8 +60,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
||||
// LEFT JOIN
|
||||
//فیش
|
||||
join ch in _context.Checkouts
|
||||
.Where(x => x.CheckoutStartDate < lastMonthEnd
|
||||
&& x.CheckoutEndDate > selectedDate)
|
||||
.Where(x => x.CheckoutStartDate < lastMonthStart
|
||||
&& x.CheckoutEndDate >= lastMonthStart)
|
||||
on u.Id equals ch.UserId into chJoin
|
||||
from ch in chJoin.DefaultIfEmpty()
|
||||
|
||||
|
||||
@@ -7,6 +7,5 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
|
||||
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
||||
{
|
||||
public long? UserId { get; set; }
|
||||
public string? SearchText { get; set; }
|
||||
public TaskSectionStatus? Status { get; set; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
||||
|
||||
@@ -23,8 +24,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
var currentUserId = _authHelper.GetCurrentUserId();
|
||||
|
||||
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
|
||||
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero
|
||||
&& x.Status != TaskSectionStatus.Completed)
|
||||
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero && x.Status != TaskSectionStatus.Completed)
|
||||
.Include(x => x.Task)
|
||||
.ThenInclude(x => x.Phase)
|
||||
.ThenInclude(x => x.Project)
|
||||
@@ -46,17 +46,9 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.SearchText))
|
||||
{
|
||||
queryable = queryable.Where(x=>x.Task.Name.Contains(request.SearchText)
|
||||
|| x.Task.Phase.Name.Contains(request.SearchText)
|
||||
|| x.Task.Phase.Project.Name.Contains(request.SearchText));
|
||||
}
|
||||
|
||||
var data = await queryable.ToListAsync(cancellationToken);
|
||||
|
||||
var activityUserIds = data.SelectMany(x => x.Activities)
|
||||
.Select(a => a.UserId).Distinct().ToList();
|
||||
var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList();
|
||||
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
|
||||
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
|
||||
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
|
||||
@@ -80,7 +72,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
{
|
||||
Activity = a,
|
||||
TimeSpent = timeSpent,
|
||||
timeSpent.TotalSeconds,
|
||||
TotalSeconds = timeSpent.TotalSeconds,
|
||||
FormattedTime = timeSpent.ToString(@"hh\:mm")
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
@@ -56,7 +56,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
|
||||
var skills = await _context.Skills
|
||||
.AsNoTracking()
|
||||
.OrderBy(x=>x.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var res = new ProjectSetTimeResponse(
|
||||
@@ -85,7 +84,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
UserId = section?.OriginalAssignedUserId ?? 0,
|
||||
SkillId = skill.Id,
|
||||
};
|
||||
}).ToList(),
|
||||
}).OrderBy(x => x.SkillId).ToList(),
|
||||
task.Id,
|
||||
level);
|
||||
|
||||
@@ -115,7 +114,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
|
||||
var skills = await _context.Skills
|
||||
.AsNoTracking()
|
||||
.OrderBy(x=>x.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var res = new ProjectSetTimeResponse(
|
||||
@@ -137,7 +135,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
UserId = section?.UserId ?? 0,
|
||||
SkillId = skill.Id,
|
||||
};
|
||||
}).ToList(),
|
||||
}).OrderBy(x => x.SkillId).ToList(),
|
||||
phase.Id,
|
||||
level);
|
||||
|
||||
@@ -167,7 +165,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
|
||||
var skills = await _context.Skills
|
||||
.AsNoTracking()
|
||||
.OrderBy(x=>x.CreationDate)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var res = new ProjectSetTimeResponse(
|
||||
@@ -189,7 +186,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
UserId = section?.UserId ?? 0,
|
||||
SkillId = skill.Id,
|
||||
};
|
||||
}).ToList(),
|
||||
}).OrderBy(x => x.SkillId).ToList(),
|
||||
project.Id,
|
||||
level);
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
||||
|
||||
public record GetMessagesQuery(
|
||||
Guid TaskId,
|
||||
MessageType? MessageType,
|
||||
int Page = 1,
|
||||
int PageSize = 50
|
||||
) : IBaseQuery<PaginationResult<MessageDto>>;
|
||||
@@ -69,12 +66,7 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
|
||||
var query = _context.TaskChatMessages
|
||||
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
|
||||
.Include(m => m.ReplyToMessage)
|
||||
.OrderBy(m => m.CreationDate).AsQueryable();
|
||||
|
||||
if (request.MessageType.HasValue)
|
||||
{
|
||||
query = query.Where(m => m.MessageType == request.MessageType.Value);
|
||||
}
|
||||
.OrderBy(m => m.CreationDate);
|
||||
|
||||
var totalCount = await query.CountAsync(cancellationToken);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
{
|
||||
PhaseId = phaseId;
|
||||
_sections = new List<TaskSection>();
|
||||
Priority = ProjectTaskPriority.Low;
|
||||
Priority = ProjectTaskPriority.Medium;
|
||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
||||
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
||||
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetPinnedMessages;
|
||||
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.SearchMessages;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
@@ -31,17 +30,15 @@ public class TaskChatController : ProgramManagerBaseController
|
||||
/// دریافت لیست پیامهای یک تسک
|
||||
/// </summary>
|
||||
/// <param name="taskId">شناسه تسک</param>
|
||||
/// <param name="messageType">نوع پیام</param>
|
||||
/// <param name="page">صفحه (پیشفرض: 1)</param>
|
||||
/// <param name="pageSize">تعداد در هر صفحه (پیشفرض: 50)</param>
|
||||
[HttpGet("{taskId:guid}/messages")]
|
||||
public async Task<ActionResult<OperationResult<PaginationResult<MessageDto>>>> GetMessages(
|
||||
Guid taskId,
|
||||
[FromQuery] MessageType? messageType,
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 50)
|
||||
{
|
||||
var query = new GetMessagesQuery(taskId,messageType, page, pageSize);
|
||||
var query = new GetMessagesQuery(taskId, page, pageSize);
|
||||
var result = await _mediator.Send(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class SmsReportController : AdminBaseController
|
||||
{
|
||||
private readonly ISmsResultApplication _smsResultApplication;
|
||||
private readonly ISmsService _smsService;
|
||||
|
||||
public SmsReportController(ISmsResultApplication smsResultApplication, ISmsService smsService)
|
||||
{
|
||||
_smsResultApplication = smsResultApplication;
|
||||
_smsService = smsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک ها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||||
{
|
||||
|
||||
var result =await _smsResultApplication.GetSmsReportList(searchModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات هر تاریخ برای اکسپند
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetExpandedList")]
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
{
|
||||
var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// گزارش ای پی آی
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetApiReport")]
|
||||
public async Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate)
|
||||
{
|
||||
var result =await _smsService.GetApiReport(startDate, endDate);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@
|
||||
تمدید قرارداد
|
||||
</p>
|
||||
</a>
|
||||
<a class="btn btn-inverse pull-left rad" style="background-color: #f57373;border: 1px solid #f57373;margin-left:5px;"
|
||||
<a permission="30715" class="btn btn-inverse pull-left rad" style="background-color: #f57373;border: 1px solid #f57373;margin-left:5px;"
|
||||
asp-page="./FinancialStatments" asp-route-name="@item.ContractingPartyName" asp-route-id="@item.ContractingPartyId" asp-route-pageNumber="0">
|
||||
<i class="fa fa-file-text-o faSize"></i>
|
||||
<p>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class CheckoutController:ClientBaseController
|
||||
{
|
||||
private readonly ICheckoutApplication _checkoutApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public CheckoutController(ICheckoutApplication checkoutApplication,IAuthHelper authHelper)
|
||||
{
|
||||
_checkoutApplication = checkoutApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<PagedResult<CheckoutListClientDto>>> GetList(CheckoutListClientSearchModel searchModel)
|
||||
{
|
||||
var res =await _checkoutApplication.GetListForClient(_workshopId, searchModel);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
59
ServiceHost/Areas/Client/Controllers/LoanController.cs
Normal file
59
ServiceHost/Areas/Client/Controllers/LoanController.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class LoanController: ClientBaseController
|
||||
{
|
||||
private readonly ILoanApplication _loanApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public LoanController(ILoanApplication loanApplication, IAuthHelper authHelper)
|
||||
{
|
||||
_loanApplication = loanApplication;
|
||||
_workshopId= authHelper.GetWorkshopId();
|
||||
}
|
||||
[HttpGet]
|
||||
public ActionResult<LoanGroupedViewModel> GetList(LoanSearchViewModel searchModel)
|
||||
{
|
||||
searchModel.WorkshopId = _workshopId;
|
||||
var loans = _loanApplication.GetSearchListAsGrouped(searchModel);
|
||||
return loans;
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<LoanDetailsViewModel>> GetDetails(long id)
|
||||
{
|
||||
var loan = await _loanApplication.GetDetails(id);
|
||||
return loan;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<OperationResult> Create([FromBody] CreateLoanViewModel command)
|
||||
{
|
||||
var result = _loanApplication.Create(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet("create/installments")]
|
||||
public ActionResult<List<LoanInstallmentViewModel>> CalculateLoanInstallment(string amount,
|
||||
int installmentCount, string loanStartDate, bool getRounded)
|
||||
{
|
||||
var installments =
|
||||
_loanApplication.CalculateLoanInstallment(amount, installmentCount, loanStartDate, getRounded);
|
||||
return installments;
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public ActionResult<OperationResult> Remove(long id)
|
||||
{
|
||||
var result = _loanApplication.Remove(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user