Merge branch 'Feature/Checkout/client-api' into Main
This commit is contained in:
@@ -80,4 +80,6 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
#endregion
|
||||
|
||||
Task<Checkout> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate);
|
||||
Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,
|
||||
CheckoutListClientSearchModel searchModel);
|
||||
}
|
||||
@@ -62,4 +62,40 @@ public interface ICheckoutApplication
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
#endregion
|
||||
|
||||
Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,
|
||||
CheckoutListClientSearchModel searchModel);
|
||||
}
|
||||
|
||||
public class CheckoutListClientSearchModel:PaginationRequest
|
||||
{
|
||||
public long? EmployeeId { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string StartDate { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
public CheckoutClientListOrderType? OrderType { get; set; }
|
||||
}
|
||||
|
||||
public class CheckoutListClientDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string EmployeeName { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public bool Signature { get; set; }
|
||||
}
|
||||
|
||||
public enum CheckoutClientListOrderType
|
||||
{
|
||||
ByCheckoutCreationDate,
|
||||
BySignedCheckout,
|
||||
ByUnSignedCheckout,
|
||||
ByPersonnelCode,
|
||||
ByPersonnelCodeDescending,
|
||||
ByCheckoutStartDate,
|
||||
ByCheckoutStartDateDescending
|
||||
}
|
||||
@@ -706,5 +706,10 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
|
||||
}
|
||||
|
||||
public async Task<PagedResult<CheckoutListClientDto>> GetListForClient(long workshopId,CheckoutListClientSearchModel searchModel)
|
||||
{
|
||||
return await _checkoutRepository.GetListForClient(workshopId, searchModel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
25
ServiceHost/Areas/Client/Controllers/CheckoutController.cs
Normal file
25
ServiceHost/Areas/Client/Controllers/CheckoutController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user