This commit is contained in:
MahanCh
2025-04-29 18:23:27 +03:30
19 changed files with 973 additions and 119 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using CompanyManagment.App.Contracts.Contract;
@@ -22,4 +23,7 @@ public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
List<LateToWorkEarlyExistSpannig> LateToWorkEarlyExit(List<GroupedRollCalls> groupedRollCall,
ICollection<CustomizeWorkshopEmployeeSettingsShift> shiftSettings, List<LeaveViewModel> leavList);
Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart,
DateTime contractEnd, string shiftwork);
}

View File

@@ -0,0 +1,179 @@
using CompanyManagement.Infrastructure.Excel.EmployeeBankInfo;
using OfficeOpenXml.Style;
using OfficeOpenXml;
using System.Drawing;
using _0_Framework.Application;
namespace CompanyManagement.Infrastructure.Excel.CWS;
public class CustomizeWorkshopGroupExcelViewModel
{
public string Name { get; set; }
public string ShiftType { get; set; }
public string Shifts { get; set; }
public string Salary { get; set; }
public List<CustomizeWorkshopEmployeeExcelViewModel> EmployeeSettings { get; set; }
}
public class CustomizeWorkshopEmployeeExcelViewModel
{
public string Name { get; set; }
public string ShiftType { get; set; }
public string Shifts { get; set; }
public int LeavePermitted { get; set; }
public string Salary { get; set; }
}
public class CustomizeWorkshopGroupSettingExcelGenerator
{
public static byte[] Generate(List<CustomizeWorkshopGroupExcelViewModel> groups)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("GroupsAndEmployees");
// Headers
worksheet.Cells[1, 1].Value = "نام گروه";
worksheet.Cells[1, 2].Value = "نوع شیفت گروه";
worksheet.Cells[1, 3].Value = "شیفت گروه";
worksheet.Cells[1, 4].Value = "حقوق گروه";
worksheet.Cells[1, 5].Value = "نام پرسنل";
worksheet.Cells[1, 6].Value = "مجاز مرخصی پرسنل";
worksheet.Cells[1, 7].Value = "نوع شیفت پرسنل";
worksheet.Cells[1, 8].Value = "شیفت پرسنل";
worksheet.Cells[1, 9].Value = "حقوق پرسنل";
using (var range = worksheet.Cells[1, 1, 1, 9])
{
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
range.Style.Font.Bold = true;
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.LightGray); // رنگ پس زمینه خاکستری
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
}
int row = 2;
foreach (var group in groups)
{
var employees = group.EmployeeSettings ?? new List<CustomizeWorkshopEmployeeExcelViewModel>();
int groupStartRow = row;
int groupEndRow = employees.Count > 0 ? (row + employees.Count - 1) : row;
if (employees.Count == 0)
{
// گروه بدون پرسنل
worksheet.Cells[row, 1].Value = group.Name;
worksheet.Cells[row, 2].Value = group.ShiftType;
worksheet.Cells[row, 3].Value = group.Shifts;
worksheet.Cells[row, 4].Value = Convert.ToInt32(group.Salary);
ApplyGroupStyle(worksheet, row, row);
worksheet.Cells[row, 4].Style.Numberformat.Format = "#,##0";
using (var thickBorderRange = worksheet.Cells[groupEndRow, 1, groupEndRow, 9])
{
thickBorderRange.Style.Border.Bottom.Style = ExcelBorderStyle.Thick;
}
row++;
}
else
{
foreach (var employee in employees)
{
worksheet.Cells[row, 5].Value = employee.Name;
worksheet.Cells[row, 6].Value = employee.LeavePermitted;
worksheet.Cells[row, 7].Value = employee.ShiftType;
worksheet.Cells[row, 8].Value = employee.Shifts;
worksheet.Cells[row, 9].Value = Convert.ToInt32(employee.Salary);
ApplyEmployeeStyle(worksheet, row);
worksheet.Cells[row, 9].Style.Numberformat.Format = "#,##0";
row++;
}
// Merge اطلاعات گروه برای تمام پرسنل
worksheet.Cells[groupStartRow, 1, groupEndRow, 1].Merge = true;
worksheet.Cells[groupStartRow, 1].Value = group.Name;
worksheet.Cells[groupStartRow, 2, groupEndRow, 2].Merge = true;
worksheet.Cells[groupStartRow, 2].Value = group.ShiftType;
worksheet.Cells[groupStartRow, 3, groupEndRow, 3].Merge = true;
worksheet.Cells[groupStartRow, 3].Value = group.Shifts;
worksheet.Cells[groupStartRow, 4, groupEndRow, 4].Merge = true;
worksheet.Cells[groupStartRow, 4].Value = Convert.ToInt32(group.Salary);
ApplyGroupStyle(worksheet, groupStartRow, groupEndRow);
worksheet.Cells[groupStartRow, 4, groupEndRow, 4].Style.Numberformat.Format = "#,##0";
worksheet.Cells[groupEndRow, 1, groupEndRow, 9].Style.Border.Bottom.Style = ExcelBorderStyle.Thick;
}
}
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
for (int i = 2; i <= worksheet.Dimension.Rows; i++)
{
worksheet.Row(i).Height = 50;
}
int groupShiftCol = 3;
int employeeShiftCol = 8;
int groupSalary = 4;
int employeeSalary = 9;
int employeeName =5;
worksheet.Columns[groupShiftCol].Width = 15;
worksheet.Columns[employeeShiftCol].Width = 15;
worksheet.Columns[groupSalary].Width = 16;
worksheet.Columns[employeeSalary].Width = 16;
worksheet.Columns[employeeName].Width = 24;
worksheet.View.RightToLeft = true; // فارسی
return package.GetAsByteArray();
}
}
private static void ApplyEmployeeStyle(ExcelWorksheet worksheet, int row)
{
using (var range = worksheet.Cells[row, 5, row, 9])
{
//range.Style.Fill.PatternType = ExcelFillStyle.Solid;
//range.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(198, 239, 206)); // سبز خیلی روشن
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
// اضافه کردن بوردر به همه‌ی سلول‌های ردیف پرسنل
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
range.Style.WrapText = true;
}
}
private static void ApplyGroupStyle(ExcelWorksheet worksheet, int startRow, int endRow)
{
using (var range = worksheet.Cells[startRow, 1, endRow, 4])
{
//range.Style.Fill.PatternType = ExcelFillStyle.Solid;
//range.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 255, 204)); // زرد خیلی روشن
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
// اضافه کردن بوردر به همه‌ی سلول‌های گروه
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
range.Style.WrapText = true;
}
}
}

