Ok prima versione costing resources completata
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.Controllers;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Config;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Cost;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Items;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Sales;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Task;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
||||
using EgwMultiEngineManager.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
@@ -12,14 +16,11 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static EgwCoreLib.Lux.Core.Enums;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Items;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Config;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Task;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Cost;
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Services
|
||||
{
|
||||
@@ -1204,7 +1205,7 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
public async Task<bool> ResourcesUpsertAsync(ResourceModel upsRec)
|
||||
{
|
||||
bool result = await dbController.ResourcesUpsertAsync(upsRec);
|
||||
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Resources");
|
||||
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Resources:*");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>0.9.2510.3110</Version>
|
||||
<Version>0.9.2510.3111</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
@using System.Globalization
|
||||
@inherits InputBase<decimal>
|
||||
|
||||
<input type="number"
|
||||
value="@CurrentValueAsString"
|
||||
@onchange="OnChange"
|
||||
step="@Step"
|
||||
min="@Min"
|
||||
max="@Max"
|
||||
class="@CssClass" />
|
||||
|
||||
@code {
|
||||
/// <summary>
|
||||
/// Number of decimal digits to display (default 3).
|
||||
/// </summary>
|
||||
[Parameter] public int Decimals { get; set; } = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Step increment for the number input (default 0.001).
|
||||
/// </summary>
|
||||
[Parameter] public decimal Step { get; set; } = 0.001M;
|
||||
|
||||
/// <summary>
|
||||
/// Optional minimum value.
|
||||
/// </summary>
|
||||
[Parameter] public decimal? Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional maximum value.
|
||||
/// </summary>
|
||||
[Parameter] public decimal? Max { get; set; }
|
||||
|
||||
protected override string FormatValueAsString(decimal value)
|
||||
{
|
||||
return value.ToString($"F{Decimals}", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
protected override bool TryParseValueFromString(
|
||||
string value,
|
||||
out decimal result,
|
||||
out string validationErrorMessage)
|
||||
{
|
||||
if (decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var parsed))
|
||||
{
|
||||
result = Math.Round(parsed, Decimals);
|
||||
validationErrorMessage = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
validationErrorMessage = "Invalid decimal number";
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnChange(ChangeEventArgs e)
|
||||
{
|
||||
CurrentValueAsString = e.Value?.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@inherits InputBase<decimal>
|
||||
|
||||
<input @bind="CurrentValueAsString" class="@CssClass" />
|
||||
|
||||
@code {
|
||||
// Format the bound value as "10%" when rendering
|
||||
protected override string FormatValueAsString(decimal value)
|
||||
{
|
||||
return value == 0 ? string.Empty : $"{value:P2}";
|
||||
}
|
||||
|
||||
// Parse the user's input back into a decimal
|
||||
protected override bool TryParseValueFromString(
|
||||
string value,
|
||||
out decimal result,
|
||||
out string validationErrorMessage)
|
||||
{
|
||||
var cleaned = value?.Replace("%", "").Trim();
|
||||
|
||||
if (decimal.TryParse(cleaned, out var parsed))
|
||||
{
|
||||
// se > 1 --> divido per 100...
|
||||
result = parsed < 1 ? parsed : parsed / 100;
|
||||
validationErrorMessage = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
validationErrorMessage = "Invalid percentage";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<div class="input-group" title="ricerca">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" title="@CurrRecord.DriverNav.Descript">Driver</span>
|
||||
<input placeholder="Qty Driver" @bind="@DriverQty" class="form-control form-control-sm text-end w-auto" type="number" step="0.001" style="width:5rem;" />
|
||||
<span class="input-group-text" title="@CurrRecord.DriverNav.Descript"><b>@CurrRecord.DriverNav.Name</b> (@CurrRecord.DriverNav.Unit)</span>
|
||||
@@ -72,7 +72,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @bind="@DriverBudget" class="form-control form-control-lg text-end w-auto" type="number" step="0.001" style="width:5rem;" />
|
||||
<div class="input-group">
|
||||
<InputDecimal Decimals="3" Step="0.001M" class="form-control form-control-lg text-end w-auto" @bind-Value="@CurrRecord.CostDriverBudget"></InputDecimal>
|
||||
<span class="input-group-text">#</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,7 +89,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.FixedCost:C2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.FixedCost:C2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputDecimal Decimals="3" Step="0.001M" class="form-control form-control-lg text-end w-auto" @bind-Value="@CurrRecord.FixedCost"></InputDecimal>
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -99,7 +112,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.VariableCost:C2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.VariableCost:C2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputDecimal Decimals="3" Step="0.001M" class="form-control form-control-lg text-end w-auto" @bind-Value="@CurrRecord.VariableCost"></InputDecimal>
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -112,7 +135,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.LaborCost:C2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.LaborCost:C2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputDecimal Decimals="3" Step="0.001M" class="form-control form-control-lg text-end w-auto" @bind-Value="@CurrRecord.LaborCost"></InputDecimal>
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -125,7 +158,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.OverHeadCost:C2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.OverHeadCost:C2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputDecimal Decimals="3" Step="0.001M" class="form-control form-control-lg text-end w-auto" @bind-Value="@CurrRecord.OverHeadCost"></InputDecimal>
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -138,7 +181,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.OverHeadPerc:P2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.OverHeadPerc:P2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputPercent class="form-control form-control-lg text-end" @bind-Value="@CurrRecord.OverHeadPerc"></InputPercent>
|
||||
<span class="input-group-text">+</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -151,7 +204,17 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.EBTPerc:P2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.EBTPerc:P2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputPercent class="form-control form-control-lg text-end" @bind-Value="@CurrRecord.EBTPerc"></InputPercent>
|
||||
<span class="input-group-text">+</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -164,16 +227,26 @@
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fs-3">
|
||||
<b>@($"{CurrRecord.PriceMargin:P2}")</b>
|
||||
@if (!isEditing)
|
||||
{
|
||||
<b>@($"{CurrRecord.PriceMargin:P2}")</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<InputPercent class="form-control form-control-lg text-end" @bind-Value="@CurrRecord.PriceMargin"></InputPercent>
|
||||
<span class="input-group-text">+</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@if (isEditing)
|
||||
{
|
||||
{
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<button class="btn btn-lg btn-success" @onclick="DoSave"><i class="fa-solid fa-floppy-disk"></i></button>
|
||||
</li>
|
||||
}
|
||||
<button class="btn btn-lg btn-success w-100" @onclick="DoSave">Save <i class="fa-solid fa-floppy-disk"></i></button>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,6 +33,7 @@ namespace Lux.UI.Components.Compo.JobTask
|
||||
CurrRecord.CostDriverBudget = Math.Round(value, 3);
|
||||
}
|
||||
}
|
||||
|
||||
protected decimal CostCalc
|
||||
{
|
||||
get => DriverQty * CurrRecord.BaseRockBottomCost;
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
@using Lux.UI.Client
|
||||
@using Lux.UI.Components
|
||||
@using Lux.UI.Components.Compo
|
||||
@using Lux.UI.Components.Compo.Base
|
||||
@using Lux.UI.Components.Compo.Config
|
||||
@using Lux.UI.Components.Compo.JobTask
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>0.9.2510.3110</Version>
|
||||
<Version>0.9.2510.3111</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 0.9.2510.3110</h4>
|
||||
<h4>Versione: 0.9.2510.3111</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2510.3110
|
||||
0.9.2510.3111
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2510.3110</version>
|
||||
<version>0.9.2510.3111</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user