merge from AdminCheckoutApi
This commit is contained in:
@@ -474,6 +474,30 @@ public static class Tools
|
||||
|
||||
return myMoney.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// اگر مبلغ صفر باشد خط تیره برمیگرداند
|
||||
/// </summary>
|
||||
/// <param name="myMoney"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToMoneyCheckZero(this double myMoney)
|
||||
{
|
||||
if (myMoney == 0)
|
||||
return "-";
|
||||
return myMoney.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// اگر مبلغ صفر یا نال باشد خط تیره برمیگرداند
|
||||
/// </summary>
|
||||
/// <param name="myMoney"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToMoneyCheckZeroNullable(this double? myMoney)
|
||||
{
|
||||
if (myMoney == 0 || myMoney == null)
|
||||
return "-";
|
||||
return myMoney?.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
|
||||
}
|
||||
public static string ToMoneyNullable(this double? myMoney)
|
||||
{
|
||||
|
||||
|
||||
@@ -86,6 +86,12 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// دریافت سلکت لیست پرسنل کارگاه
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست فیش حقوقی
|
||||
@@ -94,5 +100,14 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
/// <returns></returns>
|
||||
Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// پرینت فیش حقوقی
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -106,4 +106,14 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// دریافت لیست کارگاه های ادمین برای سلکت تو
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList();
|
||||
|
||||
#endregion
|
||||
}
|
||||
247
CompanyManagment.App.Contracts/Checkout/Dto/CheckoutPrintDto.cs
Normal file
247
CompanyManagment.App.Contracts/Checkout/Dto/CheckoutPrintDto.cs
Normal file
@@ -0,0 +1,247 @@
|
||||
using System;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
|
||||
public class CheckoutPrintDto
|
||||
{
|
||||
// هدر فیش
|
||||
// اطلاعات هویتی
|
||||
// اطلاعات کارگاه
|
||||
#region Header
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FathersName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره قراداد
|
||||
/// </summary>
|
||||
public string ContractNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ماه
|
||||
/// </summary>
|
||||
public string Month { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// سال
|
||||
/// </summary>
|
||||
public string Year { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارفرما
|
||||
/// </summary>
|
||||
public List<CheckoutEmployersList> EmployersLists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا کارقرما حقوقی است
|
||||
/// </summary>
|
||||
public bool EmployerIslegal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا ترک کار کرده
|
||||
/// </summary>
|
||||
public bool HasLeft { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آخرین روز کاری
|
||||
/// </summary>
|
||||
public string LastDayOfWork { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// روز ترک کار
|
||||
/// </summary>
|
||||
public string LeftWorkDate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
//جدول مطالبات و کسورات
|
||||
#region PaymentAndDeductionTable
|
||||
/// <summary>
|
||||
/// مطالبات
|
||||
/// </summary>
|
||||
public List<PaymentAndDeductionList> PaymentList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کسورات
|
||||
/// </summary>
|
||||
public List<PaymentAndDeductionList> DeductionList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع مطالبات
|
||||
/// </summary>
|
||||
public string TotalPayment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کسورات
|
||||
/// </summary>
|
||||
public string TotalDeductions { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string TotalClaims { get; set; }
|
||||
#endregion
|
||||
|
||||
//لیست ورود و خروج پرسنل
|
||||
//اطلاعات ساعات کار و موظقی
|
||||
#region RollCallData
|
||||
/// <summary>
|
||||
/// لیست حضورغیاب
|
||||
/// </summary>
|
||||
public List<CheckoutPrintRollCallDto> MonthlyRollCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// دیتای جدول حضورغیاب
|
||||
/// </summary>
|
||||
public CheckoutRollCallViewModel CheckoutRollCall { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
//اقساط - مساعده
|
||||
#region SalaryAidAndInstallmentData
|
||||
|
||||
public List<CheckoutPrintInstallmentDto> Installments { get; set; }
|
||||
public List<CheckoutPrintSalaryAidDto> SalaryAids { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// کسورات
|
||||
/// </summary>
|
||||
public class PaymentData
|
||||
{
|
||||
/// <summary>
|
||||
/// حقوق و مزد
|
||||
/// </summary>
|
||||
public string MonthlySalary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پایه سنوات
|
||||
/// </summary>
|
||||
public string BaseYearsPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کمک هزینه اقلام مصرفی
|
||||
/// </summary>
|
||||
public string ConsumableItems { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کمک هزینه مسکن
|
||||
/// </summary>
|
||||
public string HousingAllowance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فوق العاده اضافه کاری
|
||||
/// </summary>
|
||||
public string OvertimePay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فوق العاده شبکاری
|
||||
/// </summary>
|
||||
public string NightworkPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فوق العاده جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فوق العاده ماموریت
|
||||
/// </summary>
|
||||
public string MissionPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فوق العاده نوبت کاری
|
||||
/// </summary>
|
||||
public string ShiftPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کمک هزینه عائله مندی
|
||||
/// </summary>
|
||||
public string FamilyAllowance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// </summary>
|
||||
public string MarriedAllowance { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// کسورات
|
||||
/// </summary>
|
||||
public class DeductionData
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class PaymentAndDeductionList
|
||||
{
|
||||
public int RowNumber { get; set; }
|
||||
/// <summary>
|
||||
/// عنوان
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار/روز/ساعت
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ
|
||||
/// </summary>
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارفرما
|
||||
/// </summary>
|
||||
public class CheckoutEmployersList
|
||||
{
|
||||
public string IsLegal { get; set; }
|
||||
public string EmployerFullName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class CheckoutGetData : CheckoutPrintDto
|
||||
{
|
||||
public DateTime ContractStart { get; set; }
|
||||
|
||||
public int PersonnelCode { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
|
||||
public class ContractsListToCreateCheckoutDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی قراداد
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد پرسنلی
|
||||
/// </summary>
|
||||
public long PersonnelCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره قرارداد
|
||||
/// </summary>
|
||||
public string ContractNo { get; set; }
|
||||
|
||||
//نام کارگاه
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شوع فیش
|
||||
/// </summary>
|
||||
public string ContractStart { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ پایان فیش
|
||||
/// </summary>
|
||||
public string ContractEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ترک کار
|
||||
/// </summary>
|
||||
public string LeftWorkDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت ایجاد فیش
|
||||
/// </summary>
|
||||
public CreateCheckoutStatus CreateCheckoutStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت ایجاد فیش
|
||||
/// </summary>
|
||||
public enum CreateCheckoutStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// آماده ایجاد
|
||||
/// </summary>
|
||||
ReadyToCreate,
|
||||
|
||||
/// <summary>
|
||||
/// غیر مجاز
|
||||
/// </summary>
|
||||
NotValid,
|
||||
|
||||
/// <summary>
|
||||
/// دارای فیش حقوقی
|
||||
/// </summary>
|
||||
HasCheckout,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
|
||||
public class EmployeeSelectListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی پرسنل
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeFullName { get; set; }
|
||||
}
|
||||
@@ -69,6 +69,13 @@ public interface ICheckoutApplication
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت سلکت لیست پرسنل کارگاه
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست فیش های حقوقی ادمین
|
||||
/// </summary>
|
||||
@@ -83,9 +90,41 @@ public interface ICheckoutApplication
|
||||
/// <returns></returns>
|
||||
Task<RotatingShiftOfCheckoutDto> GetRotatingShiftApi(long id);
|
||||
|
||||
/// <summary>
|
||||
/// پرینت فیش حقوقی
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست قراردادها برای ایجاد فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<List<ContractsListToCreateCheckoutDto>>> GetContractToCreateCheckout(long workshopId,
|
||||
string year, string month, long employeeId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CheckoutPrintInstallmentDto
|
||||
{
|
||||
public string RemainingAmount { get; set; }
|
||||
public string LoanAmount { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
public class CheckoutPrintSalaryAidDto
|
||||
{
|
||||
public string Amount { get; set; }
|
||||
public string SalaryAidDateTimeFa { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckoutListClientSearchModel:PaginationRequest
|
||||
{
|
||||
public long? EmployeeId { get; set; }
|
||||
|
||||
@@ -45,4 +45,42 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
}
|
||||
#endregion
|
||||
|
||||
public class CheckoutPrintRollCallDto
|
||||
{
|
||||
|
||||
public string RollCallDateFa { get; set; }
|
||||
public string StartDate1 { get; set; }
|
||||
public string EndDate1 { get; set; }
|
||||
|
||||
public string StartDate2 { get; set; }
|
||||
public string EndDate2 { get; set; }
|
||||
|
||||
//منقطع بودن شیفت کاری
|
||||
public bool IsSliced { get; set; }
|
||||
|
||||
public string TotalWorkingHours { get; set; }
|
||||
|
||||
public string DayOfWeek { get; set; }
|
||||
|
||||
public string BreakTimeString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اگر مرخصی نداشته باشد خالی خواهد بود، اگر داشته باشد نوع مرخصی جانشانی می شود
|
||||
/// </summary>
|
||||
public string LeaveType { get; set; }
|
||||
|
||||
public bool IsAbsent { get; set; }
|
||||
public bool IsFriday { get; set; }
|
||||
public bool IsHoliday { get; set; }
|
||||
public bool IsBirthDay { get; set; }
|
||||
|
||||
|
||||
public string EnterDifferencesMinutes1 { get; set; }
|
||||
public string ExitDifferencesMinutes1 { get; set; }
|
||||
|
||||
public string EnterDifferencesMinutes2 { get; set; }
|
||||
public string ExitDifferencesMinutes2 { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
|
||||
|
||||
public class AdminWorkshopSelectListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی کارگاه
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد بایگانی
|
||||
/// </summary>
|
||||
public string ArchiveCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا بلاک شده است
|
||||
/// </summary>
|
||||
public bool IsBlock { get; set; }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.Workshop.DTOs;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -95,6 +96,17 @@ public interface IWorkshopApplication
|
||||
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست کارگاه های ادمین برای سلکت تو
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CreateWorkshopWorkflowRegistration
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@ using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.EmployeeChildren;
|
||||
@@ -1131,5 +1132,16 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList()
|
||||
{
|
||||
return await _workshopRepository.GetAdminWorkshopSelectList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -956,7 +956,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
Amount = s.Amount,
|
||||
AmountDouble = s.Amount.MoneyToDouble(),
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime,
|
||||
}).ToList(),
|
||||
CheckoutRollCall = item.CheckoutRollCall != null
|
||||
? new CheckoutRollCallViewModel()
|
||||
@@ -2816,10 +2816,44 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
///ایجاد فیش
|
||||
#region CreateCheckout
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت سلکت لیست پرسنل کارگاه
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id)
|
||||
{
|
||||
var employeesHasLeftworkData = _context.LeftWorkList.Where(x => x.WorkshopId == id).Select(x => x.EmployeeId);
|
||||
var employees = await _context.Employees
|
||||
.Where(x => employeesHasLeftworkData.Contains(x.id))
|
||||
.Select(x =>
|
||||
new EmployeeSelectListDto()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FullName
|
||||
})
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return employees;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel)
|
||||
{
|
||||
var acountID = _authHelper.CurrentAccountId();
|
||||
@@ -2827,43 +2861,40 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.Select(x => x.WorkshopId);
|
||||
|
||||
|
||||
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
var checkouts =
|
||||
(
|
||||
from workshop in _context.Workshops.Where(x => workshopAccounts.Contains(x.id))
|
||||
join x in _context.CheckoutSet
|
||||
on workshop.id equals x.WorkshopId
|
||||
select new
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
EmployeeId = x.EmployeeId,
|
||||
ContractStart = x.ContractStart,
|
||||
ContractEnd = x.ContractEnd,
|
||||
PersonnelCode = x.PersonnelCode,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
IsActiveString = x.IsActiveString,
|
||||
Signature = x.Signature,
|
||||
IsUpdateNeeded = x.IsUpdateNeeded,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ArchiveCode = workshop.ArchiveCode,
|
||||
WorkshopName = workshop.WorkshopFullName,
|
||||
WorkshopSignCheckout = workshop.SignCheckout,
|
||||
|
||||
}
|
||||
|
||||
).OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year)
|
||||
.ThenByDescending(x=>x.ContractStart)
|
||||
.ThenBy(x => x.PersonnelCode).AsNoTracking();
|
||||
watch.Start();
|
||||
var checkouts =
|
||||
(
|
||||
from workshop in _context.Workshops.Where(x => workshopAccounts.Contains(x.id))
|
||||
join x in _context.CheckoutSet
|
||||
on workshop.id equals x.WorkshopId
|
||||
select new
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
EmployeeId = x.EmployeeId,
|
||||
ContractStart = x.ContractStart,
|
||||
ContractEnd = x.ContractEnd,
|
||||
PersonnelCode = x.PersonnelCode,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
IsActiveString = x.IsActiveString,
|
||||
Signature = x.Signature,
|
||||
IsUpdateNeeded = x.IsUpdateNeeded,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ArchiveCode = workshop.ArchiveCode,
|
||||
WorkshopName = workshop.WorkshopFullName,
|
||||
WorkshopSignCheckout = workshop.SignCheckout,
|
||||
}
|
||||
).OrderByDescending(x => x.Id)
|
||||
.ThenByDescending(x => x.Year)
|
||||
.ThenByDescending(x => x.ContractStart)
|
||||
.ThenBy(x => x.PersonnelCode).AsNoTracking();
|
||||
|
||||
Console.WriteLine("getList======================= : " + watch.Elapsed);
|
||||
|
||||
|
||||
#region SercheModel
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo))
|
||||
@@ -2875,10 +2906,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
.OrderByDescending(x => x.ContractStart)
|
||||
.ThenBy(x => x.PersonnelCode);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
||||
{
|
||||
checkouts = checkouts.Where(x => x.EmployeeFullName.Contains(searchModel.EmployeeFullName));
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId != 0)
|
||||
{
|
||||
var workshopIds = _context.WorkshopEmployers.Where(e => e.EmployerId == searchModel.EmployerId)
|
||||
@@ -2888,16 +2921,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//سرچ سال
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Year) && string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||
(string.IsNullOrWhiteSpace(searchModel.ContractStart) ||
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd)))
|
||||
{
|
||||
|
||||
var startYear = searchModel.Year + "/01/01";
|
||||
var startyearGr = startYear.ToGeorgianDateTime();
|
||||
var endYear = $"{searchModel.Year}/12/01".FindeEndOfMonth();
|
||||
@@ -2905,15 +2934,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
|
||||
checkouts = checkouts.Where(x => x.ContractStart >= startyearGr && x.ContractEnd <= endYearGr);
|
||||
if (searchModel.WorkshopId > 0 || !string.IsNullOrWhiteSpace(searchModel.EmployeeFullName) || searchModel.EmployerId > 0)
|
||||
if (searchModel.WorkshopId > 0 || !string.IsNullOrWhiteSpace(searchModel.EmployeeFullName) ||
|
||||
searchModel.EmployerId > 0)
|
||||
checkouts = checkouts.OrderByDescending(x => x.ContractEnd);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.ContractEnd))
|
||||
{
|
||||
|
||||
//سرچ سال و ماه
|
||||
string y1 = $"{searchModel.Year}/{searchModel.Month}/01";
|
||||
var startDate = y1.ToGeorgianDateTime();
|
||||
@@ -3027,42 +3055,41 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
endDate >= x.ContractEnd && startDate < x.ContractEnd);
|
||||
//if (searchModel.WorkshopId > 0 || searchModel.EmployeeId > 0 || searchModel.EmployerId > 0)
|
||||
// checkouts = checkouts.OrderBy(x => x.PersonnelCodeInt);
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) &&
|
||||
!string.IsNullOrWhiteSpace(searchModel.ContractEnd) &&
|
||||
string.IsNullOrWhiteSpace(searchModel.Year) && string.IsNullOrWhiteSpace(searchModel.Month))
|
||||
{
|
||||
|
||||
//سرچ تاریخ
|
||||
var start = searchModel.ContractStart.ToGeorgianDateTime();
|
||||
var endd = searchModel.ContractEnd.ToGeorgianDateTime();
|
||||
checkouts = checkouts.Where(x =>
|
||||
x.ContractStart >= start && x.ContractStart <= endd);
|
||||
|
||||
if (searchModel.WorkshopId > 0 || !string.IsNullOrWhiteSpace(searchModel.EmployeeFullName) || searchModel.EmployerId > 0)
|
||||
if (searchModel.WorkshopId > 0 || !string.IsNullOrWhiteSpace(searchModel.EmployeeFullName) ||
|
||||
searchModel.EmployerId > 0)
|
||||
checkouts = checkouts.OrderByDescending(x => x.ContractEnd).ThenBy(x => x.PersonnelCode);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
watch.Reset();
|
||||
watch.Start();
|
||||
|
||||
var checkoutQueryFilter = await checkouts.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
|
||||
var checkoutQueryFilter =
|
||||
await checkouts.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
Console.WriteLine("pagination===================== : " + watch.Elapsed);
|
||||
|
||||
var employers =await
|
||||
var employers = await
|
||||
_context.WorkshopEmployers.Where(x => checkoutQueryFilter
|
||||
.Select(c => c.WorkshopId).Contains(x.WorkshopId))
|
||||
.Select(x=> new {x.Employer, x.WorkshopId}).ToListAsync();
|
||||
.Select(x => new { x.Employer, x.WorkshopId }).ToListAsync();
|
||||
var contractingPartiesIds = employers.Select(x => x.Employer.ContractingPartyId).ToList();
|
||||
var warningMessages = await _context.CheckoutWarningMessages.Where(x => checkoutQueryFilter
|
||||
.Select(c => c.Id).Contains(x.CheckoutId)).ToListAsync();
|
||||
|
||||
|
||||
|
||||
var contractnigParties = await _context.PersonalContractingParties
|
||||
.Where(x => contractingPartiesIds.Contains(x.id)).ToListAsync();
|
||||
|
||||
@@ -3077,7 +3104,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
var warningMessage = warningMessages.Where(wm => wm.CheckoutId == x.Id);
|
||||
var empl = employers.First(em => em.WorkshopId == x.WorkshopId);
|
||||
var isBlock = contractnigParties.Any(cp => cp.id == empl.Employer.ContractingPartyId && cp.IsBlock == "true");
|
||||
var isBlock =
|
||||
contractnigParties.Any(cp => cp.id == empl.Employer.ContractingPartyId && cp.IsBlock == "true");
|
||||
var option = options.FirstOrDefault(o => o.WorkshopId == x.WorkshopId && o.EmployeeId == x.EmployeeId);
|
||||
return new CheckoutDto
|
||||
{
|
||||
@@ -3102,13 +3130,10 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
|
||||
})
|
||||
.ToList();
|
||||
.ToList();
|
||||
var count = await checkouts.CountAsync();
|
||||
Console.WriteLine("FinalList================================ : " + watch.Elapsed);
|
||||
return new PagedResult<CheckoutDto>()
|
||||
@@ -3118,5 +3143,322 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پرینت فیش حقوقی
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids)
|
||||
{
|
||||
if (ids.Count == 0)
|
||||
return new List<CheckoutPrintDto>();
|
||||
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
|
||||
var getCheckouts = await _context.CheckoutSet.Where(x => ids.Contains(x.id))
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
var employers = await _context.WorkshopEmployers
|
||||
.Where(x => x.WorkshopId == getCheckouts.First().WorkshopId).AsNoTracking()
|
||||
.Select(x => new CheckoutEmployersList
|
||||
{
|
||||
IsLegal = x.Employer.IsLegal,
|
||||
EmployerFullName = x.Employer.FullName
|
||||
}).ToListAsync();
|
||||
|
||||
var employees =
|
||||
(from x in _context.Employees.Where(x => getCheckouts.Select(ch => ch.EmployeeId).Contains(x.id))
|
||||
select new
|
||||
{
|
||||
EmployeeId = x.id,
|
||||
MaritalStatus = x.MaritalStatus
|
||||
}
|
||||
).AsNoTracking();
|
||||
var workshop = await _context.Workshops.AsNoTracking().FirstAsync(x => x.id == getCheckouts.First().WorkshopId);
|
||||
var showSumOfPayments = workshop.TotalPaymentHide;
|
||||
bool isLegal = employers.Any(x => x.IsLegal == "حقوقی");
|
||||
|
||||
var leftWorks = await _context.LeftWorkList.AsNoTracking()
|
||||
.Where(x => x.WorkshopId == workshop.id).ToListAsync();
|
||||
|
||||
var result = getCheckouts.Select(x =>
|
||||
{
|
||||
var leftCheck = leftWorks
|
||||
.FirstOrDefault(l =>
|
||||
l.EmployeeId == x.EmployeeId && x.ContractStart >= l.StartWorkDate &&
|
||||
x.ContractStart <= l.LeftWorkDate && l.HasLeft);
|
||||
bool hasLeft = false;
|
||||
var leftWorkDate = "";
|
||||
var lastDayOfWork = "";
|
||||
if (leftCheck != null)
|
||||
{
|
||||
var contractLeftWorkDate = x.ContractEnd.AddDays(1);
|
||||
if (leftCheck.HasLeft && leftCheck.LeftWorkDate == contractLeftWorkDate)
|
||||
{
|
||||
hasLeft = true;
|
||||
leftWorkDate = leftCheck.LeftWorkDate.ToFarsi();
|
||||
lastDayOfWork = x.ContractEnd.ToFarsi();
|
||||
}
|
||||
}
|
||||
|
||||
var overTimeWorkValue = x.OvertimePay > 0 ? x.OverTimeWorkValue : "-";
|
||||
var overNightWorkValue = x.NightworkPay > 0 ? x.OverNightWorkValue : "-";
|
||||
var fridayWorkValue = x.FridayPay > 0 ? x.FridayWorkValue : "-";
|
||||
var maritalStatus = employees.First(e => e.EmployeeId == x.EmployeeId).MaritalStatus;
|
||||
var rewardPay = x.RewardPay == null ? "-" : x.RewardPay.ToMoneyCheckZeroNullable();
|
||||
var rotatingShiftValue = x.ShiftPay > 0 ? x.RotatingShiftValue : "-";
|
||||
var totalDeduction = "-";
|
||||
var totalPayment = "-";
|
||||
var totalClaims = "-";
|
||||
if (showSumOfPayments)
|
||||
{
|
||||
totalDeduction = x.TotalDeductions;
|
||||
totalPayment = x.TotalPayment.ToMoneyCheckZero();
|
||||
totalClaims = x.TotalClaims;
|
||||
}
|
||||
|
||||
List<CheckoutPrintRollCallDto> rollcalls = [];
|
||||
TimeSpan TotalPresentTimeSpan;
|
||||
TimeSpan TotalBreakTimeSpan;
|
||||
TimeSpan TotalWorkingTimeSpan;
|
||||
TimeSpan TotalPaidLeaveTmeSpan;
|
||||
TimeSpan TotalMandatoryTimeSpan;
|
||||
TimeSpan TotalSickLeaveTimeSpan;
|
||||
if (x.CheckoutRollCall != null)
|
||||
{
|
||||
TotalMandatoryTimeSpan = x.CheckoutRollCall.TotalPresentTimeSpan;
|
||||
TotalBreakTimeSpan = x.CheckoutRollCall.TotalBreakTimeSpan;
|
||||
TotalWorkingTimeSpan = x.CheckoutRollCall.TotalWorkingTimeSpan;
|
||||
TotalPaidLeaveTmeSpan = x.CheckoutRollCall.TotalPaidLeaveTmeSpan;
|
||||
TotalMandatoryTimeSpan = x.CheckoutRollCall.TotalMandatoryTimeSpan;
|
||||
TotalSickLeaveTimeSpan = x.CheckoutRollCall.TotalSickLeaveTimeSpan;
|
||||
rollcalls = x.CheckoutRollCall.RollCallDaysCollection.Select(r => new CheckoutPrintRollCallDto()
|
||||
{
|
||||
DayOfWeek = r.Date.DayOfWeek.DayOfWeeKToPersian(),
|
||||
StartDate1 = r.FirstStartDate,
|
||||
EndDate1 = r.FirstEndDate,
|
||||
StartDate2 = r.SecondStartDate,
|
||||
EndDate2 = r.SecondEndDate,
|
||||
IsSliced = r.IsSliced,
|
||||
LeaveType = r.LeaveType,
|
||||
IsAbsent = r.IsAbsent,
|
||||
IsFriday = r.IsFriday,
|
||||
IsHoliday = r.IsHoliday,
|
||||
TotalWorkingHours = $"{(int)(r.WorkingTimeSpan.TotalHours)}:{r.WorkingTimeSpan.Minutes:00}",
|
||||
BreakTimeString = $"{(int)(r.BreakTimeSpan.TotalHours)}:{r.BreakTimeSpan.Minutes:00}",
|
||||
RollCallDateFa = r.Date.ToFarsi()
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// if (x.HasRollCall)
|
||||
// x.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(x.EmployeeId, x.WorkshopId,
|
||||
// x.ContractStartGr, x.ContractEndGr);
|
||||
// else
|
||||
// {
|
||||
// x.CreateWorkingHoursTemp.ContractStartGr = x.ContractStartGr;
|
||||
// x.CreateWorkingHoursTemp.ContractEndGr = x.ContractEndGr;
|
||||
// x.CreateWorkingHoursTemp.ContarctStart = x.ContractStartGr.ToFarsi();
|
||||
// x.CreateWorkingHoursTemp.ContractEnd = x.ContractEndGr.ToFarsi();
|
||||
// x.CreateWorkingHoursTemp.EmployeeId = x.EmployeeId;
|
||||
// x.CreateWorkingHoursTemp.WorkshopId = x.WorkshopId;
|
||||
// x.MonthlyRollCall =
|
||||
// ConvertStaticToRollCall(x.CreateWorkingHoursTemp,
|
||||
// workshopName.WorkshopHolidayWorking);
|
||||
// }
|
||||
}
|
||||
|
||||
return new CheckoutPrintDto()
|
||||
{
|
||||
Id = x.id,
|
||||
|
||||
// هدر فیش
|
||||
// اطلاعات هویتی
|
||||
// اطلاعات کارگاه
|
||||
|
||||
#region Header
|
||||
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
FathersName = x.FathersName,
|
||||
NationalCode = x.NationalCode,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
WorkshopName = workshop.WorkshopName,
|
||||
ContractNo = x.ContractNo,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
EmployersLists = employers,
|
||||
EmployerIslegal = isLegal,
|
||||
HasLeft = hasLeft,
|
||||
LastDayOfWork = lastDayOfWork,
|
||||
LeftWorkDate = leftWorkDate,
|
||||
|
||||
#endregion
|
||||
|
||||
//جدول مطالبات و کسورات
|
||||
|
||||
#region PaymentAndDeductionTable
|
||||
|
||||
//مطالبات
|
||||
PaymentList =
|
||||
[
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 1, Title = "حقوق و مزد", Value = $"{x.SumOfWorkingDays}",
|
||||
Amount = x.MonthlySalary.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 2, Title = "پایه سنوات", Value = "-", Amount = x.BaseYearsPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 3, Title = "کمک هزینه اقلام مصرفی خانوار", Value = "-",
|
||||
Amount = x.ConsumableItems.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 4, Title = "کمک هزینه مسکن", Value = "-",
|
||||
Amount = x.HousingAllowance.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 5, Title = "فوق العاده اضافه کاری", Value = overTimeWorkValue,
|
||||
Amount = x.OvertimePay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 6, Title = "فوق العاده شب کاری", Value = overNightWorkValue,
|
||||
Amount = x.NightworkPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 7, Title = "فوق العاده جمعه کاری", Value = fridayWorkValue,
|
||||
Amount = x.FridayPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{ RowNumber = 8, Title = "فوق العاده ماموریت", Value = "-", Amount = "-", },
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 9, Title = "فوق العاده نوبت کاری", Value = rotatingShiftValue,
|
||||
Amount = x.ShiftPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 10, Title = "کمک هزینه عائله مندی", Value = "-",
|
||||
Amount = x.FamilyAllowance.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 11, Title = "حق تاهل", Value = maritalStatus,
|
||||
Amount = x.MarriedAllowance.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{ RowNumber = 12, Title = "پاداش", Value = "-", Amount = rewardPay, },
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 13, Title = "عیدی و پاداش", Value = "-",
|
||||
Amount = x.BonusesPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 14, Title = "سنوات", Value = "-",
|
||||
Amount = x.YearsPay.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 15, Title = "مزد مرخصی", Value = "-",
|
||||
Amount = x.LeavePay.ToMoneyCheckZero(),
|
||||
}
|
||||
],
|
||||
|
||||
//کسورات
|
||||
DeductionList =
|
||||
[
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 1, Title = "حق بیمه سهم کارگر", Value = "-",
|
||||
Amount = x.InsuranceDeduction.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 2, Title = "مالیات بر حقوق", Value = "-",
|
||||
Amount = x.TaxDeducation.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 3, Title = "قسط تسهیلات", Value = "-",
|
||||
Amount = x.InstallmentDeduction.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{
|
||||
RowNumber = 4, Title = "مساعده", Value = "-", Amount = x.SalaryAidDeduction.ToMoneyCheckZero(),
|
||||
},
|
||||
|
||||
new PaymentAndDeductionList()
|
||||
{ RowNumber = 5, Title = "غیبت", Value = "-", Amount = "-", }
|
||||
],
|
||||
|
||||
TotalPayment = totalPayment,
|
||||
TotalDeductions = totalDeduction,
|
||||
TotalClaims = totalClaims,
|
||||
|
||||
#endregion
|
||||
|
||||
//لیست ورود و خروج پرسنل
|
||||
//اطلاعات ساعات کار و موظقی
|
||||
|
||||
#region RollCallData
|
||||
|
||||
MonthlyRollCall =rollcalls,
|
||||
#endregion
|
||||
|
||||
|
||||
//اقساط - مساعده
|
||||
|
||||
#region SalaryAidAndInstallmentData
|
||||
SalaryAids= x.SalaryAids.Select(s=> new CheckoutPrintSalaryAidDto()
|
||||
{
|
||||
Amount = s.Amount,
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
}).ToList(),
|
||||
|
||||
Installments = x.LoanInstallments.Select(i=>new CheckoutPrintInstallmentDto()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
RemainingAmount = i.LoanRemaining,
|
||||
LoanAmount = i.LoanAmount
|
||||
}).ToList(),
|
||||
|
||||
|
||||
#endregion
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
Console.WriteLine("print : " + watch.Elapsed);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1187,14 +1187,14 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
.Where(x => !string.IsNullOrEmpty(x.ArchiveCode))
|
||||
.Select(x => x.ArchiveCode)
|
||||
.ToList();
|
||||
|
||||
|
||||
int maxArchiveCode = 0;
|
||||
|
||||
|
||||
foreach (var code in archiveCodes)
|
||||
{
|
||||
// Remove "b-" prefix if exists
|
||||
string cleanCode = code.StartsWith("b-") ? code.Substring(2) : code;
|
||||
|
||||
|
||||
// Try to parse the clean code to an integer
|
||||
if (int.TryParse(cleanCode, out int codeValue))
|
||||
{
|
||||
@@ -1204,7 +1204,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return maxArchiveCode;
|
||||
}
|
||||
|
||||
@@ -2024,5 +2024,52 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
}).OrderByDescending(x => x.StartWork).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList()
|
||||
{
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
var acountId = _authHelper.CurrentAccountId();
|
||||
|
||||
var workshopIds = _context.WorkshopAccounts.AsNoTracking().Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
|
||||
|
||||
var employers = await
|
||||
_context.WorkshopEmployers.AsNoTracking().Where(x => workshopIds.Contains(x.WorkshopId))
|
||||
.Select(x => new { x.Employer, x.WorkshopId }).ToListAsync();
|
||||
|
||||
var blockedContractingParties =await _context.PersonalContractingParties
|
||||
.Where(x => x.IsBlock == "true").Select(x=>x.id).ToListAsync();
|
||||
|
||||
var workshops = await _context.Workshops.AsNoTracking()
|
||||
.Where(x => workshopIds.Contains(x.id))
|
||||
.Where(x => x.IsActiveString == "true").ToListAsync();
|
||||
|
||||
|
||||
var result = workshops.Select(x =>
|
||||
{
|
||||
var empl = employers.First(em => em.WorkshopId == x.id);
|
||||
var isBlock = blockedContractingParties.Any(cp => cp == empl.Employer.ContractingPartyId);
|
||||
return new AdminWorkshopSelectListDto
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
IsBlock = isBlock
|
||||
};
|
||||
|
||||
}).OrderBy(x=>x.IsBlock ? 1 : 0)
|
||||
.ToList();
|
||||
|
||||
Console.WriteLine("workshopSelectList : " +watch.Elapsed);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2,18 +2,26 @@
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.Workshop.DTOs;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NuGet.Packaging.Signing;
|
||||
using ServiceHost.BaseControllers;
|
||||
using WorkFlow.Application.Contracts.WorkFlow;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class CheckoutController : AdminBaseController
|
||||
{
|
||||
private readonly ICheckoutApplication _checkoutApplication;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IWorkFlowApplication _workFlowApplication;
|
||||
|
||||
public CheckoutController(ICheckoutApplication checkoutApplication)
|
||||
public CheckoutController(ICheckoutApplication checkoutApplication, IWorkshopApplication workshopApplication, IWorkFlowApplication workFlowApplication)
|
||||
{
|
||||
_checkoutApplication = checkoutApplication;
|
||||
_workshopApplication = workshopApplication;
|
||||
_workFlowApplication = workFlowApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,5 +47,81 @@ public class CheckoutController : AdminBaseController
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پرینت گروهی فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GroupPrint")]
|
||||
public async Task<List<CheckoutPrintDto>> Print(List<long> ids)
|
||||
{
|
||||
var result =await _checkoutApplication.CheckoutPrint(ids);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پرینت تکی فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("PrintOne")]
|
||||
public async Task<List<CheckoutPrintDto>> Print(long id)
|
||||
{
|
||||
var result = await _checkoutApplication.CheckoutPrint([id]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#region CreateCheckout
|
||||
/// <summary>
|
||||
/// سلکت لیست کارگاه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("WorkshopSelectList")]
|
||||
public async Task<List<AdminWorkshopSelectListDto>> GetWorkshopSelectList()
|
||||
{
|
||||
var result =await _workshopApplication.GetAdminWorkshopSelectList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// سلک لیست پرسنل
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("EmployeeSelectList")]
|
||||
public async Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long workshopId)
|
||||
{
|
||||
var result = await _checkoutApplication.GetEmployeeSelectListByWorkshopId(workshopId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست قراردادها برای ایجاد فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetContractsToCreateCheckout")]
|
||||
public async Task<OperationResult<List<ContractsListToCreateCheckoutDto>>> GetContractsToCreateCheckout(long workshopId, string year, string month, long employeeId)
|
||||
{
|
||||
|
||||
var result =await _checkoutApplication.GetContractToCreateCheckout(workshopId, year, month, employeeId);
|
||||
if (!result.IsSuccedded)
|
||||
return result;
|
||||
|
||||
var hasWorkFlow =await _workFlowApplication.HasWorkFlow(workshopId, year, month);
|
||||
|
||||
if (hasWorkFlow)
|
||||
return new OperationResult<List<ContractsListToCreateCheckoutDto>>().Failed(
|
||||
"این کارگاه به دلیل داشتن کارپوشه مجاز به ایجاد تصفیه حساب نمی باشد");
|
||||
return result;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,12 @@ public class CheckoutPrintAllModel : PageModel
|
||||
}
|
||||
|
||||
public void OnGet(string idlist)
|
||||
{
|
||||
var ids = ExtractNumbers(idlist);
|
||||
var resultList = new List<CheckoutGroupPrintViewModel>();
|
||||
{
|
||||
|
||||
|
||||
var ids = ExtractNumbers(idlist);
|
||||
|
||||
var resultList = new List<CheckoutGroupPrintViewModel>();
|
||||
|
||||
var res = _checkoutApplication.PrintAll(ids);
|
||||
|
||||
|
||||
@@ -386,17 +386,17 @@ if (builder.Environment.IsDevelopment())
|
||||
{
|
||||
var logConfig = configuration
|
||||
.ReadFrom.Configuration(context.Configuration)
|
||||
.ReadFrom.Services(services)
|
||||
.Enrich.FromLogContext();
|
||||
.ReadFrom.Services(services);
|
||||
|
||||
|
||||
|
||||
logConfig.WriteTo.File(
|
||||
path: Path.Combine(logDirectory, "gozareshgir_log.txt"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 30,
|
||||
shared: true,
|
||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"
|
||||
);
|
||||
//logConfig.WriteTo.File(
|
||||
// path: Path.Combine(logDirectory, "gozareshgir_log.txt"),
|
||||
// rollingInterval: RollingInterval.Day,
|
||||
// retainedFileCountLimit: 30,
|
||||
// shared: true,
|
||||
// outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"
|
||||
//);
|
||||
}, writeToProviders: true); // این باعث میشه کنسول پیشفرض هم کار کنه
|
||||
|
||||
}
|
||||
|
||||
@@ -73,4 +73,15 @@ public interface IWorkFlowApplication
|
||||
|
||||
Task<List<DailyRollCallConfirmedWithoutLunchBreakViewModel>> GetEmployeesWithoutLunchBreak(long workshopId);
|
||||
Task<List<(long Id, string Name)>> GetEmployeesWithoutGroup(long workshopId);
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// در زمان ایجاد فیش کارپوشه کارگاه را چک میکند
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> HasWorkFlow(long workshopId, string year, string month);
|
||||
#endregion
|
||||
}
|
||||
@@ -781,5 +781,66 @@ public class WorkFlowApplication : IWorkFlowApplication
|
||||
return _customizedWorkshopSettingsACL.GetEmployeesWithoutGroup(workshopId);
|
||||
}
|
||||
|
||||
#region ForApi
|
||||
|
||||
|
||||
public async Task<bool> HasWorkFlow(long workshopId, string year, string month)
|
||||
{
|
||||
var workshop = _workshopRepository.GetDetails(workshopId);
|
||||
bool hasWorkFlow = false;
|
||||
|
||||
var skipRollCallByWorkshopId = workshopId is 368 or 610;
|
||||
if (workshop.HasRollCallFreeVip == "true" && !skipRollCallByWorkshopId)
|
||||
{
|
||||
DateTime startSreach;
|
||||
DateTime endSearch;
|
||||
|
||||
if (month == "0" && year == "0")
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
string startStr = $"{now.ToFarsi().Substring(0, 8)}01";
|
||||
startSreach = startStr.ToGeorgianDateTime();
|
||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
}
|
||||
else if (month == "0" && year != "0")
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
string startStr = $"{year}/{now.ToFarsi().Substring(5, 2)}/01";
|
||||
startSreach = startStr.ToGeorgianDateTime();
|
||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
}
|
||||
else if (month != "0" && year == "0")
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
string startStr = $"{now.ToFarsi().Substring(0, 4)}/{month}/01";
|
||||
startSreach = startStr.ToGeorgianDateTime();
|
||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
string startStr = $"{year}/{month}/01";
|
||||
startSreach = startStr.ToGeorgianDateTime();
|
||||
endSearch = (startStr.FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
}
|
||||
|
||||
|
||||
DateTime lastMonthEnd = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime().AddDays(-1);
|
||||
if (lastMonthEnd == endSearch)
|
||||
{
|
||||
var countWorkFlowCut = await CountCutByBgServiceLastMonth(workshopId);
|
||||
var countWorkFlowAbsent = await CountAbsentRollCallLastMonth(workshopId);
|
||||
var countWorkFlowLunchBreak = await CountEmployeesWithoutLunchBreakLastMonth(workshopId);
|
||||
var countUndefinedRollCalls = await CountUndefinedLastMonth(workshopId);
|
||||
|
||||
hasWorkFlow = countWorkFlowCut > 0 || countWorkFlowAbsent > 0 || countWorkFlowLunchBreak > 0 ||
|
||||
countUndefinedRollCalls > 0;
|
||||
}
|
||||
}
|
||||
|
||||
return hasWorkFlow;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user