View File

@@ -36,6 +36,7 @@ public class ComputingViewModel
public string MarriedAllowance { get; set; }
public string RotatingShiftValue { get; set; }
public List<RotatingShiftViewModel> RotatingResultList { get; set; }
public bool HasRollCall { get; set; }

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
@@ -9,4 +10,6 @@ public class CustomizeWorkshopSettingsViewModel
public string Name { get; set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; set; }
public List<CustomizeWorkshopGroupSettingsViewModel> GroupSettings { get; set; }
public TimeOnly Offset { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -8,4 +9,6 @@ public interface IRollCallMandatoryApplication
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking);
Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart,
DateTime contractEnd, string shiftwork);
}

View File

@@ -89,8 +89,8 @@ public class InsuranceJobApplication: IInsuranceJobApplication
if (_insuranceJobRepositpry.Exists(x => x.InsuranceJobTitle == command.InsuranceJobTitle && x.id!=command.Id))
return opration.Failed("عنوان صنف و درجه تکراری است");
if (_insuranceJobRepositpry.Exists(x => x.EconomicCode == command.EconomicCode && x.id != command.Id))
return opration.Failed("کد اقتصادی تکراری است");
//if (_insuranceJobRepositpry.Exists(x => x.EconomicCode == command.EconomicCode && x.id != command.Id))
// return opration.Failed("کد اقتصادی تکراری است");
try
{

View File

@@ -3,6 +3,7 @@ using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
using System;
using System.Threading.Tasks;
namespace CompanyManagment.Application;
@@ -24,4 +25,10 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
{
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking);
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,
string shiftwork)
{
return await _rollCallMandatoryRepository.RotatingShiftReport(workshopId, employeeId, contractStart, contractEnd, shiftwork);
}
}

View File

@@ -90,7 +90,16 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
TotalDeductions = x.TotalDeductions,
TotalPayment = x.TotalPayment,
RewardPay = x.RewardPay,
})
HasRollCall = x.HasRollCall,
EmployeeId = x.EmployeeId,
WorkshopId = x.WorkshopId,
ContractId = x.ContractId,
ContractStartGr = x.ContractStart,
ContractEndGr = x.ContractEnd,
ContractStart = x.ContractStart.ToFarsi(),
ContractEnd = x.ContractEnd.ToFarsi()
})
.FirstOrDefault(x => x.Id == id);
}

View File

@@ -123,15 +123,18 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
public bool HasAnyEmployeeWithoutGroup(long workshopId)
{
var dateNow = DateTime.Now.Date;
var leftWork = _companyContext.LeftWorkList.Where(x =>
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
.Include(x =>
x.EmployeesStatus)
.Where(
x =>
x.WorkshopId == workshopId &&
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
x.HasUploadedImage == "true")
x.HasUploadedImage == "true"&&
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
.AsSplitQuery()
.Include(x => x.CustomizeWorkshopGroupSettings)

View File

@@ -92,6 +92,7 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
return new CustomizeWorkshopSettingsViewModel()
{
Id = entity.id,
Offset = entity.EndTimeOffSet,
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
new CustomizeWorkshopGroupSettingsViewModel()
{
@@ -106,7 +107,7 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
EmployeeId = y.EmployeeId,
IsSettingChanged = y.IsSettingChanged,
IsShiftChanged = y.IsShiftChanged,
Name = $"{employee.FName} {employee.LName}",
Name = $"{employee?.FName} {employee?.LName}",
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
@@ -115,7 +116,14 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
Salary = y.Salary,
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
{
StartTime = r.StartTime.ToString("HH:mm"),
EndTime = r.EndTime.ToString("HH:mm")
}).ToList(),
LeavePermittedDays = y.LeavePermittedDays,
IrregularShift = y.IrregularShift,
WorkshopShiftStatus = y.WorkshopShiftStatus
};
}).ToList(),
Salary = x.Salary,
@@ -127,7 +135,16 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
MainGroup = x.MainGroup
MainGroup = x.MainGroup,
WorkshopShiftStatus = x.WorkshopShiftStatus,
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
{
StartTime = r.StartTime.ToString("HH:mm"),
EndTime = r.EndTime.ToString("HH:mm")
}).ToList(),
IrregularShift = x.IrregularShift
}).ToList(),
};

View File

@@ -145,7 +145,7 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
? "true"
: "false",
HasUploadedImage = joinedRollCall == null ? "false" : joinedRollCall.HasUploadedImage,
CreatedByClient = clientTemp != null || (employee.workshopTemp != null &&employee.workshopTemp.LeftWorkType == LeftWorkTempType.StartWork)
CreatedByClient = clientTemp != null || (employee.workshopTemp != null && employee.workshopTemp.LeftWorkType == LeftWorkTempType.StartWork)
};
@@ -272,8 +272,15 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
public List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId)
{
var dateNow = DateTime.Now.Date;
var rollCallEmployeesQuery = _context.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.WorkshopId == workshopId
&& x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) && x.HasUploadedImage == "true");
var leftWork = _context.LeftWorkList.Where(x =>
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
var rollCallEmployeesQuery = _context.RollCallEmployees.Include(x => x.EmployeesStatus)
.Where(x => x.WorkshopId == workshopId
&& x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow)
&& x.HasUploadedImage == "true" &&leftWork.Any(l=>l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId));
var personnel =
_context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId && rollCallEmployeesQuery.Any(y => y.EmployeeId == x.EmployeeId && y.WorkshopId == x.WorkshopId))
@@ -300,15 +307,15 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
{
var personnelCodes = _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId);
var rollCallEmployeesQuery = _context.RollCallEmployees.Include(x=>x.EmployeesStatus)
.Where(x => x.WorkshopId == workshopId && x.EmployeesStatus.Any() && personnelCodes.Any(y=>y.EmployeeId == x.EmployeeId));
var rollCallEmployeesQuery = _context.RollCallEmployees.Include(x => x.EmployeesStatus)
.Where(x => x.WorkshopId == workshopId && x.EmployeesStatus.Any() && personnelCodes.Any(y => y.EmployeeId == x.EmployeeId));
var res = rollCallEmployeesQuery.Select(x => new RollCallEmployeeViewModel
{
RollCallEmployeeId = x.id,
EmployeeId = x.EmployeeId,
EmployeeFullName = x.EmployeeFullName
})
{
RollCallEmployeeId = x.id,
EmployeeId = x.EmployeeId,
EmployeeFullName = x.EmployeeFullName
})
.ToList();
return res;

