Compare commits

..

34 Commits

Author SHA1 Message Date
c844867cab add OnPostCreateFromExcelData method to SalaryAidController for bulk salary aid creation from Excel data 2026-02-05 15:00:56 +03:30
779514f5c0 refactor ValidateExcel method in SalaryAidController to use ValidateExcelRequest model 2026-02-05 14:18:18 +03:30
bc491eec18 add EditDetails endpoint to SalaryAidController for salary aid detail retrieval 2026-02-05 13:55:02 +03:30
67910d2fa5 add EditDetails method to SalaryAidController for retrieving salary aid details 2026-02-05 12:50:53 +03:30
db32b1e6ea set WorkshopId in search model for salary aid list retrieval 2026-02-05 11:50:23 +03:30
79a9d72b86 rename SalaryAidViewModels property to Items in grouped view models 2026-02-05 11:32:16 +03:30
a8cb226d20 change list key for salary aid 2026-02-05 11:05:54 +03:30
ffe8fa67e2 refactor salary aid controller to update Excel validation endpoint 2026-02-05 10:33:09 +03:30
a0d2023a6c add Excel validation for salary aid import and update pagination in salary aid list 2026-02-05 10:32:08 +03:30
b22aa86aea add create - edit - remove salary aid api controller 2026-01-15 10:35:43 +03:30
f0feac9601 add salary aid controller 2026-01-14 19:27:23 +03:30
gozareshgir
8ec13ffae1 Merge branch 'master' of https://pm.gozareshgir.ir/gozareshgir/OriginalGozareshgir 2026-01-14 14:40:50 +03:30
gozareshgir
5508d4e88f Checkout Compute Minuts Base 2026-01-14 14:39:51 +03:30
43abb74c61 Merge branch 'Feature/program-manager/chat'
# Conflicts:
#	ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskChat/Queries/GetMessages/GetMessagesQuery.cs
2026-01-14 10:57:07 +03:30
73e6681baa add message type to search query 2026-01-14 10:46:44 +03:30
90b2fd2eab add order for skills in set time 2026-01-14 10:13:57 +03:30
d9c431e20e add project name search for board list 2026-01-13 09:23:53 +03:30
gozareshgir
2746bf69ea Merge branch 'master' into Feature/SmsRepoetApi 2026-01-12 14:38:15 +03:30
gozareshgir
77dbb50512 BlueDeActiveAfterZeroDebt hangfire completed 2026-01-12 14:32:50 +03:30
gozareshgir
1c7e8824c7 DeActiveInstitutionEndOfContract hangfire completed 2026-01-12 13:10:58 +03:30
0eff1b9a66 change default task priority from medium to low 2026-01-12 12:07:43 +03:30
gozareshgir
0d33d79620 unblock hangfire completed 2026-01-11 22:07:58 +03:30
gozareshgir
e4355faffc block and unblock 2026-01-11 21:10:29 +03:30
gozareshgir
577fe5db76 Merge branch 'master' of https://pm.gozareshgir.ir/gozareshgir/OriginalGozareshgir into Feature/SmsRepoetApi 2026-01-11 12:58:36 +03:30
SamSys
ec8333c715 merg from master 2026-01-08 15:00:40 +03:30
SamSys
8aa93e089a legal Action Sms completed 2026-01-08 14:56:33 +03:30
SamSys
0ab3052251 Send Warning and leagal action Message 2026-01-08 14:04:34 +03:30
SamSys
5202779d9f changes 2026-01-08 12:18:01 +03:30
SamSys
67a85735f0 merge from master 2026-01-08 11:36:18 +03:30
SamSys
35e6355069 get Warning sms List on new repo 2026-01-08 11:19:25 +03:30
SamSys
4de2e12ac5 AmaApiReport 2026-01-07 18:38:12 +03:30
SamSys
23b65cfbfe GetSms Report Expand List 2026-01-07 16:59:21 +03:30
SamSys
48b75d2baa Sms Report get list init 2026-01-07 16:29:03 +03:30
SamSys
63edb33bf5 Sms Report Init 2026-01-07 14:49:44 +03:30
49 changed files with 3841 additions and 2898 deletions

View File

@@ -2,6 +2,8 @@
public enum TypeOfSmsSetting
{
//همه انواع پیامک
All = 0,
/// <summary>
/// پیامک
@@ -23,7 +25,7 @@ public enum TypeOfSmsSetting
/// <summary>
/// پیامک
/// هشدار اول
/// هشدار بدهی
/// </summary>
Warning,
@@ -38,4 +40,14 @@ public enum TypeOfSmsSetting
/// </summary>
InstitutionContractConfirm,
/// <summary>
/// ارسال کد تاییدیه قرارداد مالی
/// </summary>
SendInstitutionContractConfirmationCode,
/// <summary>
/// یادآور وظایف
/// </summary>
TaskReminder,
}

View File

@@ -7,7 +7,7 @@ namespace _0_Framework.Application;
public class PagedResult<T> where T : class
{
public int TotalCount { get; set; }
public List<T> List { get; set; } = [];
public List<T> List { get; set; }
}
public class PagedResult<T,TMeta>:PagedResult<T> where T : class
{

View File

@@ -17,4 +17,18 @@ public class ApiResultViewModel
public string DeliveryUnixTime { get; set; }
public string DeliveryColor { get; set; }
public string FullName { get; set; }
}
public class ApiReportDto
{
public int MessageId { get; set; }
public long Mobile { get; set; }
public string SendUnixTime { get; set; }
public string DeliveryState { get; set; }
public string DeliveryUnixTime { get; set; }
public string DeliveryColor { get; set; }
}

View File

@@ -19,6 +19,13 @@ public interface ISmsService
bool SendAccountsInfo(string number,string fullName, string userName);
Task<ApiResultViewModel> GetByMessageId(int messId);
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
#region ForApi
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
#endregion
string DeliveryStatus(byte? dv);
string DeliveryColorStatus(byte? dv);
string UnixTimeStampToDateTime(int? unixTimeStamp);

View File

