change years and month on create unofficial checkout

This commit is contained in:
SamSys
2025-03-02 20:52:31 +03:30
parent c2aaceda5a
commit 0778922571
3 changed files with 395 additions and 359 deletions

View File

@@ -246,7 +246,7 @@
<span>پرینت گروهی</span>
</button>
<button onclick="excelDownloadAll()" class="btn-excel text-nowrap me-1" type="button" Permission="@SubAccountPermissionHelper.ExcelCustomizeCheckoutPermissionCode">
<button onclick="showExcelAllModal()" class="btn-excel text-nowrap me-1" type="button" Permission="@SubAccountPermissionHelper.ExcelCustomizeCheckoutPermissionCode">
<svg width="20" height="20" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" fill="#000000">
<g id="SVGRepo_bgCarrier" stroke-width="1"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
@@ -313,7 +313,7 @@
</svg>
<span>پرینت گروهی</span>
</button>
<button onclick="excelDownloadAll()" class="btn-excel text-nowrap" type="button" Permission="@SubAccountPermissionHelper.ExcelCustomizeCheckoutPermissionCode">
<button onclick="showExcelAllModal()" class="btn-excel text-nowrap" type="button" Permission="@SubAccountPermissionHelper.ExcelCustomizeCheckoutPermissionCode">
<svg width="20" height="20" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" fill="#000000">
<g id="SVGRepo_bgCarrier" stroke-width="1"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
@@ -357,6 +357,7 @@
<div class="Rtable-cell column-heading width7">آغاز قرارداد</div>
<div class="Rtable-cell column-heading width8">پایان قرارداد</div>
<div class="Rtable-cell column-heading width9">روزهای کارکرد</div>
<div class="Rtable-cell column-heading width9">مبلغ قابل پرداخت</div>
<div class="Rtable-cell column-heading width10 text-end">عملیات</div>
</div>
@@ -411,6 +412,12 @@
@item.SumOfWorkingDays
</div>
</div>
<div class="Rtable-cell d-md-flex d-none width9">
<div class="@(item.TotalPaymentD < 0 ? "bgColorMonthlySalaryMinus" : "bgColorMonthlySalaryPlus" )">
<div class="Rtable-cell--heading">مبلغ قابل پرداخت</div>
<div class="Rtable-cell--content ">@(item.TotalPayment + " ریال")</div>
</div>
</div>
<div class="Rtable-cell d-md-flex d-none width10">
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">
<button class="btn-print moreThan992" type="button" onclick="printOne(@item.Id, '@item.Year', '@item.Month')" Permission="@SubAccountPermissionHelper.PrintCustomizeCheckoutPermissionCode">
@@ -719,7 +726,8 @@
var PrintOneUrl = `#showmodal=@Url.Page("/Company/CustomizeCheckout/CheckoutUnofficial", "PrintOne")`;
var CheckoutPrintAllUrl = `@Url.Page("/Company/CustomizeCheckout/PrintAllCheckoutUnofficial")`;
var CheckoutExcelDownloadUrl = `@Url.Page("/Company/CustomizeCheckout/PrintAllCheckoutUnofficial", "DownloadExcelAll")`;
var CheckoutExcelAllUrl = `@Url.Page("/Company/CustomizeCheckout/PrintAllCheckoutUnofficial", "DownloadExcelAll")`;
var showCheckoutExcelModalUrl = `#showmodal=@Url.Page("./CheckoutUnofficial", "ExcelModal")`;
var deleteOneAjax = `@Url.Page("/Company/CustomizeCheckout/CheckoutUnofficial", "DeleteOne")`;
var deleteAllAjax = `@Url.Page("/Company/CustomizeCheckout/CheckoutUnofficial", "DeleteAll")`;

View File

