diff --git a/GPW.CORE.ADM/Components/Compo/ApprovTimbMan.razor.cs b/GPW.CORE.ADM/Components/Compo/ApprovTimbMan.razor.cs index dd7bebb..1b8636f 100644 --- a/GPW.CORE.ADM/Components/Compo/ApprovTimbMan.razor.cs +++ b/GPW.CORE.ADM/Components/Compo/ApprovTimbMan.razor.cs @@ -227,6 +227,7 @@ namespace GPW.CORE.ADM.Components.Compo private async Task ReloadData() { + currPage = 1; isLoading = true; ListRecords = null; try diff --git a/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor b/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor new file mode 100644 index 0000000..d2240aa --- /dev/null +++ b/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor @@ -0,0 +1,242 @@ + +
+
+
+
+

Elenco Timbrature

+
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + +
+
+
+
+ @if (ListRecords == null || isLoading) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + + + + + + + + + + + @foreach (var item in ListRecords) + { + + + + + + + + + + + + + + + + + + + + } + +
+ + + Dipendente Data INOUTINOUTINOUTINOUTH LavH GiuT/C19TagChkH Com
+ + + @item.CognomeNome + +
+ @($"{item.DataLav:yyyy.MM.dd}") +
+
+ @($"{item.DataLav:dddd}") + +
+
+ @if (item.entrata_1 != null) + { + @($"{item.entrata_1:HH:mm}") + } + + @if (item.uscita_1 != null) + { + @($"{item.uscita_1:HH:mm}") + } + + @if (item.entrata_2 != null) + { + @($"{item.entrata_2:HH:mm}") + } + + @if (item.uscita_2 != null) + { + @($"{item.uscita_2:HH:mm}") + } + + @if (item.entrata_3 != null) + { + @($"{item.entrata_3:HH:mm}") + } + + @if (item.uscita_3 != null) + { + @($"{item.uscita_3:HH:mm}") + } + + @if (item.entrata_4 != null) + { + @($"{item.entrata_4:HH:mm}") + } + + @if (item.uscita_4 != null) + { + @($"{item.uscita_4:HH:mm}") + } + + @($"{item.h_lav:N2}") + + @if (item.h_giust > 0) + { + @($"{item.h_giust:N2}") + } + + @if (item.TempRil < 34) + { + + } + else if (item.TempRil < 37) + { + + } + else if (item.TempRil < (decimal)37.5) + { + + } + else + { + + } + + @if (!item.TagIsActive) + { + @item.CodTag + } + else + { + @item.CodTag + } + + @if (!item.isOkTim) + { + T + } + @if (!item.isOkApp) + { + A + } + @if (item.isOkLav == 0) + { + O + } + @if (!string.IsNullOrEmpty(item.chkFunCod)) + { + @item.minMpp + } + @if (item.isOk != 0) + { + Ok + } + + @if (item.okLAvCom != 0) + { + @($"{item.h_com:N2}") + } + else + { + @($"{item.h_com:N2}") + } +
+
+
+ @if (SelRecord != null) + { + +

Giustificativi

+

Record Commesse

+ } +
+
+ } + +
+ +
+ diff --git a/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor.cs b/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor.cs new file mode 100644 index 0000000..dede190 --- /dev/null +++ b/GPW.CORE.ADM/Components/Compo/ReviewTimbMan.razor.cs @@ -0,0 +1,254 @@ +using EgwCoreLib.Razor; +using GPW.CORE.Data.DbModels; +using GPW.CORE.Data.Services; +using GPW.CORE.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using NLog; +using EgwCoreLib.Utils; +using System.Diagnostics; + +namespace GPW.CORE.ADM.Components.Compo +{ + public partial class ReviewTimbMan : IDisposable + { + #region Public Methods + + public void Dispose() + { + AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated; + } + + #endregion Public Methods + + #region Protected Fields + + protected List PageSizeListSpec = new List() { 5, 10, 15, 20, 25, 50 }; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected MessageService AppMServ { get; set; } = null!; + + [Inject] + protected GpwDataService GDataServ { get; set; } = null!; + + protected int IdxDipSel { get; set; } = 0; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected string CheckSel(TeRaExplModel? SelItem) + { + string answ = ""; + if (SelRecord != null) + { + answ = SelRecord.UID == SelItem.UID ? "table-info" : ""; + } + return answ; + } + + protected async void DoDelete(TimbratureModel selItem) + { + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare il record?")) + return; + + await GDataServ.TimbratureDelete(selItem); + SelRecord = null; + await ReloadData(); + await InvokeAsync(StateHasChanged); + } + + protected async Task DoSelect(TeRaExplModel selItem) + { + SelRecord = selItem; + // seleziono timbrature... + ListTimbDay = await GDataServ.TimbratureDay(selItem.DataLav, selItem.IdxDipendente); + await Task.Delay(1); + //await InvokeAsync(StateHasChanged); + } + + protected async Task ForceReload(bool force) + { + SelRecord = null; + await ReloadData(); + } + + protected async Task ForceUpdate(TimbratureModel UpdRec) + { + await GDataServ.TimbratureUpdate(UpdRec); + await ReloadData(); + } + + protected override async Task OnInitializedAsync() + { + CurrPeriodo.Fine = DateTime.Today.AddDays(1); + CurrSearch = ""; + AppMServ.SearchVal = ""; + AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated; + numRecord = await AppMServ.NumRowGridGet(gridKey); + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + } + + private List? ListTimbDay { get; set; } = null; + + protected async Task SetNumRec(int newNum) + { + numRecord = newNum; + currPage = 1; + await AppMServ.NumRowGridSet(gridKey, newNum); + await InvokeAsync(ReloadData); + } + + protected async Task SetPage(int newNum) + { + currPage = newNum; + await InvokeAsync(ReloadData); + } + + protected async Task SortRequested(Sorter.SortCallBack e) + { + sortField = e.ParamName; + sortAsc = e.IsAscending; + await ReloadData(); + } + + #endregion Protected Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + private string gridKey = "RevTimbMan"; + private bool sortAsc = true; + private string sortField = ""; + + #endregion Private Fields + + #region Private Properties + + private int currPage { get; set; } = 1; + private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth); + private string CurrSearch { get; set; } = ""; + private bool filtDip { get; set; } = false; + private bool isLoading { get; set; } = false; + private List ListDipendenti { get; set; } = new List(); + private List? ListRecords { get; set; } = null; + private int MaxErrMin { get; set; } = -30; + private int MaxErrPlus { get; set; } = 30; + private int numRecord { get; set; } = 10; + private List? SearchRecords { get; set; } = null; + private TeRaExplModel? SelRecord { get; set; } = null; + private bool ShowInatt { get; set; } = false; + private bool ShowWE { get; set; } = true; + private int totalCount { get; set; } = 0; + + #endregion Private Properties + + #region Private Methods + + private async void AppMServ_EA_SearchUpdated() + { + CurrSearch = AppMServ.SearchVal; + await ReloadData(); + await InvokeAsync(StateHasChanged); + } + + private async Task ReloadData() + { + currPage = 1; + isLoading = true; + ListRecords = null; + var rawList = await GDataServ.DipendentiGetAll(); + if (ShowInatt) + { + ListDipendenti = rawList; + } + else + { + ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList(); + } + try + { + SearchRecords = await GDataServ.TeRaExplGetFilt(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, ShowInatt, ShowWE, MaxErrMin, MaxErrPlus); + // verifico filtro per IdxDip + if (IdxDipSel > 0) + { + SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList(); + } + } + catch (Exception ex) + { + Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}"); + } + totalCount = SearchRecords.Count; + SortTable(); + isLoading = false; + } + + private async Task SavePeriodo(DtUtils.Periodo newPeiodo) + { + CurrPeriodo = newPeiodo; + await ReloadData(); + } + + private void SortTable() + { + if (SearchRecords != null) + { + // se ho ordinamento riordino... + if (!string.IsNullOrEmpty(sortField)) + { + switch (sortField) + { + case "Dipendente": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.CognomeNome).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.CognomeNome).ToList(); + } + break; + + case "DataLav": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.DataLav).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.DataLav).ToList(); + } + break; + + default: + break; + } + } + + // filtro x display + ListRecords = SearchRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + } + else + { + ListRecords = new List(); + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/GPW.CORE.ADM/Components/Compo/TimbList.razor b/GPW.CORE.ADM/Components/Compo/TimbList.razor new file mode 100644 index 0000000..e3a0f10 --- /dev/null +++ b/GPW.CORE.ADM/Components/Compo/TimbList.razor @@ -0,0 +1,67 @@ +

Timbrature

+
+
+
Timbrature
+
+
+ @if (ListTimb == null || ListTimb.Count == 0) + { +
Nessun record trovato
+ } + else + { + + + + + + + + + + + + @foreach (var item in ListTimb) + { + + + + + + + + } + +
Scambio
@item.DataOra.ToString("dd/MM - HH:mm") + @if (@item.Entrata == true) + { + + } + + @if (EnableEdit) + { + + } + else + { + + } + + @if (@item.Entrata == false) + { + + } + + @if (EnableDelete) + { + + } + else + { + + } +
+ } +
+
+ diff --git a/GPW.CORE.ADM/Components/Compo/TimbList.razor.cs b/GPW.CORE.ADM/Components/Compo/TimbList.razor.cs new file mode 100644 index 0000000..84348fc --- /dev/null +++ b/GPW.CORE.ADM/Components/Compo/TimbList.razor.cs @@ -0,0 +1,82 @@ +using GPW.CORE.Data.DbModels; +using Microsoft.AspNetCore.Components; + +namespace GPW.CORE.ADM.Components.Compo +{ + public partial class TimbList + { + #region Public Properties + + [Parameter] + public bool EnableDelete { get; set; } = false; + + [Parameter] + public bool EnableEdit { get; set; } = false; + + [Parameter] + public List? ListTimb + { + get => listTimb; + + set => listTimb = value; + } + + [Parameter] + public EventCallback EC_ReqDelete { get; set; } + + [Parameter] + public EventCallback EC_ReqUpdate { get; set; } + + #endregion Public Properties + + #region Protected Properties + + protected List? listTimb + { + get + { + return _ListTimb; + } + + set + { + if (value != null) + { + _ListTimb = value.OrderByDescending(x => x.DataOra).ToList(); + } + else + { + _ListTimb = null; + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected async void Delete(TimbratureModel currRecord) + { + await EC_ReqDelete.InvokeAsync(currRecord); + } + + protected override async Task OnParametersSetAsync() + { + await InvokeAsync(StateHasChanged); + } + + protected async void ScambioInOut(TimbratureModel currRecord) + { + currRecord.Entrata = !currRecord.Entrata; + await EC_ReqUpdate.InvokeAsync(currRecord); + } + + #endregion Protected Methods + + #region Private Properties + + private List? _ListTimb { get; set; } = new List(); + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/GPW.CORE.ADM/Components/Pages/ReviewTimbrature.razor b/GPW.CORE.ADM/Components/Pages/ReviewTimbrature.razor index 7964332..c2ea7f2 100644 --- a/GPW.CORE.ADM/Components/Pages/ReviewTimbrature.razor +++ b/GPW.CORE.ADM/Components/Pages/ReviewTimbrature.razor @@ -1,7 +1,16 @@ @page "/ReviewTimbrature" +@inject MessageService AppMServ +@inject AppAuthService AuthServ - + @code { - + + protected override void OnInitialized() + { + // imposto pagina e info testata + AppMServ.ShowSearch = true; + AppMServ.PageName = AuthServ.Traduci("reviewTimb"); + AppMServ.PageIcon = AuthServ.Traduci("reviewTimbExpl"); + } } diff --git a/GPW.CORE.ADM/GPW.CORE.ADM.csproj b/GPW.CORE.ADM/GPW.CORE.ADM.csproj index 1e2dc9f..aa715ad 100644 --- a/GPW.CORE.ADM/GPW.CORE.ADM.csproj +++ b/GPW.CORE.ADM/GPW.CORE.ADM.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 4.1.2409.1309 + 4.1.2409.1315 diff --git a/GPW.CORE.ADM/Properties/PublishProfiles/IIS-PROD.pubxml.user b/GPW.CORE.ADM/Properties/PublishProfiles/IIS-PROD.pubxml.user index 369f061..7cab50e 100644 --- a/GPW.CORE.ADM/Properties/PublishProfiles/IIS-PROD.pubxml.user +++ b/GPW.CORE.ADM/Properties/PublishProfiles/IIS-PROD.pubxml.user @@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAADrbAogtj/xpZqylbgs9Hb3AAAAAASAAACgAAAAEAAAAFm1lcdH7oj+NFy4QgZ7q18YAAAAROPsyRR12dhPTKfMEQ5yNCAZJ5K7C4pvFAAAAEFBVTwItjyYP2BlOTsuK1g9myQ8 - True|2024-09-12T14:07:39.0226825Z||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||; + True|2024-09-13T07:22:22.8253732Z||;True|2024-09-12T16:07:39.0226825+02:00||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||; \ No newline at end of file diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs index 978a313..9949e91 100644 --- a/GPW.CORE.Data/Controllers/GPWController.cs +++ b/GPW.CORE.Data/Controllers/GPWController.cs @@ -1797,14 +1797,14 @@ namespace GPW.CORE.Data.Controllers List dbResult = new List(); using (GPWContext localDbCtx = new GPWContext(_configuration)) { - var idxDipendente = new SqlParameter("@idxDipendente", idxDip); + var idxDipendente = new SqlParameter("@IdxDip", idxDip); var inizio = new SqlParameter("@inizio", dataStart); var fine = new SqlParameter("@fine", dataEnd); var maxRes = new SqlParameter("@maxRes", maxResult); dbResult = localDbCtx .DbSetParetoRegAtt - .FromSqlRaw("EXEC stp_freqProjByDipPeriodo @idxDipendente, @inizio,@fine,@maxRes", idxDipendente, inizio, fine, maxRes) + .FromSqlRaw("EXEC stp_freqProjByDipPeriodo @IdxDip, @inizio,@fine,@maxRes", idxDipendente, inizio, fine, maxRes) .ToList(); } return dbResult; @@ -2406,38 +2406,6 @@ namespace GPW.CORE.Data.Controllers return answ; } - /// - /// Recupera record anomalie dipendenti - /// - /// singolo idx oppure 0 = tutti - /// - /// - /// - /// - /// - /// - /// - public List TeRaExplGetAll(int idxDipendente, DateTime dataFrom, DateTime dataTo, bool inatt, bool showWE, int maxErrMin, int maxErrPlus) - { - List dbResult = new List(); - using (GPWContext localDbCtx = new GPWContext(_configuration)) - { - SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente); - SqlParameter parDataFrom = new SqlParameter("@dataFrom", dataFrom); - SqlParameter parDataTo = new SqlParameter("@dataTo", dataTo); - SqlParameter parInatt = new SqlParameter("@parInatt", inatt); - SqlParameter parShowWE = new SqlParameter("@showWE", showWE); - SqlParameter parMaxErrMin = new SqlParameter("@maxErrMin", maxErrMin); - SqlParameter parMaxErrPlus = new SqlParameter("@maxErrPlus", maxErrPlus); - - dbResult = localDbCtx - .DbSetTeRaExpl - .FromSqlRaw("EXEC stp_TE_RA_ByUserDate @idxDipendente,@dataFrom,@dataTo,@parInatt,@showWE,@maxErrMin,@maxErrPlus", parIdxDip, parDataFrom, parDataTo, parInatt, parShowWE, parMaxErrMin, parMaxErrPlus) - .ToList(); - } - return dbResult; - } - /// /// Recupera record anomalie dipendenti /// @@ -2453,7 +2421,7 @@ namespace GPW.CORE.Data.Controllers List dbResult = new List(); using (GPWContext localDbCtx = new GPWContext(_configuration)) { - SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente); + SqlParameter parIdxDip = new SqlParameter("@IdxDip", idxDipendente); SqlParameter parInizio = new SqlParameter("@inizio", inizio); SqlParameter parFine = new SqlParameter("@fine", fine); SqlParameter parNotOkApp = new SqlParameter("@notOkApp", notOkApp); @@ -2462,7 +2430,7 @@ namespace GPW.CORE.Data.Controllers dbResult = localDbCtx .DbSetTimbratureExpl - .FromSqlRaw("EXEC stp_timbratureExpl_getByAnomalia @idxDipendente,@inizio,@fine,@notOkApp,@notOkTim,@notOkLav", parIdxDip, parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav) + .FromSqlRaw("EXEC stp_timbratureExpl_getByAnomalia @IdxDip,@inizio,@fine,@notOkApp,@notOkTim,@notOkLav", parIdxDip, parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav) .ToList(); } return dbResult; @@ -2480,13 +2448,45 @@ namespace GPW.CORE.Data.Controllers List dbResult = new List(); using (GPWContext localDbCtx = new GPWContext(_configuration)) { - SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente); + SqlParameter parIdxDip = new SqlParameter("@IdxDip", idxDipendente); SqlParameter parInizio = new SqlParameter("@inizio", inizio); SqlParameter parFine = new SqlParameter("@fine", fine); dbResult = localDbCtx .DbSetTimbratureExpl - .FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @idxDipendente,@inizio,@fine", parIdxDip, parInizio, parFine) + .FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @IdxDip,@inizio,@fine", parIdxDip, parInizio, parFine) + .ToList(); + } + return dbResult; + } + + /// + /// Recupera record timbrature explose + consuntivo attivita dipendenti + /// + /// singolo idx oppure 0 = tutti + /// Inizio periodo + /// Fine periodo + /// Mostra inattivi + /// Mostra weekend + /// max consentito in mancanza + /// max consentito in eccesso + /// + public List TeRaExplGetFilt(int IdxDip, DateTime DtFrom, DateTime DtTo, bool ShowIn, bool ShowWE, int MaxErrMin, int MaxErrPlus) + { + List dbResult = new List(); + using (GPWContext localDbCtx = new GPWContext(_configuration)) + { + SqlParameter pIdxDip = new SqlParameter("@IdxDip", IdxDip); + SqlParameter pDataFrom = new SqlParameter("@DtFrom", DtFrom); + SqlParameter pDataTo = new SqlParameter("@DtTo", DtTo); + SqlParameter pInatt = new SqlParameter("@pInatt", ShowIn); + SqlParameter pShowWE = new SqlParameter("@ShowWE", ShowWE); + SqlParameter pMaxErrMin = new SqlParameter("@MaxErrMin", MaxErrMin); + SqlParameter pMaxErrPlus = new SqlParameter("@MaxErrPlus", MaxErrPlus); + + dbResult = localDbCtx + .DbSetTeRaExpl + .FromSqlRaw("EXEC stp_TE_RA_ByUserDate @IdxDip,@DtFrom,@DtTo,@pInatt,@ShowWE,@MaxErrMin,@MaxErrPlus", pIdxDip, pDataFrom, pDataTo, pInatt, pShowWE, pMaxErrMin, pMaxErrPlus) .ToList(); } return dbResult; diff --git a/GPW.CORE.Data/DbModels/TeRaExplModel.cs b/GPW.CORE.Data/DbModels/TeRaExplModel.cs index 4b20fed..ad6c5c9 100644 --- a/GPW.CORE.Data/DbModels/TeRaExplModel.cs +++ b/GPW.CORE.Data/DbModels/TeRaExplModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.Data; namespace GPW.CORE.Data.DbModels { @@ -13,7 +14,7 @@ namespace GPW.CORE.Data.DbModels public double h_giust { get; set; } = 0; public decimal h_com { get; set; } = 0; public string progetti { get; set; } = ""; - public bool okLAvCom { get; set; } = false; + public int okLAvCom { get; set; } = 0; public bool isOkTim { get; set; } = false; public bool isOkApp { get; set; } = false; public int isOkLav { get; set; } = 0; @@ -45,5 +46,10 @@ namespace GPW.CORE.Data.DbModels public bool TagIsActive { get; set; } = false; public string CodTag { get; set; } = ""; + [NotMapped] + public string UID + { + get => $"{IdxDipendente:000}_{DataLav:yyyyMMdd}"; + } } } diff --git a/GPW.CORE.Data/DbModels/TimbratureExplModel.cs b/GPW.CORE.Data/DbModels/TimbratureExplModel.cs index 47126a4..c8942c8 100644 --- a/GPW.CORE.Data/DbModels/TimbratureExplModel.cs +++ b/GPW.CORE.Data/DbModels/TimbratureExplModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.Data; namespace GPW.CORE.Data.DbModels { @@ -76,5 +77,11 @@ namespace GPW.CORE.Data.DbModels /// Temperatura rilevata /// public decimal TempRil { get; set; } + + [NotMapped] + public string UID + { + get => $"{IdxDipendente:000}_{DataLav:yyyyMMdd}"; + } } } diff --git a/GPW.CORE.Data/DbModels/TimbratureModel.cs b/GPW.CORE.Data/DbModels/TimbratureModel.cs index ce48553..a5ea36f 100644 --- a/GPW.CORE.Data/DbModels/TimbratureModel.cs +++ b/GPW.CORE.Data/DbModels/TimbratureModel.cs @@ -20,7 +20,6 @@ namespace GPW.CORE.Data.DbModels /// public bool? Approv { get; set; } - [NotMapped] public string UID { diff --git a/GPW.CORE.Data/Services/GpwDataService.cs b/GPW.CORE.Data/Services/GpwDataService.cs index fb48946..593c5e0 100644 --- a/GPW.CORE.Data/Services/GpwDataService.cs +++ b/GPW.CORE.Data/Services/GpwDataService.cs @@ -1421,7 +1421,11 @@ namespace GPW.CORE.Data.Services } else { - dbResult = dbController.DipendentiGetAll(); + dbResult = dbController + .DipendentiGetAll() + .OrderBy(c => c.Cognome) + .ThenBy(c => c.Nome) + .ToList(); rawData = JsonConvert.SerializeObject(dbResult, JSSettings); await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); } @@ -2484,6 +2488,58 @@ namespace GPW.CORE.Data.Services return dbResult; } + /// + /// Recupera record timbrature explose + consuntivo attivita dipendenti + /// + /// singolo idx oppure 0 = tutti + /// Inizio periodo + /// Fine periodo + /// Mostra inattivi + /// Mostra weekend + /// max consentito in mancanza + /// max consentito in eccesso + /// + public async Task> TeRaExplGetFilt(int IdxDip, DateTime DtFrom, DateTime DtTo, bool ShowIn, bool ShowWE, int MaxErrMin, int MaxErrPlus) + { + string source = "DB"; + // calcolo i tag boolean + string bTags = ""; + bTags += ShowIn ? "1" : "0"; + bTags += ShowWE ? "1" : "0"; + List? dbResult = new List(); + string currKey = $"{rKeyTimb}:TeRa:{IdxDip}:{DtFrom:yyMMdd}:{DtTo:yyMMdd}:B_{bTags}:ME_{MaxErrMin}_{MaxErrPlus}"; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string? rawData = await redisDb.StringGetAsync(currKey); + if (!string.IsNullOrEmpty(rawData)) + { + source = "REDIS"; + var tempResult = JsonConvert.DeserializeObject>(rawData); + if (tempResult == null) + { + dbResult = new List(); + } + else + { + dbResult = tempResult; + } + } + else + { + dbResult = dbController.TeRaExplGetFilt(IdxDip, DtFrom, DtTo, ShowIn, ShowWE, MaxErrMin, MaxErrPlus); + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + } + if (dbResult == null) + { + dbResult = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"TeRaExplGetFilt | {source} in: {ts.TotalMilliseconds} ms"); + return dbResult; + } + public async Task TimbratureUpdate(TimbratureModel currItem) { bool answ = false; diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index a942846..ea17e7f 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 4.1.2409.1309

+

Versione: 4.1.2409.1315


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index abd00f8..ef878d8 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -4.1.2409.1309 +4.1.2409.1315 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 77ba0de..a177a82 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 4.1.2409.1309 + 4.1.2409.1315 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false