@@ -1,5 +1,6 @@
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.Sms;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionContractAgg;
@@ -12,19 +13,21 @@ public class JobSchedulerRegistrator
private readonly IBackgroundJobClient _backgroundJobClient;
private readonly SmsReminder _smsReminder;
private readonly IInstitutionContractRepository _institutionContractRepository;
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
private static DateTime? _lastRunCreateTransaction;
private static DateTime? _lastRunSendMonthlySms;
private readonly ISmsService _smsService;
private readonly ILogger<JobSchedulerRegistrator> _logger;
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger)
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
_institutionContractRepository = institutionContractRepository;
_smsService = smsService;
_logger = logger;
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
}
public void Register()
@@ -58,17 +61,43 @@ public class JobSchedulerRegistrator
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
//RecurringJob.AddOrUpdate(
// "InstitutionContract.SendWarningSms",
// () => SendWarningSms(),
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
//);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendWarningSms",
() => SendWarningSms(),
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
//RecurringJob.AddOrUpdate(
// "InstitutionContract.SendLegalActionSms",
// () => SendLegalActionSms(),
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
//);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendLegalActionSms",
() => SendLegalActionSms(),
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
RecurringJob.AddOrUpdate(
"InstitutionContract.Block",
() => Block(),
"*/30 * * * *" // هر 30 دقیقه یکبار چک کن
);
RecurringJob.AddOrUpdate(
"InstitutionContract.UnBlock",
() => UnBlock(),
"*/10 * * * *"
);
RecurringJob.AddOrUpdate(
"InstitutionContract.DeActiveInstitutionEndOfContract",
() => DeActiveInstitutionEndOfContract(),
"*/30 * * * *"
);
RecurringJob.AddOrUpdate(
"InstitutionContract.BlueDeActiveAfterZeroDebt",
() => BlueDeActiveAfterZeroDebt(),
"*/10 * * * *"
);
}
@@ -79,14 +108,14 @@ public class JobSchedulerRegistrator
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
public async System.Threading.Tasks.Task CreateFinancialTransaction()
{
var now =DateTime.Now;
var now = DateTime.Now;
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
_logger.LogInformation("CreateFinancialTransaction job run");
if (now.Date == endOfMonthGr.Date && now.Hour >= 2 && now.Hour < 4 &&
now.Date != _lastRunCreateTransaction?.Date)
{
var month = endOfMonth.Substring(5, 2);
var year = endOfMonth.Substring(0, 4);
var monthName = month.ToFarsiMonthByNumber();
@@ -101,17 +130,17 @@ public class JobSchedulerRegistrator
try
{
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
_lastRunCreateTransaction = now;
Console.WriteLine("CreateTransAction executed");
}
catch (Exception e)
{
await _smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
}
}
}
@@ -134,7 +163,7 @@ public class JobSchedulerRegistrator
try
{
await _institutionContractRepository.SendMonthlySms(now);
await _institutionContractSmsServiceRepository.SendMonthlySms(now);
_lastRunSendMonthlySms = now;
Console.WriteLine("Send Monthly sms executed");
@@ -156,7 +185,7 @@ public class JobSchedulerRegistrator
public async System.Threading.Tasks.Task SendReminderSms()
{
_logger.LogInformation("SendReminderSms job run");
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
await _institutionContractSmsServiceRepository.SendReminderSmsForBackgroundTask();
}
/// <summary>
@@ -167,7 +196,7 @@ public class JobSchedulerRegistrator
public async System.Threading.Tasks.Task SendBlockSms()
{
_logger.LogInformation("SendBlockSms job run");
await _institutionContractRepository.SendBlockSmsForBackgroundTask();
await _institutionContractSmsServiceRepository.SendBlockSmsForBackgroundTask();
}
@@ -179,7 +208,7 @@ public class JobSchedulerRegistrator
public async System.Threading.Tasks.Task SendInstitutionContractConfirmSms()
{
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
await _institutionContractRepository.SendInstitutionContractConfirmSmsTask();
await _institutionContractSmsServiceRepository.SendInstitutionContractConfirmSmsTask();
}
/// <summary>
@@ -190,14 +219,86 @@ public class JobSchedulerRegistrator
public async System.Threading.Tasks.Task SendWarningSms()
{
_logger.LogInformation("SendWarningSms job run");
await _institutionContractRepository.SendWarningSmsTask();
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.Warning);
}
/// <summary>
/// پیامک اقدام قضایی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task SendLegalActionSms()
{
_logger.LogInformation("SendWarningSms job run");
await _institutionContractRepository.SendLegalActionSmsTask();
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
}
/// <summary>
/// بلاگ سازی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task Block()
{
_logger.LogInformation("block job run");
var now = DateTime.Now;
var executeDate = now.ToFarsi().Substring(8, 2);
if (executeDate == "20")
{
if (now.Hour >= 9 && now.Hour < 10)
{
await _institutionContractSmsServiceRepository.Block(now);
}
}
}
/// <summary>
/// آنبلاک
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task UnBlock()
{
_logger.LogInformation("UnBlock job run");
await _institutionContractSmsServiceRepository.UnBlock();
}
/// <summary>
/// غیر فعال سازی قراداد های پایان یافته
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task DeActiveInstitutionEndOfContract()
{
_logger.LogInformation("DeActiveInstitutionEndOfContract job run");
var now = DateTime.Now;
var executeDate = now.ToFarsi().Substring(8, 2);
if (executeDate == "01")
{
if (now.Hour >= 9 && now.Hour < 10)
{
await _institutionContractSmsServiceRepository.DeActiveInstitutionEndOfContract(now);
}
}
}
/// <summary>
/// غیرفعال سازس قرارداد های آبی که بدهی ندارند
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 800)]
public async System.Threading.Tasks.Task BlueDeActiveAfterZeroDebt()
{
_logger.LogInformation("BlueDeActiveAfterZeroDebt job run");
await _institutionContractSmsServiceRepository.BlueDeActiveAfterZeroDebt();
}
}

View File

@@ -91,65 +91,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
#region ReminderSMS
/// <summary>
/// دریافت لیست - ارسال پیامک
/// فراخوانی از سمت بک گراند سرویس
/// </summary>
/// <returns></returns>
Task<bool> SendReminderSmsForBackgroundTask();
/// <summary>
/// ارسال پیامک صورت حساب ماهانه
/// </summary>
/// <param name="now"></param>
/// <returns></returns>
Task SendMonthlySms(DateTime now);
/// <summary>
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
/// </summary>
/// <returns></returns>
Task SendBlockSmsForBackgroundTask();
/// <summary>
/// دریافت لیست واجد شرایط بلاک
/// جهت ارسال پیامک مسدودی
/// </summary>
/// <param name="checkDate"></param>
/// <returns></returns>
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
/// <summary>
/// ارسال پیامک مسدودی
/// </summary>
/// <param name="smsListData"></param>
/// <param name="typeOfSms"></param>
/// <param name="sendMessStart"></param>
/// <param name="sendMessEnd"></param>
/// <returns></returns>
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
string sendMessStart, string sendMessEnd);
/// <summary>
///دریافت لیست بدهکارن
/// جهت ارسال پیامک
/// </summary>
/// <returns></returns>
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک های یاد آور بدهی
/// </summary>
/// <returns></returns>
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
/// <summary>
/// ارسال پیامک یادآور تایید قراداد مالی
/// </summary>
/// <returns></returns>
Task SendInstitutionContractConfirmSmsTask();
#endregion
#region CreateMontlyTransaction
@@ -162,24 +104,12 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
#endregion
#region WarningSms
/// <summary>
/// پیامک های هشدار
/// </summary>
/// <returns></returns>
Task SendWarningSmsTask();
#endregion
#region legalAction
/// <summary>
/// پیامک اقدام قضائی
/// </summary>
/// <returns></returns>
Task SendLegalActionSmsTask();
#endregion
Task<long> GetIdByInstallmentId(long installmentId);
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);

View File

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