@@ -1,4 +1,5 @@
using _0_Framework.Application;
using System.Globalization;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.CustomizeCheckout;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Workshop;
@@ -7,388 +8,417 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using NuGet.Packaging.Signing;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using _0_Framework.Infrastructure;
namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout
namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout;
[NeedsPermission(SubAccountPermissionHelper.CustomizeCheckoutListPermissionCode)]
public class CheckoutUnofficialModel : PageModel
{
[NeedsPermission(SubAccountPermissionHelper.CustomizeCheckoutListPermissionCode)]
public class CheckoutUnofficialModel : PageModel
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
private readonly IWorkshopApplication _workshopApplication;
private readonly IEmployeeApplication _employeeApplication;
private readonly IAuthHelper _authHelper;
private readonly IPasswordHasher _passwordHasher;
private readonly IYearlySalaryApplication _yearlySalaryApplication;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly long _workshopId;
public string WorkshopFullName;
public SearchCustomizeCheckout SearchModel;
public List<string> YearlyList;
//by pooya
public List<CustomizeCheckoutViewModel> GroupPrintList;
public CustomizeChekoutDividedPrintViewModel DividList;
public int StartPrint;
public int EndPrint;
public List<long> printIdList;
public List<CustomizeCheckoutViewModel> CustomizeCheckouts { get; set; }
public CheckoutUnofficialModel(ICustomizeCheckoutApplication customizeCheckoutApplication, IAuthHelper authHelper, IPasswordHasher passwordHasher, IHttpContextAccessor httpContextAccessor, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IYearlySalaryApplication yearlySalaryApplication)
{
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
private readonly IWorkshopApplication _workshopApplication;
private readonly IEmployeeApplication _employeeApplication;
private readonly IAuthHelper _authHelper;
private readonly IPasswordHasher _passwordHasher;
private readonly IYearlySalaryApplication _yearlySalaryApplication;
private readonly IHttpContextAccessor _httpContextAccessor;
_customizeCheckoutApplication = customizeCheckoutApplication;
_authHelper = authHelper;
_passwordHasher = passwordHasher;
_httpContextAccessor = httpContextAccessor;
_workshopApplication = workshopApplication;
_employeeApplication = employeeApplication;
_yearlySalaryApplication = yearlySalaryApplication;
private readonly long _workshopId;
public string WorkshopFullName;
public SearchCustomizeCheckout SearchModel;
public List<string> YearlyList;
var workshopHash = _httpContextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
//by pooya
public List<CustomizeCheckoutViewModel> GroupPrintList;
public CustomizeChekoutDividedPrintViewModel DividList;
public int StartPrint;
public int EndPrint;
public List<long> printIdList;
if (_workshopId < 1)
throw new InvalidDataException("اختلال در کارگاه");
}
public List<CustomizeCheckoutViewModel> CustomizeCheckouts { get; set; }
public IActionResult OnGet(SearchCustomizeCheckout searchModel)
{
WorkshopFullName = _workshopApplication.GetWorkshopInfo(_workshopId).WorkshopFullName;
public CheckoutUnofficialModel(ICustomizeCheckoutApplication customizeCheckoutApplication, IAuthHelper authHelper, IPasswordHasher passwordHasher, IHttpContextAccessor httpContextAccessor, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IYearlySalaryApplication yearlySalaryApplication)
searchModel.WorkshopId = _workshopId;
CustomizeCheckouts = _customizeCheckoutApplication.Search(searchModel);
YearlyList = _yearlySalaryApplication.GetYears();
SearchModel = new SearchCustomizeCheckout()
{
_customizeCheckoutApplication = customizeCheckoutApplication;
_authHelper = authHelper;
_passwordHasher = passwordHasher;
_httpContextAccessor = httpContextAccessor;
_workshopApplication = workshopApplication;
_employeeApplication = employeeApplication;
_yearlySalaryApplication = yearlySalaryApplication;
Year = searchModel.Year,
Month = searchModel.Month,
SearchStartFa = searchModel.SearchStartFa,
SearchEndFa = searchModel.SearchEndFa,
EmployeeId = searchModel.EmployeeId,
OrderBy = searchModel.OrderBy,
PageIndex = CustomizeCheckouts.Count()
};
var workshopHash = _httpContextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
return Page();
}
if (_workshopId < 1)
throw new InvalidDataException("اختلال در کارگاه");
}
//public void OnGet(string idlist)
//{
// var ids = ExtractNumbers(idlist);
// var resultList = new List<CustomizeCheckoutBatchPrintViewModel>();
public IActionResult OnGet(SearchCustomizeCheckout searchModel)
// var res = _customizeCheckoutApplication.PrintAll(_workshopId, ids);
// //WorkshopId = res.Select(x => x.WorkshopId).FirstOrDefault();
// var printCounter = ids.Count();
// if (printCounter <= 25)
// {
// GroupPrintList = res;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Select(x => x.Id).ToList(),
// StartPrint = 1,
// EndPrint = printCounter,
// };
// resultList.Add(addToList);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else
// {
// var divide20 = printCounter / 20;
// var multiple = printCounter - (divide20 * 20);
// if (multiple == 0)
// {
// for (int i = 1; i <= printCounter; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// }
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else if (multiple <= 5)
// {
// int endOfround = 0;
// for (int i = 1; i <= printCounter - 26; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// endOfround = end;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// endOfround = end;
// resultList.Add(addToList);
// }
// }
// var count = res.Where(x => x.PrintCounter > endOfround).ToList();
// var addLastPart = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter > endOfround).Select(x => x.Id).ToList(),
// StartPrint = count.Select(x => x.PrintCounter).FirstOrDefault(),
// EndPrint = count.Select(x => x.PrintCounter).LastOrDefault(),
// };
// resultList.Add(addLastPart);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else if (multiple > 5)
// {
// int endOfround = 0;
// var pcounter = multiple + 1;
// for (int i = 1; i <= printCounter - pcounter; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// endOfround = end;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// endOfround = end;
// resultList.Add(addToList);
// }
// }
// var count = res.Where(x => x.PrintCounter > endOfround).ToList();
// var addLastPart = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter > endOfround).Select(x => x.Id).ToList(),
// StartPrint = count.Select(x => x.PrintCounter).FirstOrDefault(),
// EndPrint = count.Select(x => x.PrintCounter).LastOrDefault(),
// };
// resultList.Add(addLastPart);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// }
//}
//public IActionResult OnGetPrintAll(CustomizeCheckoutBatchPrintViewModel sendIds)
//{
// var res = _customizeCheckoutApplication.PrintAll(_workshopId, sendIds.CustomizeCheckoutIdList);
// var result = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutViewModels = res,
// };
// return Partial("PrintAll", result);
//}
//static List<long> ExtractNumbers(string input)
//{
// List<long> numbers = new List<long>();
// string pattern = @"\d+"; // Matches one or more digits
// MatchCollection matches = Regex.Matches(input, pattern);
// foreach (Match match in matches)
// {
// if (long.TryParse(match.Value, out long number))
// {
// numbers.Add(number);
// }
// }
// return numbers;
//}
public IActionResult OnGetCustomizeCheckoutsList(SearchCustomizeCheckout searchModel)
{
var search = new SearchCustomizeCheckout()
{
WorkshopFullName = _workshopApplication.GetWorkshopInfo(_workshopId).WorkshopFullName;
WorkshopId = _workshopId,
Year = searchModel.Year,
Month = searchModel.Month,
SearchStartFa = searchModel.SearchStartFa,
SearchEndFa = searchModel.SearchEndFa,
EmployeeId = searchModel.EmployeeId,
OrderBy = searchModel.OrderBy,
PageIndex = searchModel.PageIndex
};
searchModel.WorkshopId = _workshopId;
CustomizeCheckouts = _customizeCheckoutApplication.Search(searchModel).ToList();
var resultData = _customizeCheckoutApplication.Search(search).ToList();
YearlyList = _yearlySalaryApplication.GetYears();
SearchModel = new SearchCustomizeCheckout()
{
Year = searchModel.Year,
Month = searchModel.Month,
SearchStartFa = searchModel.SearchStartFa,
SearchEndFa = searchModel.SearchEndFa,
EmployeeId = searchModel.EmployeeId,
OrderBy = searchModel.OrderBy,
PageIndex = CustomizeCheckouts.Count()
};
return Page();
}
//public void OnGet(string idlist)
//{
// var ids = ExtractNumbers(idlist);
// var resultList = new List<CustomizeCheckoutBatchPrintViewModel>();
// var res = _customizeCheckoutApplication.PrintAll(_workshopId, ids);
// //WorkshopId = res.Select(x => x.WorkshopId).FirstOrDefault();
// var printCounter = ids.Count();
// if (printCounter <= 25)
// {
// GroupPrintList = res;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Select(x => x.Id).ToList(),
// StartPrint = 1,
// EndPrint = printCounter,
// };
// resultList.Add(addToList);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else
// {
// var divide20 = printCounter / 20;
// var multiple = printCounter - (divide20 * 20);
// if (multiple == 0)
// {
// for (int i = 1; i <= printCounter; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// }
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else if (multiple <= 5)
// {
// int endOfround = 0;
// for (int i = 1; i <= printCounter - 26; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// endOfround = end;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// endOfround = end;
// resultList.Add(addToList);
// }
// }
// var count = res.Where(x => x.PrintCounter > endOfround).ToList();
// var addLastPart = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter > endOfround).Select(x => x.Id).ToList(),
// StartPrint = count.Select(x => x.PrintCounter).FirstOrDefault(),
// EndPrint = count.Select(x => x.PrintCounter).LastOrDefault(),
// };
// resultList.Add(addLastPart);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// else if (multiple > 5)
// {
// int endOfround = 0;
// var pcounter = multiple + 1;
// for (int i = 1; i <= printCounter - pcounter; i += 20)
// {
// var start = i;
// var end = i + 19;
// if (i == 1)
// {
// GroupPrintList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).ToList();
// endOfround = end;
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// resultList.Add(addToList);
// }
// else
// {
// var addToList = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter >= start && x.PrintCounter <= end).Select(x => x.Id).ToList(),
// StartPrint = start,
// EndPrint = end,
// };
// endOfround = end;
// resultList.Add(addToList);
// }
// }
// var count = res.Where(x => x.PrintCounter > endOfround).ToList();
// var addLastPart = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutIdList = res.Where(x => x.PrintCounter > endOfround).Select(x => x.Id).ToList(),
// StartPrint = count.Select(x => x.PrintCounter).FirstOrDefault(),
// EndPrint = count.Select(x => x.PrintCounter).LastOrDefault(),
// };
// resultList.Add(addLastPart);
// var finalResult = new CustomizeChekoutDividedPrintViewModel()
// {
// CustomizeCheckoutGroupPrintViewModels = resultList,
// ButtonCounter = resultList.Count,
// };
// DividList = finalResult;
// }
// }
//}
//public IActionResult OnGetPrintAll(CustomizeCheckoutBatchPrintViewModel sendIds)
//{
// var res = _customizeCheckoutApplication.PrintAll(_workshopId, sendIds.CustomizeCheckoutIdList);
// var result = new CustomizeCheckoutBatchPrintViewModel()
// {
// CustomizeCheckoutViewModels = res,
// };
// return Partial("PrintAll", result);
//}
//static List<long> ExtractNumbers(string input)
//{
// List<long> numbers = new List<long>();
// string pattern = @"\d+"; // Matches one or more digits
// MatchCollection matches = Regex.Matches(input, pattern);
// foreach (Match match in matches)
// {
// if (long.TryParse(match.Value, out long number))
// {
// numbers.Add(number);
// }
// }
// return numbers;
//}
public IActionResult OnGetCustomizeCheckoutsList(SearchCustomizeCheckout searchModel)
return new JsonResult(new
{
var search = new SearchCustomizeCheckout()
{
WorkshopId = _workshopId,
Year = searchModel.Year,
Month = searchModel.Month,
SearchStartFa = searchModel.SearchStartFa,
SearchEndFa = searchModel.SearchEndFa,
EmployeeId = searchModel.EmployeeId,
OrderBy = searchModel.OrderBy,
PageIndex = searchModel.PageIndex
};
success = true,
data = resultData,
pageIndex = resultData.Count()
});
}
var resultData = _customizeCheckoutApplication.Search(search).ToList();
public IActionResult OnGetEmployeeList()
{
var result = _employeeApplication.GetWorkingEmployeesByWorkshopId(_workshopId);
return new JsonResult(new
{
success = true,
data = result
});
}
public IActionResult OnGetCreate()
{
PersianCalendar pc = new PersianCalendar();
DateTime now = DateTime.Now;
// رفتن به ماه گذشته
DateTime lastMonth = pc.AddMonths(now, -1);
int year = pc.GetYear(lastMonth);
int month = pc.GetMonth(lastMonth);
var model = new GetCreateCustomizeCheckout()
{
Years = _yearlySalaryApplication.GetYears(),
LastMonth = month.ToString(),
LastYear =year.ToString()
};
return Partial("ModalCheckoutUnofficialCreate",model);
}
public IActionResult OnPostCreate(CreateCustomizeCheckoutGroup command)
{
command.WorkshopId = _workshopId;
var result = _customizeCheckoutApplication.GroupCreate(command);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
public IActionResult OnGetEmployeesByYearAndMonth(int year, int month)
{
var result = _customizeCheckoutApplication.GetWorkshopEmployeesEligibleForCheckoutInDates(_workshopId, year, month);
if (result.IsSuccedded)
{
return new JsonResult(new
{
success = true,
data = resultData,
pageIndex = resultData.Count()
success = result.IsSuccedded,
data = result.Data
});
}
public IActionResult OnGetEmployeeList()
else
{
var result = _employeeApplication.GetWorkingEmployeesByWorkshopId(_workshopId);
return new JsonResult(new
{
success = true,
data = result
});
}
public IActionResult OnGetCreate()
{
return Partial("ModalCheckoutUnofficialCreate");
}
public IActionResult OnPostCreate(CreateCustomizeCheckoutGroup command)
{
command.WorkshopId = _workshopId;
var result = _customizeCheckoutApplication.GroupCreate(command);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
}
public IActionResult OnGetEmployeesByYearAndMonth(int year, int month)
public IActionResult OnGetPrintOne(long checkoutId, int yearFa, int monthFa, int index)
{
List<long> id = [checkoutId];
var customizeCheckout= _customizeCheckoutApplication.PrintAll(_workshopId, id);
var result=customizeCheckout.FirstOrDefault();
return Partial("PrintOneCheckoutUnofficial", result);
}
public IActionResult OnPostDeleteOne(long checkoutId)
{
List<long> id = [checkoutId];
var result= _customizeCheckoutApplication.GroupRemove(_workshopId,id);
return new JsonResult(new
{
var result = _customizeCheckoutApplication.GetWorkshopEmployeesEligibleForCheckoutInDates(_workshopId, year, month);
if (result.IsSuccedded)
{
return new JsonResult(new
{
success = result.IsSuccedded,
data = result.Data
});
}
else
{
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
}
success = result.IsSuccedded,
message = result.Message
});
}
public IActionResult OnGetPrintOne(long checkoutId, int yearFa, int monthFa, int index)
public IActionResult OnPostDeleteAll(List<long> checkoutIds)
{
// var ids = ExtractNumbers(checkoutIds);
var result= _customizeCheckoutApplication.GroupRemove(_workshopId,checkoutIds);
return new JsonResult(new
{
List<long> id = [checkoutId];
var customizeCheckout= _customizeCheckoutApplication.PrintAll(_workshopId, id);
var result=customizeCheckout.FirstOrDefault();
return Partial("PrintOneCheckoutUnofficial", result);
}
success = result.IsSuccedded,
message = result.Message
});
}
public IActionResult OnPostDeleteOne(long checkoutId)
{
List<long> id = [checkoutId];
var result= _customizeCheckoutApplication.GroupRemove(_workshopId,id);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
public IActionResult OnPostDeleteAll(List<long> checkoutIds)
{
// var ids = ExtractNumbers(checkoutIds);
var result= _customizeCheckoutApplication.GroupRemove(_workshopId,checkoutIds);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
}
public IActionResult OnGetExcelModal()
{
return Partial("ModalExcelSetting");
}
}
public class GetCreateCustomizeCheckout
{
public List<string> Years { get; set; }
public List<string> Month { get; set; }
public string LastMonth { get; set; }
public string LastYear { get; set; }
}

View File

@@ -60,14 +60,12 @@
/* سلکت شدن ماه جاری */
const today = new Date();
const jalaaliDate = jalaali.toJalaali(today.getFullYear(), today.getMonth(), today.getDate());
const currentMonth = String(jalaaliDate.jm).padStart(2, '0');
/* const lastMonth = */
//const today = new Date();
//const jalaaliDate = jalaali.toJalaali(today.getFullYear(), today.getMonth(), today.getDate());
//const currentMonth = String(jalaaliDate.jm).padStart(2, '0');
const monthSelect = document.getElementById('month-select');
monthSelect.value = currentMonth;
monthSelect.value = lastMonth;
/* سلکت شدن ماه جاری */
});