Compare commits

..

1 Commits

Author SHA1 Message Date
8faaea0a1e Add Excel export for institution contract and contracting party details
- Implement InstitutionContractDetailExcelGenerator and InstitutionContractLegalExcelGenerator for generating Excel files of contract parties (individual and legal)
- Add methods to Index.cshtml.cs to fetch and export contract party details within 6 months of contract end
- Update OnPostShiftDateNew to return contracting party Excel export
- Refactor usings to include new Excel generators
2025-11-30 15:30:43 +03:30
23 changed files with 698 additions and 700 deletions

View File

@@ -32,7 +32,7 @@ public static class StaticWorkshopAccounts
/// 392 - عمار حسن دوست
/// 20 - سمیرا الهی نیا
/// </summary>
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20, 476];
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20];
/// <summary>
/// این تاریخ در جدول اکانت لفت ورک به این معنیست

View File

@@ -290,13 +290,4 @@ public class PersonalContractingParty : EntityBase
this.Gender = gender;
this.IsAuthenticated = true;
}
public void EditLegalPartyFromInstitution(string legalPosition, string companyName,
string registerId,string nationalId)
{
LegalPosition = legalPosition;
LName = companyName;
RegisterId = registerId;
NationalId = nationalId;
}
}

View File

@@ -37,7 +37,7 @@ namespace Company.Domain.EmployeeDocumentsAgg
{
WorkshopId = workshopId;
EmployeeId = employeeId;
Gender = gender??string.Empty;
Gender = gender;
}
private EmployeeDocuments()

View File

@@ -0,0 +1,86 @@
using System.Collections.Generic;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
namespace CompanyManagement.Infrastructure.Excel.ContractingParty;
public static class InstitutionContractDetailExcelGenerator
{
public static byte[] Generate(List<InstitutionContractDetailExcelViewModel> items)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using var package = new ExcelPackage();
var worksheet = package.Workbook.Worksheets.Add("جزئیات طرف قرارداد");
// Headers (فارسی)
worksheet.Cells[1, 1].Value = "نام";
worksheet.Cells[1, 2].Value = "نام خانوادگی";
worksheet.Cells[1, 3].Value = "کد ملی";
worksheet.Cells[1, 4].Value = "تاریخ تولد";
worksheet.Cells[1, 5].Value = "شماره تماس";
worksheet.Cells[1, 6].Value = "شماره ملی";
// Header style
using (var headerRange = worksheet.Cells[1, 1, 1, 6])
{
headerRange.Style.Font.Bold = true;
headerRange.Style.Fill.PatternType = ExcelFillStyle.Solid;
headerRange.Style.Fill.BackgroundColor.SetColor(Color.LightGray);
headerRange.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
headerRange.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
headerRange.Style.Border.Top.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Left.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Right.Style = ExcelBorderStyle.Thin;
}
// Data rows
int row = 2;
if (items != null)
{
foreach (var it in items)
{
worksheet.Cells[row, 1].Value = it.FirstName;
worksheet.Cells[row, 2].Value = it.LastName;
worksheet.Cells[row, 3].Value = it.NationalCode;
worksheet.Cells[row, 4].Value = it.BirthDate;
worksheet.Cells[row, 5].Value = it.PhoneNumber;
worksheet.Cells[row, 6].Value = it.NationalNumber;
using (var dataRange = worksheet.Cells[row, 1, row, 6])
{
dataRange.Style.Border.Top.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Left.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Right.Style = ExcelBorderStyle.Thin;
dataRange.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; // راست‌چین
dataRange.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
dataRange.Style.WrapText = true;
}
row++;
}
}
// Auto-fit columns to largest content
if (worksheet.Dimension != null)
{
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
}
// Set sheet to RTL for Persian
worksheet.View.RightToLeft = true;
return package.GetAsByteArray();
}
}
public class InstitutionContractDetailExcelViewModel
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string NationalCode { get; set; }
public string BirthDate { get; set; } // accept Persian date strings
public string PhoneNumber { get; set; }
public string NationalNumber { get; set; }
}

View File

