RotatingShifrtReport Merged

This commit is contained in:
SamSys
2025-05-18 21:17:21 +03:30
11 changed files with 649 additions and 490 deletions

View File

@@ -17,7 +17,7 @@ public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
void TestDayliFeeCompute();
List<string> GetYears();
List<YearlySalaryViewModel> GetYearlySalary();
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking);
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking,string shiftWork);
double GetLeavePay(DateTime contractStart, DateTime contractEnd, double daylyWage, double consumableItem, double housingAllowance, double familyAllowance , string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM);
double GetOverTimeWorking(double dayliWage, string overTimeWorkH, string overTimeWorkM);
double GetOverNightWorking(double dayliWage, string overNightWorkH, string overNightWorkM, string weeklyWorkingTime, int officialholiday, int friday, DateTime contractStart, DateTime contractEnd, string totalHoursH, string totalHorsM);

View File

@@ -136,4 +136,6 @@ public class CreateCheckout
public bool HolidayWorking { get; set; }
public string ShiftWork { get; set; }
}

View File

@@ -45,5 +45,6 @@ public class ComputingViewModel
public bool HasRotatingShift { get; set; }
//public List<string> holidays;
}

View File

@@ -128,7 +128,7 @@ public class CheckoutApplication : ICheckoutApplication
//حق تاهل
var marriedAllowance = command.MarriedAllowance.MoneyToDouble();
var MontlyYearsBunos =
_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage,command.WorkingWeeklyTime,command.officialholiday,command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd,command.DailFeeComplete,command.HasRollCall, command.HolidayWorking);
_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage,command.WorkingWeeklyTime,command.officialholiday,command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd,command.DailFeeComplete,command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
var monthlyWage = MontlyYearsBunos.MontlyWage;
//سنوات

View File

@@ -84,7 +84,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
//محاسبه حقوق ماهیانه عیدی و پاداش ، سنوات
#region GetMontlyBunosYears
public MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart, DateTime contractEnd, double daylyWage,
string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking)
string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking, string shiftWork)
{
double basicDouble = basic.MoneyToDouble();
double sub = 0;
@@ -125,8 +125,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
//if (hasRollCall)
var MandatoryDays = TotalDays - fridayStartToEnd - officialholiday;
if (!hasRollCall && weeklyWorkingTime !="4")
MandatoryDays = TotalDays - fridayStartToEnd;
if (!hasRollCall && shiftWork != "4")
MandatoryDays = TotalDays - fridayStartToEnd;
//بدست آوردن ساعت موظفی این ماه
var TotalMandatoryHours = MandatoryDays * 7.33;//ساعت موظفی این ماه

View File

@@ -675,7 +675,7 @@ public class IndexModel : PageModel
_yearlySalaryRepository.GetMontlyBunosYears(foundMandatoryCompute.weeklyTime, found.ContractStart, found.ContractEnd,
foundMandatoryCompute.SalaryCompute.MoneyToDouble(), foundMandatoryCompute.SumTime44, foundMandatoryCompute.OfficialHoliday,
int.Parse(foundMandatoryCompute.NumberOfFriday), foundMandatoryCompute.TotalHolidayAndNotH, foundMandatoryCompute.TotalHolidayAndNotM,
foundMandatoryCompute.Basic, foundMandatoryCompute.FridayStartToEnd, foundMandatoryCompute.DayliFeeComplete, hasRollCall, workshop.WorkshopHolidayWorking);
foundMandatoryCompute.Basic, foundMandatoryCompute.FridayStartToEnd, foundMandatoryCompute.DayliFeeComplete, hasRollCall, workshop.WorkshopHolidayWorking, workingHours.ShiftWork);
double foundMontlySalary = MontlyYearsBunos.MontlyWage + MontlyYearsBunos.BasicYears;
int foundTotaldays = Convert.ToInt32(MontlyYearsBunos.SumOfWorkingDay);
double foundDayliWage = foundMontlySalary / foundTotaldays;
@@ -785,7 +785,8 @@ public class IndexModel : PageModel
TotalDayOfYearsCompute = yearsPay.YearsPay > 0 ? $"{yearsPay.TotalDayCompute}" : "0",
TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0",
HolidayWorking = workshop.WorkshopHolidayWorking,
};
ShiftWork = workingHours.ShiftWork,
};
_checkoutApplication.Create(command);
//var workshopId = $"{contract.WorkshopIds}";