View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -92,9 +91,5 @@ namespace Company.Domain.RollCallAgg
Task<List<RollCall>> GetRollCallsUntilNowWithWorkshopIdEmployeeIds(long workshopId, List<long> employeeIds,
DateTime fromDate);
#endregion
Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,RollCallCaseHistorySearchModel searchModel);
Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId,
string titleId, RollCallCaseHistorySearchModel searchModel);
}
}

View File

@@ -1,10 +1,30 @@
using CompanyManagment.App.Contracts.SmsResult;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System.Collections.Generic;
using _0_Framework.Domain;
using System.Threading.Tasks;
namespace Company.Domain.SmsResultAgg;
public interface ISmsResultRepository : IRepository<long, SmsResult>
{
#region ForApi
/// <summary>
/// دریافت لیست پیامکها
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
/// <summary>
/// دریافت اکسپند لیست هر تاریخ
/// </summary>
/// <param name="searchModel"></param>
/// <param name="date"></param>
/// <returns></returns>
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
#endregion
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
}

View File

@@ -1,12 +1,6 @@
using _0_Framework.Excel;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.RollCall;
using OfficeOpenXml;
using OfficeOpenXml.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace CompanyManagement.Infrastructure.Excel.RollCall;
@@ -314,111 +308,6 @@ public class RollCallExcelGenerator : ExcelGenerator
return package.GetAsByteArray();
}
public static byte[] CaseHistoryExcelForEmployee(List<RollCallCaseHistoryDetail> data, string titleId)
{
if (!Regex.IsMatch(titleId, @"^\d{4}_\d{2}$"))
throw new ArgumentException("Invalid titleId format.", nameof(titleId));
var splitDate = titleId.Split("_");
var year = Convert.ToInt32(splitDate.First());
var month = Convert.ToInt32(splitDate.Last());
var startDateFa = $"{year:D4}/{month:D2}/01";
var startDate = startDateFa.ToGeorgianDateTime();
var endDateFa = startDateFa.FindeEndOfMonth();
var endDate = endDateFa.ToGeorgianDateTime();
var dateRange = (int)(endDate.Date - startDate.Date).TotalDays + 1;
var dates = Enumerable.Range(0, dateRange).Select(x => startDate.AddDays(x)).ToList();
var safeData = data ?? new List<RollCallCaseHistoryDetail>();
var first = safeData.FirstOrDefault();
var totalWorkingTime = new TimeSpan(safeData.Sum(x => x.TotalWorkingTime.Ticks));
var viewModel = new CaseHistoryRollCallExcelForEmployeeViewModel
{
EmployeeId = first?.EmployeeId ?? 0,
DateGr = startDate,
PersonnelCode = first?.PersonnelCode,
EmployeeFullName = first?.EmployeeFullName,
PersianMonthName = month.ToFarsiMonthByIntNumber(),
PersianYear = year.ToString(),
TotalWorkingHoursFa = totalWorkingTime.ToFarsiHoursAndMinutes("-"),
TotalWorkingTimeSpan = $"{(int)totalWorkingTime.TotalHours}:{totalWorkingTime.Minutes:00}",
RollCalls = dates.Select((date, index) =>
{
var item = index < safeData.Count ? safeData[index] : null;
var records = item?.Records ?? new List<RollCallCaseHistoryDetailRecord>();
return new RollCallItemForEmployeeExcelViewModel
{
DateGr = date,
DateFa = date.ToFarsi(),
DayOfWeekFa = date.DayOfWeek.DayOfWeeKToPersian(),
PersonnelCode = item?.PersonnelCode,
EmployeeFullName = item?.EmployeeFullName,
IsAbsent = item?.Status == RollCallRecordStatus.Absent,
HasLeave = item?.Status == RollCallRecordStatus.Leaved,
IsHoliday = false,
TotalWorkingHours = (item?.TotalWorkingTime ?? TimeSpan.Zero).ToFarsiHoursAndMinutes("-"),
StartsItems = JoinRecords(records, r => r.StartTime),
EndsItems = JoinRecords(records, r => r.EndTime),
EnterTimeDifferences = JoinRecords(records, r => FormatSignedTimeSpan(r.EntryTimeDifference)),
ExitTimeDifferences = JoinRecords(records, r => FormatSignedTimeSpan(r.ExitTimeDifference))
};
}).ToList()
};
return CaseHistoryExcelForEmployee(viewModel);
}
public static byte[] CaseHistoryExcelForOneDay(List<RollCallCaseHistoryDetail> data, string titleId)
{
if (!Regex.IsMatch(titleId, @"^\d{4}/\d{2}/\d{2}$"))
throw new ArgumentException("Invalid titleId format.", nameof(titleId));
var dateGr = titleId.ToGeorgianDateTime();
var safeData = data ?? new List<RollCallCaseHistoryDetail>();
var viewModel = new CaseHistoryRollCallForOneDayViewModel
{
DateFa = titleId,
DateGr = dateGr,
DayOfWeekFa = dateGr.DayOfWeek.DayOfWeeKToPersian(),
RollCalls = safeData.Select(item =>
{
var records = item.Records ?? new List<RollCallCaseHistoryDetailRecord>();
return new RollCallItemForOneDayExcelViewModel
{
EmployeeFullName = item.EmployeeFullName,
PersonnelCode = item.PersonnelCode,
StartsItems = JoinRecords(records, r => r.StartTime),
EndsItems = JoinRecords(records, r => r.EndTime),
TotalWorkingHours = item.TotalWorkingTime.ToFarsiHoursAndMinutes("-")
};
}).ToList()
};
return CaseHistoryExcelForOneDay(viewModel);
}
private static string JoinRecords(IEnumerable<RollCallCaseHistoryDetailRecord> records, Func<RollCallCaseHistoryDetailRecord, string> selector)
{
var safeRecords = records ?? Enumerable.Empty<RollCallCaseHistoryDetailRecord>();
var values = safeRecords.Select(selector).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
return values.Count == 0 ? string.Empty : string.Join(Environment.NewLine, values);
}
private static string FormatSignedTimeSpan(TimeSpan value)
{
if (value == TimeSpan.Zero)
return "-";
var abs = value.Duration();
var sign = value.Ticks < 0 ? "-" : "+";
return $"{(int)abs.TotalHours}:{abs.Minutes:00}{sign}";
}
private string CalculateExitMinuteDifference(TimeSpan early, TimeSpan late)
{
if (early == TimeSpan.Zero && late == TimeSpan.Zero)

View File

@@ -4,8 +4,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.RollCall
{
@@ -127,62 +125,7 @@ namespace CompanyManagment.App.Contracts.RollCall
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,RollCallCaseHistorySearchModel searchModel);
Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel);
Task<RollCallCaseHistoryExcelDto> DownloadCaseHistoryExcel(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel);
}
public class RollCallCaseHistoryExcelDto
{
public byte[] Bytes { get; set; }
public string FileName { get; set; }
public string MimeType { get; set; }
}
public class RollCallCaseHistoryDetail
{
public string EmployeeFullName { get; set; }
public string PersonnelCode { get; set; }
public TimeSpan TotalWorkingTime { get; set; }
public List<RollCallCaseHistoryDetailRecord> Records { get; set; }
public RollCallRecordStatus Status { get; set; }
public long EmployeeId { get; set; }
}
public enum RollCallRecordStatus
{
Worked = 0,
Absent = 1,
Leaved = 2
}
public class RollCallCaseHistoryDetailRecord
{
public TimeSpan EntryTimeDifference { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public TimeSpan ExitTimeDifference { get; set; }
}
public class RollCallCaseHistorySearchModel:PaginationRequest
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public string OneDayDate { get; set; }
public long? EmployeeId { get; set; }
}
public class RollCallCaseHistoryTitleDto
{
public string Id { get; set; }
public string Title { get; set; }
}
public class ReCalculateRollCallValues
{
public long EmployeeId { get; set; }

View File

@@ -8,7 +8,6 @@ public class CreateSalaryAidViewModel
public long WorkshopId { get; set; }
public string Amount { get; set; }
public string SalaryDateTime { get; set; }
public string CalculationDateTime { get; set; }
public string NationalCode { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }

View File

@@ -8,7 +8,7 @@ public class SalaryAidGroupedByDateViewModel
public string YearFa { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public List<SalaryAidGroupedByDateViewModelItems> SalaryAidViewModels { get; set; }
public List<SalaryAidGroupedByDateViewModelItems> Items { get; set; }
public string TotalAmount { get; set; }
}

View File

@@ -6,7 +6,7 @@ public class SalaryAidGroupedByEmployeeViewModel
{
public string EmployeeName { get; set; }
public long EmployeeId { get; set; }
public List<SalaryAidGroupedByEmployeeViewModelItems> SalaryAidViewModels { get; set; }
public List<SalaryAidGroupedByEmployeeViewModelItems> Items { get; set; }
public string TotalAmount { get; set; }
}

View File

@@ -3,15 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.SalaryAid;
public class SalaryAidSearchViewModel
public class SalaryAidSearchViewModel:PaginationRequest
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public long EmployeeId { get; set; }
public long WorkshopId { get; set; }
public int PageIndex { get; set; }
public bool ShowAsGrouped { get; set; }
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Security.Cryptography;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.SalaryAid;
@@ -7,7 +8,7 @@ public class SalaryAidsGroupedViewModel
{
public List<SalaryAidGroupedByEmployeeViewModel> GroupedByEmployee { get; set; }
public List<SalaryAidGroupedByDateViewModel> GroupedByDate { get; set; }
public List<SalaryAidViewModel> SalaryAidListViewModels { get; set; }
public PagedResult<SalaryAidViewModel> List { get; set; }
}

View File

@@ -0,0 +1,15 @@
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
/// <summary>
/// وضعیت ارسال پیامک
/// </summary>
public enum SendStatus
{
All=0,
/// <summary>
/// موفق
/// </summary>
Success,
//ناموفق
Failed,
}

View File

@@ -0,0 +1,54 @@
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; }
}