@@ -0,0 +1,93 @@
using System.Collections.Generic;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
namespace CompanyManagement.Infrastructure.Excel.ContractingParty;
public static class InstitutionContractLegalExcelGenerator
{
public static byte[] Generate(List<InstitutionContractLegalExcelViewModel> items)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using var package = new ExcelPackage();
var worksheet = package.Workbook.Worksheets.Add("جزئیات حقوقی طرف قرارداد");
// Headers (فارسی)
worksheet.Cells[1, 1].Value = "نام شرکت";
worksheet.Cells[1, 2].Value = "نام";
worksheet.Cells[1, 3].Value = "نام خانوادگی";
worksheet.Cells[1, 4].Value = "کد ملی";
worksheet.Cells[1, 5].Value = "شماره ثبت";
worksheet.Cells[1, 6].Value = "تاریخ تولد";
worksheet.Cells[1, 7].Value = "شماره تماس";
worksheet.Cells[1, 8].Value = "شماره ملی";
// Header style
using (var headerRange = worksheet.Cells[1, 1, 1, 8])
{
headerRange.Style.Font.Bold = true;
headerRange.Style.Fill.PatternType = ExcelFillStyle.Solid;
headerRange.Style.Fill.BackgroundColor.SetColor(Color.LightGray);
headerRange.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
headerRange.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
headerRange.Style.Border.Top.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Left.Style = ExcelBorderStyle.Thin;
headerRange.Style.Border.Right.Style = ExcelBorderStyle.Thin;
}
// Data rows
int row = 2;
if (items != null)
{
foreach (var it in items)
{
worksheet.Cells[row, 1].Value = it.CompanyName;
worksheet.Cells[row, 2].Value = it.FirstName;
worksheet.Cells[row, 3].Value = it.LastName;
worksheet.Cells[row, 4].Value = it.NationalCode;
worksheet.Cells[row, 5].Value = it.RegistrationNumber;
worksheet.Cells[row, 6].Value = it.BirthDate;
worksheet.Cells[row, 7].Value = it.PhoneNumber;
worksheet.Cells[row, 8].Value = it.NationalNumber;
using (var dataRange = worksheet.Cells[row, 1, row, 8])
{
dataRange.Style.Border.Top.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Left.Style = ExcelBorderStyle.Thin;
dataRange.Style.Border.Right.Style = ExcelBorderStyle.Thin;
dataRange.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; // راست‌چین
dataRange.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
dataRange.Style.WrapText = true;
}
row++;
}
}
// Auto-fit columns to largest content
if (worksheet.Dimension != null)
{
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
}
// Set sheet to RTL for Persian
worksheet.View.RightToLeft = true;
return package.GetAsByteArray();
}
}
public class InstitutionContractLegalExcelViewModel
{
public string CompanyName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string NationalCode { get; set; }
public string RegistrationNumber { get; set; }
public string BirthDate { get; set; }
public string PhoneNumber { get; set; }
public string NationalNumber { get; set; }
}

View File

@@ -1585,12 +1585,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (employee.IsAuthorized == false)
{
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (apiResult == null)
{
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
}
if (apiResult.ResponseContext.Status.Code is 14 or 3)
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
@@ -1655,7 +1650,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
}
if (apiResult.ResponseContext.Status.Code is 14 or 3)
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });

View File