View File

@@ -449,7 +449,7 @@
}
var i = 1;
var zeropscode = "zero-ps-code tooltip-container";
string adminVersion = _0_Framework.Application.Version.AdminVersion;
<link href="~/AdminTheme/assets/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
}
@@ -848,9 +848,12 @@
var alertModalAjax = '@Url.Page("./AutoExtension", "AlertModal")';
var clockAjax = '@Url.Page("./AutoExtension", "Clock")';
var createContractAjax = '@Url.Page("./AutoExtension", "CreateContract")';
var EmployeesStartedWorkInSelectedPeriodAjaxUrl = '@Url.Page("./AutoExtension", "EmployeesStartedWorkInSelectedPeriod")';
</script>
<script src="~/AssetsAdmin/page/Workshop/js/AutoExtension.js"></script>
<script src="~/AssetsAdmin/page/Workshop/js/AutoExtension.js?ver=@adminVersion"></script>
}

View File

@@ -167,6 +167,50 @@ public class AutoExtensionModel : PageModel
//Correction();
}
public IActionResult OnPostEmployeesStartedWorkInSelectedPeriod(long workshopId, string startDate, string endDate, bool manualDate)
{
var start = startDate.ToGeorgianDateTime();
var end = ($"{startDate.FindeEndOfMonth()}").ToGeorgianDateTime();
if (manualDate)
end = endDate.ToGeorgianDateTime();
if (start >= end)
{
return new JsonResult(new
{
founded = false,
error = true
});
}
var leftWorkSerchModel = new LeftWorkSearchModel
{
WorkshopId = workshopId
};
var leftWorkList = _leftWorkApplication.search(leftWorkSerchModel);
if (leftWorkList.Count > 0)
{
var res = leftWorkList.Where(x => x.StartWorkDateGr <= end && x.StartWorkDateGr > start).ToList();
if (res.Count > 0)
{
return new JsonResult(new
{
founded = true,
leftWorkList = res,
error = false
});
}
}
return new JsonResult(new
{
founded = false,
error = false
});
}
public IActionResult OnGetContractStatus(long employeeId, long workshopId, string employeeName, string workshopname)
{
var command = new ContractStatusViewModel();

View File

@@ -1,6 +1,7 @@
@model CompanyManagment.App.Contracts.Contract.ComputingViewModel
@{
var index = 1;
<style>
.modal.show .modal-dialog {
max-width: 900px;
@@ -33,16 +34,33 @@
margin: auto;
}
.sticky-div {
top: -5px;
.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span {
width: 26px;
height: 26px;
font-size: 11px;
}
.sticky-div {
top: -5px;
}
.noRotatingTxt {
color: #ef2d2d;
}
.hasRotatingTxt {
color: #18b74a;
}
@@media (max-width: 768px) {
.Rtable--collapse .Rtable-row {
outline: none;
}
}
</style>
string noRotatingTxt = "noRotatingTxt";
string hasRotatingTxt = "hasRotatingTxt";
}
@@ -60,18 +78,18 @@
<div class="wrapper wrapContainerRSR">
<div class="row">
<div class="col-4 text-start">
<div class="titleRSR">وضعیت نوبت کاری: @Model.RotatingStatus </div>
<div class="titleRSR">وضعیت نوبت کاری: <span class="@(!Model.HasRotatingShift? @noRotatingTxt :@hasRotatingTxt )">@Model.RotatingStatus</span></div>
</div>
<div class="col-4 text-center">
<div class="titleRSR">
نوع ساعت کاری:
@if (Model.HasRollCall)
{
<span> حضور غیاب</span>
<span>دارای حضور غیاب</span>
}
else
{
<span>عدم حضور غیاب</span>
<span>بدون حضور غیاب</span>
}
</div>
</div>
@@ -83,36 +101,51 @@
<div class="Rtable Rtable--5cols Rtable--collapse">
<div class="Rtable-row Rtable-row--head align-items-center sticky-div d-flex">
<div class="Rtable-cell column-heading width1">تاریخ</div>
<div class="Rtable-cell column-heading width2 text-center">کارکرد صبح</div>
<div class="Rtable-cell column-heading width3 text-center">کارکرد عصر</div>
<div class="Rtable-cell column-heading width4 text-center">کارکرد شب</div>
<div class="Rtable-cell column-heading width5 text-center">نوبت صبح</div>
<div class="Rtable-cell column-heading width6 text-center">نوبت عصر</div>
<div class="Rtable-cell column-heading width7 text-center">نوبت شب</div>
<div class="Rtable-cell column-heading width1">
<span class="text-white prevent-select">
ردیف
</span>
</div>
<div class="Rtable-cell column-heading width2">تاریخ</div>
<div class="Rtable-cell column-heading width3 text-center">کارکرد صبح</div>
<div class="Rtable-cell column-heading width4 text-center">کارکرد عصر</div>
<div class="Rtable-cell column-heading width5 text-center">کارکرد شب</div>
<div class="Rtable-cell column-heading width6 text-center">نوبت صبح</div>
<div class="Rtable-cell column-heading width7 text-center">نوبت عصر</div>
<div class="Rtable-cell column-heading width8 text-center">نوبت شب</div>
</div>
@foreach (var item in @Model.RotatingResultList)
{
<div class="Rtable-row align-items-center position-relative ">
<div class="Rtable-cell width1">
<div class="Rtable-row align-items-center position-relative">
<div class="Rtable-cell d-md-block d-none width1">
<div class="Rtable-cell--heading">
ردیف
</div>
<label for="@index" class="Rtable-cell--content prevent-select">
<span class="d-flex justify-content-center align-items-center">
@(index++)
</span>
</label>
</div>
<div class="Rtable-cell width2">
<div class="Rtable-cell--heading">تاریخ</div>
<div class="Rtable-cell--content">@item.RotatingDate</div>
</div>
<div class="Rtable-cell width2">
<div class="Rtable-cell width3">
<div class="Rtable-cell--heading">کارکرد صبح</div>
<div class="Rtable-cell--content text-center">@item.MorningString</div>
</div>
<div class="Rtable-cell width3">
<div class="Rtable-cell width4">
<div class="Rtable-cell--heading">کارکرد عصر</div>
<div class="Rtable-cell--content text-center">@item.EveningString</div>
</div>
<div class="Rtable-cell width4">
<div class="Rtable-cell width5">
<div class="Rtable-cell--heading">کارکرد شب</div>
<div class="Rtable-cell--content text-center">@item.NightString</div>
</div>
<div class="Rtable-cell width5">
<div class="Rtable-cell width6">
<div class="Rtable-cell--heading">نوبت صبح</div>
<div class="Rtable-cell--content text-center">
@if (item.IsMorningShift == true)
@@ -129,7 +162,7 @@
}
</div>
</div>
<div class="Rtable-cell d-md-block d-none width6">
<div class="Rtable-cell d-md-block d-none width7">
<div class="Rtable-cell--heading">نوبت عصر</div>
<div class="Rtable-cell--content text-center">
@if (item.IsEveningShift == true)
@@ -146,7 +179,7 @@
}
</div>
</div>
<div class="Rtable-cell d-md-block d-none width7">
<div class="Rtable-cell d-md-block d-none width8">
<div class="Rtable-cell--heading">نوبت شب</div>
<div class="Rtable-cell--content text-center">
@if (item.IsNightShift == true)

View File

@@ -180,7 +180,7 @@ $('#firstCheckBtn').on('click',
$('#datatable tbody tr').each(function (i) {
let chekbox = $(this).find("input[name=selectItem]");
if (chekbox.is(":checked") == true) {
employeeId = $(this).attr("data-employeeId");;
employeeId = $(this).attr("data-employeeId");
start = $(this).find("input[name=contarctStart]").val();
startObj = $(this).find("input[name=contarctStart]");
end = $(this).find("input[name=contractEnd]").val();
@@ -701,7 +701,12 @@ $("#start").keyup(function () {
$(this).addClass("errored");
} else {
$(this).removeClass("errored");
$(".sdate").val(value);
var endDate = $("#end").val();
if (endDate.length == 10) {
SetStartAndEndDate(value, endDate, true);
}
}
}
});
@@ -713,7 +718,11 @@ $("#end").keyup(function () {
$(this).addClass("errored");
} else {
$(this).removeClass("errored");
$(".edate").val(value);
var startDate = $("#start").val();
if (startDate.length == 10) {
SetStartAndEndDate(startDate, value,true);
}
}
}
});
@@ -745,18 +754,21 @@ $(".edate").keyup(function () {
$('#monthSelected').on('change',
function () {
const year = $("select[name=yearSelected]").val();
const month = $(this).val();
if (year === "0") {
$("select[name=yearSelected]").addClass("errored");
}
if (year != "0" && month != "0") {
const selectedDate = year + "/" + month + "/01";
const endDate = DateComputing(selectedDate);
$(".sdate").val(selectedDate);
$(".edate").val(endDate);
$('.sdate').removeClass("errored");
$('.edate').removeClass("errored");
SetStartAndEndDate(selectedDate, endDate,false);
}
});
@@ -768,15 +780,65 @@ $("select[name=yearSelected]").on('change',
if (year != "0" && month != "0") {
const selectedDate = year + "/" + month + "/01";
const endDate = DateComputing(selectedDate);
$(".sdate").val(selectedDate);
$(".edate").val(endDate);
$('.sdate').removeClass("errored");
$('.edate').removeClass("errored");
SetStartAndEndDate(selectedDate, endDate,false);
$("select[name=yearSelected]").removeClass("errored");
}
});
function SetStartAndEndDate(selectedDate, endDate, manualDate) {
const workshopId = Number($('#workshopId').val());
$.ajax({
dataType: 'json',
type: 'POST',
url: EmployeesStartedWorkInSelectedPeriodAjaxUrl,
data: { "workshopId": workshopId, "startDate": selectedDate, "endDate": endDate, "manualDate": manualDate },
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (response) {
if (response.founded && !response.error) {
$('#datatable tbody tr').each(function (i) {
let selectedTr = $(this);
let employeeIdInList = selectedTr.attr("data-employeeId");
console.log('employeeIdInList' + employeeIdInList);
selectedTr.find(".sdate").val(selectedDate);
selectedTr.find(".edate").val(endDate);
response.leftWorkList.forEach(function (el) {
if (el.employeeId == employeeIdInList) {
$('.sdate').removeClass("errored");
selectedTr.find(".sdate").val(el.startWorkDate);
selectedTr.find(".edate").val(endDate);
$('.edate').removeClass("errored");
}
});
});
} else if (!response.founded && !response.error) {
$(".sdate").val(selectedDate);
$('.sdate').removeClass("errored");
$(".edate").val(endDate);
$('.edate').removeClass("errored");
} else if (!response.founded && response.error) {
$('#end').addClass("errored");
}
},
failure: function (response) {
console.log(5, response);
}
}); //endOf Ajax
}
function DateComputing(selectedDate) {
var persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g],
arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g],