View File

@@ -0,0 +1,43 @@
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; }
}

View File

@@ -1,14 +1,34 @@
using System;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.SmsResult;
public interface ISmsResultApplication
{
#region ForApi
/// <summary>
/// دریافت لیست پیامکها
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
/// <summary>
/// دریافت اکسپند لیست هر تاریخ
/// </summary>
/// <param name="searchModel"></param>
/// <param name="date"></param>
/// <returns></returns>
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
#endregion
OperationResult Create(CreateSmsResult command);
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
}

View File

@@ -13,7 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\Company.Domain\Company.Domain.csproj" />
<ProjectReference Include="..\CompanyManagement.Infrastructure.Excel\CompanyManagement.Infrastructure.Excel.csproj" />
<ProjectReference Include="..\CompanyManagment.App.Contracts\CompanyManagment.App.Contracts.csproj" />
<ProjectReference Include="..\CompanyManagment.EFCore\CompanyManagment.EFCore.csproj" />
</ItemGroup>

View File

@@ -3,11 +3,9 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Exceptions;
using Company.Domain.CheckoutAgg;
using Company.Domain.CustomizeCheckoutAgg;
using Company.Domain.CustomizeCheckoutTempAgg;
@@ -18,8 +16,6 @@ using Company.Domain.LeaveAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.RollCallAgg.DomainService;
using Company.Domain.RollCallEmployeeAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagement.Infrastructure.Excel.RollCall;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.RollCall;
@@ -38,9 +34,8 @@ public class RollCallApplication : IRollCallApplication
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository;
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
private readonly IWorkshopRepository _workshopRepository;
public RollCallApplication(IRollCallRepository rollCallRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository, IRollCallDomainService rollCallDomainService, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IWorkshopRepository workshopRepository)
public RollCallApplication(IRollCallRepository rollCallRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository, IRollCallDomainService rollCallDomainService, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
{
_rollCallRepository = rollCallRepository;
_rollCallEmployeeRepository = rollCallEmployeeRepository;
@@ -52,8 +47,7 @@ public class RollCallApplication : IRollCallApplication
_customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
_workshopRepository = workshopRepository;
}
}
public OperationResult Create(CreateRollCall command)
{
@@ -864,58 +858,4 @@ public class RollCallApplication : IRollCallApplication
}
}
public async Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallRepository.GetCaseHistoryTitles(workshopId,searchModel);
}
public async Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId,
string titleId, RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallRepository.GetCaseHistoryDetails(workshopId, titleId, searchModel);
}
public async Task<RollCallCaseHistoryExcelDto> DownloadCaseHistoryExcel(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel)
{
var data = await _rollCallRepository
.GetCaseHistoryDetails(workshopId, titleId, searchModel);
string nameSecondPart = "";
byte[] excelBytes;
if (Regex.IsMatch(titleId, @"^\d{4}_\d{2}$"))
{
var splitDate = titleId.Split("_");
var year = Convert.ToInt32(splitDate.First());
var month = Convert.ToInt32(splitDate.Last());
var monthName = Convert.ToInt32(month).ToFarsiMonthByIntNumber();
nameSecondPart = $"{year}/{monthName}";
excelBytes = RollCallExcelGenerator.CaseHistoryExcelForEmployee(data, titleId);
}
else if (Regex.IsMatch(titleId, @"^\d{4}/\d{2}/\d{2}$"))
{
var oneDayDate = titleId.ToGeorgianDateTime();
nameSecondPart = $" {oneDayDate.DayOfWeek.DayOfWeeKToPersian()}،{titleId}";
excelBytes = RollCallExcelGenerator.CaseHistoryExcelForOneDay(data, titleId);
}
else
{
throw new BadRequestException("شناسه سر تیتر وارد شده نامعتبر است");
}
var workshopFullName = _workshopRepository.Get(workshopId)?.WorkshopFullName ?? "بدون کارگاه";
var fileName = $"{workshopFullName} - {nameSecondPart}.xlsx";
var res = new RollCallCaseHistoryExcelDto()
{
Bytes = excelBytes,
MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
FileName = fileName
};
return res;
}
}