@@ -888,7 +888,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication
public void RemoveContract(long id)
{
_institutionContractRepository.RemoveContract(id);
}
@@ -982,12 +981,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication
existingContractingParty.UnAuthenticateLegalEdit(legalCommand.FName,legalCommand.LName,legalCommand.FatherName,legalCommand.IdNumber,existingContractingParty.IdNumberSeri,existingContractingParty.IdNumberSerial,
legalCommand.BirthDateFa,legalCommand.Gender,legalCommand.PhoneNumber);
}
if (existingContractingParty != null)
{
existingContractingParty.EditLegalPartyFromInstitution(command.LegalParty.Position,command.LegalParty.CompanyName,
command.LegalParty.RegisterId,command.LegalParty.NationalId);
}
}
else if (command.ContractingPartyLegalType == LegalType.Real)
{

View File

@@ -290,34 +290,8 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
if (rollCallsEmployee != null)
{
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
// {
// x.WorkshopId,
@@ -327,6 +301,27 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
// });
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
}

View File

@@ -240,8 +240,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
result.IdNumberSerial = createTemp.IdNumberSerial;
result.IdNumber = idNumber;
result.NationalCode = createTemp.NationalCode;
result.Phone = createTemp.Phone;
result.IdNumberSeri = createTemp.IdNumberSeri;
return op.Succcedded(result);

View File

@@ -4723,8 +4723,6 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
#endregion
#region KebabMahdiAbsentsCaclculation
var rollCallDays = groupedRollCall.Count > mandatoryDays ? mandatoryDays : groupedRollCall.Count;
@@ -5110,45 +5108,6 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
});
}
#endregion
#region اگر که پرسنل در روز های جمعه یا پنجشنبه غیبت داشت یک روز به غیبت اضافه شود
//این منطق زمانی برقرار هست که مرخصی در اون روز نداشته باشه
// ساخت لیست روزهای بین شروع و پایان قرارداد
var contractDaysList = Enumerable.Range(0, (contractEnd - contractStart).Days + 1)
.Select(offset => contractStart.AddDays(offset))
.ToList();
// کم کردن روزهایی که حضور دارند
var absentDaysList = contractDaysList
.Where(date => !groupedRollCall.Any(g => g.ShiftDate.Date == date.Date))
.ToList();
var absentFridaysOrThursdays = absentDaysList
.Where(date => date.DayOfWeek is DayOfWeek.Friday or DayOfWeek.Thursday)
.ToList();
var leaveList = _context.LeaveList
.Where(x => x.EmployeeId == employeeId
&& x.WorkshopId == workshopId
&& x.IsAccepted == true
&& x.StartLeave <= contractEnd
&& x.EndLeave >= contractStart
&& x.LeaveType == "استحقاقی"
&& x.PaidLeaveType =="روزانه")
.Select(x => new { x.StartLeave, x.EndLeave })
.ToList();
// بررسی کدام روزهای غایب جمعه/پنجشنبه در بازه مرخصی قرار ندارند
var absentFridaysOrThursdaysWithoutLeave = absentFridaysOrThursdays
.Where(date => !leaveList.Any(leave => date.Date >= leave.StartLeave.Date && date.Date <= leave.EndLeave.Date))
.ToList();
// تعداد روزهای غایب جمعه/پنجشنبه بدون مرخصی
int absentFridaysOrThursdaysWithoutLeaveCount = absentFridaysOrThursdaysWithoutLeave.Count;
absentsDeductionAmount += absentFridaysOrThursdaysWithoutLeaveCount * dailyWage;
#endregion
return new CustomizeCheckoutMandatoryViewModel

View File

@@ -507,13 +507,6 @@
</svg>
لیست تراکنش های درگاه پرداخت
</a></li>
<li permission="307" style=";white-space: nowrap">
<a class="clik10 " href="https://admin@(AppSetting.Value.Domain)/account-number-database" style="width: 7px;margin: 0 6px;">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
</svg>
اطلاعات بانکی طرف حساب
</a></li>
</ul>

View File

