feat: implement contract printing methods and view models

This commit is contained in:
2025-12-20 13:04:30 +03:30
parent 0fbd5c9d3e
commit b0d174a575
4 changed files with 91 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ public interface IContractRepository : IRepository<long, Contract>
Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel);
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
#endregion
#region NewChangeByHeydari
@@ -66,6 +67,7 @@ public interface IContractRepository : IRepository<long, Contract>
ContractViweModel GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
List<ContractViweModel> GetByWorkshopIdInDates(long workshopId, DateTime contractStart, DateTime contractEnd);
#endregion
}

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Workshop;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
@@ -74,4 +76,71 @@ public interface IContractApplication
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 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; }
}

View File

@@ -3112,14 +3112,14 @@ public class ContractApplication : IContractApplication
return await _contractRepository.GetContractListForClient(searchModel);
}
public Task<ContractPrintViewModel> PrintOneAsync(long id)
public async Task<ContractPrintViewModel> PrintOneAsync(long id)
{
throw new NotImplementedException();
return (await _contractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
throw new NotImplementedException();
return await _contractRepository.PrintAllAsync(ids);
}
#endregion

View File

@@ -1621,6 +1621,22 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
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 res = query.Select(x=>
{
var employer =
return new ContractPrintViewModel()
{
Employer =
};
})
}
#endregion
#region NewChangeByHeydari