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
|
public enum TypeOfSmsSetting
|
||||||
{
|
{
|
||||||
//همه انواع پیامک
|
|
||||||
All = 0,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// پیامک
|
/// پیامک
|
||||||
@@ -25,7 +23,7 @@ public enum TypeOfSmsSetting
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// پیامک
|
/// پیامک
|
||||||
/// هشدار بدهی
|
/// هشدار اول
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Warning,
|
Warning,
|
||||||
|
|
||||||
@@ -40,14 +38,4 @@ public enum TypeOfSmsSetting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
InstitutionContractConfirm,
|
InstitutionContractConfirm,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال کد تاییدیه قرارداد مالی
|
|
||||||
/// </summary>
|
|
||||||
SendInstitutionContractConfirmationCode,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// یادآور وظایف
|
|
||||||
/// </summary>
|
|
||||||
TaskReminder,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,17 +18,3 @@ public class ApiResultViewModel
|
|||||||
public string DeliveryColor { get; set; }
|
public string DeliveryColor { get; set; }
|
||||||
public string FullName { 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);
|
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||||
|
|
||||||
#region ForApi
|
|
||||||
|
|
||||||
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
string DeliveryStatus(byte? dv);
|
string DeliveryStatus(byte? dv);
|
||||||
string DeliveryColorStatus(byte? dv);
|
string DeliveryColorStatus(byte? dv);
|
||||||
string UnixTimeStampToDateTime(int? unixTimeStamp);
|
string UnixTimeStampToDateTime(int? unixTimeStamp);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using _0_Framework.Application.Enums;
|
|
||||||
using _0_Framework.Application.Sms;
|
using _0_Framework.Application.Sms;
|
||||||
using Company.Domain.ContarctingPartyAgg;
|
using Company.Domain.ContarctingPartyAgg;
|
||||||
using Company.Domain.InstitutionContractAgg;
|
using Company.Domain.InstitutionContractAgg;
|
||||||
@@ -13,21 +12,19 @@ public class JobSchedulerRegistrator
|
|||||||
private readonly IBackgroundJobClient _backgroundJobClient;
|
private readonly IBackgroundJobClient _backgroundJobClient;
|
||||||
private readonly SmsReminder _smsReminder;
|
private readonly SmsReminder _smsReminder;
|
||||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
|
||||||
private static DateTime? _lastRunCreateTransaction;
|
private static DateTime? _lastRunCreateTransaction;
|
||||||
private static DateTime? _lastRunSendMonthlySms;
|
private static DateTime? _lastRunSendMonthlySms;
|
||||||
private readonly ISmsService _smsService;
|
private readonly ISmsService _smsService;
|
||||||
private readonly ILogger<JobSchedulerRegistrator> _logger;
|
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;
|
_smsReminder = smsReminder;
|
||||||
_backgroundJobClient = backgroundJobClient;
|
_backgroundJobClient = backgroundJobClient;
|
||||||
_institutionContractRepository = institutionContractRepository;
|
_institutionContractRepository = institutionContractRepository;
|
||||||
_smsService = smsService;
|
_smsService = smsService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Register()
|
public void Register()
|
||||||
@@ -61,43 +58,17 @@ public class JobSchedulerRegistrator
|
|||||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||||
);
|
);
|
||||||
|
|
||||||
RecurringJob.AddOrUpdate(
|
//RecurringJob.AddOrUpdate(
|
||||||
"InstitutionContract.SendWarningSms",
|
// "InstitutionContract.SendWarningSms",
|
||||||
() => SendWarningSms(),
|
// () => SendWarningSms(),
|
||||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||||
);
|
//);
|
||||||
|
|
||||||
RecurringJob.AddOrUpdate(
|
//RecurringJob.AddOrUpdate(
|
||||||
"InstitutionContract.SendLegalActionSms",
|
// "InstitutionContract.SendLegalActionSms",
|
||||||
() => SendLegalActionSms(),
|
// () => SendLegalActionSms(),
|
||||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
// "*/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 * * * *"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,7 +134,7 @@ public class JobSchedulerRegistrator
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _institutionContractSmsServiceRepository.SendMonthlySms(now);
|
await _institutionContractRepository.SendMonthlySms(now);
|
||||||
_lastRunSendMonthlySms = now;
|
_lastRunSendMonthlySms = now;
|
||||||
Console.WriteLine("Send Monthly sms executed");
|
Console.WriteLine("Send Monthly sms executed");
|
||||||
|
|
||||||
@@ -185,7 +156,7 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendReminderSms()
|
public async System.Threading.Tasks.Task SendReminderSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendReminderSms job run");
|
_logger.LogInformation("SendReminderSms job run");
|
||||||
await _institutionContractSmsServiceRepository.SendReminderSmsForBackgroundTask();
|
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -196,7 +167,7 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendBlockSms()
|
public async System.Threading.Tasks.Task SendBlockSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendBlockSms job run");
|
_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()
|
public async System.Threading.Tasks.Task SendInstitutionContractConfirmSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
|
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
|
||||||
await _institutionContractSmsServiceRepository.SendInstitutionContractConfirmSmsTask();
|
await _institutionContractRepository.SendInstitutionContractConfirmSmsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -219,86 +190,14 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendWarningSms()
|
public async System.Threading.Tasks.Task SendWarningSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendWarningSms job run");
|
_logger.LogInformation("SendWarningSms job run");
|
||||||
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.Warning);
|
await _institutionContractRepository.SendWarningSmsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// پیامک اقدام قضایی
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||||
public async System.Threading.Tasks.Task SendLegalActionSms()
|
public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendWarningSms job run");
|
_logger.LogInformation("SendWarningSms job run");
|
||||||
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
|
await _institutionContractRepository.SendLegalActionSmsTask();
|
||||||
}
|
|
||||||
|
|
||||||
/// <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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -80,6 +80,4 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Task<Checkout> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate);
|
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);
|
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
|
#region CreateMontlyTransaction
|
||||||
|
|
||||||
@@ -104,12 +162,24 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
|||||||
|
|
||||||
#endregion
|
#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<long> GetIdByInstallmentId(long installmentId);
|
||||||
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);
|
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;
|
|
||||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using _0_Framework.Domain;
|
||||||
|
|
||||||
namespace Company.Domain.SmsResultAgg;
|
namespace Company.Domain.SmsResultAgg;
|
||||||
|
|
||||||
public interface ISmsResultRepository : IRepository<long, SmsResult>
|
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);
|
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||||
}
|
}
|
||||||
@@ -62,40 +62,4 @@ public interface ICheckoutApplication
|
|||||||
long workshopId, DateTime start, DateTime end);
|
long workshopId, DateTime start, DateTime end);
|
||||||
|
|
||||||
#endregion
|
#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<LoanGroupedByDateViewModel> GroupedByDate { get; set; }
|
||||||
public List<LoanGroupedByEmployeeViewModel>GroupedByEmployee { 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 string EndDate { get; set; }
|
||||||
|
|
||||||
public int PageIndex { get; set; }
|
public int PageIndex { get; set; }
|
||||||
|
public int PageSize { get; set; } = 30;
|
||||||
public bool ShowAsGrouped { get; set; }
|
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 System;
|
||||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application;
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.SmsResult;
|
namespace CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
|
||||||
public interface ISmsResultApplication
|
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);
|
OperationResult Create(CreateSmsResult command);
|
||||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||||
}
|
}
|
||||||
@@ -706,10 +706,5 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
|
return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,CheckoutListClientSearchModel searchModel)
|
|
||||||
{
|
|
||||||
return await _checkoutRepository.GetListForClient(workshopId, searchModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
using CompanyManagment.App.Contracts.SmsResult;
|
||||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
|
||||||
|
|
||||||
namespace CompanyManagment.Application;
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
@@ -17,23 +15,6 @@ public class SmsResultApplication : ISmsResultApplication
|
|||||||
_smsResultRepository = smsResultRepository;
|
_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)
|
public OperationResult Create(CreateSmsResult command)
|
||||||
{
|
{
|
||||||
var op = new OperationResult();
|
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 _0_Framework.Application.Enums;
|
||||||
using Company.Domain.InstitutionContractAgg;
|
using Company.Domain.InstitutionContractAgg;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
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;
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
@@ -16,13 +15,11 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
{
|
{
|
||||||
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
||||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
|
||||||
|
|
||||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
|
||||||
{
|
{
|
||||||
_smsSettingsRepository = smsSettingsRepository;
|
_smsSettingsRepository = smsSettingsRepository;
|
||||||
_institutionContractRepository = institutionContractRepository;
|
_institutionContractRepository = institutionContractRepository;
|
||||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -119,12 +116,12 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
|
|
||||||
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
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)
|
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())
|
if (command.Any())
|
||||||
{
|
{
|
||||||
await _institutionContractSmsServiceRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -156,7 +153,7 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
string sendMessEnd = "پایان مسدودی آنی ";
|
string sendMessEnd = "پایان مسدودی آنی ";
|
||||||
if (command.Any())
|
if (command.Any())
|
||||||
{
|
{
|
||||||
await _institutionContractSmsServiceRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
||||||
sendMessEnd);
|
sendMessEnd);
|
||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System.Linq;
|
|||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using _0_Framework.Exceptions;
|
|
||||||
using _0_Framework.InfraStructure;
|
using _0_Framework.InfraStructure;
|
||||||
using Company.Domain.CheckoutAgg;
|
using Company.Domain.CheckoutAgg;
|
||||||
using Company.Domain.LeftWorkAgg;
|
using Company.Domain.LeftWorkAgg;
|
||||||
@@ -51,11 +50,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
|
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
|
||||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||||
|
|
||||||
public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration,
|
public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration, ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication, IRollCallRepository rollCallRepository, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallEmployeeRepository rollCallEmployeeRepository) : base(context)
|
||||||
ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication,
|
|
||||||
IRollCallRepository rollCallRepository, IRollCallMandatoryRepository rollCallMandatoryRepository,
|
|
||||||
IRollCallEmployeeRepository rollCallEmployeeRepository) : base(context)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
_authHelper = authHelper;
|
_authHelper = authHelper;
|
||||||
_context = context;
|
_context = context;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@@ -74,8 +71,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
/// <param name="سال به صورت رشته عددی"></param>
|
/// <param name="سال به صورت رشته عددی"></param>
|
||||||
/// <param name="ماه بصورت رشته عددی"></param>
|
/// <param name="ماه بصورت رشته عددی"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double
|
public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month)
|
||||||
Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month)
|
|
||||||
{
|
{
|
||||||
var farisMonthName = Tools.ToFarsiMonthByNumber(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,
|
return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,res.YearsPay);
|
||||||
res.YearsPay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditCheckout GetDetails(long id)
|
public EditCheckout GetDetails(long id)
|
||||||
@@ -141,6 +136,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ContractEndGr = x.ContractEnd,
|
ContractEndGr = x.ContractEnd,
|
||||||
ContractStart = x.ContractStart.ToFarsi(),
|
ContractStart = x.ContractStart.ToFarsi(),
|
||||||
ContractEnd = x.ContractEnd.ToFarsi()
|
ContractEnd = x.ContractEnd.ToFarsi()
|
||||||
|
|
||||||
})
|
})
|
||||||
.FirstOrDefault(x => x.Id == id);
|
.FirstOrDefault(x => x.Id == id);
|
||||||
}
|
}
|
||||||
@@ -156,8 +152,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
/// <param name="contractEnd"></param>
|
/// <param name="contractEnd"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public async Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId,
|
public async Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId, string year, string month, string contractStart,
|
||||||
string year, string month, string contractStart,
|
|
||||||
string contractEnd)
|
string contractEnd)
|
||||||
{
|
{
|
||||||
DateTime startSreach;
|
DateTime startSreach;
|
||||||
@@ -170,6 +165,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (month == "0" && year == "0")
|
if (month == "0" && year == "0")
|
||||||
{
|
{
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
@@ -199,8 +195,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
startSreach = startStr.ToGeorgianDateTime();
|
startSreach = startStr.ToGeorgianDateTime();
|
||||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
var timer = new Stopwatch();
|
var timer = new Stopwatch();
|
||||||
timer.Start();
|
timer.Start();
|
||||||
|
|
||||||
@@ -215,9 +211,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
contractWorkshop => contractWorkshop.contract.EmployeeId,
|
contractWorkshop => contractWorkshop.contract.EmployeeId,
|
||||||
employee => employee.id,
|
employee => employee.id,
|
||||||
(contractWorkshop, employee) => new { contractWorkshop, employee })
|
(contractWorkshop, employee) => new { contractWorkshop, employee })
|
||||||
.Join(
|
.Join(_context.LeftWorkList.AsSplitQuery().Where(l => l.WorkshopId == workshopId && l.StartWorkDate < endSearch && l.LeftWorkDate > startSreach),
|
||||||
_context.LeftWorkList.AsSplitQuery().Where(l =>
|
|
||||||
l.WorkshopId == workshopId && l.StartWorkDate < endSearch && l.LeftWorkDate > startSreach),
|
|
||||||
contractWorkshopEmployee => contractWorkshopEmployee.contractWorkshop.contract.EmployeeId,
|
contractWorkshopEmployee => contractWorkshopEmployee.contractWorkshop.contract.EmployeeId,
|
||||||
leftwork => leftwork.EmployeeId,
|
leftwork => leftwork.EmployeeId,
|
||||||
(contractWorkshopEmployee, leftwork) => new { contractWorkshopEmployee, leftwork })
|
(contractWorkshopEmployee, leftwork) => new { contractWorkshopEmployee, leftwork })
|
||||||
@@ -227,15 +221,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
personnelCode => personnelCode.EmployeeId,
|
personnelCode => personnelCode.EmployeeId,
|
||||||
(contractWorkshopEmployeeleftWork, personnelCode) =>
|
(contractWorkshopEmployeeleftWork, personnelCode) =>
|
||||||
new { contractWorkshopEmployeeleftWork, personnelCode })
|
new { contractWorkshopEmployeeleftWork, personnelCode })
|
||||||
|
|
||||||
.GroupJoin(_context.CheckoutSet.AsSplitQuery(),
|
.GroupJoin(_context.CheckoutSet.AsSplitQuery(),
|
||||||
contractWorkshopEmployeeleftWorkPersonnelCode => contractWorkshopEmployeeleftWorkPersonnelCode
|
contractWorkshopEmployeeleftWorkPersonnelCode => contractWorkshopEmployeeleftWorkPersonnelCode
|
||||||
.contractWorkshopEmployeeleftWork.contractWorkshopEmployee.contractWorkshop.contract.id,
|
.contractWorkshopEmployeeleftWork.contractWorkshopEmployee.contractWorkshop.contract.id,
|
||||||
checkout => checkout.ContractId,
|
checkout => checkout.ContractId,
|
||||||
(contractWorkshopEmployeeleftWorkPersonnelCode, checkout) =>
|
(contractWorkshopEmployeeleftWorkPersonnelCode, checkout) =>
|
||||||
new { contractWorkshopEmployeeleftWorkPersonnelCode, checkout })
|
new { contractWorkshopEmployeeleftWorkPersonnelCode, checkout })
|
||||||
|
|
||||||
.GroupJoin(_context.EmployeeComputeOptionsSet.Where(o => o.WorkshopId == workshopId),
|
.GroupJoin(_context.EmployeeComputeOptionsSet.Where(o => o.WorkshopId == workshopId),
|
||||||
x => x.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.leftwork
|
x => x.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.leftwork.EmployeeId,
|
||||||
.EmployeeId,
|
|
||||||
option => option.EmployeeId,
|
option => option.EmployeeId,
|
||||||
(x, options) => new { x.checkout, x.contractWorkshopEmployeeleftWorkPersonnelCode, options })
|
(x, options) => new { x.checkout, x.contractWorkshopEmployeeleftWorkPersonnelCode, options })
|
||||||
.SelectMany(
|
.SelectMany(
|
||||||
@@ -255,11 +250,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
DateTime currentStart = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
|
DateTime currentStart = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime();
|
||||||
DateTime currentEnd = ($"{DateTime.Now.ToFarsi().FindeEndOfMonth()}").ToGeorgianDateTime();
|
DateTime currentEnd = ($"{DateTime.Now.ToFarsi().FindeEndOfMonth()}").ToGeorgianDateTime();
|
||||||
|
|
||||||
var chekoutCreated = result.checkout.FirstOrDefault(x =>
|
var chekoutCreated = result.checkout.FirstOrDefault(x => x.ContractStart < endSearch && x.ContractEnd > startSreach && x.IsActiveString == "true");
|
||||||
x.ContractStart < endSearch && x.ContractEnd > startSreach && x.IsActiveString == "true");
|
|
||||||
|
|
||||||
if (chekoutCreated != null)
|
if (chekoutCreated != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
return new CreateCheckoutListViewModel
|
return new CreateCheckoutListViewModel
|
||||||
{
|
{
|
||||||
Id = chekoutCreated.ContractId,
|
Id = chekoutCreated.ContractId,
|
||||||
@@ -278,7 +273,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
EmployeeHasCreateCheckout = true
|
EmployeeHasCreateCheckout = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var employeeJoin = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
var employeeJoin = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||||
.contractWorkshopEmployee.employee.id;
|
.contractWorkshopEmployee.employee.id;
|
||||||
|
|
||||||
@@ -289,13 +283,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
var startStatusSearch = leftWork.StartWorkDate > startSreach && leftWork.StartWorkDate <= endSearch
|
var startStatusSearch = leftWork.StartWorkDate > startSreach && leftWork.StartWorkDate <= endSearch
|
||||||
? leftWork.StartWorkDate
|
? leftWork.StartWorkDate
|
||||||
: startSreach;
|
: startSreach;
|
||||||
var endStatusSearch = leftWork.HasLeft && leftWork.LeftWorkDate > startSreach &&
|
var endStatusSearch = leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch
|
||||||
leftWork.LeftWorkDate <= endSearch
|
|
||||||
? leftWork.LeftWorkDate.AddDays(-1)
|
? leftWork.LeftWorkDate.AddDays(-1)
|
||||||
: startSreach;
|
: startSreach;
|
||||||
bool hasRollCall =
|
bool hasRollCall =
|
||||||
_rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startStatusSearch,
|
_rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startStatusSearch, endStatusSearch);
|
||||||
endStatusSearch);
|
|
||||||
|
|
||||||
bool extension = true;
|
bool extension = true;
|
||||||
bool laterThanEnd = false;
|
bool laterThanEnd = false;
|
||||||
@@ -308,11 +300,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
.contractWorkshopEmployee.contractWorkshop.contract.ContarctStart;
|
.contractWorkshopEmployee.contractWorkshop.contract.ContarctStart;
|
||||||
var contractEndGr = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
var contractEndGr = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||||
.contractWorkshopEmployee.contractWorkshop.contract.ContractEnd;
|
.contractWorkshopEmployee.contractWorkshop.contract.ContractEnd;
|
||||||
|
|
||||||
#region HasRollCall
|
#region HasRollCall
|
||||||
|
|
||||||
if (hasRollCall)
|
if (hasRollCall)
|
||||||
{
|
{
|
||||||
|
|
||||||
// اگر ترک کار کرده بود
|
// اگر ترک کار کرده بود
|
||||||
// اگر ترک کارش در بازه انتخاب شده بود
|
// اگر ترک کارش در بازه انتخاب شده بود
|
||||||
if (leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch)
|
if (leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch)
|
||||||
@@ -330,6 +322,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
? leftWork.StartWorkDate.ToFarsi()
|
? leftWork.StartWorkDate.ToFarsi()
|
||||||
: startSreach.ToFarsi();
|
: startSreach.ToFarsi();
|
||||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -341,6 +334,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
? leftWork.StartWorkDate.ToFarsi()
|
? leftWork.StartWorkDate.ToFarsi()
|
||||||
: startSreach.ToFarsi();
|
: startSreach.ToFarsi();
|
||||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (endSearch < currentStart)
|
else if (endSearch < currentStart)
|
||||||
@@ -363,6 +357,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
: startSreach.ToFarsi();
|
: startSreach.ToFarsi();
|
||||||
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
contractEnd = leftWork.LeftWorkDate.AddDays(-1).ToFarsi();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (leftWork.HasLeft && leftWork.LeftWorkDate <= startSreach)
|
else if (leftWork.HasLeft && leftWork.LeftWorkDate <= startSreach)
|
||||||
{
|
{
|
||||||
@@ -370,6 +365,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
extension = false;
|
extension = false;
|
||||||
description = "به دلیل ترک کار پیش از تاریخ انتخاب شده مجاز به ایجاد فیش نمی باشید";
|
description = "به دلیل ترک کار پیش از تاریخ انتخاب شده مجاز به ایجاد فیش نمی باشید";
|
||||||
leftWorkDate = leftWork.LeftWorkDate.ToFarsi();
|
leftWorkDate = leftWork.LeftWorkDate.ToFarsi();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!leftWork.HasLeft && startSreach == currentStart)
|
else if (!leftWork.HasLeft && startSreach == currentStart)
|
||||||
{
|
{
|
||||||
@@ -380,9 +376,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
? leftWork.StartWorkDate.ToFarsi()
|
? leftWork.StartWorkDate.ToFarsi()
|
||||||
: startSreach.ToFarsi();
|
: startSreach.ToFarsi();
|
||||||
contractEnd = endSearch.ToFarsi();
|
contractEnd = endSearch.ToFarsi();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!leftWork.HasLeft && startSreach < currentStart)
|
else if (!leftWork.HasLeft && startSreach < currentStart)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (contractStartGr <= startSreach && contractStartGr > endSearch)
|
if (contractStartGr <= startSreach && contractStartGr > endSearch)
|
||||||
{
|
{
|
||||||
laterThanEnd = true;
|
laterThanEnd = true;
|
||||||
@@ -397,11 +397,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
contractStart = leftWork.StartWorkDate > startSreach
|
contractStart = leftWork.StartWorkDate > startSreach
|
||||||
? leftWork.StartWorkDate.ToFarsi()
|
? leftWork.StartWorkDate.ToFarsi()
|
||||||
: startSreach.ToFarsi();
|
: startSreach.ToFarsi();
|
||||||
contractEnd = (leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch)
|
contractEnd = (leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch) ? leftWork.LeftWorkDate.AddDays(-1).ToFarsi() : endSearch.ToFarsi();
|
||||||
? leftWork.LeftWorkDate.AddDays(-1).ToFarsi()
|
|
||||||
: endSearch.ToFarsi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -467,11 +468,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
contractEnd = endSearch.ToFarsi();
|
contractEnd = endSearch.ToFarsi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new CreateCheckoutListViewModel
|
return new CreateCheckoutListViewModel
|
||||||
{
|
{
|
||||||
Id = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
Id = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
||||||
@@ -495,14 +498,15 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ContractStart = contractStart,
|
ContractStart = contractStart,
|
||||||
ContractEnd = contractEnd,
|
ContractEnd = contractEnd,
|
||||||
LeftWorkDate = leftWorkDate,
|
LeftWorkDate = leftWorkDate,
|
||||||
EmployeeHasCreateCheckout = result.option != null
|
EmployeeHasCreateCheckout = result.option != null ? result.option.CreateCheckout : result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork.contractWorkshopEmployee.contractWorkshop.workshop.CreateCheckout
|
||||||
? result.option.CreateCheckout
|
|
||||||
: result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork
|
|
||||||
.contractWorkshopEmployee.contractWorkshop.workshop.CreateCheckout
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}).Where(x => x.EmployeeHasCreateCheckout).OrderByDescending(x => x.Extension).ToList();
|
}).Where(x => x.EmployeeHasCreateCheckout).OrderByDescending(x => x.Extension).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("process : " + timer.Elapsed);
|
Console.WriteLine("process : " + timer.Elapsed);
|
||||||
|
|
||||||
return new CreateCheckoutListViewModel()
|
return new CreateCheckoutListViewModel()
|
||||||
@@ -513,6 +517,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
|
|
||||||
public async Task CreateCkeckout(Checkout command)
|
public async Task CreateCkeckout(Checkout command)
|
||||||
{
|
{
|
||||||
|
|
||||||
var creationDates = DateTime.Now;
|
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}");
|
//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)
|
if(command.HasInsuranceShareTheSameAsList)
|
||||||
entity.SetInsuranceShare();
|
entity.SetInsuranceShare();
|
||||||
await _context.SaveChangesAsync();
|
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();
|
query = query.Where(x => x.ContractStartGr >= startyearGr && x.ContractEndGr <= endYearGr).ToList();
|
||||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
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.ContractEndGr).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
@@ -790,6 +799,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
endDate >= x.ContractEndGr && startDate < x.ContractEndGr).ToList();
|
endDate >= x.ContractEndGr && startDate < x.ContractEndGr).ToList();
|
||||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
return query.OrderBy(x => x.PersonnelCodeInt).ToList();
|
return query.OrderBy(x => x.PersonnelCodeInt).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
!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)
|
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.ContractEndGr).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return query.OrderByDescending(x => x.Id)
|
return query.OrderByDescending(x => x.Id)
|
||||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(100).ToList();
|
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(100).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//foreach(var items in query)
|
//foreach(var items in query)
|
||||||
//{
|
//{
|
||||||
// var employeId = _context.WorkshopEmployers?.Where(x => x.WorkshopId == items.WorkshopId)
|
// var employeId = _context.WorkshopEmployers?.Where(x => x.WorkshopId == items.WorkshopId)
|
||||||
@@ -850,6 +865,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ContractNo = x.ContractNo,
|
ContractNo = x.ContractNo,
|
||||||
ContractId = x.ContractId,
|
ContractId = x.ContractId,
|
||||||
HasRollCall = x.HasRollCall
|
HasRollCall = x.HasRollCall
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId != 0)
|
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId != 0)
|
||||||
@@ -868,12 +884,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
var start = searchModel.ContractStart.ToGeorgianDateTime();
|
var start = searchModel.ContractStart.ToGeorgianDateTime();
|
||||||
var end = searchModel.ContractEnd.ToGeorgianDateTime();
|
var end = searchModel.ContractEnd.ToGeorgianDateTime();
|
||||||
query = query.Where(x =>
|
query = query.Where(x => x.ContractStartGr == start && x.ContractEndGr == end && x.EmployeeId == searchModel.EmployeeId && x.WorkshopId == searchModel.WorkshopId);
|
||||||
x.ContractStartGr == start && x.ContractEndGr == end && x.EmployeeId == searchModel.EmployeeId &&
|
|
||||||
x.WorkshopId == searchModel.WorkshopId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return query.OrderBy(x => x.ContractStartGr).ToList();
|
return query.OrderBy(x => x.ContractStartGr).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CheckoutViewModel> PrintAll(List<long> id)
|
public List<CheckoutViewModel> PrintAll(List<long> id)
|
||||||
@@ -954,8 +969,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
CheckoutRollCall = item.CheckoutRollCall != null
|
CheckoutRollCall = item.CheckoutRollCall != null ? new CheckoutRollCallViewModel()
|
||||||
? new CheckoutRollCallViewModel()
|
|
||||||
{
|
{
|
||||||
TotalPresentTimeSpan = item.CheckoutRollCall.TotalPresentTimeSpan,
|
TotalPresentTimeSpan = item.CheckoutRollCall.TotalPresentTimeSpan,
|
||||||
TotalBreakTimeSpan = item.CheckoutRollCall.TotalBreakTimeSpan,
|
TotalBreakTimeSpan = item.CheckoutRollCall.TotalBreakTimeSpan,
|
||||||
@@ -963,8 +977,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
TotalPaidLeaveTmeSpan = item.CheckoutRollCall.TotalPaidLeaveTmeSpan,
|
TotalPaidLeaveTmeSpan = item.CheckoutRollCall.TotalPaidLeaveTmeSpan,
|
||||||
TotalMandatoryTimeSpan = item.CheckoutRollCall.TotalMandatoryTimeSpan,
|
TotalMandatoryTimeSpan = item.CheckoutRollCall.TotalMandatoryTimeSpan,
|
||||||
TotalSickLeaveTimeSpan = item.CheckoutRollCall.TotalSickLeaveTimeSpan,
|
TotalSickLeaveTimeSpan = item.CheckoutRollCall.TotalSickLeaveTimeSpan,
|
||||||
RollCallDaysCollection = item.CheckoutRollCall.RollCallDaysCollection.Select(d =>
|
RollCallDaysCollection = item.CheckoutRollCall.RollCallDaysCollection.Select(d => new CheckoutRollCallDayViewModel()
|
||||||
new CheckoutRollCallDayViewModel()
|
|
||||||
{
|
{
|
||||||
WorkingTimeSpan = d.WorkingTimeSpan,
|
WorkingTimeSpan = d.WorkingTimeSpan,
|
||||||
BreakTimeSpan = d.BreakTimeSpan,
|
BreakTimeSpan = d.BreakTimeSpan,
|
||||||
@@ -981,12 +994,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
SecondEndDate = d.SecondEndDate,
|
SecondEndDate = d.SecondEndDate,
|
||||||
SecondStartDate = d.SecondStartDate,
|
SecondStartDate = d.SecondStartDate,
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
}
|
|
||||||
: null,
|
} : null,
|
||||||
HasAmountConflict =item.HasAmountConflict,
|
HasAmountConflict =item.HasAmountConflict,
|
||||||
EmployeeMandatoryHoursTimeSpan = item.EmployeeMandatoryHours,
|
EmployeeMandatoryHoursTimeSpan = item.EmployeeMandatoryHours,
|
||||||
EmployeeMandatoryHoursStr = Tools.ToFarsiHoursAndMinutes(
|
EmployeeMandatoryHoursStr = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(item.EmployeeMandatoryHours.TotalHours),item.EmployeeMandatoryHours.Minutes,"-")
|
||||||
Convert.ToInt32(item.EmployeeMandatoryHours.TotalHours), item.EmployeeMandatoryHours.Minutes, "-")
|
|
||||||
};
|
};
|
||||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||||
ch.WorkshopName = workshopName.WorkshopName;
|
ch.WorkshopName = workshopName.WorkshopName;
|
||||||
@@ -1110,8 +1122,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
|
|
||||||
var totalPaidLeaveTimeSpans = hourlyPaidLeaveTimeSpans.Concat(dailyPaidLeaveTimeSpans);
|
var totalPaidLeaveTimeSpans = hourlyPaidLeaveTimeSpans.Concat(dailyPaidLeaveTimeSpans);
|
||||||
ch.TotalHourlyLeave = new TimeSpan(hourlyPaidLeaveTimeSpans.Sum(x => x.Ticks));
|
ch.TotalHourlyLeave = new TimeSpan(hourlyPaidLeaveTimeSpans.Sum(x => x.Ticks));
|
||||||
ch.TotalPaidLeave =
|
ch.TotalPaidLeave = new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||||
new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1129,9 +1142,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ch.TotalBreakTimeStr = ch.CheckoutRollCall.TotalBreakTimeSpan.ToFarsiHoursAndMinutes("-");
|
ch.TotalBreakTimeStr = ch.CheckoutRollCall.TotalBreakTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||||
ch.TotalPresentTimeStr = ch.CheckoutRollCall.TotalPresentTimeSpan.ToFarsiHoursAndMinutes("-");
|
ch.TotalPresentTimeStr = ch.CheckoutRollCall.TotalPresentTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||||
ch.TotalMandatoryTimeStr = ch.CheckoutRollCall.TotalMandatoryTimeSpan.ToFarsiHoursAndMinutes("-");
|
ch.TotalMandatoryTimeStr = ch.CheckoutRollCall.TotalMandatoryTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||||
ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(
|
ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours), ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-");
|
||||||
Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours),
|
|
||||||
ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-");
|
|
||||||
ch.MonthlyRollCall = ch.CheckoutRollCall.RollCallDaysCollection
|
ch.MonthlyRollCall = ch.CheckoutRollCall.RollCallDaysCollection
|
||||||
.Select(x => new CheckoutDailyRollCallViewModel
|
.Select(x => new CheckoutDailyRollCallViewModel
|
||||||
{
|
{
|
||||||
@@ -1152,12 +1163,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
BreakTimeString = $"{(int)(x.BreakTimeSpan.TotalHours)}:{x.BreakTimeSpan.Minutes:00}",
|
BreakTimeString = $"{(int)(x.BreakTimeSpan.TotalHours)}:{x.BreakTimeSpan.Minutes:00}",
|
||||||
RollCallDateFa = x.Date.ToFarsi()
|
RollCallDateFa = x.Date.ToFarsi()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ch.HasRollCall)
|
if (ch.HasRollCall)
|
||||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId,
|
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||||
ch.ContractStartGr, ch.ContractEndGr);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
||||||
@@ -1166,11 +1178,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
||||||
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
||||||
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
||||||
ch.MonthlyRollCall =
|
ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||||
ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query.Add(ch);
|
query.Add(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,7 +1191,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
printNumer += 1;
|
printNumer += 1;
|
||||||
rec.PrintCounter = printNumer;
|
rec.PrintCounter = printNumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1207,6 +1216,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
Id = x.id,
|
Id = x.id,
|
||||||
EmployerFullName = x.FName + " " + x.LName,
|
EmployerFullName = x.FName + " " + x.LName,
|
||||||
IsLegal = x.IsLegal,
|
IsLegal = x.IsLegal,
|
||||||
|
|
||||||
}).Where(x => emp.Contains(x.Id)).ToList();
|
}).Where(x => emp.Contains(x.Id)).ToList();
|
||||||
if (employerlist.Count > 0)
|
if (employerlist.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -1235,8 +1245,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
var leaveList = _context.LeaveList.Where(x =>
|
var leaveList = _context.LeaveList.Where(x => x.WorkshopId == ch.WorkshopId && x.EmployeeId == ch.EmployeeId && x.LeaveType == "استحقاقی");
|
||||||
x.WorkshopId == ch.WorkshopId && x.EmployeeId == ch.EmployeeId && x.LeaveType == "استحقاقی");
|
|
||||||
var leaveViewModel = new List<LeaveViewModel>();
|
var leaveViewModel = new List<LeaveViewModel>();
|
||||||
|
|
||||||
foreach (var list in leaveList)
|
foreach (var list in leaveList)
|
||||||
@@ -1361,6 +1370,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
|
|
||||||
}).SingleOrDefault(x => x.Id == id);
|
}).SingleOrDefault(x => x.Id == id);
|
||||||
|
|
||||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||||
@@ -1380,7 +1390,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
};
|
};
|
||||||
employers.Add(employer);
|
employers.Add(employer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ch.MaritalStatus = _context.Employees.Find(ch.EmployeeId)?.MaritalStatus;
|
ch.MaritalStatus = _context.Employees.Find(ch.EmployeeId)?.MaritalStatus;
|
||||||
ch.EmployerList = employers;
|
ch.EmployerList = employers;
|
||||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
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("-");
|
ch.TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-");
|
||||||
|
|
||||||
var hourlyPaidLeaveTimeSpans =
|
var hourlyPaidLeaveTimeSpans = hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan()).ToList();
|
||||||
hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan()).ToList();
|
|
||||||
|
|
||||||
var dailyPaidLeaveTimeSpans = dailyPaidLeave.Select(x =>
|
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.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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ch.TotalPaymentHide == false)
|
if (ch.TotalPaymentHide == false)
|
||||||
{
|
{
|
||||||
ch.TotalClaims = "";
|
ch.TotalClaims = "";
|
||||||
ch.TotalDeductions = "";
|
ch.TotalDeductions = "";
|
||||||
ch.TotalPayment = "";
|
ch.TotalPayment = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch.HasRollCall)
|
if (ch.HasRollCall)
|
||||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId,
|
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||||
ch.ContractStartGr, ch.ContractEndGr);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr;
|
||||||
@@ -1510,15 +1519,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi();
|
||||||
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId;
|
||||||
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId;
|
||||||
ch.MonthlyRollCall =
|
ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
||||||
ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CheckoutDailyRollCallViewModel> ConvertStaticToRollCall(CreateWorkingHoursTemp workingHours,
|
private List<CheckoutDailyRollCallViewModel> ConvertStaticToRollCall(CreateWorkingHoursTemp workingHours, bool workshopHolidayWorking)
|
||||||
bool workshopHolidayWorking)
|
|
||||||
{
|
{
|
||||||
var rollCalls = _rollCallMandatoryRepository.ConvertStaticHoursToRollCall(workingHours,
|
var rollCalls = _rollCallMandatoryRepository.ConvertStaticHoursToRollCall(workingHours,
|
||||||
workshopHolidayWorking);
|
workshopHolidayWorking);
|
||||||
@@ -1551,8 +1557,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
|
int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
|
||||||
|
|
||||||
|
|
||||||
var holidays = _context.HolidayItems.Where(x => x.HolidayYear.Contains(year.ToString())).Select(x =>
|
var holidays = _context.HolidayItems.Where(x => x.HolidayYear.Contains(year.ToString())).Select(x => new HolidayItemViewModel
|
||||||
new HolidayItemViewModel
|
|
||||||
{
|
{
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
Holidaydate = x.Holidaydate.ToFarsi(),
|
Holidaydate = x.Holidaydate.ToFarsi(),
|
||||||
@@ -1565,8 +1570,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
holidays = [];
|
holidays = [];
|
||||||
|
|
||||||
//all the dates from start to end, to be compared with present days to get absent dates
|
//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)
|
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date).ToList();
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var absentRecords = completeDaysList
|
var absentRecords = completeDaysList
|
||||||
.ExceptBy(rollCalls.Select(x => x.ShiftDate.Date), y => y.Date)
|
.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 presentDays = rollCalls.GroupBy(x => x.ShiftDate.Date).Select(x =>
|
||||||
{
|
{
|
||||||
|
|
||||||
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
||||||
|
|
||||||
var rollCallTimeSpanPerDay =
|
var rollCallTimeSpanPerDay =
|
||||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y =>
|
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));
|
||||||
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 breakTimePerDay = new TimeSpan(x.Sum(r => r.BreakTimeSpan.Ticks));
|
||||||
|
|
||||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||||
@@ -1612,6 +1614,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
secondRCEndDate = secondRollCall.ShiftEndWithoutRest ?? secondRollCall.EndDate;
|
secondRCEndDate = secondRollCall.ShiftEndWithoutRest ?? secondRollCall.EndDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new CheckoutDailyRollCallViewModel()
|
return new CheckoutDailyRollCallViewModel()
|
||||||
{
|
{
|
||||||
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||||
@@ -1683,15 +1686,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
return new List<CheckoutViewModel>();
|
return new List<CheckoutViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var employers =
|
var employers =
|
||||||
_context.Employers.Where(x => x.ContractingPartyId == contracingPartyAcc.PersonalContractingPartyId)
|
_context.Employers.Where(x => x.ContractingPartyId == contracingPartyAcc.PersonalContractingPartyId).Select(x => x.id).ToList();
|
||||||
.Select(x => x.id).ToList();
|
|
||||||
if (employers.Count < 1)
|
if (employers.Count < 1)
|
||||||
{
|
{
|
||||||
return new List<CheckoutViewModel>();
|
return new List<CheckoutViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var workshopIds = _context.WorkshopEmployers.Where(x => employers.Contains(x.EmployerId))
|
var workshopIds = _context.WorkshopEmployers.Where(x => employers.Contains(x.EmployerId))
|
||||||
.Select(x => x.WorkshopId).ToList();
|
.Select(x => x.WorkshopId).ToList();
|
||||||
var checkValid = workshopIds.Any(x => x == searchModel.WorkshopId);
|
var checkValid = workshopIds.Any(x => x == searchModel.WorkshopId);
|
||||||
@@ -1699,9 +1699,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
return new List<CheckoutViewModel>();
|
return new List<CheckoutViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
||||||
.AsSplitQuery().Select(x => new CheckoutViewModel()
|
.AsSplitQuery().Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
@@ -1743,7 +1741,9 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
WarningMessage = wm.WarningMessage,
|
WarningMessage = wm.WarningMessage,
|
||||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||||
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
|
|
||||||
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
|
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||||
if (searchModel.EmployeeId > 0)
|
if (searchModel.EmployeeId > 0)
|
||||||
{
|
{
|
||||||
@@ -1857,20 +1857,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
default:
|
default:
|
||||||
y2 = $"{searchModel.Year}/{searchModel.Month}/29";
|
y2 = $"{searchModel.Year}/{searchModel.Month}/29";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var start = y.ToGeorgianDateTime();
|
var start = y.ToGeorgianDateTime();
|
||||||
var end = y2.ToGeorgianDateTime();
|
var end = y2.ToGeorgianDateTime();
|
||||||
|
|
||||||
query = query.Where(x =>
|
query = query.Where(x => x.ContractStartGr >= start && x.ContractStartGr < end && x.ContractEndGr > start && x.ContractEndGr <= end ||
|
||||||
x.ContractStartGr >= start && x.ContractStartGr < end && x.ContractEndGr > start &&
|
x.ContractStartGr <= start && x.ContractEndGr >= end || start <= x.ContractStartGr && end > x.ContractStartGr || end >= x.ContractEndGr && start < x.ContractEndGr);
|
||||||
x.ContractEndGr <= end ||
|
|
||||||
x.ContractStartGr <= start && x.ContractEndGr >= end ||
|
|
||||||
start <= x.ContractStartGr && end > x.ContractStartGr ||
|
|
||||||
end >= x.ContractEndGr && start < x.ContractEndGr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.SearchAll)
|
if (searchModel.SearchAll)
|
||||||
return query.OrderByDescending(x => x.Id).ToList();
|
return query.OrderByDescending(x => x.Id).ToList();
|
||||||
switch (searchModel.Sorting)
|
switch (searchModel.Sorting)
|
||||||
@@ -1901,6 +1897,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
break;
|
break;
|
||||||
default: return query.OrderByDescending(x => x.Id).Skip(searchModel.PageIndex).Take(30).ToList();
|
default: return query.OrderByDescending(x => x.Id).Skip(searchModel.PageIndex).Take(30).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1930,10 +1928,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
var checkout = _context.CheckoutSet.Where(x => x.id == id)?.FirstOrDefault();
|
var checkout = _context.CheckoutSet.Where(x => x.id == id)?.FirstOrDefault();
|
||||||
_context.CheckoutSet.Remove(checkout);
|
_context.CheckoutSet.Remove(checkout);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return op.Succcedded(-1, "حذف با موفقیت انجام شد.");
|
return op.Succcedded(-1, "حذف با موفقیت انجام شد.");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -1951,7 +1951,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
notRemoveList.Add(item);
|
notRemoveList.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return notRemoveList;
|
return notRemoveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2011,8 +2010,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
var checkouts =
|
var checkouts =
|
||||||
_context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
_context.CheckoutSet.Include(w=>w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||||
.Where(x => workshopAcounts.Contains(x.WorkshopId))
|
|
||||||
.Join(_context.Workshops.AsSplitQuery(),
|
.Join(_context.Workshops.AsSplitQuery(),
|
||||||
ch => ch.WorkshopId,
|
ch => ch.WorkshopId,
|
||||||
workshop => workshop.id,
|
workshop => workshop.id,
|
||||||
@@ -2035,8 +2033,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
res.ch,
|
res.ch,
|
||||||
res.workshop,
|
res.workshop,
|
||||||
option = _context.EmployeeComputeOptionsSet.FirstOrDefault(x =>
|
option = _context.EmployeeComputeOptionsSet.FirstOrDefault(x=>x.WorkshopId == res.ch.WorkshopId &&x.EmployeeId == res.ch.EmployeeId),
|
||||||
x.WorkshopId == res.ch.WorkshopId && x.EmployeeId == res.ch.EmployeeId),
|
|
||||||
res.workshopEmployer,
|
res.workshopEmployer,
|
||||||
contractingParty = _context.PersonalContractingParties
|
contractingParty = _context.PersonalContractingParties
|
||||||
.Include(p => p.Employers)
|
.Include(p => p.Employers)
|
||||||
@@ -2053,18 +2050,15 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
checkouts = checkouts.Where(x => x.ch.WorkshopId == searchModel.WorkshopId);
|
checkouts = checkouts.Where(x => x.ch.WorkshopId == searchModel.WorkshopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployeeId != 0)
|
if (searchModel.EmployeeId != 0)
|
||||||
{
|
{
|
||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
checkouts = checkouts.Where(x => x.ch.EmployeeId == searchModel.EmployeeId);
|
checkouts = checkouts.Where(x => x.ch.EmployeeId == searchModel.EmployeeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployerId != 0)
|
if (searchModel.EmployerId != 0)
|
||||||
{
|
{
|
||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
checkouts = checkouts.Where(x =>
|
checkouts = checkouts.Where(x => x.contractingParty.Employers.Select(c => c.id).Contains(searchModel.EmployerId));
|
||||||
x.contractingParty.Employers.Select(c => c.id).Contains(searchModel.EmployerId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo))
|
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo))
|
||||||
@@ -2074,6 +2068,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (searchModel.IsActiveString == null)
|
//if (searchModel.IsActiveString == null)
|
||||||
//{
|
//{
|
||||||
// checkouts = checkouts.Where(x => x.ch.IsActiveString == "true");
|
// 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);
|
checkouts = checkouts.Where(x => x.ch.ContractStart >= startyearGr && x.ch.ContractEnd <= endYearGr);
|
||||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
checkouts = checkouts.OrderByDescending(x => x.ch.ContractEnd);
|
checkouts = checkouts.OrderByDescending(x => x.ch.ContractEnd);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
@@ -2224,6 +2220,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
endDate >= x.ch.ContractEnd && startDate < x.ch.ContractEnd);
|
endDate >= x.ch.ContractEnd && startDate < x.ch.ContractEnd);
|
||||||
//if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
//if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
// checkouts = checkouts.OrderBy(x => x.ch.PersonnelCodeInt);
|
// checkouts = checkouts.OrderBy(x => x.ch.PersonnelCodeInt);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
||||||
@@ -2243,20 +2240,22 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
||||||
{
|
{
|
||||||
hasSearch = true;
|
hasSearch = true;
|
||||||
var employeeList = _context.Employees.Where(x =>
|
var employeeList = _context.Employees.Where(x => (!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||||
(!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id).ToList();
|
||||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id)
|
|
||||||
.ToList();
|
|
||||||
checkouts = checkouts.Where(x => employeeList.Contains(x.ch.EmployeeId));
|
checkouts = checkouts.Where(x => employeeList.Contains(x.ch.EmployeeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
if (!hasSearch && !hasEmployeeOrWorkshpSearch)
|
if (!hasSearch && !hasEmployeeOrWorkshpSearch)
|
||||||
{
|
{
|
||||||
|
|
||||||
return checkouts.Select(x => new CheckoutViewModel()
|
return checkouts.Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = x.ch.id,
|
Id = x.ch.id,
|
||||||
EmployeeFullName = x.ch.EmployeeFullName,
|
EmployeeFullName = x.ch.EmployeeFullName,
|
||||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||||
@@ -2282,21 +2281,26 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm=> new CheckoutWarningMessageModel
|
||||||
new CheckoutWarningMessageModel
|
|
||||||
{
|
{
|
||||||
WarningMessage = wm.WarningMessage,
|
WarningMessage = wm.WarningMessage,
|
||||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||||
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
|
|
||||||
|
|
||||||
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
|
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
|
||||||
.OrderByDescending(x => x.Id).ThenByDescending(x => x.Year)
|
.OrderByDescending(x => x.Id).ThenByDescending(x => x.Year)
|
||||||
.ThenBy(x => x.PersonnelCodeInt)
|
.ThenBy(x => x.PersonnelCodeInt)
|
||||||
.Take(50).ToList();
|
.Take(50).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (hasSearch && !hasEmployeeOrWorkshpSearch)
|
else if (hasSearch && !hasEmployeeOrWorkshpSearch)
|
||||||
{
|
{
|
||||||
|
|
||||||
var result = checkouts.Select(x => new CheckoutViewModel()
|
var result = checkouts.Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = x.ch.id,
|
Id = x.ch.id,
|
||||||
EmployeeFullName = x.ch.EmployeeFullName,
|
EmployeeFullName = x.ch.EmployeeFullName,
|
||||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||||
@@ -2322,17 +2326,19 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||||
new CheckoutWarningMessageModel
|
|
||||||
{
|
{
|
||||||
WarningMessage = wm.WarningMessage,
|
WarningMessage = wm.WarningMessage,
|
||||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||||
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
|
|
||||||
}).OrderByDescending(x => x.Id)
|
}).OrderByDescending(x => x.Id)
|
||||||
.GroupBy(x => x.Id)
|
.GroupBy(x => x.Id)
|
||||||
.Select(x => x.First());
|
.Select(x => x.First());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
||||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) && string.IsNullOrWhiteSpace(searchModel.Month))
|
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) && string.IsNullOrWhiteSpace(searchModel.Month))
|
||||||
{
|
{
|
||||||
@@ -2342,8 +2348,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||||
}
|
}
|
||||||
else if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
else if ((string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
||||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) &&
|
string.IsNullOrWhiteSpace(searchModel.ContractEnd)) && !string.IsNullOrWhiteSpace(searchModel.Month) && !string.IsNullOrWhiteSpace(searchModel.Year))
|
||||||
!string.IsNullOrWhiteSpace(searchModel.Month) && !string.IsNullOrWhiteSpace(searchModel.Year))
|
|
||||||
{
|
{
|
||||||
//اگر فقط سال و ماه رو سرچ کرد
|
//اگر فقط سال و ماه رو سرچ کرد
|
||||||
return result.Take(300)
|
return result.Take(300)
|
||||||
@@ -2361,11 +2366,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
|
|
||||||
return result.ToList().OrderByDescending(x => x.Id)
|
return result.ToList().OrderByDescending(x => x.Id)
|
||||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (hasEmployeeOrWorkshpSearch && !hasSearch)
|
else if (hasEmployeeOrWorkshpSearch && !hasSearch)
|
||||||
{
|
{
|
||||||
|
|
||||||
return checkouts.Select(x => new CheckoutViewModel()
|
return checkouts.Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = x.ch.id,
|
Id = x.ch.id,
|
||||||
EmployeeFullName = x.ch.EmployeeFullName,
|
EmployeeFullName = x.ch.EmployeeFullName,
|
||||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||||
@@ -2391,12 +2399,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||||
new CheckoutWarningMessageModel
|
|
||||||
{
|
{
|
||||||
WarningMessage = wm.WarningMessage,
|
WarningMessage = wm.WarningMessage,
|
||||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||||
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
|
|
||||||
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
|
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
|
||||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||||
}
|
}
|
||||||
@@ -2404,6 +2413,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
{
|
{
|
||||||
return checkouts.Select(x => new CheckoutViewModel()
|
return checkouts.Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = x.ch.id,
|
Id = x.ch.id,
|
||||||
EmployeeFullName = x.ch.EmployeeFullName,
|
EmployeeFullName = x.ch.EmployeeFullName,
|
||||||
ContractStart = x.ch.ContractStart.ToFarsi(),
|
ContractStart = x.ch.ContractStart.ToFarsi(),
|
||||||
@@ -2429,21 +2439,26 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm =>
|
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||||
new CheckoutWarningMessageModel
|
|
||||||
{
|
{
|
||||||
WarningMessage = wm.WarningMessage,
|
WarningMessage = wm.WarningMessage,
|
||||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||||
|
|
||||||
}).ToList()
|
}).ToList()
|
||||||
|
|
||||||
}).GroupBy(x => x.Id)
|
}).GroupBy(x => x.Id)
|
||||||
.Select(x => x.First()).ToList()
|
.Select(x => x.First()).ToList()
|
||||||
.OrderByDescending(x => x.Id)
|
.OrderByDescending(x => x.Id)
|
||||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public async Task<List<CheckoutViewModel>> SearchForMainCheckout(CheckoutSearchModel searchModel)
|
public async Task<List<CheckoutViewModel>> SearchForMainCheckout(CheckoutSearchModel searchModel)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
bool hasSearch = false;
|
bool hasSearch = false;
|
||||||
bool hasEmployeeOrWorkshpSearch = false;
|
bool hasEmployeeOrWorkshpSearch = false;
|
||||||
//List<CheckoutViewModel> query = null;
|
//List<CheckoutViewModel> query = null;
|
||||||
@@ -2461,8 +2476,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
.Select(x => x.WorkshopId).ToList();
|
.Select(x => x.WorkshopId).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var query = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
var query = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
EmployeeFullName = x.EmployeeFullName,
|
EmployeeFullName = x.EmployeeFullName,
|
||||||
//var start = ;
|
//var start = ;
|
||||||
@@ -2485,9 +2503,13 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
IsActiveString = x.IsActiveString,
|
IsActiveString = x.IsActiveString,
|
||||||
Signature = x.Signature,
|
Signature = x.Signature,
|
||||||
CreationDate = x.CreationDate,
|
CreationDate = x.CreationDate,
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo) && searchModel.ContractId != 0)
|
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo) && searchModel.ContractId != 0)
|
||||||
query = query.Where(x =>
|
query = query.Where(x =>
|
||||||
x.ContractNo == searchModel.ContractNo && x.ContractId == searchModel.ContractId);
|
x.ContractNo == searchModel.ContractNo && x.ContractId == searchModel.ContractId);
|
||||||
@@ -2496,13 +2518,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployeeId != 0)
|
if (searchModel.EmployeeId != 0)
|
||||||
{
|
{
|
||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployerId != 0)
|
if (searchModel.EmployerId != 0)
|
||||||
{
|
{
|
||||||
hasEmployeeOrWorkshpSearch = true;
|
hasEmployeeOrWorkshpSearch = true;
|
||||||
@@ -2546,6 +2566,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
query = query.Where(x => x.ContractStartGr >= startyearGr && x.ContractEndGr <= endYearGr);
|
query = query.Where(x => x.ContractStartGr >= startyearGr && x.ContractEndGr <= endYearGr);
|
||||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
@@ -2665,6 +2686,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
endDate >= x.ContractEndGr && startDate < x.ContractEndGr);
|
endDate >= x.ContractEndGr && startDate < x.ContractEndGr);
|
||||||
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
query = query.OrderBy(x => x.PersonnelCodeInt);
|
query = query.OrderBy(x => x.PersonnelCodeInt);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
!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)
|
if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||||
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
query = query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
if (!string.IsNullOrEmpty(searchModel.EmployeeName))
|
||||||
{
|
{
|
||||||
hasSearch = true;
|
hasSearch = true;
|
||||||
var employeeList = _context.Employees.Where(x =>
|
var employeeList = _context.Employees.Where(x => (!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
||||||
(!string.IsNullOrEmpty(x.FName) && x.FName.StartsWith(searchModel.EmployeeName)) ||
|
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id).ToList();
|
||||||
(!string.IsNullOrEmpty(x.LName) && x.LName.StartsWith(searchModel.EmployeeName))).Select(x => x.id)
|
|
||||||
.ToList();
|
|
||||||
query = query.Where(x => employeeList.Contains(x.EmployeeId));
|
query = query.Where(x => employeeList.Contains(x.EmployeeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSearch)
|
if (hasSearch)
|
||||||
return query.OrderByDescending(x => x.Id)
|
return query.OrderByDescending(x => x.Id)
|
||||||
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList();
|
.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();
|
.ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(50).ToList();
|
||||||
|
|
||||||
// Console.WriteLine("return" + watch.Elapsed);
|
// Console.WriteLine("return" + watch.Elapsed);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Pooya
|
#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,
|
EmployeeId = x.EmployeeId,
|
||||||
CheckoutEnd = x.ContractEnd,
|
CheckoutEnd = x.ContractEnd,
|
||||||
@@ -2726,88 +2751,5 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
|||||||
x.ContractEnd >= inDate);
|
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
|
#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);
|
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()
|
.Take(30).ToList()
|
||||||
.Select(x => new LoanViewModel()
|
.Select(x => new LoanViewModel()
|
||||||
{
|
{
|
||||||
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
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(),
|
Amount = x.Amount.ToMoney(),
|
||||||
AmountPerMonth = x.AmountPerMonth.ToMoney(),
|
AmountPerMonth = x.AmountPerMonth.ToMoney(),
|
||||||
StartDateTime = x.StartInstallmentPayment.ToFarsi(),
|
StartDateTime = x.StartInstallmentPayment.ToFarsi(),
|
||||||
@@ -186,7 +191,9 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
|||||||
EmployeeId = x.EmployeeId,
|
EmployeeId = x.EmployeeId,
|
||||||
YearFa = pc.GetYear(x.StartInstallmentPayment).ToString(),
|
YearFa = pc.GetYear(x.StartInstallmentPayment).ToString(),
|
||||||
|
|
||||||
}).ToList();
|
}).ToList()
|
||||||
|
};
|
||||||
|
|
||||||
return result;
|
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 _0_Framework.InfraStructure;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
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;
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
@@ -22,260 +15,6 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
|||||||
_context = context;
|
_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)
|
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)
|
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||||
{
|
{
|
||||||
|
var st = new DateTime(2024, 6, 2);
|
||||||
|
var ed = new DateTime(2024, 7, 1);
|
||||||
if(startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
|
if (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
|
||||||
return new List<ApiResultViewModel>();
|
{
|
||||||
|
st = startDate.ToGeorgianDateTime();
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
|
||||||
|
{
|
||||||
|
ed = endDate.ToGeorgianDateTime();
|
||||||
|
}
|
||||||
var res = new List<ApiResultViewModel>();
|
var res = new List<ApiResultViewModel>();
|
||||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
Int32 unixTimestamp2 = (int)ed.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;
|
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)
|
public string DeliveryStatus(byte? dv)
|
||||||
{
|
{
|
||||||
string mess = "";
|
string mess = "";
|
||||||
|
|||||||
@@ -563,7 +563,6 @@ public class PersonalBootstrapper
|
|||||||
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
|
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
|
||||||
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
|
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
|
||||||
|
|
||||||
services.AddTransient<IInstitutionContractSmsServiceRepository, InstitutionContractSmsServiceRepository>();
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -209,38 +209,22 @@ public class CreateOrEditCheckoutCommandHandler : IBaseCommandHandler<CreateOrEd
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
////حقوق نهایی
|
//حقوق نهایی
|
||||||
//var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
||||||
//// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||||
//monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
||||||
|
|
||||||
////حقوق کسر شده
|
//حقوق کسر شده
|
||||||
//var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
||||||
|
|
||||||
//new chang salary compute
|
|
||||||
var monthlySalaryPay = totalHoursWorked * monthlySalaryDefined;
|
|
||||||
|
|
||||||
//زمان باقی مانده
|
//زمان باقی مانده
|
||||||
var remainingTime = totalHoursWorked - mandatoryHours;
|
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
|
var computeResult = new ComputeResultDto
|
||||||
{
|
{
|
||||||
MandatoryHours = mandatoryHours,
|
MandatoryHours = mandatoryHours,
|
||||||
MonthlySalaryPay = monthlySalaryPay,
|
MonthlySalaryPay = monthlySalaryPay,
|
||||||
DeductionFromSalary = 0 /*deductionFromSalary*/,
|
DeductionFromSalary = deductionFromSalary,
|
||||||
RemainingHours = remainingTime
|
RemainingHours = remainingTime
|
||||||
};
|
};
|
||||||
Console.WriteLine(mandatoryHours);
|
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._Common.Models;
|
||||||
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PersianDateTime = PersianTools.Core.PersianDateTime;
|
using PersianTools.Core;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
||||||
|
|
||||||
@@ -46,8 +45,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
|||||||
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
|
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
|
||||||
|
|
||||||
|
|
||||||
//var lastMonthStart = lastMonth;
|
var lastMonthStart = lastMonth;
|
||||||
var lastMonthEnd = ((selectedDate.ToFarsi().FindeEndOfMonth())).ToGeorgianDateTime();
|
var lastMonthEnd = lastMonth;
|
||||||
|
|
||||||
var query =
|
var query =
|
||||||
await (from u in _context.Users
|
await (from u in _context.Users
|
||||||
@@ -61,8 +60,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
|||||||
// LEFT JOIN
|
// LEFT JOIN
|
||||||
//فیش
|
//فیش
|
||||||
join ch in _context.Checkouts
|
join ch in _context.Checkouts
|
||||||
.Where(x => x.CheckoutStartDate < lastMonthEnd
|
.Where(x => x.CheckoutStartDate < lastMonthStart
|
||||||
&& x.CheckoutEndDate > selectedDate)
|
&& x.CheckoutEndDate >= lastMonthStart)
|
||||||
on u.Id equals ch.UserId into chJoin
|
on u.Id equals ch.UserId into chJoin
|
||||||
from ch in chJoin.DefaultIfEmpty()
|
from ch in chJoin.DefaultIfEmpty()
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,5 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
|
|||||||
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
||||||
{
|
{
|
||||||
public long? UserId { get; set; }
|
public long? UserId { get; set; }
|
||||||
public string? SearchText { get; set; }
|
|
||||||
public TaskSectionStatus? Status { get; set; }
|
public TaskSectionStatus? Status { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
||||||
|
|
||||||
@@ -23,8 +24,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
var currentUserId = _authHelper.GetCurrentUserId();
|
var currentUserId = _authHelper.GetCurrentUserId();
|
||||||
|
|
||||||
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
|
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
|
||||||
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero
|
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero && x.Status != TaskSectionStatus.Completed)
|
||||||
&& x.Status != TaskSectionStatus.Completed)
|
|
||||||
.Include(x => x.Task)
|
.Include(x => x.Task)
|
||||||
.ThenInclude(x => x.Phase)
|
.ThenInclude(x => x.Phase)
|
||||||
.ThenInclude(x => x.Project)
|
.ThenInclude(x => x.Project)
|
||||||
@@ -46,17 +46,9 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
|
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 data = await queryable.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var activityUserIds = data.SelectMany(x => x.Activities)
|
var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList();
|
||||||
.Select(a => a.UserId).Distinct().ToList();
|
|
||||||
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
|
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
|
||||||
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
|
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
|
||||||
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
|
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
|
||||||
@@ -80,7 +72,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
{
|
{
|
||||||
Activity = a,
|
Activity = a,
|
||||||
TimeSpent = timeSpent,
|
TimeSpent = timeSpent,
|
||||||
timeSpent.TotalSeconds,
|
TotalSeconds = timeSpent.TotalSeconds,
|
||||||
FormattedTime = timeSpent.ToString(@"hh\:mm")
|
FormattedTime = timeSpent.ToString(@"hh\:mm")
|
||||||
};
|
};
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.OrderBy(x=>x.CreationDate)
|
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -85,7 +84,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.OriginalAssignedUserId ?? 0,
|
UserId = section?.OriginalAssignedUserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).ToList(),
|
}).OrderBy(x => x.SkillId).ToList(),
|
||||||
task.Id,
|
task.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
@@ -115,7 +114,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.OrderBy(x=>x.CreationDate)
|
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -137,7 +135,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.UserId ?? 0,
|
UserId = section?.UserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).ToList(),
|
}).OrderBy(x => x.SkillId).ToList(),
|
||||||
phase.Id,
|
phase.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
@@ -167,7 +165,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.OrderBy(x=>x.CreationDate)
|
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -189,7 +186,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.UserId ?? 0,
|
UserId = section?.UserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).ToList(),
|
}).OrderBy(x => x.SkillId).ToList(),
|
||||||
project.Id,
|
project.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
||||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
|
||||||
using MediatR;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
||||||
|
|
||||||
public record GetMessagesQuery(
|
public record GetMessagesQuery(
|
||||||
Guid TaskId,
|
Guid TaskId,
|
||||||
MessageType? MessageType,
|
|
||||||
int Page = 1,
|
int Page = 1,
|
||||||
int PageSize = 50
|
int PageSize = 50
|
||||||
) : IBaseQuery<PaginationResult<MessageDto>>;
|
) : IBaseQuery<PaginationResult<MessageDto>>;
|
||||||
@@ -69,12 +66,7 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
|
|||||||
var query = _context.TaskChatMessages
|
var query = _context.TaskChatMessages
|
||||||
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
|
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
|
||||||
.Include(m => m.ReplyToMessage)
|
.Include(m => m.ReplyToMessage)
|
||||||
.OrderBy(m => m.CreationDate).AsQueryable();
|
.OrderBy(m => m.CreationDate);
|
||||||
|
|
||||||
if (request.MessageType.HasValue)
|
|
||||||
{
|
|
||||||
query = query.Where(m => m.MessageType == request.MessageType.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
var totalCount = await query.CountAsync(cancellationToken);
|
var totalCount = await query.CountAsync(cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ProjectTask : ProjectHierarchyNode
|
|||||||
{
|
{
|
||||||
PhaseId = phaseId;
|
PhaseId = phaseId;
|
||||||
_sections = new List<TaskSection>();
|
_sections = new List<TaskSection>();
|
||||||
Priority = ProjectTaskPriority.Low;
|
Priority = ProjectTaskPriority.Medium;
|
||||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
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.GetMessages;
|
||||||
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetPinnedMessages;
|
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetPinnedMessages;
|
||||||
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.SearchMessages;
|
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.SearchMessages;
|
||||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ServiceHost.BaseControllers;
|
using ServiceHost.BaseControllers;
|
||||||
@@ -31,17 +30,15 @@ public class TaskChatController : ProgramManagerBaseController
|
|||||||
/// دریافت لیست پیامهای یک تسک
|
/// دریافت لیست پیامهای یک تسک
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId">شناسه تسک</param>
|
/// <param name="taskId">شناسه تسک</param>
|
||||||
/// <param name="messageType">نوع پیام</param>
|
|
||||||
/// <param name="page">صفحه (پیشفرض: 1)</param>
|
/// <param name="page">صفحه (پیشفرض: 1)</param>
|
||||||
/// <param name="pageSize">تعداد در هر صفحه (پیشفرض: 50)</param>
|
/// <param name="pageSize">تعداد در هر صفحه (پیشفرض: 50)</param>
|
||||||
[HttpGet("{taskId:guid}/messages")]
|
[HttpGet("{taskId:guid}/messages")]
|
||||||
public async Task<ActionResult<OperationResult<PaginationResult<MessageDto>>>> GetMessages(
|
public async Task<ActionResult<OperationResult<PaginationResult<MessageDto>>>> GetMessages(
|
||||||
Guid taskId,
|
Guid taskId,
|
||||||
[FromQuery] MessageType? messageType,
|
|
||||||
[FromQuery] int page = 1,
|
[FromQuery] int page = 1,
|
||||||
[FromQuery] int pageSize = 50)
|
[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);
|
var result = await _mediator.Send(query);
|
||||||
return result;
|
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>
|
</p>
|
||||||
</a>
|
</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">
|
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>
|
<i class="fa fa-file-text-o faSize"></i>
|
||||||
<p>
|
<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