@@ -2,10 +2,8 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using AccountManagement.Domain.AccountLeftWorkAgg;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.AndroidApkVersionAgg;
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
using Company.Domain.RewardAgg;
using Company.Domain.RollCallAgg.DomainService;
using CompanyManagment.App.Contracts.AndroidApkVersion;
using CompanyManagment.EFCore;
@@ -13,24 +11,17 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using System.Net.Http;
using System.Security.Cryptography.Xml;
using System.Text.Json.Serialization;
using _0_Framework.Application.PaymentGateway;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.InstitutionPlanAgg;
using Company.Domain.PaymentTransactionAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.PaymentTransaction;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using Microsoft.Extensions.Options;
using Parbad;
using Parbad.AspNetCore;
using Parbad.Gateway.Sepehr;
using System.ComponentModel.DataAnnotations;
using _0_Framework.Application.Enums;
using CompanyManagement.Infrastructure.Excel.ContractingParty;
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
{
@@ -136,7 +127,9 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public async Task<IActionResult> OnPostShiftDateNew()
{
await UpdateInstitutionContract();
var bytes = generateContractingExcel();
return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"ContractingParties.xlsx");
ViewData["message"] = "تومام یک";
return Page();
}
@@ -961,6 +954,79 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
await transaction.CommitAsync();
}
#endregion
#region MyRegion
public byte[] generateContractingExcel()
{
var now = DateTime.Now;
var next6Month = now.AddMonths(6);
var institutionContracts = _context.InstitutionContractSet.Where(x => x.ContractEndGr
<= next6Month && x.ContractStartGr <= now)
.Join(_context.PersonalContractingParties.Where(x => x.IsLegal == "حقیقی"),
contract => contract.ContractingPartyId,
contractingParty => contractingParty.id,
(contract, contractingParty) => new { contract, contractingParty })
.GroupJoin(_context.Employers.Where(x => x.IsLegal == "حقیقی"),
combined => combined.contractingParty.Nationalcode,
employer => employer.Nationalcode,
(combined, employer) =>
new { combined.contract, combined.contractingParty, employer })
.SelectMany(x=>x.employer.DefaultIfEmpty(),(x,employer)=> new {x.contract, x.contractingParty, employer})
.ToList();
var data = institutionContracts.Select(x => new InstitutionContractDetailExcelViewModel()
{
FirstName = x.contractingParty.FName ?? x.employer?.FName ?? "",
LastName = x.contractingParty.LName ?? x.employer?.LName ?? "",
NationalCode = x.contractingParty.Nationalcode ?? x.employer?.Nationalcode ?? "",
BirthDate = x.contractingParty.DateOfBirth.HasValue
? x.contractingParty.DateOfBirth.ToFarsi()
: (x.employer?.DateOfBirth != null ? x.employer.DateOfBirth.ToFarsi() : ""),
NationalNumber = x.contractingParty.IdNumber ?? x.employer?.IdNumber ?? "",
PhoneNumber = x.contractingParty.Phone ?? x.employer?.Phone ?? "",
}).ToList().DistinctBy(x => x.NationalCode).ToList();
return InstitutionContractDetailExcelGenerator.Generate(data);
}
public byte[] generateContractingLegalExcel()
{
var now = DateTime.Now;
var next6Month = now.AddMonths(6);
var institutionContracts = _context.InstitutionContractSet.Where(x => x.ContractEndGr
<= next6Month && x.ContractStartGr <= now)
.Join(_context.PersonalContractingParties.Where(x => x.IsLegal == "حقوقی"),
contract => contract.ContractingPartyId,
contractingParty => contractingParty.id,
(contract, contractingParty) => new { contract, contractingParty })
.GroupJoin(_context.Employers.Where(x => x.IsLegal == "حقوقی"),
combined => combined.contractingParty.NationalId,
employer => employer.NationalId,
(combined, employer) =>
new { combined.contract, combined.contractingParty, employer })
.SelectMany(x=>x.employer.DefaultIfEmpty(),(x,employer)=> new {x.contract, x.contractingParty, employer})
.ToList();
var data = institutionContracts.Select(x => new InstitutionContractLegalExcelViewModel()
{
FirstName = x.contractingParty.CeoFName??x.employer?.FName??"",
LastName = x.contractingParty.CeoLName??x.employer?.EmployerLName??"",
NationalCode = x.contractingParty.Nationalcode??x.employer?.Nationalcode??"",
BirthDate = x.contractingParty.DateOfBirth.HasValue?
x.contractingParty.DateOfBirth.ToFarsi():
x.employer?.DateOfBirth.ToFarsi()??"",
NationalNumber = x.contractingParty.NationalId?? x.employer?.NationalId??"",
PhoneNumber = x.contractingParty.Phone?? x.employer?.Phone??"",
CompanyName = x.contractingParty.LName?? x.employer?.LName??"",
RegistrationNumber = x.contractingParty.RegisterId?? x.employer?.RegisterId??"",
}).ToList().DistinctBy(x=>x.NationalNumber).ToList();
return InstitutionContractLegalExcelGenerator.Generate(data);
}
#endregion
}

View File