View File

@@ -19,6 +19,7 @@ using System.Linq;
using CompanyManagment.App.Contracts.Fine;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -30,6 +31,7 @@ using CompanyManagment.App.Contracts.SalaryAid;
using Company.Domain.RewardAgg;
using CompanyManagment.App.Contracts.Reward.Enums;
using static System.Runtime.InteropServices.JavaScript.JSType;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace CompanyManagment.EFCore.Repository;
@@ -594,6 +596,106 @@ CreateWorkingHoursTemp command, bool holidayWorking)
return res;
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId,long employeeId, DateTime contractStart, DateTime contractEnd, string shiftwork)
{
List<RollCallViewModel> rollCallResult =await _context.RollCalls.Where(x =>
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date &&
x.StartDate.Value.Date <= contractEnd.Date && x.EndDate != null).Select(x => new RollCallViewModel()
{
StartDate = x.StartDate,
EndDate = x.EndDate,
ShiftSpan = (x.EndDate.Value - x.StartDate.Value),
CreationDate = x.ShiftDate,
}).ToListAsync();
List<GroupedRollCalls> groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
{
CreationDate = x.Key,
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
}).OrderBy(x => x.CreationDate).ToList();
//****** نوبت کاری و شب کاری ****
#region RotatingShiftCheckAndNightWorkOver22
string shiftPayValue = "0";
List<RotatingShiftViewModel> rotatingResultList = RotatingShiftCheck(groupedRollCall);
var moriningCount = rotatingResultList.Count(x => x.IsMorningShift);
var eveningCount = rotatingResultList.Count(x => x.IsEveningShift);
var nightCount = rotatingResultList.Count(x => x.IsNightShift);
// شبکاری
TimeSpan over22 = new TimeSpan(rotatingResultList.Sum(x => x.NightWorkSpan.Ticks));
var RotatingfaName = new List<string>();
if (shiftwork != "1" && shiftwork != "2" && shiftwork != "4")//اگر چرخشی بود و منظم نبود
{
if (moriningCount > 0)
RotatingfaName.Add("صبح");
if (eveningCount > 0)
RotatingfaName.Add("عصر");
if (nightCount > 0)
RotatingfaName.Add("شب");
}
else// اگر منظم و شیفتی بود
{
var totalDays = (int)(contractEnd - contractStart).TotalDays + 1;
int validCount = 0;
if (totalDays <= 7) // زیر 7 روز باید حد اقل 2 تغییر شیفت داشته باشد
{
validCount = 2;
}
else if (totalDays >= 28) // بالای 28 روز حد اقل 8 تغییر شیفت
{
validCount = 8;
}
else
{
// تناسب گیری - اگر برای 28 روز 8 تغییر پس برای ایکس روز چند تغییر لازم است
validCount = (int)((totalDays * 8) / 28);
}
if (moriningCount >= validCount)
RotatingfaName.Add("صبح");
if (eveningCount >= validCount)
RotatingfaName.Add("عصر");
if (nightCount >= validCount)
RotatingfaName.Add("شب");
}
var rotatingFaResult = "";
if (RotatingfaName.Count > 1)// اگر تعداد شیفت های محاسبه شده بیش از یک بود
{
for (var rotateNumber = 0; rotateNumber < RotatingfaName.Count; rotateNumber++)
{
if (rotateNumber == 0)
rotatingFaResult = $"{RotatingfaName[rotateNumber]}";
if (rotateNumber == 1)
rotatingFaResult += $" و {RotatingfaName[rotateNumber]}";
if (rotateNumber == 2)
rotatingFaResult += $" و {RotatingfaName[rotateNumber]}";
}
}
else if (RotatingfaName.Count <= 1)
{
rotatingFaResult = "نوبت کاری ندارد";
}
return new ComputingViewModel
{
RotatingStatus = rotatingFaResult,
RotatingResultList = rotatingResultList
};
#endregion
}
public static TimeSpan CalculateBreakTime(BreakTime breakTime, TimeSpan sumOneDaySpan)
{
if (breakTime.BreakTimeType != BreakTimeType.WithTime)
@@ -738,7 +840,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
var nightWorkingTime = new TimeSpan();
#endregion
foreach (var shift in item.ShiftList)
{
#region DatePeriod
@@ -913,6 +1015,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
#region Result
var result = new RotatingShiftViewModel();
result.RotatingDate = item.CreationDate.ToFarsi();
result.MorningWorkSpan = morningWorkingTime;
result.EveningWorkSpan = eveningWorkingTime;
result.NightWorkSpan = nightWorkingTime;

View File

@@ -1323,6 +1323,30 @@
}
}
function rotatingShiftReport(id){
console.log(Number(id));
var checkoutId=Number(id);
$.ajax({
dataType: 'json',
type: 'POST',
url: '@Url.Page("./Index", "RotatngShiftReport")',
headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
data: { "checkoutId": checkoutId},
success: function (response) {
console.log(response);
if (response.isSuccedded) {
}
},
failure: function (response) {
console.log(5, response)
}
});
}
function deleteCheckout(element, id) {
$('.sweet-alert').removeClass("successSwall");
$('.sweet-alert').removeClass("errorSwall");

View File

@@ -26,6 +26,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.SignalR;
using PersianTools.Core;
using ServiceHost.Hubs;
using System.Diagnostics.Contracts;
namespace ServiceHost.Areas.Admin.Pages.Company.Checkouts;
@@ -141,7 +142,93 @@ public class IndexModel : PageModel
//chekoutlist = await _checkoutApplication.Search(searchModel);
}
public async Task<IActionResult> OnGetSearch(CheckoutSearchModel searchModel)
/// <summary>
/// گزارش نوبت کاری
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
#region RotatngShiftReport
public async Task<IActionResult> OnGetRotatngShiftReportDesktop(long id)
{
var result = new ComputingViewModel();
var checkout = _checkoutApplication.GetDetails(id);
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(checkout.ContractId);
if (checkout.HasRollCall)
{
result = await _rollCallMandatoryApplication.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId,checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork);
result.HasRollCall = true;
}
else
{
var ConvertYear = checkout.ContractStart.Substring(0, 4);
var ConvertMonth = checkout.ContractStart.Substring(5, 2);
var contract = _contractApplication.GetDetails(checkout.ContractId);
var workshop = _workshopApplication.GetDetails(contract.WorkshopIds);
var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth,
contract.ContractStartGr, contract.ContractEndGr, contract.EmployeeId, contract.WorkshopIds);
workingHours.ContractStartGr = separation.ContractStartGr;
workingHours.ContractEndGr = separation.ContractEndGr;
workingHours.ContarctStart = separation.ContarctStart;
workingHours.ContractEnd = separation.ContractEnd;
workingHours.GetWorkDate = contract.GetWorkDate;
workingHours.GetWorkDateHide = contract.GetWorkDate;
workingHours.WorkshopId = contract.WorkshopIds;
workingHours.EmployeeId = contract.EmployeeId;
result = MandatoryHours(workingHours, workshop.WorkshopHolidayWorking, 0);
}
Console.WriteLine("ok");
return Partial("./RotatingShiftReportDesktop", result);
}
public async Task<IActionResult> OnGetRotatngShiftReportMobile(long id)
{
var result = new ComputingViewModel();
var checkout = _checkoutApplication.GetDetails(id);
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(checkout.ContractId);
if (checkout.HasRollCall)
{
result = await _rollCallMandatoryApplication.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId, checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork);
result.HasRollCall = true;
}
else
{
var ConvertYear = checkout.ContractStart.Substring(0, 4);
var ConvertMonth = checkout.ContractStart.Substring(5, 2);
var contract = _contractApplication.GetDetails(checkout.ContractId);
var workshop = _workshopApplication.GetDetails(contract.WorkshopIds);
var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth,
contract.ContractStartGr, contract.ContractEndGr, contract.EmployeeId, contract.WorkshopIds);
workingHours.ContractStartGr = separation.ContractStartGr;
workingHours.ContractEndGr = separation.ContractEndGr;
workingHours.ContarctStart = separation.ContarctStart;
workingHours.ContractEnd = separation.ContractEnd;
workingHours.GetWorkDate = contract.GetWorkDate;
workingHours.GetWorkDateHide = contract.GetWorkDate;
workingHours.WorkshopId = contract.WorkshopIds;
workingHours.EmployeeId = contract.EmployeeId;
result = MandatoryHours(workingHours, workshop.WorkshopHolidayWorking, 0);
}
Console.WriteLine("ok");
return Partial("./RotatingShiftReportMobile", result);
}
#endregion
public async Task<IActionResult> OnGetSearch(CheckoutSearchModel searchModel)
{
var accountId = _authHelper.CurrentAccountId();

View File

@@ -212,9 +212,12 @@
</svg>
</a>
<a permission="20218" class="btn btn-inverse pull-left customSet @(item.IsBlockCantracingParty == "true" ? "disabled" : "")"
@* <a permission="20218" class="btn btn-inverse pull-left customSet @(item.IsBlockCantracingParty == "true" ? "disabled" : "")"
href="#showmodal=@Url.Page("./Index", "CustomSet", new { item.Id })">
<i class="md-attach-money" style="font-size: 22px; top: 2px; position: relative;"></i>
</a> *@
<a permission="20218" class="btn btn-inverse pull-left customSet @(item.IsBlockCantracingParty == "true" ? "disabled" : "")" href="#showmodal=@Url.Page("./Index", "RotatngShiftReportDesktop",new { @item.Id })">
<i class="md-attach-money" style="font-size: 22px; top: 2px; position: relative;"></i>
</a>
</div>
<div class="flexible-div op-td mobile-view" style="justify-content: flex-end;">
@@ -231,8 +234,7 @@
<i class="fa faSize fa-print"></i>
</a>
<a permission="20218" class="btn btn-inverse pull-left customSet @(item.IsBlockCantracingParty == "true" ? "disabled" : "")"
href="#showmodal=@Url.Page("./Index", "CustomSet", new { item.Id })">
<a permission="20218" class="btn btn-inverse pull-left customSet @(item.IsBlockCantracingParty == "true" ? "disabled" : "")" href="#showmodal=@Url.Page("./Index", "RotatngShiftReportMobile",new { @item.Id })">
<i class="md-attach-money" style="font-size: 22px; top: 2px; position: relative;"></i>
</a>
</div>

View File

@@ -0,0 +1,158 @@
@model CompanyManagment.App.Contracts.Contract.ComputingViewModel
@{
<style>
.modal .modal-dialog .modal-content{
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #DDDDDD;
padding: 0px 30px;
border-radius: 10px;
background-color: #ededed;
border: none;
}
.modal2-btns {
float: left;
padding: 15px;
}
.modal2-btn {
border-radius: 16px;
font-size: 12px;
}
.modal-body2 {
background-color: #f2fbfb;
width: 100%;
height: 644px;
border-radius: 25px;
position: absolute;
}
.rotateHead {
width: 100%;
margin-top: 10px;
height: 20px;
background-color: #eb950a;
box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);
border-radius: 10px;
color: #fff;
font-size: 12px;
line-height: 1.7;
}
.rotateItems {
width: 100%;
margin-top: 3px;
height: 17px;
box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);
border-radius: 10px;
font-size: 12px;
}
.rotateParntModal {
height: 600px !important;
}
</style>
}
<div class="modal-body2" dir="rtl">
@if (@Model.RotatingStatus != "نوبت کاری ندارد")
{
<div class="row container">
<div class="col-xs-3" style="text-align:right">
@if (Model.HasRollCall)
{
<h5> حضور غیاب</h5>
}
else
{
<h5> استاتیک</h5>
}
</div>
<div class="col-xs-3" style="text-align:left"> <h5>نوع ساعت کاری :</h5> </div>
<div class="col-xs-3" style="text-align:right">
<h5>@Model.RotatingStatus</h5>
</div>
<div class="col-xs-3" style="text-align:left">
<h5>وضعیت نوبت کاری : </h5>
</div>
</div>
}
<div class="container" style="height: 550px">
<div class="rotateHead">
<span style="border-left: 1px solid;padding: 0px 30px;">تاریخ</span>
<span style="border-left: 1px solid;padding: 0px 10px;"> کارکرد صبح </span>
<span style="border-left: 1px solid;padding: 0px 10px;"> کارکرد عصر </span>
<span style="border-left: 1px solid;padding: 0px 10px;"> کارکرد شب </span>
<span style="border-left: 1px solid;padding: 0px 10px;"> نوبت صبح </span>
<span style="border-left: 1px solid;padding: 0px 10px;"> نوبت عصر </span>
<span style="padding: 0px 10px;"> نوبت شب </span>
</div>
<div id="rotatingList">
@{
if (@Model.RotatingStatus == "نوبت کاری ندارد")
{
<div class="row">
<div class="col-xs-4"></div>
<div class="col-xs-4">
<h3>نوبت کاری ندارد</h3>
</div>
<div class="col-xs-4"></div>
</div>
}
else
{
@foreach (var item in @Model.RotatingResultList)
{
<div class="rotateItems">
<span style="border-left: 1px solid;padding: 0px 15px;width : 15.3%;display:inline-block;font-family: 'IranText' !important;font-size: 10px;">@item.RotatingDate</span>
<span style="border-left: 1px solid;padding: 0px 22px;width: 14%;display: inline-block;">@item.MorningString</span>
<span style="border-left: 1px solid;padding: 0px 20px;display: inline-block;width: 13.1%;">@item.EveningString </span>
<span style="border-left: 1px solid;padding: 0px 22px;display: inline-block;width: 13.2%;">@item.NightString</span>
<span style="border-left: 1px solid;padding: 0px 30px;display: inline-block;width: 13%;">
@if (item.IsMorningShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
<span style="border-left: 1px solid;padding: 0px 30px;display: inline-block;width: 12.7%;">
@if (item.IsEveningShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
<span style="padding: 0px 30px;display: inline-block;width: 12.7%;">
@if (item.IsNightShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
</div>
}
}
}
</div>
</div>
<div class="row">
<div class="col-md-9"></div>
<div class="modal2-btns col-md-3">
<a type="button" id="closeRotate" class="btn pull-left m-l-10" style="background-color: #e7f2f3;border-radius: 15px;box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);" data-dismiss="modal" data-parent-modal="#edit-modal">بستن</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,156 @@
@model CompanyManagment.App.Contracts.Contract.ComputingViewModel
@{
<style>
.modal .modal-dialog .modal-content{
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #DDDDDD;
padding: 0px 30px;
border-radius: 10px;
background-color: #ededed;
border: none;
}
.modal2-btns {
float: left;
padding: 15px;
}
.modal2-btn {
border-radius: 16px;
font-size: 12px;
}
.modal-body2 {
background-color: #f2fbfb;
width: 95%;
height: 650px;
border-radius: 25px;
position: absolute;
}
.rotateHead {
width: 100%;
margin-top: 10px;
height: 20px;
background-color: #eb950a;
box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);
border-radius: 10px;
color: #fff;
font-size: 12px;
line-height: 1.7;
}
.rotateItems {
width: 100%;
margin-top: 3px;
height: 17px;
box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);
border-radius: 10px;
font-size: 12px;
}
.rotateParntModal {
height: 600px !important;
}
</style>
}
<div class="modal-body2" dir="rtl">
@if (@Model.RotatingStatus != "نوبت کاری ندارد")
{
<div class="row container m-t-5" >
<div class="col-xs-6" style="text-align: center;background-color: #dcf5f9;border-radius: 15px;box-shadow: -5px 0px 5px 2px rgb(0 0 0 / 19%);">
<span>نوع ساعت کاری </span>
<br />
@if (Model.HasRollCall)
{
<span> حضور غیاب</span>
}
else
{
<span> استاتیک</span>
}
</div>
<div class="col-xs-6" style="text-align: center;background-color: #dcf5f9;border-radius: 15px;box-shadow: 4px -1px 5px 2px rgb(0 0 0 / 19%);">
<span>وضعیت نوبت کاری </span>
<br/>
<span>@Model.RotatingStatus</span>
</div>
</div>
}
<div class="container" style="height: 550px">
<div class="rotateHead">
<span style="border-left: 1px solid;padding: 0px 30px;">تاریخ</span>
<span style="border-left: 1px solid;padding: 0px 10px;"> نوبت صبح </span>
<span style="border-left: 1px solid;padding: 0px 10px;"> نوبت عصر </span>
<span style="padding: 0px 10px;"> نوبت شب </span>
</div>
<div id="rotatingList">
@{
if (@Model.RotatingStatus == "نوبت کاری ندارد")
{
<div class="row">
<div class="col-xs-4"></div>
<div class="col-xs-4">
<h3>نوبت کاری ندارد</h3>
</div>
<div class="col-xs-4"></div>
</div>
}
else
{
@foreach (var item in @Model.RotatingResultList)
{
<div class="rotateItems">
<span style="border-left: 1px solid;padding: 0px 15px;width : 27.3%;display:inline-block;font-family: 'IranText' !important;font-size: 10px;">@item.RotatingDate</span>
<span style="border-left: 1px solid;padding: 0px 30px;display: inline-block;width: 24%;">
@if (item.IsMorningShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
<span style="border-left: 1px solid;padding: 0px 30px;display: inline-block;width: 22.7%;">
@if (item.IsEveningShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
<span style="padding: 0px 30px;display: inline-block;width: 20.7%;">
@if (item.IsNightShift == true) {
<i class="ion-checkmark-circled" style="color: #1bff01;"></i>
}else{
<i class="ion-checkmark-circled" style="color: #f2fbfb;"></i>
}
</span>
</div>
}
}
}
</div>
</div>
<div class="row">
<div class="col-md-9"></div>
<div class="modal2-btns col-md-3">
<a type="button" id="closeRotate" class="btn pull-left m-l-10" style="background-color: #e7f2f3;border-radius: 15px;box-shadow: 1px 1px 5px 2px rgb(0 0 0 / 19%);" data-dismiss="modal" data-parent-modal="#edit-modal">بستن</a>
</div>
</div>
</div>

View File

@@ -36,9 +36,28 @@
</div>
<div class="col-12 p-0 mt-2">
<button class="btnCreateNew" type="button" id="newCreateGroup">
گروه جدید
</button>
<div class="d-flex align-items-center gap-2">
<button class="btnCreateNew" type="button" id="newCreateGroup" style="white-space: nowrap;">
گروه جدید
</button>
<div style="white-space: nowrap;">
<a class="btn btn-success btn-rounded text-white d-flex align-items-center align-content-center gap-2" href="./grouping/?handler=DownloadExcel">
<svg width="24" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" fill="#000000">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<defs>
<style>
.cls-1 {
fill: #ffffff;
}</style>
</defs> <title></title> <g id="xxx-word"> <path class="cls-1" d="M325,105H250a5,5,0,0,1-5-5V25a5,5,0,1,1,10,0V95h70a5,5,0,0,1,0,10Z"></path> <path class="cls-1" d="M325,154.83a5,5,0,0,1-5-5V102.07L247.93,30H100A20,20,0,0,0,80,50v98.17a5,5,0,0,1-10,0V50a30,30,0,0,1,30-30H250a5,5,0,0,1,3.54,1.46l75,75A5,5,0,0,1,330,100v49.83A5,5,0,0,1,325,154.83Z"></path> <path class="cls-1" d="M300,380H100a30,30,0,0,1-30-30V275a5,5,0,0,1,10,0v75a20,20,0,0,0,20,20H300a20,20,0,0,0,20-20V275a5,5,0,0,1,10,0v75A30,30,0,0,1,300,380Z"></path> <path class="cls-1" d="M275,280H125a5,5,0,1,1,0-10H275a5,5,0,0,1,0,10Z"></path> <path class="cls-1" d="M200,330H125a5,5,0,1,1,0-10h75a5,5,0,0,1,0,10Z"></path> <path class="cls-1" d="M325,280H75a30,30,0,0,1-30-30V173.17a30,30,0,0,1,30-30h.2l250,1.66a30.09,30.09,0,0,1,29.81,30V250A30,30,0,0,1,325,280ZM75,153.17a20,20,0,0,0-20,20V250a20,20,0,0,0,20,20H325a20,20,0,0,0,20-20V174.83a20.06,20.06,0,0,0-19.88-20l-250-1.66Z"></path> <path class="cls-1" d="M152.44,236H117.79V182.68h34.3v7.93H127.4v14.45h19.84v7.73H127.4v14.92h25Z"></path> <path class="cls-1" d="M190.18,236H180l-8.36-14.37L162.52,236h-7.66L168,215.69l-11.37-19.14h10.2l6.48,11.6,7.38-11.6h7.46L177,213.66Z"></path> <path class="cls-1" d="M217.4,221.51l7.66.78q-1.49,7.42-5.74,11A15.5,15.5,0,0,1,209,236.82q-8.17,0-12.56-6a23.89,23.89,0,0,1-4.39-14.59q0-8.91,4.8-14.73a15.77,15.77,0,0,1,12.81-5.82q12.89,0,15.35,13.59l-7.66,1.05q-1-7.34-7.23-7.34a6.9,6.9,0,0,0-6.58,4,20.66,20.66,0,0,0-2.05,9.59q0,6,2.13,9.22a6.74,6.74,0,0,0,6,3.24Q215.49,229,217.4,221.51Z"></path> <path class="cls-1" d="M257,223.42l8,1.09a16.84,16.84,0,0,1-6.09,8.83,18.13,18.13,0,0,1-11.37,3.48q-8.2,0-13.2-5.51t-5-14.92q0-8.94,5-14.8t13.67-5.86q8.44,0,13,5.78t4.61,14.84l0,1H238.61a22.12,22.12,0,0,0,.76,6.45,8.68,8.68,0,0,0,3,4.22,8.83,8.83,0,0,0,5.66,1.8Q254.67,229.83,257,223.42Zm-.55-11.8a9.92,9.92,0,0,0-2.56-7,8.63,8.63,0,0,0-12.36-.18,11.36,11.36,0,0,0-2.89,7.13Z"></path> <path class="cls-1" d="M282.71,236h-8.91V182.68h8.91Z"></path> </g>
</g>
</svg>
خروجی EXCEL
</a>
</div>
</div>
</div>
</div>
</div>

View File

@@ -14,6 +14,8 @@ using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Infrastructure;
using CompanyManagment.App.Contracts.RollCallEmployee;
using Company.Domain.EmployeeAgg;
using CompanyManagement.Infrastructure.Excel.CWS;
using CompanyManagement.Infrastructure.Excel.EmployeeBankInfo;
namespace ServiceHost.Areas.Client.Pages.Company.RollCall
{
@@ -29,12 +31,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
private readonly IHttpContextAccessor _contextAccessor;
private readonly IAuthHelper _authHelper;
public bool GroupedAllEmployees;
private readonly long _workshopId;
public string WorkshopFullName;
private readonly long _workshopId;
public string WorkshopFullName;
public CustomizeWorkshopSettingsViewModel RollCallWorkshopSettings;
public List<RollCallEmployeeViewModel> RollCallEmployeeList;
public GroupingModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ICustomizeWorkshopSettingsApplication rollCallWorkshopSettingsApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, IRollCallEmployeeApplication rollCallEmployeeApplication)
public GroupingModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ICustomizeWorkshopSettingsApplication rollCallWorkshopSettingsApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, IRollCallEmployeeApplication rollCallEmployeeApplication)
{
_passwordHasher = passwordHasher;
_workshopApplication = workshopApplication;
@@ -47,29 +49,29 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
if (_workshopId < 1)
throw new InvalidDataException("اختلال در کارگاه");
}
throw new InvalidDataException("اختلال در کارگاه");
}
public bool IrregularWorkshopHaveGroupedAllPersonnelValidation(long workshopId)
{
//var isWorkshopIrregular = _customizeWorkshopSettingsApplication
// .GetWorkshopSettingsDetails(workshopId).WorkshopShiftStatus == WorkshopShiftStatus.Irregular;
//var isWorkshopIrregular = _customizeWorkshopSettingsApplication
// .GetWorkshopSettingsDetails(workshopId).WorkshopShiftStatus == WorkshopShiftStatus.Irregular;
//if (isWorkshopIrregular == false)
// return true;
var employeesWithoutGroup = _customizeWorkshopSettingsApplication.HasAnyEmployeeWithoutGroup(workshopId);
if (employeesWithoutGroup)
return false;
return true;
}
//if (isWorkshopIrregular == false)
// return true;
var employeesWithoutGroup = _customizeWorkshopSettingsApplication.HasAnyEmployeeWithoutGroup(workshopId);
if (employeesWithoutGroup)
return false;
return true;
}
public IActionResult OnGet()
{
//if (_workshopId != 11)
// return Redirect("/Client/Company/RollCall");
//if (_workshopId != 11)
// return Redirect("/Client/Company/RollCall");
RollCallEmployeeList = _rollCallEmployeeApplication.GetEmployeeRollCalls(_workshopId);
RollCallEmployeeList = _rollCallEmployeeApplication.GetEmployeeRollCalls(_workshopId);
var account = _authHelper.CurrentAccountInfo();
var account = _authHelper.CurrentAccountInfo();
GroupedAllEmployees = IrregularWorkshopHaveGroupedAllPersonnelValidation(_workshopId);
var workshop = _workshopApplication.GetWorkshopInfo(_workshopId);
@@ -77,18 +79,18 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
RollCallWorkshopSettings = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(_workshopId, account);
if (RollCallWorkshopSettings.Id == 0)
{
return Redirect("/Client/Company/RollCall");
}
{
return Redirect("/Client/Company/RollCall");
}
return Page();
}
public IActionResult OnGetWorkshopSettingsDataAjax()
{
var account = _authHelper.CurrentAccountInfo();
var account = _authHelper.CurrentAccountInfo();
var result = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(_workshopId, account);
var result = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(_workshopId, account);
return new JsonResult(new
{
isSuccedded = true,
@@ -107,16 +109,16 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
}
public IActionResult OnGetEmployeesGroupSettingsByEmployeeId(long employeeId)
{
var result = _customizeWorkshopSettingsApplication.GetEmployeesGroupSettingsByEmployeeId(employeeId, _workshopId);
return new JsonResult(new
{
success = true,
data = result
});
{
var result = _customizeWorkshopSettingsApplication.GetEmployeesGroupSettingsByEmployeeId(employeeId, _workshopId);
return new JsonResult(new
{
success = true,
data = result
});
}
public IActionResult OnGetCreateGroup(long workshopSettingId)
public IActionResult OnGetCreateGroup(long workshopSettingId)
{
var command = new CreateCustomizeWorkshopGroupSettings
{
@@ -127,7 +129,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
public IActionResult OnPostCreateGroup(CreateCustomizeWorkshopGroupSettings command)
{
command.Salary = "0";
command.Salary = "0";
OperationResult result = _customizeWorkshopSettingsApplication.CreateGroupSettingsByRollCallWorkshopSettingId(command);
return new JsonResult(new
@@ -139,35 +141,35 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
public IActionResult OnGetEditGroup(long groupId)
{
var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId);
command.IsShiftChanged = _customizeWorkshopSettingsApplication
.GetEmployeeSettingsByGroupSettingsId(groupId)
.Any(x => x.IsSettingChanged == true);
return Partial("ModalEditGroup", command);
}
var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId);
command.IsShiftChanged = _customizeWorkshopSettingsApplication
.GetEmployeeSettingsByGroupSettingsId(groupId)
.Any(x => x.IsSettingChanged == true);
return Partial("ModalEditGroup", command);
}
public IActionResult OnPostEditGroup(EditCustomizeWorkshopGroupSettings command)
{
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command);
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command);
return new JsonResult(new
{
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
});
}
public IActionResult OnGetEmployeeIsChangeList(long groupId)
{
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId)
.Where(x => x.IsSettingChanged).ToList();
return new JsonResult(new
{
success = true,
data = result
});
}
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId)
.Where(x => x.IsSettingChanged).ToList();
return new JsonResult(new
{
success = true,
data = result
});
}
public IActionResult OnPostDeleteGroup(long groupId)
{
@@ -179,7 +181,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
});
}
public IActionResult OnGetEmployeeGroupAjax(long rollCallWorkshopSettingId)
public IActionResult OnGetEmployeeGroupAjax(long rollCallWorkshopSettingId)
{
var result = _customizeWorkshopSettingsApplication.GetEmployeesWithoutGroup(rollCallWorkshopSettingId);
return new JsonResult(new
@@ -202,8 +204,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
public IActionResult OnPostCreateEmployee(CreateCustomizeEmployeeSettings command)
{
command.WorkshopId = _workshopId;
OperationResult result = _customizeWorkshopSettingsApplication.CreateEmployeeSettings(command);
command.WorkshopId = _workshopId;
OperationResult result = _customizeWorkshopSettingsApplication.CreateEmployeeSettings(command);
return new JsonResult(new
{
success = result.IsSuccedded,
@@ -223,29 +225,29 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
public IActionResult OnGetEditEmployee(long groupId, List<long> employeeId)
{
var employee = _customizeWorkshopSettingsApplication.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(_workshopId, employeeId.First());
var employee = _customizeWorkshopSettingsApplication.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(_workshopId, employeeId.First());
var command = new EditCustomizeEmployeeSettings()
{
Id = employee.Id,
Id = employee.Id,
EmployeeIds = employeeId,
EmployeeFullName = employee.EmployeeFullName,
Salary = employee.Salary.ToMoney(),
NameGroup = employee.Name,
ShiftViewModel = employee.RollCallWorkshopShifts,
ShiftViewModel = employee.RollCallWorkshopShifts,
BreakTime = employee.BreakTime,
WorkshopShiftStatus = employee.WorkshopShiftStatus,
IrregularShift = employee.IrregularShift,
FridayWork = employee.FridayWork,
HolidayWork = employee.HolidayWork,
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels
};
};
return Partial("ModalEditEmployeeFromGroup", command);
}
public IActionResult OnPostChangeEditEmployee(EditCustomizeEmployeeSettings command)
{
command.WorkshopId = _workshopId;
OperationResult result = _customizeWorkshopSettingsApplication.EditSimpleRollCallEmployeeSetting(command);
command.WorkshopId = _workshopId;
OperationResult result = _customizeWorkshopSettingsApplication.EditSimpleRollCallEmployeeSetting(command);
return new JsonResult(new
{
success = result.IsSuccedded,
@@ -253,43 +255,113 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
});
}
// public IActionResult OnGetGroupingSetting(long groupId)
// {
// var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId);
public IActionResult OnGetDownloadExcel()
{
var groupData = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopIdForAdmin(_workshopId);
// return Partial("ModalSettingGroup", command);
//}
var data = groupData.GroupSettings.Select(x => new CustomizeWorkshopGroupExcelViewModel()
{
Name = x.GroupName,
Salary = ((int)x.Salary).ToString(),
ShiftType = x.WorkshopShiftStatus switch
{
WorkshopShiftStatus.Irregular => "مختلط",
WorkshopShiftStatus.Regular => "منظم",
WorkshopShiftStatus.Rotating => "گردشی",
_ => throw new ArgumentOutOfRangeException()
},
Shifts = x.WorkshopShiftStatus switch
{
WorkshopShiftStatus.Irregular => x.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.None => "نامشخص",
WorkshopIrregularShifts.TwelveThirtySix => "12/36",
WorkshopIrregularShifts.TwelveTwentyFour => "12/24",
WorkshopIrregularShifts.TwentyFourTwentyFour => "24/24",
_ => throw new ArgumentOutOfRangeException()
},
WorkshopShiftStatus.Regular => string.Join(Environment.NewLine,
x.RollCallWorkshopShifts.Select(s => s.StartTime.ToString() + " - " + s.EndTime).ToList()),
WorkshopShiftStatus.Rotating => string.Join(Environment.NewLine,
x.CustomizeRotatingShiftsViewModels.Select(s => s.StartTime.ToString() + " - " + s.EndTime)
.ToList()),
_ => throw new ArgumentOutOfRangeException()
},
EmployeeSettings = x.RollCallWorkshopEmployeesSettings.Select(e => new CustomizeWorkshopEmployeeExcelViewModel
{
Shifts = e.WorkshopShiftStatus switch
{
WorkshopShiftStatus.Irregular => e.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.None => "نامشخص",
WorkshopIrregularShifts.TwelveThirtySix => "12/36",
WorkshopIrregularShifts.TwelveTwentyFour => "12/24",
WorkshopIrregularShifts.TwentyFourTwentyFour => "24/24",
_ => throw new ArgumentOutOfRangeException()
},
WorkshopShiftStatus.Regular => string.Join(Environment.NewLine,
e.RollCallWorkshopShifts.Select(s => s.StartTime.ToString() + " - " + s.EndTime).ToList()),
WorkshopShiftStatus.Rotating => string.Join(Environment.NewLine,
e.CustomizeRotatingShiftsViewModels.Select(s => s.StartTime.ToString() + " - " + s.EndTime)
.ToList()),
_ => throw new ArgumentOutOfRangeException()
},
Salary = ((int)e.Salary).ToString(),
ShiftType = e.WorkshopShiftStatus switch
{
WorkshopShiftStatus.Irregular => "مختلط",
WorkshopShiftStatus.Regular => "منظم",
WorkshopShiftStatus.Rotating => "گردشی",
_ => throw new ArgumentOutOfRangeException()
},
LeavePermitted = e.LeavePermittedDays,
Name = e.Name
}).ToList(),
}).ToList();
// public IActionResult OnPostGroupingSetting(EditCustomizeWorkshopGroupSettings command)
// {
// command.EmployeeIds = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(command.Id).Select(x => x.EmployeeId).ToList();
// OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallGroupSetting(command);
var bytes = CustomizeWorkshopGroupSettingExcelGenerator.Generate(data);
return File(bytes,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
$"اطلاعات گروهبندی.xlsx");
}
// return new JsonResult(new
// {
// isSuccess = result.IsSuccedded,
// message = result.Message
// });
//}
// public IActionResult OnGetGroupingSetting(long groupId)
// {
// var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId);
//public IActionResult OnGetGroupingEmployeeSetting(long customizeEmployeeId, List<long> employeeId)
// {
// var command = _customizeWorkshopSettingsApplication.GetCustomizeEmployeeSettingsDetails(customizeEmployeeId);
// command.EmployeeIds = employeeId;
// return Partial("ModalSettingGroup", command);
//}
// return Partial("ModalSettingGroupEmployee", command);
// }
// public IActionResult OnPostGroupingSetting(EditCustomizeWorkshopGroupSettings command)
// {
// command.EmployeeIds = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(command.Id).Select(x => x.EmployeeId).ToList();
// OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallGroupSetting(command);
// public IActionResult OnPostGroupingEmployeeSetting(EditCustomizeEmployeeSettings command)
// {
// command.WorkshopId = _workshopId;
// OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallEmployeeSettings(command);
// return new JsonResult(new
// {
// isSuccess = result.IsSuccedded,
// message = result.Message
// });
//}
// return new JsonResult(new
// {
// isSuccess = result.IsSuccedded,
// message = result.Message
// });
//}
}
//public IActionResult OnGetGroupingEmployeeSetting(long customizeEmployeeId, List<long> employeeId)
// {
// var command = _customizeWorkshopSettingsApplication.GetCustomizeEmployeeSettingsDetails(customizeEmployeeId);
// command.EmployeeIds = employeeId;
// return Partial("ModalSettingGroupEmployee", command);
// }
// public IActionResult OnPostGroupingEmployeeSetting(EditCustomizeEmployeeSettings command)
// {
// command.WorkshopId = _workshopId;
// OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallEmployeeSettings(command);
// return new JsonResult(new
// {
// isSuccess = result.IsSuccedded,
// message = result.Message
// });
//}
}
}