View File

@@ -433,7 +433,7 @@ public class SalaryAidApplication : ISalaryAidApplication
var checkouts = _checkoutRepository.GetByWorkshopIdEmployeeIdInDate(
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
checkouts?.SetAmountConflict(true);
checkouts?.SetAmountConflict(true);
}
}

View File

@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
namespace CompanyManagment.Application;
@@ -15,6 +17,23 @@ public class SmsResultApplication : ISmsResultApplication
_smsResultRepository = smsResultRepository;
}
#region ForApi
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
{
return await _smsResultRepository.GetSmsReportList(searchModel);
}
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
{
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
}
#endregion
public OperationResult Create(CreateSmsResult command)
{
var op = new OperationResult();

View File

@@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.EFCore.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompanyManagment.Application;
@@ -15,11 +16,13 @@ public class SmsSettingApplication : ISmsSettingApplication
{
private readonly ISmsSettingsRepository _smsSettingsRepository;
private readonly IInstitutionContractRepository _institutionContractRepository;
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
{
_smsSettingsRepository = smsSettingsRepository;
_institutionContractRepository = institutionContractRepository;
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
}
@@ -116,12 +119,12 @@ public class SmsSettingApplication : ISmsSettingApplication
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
return await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
}
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetBlockListData(DateTime.Now);
return await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
}
@@ -134,7 +137,7 @@ public class SmsSettingApplication : ISmsSettingApplication
if (command.Any())
{
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
await _institutionContractSmsServiceRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
return op.Succcedded();
}
else
@@ -153,7 +156,7 @@ public class SmsSettingApplication : ISmsSettingApplication
string sendMessEnd = "پایان مسدودی آنی ";
if (command.Any())
{
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
await _institutionContractSmsServiceRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
sendMessEnd);
return op.Succcedded();
}

View File

@@ -713,15 +713,10 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
var itemsQuery = _companyContext.EmployeeDocumentItems
.Where(x => x.DocumentStatus != DocumentStatus.Unsubmitted)
.Include(x => x.EmployeeDocuments)
.ThenInclude(x => x.Workshop)
.ThenInclude(x => x.WorkshopEmployers)
.ThenInclude(x => x.Employer)
.GroupBy(x => x.WorkshopId)
.Select(x => new WorkshopWithEmployeeDocumentsViewModel()
.ThenInclude(x => x.Workshop).ThenInclude(x => x.WorkshopEmployers).ThenInclude(x => x.Employer)
.GroupBy(x => x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
{
SubmittedItemsCount = x
.Count(y => y.DocumentStatus == DocumentStatus.SubmittedByAdmin
|| y.DocumentStatus == DocumentStatus.SubmittedByClient),
SubmittedItemsCount = x.Count(y => y.DocumentStatus == DocumentStatus.SubmittedByAdmin || y.DocumentStatus == DocumentStatus.SubmittedByClient),
WorkshopId = x.Key,
WorkshopFullName = x.First().EmployeeDocuments.Workshop.WorkshopName,
EmployerName = x.First().EmployeeDocuments.Workshop.WorkshopEmployers.First().Employer.FullName

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -146,7 +146,7 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
{
YearFa = x.Key.YearFa,
MonthFa = x.Key.MonthFa,
SalaryAidViewModels = x.Select(s => new SalaryAidGroupedByDateViewModelItems()
Items = x.Select(s => new SalaryAidGroupedByDateViewModelItems()
{
Amount = s.Amount,
EmployeeName = s.EmployeeFullName,
@@ -175,7 +175,7 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
EmployeeId = x.Key,
TotalAmount = x.Sum(s => s.Amount).ToMoney(),
EmployeeName = employees.FirstOrDefault(e => e.id == x.Key).FullName,
SalaryAidViewModels = x.Select(s => new SalaryAidGroupedByEmployeeViewModelItems()
Items = x.Select(s => new SalaryAidGroupedByEmployeeViewModelItems()
{
Amount = s.Amount.ToMoney(),
Id = s.id,
@@ -197,23 +197,28 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
query = query.Where(x => x.SalaryAidDateTime >= startDate && x.SalaryAidDateTime <= endDate);
}
result.SalaryAidListViewModels = query.OrderByDescending(x => x.SalaryAidDateTime).Skip(searchModel.PageIndex).Take(30).ToList().Select(
x => new SalaryAidViewModel()
{
Amount = x.Amount.ToMoney(),
CreationDate = x.CreationDate.ToFarsi(),
Id = x.id,
EmployeeId = x.EmployeeId,
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
SalaryAidDateTimeGe = x.SalaryAidDateTime,
WorkshopId = x.WorkshopId,
YearFa = x.SalaryAidDateTime.ToFarsi().Substring(0, 4),
MonthFa = x.SalaryAidDateTime.ToFarsi().Substring(5, 2),
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
AmountDouble = x.Amount,
}).ToList();
result.List = new PagedResult<SalaryAidViewModel>()
{
TotalCount = query.Count(),
List = query.OrderByDescending(x => x.SalaryAidDateTime).ApplyPagination(searchModel.PageIndex,searchModel.PageSize).ToList()
.Select(x => new SalaryAidViewModel()
{
Amount = x.Amount.ToMoney(),
CreationDate = x.CreationDate.ToFarsi(),
Id = x.id,
EmployeeId = x.EmployeeId,
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
SalaryAidDateTimeGe = x.SalaryAidDateTime,
WorkshopId = x.WorkshopId,
YearFa = x.SalaryAidDateTime.ToFarsi().Substring(0, 4),
MonthFa = x.SalaryAidDateTime.ToFarsi().Substring(5, 2),
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode
.ToString(),
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
AmountDouble = x.Amount,
}).ToList()
};
return result;
}

View File

@@ -1,13 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace CompanyManagment.EFCore.Repository;
public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultRepository
public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRepository
{
private readonly CompanyContext _context;
public SmsResultRepository(CompanyContext context) : base(context)
@@ -15,9 +22,263 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
_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)
{
var query = _context.SmsResults.Select(x => new App.Contracts.SmsResult.SmsResultViewModel()
{
Id = x.id,
@@ -64,7 +325,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
var endGr = end.ToGeorgianDateTime();
query = query.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date);
}
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && string.IsNullOrWhiteSpace(searchModel.Month))
{
@@ -74,7 +335,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
var startGr = start.ToGeorgianDateTime();
var endGr = end.ToGeorgianDateTime();
query = query.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date);
}
}
@@ -82,12 +343,12 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
query = query.OrderByDescending(x => x.CreationDate)
.ThenByDescending(x=>x.CreationDate.Hour).ThenByDescending(x=>x.CreationDate.Minute);
.ThenByDescending(x => x.CreationDate.Hour).ThenByDescending(x => x.CreationDate.Minute);
return query.Skip(searchModel.PageIndex).Take(30).ToList();
}
}

View File

@@ -207,16 +207,11 @@ public class SmsService : ISmsService
}
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 (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
{
st = startDate.ToGeorgianDateTime();
}
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
{
ed = endDate.ToGeorgianDateTime();
}
if(startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
return new List<ApiResultViewModel>();
var res = new List<ApiResultViewModel>();
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
@@ -248,6 +243,44 @@ public class SmsService : ISmsService
return res;
}
public async Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate)
{
if (startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
return new List<ApiReportDto>();
var res = new List<ApiReportDto>();
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
int pageNumber = 2;
int pageSize = 100; // max: 100
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
MessageReportResult[] messages = response.Data;
foreach (var message in messages)
{
var appendData = new ApiReportDto()
{
MessageId = message.MessageId,
Mobile = message.Mobile,
SendUnixTime = UnixTimeStampToDateTime(message.SendDateTime),
DeliveryState = DeliveryStatus(message.DeliveryState),
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
};
res.Add(appendData);
}
return res;
}
public string DeliveryStatus(byte? dv)
{
string mess = "";

View File

@@ -563,6 +563,7 @@ public class PersonalBootstrapper
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
services.AddTransient<IInstitutionContractSmsServiceRepository, InstitutionContractSmsServiceRepository>();
#endregion

View File

@@ -209,22 +209,38 @@ public class CreateOrEditCheckoutCommandHandler : IBaseCommandHandler<CreateOrEd
}
}
//حقوق نهایی
var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
////حقوق نهایی
//var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
//// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
//monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
//حقوق کسر شده
var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
////حقوق کسر شده
//var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
//new chang salary compute
var monthlySalaryPay = totalHoursWorked * monthlySalaryDefined;
//زمان باقی مانده
var remainingTime = totalHoursWorked - mandatoryHours;
//تناسب به دقیقه
#region MyRegion
//var monthlySalaryDefinedTest = monthlySalaryDefined * mandatoryHours;
//var monthlySalaryPayTest = totalHoursWorked * monthlySalaryDefined;
////// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
//monthlySalaryPayTest = monthlySalaryPayTest > monthlySalaryDefinedTest ? monthlySalaryDefinedTest : monthlySalaryPayTest;
//////حقوق کسر شده
//var deductionFromSalaryTest = monthlySalaryDefinedTest - monthlySalaryPayTest;
#endregion
var computeResult = new ComputeResultDto
{
MandatoryHours = mandatoryHours,
MonthlySalaryPay = monthlySalaryPay,
DeductionFromSalary = deductionFromSalary,
DeductionFromSalary = 0 /*deductionFromSalary*/,
RemainingHours = remainingTime
};
Console.WriteLine(mandatoryHours);

View File

@@ -1,10 +1,11 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using DNTPersianUtils.Core;
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
using Microsoft.EntityFrameworkCore;
using PersianTools.Core;
using PersianDateTime = PersianTools.Core.PersianDateTime;
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
@@ -45,8 +46,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
var lastMonthStart = lastMonth;
var lastMonthEnd = lastMonth;
//var lastMonthStart = lastMonth;
var lastMonthEnd = ((selectedDate.ToFarsi().FindeEndOfMonth())).ToGeorgianDateTime();
var query =
await (from u in _context.Users
@@ -60,8 +61,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
// LEFT JOIN
//فیش
join ch in _context.Checkouts
.Where(x => x.CheckoutStartDate < lastMonthStart
&& x.CheckoutEndDate >= lastMonthStart)
.Where(x => x.CheckoutStartDate < lastMonthEnd
&& x.CheckoutEndDate > selectedDate)
on u.Id equals ch.UserId into chJoin
from ch in chJoin.DefaultIfEmpty()

View File

@@ -7,5 +7,6 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
{
public long? UserId { get; set; }
public string? SearchText { get; set; }
public TaskSectionStatus? Status { get; set; }
}

View File

@@ -3,7 +3,6 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query.Internal;
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
@@ -24,7 +23,8 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
var currentUserId = _authHelper.GetCurrentUserId();
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero && x.Status != TaskSectionStatus.Completed)
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero
&& x.Status != TaskSectionStatus.Completed)
.Include(x => x.Task)
.ThenInclude(x => x.Phase)
.ThenInclude(x => x.Project)
@@ -45,10 +45,18 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
{
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
}
if (!string.IsNullOrWhiteSpace(request.SearchText))
{
queryable = queryable.Where(x=>x.Task.Name.Contains(request.SearchText)
|| x.Task.Phase.Name.Contains(request.SearchText)
|| x.Task.Phase.Project.Name.Contains(request.SearchText));
}
var data = await queryable.ToListAsync(cancellationToken);
var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList();
var activityUserIds = data.SelectMany(x => x.Activities)
.Select(a => a.UserId).Distinct().ToList();
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
@@ -72,7 +80,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
{
Activity = a,
TimeSpent = timeSpent,
TotalSeconds = timeSpent.TotalSeconds,
timeSpent.TotalSeconds,
FormattedTime = timeSpent.ToString(@"hh\:mm")
};
}).ToList();