@@ -136,9 +136,6 @@
<div class="card-title">قرارداد های مالی</div>
</div>
</div>
<div class="countNumber" id="InstitutionContractCount">
<span></span>
</div>
</div>
<div class="spinner-loading loading" style="display: none;">
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
@@ -195,7 +192,6 @@
<script>
$(document).ready(function () {
workFlowStartAndLeftWorkCountMenu();
getInstitutionContractCount();
$('.loadingButton').on('click', function (e) {
if (e.ctrlKey || e.metaKey) {
@@ -239,29 +235,5 @@
}
});
}
function getInstitutionContractCount() {
$.ajax({
async: true,
dataType: 'json',
url: `@Url.Page("./Index", "InstitutionContractCount")`,
headers: { "RequestVerificationToken": antiForgeryTokenLayout },
type: 'GET',
success: function (response) {
if (response.success) {
if (response.dataInstitutionContractCount === 0) {
$('#InstitutionContractCount').hide();
} else {
$('#InstitutionContractCount').show();
var contractCount = response.dataInstitutionContractCount > 99 ? "+99" : response.dataInstitutionContractCount;
$('#InstitutionContractCount span').text(contractCount);
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
}
});
}
</script>
}

View File

@@ -1,6 +1,5 @@
using _0_Framework.Application;
using Company.Domain.WorkshopAccountAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.RollCallService;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
@@ -19,15 +18,13 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow
private readonly IAuthHelper _authHelper;
private readonly IWorkshopAccountRepository _workshopAccountRepository;
public int EmployeeDocumentsAwaitingSubmitCount;
private readonly IInstitutionContractApplication _institutionContractApplication;
private readonly long _roleId;
public IndexModel(IAdminWorkFlowApplication adminWorkFlowApplication, IAuthHelper authHelper, IWorkshopAccountRepository workshopAccountRepository, IInstitutionContractApplication institutionContractApplication)
public IndexModel(IAdminWorkFlowApplication adminWorkFlowApplication, IAuthHelper authHelper, IWorkshopAccountRepository workshopAccountRepository)
{
_adminWorkFlowApplication = adminWorkFlowApplication;
_authHelper = authHelper;
_workshopAccountRepository = workshopAccountRepository;
_institutionContractApplication = institutionContractApplication;
_roleId = authHelper.CurrentAccountInfo().RoleId;
}
@@ -52,27 +49,5 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow
dataLeftWorkCount = resultLeftWorkCount,
});
}
public async Task<IActionResult> OnGetInstitutionContractCount()
{
try
{
var institutionContractCount = (await _institutionContractApplication.RegistrationWorkflowMainList()).Count;
return new JsonResult(new
{
success = true,
dataInstitutionContractCount = institutionContractCount
});
}
catch (Exception ex)
{
return new JsonResult(new
{
success = false,
message = ex.Message
});
}
}
}
}

View File

@@ -99,9 +99,7 @@ namespace ServiceHost.Areas.AdminNew.Pages
{
var currentAccountId = _authHelper.CurrentAccountId();
var accountWorkshops = _workshopAccountRepository.GetList(currentAccountId).Select(x => x.WorkshopId).ToList();
var permissions = _authHelper.GetPermissions();
int workFlowCount = await _adminWorkFlowApplication.GetWorkFlowCountsForAdmin(accountWorkshops,currentAccountId, _roleId,permissions);
int workFlowCount = await _adminWorkFlowApplication.GetWorkFlowCountsForAdmin(accountWorkshops,currentAccountId, _roleId);
return new JsonResult(new

View File

@@ -655,13 +655,6 @@
</svg>
لیست تراکنش های درگاه پرداخت
</a></li>
<li permission="307" style=";white-space: nowrap">
<a class="clik10 " href="https://admin@(AppSetting.Value.Domain)/account-number-database" style="width: 7px;margin: 0 6px;">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
</svg>
اطلاعات بانکی طرف حساب
</a></li>
</ul>

View File

@@ -19,7 +19,7 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
"applicationUrl": "https://localhost:5004;http://localhost:5003;",
"applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5005",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},

View File

@@ -67,7 +67,7 @@ public interface IAdminWorkFlowApplication
#endregion
Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds, long roleId);
Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId, List<int> permissions);
Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId);
Task<int> GetWorkFlowCountForChecker();
@@ -93,7 +93,7 @@ public interface IAdminWorkFlowApplication
#endregion
Task<int> GetInstitutionContractWorkflowCount();
}
/// <summary>

