|
|
|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using _0_Framework.Application;
|
|
|
|
|
using AccountManagement.Application.Contracts.Account;
|
|
|
|
|
using Company.Domain.InstitutionContractAgg;
|
|
|
|
|
using CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
|
|
|
|
using CompanyManagment.App.Contracts.Employer;
|
|
|
|
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
|
|
|
|
@@ -38,6 +39,7 @@ public class IndexModel : PageModel
|
|
|
|
|
private readonly IInstitutionContractApplication _institutionContract;
|
|
|
|
|
private readonly ILeftWorkApplication _leftWorkApplication;
|
|
|
|
|
private readonly IRepresentativeApplication _representativeApplication;
|
|
|
|
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly string _viewName;
|
|
|
|
|
@@ -60,7 +62,7 @@ public class IndexModel : PageModel
|
|
|
|
|
IPersonalContractingPartyApp contractingPartyApplication,
|
|
|
|
|
IRepresentativeApplication representativeApplication, IInstitutionContractApplication institutionContract,
|
|
|
|
|
ILeftWorkApplication leftWorkApplication
|
|
|
|
|
, IContactInfoApplication contactInfoApplication, IAccountApplication accountApplication)
|
|
|
|
|
, IContactInfoApplication contactInfoApplication, IAccountApplication accountApplication, IInstitutionContractRepository institutionContractRepository)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
_workshopApplication = workshopApplication;
|
|
|
|
|
@@ -71,6 +73,7 @@ public class IndexModel : PageModel
|
|
|
|
|
_leftWorkApplication = leftWorkApplication;
|
|
|
|
|
_contactInfoApplication = contactInfoApplication;
|
|
|
|
|
_accountApplication = accountApplication;
|
|
|
|
|
_institutionContractRepository = institutionContractRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Message { get; set; }
|
|
|
|
|
@@ -920,12 +923,27 @@ public class IndexModel : PageModel
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult OnGetDownloadExcel()
|
|
|
|
|
public async Task<IActionResult> OnGetDownloadExcel()
|
|
|
|
|
{
|
|
|
|
|
var institutionContractViewModels = _institutionContract.NewSearch(new() {IsActiveString = "both", TypeOfContract = "both" });
|
|
|
|
|
|
|
|
|
|
institutionContractViewModels= institutionContractViewModels.GroupBy(x=>x.ContractingPartyId).Select(g=>g.MaxBy(x=>x.ContractStartGr)).ToList();
|
|
|
|
|
var bytes = InstitutionContractExcelGenerator.GenerateExcel(institutionContractViewModels);
|
|
|
|
|
var searchModel = new InstitutionContractListSearchModel();
|
|
|
|
|
|
|
|
|
|
var dataVm=new List<InstitutionContractExcelViewModel>();
|
|
|
|
|
|
|
|
|
|
foreach (var name in typeof(InstitutionContractListStatus).GetEnumNames())
|
|
|
|
|
{
|
|
|
|
|
var @enum = Enum.Parse<InstitutionContractListStatus>(name);
|
|
|
|
|
searchModel.Status = @enum;
|
|
|
|
|
searchModel.PageSize = 99999;
|
|
|
|
|
var data =( await(_institutionContractRepository.GetList(searchModel))).List;
|
|
|
|
|
dataVm.Add(new InstitutionContractExcelViewModel(){Tab = @enum, GetInstitutionContractListItemsViewModels = data});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchModel.Status = null;
|
|
|
|
|
|
|
|
|
|
var nullData = ( await(_institutionContractRepository.GetList(searchModel))).List;
|
|
|
|
|
dataVm.Add(new InstitutionContractExcelViewModel(){Tab = null, GetInstitutionContractListItemsViewModels = nullData});
|
|
|
|
|
|
|
|
|
|
var bytes = InstitutionContractExcelGenerator.GenerateExcel(dataVm);
|
|
|
|
|
return File(bytes,
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
$"قرارداد های مالی.xlsx");
|
|
|
|
|
|