View File

@@ -56,6 +56,7 @@ public class ProjectSetTimeDetailsQueryHandler
var skills = await _context.Skills
.AsNoTracking()
.OrderBy(x=>x.CreationDate)
.ToListAsync(cancellationToken);
var res = new ProjectSetTimeResponse(
@@ -84,7 +85,7 @@ public class ProjectSetTimeDetailsQueryHandler
UserId = section?.OriginalAssignedUserId ?? 0,
SkillId = skill.Id,
};
}).OrderBy(x => x.SkillId).ToList(),
}).ToList(),
task.Id,
level);
@@ -114,6 +115,7 @@ public class ProjectSetTimeDetailsQueryHandler
var skills = await _context.Skills
.AsNoTracking()
.OrderBy(x=>x.CreationDate)
.ToListAsync(cancellationToken);
var res = new ProjectSetTimeResponse(
@@ -135,7 +137,7 @@ public class ProjectSetTimeDetailsQueryHandler
UserId = section?.UserId ?? 0,
SkillId = skill.Id,
};
}).OrderBy(x => x.SkillId).ToList(),
}).ToList(),
phase.Id,
level);
@@ -165,6 +167,7 @@ public class ProjectSetTimeDetailsQueryHandler
var skills = await _context.Skills
.AsNoTracking()
.OrderBy(x=>x.CreationDate)
.ToListAsync(cancellationToken);
var res = new ProjectSetTimeResponse(
@@ -186,7 +189,7 @@ public class ProjectSetTimeDetailsQueryHandler
UserId = section?.UserId ?? 0,
SkillId = skill.Id,
};
}).OrderBy(x => x.SkillId).ToList(),
}).ToList(),
project.Id,
level);

View File

@@ -1,12 +1,15 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
public record GetMessagesQuery(
Guid TaskId,
MessageType? MessageType,
int Page = 1,
int PageSize = 50
) : IBaseQuery<PaginationResult<MessageDto>>;
@@ -66,7 +69,12 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
var query = _context.TaskChatMessages
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
.Include(m => m.ReplyToMessage)
.OrderBy(m => m.CreationDate);
.OrderBy(m => m.CreationDate).AsQueryable();
if (request.MessageType.HasValue)
{
query = query.Where(m => m.MessageType == request.MessageType.Value);
}
var totalCount = await query.CountAsync(cancellationToken);