View File

@@ -3,7 +3,6 @@ using CompanyManagment.App.Contracts.Employee;
using WorkFlow.Application.Contracts.AdminWorkFlow;
using WorkFlow.Infrastructure.ACL.Employee;
using WorkFlow.Infrastructure.ACL.EmployeeDocuments;
using WorkFlow.Infrastructure.ACL.InstitutionContract;
using WorkFlow.Infrastructure.ACL.Workshop;
namespace WorkFlow.Application
@@ -13,76 +12,65 @@ namespace WorkFlow.Application
private readonly IWorkFlowEmployeeDocumentsACL _workFlowEmployeeDocumentsACL;
private readonly IWorkFlowWorkshopACL _workFlowWorkshopACL;
private readonly IWorkFlowEmployeeACL _workFlowEmployeeACL;
private readonly IWorkFlowInstitutionContractACL _workFlowInstitutionContractACL;
public AdminWorkFlowApplication(IWorkFlowEmployeeDocumentsACL workFlowEmployeeDocumentsACL,
IWorkFlowWorkshopACL workFlowWorkshopACL, IWorkFlowEmployeeACL workFlowEmployeeACL,
IWorkFlowInstitutionContractACL workFlowInstitutionContractACL)
public AdminWorkFlowApplication(IWorkFlowEmployeeDocumentsACL workFlowEmployeeDocumentsACL, IWorkFlowWorkshopACL workFlowWorkshopACL, IWorkFlowEmployeeACL workFlowEmployeeACL)
{
_workFlowEmployeeDocumentsACL = workFlowEmployeeDocumentsACL;
_workFlowWorkshopACL = workFlowWorkshopACL;
_workFlowEmployeeACL = workFlowEmployeeACL;
_workFlowInstitutionContractACL = workFlowInstitutionContractACL;
}
#region Pooya
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(
List<long> workshops)
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(List<long> workshops)
{
return _workFlowEmployeeDocumentsACL.GetWorkshopDocumentsAwaitingReviewForChecker(workshops);
}
public async Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds, long roleId)
public async Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds,long roleId)
{
var count = 0;
count += await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentRejectedForAdmin(workshopIds, roleId);
count += await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentRejectedForAdmin(workshopIds,roleId);
count += await _workFlowEmployeeDocumentsACL.GetCreatedEmployeesWorkshopDocumentForAdmin(workshopIds,
roleId);
count+= await _workFlowEmployeeDocumentsACL.GetCreatedEmployeesWorkshopDocumentForAdmin(workshopIds,roleId);
//count+= await _workFlowEmployeeDocumentsACL.GetClientRejectedDocumentWorkshopsForAdmin(workshopIds, roleId);
return count;
}
public async Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId, long roleId,
List<int> permissions)
public async Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId,long roleId)
{
var employeeDocumentWorkFlowCounts = await GetEmployeeDocumentWorkFlowCountsForAdmin(workshopIds, roleId);
var startWork = await GetWorkshopsForEmployeeStartWorkCount(accountId);
var leftWork = await GetWorkshopsForLeftWorkTempCount(accountId);
int institutionContract = 0;
if (permissions.Any(x => x == 1004))
{
institutionContract = await GetInstitutionContractWorkflowCount();
}
return employeeDocumentWorkFlowCounts + startWork + leftWork +institutionContract;
return employeeDocumentWorkFlowCounts + startWork + leftWork;
}
public async Task<int> GetWorkFlowCountForChecker()
{
return await _workFlowEmployeeDocumentsACL.GetCheckerWorkFlowCount();
}
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(
List<long> workshops)
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(List<long> workshops)
{
return _workFlowEmployeeDocumentsACL.GetWorkshopsWithDocumentsAwaitingUploadForAdmin(workshops);
}
#endregion
#region Mahan
#region شروع به کار پرسنل افزوده شده
public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(
long accountId)
public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId)
{
return await _workFlowWorkshopACL.GetWorkshopsForEmployeeStartWork(accountId);
}
@@ -93,14 +81,14 @@ namespace WorkFlow.Application
}
public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(
long workshopId)
public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId)
{
return await _workFlowEmployeeACL.GetClientEmployeesStartWork(workshopId);
}
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(
long employeeId, long workshopId)
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
{
return await _workFlowEmployeeACL.GetEmployeeEditInEmployeeDocumentWorkFlow(employeeId, workshopId);
}
@@ -115,24 +103,16 @@ namespace WorkFlow.Application
#region ترک کار موقت
public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(
long accountId)
public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId)
{
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTemp(accountId);
}
public async Task<int> GetWorkshopsForLeftWorkTempCount(long accountId)
{
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTempCount(accountId);
}
public async Task<int> GetInstitutionContractWorkflowCount()
{
return await _workFlowInstitutionContractACL.GetInstitutionContractWorkflowCount();
}
public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(
long workshopId)
public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId)
{
return await _workFlowEmployeeACL.GetEmployeesForLeftWorkTemp(workshopId);
}
@@ -141,8 +121,7 @@ namespace WorkFlow.Application
#region آپلود مدارک پرسنل
public async Task<ICollection<WorkshopWithDocumentsViewModelForWorkFlow>>
GetWorkshopDocumentCreatedEmployeeForAdmin(List<long> workshops, long roleId)
public async Task<ICollection<WorkshopWithDocumentsViewModelForWorkFlow>> GetWorkshopDocumentCreatedEmployeeForAdmin(List<long> workshops, long roleId)
{
return await _workFlowEmployeeDocumentsACL.GetWorkshopDocumentCreatedEmployeeForAdmin(workshops, roleId);
}
@@ -151,4 +130,6 @@ namespace WorkFlow.Application
#endregion
}
}
}

