Compare commits
24 Commits
Feature/Cl
...
deploy-org
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd1c1fa814 | ||
|
|
8496b52013 | ||
|
|
5c1547dced | ||
|
|
c09321d89d | ||
| 219e64c0f7 | |||
| b42217ed94 | |||
| 8b6786c09a | |||
| 45c5d20323 | |||
| ad6f872145 | |||
| d22805892a | |||
| 4da496cab8 | |||
| aa0eae6c83 | |||
| 8e5d4c312e | |||
| 4b39994de6 | |||
| 0dd2dc7c43 | |||
| 20c00893b6 | |||
| b0d174a575 | |||
| 293ea0f6f4 | |||
| 3ce4cf3966 | |||
| 0fbd5c9d3e | |||
| 8436f70aa0 | |||
| 9cf8447a83 | |||
| e124a4d5d9 | |||
| 7b9e7881c6 |
9
.github/workflows/dotnet-developPublish.yml
vendored
9
.github/workflows/dotnet-developPublish.yml
vendored
@@ -5,8 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- Main
|
- Main
|
||||||
|
|
||||||
env:
|
|
||||||
DOTNET_ENVIRONMENT: Development
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
@@ -37,12 +35,11 @@ jobs:
|
|||||||
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
||||||
-verb:sync `
|
-verb:sync `
|
||||||
-source:contentPath="$publishFolder" `
|
-source:contentPath="$publishFolder" `
|
||||||
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R",authType="Basic" `
|
-dest:contentPath="dadmehrg",computerName="https://$env:SERVER_HOST:8172/msdeploy.axd?site=gozareshgir",userName="$env:DEPLOY_USER",password="$env:DEPLOY_PASSWORD",authType="Basic" `
|
||||||
-allowUntrusted `
|
-allowUntrusted `
|
||||||
-enableRule:AppOffline
|
-enableRule:AppOffline
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SERVER_HOST: your-server-ip-or-domain
|
SERVER_HOST: 171.22.24.15
|
||||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||||
DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
|
DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ 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
|
||||||
|
|
||||||
@@ -63,4 +67,8 @@ 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
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
|||||||
|
|
||||||
Employee GetIgnoreQueryFilter(long id);
|
Employee GetIgnoreQueryFilter(long id);
|
||||||
|
|
||||||
[Obsolete("این متد منسوخ شده است و از متد WorkedEmployeesInWorkshopSelectList استفاده کنید")]
|
|
||||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||||
|
|
||||||
|
|
||||||
@@ -78,32 +77,7 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
|||||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id);
|
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id);
|
||||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||||
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
||||||
|
#endregion
|
||||||
/// <summary>
|
|
||||||
/// دریافت لیست پرسنل کلاینت
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchModel"></param>
|
|
||||||
/// <param name="workshopId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// پرینت تجمیعی پرسنل کلاینت
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="workshopId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// سلکت لیست پرسنل های کارگاه کلاینت
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="workshopId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,7 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
||||||
|
Task<InsuranceClientPrintViewModel> ClientPrintOne(long id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,86 +8,130 @@ using System.Text.RegularExpressions;
|
|||||||
|
|
||||||
namespace CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
namespace CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
||||||
|
|
||||||
|
// Enum برای تعریف ستونهای موجود
|
||||||
|
public enum ExcelColumnType
|
||||||
|
{
|
||||||
|
RowNumber, // ردیف
|
||||||
|
PhysicalContract, // قرارداد فیزیکی
|
||||||
|
ContractNo, // شماره قرارداد
|
||||||
|
Representative, // معرف
|
||||||
|
ContractingPartyName, // طرف حساب
|
||||||
|
ArchiveCode, // شماره کارفرما
|
||||||
|
EmployerName, // کارفرما
|
||||||
|
WorkshopName, // کارگاهها (چندخطی)
|
||||||
|
WorkshopCount, // تعداد کارگاه
|
||||||
|
EmployeeCount, // مجموع پرسنل
|
||||||
|
ContractStartDate, // شروع قرارداد
|
||||||
|
ContractEndDate, // پایان قرارداد
|
||||||
|
InstallmentAmount, // مبلغ قسط
|
||||||
|
ContractAmount, // مبلغ قرارداد
|
||||||
|
FinancialStatus // وضعیت مالی
|
||||||
|
}
|
||||||
|
|
||||||
|
// کلاس کانفیگ برای تنظیم ستونهای نمایشی
|
||||||
|
public class ExcelColumnConfig
|
||||||
|
{
|
||||||
|
public List<ExcelColumnType> VisibleColumns { get; set; }
|
||||||
|
|
||||||
|
public ExcelColumnConfig()
|
||||||
|
{
|
||||||
|
// فعلاً تمام ستونها فعال هستند
|
||||||
|
VisibleColumns = new List<ExcelColumnType>
|
||||||
|
{
|
||||||
|
ExcelColumnType.RowNumber,
|
||||||
|
ExcelColumnType.PhysicalContract,
|
||||||
|
ExcelColumnType.ContractNo,
|
||||||
|
ExcelColumnType.Representative,
|
||||||
|
ExcelColumnType.ContractingPartyName,
|
||||||
|
ExcelColumnType.ArchiveCode,
|
||||||
|
ExcelColumnType.EmployerName,
|
||||||
|
ExcelColumnType.WorkshopName,
|
||||||
|
ExcelColumnType.WorkshopCount,
|
||||||
|
ExcelColumnType.EmployeeCount,
|
||||||
|
ExcelColumnType.ContractStartDate,
|
||||||
|
ExcelColumnType.ContractEndDate,
|
||||||
|
ExcelColumnType.InstallmentAmount,
|
||||||
|
ExcelColumnType.ContractAmount,
|
||||||
|
ExcelColumnType.FinancialStatus
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class InstitutionContractExcelGenerator
|
public class InstitutionContractExcelGenerator
|
||||||
{
|
{
|
||||||
|
private static ExcelColumnConfig _columnConfig = new ExcelColumnConfig();
|
||||||
|
|
||||||
public static byte[] GenerateExcel(List<InstitutionContractViewModel> institutionContractViewModels)
|
public static byte[] GenerateExcel(List<InstitutionContractExcelViewModel> contractViewModels)
|
||||||
{
|
{
|
||||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||||
using var package = new ExcelPackage();
|
using var package = new ExcelPackage();
|
||||||
var allWorksheet = package.Workbook.Worksheets.Add("همه");
|
|
||||||
|
|
||||||
var blueWorksheet = package.Workbook.Worksheets.Add("آبی");
|
|
||||||
blueWorksheet.TabColor = Color.LightBlue;
|
|
||||||
|
|
||||||
var grayWorksheet = package.Workbook.Worksheets.Add("خاکستری");
|
|
||||||
grayWorksheet.TabColor = Color.LightGray;
|
|
||||||
|
|
||||||
var redWorksheet = package.Workbook.Worksheets.Add("قرمز");
|
|
||||||
redWorksheet.TabColor = Color.LightCoral;
|
|
||||||
|
|
||||||
var purpleWorksheet = package.Workbook.Worksheets.Add("بنفش");
|
|
||||||
purpleWorksheet.TabColor = Color.MediumPurple;
|
|
||||||
|
|
||||||
var blackWorksheet = package.Workbook.Worksheets.Add("مشکی");
|
|
||||||
blackWorksheet.TabColor = Color.DimGray;
|
|
||||||
|
|
||||||
var yellowWorksheet = package.Workbook.Worksheets.Add("زرد");
|
|
||||||
yellowWorksheet.TabColor = Color.Yellow;
|
|
||||||
|
|
||||||
var whiteWorksheet = package.Workbook.Worksheets.Add("سفید");
|
|
||||||
whiteWorksheet.TabColor = Color.White;
|
|
||||||
|
|
||||||
|
|
||||||
CreateExcelSheet(institutionContractViewModels, allWorksheet);
|
|
||||||
|
|
||||||
var blueContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "blue").ToList();
|
|
||||||
CreateExcelSheet(blueContracts, blueWorksheet);
|
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(blueContracts).ToList();
|
|
||||||
|
|
||||||
var grayContracts = institutionContractViewModels.Where(x => x.IsContractingPartyBlock == "true").ToList();
|
|
||||||
CreateExcelSheet(grayContracts, grayWorksheet);
|
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(grayContracts).ToList();
|
|
||||||
|
|
||||||
var redContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "red").ToList();
|
|
||||||
CreateExcelSheet(redContracts, redWorksheet);
|
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(redContracts).ToList();
|
|
||||||
|
|
||||||
var purpleContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "purple").ToList();
|
|
||||||
CreateExcelSheet(purpleContracts, purpleWorksheet);
|
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(purpleContracts).ToList();
|
|
||||||
|
|
||||||
var blackContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "black").ToList();
|
// ایجاد شیت برای هر تب با دادههای مربوطه
|
||||||
CreateExcelSheet(blackContracts, blackWorksheet);
|
foreach (var viewModel in contractViewModels)
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(blackContracts).ToList();
|
{
|
||||||
|
var worksheet = CreateWorksheet(package, viewModel.Tab);
|
||||||
var yellowContracts = institutionContractViewModels
|
CreateExcelSheet(viewModel.GetInstitutionContractListItemsViewModels ?? new List<GetInstitutionContractListItemsViewModel>(), worksheet);
|
||||||
.Where(x => string.IsNullOrWhiteSpace(x.ExpireColor) && x.WorkshopCount == "0").ToList();
|
}
|
||||||
CreateExcelSheet(yellowContracts, yellowWorksheet);
|
|
||||||
institutionContractViewModels = institutionContractViewModels.Except(yellowContracts).ToList();
|
|
||||||
|
|
||||||
var otherContracts = institutionContractViewModels;
|
|
||||||
CreateExcelSheet(otherContracts, whiteWorksheet);
|
|
||||||
|
|
||||||
return package.GetAsByteArray();
|
return package.GetAsByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateExcelSheet(List<InstitutionContractViewModel> institutionContractViewModels, ExcelWorksheet worksheet)
|
/// <summary>
|
||||||
|
/// ایجاد شیت بر اساس نوع تب
|
||||||
|
/// </summary>
|
||||||
|
private static ExcelWorksheet CreateWorksheet(ExcelPackage package, InstitutionContractListStatus? status)
|
||||||
{
|
{
|
||||||
// Headers
|
return status switch
|
||||||
worksheet.Cells[1, 1].Value = "شماره قرارداد";
|
{
|
||||||
worksheet.Cells[1, 2].Value = "طرف حساب";
|
InstitutionContractListStatus.DeactiveWithDebt =>
|
||||||
worksheet.Cells[1, 3].Value = "شماره کارفرما";
|
CreateColoredWorksheet(package, "غیرفعال دارای بدهی", Color.LightBlue),
|
||||||
worksheet.Cells[1, 4].Value = "کارفرما ها";
|
|
||||||
worksheet.Cells[1, 5].Value = "کارگاه ها";
|
InstitutionContractListStatus.Deactive =>
|
||||||
worksheet.Cells[1, 6].Value = "مجبوع پرسنل";
|
CreateColoredWorksheet(package, "غیرفعال", Color.LightGray),
|
||||||
worksheet.Cells[1, 7].Value = "شروع قرارداد";
|
|
||||||
worksheet.Cells[1, 8].Value = "پایان قرارداد";
|
InstitutionContractListStatus.PendingForRenewal =>
|
||||||
worksheet.Cells[1, 9].Value = "مبلغ قرارداد (بدون کارگاه)";
|
CreateColoredWorksheet(package, "در انتظار تمدید", Color.LightCoral),
|
||||||
worksheet.Cells[1, 10].Value = "مبلغ قرارداد";
|
|
||||||
worksheet.Cells[1, 11].Value = "وضعیت مالی";
|
InstitutionContractListStatus.Free =>
|
||||||
|
CreateColoredWorksheet(package, "بنفش", Color.MediumPurple),
|
||||||
|
|
||||||
|
InstitutionContractListStatus.Block =>
|
||||||
|
CreateColoredWorksheet(package, "بلاک", Color.DimGray),
|
||||||
|
|
||||||
|
InstitutionContractListStatus.WithoutWorkshop =>
|
||||||
|
CreateColoredWorksheet(package, "بدون کارگاه", Color.Yellow),
|
||||||
|
|
||||||
|
InstitutionContractListStatus.Active =>
|
||||||
|
CreateColoredWorksheet(package, "فعال", Color.White),
|
||||||
|
|
||||||
|
InstitutionContractListStatus.PendingForVerify =>
|
||||||
|
CreateColoredWorksheet(package, "در انتظار تایید", Color.OrangeRed),
|
||||||
|
|
||||||
|
null => CreateColoredWorksheet(package, "کل قرارداد ها", Color.White),
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
using (var range = worksheet.Cells[1, 1, 1, 11])
|
/// <summary>
|
||||||
|
/// ایجاد شیت با رنگ تب
|
||||||
|
/// </summary>
|
||||||
|
private static ExcelWorksheet CreateColoredWorksheet(ExcelPackage package, string sheetName, Color tabColor)
|
||||||
|
{
|
||||||
|
var worksheet = package.Workbook.Worksheets.Add(sheetName);
|
||||||
|
worksheet.TabColor = tabColor;
|
||||||
|
return worksheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreateExcelSheet(List<GetInstitutionContractListItemsViewModel> contractItems, ExcelWorksheet worksheet)
|
||||||
|
{
|
||||||
|
// دریافت نقشه ستونهای مرئی
|
||||||
|
var visibleColumnIndices = GetVisibleColumnIndices();
|
||||||
|
int columnCount = visibleColumnIndices.Count;
|
||||||
|
|
||||||
|
// تنظیم Headers
|
||||||
|
SetupHeaders(worksheet, visibleColumnIndices, columnCount);
|
||||||
|
|
||||||
|
using (var range = worksheet.Cells[1, 1, 1, columnCount])
|
||||||
{
|
{
|
||||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||||
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
|
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
|
||||||
@@ -110,30 +154,35 @@ public class InstitutionContractExcelGenerator
|
|||||||
|
|
||||||
int row = 2;
|
int row = 2;
|
||||||
|
|
||||||
for (int i = 0; i < institutionContractViewModels.Count; i++)
|
for (int i = 0; i < contractItems.Count; i++)
|
||||||
{
|
{
|
||||||
var contract = institutionContractViewModels[i];
|
var contract = contractItems[i];
|
||||||
var employers = contract.EmployerViewModels?.ToList() ?? new();
|
var employers = contract.EmployerNames?.ToList() ?? new();
|
||||||
var workshops = contract.WorkshopViewModels?.ToList() ?? new();
|
var workshops = contract.WorkshopNames?.ToList() ?? new();
|
||||||
|
|
||||||
int maxRows = Math.Max(employers.Count, workshops.Count);
|
int maxRows = 1; // هر قرارداد فقط یک ردیف؛ نیازی به مرج عمودی نیست
|
||||||
maxRows = Math.Max(1, maxRows);
|
|
||||||
|
|
||||||
int startRow = row;
|
int startRow = row;
|
||||||
int endRow = row + maxRows - 1;
|
int endRow = row + maxRows - 1;
|
||||||
|
|
||||||
// 🎨 دریافت رنگ پسزمینه از مقدار رنگ موجود در داده
|
// 🎨 دریافت رنگ پسزمینه بر اساس وضعیت قرارداد
|
||||||
string colorName = contract.ExpireColor.ToLower();
|
var fillColor = GetColorByStatus(contract.ListStatus, contract.WorkshopsCount);
|
||||||
var fillColor = GetColorByName(colorName, contract.WorkshopCount, contract.IsContractingPartyBlock);
|
|
||||||
|
|
||||||
for (int j = 0; j < maxRows; j++)
|
for (int j = 0; j < maxRows; j++)
|
||||||
{
|
{
|
||||||
int currentRow = row + j;
|
int currentRow = row + j;
|
||||||
|
|
||||||
worksheet.Cells[currentRow, 4].Value = j < employers.Count ? employers[j].FullName : null;
|
// پر کردن ستونهای employer و workshop
|
||||||
worksheet.Cells[currentRow, 5].Value = j < workshops.Count ? workshops[j].WorkshopFullName : null;
|
var employerColIndex = GetColumnIndexForType(ExcelColumnType.EmployerName, visibleColumnIndices);
|
||||||
|
var workshopColIndex = GetColumnIndexForType(ExcelColumnType.WorkshopName, visibleColumnIndices);
|
||||||
|
|
||||||
for (int col = 1; col <= 11; col++)
|
if (employerColIndex > 0)
|
||||||
|
worksheet.Cells[currentRow, employerColIndex].Value = j < employers.Count ? employers[j] : null;
|
||||||
|
|
||||||
|
if (workshopColIndex > 0)
|
||||||
|
worksheet.Cells[currentRow, workshopColIndex].Value = j < workshops.Count ? workshops[j] : null;
|
||||||
|
|
||||||
|
for (int col = 1; col <= columnCount; col++)
|
||||||
{
|
{
|
||||||
var cell = worksheet.Cells[currentRow, col];
|
var cell = worksheet.Cells[currentRow, col];
|
||||||
|
|
||||||
@@ -154,109 +203,226 @@ public class InstitutionContractExcelGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 🧱 مرج و مقداردهی ستونهای اصلی
|
// 🧱 مرج و مقداردهی ستونهای اصلی
|
||||||
worksheet.Cells[startRow, 1, endRow, 1].Merge = true;
|
FillColumnData(worksheet, contract, startRow, endRow, visibleColumnIndices);
|
||||||
worksheet.Cells[startRow, 1].Value = contract.ContractNo;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 2, endRow, 2].Merge = true;
|
|
||||||
worksheet.Cells[startRow, 2].Value = contract.ContractingPartyName;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 3, endRow, 3].Merge = true;
|
|
||||||
worksheet.Cells[startRow, 3].Value = contract.ArchiveCode;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 6, endRow, 6].Merge = true;
|
|
||||||
worksheet.Cells[startRow, 6].Value = contract.EmployeeCount;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 7, endRow, 7].Merge = true;
|
|
||||||
worksheet.Cells[startRow, 7].Value = contract.ContractStartFa;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 8, endRow, 8].Merge = true;
|
|
||||||
worksheet.Cells[startRow, 8].Value = contract.ContractEndFa;
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 9, endRow, 9].Merge = true;
|
|
||||||
var contractWithoutWorkshopAmountCell = worksheet.Cells[startRow, 9];
|
|
||||||
contractWithoutWorkshopAmountCell.Value = contract.WorkshopCount == "0" ? MoneyToDouble(contract.ContractAmount) : "";
|
|
||||||
contractWithoutWorkshopAmountCell.Style.Numberformat.Format = "#,##0";
|
|
||||||
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 10, endRow, 10].Merge = true;
|
|
||||||
var contractAmountCell = worksheet.Cells[startRow, 10];
|
|
||||||
contractAmountCell.Value = contract.WorkshopCount != "0" ? MoneyToDouble(contract.ContractAmount) : "";
|
|
||||||
contractAmountCell.Style.Numberformat.Format = "#,##0";
|
|
||||||
|
|
||||||
|
|
||||||
worksheet.Cells[startRow, 11, endRow, 11].Merge = true;
|
|
||||||
var balance = MoneyToDouble(contract.BalanceStr);
|
|
||||||
var balanceCell = worksheet.Cells[startRow, 11];
|
|
||||||
balanceCell.Value = balance;
|
|
||||||
balanceCell.Style.Numberformat.Format = "#,##0";
|
|
||||||
|
|
||||||
if (balance > 0)
|
|
||||||
balanceCell.Style.Font.Color.SetColor(Color.Red);
|
|
||||||
else if (balance < 0)
|
|
||||||
balanceCell.Style.Font.Color.SetColor(Color.Green);
|
|
||||||
|
|
||||||
// 📦 بوردر ضخیم خارجی برای هر سطر
|
// 📦 بوردر ضخیم خارجی برای هر سطر
|
||||||
var boldRange = worksheet.Cells[startRow, 1, endRow, 11];
|
var boldRange = worksheet.Cells[startRow, 1, endRow, columnCount];
|
||||||
boldRange.Style.Border.BorderAround(ExcelBorderStyle.Medium);
|
boldRange.Style.Border.BorderAround(ExcelBorderStyle.Medium);
|
||||||
|
|
||||||
row += maxRows;
|
row += maxRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetupPrintSettings(worksheet, visibleColumnIndices, columnCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت فهرست ستونهای مرئی بر اساس کانفیگ
|
||||||
|
/// </summary>
|
||||||
|
private static List<ExcelColumnType> GetVisibleColumnIndices()
|
||||||
|
{
|
||||||
|
return _columnConfig.VisibleColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت شماره ستون برای یک نوع ستون خاص
|
||||||
|
/// </summary>
|
||||||
|
private static int GetColumnIndexForType(ExcelColumnType columnType, List<ExcelColumnType> visibleColumns)
|
||||||
|
{
|
||||||
|
var index = visibleColumns.IndexOf(columnType);
|
||||||
|
return index >= 0 ? index + 1 : 0; // 1-based indexing
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت متن header برای یک نوع ستون
|
||||||
|
/// </summary>
|
||||||
|
private static string GetColumnHeader(ExcelColumnType columnType)
|
||||||
|
{
|
||||||
|
return columnType switch
|
||||||
|
{
|
||||||
|
ExcelColumnType.RowNumber => "ردیف",
|
||||||
|
ExcelColumnType.PhysicalContract => "قرارداد فیزیکی",
|
||||||
|
ExcelColumnType.ContractNo => "شماره قرارداد",
|
||||||
|
ExcelColumnType.Representative => "معرف",
|
||||||
|
ExcelColumnType.ContractingPartyName => "طرف حساب",
|
||||||
|
ExcelColumnType.ArchiveCode => "شماره کارفرما",
|
||||||
|
ExcelColumnType.EmployerName => "کارفرما",
|
||||||
|
ExcelColumnType.WorkshopName => "کارگاهها",
|
||||||
|
ExcelColumnType.WorkshopCount => "تعداد کارگاه",
|
||||||
|
ExcelColumnType.EmployeeCount => "مجموع پرسنل",
|
||||||
|
ExcelColumnType.ContractStartDate => "شروع قرارداد",
|
||||||
|
ExcelColumnType.ContractEndDate => "پایان قرارداد",
|
||||||
|
ExcelColumnType.InstallmentAmount => "مبلغ قسط",
|
||||||
|
ExcelColumnType.ContractAmount => "مبلغ قرارداد",
|
||||||
|
ExcelColumnType.FinancialStatus => "وضعیت مالی",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تنظیم Headerهای ستونها
|
||||||
|
/// </summary>
|
||||||
|
private static void SetupHeaders(ExcelWorksheet worksheet, List<ExcelColumnType> visibleColumns, int columnCount)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < visibleColumns.Count; i++)
|
||||||
|
{
|
||||||
|
worksheet.Cells[1, i + 1].Value = GetColumnHeader(visibleColumns[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// پر کردن دادههای ستونها برای یک قرارداد
|
||||||
|
/// </summary>
|
||||||
|
private static void FillColumnData(ExcelWorksheet worksheet, GetInstitutionContractListItemsViewModel contract, int startRow, int endRow, List<ExcelColumnType> visibleColumns)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < visibleColumns.Count; i++)
|
||||||
|
{
|
||||||
|
int columnIndex = i + 1; // 1-based indexing
|
||||||
|
var columnType = visibleColumns[i];
|
||||||
|
|
||||||
|
// Merge cells for non-repeating columns
|
||||||
|
worksheet.Cells[startRow, columnIndex, endRow, columnIndex].Merge = true;
|
||||||
|
|
||||||
|
var cell = worksheet.Cells[startRow, columnIndex];
|
||||||
|
|
||||||
|
switch (columnType)
|
||||||
|
{
|
||||||
|
case ExcelColumnType.RowNumber:
|
||||||
|
// TODO: مقدار ردیف رو از user input دریافت کن
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.PhysicalContract:
|
||||||
|
// TODO: مقدار قرارداد فیزیکی رو دریافت کن
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ContractNo:
|
||||||
|
cell.Value = contract.ContractNo;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.Representative:
|
||||||
|
cell.Value = contract.RepresentativeName;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ContractingPartyName:
|
||||||
|
cell.Value = contract.ContractingPartyName;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ArchiveCode:
|
||||||
|
cell.Value = contract.ArchiveNo;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.EmployerName:
|
||||||
|
// این ستون چندخطی است و داخل loop پر میشود
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.WorkshopName:
|
||||||
|
// این ستون چندخطی است و داخل loop پر میشود
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.WorkshopCount:
|
||||||
|
cell.Value = contract.WorkshopsCount;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.EmployeeCount:
|
||||||
|
cell.Value = contract.EmployeesCount;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ContractStartDate:
|
||||||
|
cell.Value = contract.ContractStartFa;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ContractEndDate:
|
||||||
|
cell.Value = contract.ContractEndFa;
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.InstallmentAmount:
|
||||||
|
cell.Value = contract.InstallmentAmount;
|
||||||
|
cell.Style.Numberformat.Format = "#,##0";
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.ContractAmount:
|
||||||
|
cell.Value = contract.ContractAmount;
|
||||||
|
cell.Style.Numberformat.Format = "#,##0";
|
||||||
|
break;
|
||||||
|
case ExcelColumnType.FinancialStatus:
|
||||||
|
cell.Value = contract.Balance;
|
||||||
|
cell.Style.Numberformat.Format = "#,##0";
|
||||||
|
|
||||||
|
if (contract.Balance > 0)
|
||||||
|
cell.Style.Font.Color.SetColor(Color.Red);
|
||||||
|
else if (contract.Balance < 0)
|
||||||
|
cell.Style.Font.Color.SetColor(Color.Green);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تنظیم تنظیمات چاپ و عرض ستونها
|
||||||
|
/// </summary>
|
||||||
|
private static void SetupPrintSettings(ExcelWorksheet worksheet, List<ExcelColumnType> visibleColumns, int columnCount)
|
||||||
|
{
|
||||||
worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
|
worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
|
||||||
worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
|
worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
|
||||||
worksheet.PrinterSettings.FitToPage = true;
|
worksheet.PrinterSettings.FitToPage = true;
|
||||||
worksheet.PrinterSettings.FitToWidth = 1;
|
worksheet.PrinterSettings.FitToWidth = 1;
|
||||||
worksheet.PrinterSettings.FitToHeight = 0;
|
worksheet.PrinterSettings.FitToHeight = 0;
|
||||||
worksheet.PrinterSettings.Scale = 85;
|
worksheet.PrinterSettings.Scale = 85;
|
||||||
int contractNoCol = 1;
|
|
||||||
int contractingPartyNameCol = 2;
|
// تنظیم عرض ستونها بر اساس نوع ستون
|
||||||
int archiveNoCol = 3;
|
for (int i = 0; i < visibleColumns.Count; i++)
|
||||||
int employersCol = 4;
|
{
|
||||||
int workshopsCol = 5;
|
int columnIndex = i + 1;
|
||||||
int employeeCountCol = 6;
|
worksheet.Columns[columnIndex].Width = GetColumnWidth(visibleColumns[i]);
|
||||||
int startContractCol = 7;
|
}
|
||||||
int endContractCol = 8;
|
|
||||||
int contractWithoutWorkshopAmountCol = 9;
|
|
||||||
int contractAmountCol = 10;
|
|
||||||
int balanceCol = 11;
|
|
||||||
worksheet.Columns[contractNoCol].Width = 17;
|
|
||||||
worksheet.Columns[contractingPartyNameCol].Width = 40;
|
|
||||||
worksheet.Columns[archiveNoCol].Width = 10;
|
|
||||||
worksheet.Columns[employersCol].Width = 40;
|
|
||||||
worksheet.Columns[workshopsCol].Width = 45;
|
|
||||||
worksheet.Columns[employeeCountCol].Width = 12;
|
|
||||||
worksheet.Columns[startContractCol].Width = 12;
|
|
||||||
worksheet.Columns[endContractCol].Width = 12;
|
|
||||||
worksheet.Columns[contractWithoutWorkshopAmountCol].Width = 18;
|
|
||||||
worksheet.Columns[contractAmountCol].Width = 12;
|
|
||||||
worksheet.Columns[balanceCol].Width = 12;
|
|
||||||
worksheet.View.RightToLeft = true; // فارسی
|
worksheet.View.RightToLeft = true; // فارسی
|
||||||
//worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت عرض ستون پیشفرض برای هر نوع ستون
|
||||||
|
/// </summary>
|
||||||
|
private static double GetColumnWidth(ExcelColumnType columnType)
|
||||||
|
{
|
||||||
|
return columnType switch
|
||||||
|
{
|
||||||
|
ExcelColumnType.RowNumber => 8,
|
||||||
|
ExcelColumnType.PhysicalContract => 15,
|
||||||
|
ExcelColumnType.ContractNo => 17,
|
||||||
|
ExcelColumnType.Representative => 15,
|
||||||
|
ExcelColumnType.ContractingPartyName => 40,
|
||||||
|
ExcelColumnType.ArchiveCode => 10,
|
||||||
|
ExcelColumnType.EmployerName => 40,
|
||||||
|
ExcelColumnType.WorkshopName => 45,
|
||||||
|
ExcelColumnType.WorkshopCount => 12,
|
||||||
|
ExcelColumnType.EmployeeCount => 12,
|
||||||
|
ExcelColumnType.ContractStartDate => 12,
|
||||||
|
ExcelColumnType.ContractEndDate => 12,
|
||||||
|
ExcelColumnType.InstallmentAmount => 15,
|
||||||
|
ExcelColumnType.ContractAmount => 15,
|
||||||
|
ExcelColumnType.FinancialStatus => 12,
|
||||||
|
_ => 12
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double MoneyToDouble(string value)
|
private static double MoneyToDouble(string value)
|
||||||
{
|
{
|
||||||
Console.WriteLine(value);
|
if (string.IsNullOrEmpty(value))
|
||||||
|
return 0;
|
||||||
|
|
||||||
var min = value.Length > 1 ? value.Substring(0, 2) : "";
|
var min = value.Length > 1 ? value.Substring(0, 2) : "";
|
||||||
var test = min == "\u200e\u2212" ? value.MoneyToDouble() * -1 : value.MoneyToDouble();
|
var test = min == "\u200e\u2212" ? value.MoneyToDouble() * -1 : value.MoneyToDouble();
|
||||||
|
|
||||||
Console.WriteLine(test);
|
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
private static Color GetColorByName(string name, string workshopCount, string IsContractingPartyBlock)
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت رنگ بر اساس وضعیت قرارداد
|
||||||
|
/// </summary>
|
||||||
|
private static Color GetColorByStatus(InstitutionContractListStatus status, int workshopsCount)
|
||||||
{
|
{
|
||||||
return name switch
|
return status switch
|
||||||
{
|
{
|
||||||
"blue" => Color.LightBlue,
|
InstitutionContractListStatus.DeactiveWithDebt => Color.LightBlue,
|
||||||
_ when IsContractingPartyBlock == "true" => Color.LightGray,
|
InstitutionContractListStatus.Deactive => Color.LightGray,
|
||||||
"red" => Color.LightCoral,
|
InstitutionContractListStatus.PendingForRenewal => Color.LightCoral,
|
||||||
"purple" => Color.MediumPurple,
|
InstitutionContractListStatus.Free => Color.MediumPurple,
|
||||||
"black" => Color.DimGray,
|
InstitutionContractListStatus.Block => Color.DimGray,
|
||||||
var n when string.IsNullOrWhiteSpace(n) && workshopCount == "0" => Color.Yellow,
|
InstitutionContractListStatus.WithoutWorkshop => Color.Yellow,
|
||||||
|
InstitutionContractListStatus.Active => Color.White,
|
||||||
_ => Color.White
|
_ => Color.White
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class InstitutionContractExcelViewModel
|
||||||
|
{
|
||||||
|
public InstitutionContractListStatus? Tab { get; set; }
|
||||||
|
public List<GetInstitutionContractListItemsViewModel> GetInstitutionContractListItemsViewModels { get; set; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.Contract;
|
||||||
|
|
||||||
|
public enum ContractListOrderType
|
||||||
|
{
|
||||||
|
ByContractCreationDate,
|
||||||
|
BySignedContract,
|
||||||
|
ByUnSignedContract,
|
||||||
|
ByPersonnelCode,
|
||||||
|
ByPersonnelCodeDescending,
|
||||||
|
ByContractStartDate,
|
||||||
|
ByContractStartDateDescending
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
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,6 +3,8 @@ 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
|
||||||
@@ -45,16 +47,101 @@ 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>
|
||||||
|
/// لیست قراردادها برای کلاینت
|
||||||
|
/// </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);
|
||||||
|
|
||||||
#region NewChangeByHeydari
|
#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);
|
||||||
List<ContractViweModel> SearchForMainContract(ContractSearchModel searchModel);
|
List<ContractViweModel> SearchForMainContract(ContractSearchModel searchModel);
|
||||||
|
|
||||||
#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,92 +0,0 @@
|
|||||||
using System.Diagnostics.Contracts;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// لیست پرسنل کلاینت
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
public class EmployeeListDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// آی دی پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نام کامل پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public string EmployeeFullName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// کد پرسنلی
|
|
||||||
/// </summary>
|
|
||||||
public int PersonnelCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// وضعیت تاهل
|
|
||||||
/// </summary>
|
|
||||||
public string MaritalStatus { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///کد ملی
|
|
||||||
/// </summary>
|
|
||||||
public string NationalCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// شماره شناسنامه
|
|
||||||
/// </summary>
|
|
||||||
public string IdNumber { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ تولد
|
|
||||||
/// </summary>
|
|
||||||
public string DateOfBirth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نام پدر
|
|
||||||
/// </summary>
|
|
||||||
public string FatherName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تعداد فرزندان
|
|
||||||
/// </summary>
|
|
||||||
public string NumberOfChildren { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// آخرین تاریخ شروع بکار قرارداد
|
|
||||||
/// </summary>
|
|
||||||
public string LatestContractStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ ترک کار قرارداد
|
|
||||||
/// </summary>
|
|
||||||
public string ContractLeftDate { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// آخرین تاریخ شروع بکار بیمه
|
|
||||||
/// </summary>
|
|
||||||
public string LatestInsuranceStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ ترک کار بیمه
|
|
||||||
/// </summary>
|
|
||||||
public string InsuranceLeftDate { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دارای قرارداد است؟
|
|
||||||
/// </summary>
|
|
||||||
public bool HasContract { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دارای بیمه است؟
|
|
||||||
/// </summary>
|
|
||||||
public bool HasInsurance { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// وضعیت پرسنل در کارگاه
|
|
||||||
/// </summary>
|
|
||||||
public EmployeeStatusInWorkshop EmployeeStatusInWorkshop { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// سرچ مدل پرسنل
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
public class EmployeeSearchModelDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// نام پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public string EmployeeFullName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// کد ملی
|
|
||||||
/// </summary>
|
|
||||||
public string NationalCode { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// وضعیت پرسنل در کارگاه
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
public enum EmployeeStatusInWorkshop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ایجاد شده توسط کارفرما
|
|
||||||
/// </summary>
|
|
||||||
CreatedByClient,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ترک کار موقت
|
|
||||||
/// </summary>
|
|
||||||
LefWorkTemp,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// در حال کار در کارگاه
|
|
||||||
/// </summary>
|
|
||||||
Working,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// قطع ارتباط و ترک کار کامب
|
|
||||||
/// </summary>
|
|
||||||
HasLeft,
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// پرینت تجمیعی پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public class PrintAllEmployeesInfoDtoClient
|
|
||||||
{
|
|
||||||
public PrintAllEmployeesInfoDtoClient(EmployeeListDto source)
|
|
||||||
{
|
|
||||||
Id = source.Id;
|
|
||||||
EmployeeFullName = source.EmployeeFullName;
|
|
||||||
PersonnelCode = source.PersonnelCode;
|
|
||||||
MaritalStatus = source.MaritalStatus;
|
|
||||||
NationalCode = source.NationalCode;
|
|
||||||
IdNumber = source.IdNumber;
|
|
||||||
DateOfBirth = source.DateOfBirth;
|
|
||||||
FatherName = source.FatherName;
|
|
||||||
NumberOfChildren = source.NumberOfChildren;
|
|
||||||
LatestContractStartDate = source.LatestContractStartDate;
|
|
||||||
ContractLeftDate = source.ContractLeftDate;
|
|
||||||
LatestInsuranceStartDate = source.LatestInsuranceStartDate;
|
|
||||||
InsuranceLeftDate = source.InsuranceLeftDate;
|
|
||||||
EmployeeStatusInWorkshop = source.EmployeeStatusInWorkshop;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// آی دی پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نام کامل پرسنل
|
|
||||||
/// </summary>
|
|
||||||
public string EmployeeFullName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// کد پرسنلی
|
|
||||||
/// </summary>
|
|
||||||
public int PersonnelCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// وضعیت تاهل
|
|
||||||
/// </summary>
|
|
||||||
public string MaritalStatus { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///کد ملی
|
|
||||||
/// </summary>
|
|
||||||
public string NationalCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// شماره شناسنامه
|
|
||||||
/// </summary>
|
|
||||||
public string IdNumber { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ تولد
|
|
||||||
/// </summary>
|
|
||||||
public string DateOfBirth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نام پدر
|
|
||||||
/// </summary>
|
|
||||||
public string FatherName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تعداد فرزندان
|
|
||||||
/// </summary>
|
|
||||||
public string NumberOfChildren { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// آخرین تاریخ شروع بکار قرارداد
|
|
||||||
/// </summary>
|
|
||||||
public string LatestContractStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ ترک کار قرارداد
|
|
||||||
/// </summary>
|
|
||||||
public string ContractLeftDate { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// آخرین تاریخ شروع بکار بیمه
|
|
||||||
/// </summary>
|
|
||||||
public string LatestInsuranceStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// تاریخ ترک کار بیمه
|
|
||||||
/// </summary>
|
|
||||||
public string InsuranceLeftDate { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// وضعیت پرسنل در کارگاه
|
|
||||||
/// </summary>
|
|
||||||
public EmployeeStatusInWorkshop EmployeeStatusInWorkshop { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.Employee;
|
namespace CompanyManagment.App.Contracts.Employee;
|
||||||
|
|
||||||
@@ -75,7 +73,6 @@ public interface IEmployeeApplication
|
|||||||
long workshopId);
|
long workshopId);
|
||||||
Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(EditEmployeeInEmployeeDocument command);
|
Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(EditEmployeeInEmployeeDocument command);
|
||||||
|
|
||||||
[Obsolete("این متد منسوخ شده است و از متد WorkedEmployeesInWorkshopSelectList استفاده کنید")]
|
|
||||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||||
|
|
||||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||||
@@ -106,26 +103,8 @@ public interface IEmployeeApplication
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دریافت لیست پرسنل کلاینت
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchModel"></param>
|
|
||||||
/// <param name="workshopId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// پرینت تجمیعی پرسنل کلاینت
|
|
||||||
/// api
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="workshopId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetClientEmployeeListSearchModel
|
public class GetClientEmployeeListSearchModel
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using CompanyManagment.App.Contracts.InsuranceList;
|
using CompanyManagment.App.Contracts.InsuranceList;
|
||||||
|
using CompanyManagment.App.Contracts.Workshop;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
@@ -96,6 +97,94 @@ public interface IInsuranceListApplication
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
||||||
|
Task<InsuranceClientPrintViewModel> ClientPrintOne(long id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InsuranceClientPrintViewModel
|
||||||
|
{
|
||||||
|
public string Month { get; set; }
|
||||||
|
public string Year { get; set; }
|
||||||
|
public string WorkshopName { get; set; }
|
||||||
|
public string ListNo { get; set; }
|
||||||
|
public string AgreementNumber { get; set; }
|
||||||
|
public string WorkshopInsuranceCode { get; set; }
|
||||||
|
public string WorkshopEmployerName { get; set; }
|
||||||
|
public string WorkshopAddress { get; set; }
|
||||||
|
public List<InsuranceClientPrintItemsViewModel> Items { get; set; }
|
||||||
|
public string EmployerShare { get; set; }
|
||||||
|
public string InsuredShare { get; set; }
|
||||||
|
public string UnEmploymentInsurance { get; set; }
|
||||||
|
public string AllInsuredShare { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
public class InsuranceClientPrintItemsViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// شماره بیمه
|
||||||
|
/// </summary>
|
||||||
|
public string InsuranceCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// نام و نام خانوادگی
|
||||||
|
/// </summary>
|
||||||
|
public string FullName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// شغل
|
||||||
|
/// </summary>
|
||||||
|
public string JobName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// کد ملی
|
||||||
|
/// </summary>
|
||||||
|
public string NationalCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// شروع به کار
|
||||||
|
/// </summary>
|
||||||
|
public string StartWork { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ترک کار
|
||||||
|
/// </summary>
|
||||||
|
public string LeftWork { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// روزهای کارکرد
|
||||||
|
/// </summary>
|
||||||
|
public string WorkingDays { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// دستمزد روزانه
|
||||||
|
/// </summary>
|
||||||
|
public string DailyWage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// پایه سنوات روزانه
|
||||||
|
/// </summary>
|
||||||
|
public string BaseYears { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// دستمزد ماهانه
|
||||||
|
/// </summary>
|
||||||
|
public string MonthlySalary { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// مزایای ماهیانه مشمول
|
||||||
|
/// </summary>
|
||||||
|
public string MonthlyBenefits { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// حق تاهل
|
||||||
|
/// </summary>
|
||||||
|
public string MarriedAllowance { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// حقوق و مزایای ماهیانه مشمول
|
||||||
|
/// </summary>
|
||||||
|
public string BenefitsIncludedContinuous { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// حقوق و مزایای ماهیانه غیر مشمول
|
||||||
|
/// </summary>
|
||||||
|
public string BenefitsIncludedNonContinuous { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// مجموع مزایای ماهیانه مشمول و غیر مشمول
|
||||||
|
/// </summary>
|
||||||
|
public string IncludedAndNotIncluded { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// حق بیمه سهم بیمه شده
|
||||||
|
/// </summary>
|
||||||
|
public string InsuranceShare { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InsuranceClientSearchModel:PaginationRequest
|
public class InsuranceClientSearchModel:PaginationRequest
|
||||||
@@ -113,4 +202,11 @@ public class InsuranceClientListViewModel
|
|||||||
public int YearInt { get; set; }
|
public int YearInt { get; set; }
|
||||||
public string MonthName { get; set; }
|
public string MonthName { get; set; }
|
||||||
public int MonthInt { get; set; }
|
public int MonthInt { get; set; }
|
||||||
|
public int PersonnelCount { get; set; }
|
||||||
|
public int LeftWorkCount { get; set; }
|
||||||
|
public string AllInsuredShare { get; set; }
|
||||||
|
public string InsuredShare { get; set; }
|
||||||
|
public string EmployerShare { get; set; }
|
||||||
|
public string UnEmploymentInsurance { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
using _0_Framework.Application;
|
using System.Collections.Generic;
|
||||||
using AccountManagement.Application.Contracts.Account;
|
|
||||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
using CompanyManagment.App.Contracts.Workshop.DTOs;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application;
|
||||||
|
using AccountManagement.Application.Contracts.Account;
|
||||||
|
using CompanyManagment.App.Contracts.Workshop.DTOs;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.Workshop;
|
namespace CompanyManagment.App.Contracts.Workshop;
|
||||||
|
|
||||||
@@ -93,8 +92,6 @@ public interface IWorkshopApplication
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
|
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateWorkshopWorkflowRegistration
|
public class CreateWorkshopWorkflowRegistration
|
||||||
|
|||||||
@@ -2712,7 +2712,9 @@ 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()
|
||||||
{
|
{
|
||||||
@@ -3107,6 +3109,21 @@ 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
|
||||||
|
|||||||
@@ -1734,20 +1734,5 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|||||||
return await _EmployeeRepository.GetClientEmployeeList(searchModel, workshopId);
|
return await _EmployeeRepository.GetClientEmployeeList(searchModel, workshopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId)
|
|
||||||
{
|
|
||||||
return await _EmployeeRepository.ListOfAllEmployeesClient(searchModel, workshopId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId)
|
|
||||||
{
|
|
||||||
return await _EmployeeRepository.PrintAllEmployeesInfoClient(workshopId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
|
||||||
{
|
|
||||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -2381,5 +2381,10 @@ public class InsuranceListApplication : IInsuranceListApplication
|
|||||||
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
|
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<InsuranceClientPrintViewModel> ClientPrintOne(long id)
|
||||||
|
{
|
||||||
|
return await _insuranceListRepositpry.ClientPrintOne(id);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,6 @@ using Company.Domain.LeftWorkAgg;
|
|||||||
using Company.Domain.LeftWorkInsuranceAgg;
|
using Company.Domain.LeftWorkInsuranceAgg;
|
||||||
using Company.Domain.WorkshopAgg;
|
using Company.Domain.WorkshopAgg;
|
||||||
using CompanyManagment.App.Contracts.Employee;
|
using CompanyManagment.App.Contracts.Employee;
|
||||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
using CompanyManagment.App.Contracts.EmployeeChildren;
|
using CompanyManagment.App.Contracts.EmployeeChildren;
|
||||||
using CompanyManagment.App.Contracts.LeftWork;
|
using CompanyManagment.App.Contracts.LeftWork;
|
||||||
using CompanyManagment.App.Contracts.RollCallService;
|
using CompanyManagment.App.Contracts.RollCallService;
|
||||||
@@ -1127,6 +1126,5 @@ public class WorkshopAppliction : IWorkshopApplication
|
|||||||
return operation.Succcedded();
|
return operation.Succcedded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ 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;
|
||||||
@@ -1081,30 +1083,7 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
|
|||||||
|
|
||||||
var weeklyDouble = 0.0;
|
var weeklyDouble = 0.0;
|
||||||
var weekly = c.WorkingHoursWeekly;
|
var weekly = c.WorkingHoursWeekly;
|
||||||
if (!string.IsNullOrWhiteSpace(weekly) &&
|
c.WorkingHoursWeekly = WeeklyHourConvertor(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);
|
||||||
@@ -1161,6 +1140,37 @@ 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
|
||||||
@@ -1506,6 +1516,195 @@ 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
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
using _0_Framework.Application;
|
using System;
|
||||||
using _0_Framework.Application.Enums;
|
|
||||||
using _0_Framework.Exceptions;
|
|
||||||
using _0_Framework.InfraStructure;
|
|
||||||
using Company.Domain.ClientEmployeeWorkshopAgg;
|
|
||||||
using Company.Domain.EmployeeAccountAgg;
|
|
||||||
using Company.Domain.EmployeeAgg;
|
|
||||||
using Company.Domain.EmployeeInsuranceRecordAgg;
|
|
||||||
using Company.Domain.InsuranceListAgg;
|
|
||||||
using CompanyManagment.App.Contracts.Employee;
|
|
||||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
|
||||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
|
||||||
using Microsoft.Data.SqlClient;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application;
|
||||||
|
using _0_Framework.InfraStructure;
|
||||||
|
using Company.Domain.ClientEmployeeWorkshopAgg;
|
||||||
|
using Company.Domain.EmployeeAccountAgg;
|
||||||
|
using Company.Domain.EmployeeAgg;
|
||||||
|
using CompanyManagment.App.Contracts.Employee;
|
||||||
|
using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||||
|
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||||
|
using Microsoft.Data.SqlClient;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||||
|
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||||
|
using _0_Framework.Application.Enums;
|
||||||
|
using _0_Framework.Exceptions;
|
||||||
|
|
||||||
namespace CompanyManagment.EFCore.Repository;
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
public bool city = true;
|
public bool city = true;
|
||||||
public DateTime initial = new DateTime(1922, 01, 01, 00, 00, 00, 0000000);
|
public DateTime initial = new DateTime(1922, 01, 01, 00, 00, 00, 0000000);
|
||||||
private readonly IAuthHelper _authHelper;
|
private readonly IAuthHelper _authHelper;
|
||||||
public EmployeeRepository(CompanyContext context, IConfiguration configuration, IAuthHelper authHelper) : base(context)
|
public EmployeeRepository(CompanyContext context, IConfiguration configuration, IAuthHelper authHelper) :base(context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@@ -43,13 +42,13 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
|
|
||||||
public List<EmployeeViewModel> GetEmployee()
|
public List<EmployeeViewModel> GetEmployee()
|
||||||
{
|
{
|
||||||
return _context.Employees.Where(x => x.IsActive).Select(x => new EmployeeViewModel
|
return _context.Employees.Where(x=>x.IsActive).Select(x => new EmployeeViewModel
|
||||||
{
|
{
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
FName = x.FName,
|
FName = x.FName,
|
||||||
|
|
||||||
LName = x.LName,
|
LName = x.LName,
|
||||||
EmployeeFullName = x.FName + " " + x.LName,
|
EmployeeFullName = x.FName +" "+x.LName,
|
||||||
FatherName = x.FatherName,
|
FatherName = x.FatherName,
|
||||||
NationalCode = x.NationalCode,
|
NationalCode = x.NationalCode,
|
||||||
IdNumber = x.IdNumber,
|
IdNumber = x.IdNumber,
|
||||||
@@ -62,48 +61,48 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
public EditEmployee GetDetails(long id)
|
public EditEmployee GetDetails(long id)
|
||||||
{
|
{
|
||||||
return _context.Employees.Select(x => new EditEmployee
|
return _context.Employees.Select(x => new EditEmployee
|
||||||
{
|
{
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
FName = x.FName,
|
FName = x.FName,
|
||||||
LName = x.LName,
|
LName = x.LName,
|
||||||
Gender = x.Gender,
|
Gender = x.Gender,
|
||||||
NationalCode = x.NationalCode,
|
NationalCode = x.NationalCode,
|
||||||
IdNumber = x.IdNumber,
|
IdNumber = x.IdNumber,
|
||||||
Nationality = x.Nationality,
|
Nationality = x.Nationality,
|
||||||
FatherName = x.FatherName,
|
FatherName = x.FatherName,
|
||||||
DateOfBirth = x.DateOfBirth == initial ? "" : x.DateOfBirth.ToFarsi(),
|
DateOfBirth = x.DateOfBirth == initial ? "" : x.DateOfBirth.ToFarsi(),
|
||||||
DateOfIssue = x.DateOfIssue == initial ? "" : x.DateOfIssue.ToFarsi(),
|
DateOfIssue = x.DateOfIssue == initial ? "" : x.DateOfIssue.ToFarsi(),
|
||||||
PlaceOfIssue = x.PlaceOfIssue,
|
PlaceOfIssue = x.PlaceOfIssue,
|
||||||
Phone = x.Phone,
|
Phone = x.Phone,
|
||||||
Address = x.Address,
|
Address = x.Address,
|
||||||
State = x.State,
|
State = x.State,
|
||||||
City = x.City,
|
City = x.City,
|
||||||
MaritalStatus = x.MaritalStatus,
|
MaritalStatus = x.MaritalStatus,
|
||||||
MilitaryService = x.MilitaryService,
|
MilitaryService = x.MilitaryService,
|
||||||
LevelOfEducation = x.LevelOfEducation,
|
LevelOfEducation = x.LevelOfEducation,
|
||||||
FieldOfStudy = x.FieldOfStudy,
|
FieldOfStudy = x.FieldOfStudy,
|
||||||
BankCardNumber = x.BankCardNumber,
|
BankCardNumber = x.BankCardNumber,
|
||||||
BankBranch = x.BankBranch,
|
BankBranch = x.BankBranch,
|
||||||
InsuranceCode = x.InsuranceCode,
|
InsuranceCode = x.InsuranceCode,
|
||||||
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
||||||
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
||||||
NumberOfChildren = x.NumberOfChildren,
|
NumberOfChildren = x.NumberOfChildren,
|
||||||
OfficePhone = x.OfficePhone,
|
OfficePhone = x.OfficePhone,
|
||||||
EmployeeFullName = x.FName + " " + x.LName,
|
EmployeeFullName = x.FName + " " + x.LName,
|
||||||
MclsUserName = x.MclsUserName,
|
MclsUserName =x.MclsUserName,
|
||||||
MclsPassword = x.MclsPassword,
|
MclsPassword = x.MclsPassword,
|
||||||
EserviceUserName = x.EserviceUserName,
|
EserviceUserName = x.EserviceUserName,
|
||||||
EservicePassword = x.EservicePassword,
|
EservicePassword = x.EservicePassword,
|
||||||
TaxOfficeUserName = x.TaxOfficeUserName,
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
||||||
TaxOfficepassword = x.TaxOfficepassword,
|
TaxOfficepassword = x.TaxOfficepassword,
|
||||||
SanaUserName = x.SanaUserName,
|
SanaUserName = x.SanaUserName,
|
||||||
SanaPassword = x.SanaPassword,
|
SanaPassword = x.SanaPassword,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.FirstOrDefault(x => x.Id == id);
|
.FirstOrDefault(x => x.Id == id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<EmployeeViewModel>> Search(EmployeeSearchModel searchModel)
|
public async Task<List<EmployeeViewModel>> Search(EmployeeSearchModel searchModel)
|
||||||
@@ -183,10 +182,10 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
return query.OrderByDescending(x => x.Id).Take(100).ToList();
|
return query.OrderByDescending(x => x.Id).Take(100).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<EmployeeSelectListViewModel>> GetEmployeeToList()
|
public async Task<List<EmployeeSelectListViewModel>> GetEmployeeToList()
|
||||||
{
|
{
|
||||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||||
|
|
||||||
List<EmployeeSelectListViewModel> result = null;
|
List<EmployeeSelectListViewModel> result = null;
|
||||||
var connection = _configuration.GetConnectionString("MesbahDb");
|
var connection = _configuration.GetConnectionString("MesbahDb");
|
||||||
using (var conn = new SqlConnection(connection))
|
using (var conn = new SqlConnection(connection))
|
||||||
@@ -196,7 +195,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
var command = new SqlCommand("EmployeeFullNameId", conn);
|
var command = new SqlCommand("EmployeeFullNameId", conn);
|
||||||
command.CommandType = CommandType.StoredProcedure;
|
command.CommandType = CommandType.StoredProcedure;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (var reader = await command.ExecuteReaderAsync())
|
using (var reader = await command.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
@@ -274,45 +273,45 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
public EditEmployee GetDetailsByADDate(long id)
|
public EditEmployee GetDetailsByADDate(long id)
|
||||||
{
|
{
|
||||||
return _context.Employees.Select(x => new EditEmployee
|
return _context.Employees.Select(x => new EditEmployee
|
||||||
{
|
{
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
FName = x.FName,
|
FName = x.FName,
|
||||||
LName = x.LName,
|
LName = x.LName,
|
||||||
Gender = x.Gender,
|
Gender = x.Gender,
|
||||||
NationalCode = x.NationalCode,
|
NationalCode = x.NationalCode,
|
||||||
IdNumber = x.IdNumber,
|
IdNumber = x.IdNumber,
|
||||||
Nationality = x.Nationality,
|
Nationality = x.Nationality,
|
||||||
FatherName = x.FatherName,
|
FatherName = x.FatherName,
|
||||||
DateOfBirthGr = x.DateOfBirth,
|
DateOfBirthGr = x.DateOfBirth ,
|
||||||
DateOfIssueGr = x.DateOfIssue,
|
DateOfIssueGr = x.DateOfIssue ,
|
||||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||||
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
||||||
PlaceOfIssue = x.PlaceOfIssue,
|
PlaceOfIssue = x.PlaceOfIssue,
|
||||||
Phone = x.Phone,
|
Phone = x.Phone,
|
||||||
Address = x.Address,
|
Address = x.Address,
|
||||||
State = x.State,
|
State = x.State,
|
||||||
City = x.City,
|
City = x.City,
|
||||||
MaritalStatus = x.MaritalStatus,
|
MaritalStatus = x.MaritalStatus,
|
||||||
MilitaryService = x.MilitaryService,
|
MilitaryService = x.MilitaryService,
|
||||||
LevelOfEducation = x.LevelOfEducation,
|
LevelOfEducation = x.LevelOfEducation,
|
||||||
FieldOfStudy = x.FieldOfStudy,
|
FieldOfStudy = x.FieldOfStudy,
|
||||||
BankCardNumber = x.BankCardNumber,
|
BankCardNumber = x.BankCardNumber,
|
||||||
BankBranch = x.BankBranch,
|
BankBranch = x.BankBranch,
|
||||||
InsuranceCode = x.InsuranceCode,
|
InsuranceCode = x.InsuranceCode,
|
||||||
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
||||||
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
||||||
NumberOfChildren = x.NumberOfChildren,
|
NumberOfChildren = x.NumberOfChildren,
|
||||||
OfficePhone = x.OfficePhone,
|
OfficePhone = x.OfficePhone,
|
||||||
EmployeeFullName = x.FName + " " + x.LName,
|
EmployeeFullName = x.FName + " " + x.LName,
|
||||||
MclsUserName = x.MclsUserName,
|
MclsUserName = x.MclsUserName,
|
||||||
MclsPassword = x.MclsPassword,
|
MclsPassword = x.MclsPassword,
|
||||||
EserviceUserName = x.EserviceUserName,
|
EserviceUserName = x.EserviceUserName,
|
||||||
EservicePassword = x.EservicePassword,
|
EservicePassword = x.EservicePassword,
|
||||||
TaxOfficeUserName = x.TaxOfficeUserName,
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
||||||
TaxOfficepassword = x.TaxOfficepassword,
|
TaxOfficepassword = x.TaxOfficepassword,
|
||||||
SanaUserName = x.SanaUserName,
|
SanaUserName = x.SanaUserName,
|
||||||
SanaPassword = x.SanaPassword,
|
SanaPassword = x.SanaPassword,
|
||||||
})
|
})
|
||||||
.FirstOrDefault(x => x.Id == id);
|
.FirstOrDefault(x => x.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +324,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
EmployeeFullName = x.FName + " " + x.LName,
|
EmployeeFullName = x.FName + " " + x.LName,
|
||||||
IsActive = x.IsActive
|
IsActive = x.IsActive
|
||||||
|
|
||||||
}).Where(x => x.IsActive).ToList();
|
}).Where(x=>x.IsActive).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Client
|
#region Client
|
||||||
@@ -453,7 +452,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
|
|
||||||
var employeeData = new Employee(command.FName, command.LName, command.FatherName, dateOfBirth,
|
var employeeData = new Employee(command.FName, command.LName, command.FatherName, dateOfBirth,
|
||||||
dateOfIssue,
|
dateOfIssue,
|
||||||
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality, command.IdNumberSerial, command.IdNumberSeri,
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,command.IdNumberSerial,command.IdNumberSeri,
|
||||||
command.Phone, command.Address,
|
command.Phone, command.Address,
|
||||||
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
||||||
command.FieldOfStudy, command.BankCardNumber,
|
command.FieldOfStudy, command.BankCardNumber,
|
||||||
@@ -707,20 +706,20 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
case "":
|
case "":
|
||||||
query = query.Where(x => x.IsActive == true).ToList();
|
query = query.Where(x => x.IsActive == true).ToList();
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
query = query.Where(x => x.IsActive == false).ToList();
|
query = query.Where(x => x.IsActive == false).ToList();
|
||||||
hasSearch = true;
|
hasSearch = true;
|
||||||
break;
|
break;
|
||||||
case "both":
|
case "both":
|
||||||
query = query.Where(x => x.IsActive == true || x.IsActive == false).ToList();
|
query = query.Where(x => x.IsActive == true || x.IsActive == false).ToList();
|
||||||
hasSearch = true;
|
hasSearch = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (hasSearch)
|
if (hasSearch)
|
||||||
{
|
{
|
||||||
return query.OrderByDescending(x => x.Id).ToList();
|
return query.OrderByDescending(x => x.Id).ToList();
|
||||||
@@ -817,11 +816,11 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
var employeesQuery = _context.Employees.Where(x =>
|
var employeesQuery = _context.Employees.Where(x =>
|
||||||
workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
||||||
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id)).Select(x => new
|
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id)).Select(x => new
|
||||||
{
|
{
|
||||||
leftWork = workshopActiveLeftWorksQuery.Where(l => l.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
leftWork = workshopActiveLeftWorksQuery.Where(l => l.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
||||||
insuranceLeftWork = workshopActiveInsuranceLeftWorksQuery.Where(i => i.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
insuranceLeftWork = workshopActiveInsuranceLeftWorksQuery.Where(i => i.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
||||||
Employee = x
|
Employee = x
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -879,7 +878,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
|
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
|
||||||
{
|
{
|
||||||
var employee = await _context.Employees.Where(x => x.id == employeeId).Select(x => new GetEditEmployeeInEmployeeDocumentViewModel()
|
var employee = await _context.Employees.Where(x => x.id == employeeId).Select(x => new GetEditEmployeeInEmployeeDocumentViewModel()
|
||||||
@@ -947,13 +946,13 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Api
|
#region Api
|
||||||
|
|
||||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText, long id)
|
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id)
|
||||||
{
|
{
|
||||||
var query = _context.Employees.AsQueryable();
|
var query = _context.Employees.AsQueryable();
|
||||||
EmployeeSelectListViewModel idSelected = null;
|
EmployeeSelectListViewModel idSelected = null;
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
@@ -964,104 +963,104 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrWhiteSpace(searchText))
|
if (!string.IsNullOrWhiteSpace(searchText))
|
||||||
{
|
{
|
||||||
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
var list = await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
||||||
{
|
{
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
EmployeeFullName = x.FName + " " + x.LName
|
EmployeeFullName = x.FName + " " + x.LName
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
if (idSelected != null)
|
if (idSelected != null)
|
||||||
list.Add(idSelected);
|
list.Add(idSelected);
|
||||||
|
|
||||||
return list.DistinctBy(x => x.Id).ToList();
|
return list.DistinctBy(x=>x.Id).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
||||||
{
|
{
|
||||||
var query = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances).AsQueryable();
|
var query = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances).AsQueryable();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.NationalCode.Contains(searchModel.NationalCode));
|
query = query.Where(x => x.NationalCode.Contains(searchModel.NationalCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployeeId > 0)
|
if (searchModel.EmployeeId > 0)
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.id == searchModel.EmployeeId);
|
query = query.Where(x => x.id == searchModel.EmployeeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.WorkshopId > 0)
|
if (searchModel.WorkshopId > 0)
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.LeftWorks.Any(l => l.WorkshopId == searchModel.WorkshopId) || x.LeftWorkInsurances.Any(l => l.WorkshopId == searchModel.WorkshopId));
|
query = query.Where(x => x.LeftWorks.Any(l => l.WorkshopId == searchModel.WorkshopId) || x.LeftWorkInsurances.Any(l => l.WorkshopId == searchModel.WorkshopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region employer
|
#region employer
|
||||||
|
|
||||||
if (searchModel.EmployerId > 0)
|
if (searchModel.EmployerId > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
var workshopIdsByEmployer = _context.WorkshopEmployers.Where(x => x.EmployerId == searchModel.EmployerId)
|
var workshopIdsByEmployer = _context.WorkshopEmployers.Where(x => x.EmployerId == searchModel.EmployerId)
|
||||||
.Include(x => x.Workshop).Select(x => x.Workshop.id).AsQueryable();
|
.Include(x => x.Workshop).Select(x => x.Workshop.id).AsQueryable();
|
||||||
|
|
||||||
query = query.Where(x =>
|
query = query.Where(x =>
|
||||||
x.LeftWorks.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)) ||
|
x.LeftWorks.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)) ||
|
||||||
x.LeftWorkInsurances.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)));
|
x.LeftWorkInsurances.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)));
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchModel.InsuranceCode))
|
if (!string.IsNullOrEmpty(searchModel.InsuranceCode))
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.InsuranceCode.Contains(searchModel.InsuranceCode));
|
query = query.Where(x => x.InsuranceCode.Contains(searchModel.InsuranceCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.EmployeeStatus != ActivationStatus.None)
|
if (searchModel.EmployeeStatus != ActivationStatus.None)
|
||||||
{
|
{
|
||||||
var status = searchModel.EmployeeStatus switch
|
var status = searchModel.EmployeeStatus switch
|
||||||
{
|
{
|
||||||
ActivationStatus.Active => true,
|
ActivationStatus.Active => true,
|
||||||
ActivationStatus.DeActive => false,
|
ActivationStatus.DeActive => false,
|
||||||
_ => throw new BadRequestException("پارامتر جستجو نامعتبر است")
|
_ => throw new BadRequestException("پارامتر جستجو نامعتبر است")
|
||||||
};
|
};
|
||||||
query = query.Where(x => x.IsActiveString == status.ToString() || x.IsActive == status);
|
query = query.Where(x => x.IsActiveString == status.ToString() || x.IsActive == status);
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
var list = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||||
|
|
||||||
var employeeIds = list.Select(x => x.id);
|
var employeeIds = list.Select(x => x.id);
|
||||||
|
|
||||||
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
||||||
|
|
||||||
var result = list.Select(x => new GetEmployeeListViewModel()
|
var result = list.Select(x => new GetEmployeeListViewModel()
|
||||||
{
|
{
|
||||||
BirthDate = x.DateOfBirth.ToFarsi(),
|
BirthDate = x.DateOfBirth.ToFarsi(),
|
||||||
ChildrenCount = children.Count(c => c.EmployeeId == x.id).ToString(),
|
ChildrenCount = children.Count(c => c.EmployeeId == x.id).ToString(),
|
||||||
EmployeeFullName = x.FullName,
|
EmployeeFullName = x.FullName,
|
||||||
EmployeeStatus = x.IsActive switch
|
EmployeeStatus = x.IsActive switch
|
||||||
{
|
{
|
||||||
true => ActivationStatus.Active,
|
true => ActivationStatus.Active,
|
||||||
false => ActivationStatus.DeActive
|
false => ActivationStatus.DeActive
|
||||||
},
|
},
|
||||||
Gender = x.Gender switch
|
Gender = x.Gender switch
|
||||||
{
|
{
|
||||||
"مرد" => Gender.Male,
|
"مرد" => Gender.Male,
|
||||||
"زن" => Gender.Female,
|
"زن" => Gender.Female,
|
||||||
_ => Gender.None
|
_ => Gender.None
|
||||||
},
|
},
|
||||||
Id = x.id,
|
Id = x.id,
|
||||||
InsuranceCode = x.InsuranceCode,
|
InsuranceCode = x.InsuranceCode,
|
||||||
NationalCode = x.NationalCode
|
NationalCode = x.NationalCode
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId)
|
public Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId)
|
||||||
{
|
{
|
||||||
@@ -1171,144 +1170,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|||||||
//
|
//
|
||||||
// };
|
// };
|
||||||
// }).OrderByDescending(x => x.StartWork).ToList();
|
// }).OrderByDescending(x => x.StartWork).ToList();
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<List<EmployeeListDto>> ListOfAllEmployeesClient(EmployeeSearchModelDto searchModel, long workshopId)
|
|
||||||
{
|
|
||||||
var hasNotStoppedWorkingYet = Tools.GetUndefinedDateTime();
|
|
||||||
|
|
||||||
var baseQuery = await
|
|
||||||
(
|
|
||||||
from personnelCode in _context.PersonnelCodeSet
|
|
||||||
join employee in _context.Employees
|
|
||||||
on personnelCode.EmployeeId equals employee.id
|
|
||||||
where personnelCode.WorkshopId == workshopId
|
|
||||||
select new
|
|
||||||
{
|
|
||||||
Employee = employee,
|
|
||||||
PersonnelCode = personnelCode
|
|
||||||
}
|
|
||||||
).ToListAsync();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
|
||||||
baseQuery = baseQuery.Where(x => x.Employee.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
|
||||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
|
||||||
baseQuery = baseQuery.Where(x => x.Employee.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
|
||||||
|
|
||||||
var employeeIds = baseQuery.Select(x => x.Employee.id).ToList();
|
|
||||||
|
|
||||||
var leftWorks = await _context.LeftWorkList
|
|
||||||
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var insuranceLeftWorks = await _context.LeftWorkInsuranceList
|
|
||||||
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
|
||||||
|
|
||||||
var clientTemp = await _context.EmployeeClientTemps.Where(x => x.WorkshopId == workshopId)
|
|
||||||
.Select(x => x.EmployeeId).ToListAsync();
|
|
||||||
var leftWorkTempData = await _context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId).ToListAsync();
|
|
||||||
var startWorkTemp = leftWorkTempData.Where(x => x.LeftWorkType == LeftWorkTempType.StartWork).ToList();
|
|
||||||
var leftWorkTemp = leftWorkTempData.Where(x => x.LeftWorkType == LeftWorkTempType.LeftWork).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = baseQuery.Select(x =>
|
|
||||||
{
|
|
||||||
var left = leftWorks
|
|
||||||
.Where(l => l.EmployeeId == x.Employee.id)
|
|
||||||
.MaxBy(l => l.StartWorkDate);
|
|
||||||
|
|
||||||
var insuranceLeftWork = insuranceLeftWorks
|
|
||||||
.Where(l => l.EmployeeId == x.Employee.id).MaxBy(l => l.StartWorkDate);
|
|
||||||
|
|
||||||
var contractStart = left != null ? left.StartWorkDate.ToFarsi() : "";
|
|
||||||
var contractLeft = left != null
|
|
||||||
? left.LeftWorkDate != hasNotStoppedWorkingYet ? left.LeftWorkDate.ToFarsi() : ""
|
|
||||||
: "";
|
|
||||||
|
|
||||||
var insuranceStart = insuranceLeftWork != null ? insuranceLeftWork.StartWorkDate.ToFarsi() : "";
|
|
||||||
var insuranceLeft = insuranceLeftWork != null
|
|
||||||
? insuranceLeftWork.LeftWorkDate != null ? insuranceLeftWork.LeftWorkDate.ToFarsi() : ""
|
|
||||||
: "";
|
|
||||||
int personnelCode = Convert.ToInt32($"{x.PersonnelCode.PersonnelCode}");
|
|
||||||
|
|
||||||
int numberOfChildren = children.Count(ch => ch.EmployeeId == x.Employee.id);
|
|
||||||
|
|
||||||
bool employeeHasLeft =
|
|
||||||
(!string.IsNullOrWhiteSpace(insuranceLeft) && !string.IsNullOrWhiteSpace(contractLeft))
|
|
||||||
|| (left == null && !string.IsNullOrWhiteSpace(insuranceLeft))
|
|
||||||
|| (insuranceLeftWork == null && !string.IsNullOrWhiteSpace(contractLeft));
|
|
||||||
bool hasClientTemp = clientTemp.Any(c => c == x.Employee.id);
|
|
||||||
bool hasStartWorkTemp = startWorkTemp.Any(st => st.EmployeeId == x.Employee.id);
|
|
||||||
bool hasLeftWorkTemp = leftWorkTemp.Any(lf => lf.EmployeeId == x.Employee.id);
|
|
||||||
return new EmployeeListDto
|
|
||||||
{
|
|
||||||
Id = x.Employee.id,
|
|
||||||
EmployeeFullName = x.Employee.FullName,
|
|
||||||
PersonnelCode = personnelCode,
|
|
||||||
MaritalStatus = x.Employee.MaritalStatus,
|
|
||||||
NationalCode = x.Employee.NationalCode,
|
|
||||||
IdNumber = x.Employee.IdNumber,
|
|
||||||
DateOfBirth = x.Employee.DateOfBirth.ToFarsi(),
|
|
||||||
FatherName = x.Employee.FatherName,
|
|
||||||
NumberOfChildren = $"{numberOfChildren}",
|
|
||||||
LatestContractStartDate = contractStart,
|
|
||||||
ContractLeftDate = contractLeft,
|
|
||||||
LatestInsuranceStartDate = insuranceStart,
|
|
||||||
InsuranceLeftDate = insuranceLeft,
|
|
||||||
HasContract = !string.IsNullOrWhiteSpace(contractStart),
|
|
||||||
HasInsurance = !string.IsNullOrWhiteSpace(insuranceStart),
|
|
||||||
EmployeeStatusInWorkshop =
|
|
||||||
hasClientTemp || hasStartWorkTemp ? EmployeeStatusInWorkshop.CreatedByClient :
|
|
||||||
hasLeftWorkTemp ? EmployeeStatusInWorkshop.LefWorkTemp :
|
|
||||||
employeeHasLeft ? EmployeeStatusInWorkshop.HasLeft : EmployeeStatusInWorkshop.Working,
|
|
||||||
|
|
||||||
};
|
|
||||||
}).OrderBy(x => x.EmployeeStatusInWorkshop).ThenBy(x => x.PersonnelCode).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<List<PrintAllEmployeesInfoDtoClient>> PrintAllEmployeesInfoClient(long workshopId)
|
|
||||||
{
|
|
||||||
var res = await ListOfAllEmployeesClient(new EmployeeSearchModelDto(), workshopId);
|
|
||||||
|
|
||||||
return res
|
|
||||||
.Where(x=>x.EmployeeStatusInWorkshop != EmployeeStatusInWorkshop.CreatedByClient
|
|
||||||
&& x.EmployeeStatusInWorkshop != EmployeeStatusInWorkshop.LefWorkTemp)
|
|
||||||
.Select(x => new PrintAllEmployeesInfoDtoClient(x)).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
|
||||||
{
|
|
||||||
var dateNow = DateTime.Now.Date;
|
|
||||||
|
|
||||||
|
|
||||||
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
|
|
||||||
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
|
|
||||||
|
|
||||||
|
|
||||||
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
|
||||||
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
|
|
||||||
|
|
||||||
|
|
||||||
var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
|
||||||
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id));
|
|
||||||
|
|
||||||
|
|
||||||
return await employeesQuery.Select(x => new EmployeeSelectListViewModel()
|
|
||||||
{
|
|
||||||
Id = x.id,
|
|
||||||
EmployeeFullName = x.FullName
|
|
||||||
}).ToListAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -176,18 +176,20 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||||
{
|
{
|
||||||
checkout.SetUpdateNeeded();
|
checkout.SetUpdateNeeded();
|
||||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
if (!_context.CheckoutWarningMessages.Any(x =>
|
||||||
|
x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning !=
|
||||||
|
TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||||
{
|
{
|
||||||
var createWarrning =
|
var createWarrning =
|
||||||
new CheckoutWarningMessage(
|
new CheckoutWarningMessage(
|
||||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد",
|
||||||
|
checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,7 +731,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
var id = insuranceListObj.id;
|
var id = insuranceListObj.id;
|
||||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||||
{
|
{
|
||||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||||
|
|
||||||
var checkouts = _context.CheckoutSet.Where(x =>
|
var checkouts = _context.CheckoutSet.Where(x =>
|
||||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||||
@@ -759,16 +761,15 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
{
|
{
|
||||||
var createWarrning =
|
var createWarrning =
|
||||||
new CheckoutWarningMessage(
|
new CheckoutWarningMessage(
|
||||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد",
|
||||||
|
checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_employeeInsurancListDataRepository.SaveChanges();
|
_employeeInsurancListDataRepository.SaveChanges();
|
||||||
@@ -1777,46 +1778,76 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel)
|
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(
|
||||||
|
InsuranceClientSearchModel searchModel)
|
||||||
{
|
{
|
||||||
var workshopId = _authHelper.GetWorkshopId();
|
var workshopId = _authHelper.GetWorkshopId();
|
||||||
var query = _context.InsuranceListSet
|
var query = _context.InsuranceListSet
|
||||||
.Select(x => new InsuranceClientListViewModel
|
.Where(x => x.WorkshopId == workshopId);
|
||||||
{
|
|
||||||
Id = x.id,
|
|
||||||
WorkShopId = x.WorkshopId,
|
|
||||||
Year = x.Year,
|
|
||||||
YearInt = Convert.ToInt32(x.Year),
|
|
||||||
Month = x.Month,
|
|
||||||
MonthName = x.Month.ToFarsiMonthByNumber(),
|
|
||||||
MonthInt = Convert.ToInt32(x.Month),
|
|
||||||
}).Where(x => x.WorkShopId == workshopId);
|
|
||||||
|
|
||||||
|
|
||||||
if (searchModel.Year>0)
|
if (searchModel.Year > 0)
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.YearInt == searchModel.Year);
|
query = query.Where(x => x.Year == searchModel.Year.ToString("0000"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchModel.Month > 0)
|
if (searchModel.Month > 0)
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.MonthInt == searchModel.Month);
|
query = query.Where(x => x.Month == searchModel.Month.ToString("00"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var res = new PagedResult<InsuranceClientListViewModel>
|
var res = new PagedResult<InsuranceClientListViewModel>
|
||||||
{
|
{
|
||||||
TotalCount = query.Count()
|
TotalCount = query.Count()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var list = (await query.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync());
|
||||||
|
|
||||||
|
var insuranceListIds = list.Select(x => x.id).ToList();
|
||||||
|
|
||||||
|
var employeeData = await _context.EmployeeInsurancListDataSet
|
||||||
|
.Where(x => insuranceListIds.Contains(x.InsuranceListId))
|
||||||
|
.GroupBy(x => x.InsuranceListId)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
g.Key,
|
||||||
|
Count = g.Count(x=>x.LeftWorkDate != null)
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
query = searchModel.Sorting switch
|
query = searchModel.Sorting switch
|
||||||
{
|
{
|
||||||
"CreationDate-Max" => query.OrderByDescending(x => x.Id),
|
"CreationDate-Max" => query.OrderByDescending(x => x.id),
|
||||||
"CreationDate-Min" => query.OrderBy(x => x.Id),
|
"CreationDate-Min" => query.OrderBy(x => x.id),
|
||||||
"Month-Max" => query.OrderByDescending(x => x.MonthInt),
|
"Month-Max" => query.OrderByDescending(x => x.Month),
|
||||||
"Month-Min" => query.OrderBy(x => x.MonthInt),
|
"Month-Min" => query.OrderBy(x => x.Month),
|
||||||
"Year-Max" => query.OrderByDescending(x => x.YearInt),
|
"Year-Max" => query.OrderByDescending(x => x.Year),
|
||||||
"Year-Min" => query.OrderBy(x => x.YearInt),
|
"Year-Min" => query.OrderBy(x => x.Year),
|
||||||
_ => query.OrderByDescending(x => x.Id),
|
_ => query.OrderByDescending(x => x.id),
|
||||||
};
|
};
|
||||||
res.List =await query.ApplyPagination(searchModel.PageIndex,searchModel.PageSize).ToListAsync();
|
|
||||||
|
var resList = list
|
||||||
|
.Select(x => new InsuranceClientListViewModel
|
||||||
|
{
|
||||||
|
Id = x.id,
|
||||||
|
WorkShopId = x.WorkshopId,
|
||||||
|
Year = x.Year,
|
||||||
|
YearInt = Convert.ToInt32(x.Year),
|
||||||
|
Month = x.Month,
|
||||||
|
MonthName = x.Month.ToFarsiMonthByNumber(),
|
||||||
|
MonthInt = Convert.ToInt32(x.Month),
|
||||||
|
EmployerShare = x.EmployerShare.ToMoney(),
|
||||||
|
InsuredShare = x.InsuredShare.ToMoney(),
|
||||||
|
UnEmploymentInsurance = x.UnEmploymentInsurance.ToMoney(),
|
||||||
|
PersonnelCount = x.SumOfEmployees,
|
||||||
|
AllInsuredShare = (x.InsuredShare +
|
||||||
|
x.EmployerShare +
|
||||||
|
x.UnEmploymentInsurance).ToMoney(),
|
||||||
|
LeftWorkCount =employeeData.FirstOrDefault(e=>e.Key == x.id)?.Count ?? 0,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
res.List = resList;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1882,10 +1913,10 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
||||||
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
||||||
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
||||||
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year)
|
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year)
|
||||||
@@ -1965,6 +1996,77 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<InsuranceClientPrintViewModel> ClientPrintOne(long id)
|
||||||
|
{
|
||||||
|
var insurance = await _context.InsuranceListSet.FirstOrDefaultAsync(x => x.id == id);
|
||||||
|
|
||||||
|
if (insurance == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var employeeInsurance = _context.EmployeeInsurancListDataSet
|
||||||
|
.Where(x => x.InsuranceListId == insurance.id);
|
||||||
|
|
||||||
|
var workshop = await _context.Workshops
|
||||||
|
.Include(x => x.InsuranceWorkshopInfo)
|
||||||
|
.FirstOrDefaultAsync(x => x.id == insurance.WorkshopId);
|
||||||
|
|
||||||
|
var employeeIds = await employeeInsurance
|
||||||
|
.Select(x => x.EmployeeId).ToListAsync();
|
||||||
|
|
||||||
|
var employees = await _context.Employees
|
||||||
|
.Where(x => employeeIds.Contains(x.id)).ToListAsync();
|
||||||
|
|
||||||
|
var jobIds = employeeInsurance.Select(x => x.JobId).ToList();
|
||||||
|
|
||||||
|
var jobs = await _context.Jobs
|
||||||
|
.Where(x => jobIds.Contains(x.id)).ToDictionaryAsync(x => x.id, x => x.JobName);
|
||||||
|
|
||||||
|
var employeeData = employeeInsurance.ToList().Select(x =>
|
||||||
|
{
|
||||||
|
var employee = employees.FirstOrDefault(e => e.id == x.EmployeeId);
|
||||||
|
return new InsuranceClientPrintItemsViewModel()
|
||||||
|
{
|
||||||
|
BaseYears = x.BaseYears.ToMoney(),
|
||||||
|
BenefitsIncludedContinuous = x.BenefitsIncludedContinuous.ToMoney(),
|
||||||
|
BenefitsIncludedNonContinuous = x.BenefitsIncludedNonContinuous.ToMoney(),
|
||||||
|
DailyWage = x.DailyWage.ToMoney(),
|
||||||
|
IncludedAndNotIncluded = (x.BenefitsIncludedNonContinuous + x.BenefitsIncludedContinuous).ToMoney(),
|
||||||
|
WorkingDays = x.WorkingDays.ToString(),
|
||||||
|
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||||
|
StartWork = x.StartWorkDate.ToFarsi(),
|
||||||
|
LeftWork = x.LeftWorkDate.ToFarsi(),
|
||||||
|
MonthlyBenefits = x.MonthlyBenefits.ToMoney(),
|
||||||
|
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||||
|
NationalCode = employee.NationalCode,
|
||||||
|
InsuranceCode = employee.InsuranceCode,
|
||||||
|
JobName = jobs.GetValueOrDefault(x.JobId, ""),
|
||||||
|
FullName = employee.FullName,
|
||||||
|
InsuranceShare = x.InsuranceShare.ToMoney(),
|
||||||
|
};
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
var result = new InsuranceClientPrintViewModel()
|
||||||
|
{
|
||||||
|
Items = employeeData.ToList(),
|
||||||
|
AllInsuredShare = (insurance.InsuredShare +
|
||||||
|
insurance.EmployerShare +
|
||||||
|
insurance.UnEmploymentInsurance).ToMoney(),
|
||||||
|
EmployerShare = insurance.EmployerShare.ToMoney(),
|
||||||
|
InsuredShare = insurance.InsuredShare.ToMoney(),
|
||||||
|
UnEmploymentInsurance = insurance.UnEmploymentInsurance.ToMoney(),
|
||||||
|
WorkshopName = workshop.InsuranceWorkshopInfo.WorkshopName,
|
||||||
|
WorkshopAddress = workshop.InsuranceWorkshopInfo.Address,
|
||||||
|
WorkshopEmployerName = workshop.InsuranceWorkshopInfo.EmployerName,
|
||||||
|
WorkshopInsuranceCode = workshop.InsuranceWorkshopInfo.InsuranceCode,
|
||||||
|
AgreementNumber = workshop.InsuranceWorkshopInfo.AgreementNumber,
|
||||||
|
ListNo = "01",
|
||||||
|
Month = insurance.Month,
|
||||||
|
Year = insurance.Year
|
||||||
|
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ public class institutionContractController : AdminBaseController
|
|||||||
{
|
{
|
||||||
var institutionContractViewModels =
|
var institutionContractViewModels =
|
||||||
_institutionContractApplication.NewSearch(new() { IsActiveString = "both", TypeOfContract = "both" });
|
_institutionContractApplication.NewSearch(new() { IsActiveString = "both", TypeOfContract = "both" });
|
||||||
var bytes = InstitutionContractExcelGenerator.GenerateExcel(institutionContractViewModels);
|
var bytes = InstitutionContractExcelGenerator.GenerateExcel(new List<InstitutionContractExcelViewModel>());
|
||||||
return File(bytes,
|
return File(bytes,
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
$"قرارداد های مالی.xlsx");
|
$"قرارداد های مالی.xlsx");
|
||||||
@@ -814,6 +814,34 @@ public class institutionContractController : AdminBaseController
|
|||||||
var res= await _institutionContractApplication.VerifyInstitutionContractManually(id);
|
var res= await _institutionContractApplication.VerifyInstitutionContractManually(id);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("excel-download")]
|
||||||
|
public async Task<IActionResult> ExcelDownload()
|
||||||
|
{
|
||||||
|
|
||||||
|
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(_institutionContractApplication.GetList(searchModel))).List;
|
||||||
|
dataVm.Add(new InstitutionContractExcelViewModel(){Tab = @enum, GetInstitutionContractListItemsViewModels = data});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchModel.Status = null;
|
||||||
|
|
||||||
|
var nullData = ( await(_institutionContractApplication.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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using AccountManagement.Application.Contracts.Account;
|
using AccountManagement.Application.Contracts.Account;
|
||||||
|
using Company.Domain.InstitutionContractAgg;
|
||||||
using CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
using CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
||||||
using CompanyManagment.App.Contracts.Employer;
|
using CompanyManagment.App.Contracts.Employer;
|
||||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
@@ -38,6 +39,7 @@ public class IndexModel : PageModel
|
|||||||
private readonly IInstitutionContractApplication _institutionContract;
|
private readonly IInstitutionContractApplication _institutionContract;
|
||||||
private readonly ILeftWorkApplication _leftWorkApplication;
|
private readonly ILeftWorkApplication _leftWorkApplication;
|
||||||
private readonly IRepresentativeApplication _representativeApplication;
|
private readonly IRepresentativeApplication _representativeApplication;
|
||||||
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||||
|
|
||||||
|
|
||||||
private readonly string _viewName;
|
private readonly string _viewName;
|
||||||
@@ -60,7 +62,7 @@ public class IndexModel : PageModel
|
|||||||
IPersonalContractingPartyApp contractingPartyApplication,
|
IPersonalContractingPartyApp contractingPartyApplication,
|
||||||
IRepresentativeApplication representativeApplication, IInstitutionContractApplication institutionContract,
|
IRepresentativeApplication representativeApplication, IInstitutionContractApplication institutionContract,
|
||||||
ILeftWorkApplication leftWorkApplication
|
ILeftWorkApplication leftWorkApplication
|
||||||
, IContactInfoApplication contactInfoApplication, IAccountApplication accountApplication)
|
, IContactInfoApplication contactInfoApplication, IAccountApplication accountApplication, IInstitutionContractRepository institutionContractRepository)
|
||||||
|
|
||||||
{
|
{
|
||||||
_workshopApplication = workshopApplication;
|
_workshopApplication = workshopApplication;
|
||||||
@@ -71,6 +73,7 @@ public class IndexModel : PageModel
|
|||||||
_leftWorkApplication = leftWorkApplication;
|
_leftWorkApplication = leftWorkApplication;
|
||||||
_contactInfoApplication = contactInfoApplication;
|
_contactInfoApplication = contactInfoApplication;
|
||||||
_accountApplication = accountApplication;
|
_accountApplication = accountApplication;
|
||||||
|
_institutionContractRepository = institutionContractRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Message { get; set; }
|
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" });
|
var searchModel = new InstitutionContractListSearchModel();
|
||||||
|
|
||||||
institutionContractViewModels= institutionContractViewModels.GroupBy(x=>x.ContractingPartyId).Select(g=>g.MaxBy(x=>x.ContractStartGr)).ToList();
|
var dataVm=new List<InstitutionContractExcelViewModel>();
|
||||||
var bytes = InstitutionContractExcelGenerator.GenerateExcel(institutionContractViewModels);
|
|
||||||
|
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,
|
return File(bytes,
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
$"قرارداد های مالی.xlsx");
|
$"قرارداد های مالی.xlsx");
|
||||||
|
|||||||
39
ServiceHost/Areas/Client/Controllers/ContractController.cs
Normal file
39
ServiceHost/Areas/Client/Controllers/ContractController.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using CompanyManagment.App.Contracts.Employee;
|
using CompanyManagment.App.Contracts.Employee;
|
||||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ServiceHost.BaseControllers;
|
using ServiceHost.BaseControllers;
|
||||||
|
|
||||||
@@ -17,38 +16,10 @@ public class EmployeeController:ClientBaseController
|
|||||||
_workshopId = authHelper.GetWorkshopId();
|
_workshopId = authHelper.GetWorkshopId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("select-list")]
|
[HttpGet("select-list")]
|
||||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
||||||
{
|
{
|
||||||
var result = await _employeeApplication.GetWorkingEmployeesSelectList(_workshopId);
|
var result = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دریافت لیست پرسنل
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchModel"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<ActionResult<List<EmployeeListDto>>> GetList(EmployeeSearchModelDto searchModel)
|
|
||||||
{
|
|
||||||
var result = await _employeeApplication.ListOfAllEmployeesClient(searchModel, _workshopId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// پرینت تجمیعی پرسنل
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("PrintAllEmployeesInfo")]
|
|
||||||
public async Task<ActionResult<List<PrintAllEmployeesInfoDtoClient>>> PrintAllEmployeesInfo()
|
|
||||||
{
|
|
||||||
var result = await _employeeApplication.PrintAllEmployeesInfoClient(_workshopId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,4 +19,15 @@ public class InsuranceController:ClientBaseController
|
|||||||
var insurances =await _insuranceListApplication.GetInsuranceClientList(searchModel);
|
var insurances =await _insuranceListApplication.GetInsuranceClientList(searchModel);
|
||||||
return Ok(insurances);
|
return Ok(insurances);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("print-one")]
|
||||||
|
public async Task<ActionResult<InsuranceClientPrintViewModel>> ClientPrintList(long id)
|
||||||
|
{
|
||||||
|
InsuranceClientPrintViewModel res = await _insuranceListApplication.ClientPrintOne(id);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InsuranceClientViewModel
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,9 +91,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="submenu">
|
<ul class="submenu">
|
||||||
<li Permission="@SubAccountPermissionHelper.ContractListPermissionCode"><a class="selectLi" asp-page="/Company/Contracts/Index"><span>لیست قرارداد</span></a></li>
|
<li Permission="@SubAccountPermissionHelper.ContractListPermissionCode"><a class="selectLi" href="https://client@(AppSetting.Value.Domain)/contract-list"><span>لیست قرارداد</span></a></li>
|
||||||
<li Permission="@SubAccountPermissionHelper.CheckoutListPermissionCode"><a class="selectLi" asp-page="/Company/Checkouts/Index"><span>لیست فیش حقوقی</span></a></li>
|
<li Permission="@SubAccountPermissionHelper.CheckoutListPermissionCode"><a class="selectLi" asp-page="/Company/Checkouts/Index"><span>لیست فیش حقوقی</span></a></li>
|
||||||
<li Permission="@SubAccountPermissionHelper.InsuranceListPermissionCode"><a class="selectLi" asp-page="/Company/InsuranceList/Index"><span>لیست بیمه</span></a></li>
|
<li Permission="@SubAccountPermissionHelper.InsuranceListPermissionCode"><a class="selectLi" href="https://client@(AppSetting.Value.Domain)/insurance-list"><span>لیست بیمه</span></a></li>
|
||||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusIndividualReportPermissionCode"><a class="selectLi disable" @*onclick="AjaxUrlContentModal('@Url.Page("/Company/Employees/Index", "ContractCheckoutStatus")');"*@><span>گزارش وضعیت انفرادی پرسنل</span></a></li>
|
<li Permission="@SubAccountPermissionHelper.PersonnelStatusIndividualReportPermissionCode"><a class="selectLi disable" @*onclick="AjaxUrlContentModal('@Url.Page("/Company/Employees/Index", "ContractCheckoutStatus")');"*@><span>گزارش وضعیت انفرادی پرسنل</span></a></li>
|
||||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusGroupReportPermissionCode"><a class="selectLi disable" @*onclick="AjaxUrlContentModal('@Url.Page("/Company/Workshop/Index", "ContractCheckoutYearlyStatus")');"*@><span>گزارش وضعیت گروهی پرسنل</span></a></li>
|
<li Permission="@SubAccountPermissionHelper.PersonnelStatusGroupReportPermissionCode"><a class="selectLi disable" @*onclick="AjaxUrlContentModal('@Url.Page("/Company/Workshop/Index", "ContractCheckoutYearlyStatus")');"*@><span>گزارش وضعیت گروهی پرسنل</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ builder.Services.AddCors(options =>
|
|||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
"http://localhost:4000",
|
"http://localhost:4000",
|
||||||
"http://localhost:4001",
|
"http://localhost:4001",
|
||||||
|
"http://localhost:4002",
|
||||||
"http://localhost:3001",
|
"http://localhost:3001",
|
||||||
"https://gozareshgir.ir",
|
"https://gozareshgir.ir",
|
||||||
"https://dad-mehr.ir",
|
"https://dad-mehr.ir",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"ServiceHost": {
|
"ServiceHost": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": false,
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
|
||||||
|
|||||||
Reference in New Issue
Block a user