View File

@@ -20,7 +20,7 @@ public class ProjectTask : ProjectHierarchyNode
{
PhaseId = phaseId;
_sections = new List<TaskSection>();
Priority = ProjectTaskPriority.Medium;
Priority = ProjectTaskPriority.Low;
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
}

View File

@@ -8,6 +8,7 @@ using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetPinnedMessages;
using GozareshgirProgramManager.Application.Modules.TaskChat.Queries.SearchMessages;
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
@@ -30,15 +31,17 @@ public class TaskChatController : ProgramManagerBaseController
/// دریافت لیست پیام‌های یک تسک
/// </summary>
/// <param name="taskId">شناسه تسک</param>
/// <param name="messageType">نوع پیام</param>
/// <param name="page">صفحه (پیش‌فرض: 1)</param>
/// <param name="pageSize">تعداد در هر صفحه (پیش‌فرض: 50)</param>
[HttpGet("{taskId:guid}/messages")]
public async Task<ActionResult<OperationResult<PaginationResult<MessageDto>>>> GetMessages(
Guid taskId,
[FromQuery] MessageType? messageType,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 50)
{
var query = new GetMessagesQuery(taskId, page, pageSize);
var query = new GetMessagesQuery(taskId,messageType, page, pageSize);
var result = await _mediator.Send(query);
return result;
}

View File

@@ -0,0 +1,59 @@
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;
}
}

View File

@@ -1289,7 +1289,7 @@
تمدید قرارداد
</p>
</a>
<a permission="30715" class="btn btn-inverse pull-left rad" style="background-color: #f57373;border: 1px solid #f57373;margin-left:5px;"
<a class="btn btn-inverse pull-left rad" style="background-color: #f57373;border: 1px solid #f57373;margin-left:5px;"
asp-page="./FinancialStatments" asp-route-name="@item.ContractingPartyName" asp-route-id="@item.ContractingPartyId" asp-route-pageNumber="0">
<i class="fa fa-file-text-o faSize"></i>
<p>

View File

@@ -1,200 +0,0 @@
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.RollCall;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers.RollCall;
public class RollCallCaseHistoryController : ClientBaseController
{
private readonly IRollCallApplication _rollCallApplication;
private readonly long _workshopId;
private readonly IWorkshopApplication _workshopApplication;
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
public RollCallCaseHistoryController(IRollCallApplication rollCallApplication,
IAuthHelper authHelper, IWorkshopApplication workshopApplication,
IRollCallEmployeeApplication rollCallEmployeeApplication)
{
_rollCallApplication = rollCallApplication;
_workshopApplication = workshopApplication;
_rollCallEmployeeApplication = rollCallEmployeeApplication;
_workshopId = authHelper.GetWorkshopId();
}
[HttpGet]
public async Task<ActionResult<PagedResult<RollCallCaseHistoryTitleDto>>> GetTitles(
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryTitles(_workshopId, searchModel);
}
[HttpGet("details")]
public async Task<ActionResult<List<RollCallCaseHistoryDetail>>> GetDetails(string titleId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
}
/// <summary>
/// ایجاد و ویرایش
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost]
public ActionResult<OperationResult> Upsert(CreateOrEditEmployeeRollCall command)
{
command.WorkshopId = _workshopId;
return _rollCallApplication.ManualEdit(command);
}
[HttpGet("print")]
public async Task<ActionResult<List<RollCallCaseHistoryDetail>>> GetPrintDetails(string titleId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
}
[HttpGet("total-working")]
public ActionResult<OperationResult<string>> OnGetTotalWorking(
string startDate,
string startTime,
string endDate,
string endTime)
{
var op = new OperationResult<string>();
const string emptyValue = "-";
if (!TryParseDateTime(startDate, startTime, out var start) ||
!TryParseDateTime(endDate, endTime, out var end))
{
return op.Succcedded(emptyValue);
}
if (start >= end)
{
return op.Succcedded(emptyValue);
}
var duration = (end - start).ToFarsiHoursAndMinutes(emptyValue);
return op.Succcedded(duration);
}
[HttpGet("excel")]
public async Task<IActionResult> GetDownload(string titleId, RollCallCaseHistorySearchModel searchModel)
{
var res =await _rollCallApplication.DownloadCaseHistoryExcel(_workshopId, titleId, searchModel);
return File(res.Bytes,
res.MimeType,
res.FileName);
}
[HttpGet("edit")]
public ActionResult<EditRollCallDetailsResult> GetEditDetails(string date, long employeeId)
{
var result = _rollCallApplication.GetWorkshopEmployeeRollCallsForDate(_workshopId, employeeId, date);
//var dates = _rollCallApplication.GetEditableDatesForManualEdit(date.ToGeorgianDateTime());
var name = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, _workshopId);
var total = new TimeSpan(result.Sum(x =>
(x.EndDate!.Value.Ticks - x.StartDate!.Value.Ticks)));
var res = new EditRollCallDetailsResult()
{
EmployeeFullName = name.EmployeeFullName,
EmployeeId = employeeId,
DateFa = date,
//EditableDates = dates,
Records = result.Select(x=>new EmployeeRollCallRecord()
{
Date = x.DateGr,
EndDate = x.EndDateFa,
EndTime = x.EndTimeString,
RollCallId = x.Id,
StartDate = x.StartDateFa,
StartTime = x.StartTimeString
}).ToList(),
TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
};
return res;
}
[HttpPost("edit")]
public ActionResult<OperationResult> Edit(CreateOrEditEmployeeRollCall command)
{
command.WorkshopId = _workshopId;
var result = _rollCallApplication.ManualEdit(command);
return result;
}
[HttpDelete("delete")]
public IActionResult OnPostRemoveEmployeeRollCallsInDate(RemoveEmployeeRollCallRequest request)
{
var result = _rollCallApplication.RemoveEmployeeRollCallsInDate(_workshopId, request.EmployeeId, request.Date);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message,
});
}
// [HttpGet("edit")]
// public ActionResult<> GetEditDetails(string date,long employeeId)
// {
// var result = _rollCallApplication.GetWorkshopEmployeeRollCallsForDate(_workshopId, employeeId, date);
// //var dates = _rollCallApplication.GetEditableDatesForManualEdit(date.ToGeorgianDateTime());
// var name = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, _workshopId);
//
// var total = new TimeSpan(result.Sum(x =>
// (x.EndDate!.Value.Ticks - x.StartDate!.Value.Ticks)));
//
// var command = new EmployeeRollCallsViewModel()
// {
// EmployeeFullName = name.EmployeeFullName,
// EmployeeId = employeeId,
// DateFa = date,
// //EditableDates = dates,
// RollCalls = result,
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
// };
// }
private static bool TryParseDateTime(string date, string time, out DateTime result)
{
result = default;
try
{
var dateTime = date.ToGeorgianDateTime();
var timeOnly = TimeOnly.Parse(time);
result = dateTime.AddTicks(timeOnly.Ticks);
return true;
}
catch
{
return false;
}
}
}
public class EditRollCallDetailsResult
{
public string EmployeeFullName { get; set; }
public long EmployeeId { get; set; }
public string DateFa { get; set; }
public string TotalRollCallsDuration { get; set; }
public List<EmployeeRollCallRecord> Records { get; set; }
}
public class RemoveEmployeeRollCallRequest
{
public long EmployeeId { get; set; }
public string Date { get; set; }
}

