f3d7d49e87
- Fix gestione spostamento inizio/fine anno su sel week
160 lines
3.6 KiB
C#
160 lines
3.6 KiB
C#
using GPW.CORE.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace GPW.CORE.WRKLOG.Components.Compo
|
|
{
|
|
public partial class WeekStat
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public CORE.Data.DTO.WeekStatDTO? currData { get; set; }
|
|
|
|
[Parameter]
|
|
public int WeekSel { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public EventCallback<WeekData> weekSelected { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Classes
|
|
|
|
public class WeekArg
|
|
{
|
|
#region Public Properties
|
|
|
|
public int Week { get; set; }
|
|
public int Year { get; set; }
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
#endregion Public Classes
|
|
|
|
#region Protected Properties
|
|
|
|
protected int currWeekNum
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (currData != null)
|
|
{
|
|
answ = currData.WeekNumber;
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected int currYearNum
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (currData != null)
|
|
{
|
|
if (currData.Fine.Month == 1)
|
|
{
|
|
answ = currData.Fine.Year;
|
|
}
|
|
else
|
|
{
|
|
answ = currData.Anno;
|
|
}
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected double denom
|
|
{
|
|
get
|
|
{
|
|
double answ = 40;
|
|
if (currData != null)
|
|
{
|
|
// cerco massimo tra ore lav e commesse...
|
|
if (currData.SumOreLav > answ)
|
|
{
|
|
answ = currData.SumOreLav;
|
|
}
|
|
|
|
if (currData.SumOreComm > answ)
|
|
{
|
|
answ = currData.SumOreComm;
|
|
}
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected string selStyle
|
|
{
|
|
get
|
|
{
|
|
string currCss = "bg-secondary";
|
|
if (currData != null)
|
|
{
|
|
currCss = currData.WeekNumber == WeekSel ? "bg-primary" : "bg-secondary";
|
|
}
|
|
|
|
return currCss;
|
|
}
|
|
}
|
|
|
|
protected string styleCom
|
|
{
|
|
get
|
|
{
|
|
double valPerc = 0;
|
|
if (currData != null)
|
|
{
|
|
try
|
|
{
|
|
valPerc = currData.SumOreComm / denom;
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
return $"width: {valPerc:P0};";
|
|
}
|
|
}
|
|
|
|
protected string styleLav
|
|
{
|
|
get
|
|
{
|
|
double valPerc = 0;
|
|
if (currData != null)
|
|
{
|
|
try
|
|
{
|
|
valPerc = currData.SumOreLav / denom;
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
return $"width: {valPerc:P0};";
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void reportSelect()
|
|
{
|
|
weekSelected.InvokeAsync(new WeekData(currYearNum, currWeekNum));
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |