diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml index d65f843d..541719de 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml @@ -246,7 +246,7 @@ پرینت گروهی - + @@ -313,7 +313,7 @@ پرینت گروهی - + @@ -357,6 +357,7 @@ آغاز قرارداد پایان قرارداد روزهای کارکرد + مبلغ قابل پرداخت عملیات @@ -411,6 +412,12 @@ @item.SumOfWorkingDays + + + مبلغ قابل پرداخت + @(item.TotalPayment + " ریال") + + @@ -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")`; diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs index 1805c527..dbdc79e1 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs @@ -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 YearlyList; + + //by pooya + public List GroupPrintList; + public CustomizeChekoutDividedPrintViewModel DividList; + public int StartPrint; + public int EndPrint; + public List printIdList; + + public List 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 YearlyList; + var workshopHash = _httpContextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug"); + _workshopId = _passwordHasher.SlugDecrypt(workshopHash); - //by pooya - public List GroupPrintList; - public CustomizeChekoutDividedPrintViewModel DividList; - public int StartPrint; - public int EndPrint; - public List printIdList; + if (_workshopId < 1) + throw new InvalidDataException("اختلال در کارگاه"); + } - public List 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(); - 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 ExtractNumbers(string input) + //{ + // List numbers = new List(); + // 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(); - - // 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 ExtractNumbers(string input) - //{ - // List numbers = new List(); - // 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 id = [checkoutId]; + var customizeCheckout= _customizeCheckoutApplication.PrintAll(_workshopId, id); + var result=customizeCheckout.FirstOrDefault(); + return Partial("PrintOneCheckoutUnofficial", result); + } + + public IActionResult OnPostDeleteOne(long checkoutId) + { + List 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 checkoutIds) + { + // var ids = ExtractNumbers(checkoutIds); + var result= _customizeCheckoutApplication.GroupRemove(_workshopId,checkoutIds); + return new JsonResult(new { - List 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 id = [checkoutId]; - var result= _customizeCheckoutApplication.GroupRemove(_workshopId,id); - return new JsonResult(new - { - success = result.IsSuccedded, - message = result.Message - }); - } - - public IActionResult OnPostDeleteAll(List 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 Years { get; set; } + public List Month { get; set; } + public string LastMonth { get; set; } + public string LastYear { get; set; } +} \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js index 28f655ca..37df7ae7 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js @@ -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; /* سلکت شدن ماه جاری */ });