View File

@@ -0,0 +1,138 @@
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.SalaryAid;
using CompanyManagment.App.Contracts.SalaryAid;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Build.Evaluation;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers;
public class SalaryAidController:ClientBaseController
{
private readonly ISalaryAidApplication _salaryAidApplication;
private readonly long _workshopId;
private readonly SalaryAidImportExcel _salaryAidImportExcel;
public SalaryAidController(ISalaryAidApplication salaryAidApplication,IAuthHelper authHelper, SalaryAidImportExcel salaryAidImportExcel)
{
_salaryAidApplication = salaryAidApplication;
_salaryAidImportExcel = salaryAidImportExcel;
_workshopId = authHelper.GetWorkshopId();
}
[HttpGet]
public ActionResult<SalaryAidsGroupedViewModel> GetList([FromQuery]SalaryAidSearchViewModel searchModel)
{
searchModel.WorkshopId = _workshopId;
var result = _salaryAidApplication.GetSearchListAsGrouped(searchModel);
return Ok(result);
}
[HttpPost]
public ActionResult<OperationResult> Create([FromBody]CreateSalaryAidRequest request)
{
var command = new CreateSalaryAidViewModel()
{
Amount = request.Amount.ToMoney(),
CalculationMonth = request.CalculationMonth,
CalculationYear = request.CalculationYear,
EmployeeIds = request.EmployeeIds,
WorkshopId = _workshopId,
SalaryDateTime = request.SalaryDateTime,
};
var result = _salaryAidApplication.Create(command);
return result;
}
[HttpPut]
public ActionResult<OperationResult> Edit([FromBody]EditSalaryAidRequest request)
{
var command = new EditSalaryAidViewModel()
{
Id = request.Id,
Amount = request.Amount.ToMoney(),
CalculationMonth = request.CalculationMonth,
CalculationYear = request.CalculationYear,
SalaryDateTime = request.SalaryDateTime,
WorkshopId = _workshopId,
};
var result = _salaryAidApplication.Edit(command);
return result;
}
[HttpGet("{id}")]
public ActionResult<EditSalaryAidRequest> EditDetails(long id)
{
var data = _salaryAidApplication.GetDetails(id);
var res = new EditSalaryAidRequest()
{
Id = data.Id,
Amount = data.Amount.MoneyToDouble(),
CalculationMonth = data.CalculationMonth,
CalculationYear = data.CalculationYear,
SalaryDateTime = data.SalaryDateTime,
};
return res;
}
[HttpDelete("{id:long}")]
public ActionResult<OperationResult> Delete(long id)
{
var result = _salaryAidApplication.Remove(id);
return result;
}
[HttpPost("validate-excel")]
public ActionResult<ExcelValidation<SalaryAidImportData>> ValidateExcel([FromForm]ValidateExcelRequest request)
{
var validation = _salaryAidImportExcel.ReadAndValidateExcel(request.Excel, _workshopId);
return validation;
}
[HttpPost("create-from-excel")]
public async Task<ActionResult<OperationResult>> OnPostCreateFromExcelData(List<SalaryAidImportData> data)
{
var commands = data.Select(x => new CreateSalaryAidViewModel()
{
WorkshopId = x.WorkshopId,
Amount = x.Amount.ToMoney(),
EmployeeIds = [x.EmployeeId],
SalaryDateTime = x.SalaryAidDateTime,
NationalCode = x.NationalCode,
CalculationMonth = x.calculationMonth,
CalculationYear = x.calculationYear
}).ToList();
OperationResult result = await _salaryAidApplication.CreateRangeAsync(commands);
return new JsonResult(new
{
result.IsSuccedded,
result.Message
});
}
}
public class ValidateExcelRequest
{
public IFormFile Excel { get; set; }
}
public class EditSalaryAidRequest
{
public long Id { get; set; }
public long EmployeeId { get; set; }
public double Amount { get; set; }
public string SalaryDateTime { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }
}
public class CreateSalaryAidRequest
{
public List<long> EmployeeIds { get; set; }
public double Amount { get; set; }
public string SalaryDateTime { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }
}

View File

@@ -250,7 +250,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
var span = end - start;
var hours = (int)span.TotalHours;
var minutes = span.Minutes;
if (hours > 0 && minutes > 0)
{
return new JsonResult(new

View File

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.BaseControllers;
[Authorize(Policy = "AdminArea")]

View File

@@ -42,15 +42,6 @@ public class GeneralController : GeneralBaseController
currentDate
});
}
[HttpGet("persian-day-of-week")]
public ActionResult<OperationResult<string>> OnGetDayOfWeek(string dateFa)
{
var op = new OperationResult<string>();
if (!dateFa.TryToGeorgianDateTime(out DateTime date))
return op.Failed("تاریخ وارد شده نامعتبر است");
return op.Succcedded(date.DayOfWeek.DayOfWeeKToPersian());
}
// [HttpGet("pm-permissions")]
// public IActionResult GetPMPermissions()
@@ -105,8 +96,44 @@ public class GeneralController : GeneralBaseController
var statusCode = isSuccess ? "1" : "0";
return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}";
}
}
public class TokenReq
{
public long Amount { get; set; }
public string CallbackUrl { get; set; }
[Display(Name = "شماره فاکتور")]
[MaxLength(100)]
[Required]
[Key]
// be ezaye har pazirande bayad yekta bashad
public string invoiceID { get; set; }
[Required] public long terminalID { get; set; }
/*
* JSON Bashad
* etelaate takmili site harchi
* nabayad char khas dashte bashe (*'"xp_%!+- ...)
*/
public string Payload { get; set; } = "";
public string email { get; set; }
}
public class TokenResp
{
// if 0 = success
public int Status { get; set; }
public string AccessToken { get; set; }
}
public class PayRequest
{
[Required] [MaxLength(3000)] public string token { get; set; }
[Required] public long terminalID { get; set; }
public string nationalCode { get; set; }
}
public class SepehrGatewayPayResponse
@@ -142,4 +169,10 @@ public class SepehrGatewayPayResponse
public string issuerbank { get; set; }
[Display(Name = " شماره کارت ")] public string cardnumber { get; set; }
}
public class AdviceReq
{
[Display(Name = " رسید دیجیتال ")] public string digitalreceipt { get; set; }
public long Tid { get; set; }
}

View File

@@ -19,7 +19,7 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
"applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5005",
"applicationUrl": "https://localhost:5004;http://localhost:5003;",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},