Compare commits
1 Commits
Feature/co
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| cae82ed702 |
@@ -48,10 +48,6 @@ public interface IContractRepository : IRepository<long, Contract>
|
|||||||
bool Remove(long id);
|
bool Remove(long id);
|
||||||
|
|
||||||
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
|
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
|
||||||
|
|
||||||
Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel);
|
|
||||||
|
|
||||||
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
|
||||||
#endregion
|
#endregion
|
||||||
#region NewChangeByHeydari
|
#region NewChangeByHeydari
|
||||||
|
|
||||||
@@ -67,8 +63,4 @@ public interface IContractRepository : IRepository<long, Contract>
|
|||||||
ContractViweModel GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
|
ContractViweModel GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
|
||||||
List<ContractViweModel> GetByWorkshopIdInDates(long workshopId, DateTime contractStart, DateTime contractEnd);
|
List<ContractViweModel> GetByWorkshopIdInDates(long workshopId, DateTime contractStart, DateTime contractEnd);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace CompanyManagment.App.Contracts.Contract;
|
|
||||||
|
|
||||||
public enum ContractListOrderType
|
|
||||||
{
|
|
||||||
ByContractCreationDate,
|
|
||||||
BySignedContract,
|
|
||||||
ByUnSignedContract,
|
|
||||||
ByPersonnelCode,
|
|
||||||
ByPersonnelCodeDescending,
|
|
||||||
ByContractStartDate,
|
|
||||||
ByContractStartDateDescending
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using _0_Framework.Application;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.Contract;
|
|
||||||
|
|
||||||
public class GetContractListForClientRequest: PaginationRequest
|
|
||||||
{
|
|
||||||
public int Year { get; set; }
|
|
||||||
public int Month { get; set; }
|
|
||||||
public string StartDate { get; set; }
|
|
||||||
public string EndDate { get; set; }
|
|
||||||
public long EmployeeId { get; set; }
|
|
||||||
public ContractListOrderType? OrderType { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
namespace CompanyManagment.App.Contracts.Contract;
|
|
||||||
|
|
||||||
public class GetContractListForClientResponse
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string PersonnelCode { get; set; }
|
|
||||||
public string ContractNo { get; set; }
|
|
||||||
public string EmployeeFullName { get; set; }
|
|
||||||
public string ContractStart { get; set; }
|
|
||||||
public string ContractEnd { get; set; }
|
|
||||||
public bool IsSigned { get; set; }
|
|
||||||
public string DailyWage { get; set; }
|
|
||||||
public string AvgWorkingHour { get; set; }
|
|
||||||
public string FamilyAllowance { get; set; }
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
|||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using CompanyManagment.App.Contracts.Workshop;
|
using CompanyManagment.App.Contracts.Workshop;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application.Enums;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.Contract;
|
namespace CompanyManagment.App.Contracts.Contract;
|
||||||
|
|
||||||
public interface IContractApplication
|
public interface IContractApplication
|
||||||
@@ -47,25 +45,12 @@ public interface IContractApplication
|
|||||||
#region Client
|
#region Client
|
||||||
|
|
||||||
OperationResult Remove(long id);
|
OperationResult Remove(long id);
|
||||||
|
|
||||||
[Obsolete("این متد منسوخ شده است. لطفاً از متد GetContractListForClient استفاده کنید.")]
|
|
||||||
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
|
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
#region NewChangeByHeydari
|
||||||
/// لیست قراردادها برای کلاینت
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchModel"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<PagedResult<GetContractListForClientResponse>>
|
|
||||||
GetContractListForClient(GetContractListForClientRequest searchModel);
|
|
||||||
Task<ContractPrintViewModel> PrintOneAsync(long id);
|
|
||||||
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
|
||||||
|
|
||||||
#endregion
|
OperationResult DeleteAllContarcts(List<long> ids);
|
||||||
|
|
||||||
#region NewChangeByHeydari
|
|
||||||
|
|
||||||
OperationResult DeleteAllContarcts(List<long> ids);
|
|
||||||
OperationResult DeleteContarcts(long id);
|
OperationResult DeleteContarcts(long id);
|
||||||
List<long> CheckHasCheckout(List<long> ids);
|
List<long> CheckHasCheckout(List<long> ids);
|
||||||
List<long> CheckHasSignature(List<long> ids);
|
List<long> CheckHasSignature(List<long> ids);
|
||||||
@@ -73,75 +58,3 @@ public interface IContractApplication
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ContractPrintViewModel
|
|
||||||
{
|
|
||||||
public string ContractNo { get; set; }
|
|
||||||
public ContractPrintEmployerViewModel Employer { get; set; }
|
|
||||||
public ContractPrintEmployeeViewModel Employee { get; set; }
|
|
||||||
public ContractPrintTypeOfContractViewModel TypeOfContract { get; set; }
|
|
||||||
public ContractPrintFeesViewModel Fees { get; set; }
|
|
||||||
public string ConditionAndDetials { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintFeesViewModel
|
|
||||||
{
|
|
||||||
public string DailyWage { get; set; }
|
|
||||||
public string FamilyAllowance { get; set; }
|
|
||||||
public string ConsumableItems { get; set; }
|
|
||||||
public string HousingAllowance { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintTypeOfContractViewModel
|
|
||||||
{
|
|
||||||
public string ContractType { get; set; }
|
|
||||||
public string JobName { get; set; }
|
|
||||||
public string SetContractDate { get; set; }
|
|
||||||
public string ContarctStart { get; set; }
|
|
||||||
public string ContractEnd { get; set; }
|
|
||||||
public string WorkingHoursWeekly { get; set; }
|
|
||||||
public List<string> WorkshopAddress { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintEmployeeViewModel
|
|
||||||
{
|
|
||||||
public string FullName { get; set; }
|
|
||||||
public string NationalCode { get; set; }
|
|
||||||
public string IdNumber { get; set; }
|
|
||||||
public string DateOfBirth { get; set; }
|
|
||||||
public string FatherName { get; set; }
|
|
||||||
public string LevelOfEducation { get; set; }
|
|
||||||
public string Address { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintEmployerViewModel
|
|
||||||
{
|
|
||||||
public LegalType LegalType { get; set; }
|
|
||||||
public ContractPrintRealEmployerViewModel RealEmployer { get; set; }
|
|
||||||
public ContractPrintLegalEmployerViewModel LegalEmployer { get; set; }
|
|
||||||
public string WorkshopName { get; set; }
|
|
||||||
public string Address { get; set; }
|
|
||||||
public string WorkshopCode { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintLegalEmployerViewModel
|
|
||||||
{
|
|
||||||
public string CompanyName { get; set; }
|
|
||||||
public string NationalId { get; set; }
|
|
||||||
public string RegisterId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContractPrintRealEmployerViewModel
|
|
||||||
{
|
|
||||||
public string FullName { get; set; }
|
|
||||||
public string NationalCode { get; set; }
|
|
||||||
public string IdNumber { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using _0_Framework.Application.Sms;
|
using _0_Framework.Application.Sms;
|
||||||
using CompanyManagment.App.Contracts.Checkout;
|
|
||||||
using CompanyManagment.App.Contracts.Law;
|
using CompanyManagment.App.Contracts.Law;
|
||||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||||
using CompanyManagment.App.Contracts.Workshop;
|
|
||||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
|
|
||||||
@@ -80,11 +73,6 @@ public interface IInstitutionContractApplication
|
|||||||
|
|
||||||
|
|
||||||
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
||||||
/// <summary>
|
|
||||||
/// چاپ یک قرارداد
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">شناسه قرارداد</param>
|
|
||||||
/// <returns>اطلاعات قرارداد برای چاپ</returns>
|
|
||||||
InstitutionContractViewModel PrintOne(long id);
|
InstitutionContractViewModel PrintOne(long id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -164,6 +152,14 @@ public interface IInstitutionContractApplication
|
|||||||
|
|
||||||
#region Api
|
#region Api
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// غیر فعال کردن قرارداد - اگر بدهی داشته باشد حالت آبی میشود.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task DeActiveAsync(long id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// لیست قرارداد های مالی
|
/// لیست قرارداد های مالی
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2712,9 +2712,7 @@ public class ContractApplication : IContractApplication
|
|||||||
|
|
||||||
var emp = workshopEmpList.Where(x => x.WorkshopId == res.WorkshopIds)
|
var emp = workshopEmpList.Where(x => x.WorkshopId == res.WorkshopIds)
|
||||||
.Select(x => x.EmployerId).ToList();
|
.Select(x => x.EmployerId).ToList();
|
||||||
|
|
||||||
res.Employers = _employerRepository.GetEmployers(emp);
|
res.Employers = _employerRepository.GetEmployers(emp);
|
||||||
|
|
||||||
var workshopSelect = _workshopApplication.GetDetails(res.WorkshopIds);
|
var workshopSelect = _workshopApplication.GetDetails(res.WorkshopIds);
|
||||||
var workshop = new WorkshopViewModel()
|
var workshop = new WorkshopViewModel()
|
||||||
{
|
{
|
||||||
@@ -3109,21 +3107,6 @@ public class ContractApplication : IContractApplication
|
|||||||
return _contractRepository.SearchForClient(searchModel);
|
return _contractRepository.SearchForClient(searchModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel)
|
|
||||||
{
|
|
||||||
return await _contractRepository.GetContractListForClient(searchModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<ContractPrintViewModel> PrintOneAsync(long id)
|
|
||||||
{
|
|
||||||
return (await _contractRepository.PrintAllAsync([id])).FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
|
|
||||||
{
|
|
||||||
return await _contractRepository.PrintAllAsync(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region NewChangeByHeydari
|
#region NewChangeByHeydari
|
||||||
|
|||||||
@@ -917,6 +917,26 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
|||||||
return _institutionContractRepository.GetcontractAmount(countPerson);
|
return _institutionContractRepository.GetcontractAmount(countPerson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeActiveAsync(long id)
|
||||||
|
{
|
||||||
|
var institutionContract = _institutionContractRepository.Get(id);
|
||||||
|
if (institutionContract == null)
|
||||||
|
{
|
||||||
|
throw new NotFoundException("رکورد مورد نظر یافت نشد");
|
||||||
|
}
|
||||||
|
|
||||||
|
var financialStatement =await _financialStatmentRepository.GetByContractingPartyId(id);
|
||||||
|
var balanceAmount =await _financialStatmentRepository.GetBalanceAmount(financialStatement.id);
|
||||||
|
if (balanceAmount.Amount>0)
|
||||||
|
{
|
||||||
|
institutionContract.DeActiveBlue();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
institutionContract.DeActive();
|
||||||
|
}
|
||||||
|
await _institutionContractRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(
|
public async Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(
|
||||||
InstitutionContractListSearchModel searchModel)
|
InstitutionContractListSearchModel searchModel)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -167,8 +167,6 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
|||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
return _rollCallEmployeeStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && x.StartDate < now && x.EndDate > now);
|
return _rollCallEmployeeStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && x.StartDate < now && x.EndDate > now);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using _0_Framework.Application.Enums;
|
|
||||||
using _0_Framework.Exceptions;
|
|
||||||
using _0_Framework.InfraStructure;
|
using _0_Framework.InfraStructure;
|
||||||
using Company.Domain.ContractAgg;
|
using Company.Domain.ContractAgg;
|
||||||
using Company.Domain.empolyerAgg;
|
using Company.Domain.empolyerAgg;
|
||||||
@@ -1083,7 +1081,30 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
|
|||||||
|
|
||||||
var weeklyDouble = 0.0;
|
var weeklyDouble = 0.0;
|
||||||
var weekly = c.WorkingHoursWeekly;
|
var weekly = c.WorkingHoursWeekly;
|
||||||
c.WorkingHoursWeekly = WeeklyHourConvertor(weekly);
|
if (!string.IsNullOrWhiteSpace(weekly) &&
|
||||||
|
weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
|
||||||
|
{
|
||||||
|
if (weekly.Contains("/"))
|
||||||
|
{
|
||||||
|
weeklyDouble = double.Parse(weekly);
|
||||||
|
var minute = (int)((weeklyDouble % 1) * 60);
|
||||||
|
var hour = (int)(weeklyDouble);
|
||||||
|
c.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
|
||||||
|
}
|
||||||
|
else if (weekly.Contains("."))
|
||||||
|
{
|
||||||
|
weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
|
||||||
|
var minute = (int)((weeklyDouble % 1) * 60);
|
||||||
|
var hour = (int)(weeklyDouble);
|
||||||
|
c.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c.WorkingHoursWeekly = c.WorkingHoursWeekly + " " + "ساعت";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
var emp = workshopEmpList.Where(x => x.WorkshopId == c.WorkshopIds)
|
var emp = workshopEmpList.Where(x => x.WorkshopId == c.WorkshopIds)
|
||||||
.Select(x => x.EmployerId).ToList();
|
.Select(x => x.EmployerId).ToList();
|
||||||
c.Employers = _employerRepository.GetEmployers(emp);
|
c.Employers = _employerRepository.GetEmployers(emp);
|
||||||
@@ -1140,37 +1161,6 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string WeeklyHourConvertor(string weekly)
|
|
||||||
{
|
|
||||||
double weeklyDouble;
|
|
||||||
if (!string.IsNullOrWhiteSpace(weekly) &&
|
|
||||||
weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
|
|
||||||
{
|
|
||||||
if (weekly.Contains("/"))
|
|
||||||
{
|
|
||||||
weeklyDouble = double.Parse(weekly);
|
|
||||||
var minute = (int)((weeklyDouble % 1) * 60);
|
|
||||||
var hour = (int)(weeklyDouble);
|
|
||||||
return hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
|
|
||||||
}
|
|
||||||
else if (weekly.Contains("."))
|
|
||||||
{
|
|
||||||
weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
|
|
||||||
var minute = (int)((weeklyDouble % 1) * 60);
|
|
||||||
var hour = (int)(weeklyDouble);
|
|
||||||
return hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return weekly + " " + "ساعت";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQueryable<WorkshopEmployerViewModel> GetWorkshopEmployer()
|
public IQueryable<WorkshopEmployerViewModel> GetWorkshopEmployer()
|
||||||
{
|
{
|
||||||
return _context.WorkshopEmployers.Select(x => new WorkshopEmployerViewModel
|
return _context.WorkshopEmployers.Select(x => new WorkshopEmployerViewModel
|
||||||
@@ -1516,195 +1506,6 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel)
|
|
||||||
{
|
|
||||||
var workshopId = _authHelper.GetWorkshopId();
|
|
||||||
var query = _context.Contracts
|
|
||||||
.Where(c => c.WorkshopIds == workshopId);
|
|
||||||
|
|
||||||
#region Search
|
|
||||||
|
|
||||||
if (searchModel.EmployeeId > 0)
|
|
||||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.StartDate) && string.IsNullOrWhiteSpace(searchModel.EndDate))
|
|
||||||
{
|
|
||||||
if (!searchModel.StartDate.TryToGeorgianDateTime(out var startDate))
|
|
||||||
throw new BadRequestException("تاریخ شروع وارد شده معتبر نمی باشد.");
|
|
||||||
|
|
||||||
if (!searchModel.EndDate.TryToGeorgianDateTime(out var endDate))
|
|
||||||
throw new BadRequestException("تاریخ پایان وارد شده معتبر نمی باشد.");
|
|
||||||
|
|
||||||
query = query.Where(x => x.ContarctStart <=endDate && x.ContractEnd >= startDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchModel.Year>0 && searchModel.Month >0)
|
|
||||||
{
|
|
||||||
|
|
||||||
var startDateFa = $"{searchModel.Year:0000}/{searchModel.Month:00}/01";
|
|
||||||
if (!startDateFa.TryToGeorgianDateTime(out var startDate))
|
|
||||||
throw new BadRequestException("سال و ماه وارد شده معتبر نمی باشد.");
|
|
||||||
|
|
||||||
if(!startDateFa.FindeEndOfMonth().TryToGeorgianDateTime(out var endDate))
|
|
||||||
throw new BadRequestException("سال و ماه وارد شده معتبر نمی باشد.");
|
|
||||||
|
|
||||||
query = query.Where(x => x.ContarctStart <=endDate && x.ContractEnd >= startDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchModel.OrderType != null)
|
|
||||||
{
|
|
||||||
switch (searchModel.OrderType)
|
|
||||||
{
|
|
||||||
case ContractListOrderType.ByContractCreationDate:
|
|
||||||
query = query.OrderBy(x => x.CreationDate);
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.ByContractStartDate:
|
|
||||||
query = query.OrderBy(x => x.ContarctStart);
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.ByContractStartDateDescending:
|
|
||||||
query = query.OrderByDescending(x=>x.ContarctStart);
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.ByPersonnelCode:
|
|
||||||
query = query.OrderBy(x => x.PersonnelCode);
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.ByPersonnelCodeDescending:
|
|
||||||
query = query.OrderByDescending(x => x.PersonnelCode);
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.BySignedContract:
|
|
||||||
query = query.OrderByDescending(x => x.Signature == "1");
|
|
||||||
break;
|
|
||||||
case ContractListOrderType.ByUnSignedContract:
|
|
||||||
query = query.OrderBy(x => x.Signature == "1");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
query = query.OrderByDescending(x => x.id);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
var pagedList =await query
|
|
||||||
.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
|
||||||
|
|
||||||
var employeeIds = pagedList.Select(x => x.EmployeeId).ToList();
|
|
||||||
|
|
||||||
var employees = await _context.Employees
|
|
||||||
.Where(x => employeeIds.Contains(x.id)).Select(x => new
|
|
||||||
{
|
|
||||||
Id = x.id,
|
|
||||||
x.FullName
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
var result = new PagedResult<GetContractListForClientResponse>
|
|
||||||
{
|
|
||||||
TotalCount = await query.CountAsync(),
|
|
||||||
List = pagedList.Select(c =>
|
|
||||||
{
|
|
||||||
var employeeFullName = employees
|
|
||||||
.FirstOrDefault(e => e.Id == c.EmployeeId)?.FullName ?? "";
|
|
||||||
|
|
||||||
return new GetContractListForClientResponse
|
|
||||||
{
|
|
||||||
Id = c.id,
|
|
||||||
PersonnelCode = c.PersonnelCode.ToString(),
|
|
||||||
ContractStart = c.ContarctStart.ToFarsi(),
|
|
||||||
ContractEnd = c.ContractEnd.ToFarsi(),
|
|
||||||
ContractNo = c.ContractNo,
|
|
||||||
IsSigned = c.Signature == "1",
|
|
||||||
EmployeeFullName = employeeFullName,
|
|
||||||
AvgWorkingHour = WeeklyHourConvertor(c.WorkingHoursWeekly),
|
|
||||||
DailyWage = c.DayliWage,
|
|
||||||
FamilyAllowance = c.FamilyAllowance
|
|
||||||
};
|
|
||||||
}).ToList()
|
|
||||||
};
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
|
|
||||||
{
|
|
||||||
var query =await _context.Contracts.Include(x => x.Employer)
|
|
||||||
.Include(x => x.Employee).Where(x => ids.Contains(x.id))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var workshopIds = query.Select(x => x.WorkshopIds).Distinct().ToList();
|
|
||||||
|
|
||||||
var workshops = await _context.Workshops
|
|
||||||
.Where(x => workshopIds.Contains(x.id))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
List<long> exceptionWorkshops = [516,63,38,39];
|
|
||||||
var res = query.Select(x =>
|
|
||||||
{
|
|
||||||
var workshop = workshops.FirstOrDefault(w => w.id == x.WorkshopIds);
|
|
||||||
|
|
||||||
var employerRes = new ContractPrintEmployerViewModel()
|
|
||||||
{
|
|
||||||
WorkshopName = workshop!.WorkshopName,
|
|
||||||
Address =$"{workshop.State} - {workshop.City} - {workshop.Address}",
|
|
||||||
LegalType = x.Employer.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
|
||||||
LegalEmployer = x.Employer.IsLegal == "حقیقی"
|
|
||||||
? null
|
|
||||||
: new ContractPrintLegalEmployerViewModel()
|
|
||||||
{
|
|
||||||
NationalId = x.Employer.NationalId,
|
|
||||||
RegisterId = x.Employer.RegisterId,
|
|
||||||
CompanyName = x.Employer.LName,
|
|
||||||
},
|
|
||||||
RealEmployer = x.Employer.IsLegal == "حقیقی"
|
|
||||||
? new ContractPrintRealEmployerViewModel()
|
|
||||||
{
|
|
||||||
FullName = x.Employer.FullName,
|
|
||||||
IdNumber = x.Employer.IdNumber,
|
|
||||||
NationalCode = x.Employer.Nationalcode
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
WorkshopCode = workshop.InsuranceCode
|
|
||||||
|
|
||||||
};
|
|
||||||
var employeeRes = new ContractPrintEmployeeViewModel()
|
|
||||||
{
|
|
||||||
Address =$"{x.Employee.State} - {x.Employee.City} - {x.Employee.Address}" ,
|
|
||||||
FullName = x.Employee.FullName,
|
|
||||||
IdNumber = x.Employee.IdNumber,
|
|
||||||
NationalCode = x.Employee.NationalCode,
|
|
||||||
DateOfBirth = x.Employee.DateOfBirth.ToFarsi(),
|
|
||||||
FatherName = x.Employee.FatherName,
|
|
||||||
LevelOfEducation = x.Employee.LevelOfEducation
|
|
||||||
};
|
|
||||||
|
|
||||||
var typeOfContract = new ContractPrintTypeOfContractViewModel()
|
|
||||||
{
|
|
||||||
ContarctStart = x.ContarctStart.ToFarsi(),
|
|
||||||
ContractEnd = x.ContractEnd.ToFarsi(),
|
|
||||||
JobName = x.JobType,
|
|
||||||
ContractType = x.ContractType,
|
|
||||||
SetContractDate = x.SetContractDate.ToFarsi(),
|
|
||||||
WorkingHoursWeekly = WeeklyHourConvertor(x.WorkingHoursWeekly),
|
|
||||||
WorkshopAddress = [x.WorkshopAddress1, x.WorkshopAddress2],
|
|
||||||
};
|
|
||||||
ContractPrintFeesViewModel fees= new ContractPrintFeesViewModel()
|
|
||||||
{
|
|
||||||
DailyWage = x.DayliWage,
|
|
||||||
FamilyAllowance = x.FamilyAllowance,
|
|
||||||
HousingAllowance = x.HousingAllowance,
|
|
||||||
ConsumableItems = x.ConsumableItems,
|
|
||||||
};
|
|
||||||
return new ContractPrintViewModel()
|
|
||||||
{
|
|
||||||
Employer = employerRes,
|
|
||||||
Employee = employeeRes,
|
|
||||||
TypeOfContract = typeOfContract,
|
|
||||||
Fees = fees,
|
|
||||||
ContractNo = x.ContractNo,
|
|
||||||
ConditionAndDetials = exceptionWorkshops.Contains(x.WorkshopIds) ? "بر اساس ماده 190 قانون کار جمهوری اسلامی ایران ، پرسنل اقرار مینماید کلیه مبالغ پیش بینی شده در قانون کار را وفق قرارداد منعقده دریافت مینماید. این مبالغ قسمتی بصورت مستقیم از سوی کارفرما و قسمتی بر اساس شرایط کارگاه از محل درآمد حاصله از مشتری اخذ میگردد . با توجه به شرایط کارگاه کلیه مبالغ بصورت واریز به حساب و وجه نقد رایج کشور ، تواما به پرسنل پرداخت میگردد. امضا تصفیه حساب دارای مبالغ ، توسط پرسنل نشانگر تصفیه قطعی ایشان میباشد.": "",
|
|
||||||
|
|
||||||
};
|
|
||||||
}).ToList();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region NewChangeByHeydari
|
#region NewChangeByHeydari
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
|||||||
|
|
||||||
public async Task<FinancialStatment> GetByContractingPartyId(long contractingPartyId)
|
public async Task<FinancialStatment> GetByContractingPartyId(long contractingPartyId)
|
||||||
{
|
{
|
||||||
return await _context.FinancialStatments.FirstOrDefaultAsync(x => x.ContractingPartyId == contractingPartyId);
|
return await _context.FinancialStatments
|
||||||
|
.FirstOrDefaultAsync(x => x.ContractingPartyId == contractingPartyId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,37 +210,24 @@ public class institutionContractController : AdminBaseController
|
|||||||
return new JsonResult(result);
|
return new JsonResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// حذف قرارداد مالی
|
// /// حذف قرارداد مالی
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id"></param>
|
// /// <param name="id"></param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpDelete("{id}")]
|
// [HttpDelete("{id}")]
|
||||||
public async Task<ActionResult<OperationResult>> Remove(long id)
|
// public async Task<ActionResult<OperationResult>> Remove(long id)
|
||||||
{
|
// {
|
||||||
_institutionContractApplication.RemoveContract(id);
|
// _institutionContractApplication.RemoveContract(id);
|
||||||
return new OperationResult().Succcedded();
|
// return new OperationResult().Succcedded();
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
[HttpPost("deActive/{id}")]
|
[HttpPost("deActive/{id}")]
|
||||||
public ActionResult<OperationResult> DeActive(long id, string balance)
|
public async Task<ActionResult> DeActive(long id)
|
||||||
{
|
{
|
||||||
var result = new OperationResult();
|
await _institutionContractApplication.DeActiveAsync(id);
|
||||||
if (balance == "0")
|
return Ok();
|
||||||
{
|
|
||||||
result = _institutionContractApplication.DeActive(id);
|
|
||||||
if (result.IsSuccedded) result = _institutionContractApplication.DeActiveAllConnections(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = _institutionContractApplication.DeActiveBlue(id);
|
|
||||||
if (result.IsSuccedded)
|
|
||||||
result = _institutionContractApplication.DeActiveAllConnections(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
using _0_Framework.Application;
|
|
||||||
using Company.Domain.ContractAgg;
|
|
||||||
using CompanyManagment.App.Contracts.Contract;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using ServiceHost.BaseControllers;
|
|
||||||
|
|
||||||
namespace ServiceHost.Areas.Client.Controllers;
|
|
||||||
|
|
||||||
public class ContractController:ClientBaseController
|
|
||||||
{
|
|
||||||
private readonly IContractApplication _contractApplication;
|
|
||||||
|
|
||||||
public ContractController(IContractApplication contractApplication)
|
|
||||||
{
|
|
||||||
_contractApplication = contractApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<ActionResult<PagedResult<GetContractListForClientResponse>>> GetList(
|
|
||||||
GetContractListForClientRequest searchModel)
|
|
||||||
{
|
|
||||||
var res = await _contractApplication
|
|
||||||
.GetContractListForClient(searchModel);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
[HttpGet("print/{id}")]
|
|
||||||
public async Task<ActionResult<ContractPrintViewModel>> PrintOne(long id)
|
|
||||||
{
|
|
||||||
var res = await _contractApplication.PrintOneAsync(id);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
[HttpGet("print")]
|
|
||||||
public async Task<ActionResult<List<ContractPrintViewModel>>> PrintAll([FromQuery] List<long> ids)
|
|
||||||
{
|
|
||||||
var res = await _contractApplication.PrintAllAsync(ids);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user