View File

@@ -58,5 +58,4 @@ public class WorkFlowEmployeeACL : IWorkFlowEmployeeACL
{
return await _employeeApplication.EditEmployeeInEmployeeDocumentWorkFlow(command);
}
}

View File

@@ -1,23 +0,0 @@
using CompanyManagment.App.Contracts.InstitutionContract;
namespace WorkFlow.Infrastructure.ACL.InstitutionContract;
public interface IWorkFlowInstitutionContractACL
{
Task<int> GetInstitutionContractWorkflowCount();
}
public class WorkFlowInstitutionContractACL : IWorkFlowInstitutionContractACL
{
private readonly IInstitutionContractApplication _institutionContractApplication;
public WorkFlowInstitutionContractACL(IInstitutionContractApplication institutionContractApplication)
{
_institutionContractApplication = institutionContractApplication;
}
public async Task<int> GetInstitutionContractWorkflowCount()
{
var list = await _institutionContractApplication.RegistrationWorkflowMainList();
return list.Count;
}
}

View File

@@ -9,7 +9,6 @@ using WorkFlow.Infrastructure.ACL.Checkout;
using WorkFlow.Infrastructure.ACL.CustomizedWorkshopSettings;
using WorkFlow.Infrastructure.ACL.Employee;
using WorkFlow.Infrastructure.ACL.EmployeeDocuments;
using WorkFlow.Infrastructure.ACL.InstitutionContract;
using WorkFlow.Infrastructure.ACL.RollCall;
using WorkFlow.Infrastructure.ACL.Workshop;
using WorkFlow.Infrastructure.EfCore;
@@ -34,7 +33,8 @@ namespace WorkFlow.Infrastructure.Config
services.AddTransient<IWorkFlowRollCallACL, WorkFlowRollCallACL>();
services.AddTransient<IWorkFlowCustomizedWorkshopSettingsACL, WorkFlowCustomizedWorkshopSettingsACL>();
services.AddTransient<IWorkFlowEmployeeACL, WorkFlowEmployeeACL>();
services.AddTransient<IWorkFlowInstitutionContractACL, WorkFlowInstitutionContractACL>();
services.AddTransient<IWorkFlowWorkshopACL, WorkFlowWorkshopACL>();