From 87b0d248a3785998370f891d83ce99b40f644ab5 Mon Sep 17 00:00:00 2001 From: Mahan Ch Date: Tue, 3 Jun 2025 19:38:18 +0330 Subject: [PATCH] Convert checkoutPrintOne to CheckoutPrintAll for best performance --- CompanyManagment.Application/CheckoutApplication.cs | 8 ++++---- .../Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs | 2 +- .../Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 159da336..9d26aa35 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -329,9 +329,9 @@ public class CheckoutApplication : ICheckoutApplication if (x.HasRollCall) { - totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)); + totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - x.TotalHourlyLeave; totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks)); - totalPresent = totalWorking + totalBreakTime - x.TotalHourlyLeave; + totalPresent = totalWorking + totalBreakTime ; } else { @@ -373,9 +373,9 @@ public class CheckoutApplication : ICheckoutApplication TimeSpan totalHoursLeave; if (result.HasRollCall) { - totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)); + totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - result.TotalHourlyLeave; totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks)); - totalPresent = totalWorking + totalBreakTime - result.TotalHourlyLeave; + totalPresent = totalWorking + totalBreakTime ; } else { diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index ae4b501d..34a3d445 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -1013,7 +1013,7 @@ public class IndexModel : PageModel public IActionResult OnGetPrintOne(long id) { - var res = _checkoutApplication.PrintOne(id); + var res = _checkoutApplication.PrintAll([id]).FirstOrDefault(); //var res = _contractApplication.PrintAll(ids); if (res.HasRollCall) return Partial("PrintDetailsRollCall", res); diff --git a/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs index 7a18b4f2..7ae63485 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs @@ -233,7 +233,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Checkouts public IActionResult OnGetPrintOne(long id) { - var res = _checkoutApplication.PrintOne(id); + var res = _checkoutApplication.PrintAll([id]).FirstOrDefault(); if (res.HasRollCall) return Partial("PrintOneRollCall", res); @@ -246,7 +246,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Checkouts public IActionResult OnGetPrintOneMobile(long id) { - var res = _checkoutApplication.PrintOne(id); + var res = _checkoutApplication.PrintAll([id]).FirstOrDefault(); if (res.HasRollCall) return Partial("PrintOneRollCall", res);