150 lines
4.8 KiB
C#
150 lines
4.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
// <Auto-Generated>
|
|
// This is here so CodeMaid doesn't reorganize this document
|
|
// </Auto-Generated>
|
|
namespace EgwCoreLib.Lux.Data.DbModel.Cost
|
|
{
|
|
/// <summary>
|
|
/// Risorsa / Centro di Costo, con costi / Hourly
|
|
/// </summary>
|
|
[Table("cost_resource")]
|
|
public class ResourceModel
|
|
{
|
|
/// <summary>
|
|
/// ID del record
|
|
/// </summary>
|
|
[Key]
|
|
public int ResourceID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Nome/Descrizione
|
|
/// </summary>
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// ID del driver di costo impiegato, tipicamente 1 = WorkHour
|
|
/// </summary>
|
|
public int CostDriverID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Valore di riferimento del CostDriver per il calcolo dell'importo unitario della risorsa
|
|
/// Se è basato su WorkHour diventa il budget annuale della risorsa disponibile
|
|
/// Tipicamente le Ore di impiego a buget risorsa, es 220gg x 8h
|
|
/// </summary>
|
|
public decimal CostDriverBudget { get; set; } = 1;
|
|
|
|
/// <summary>
|
|
/// Costo totale (rif al CostDriverBudget) componente FIXED (macchinari) della risorsa (ove applicabile), comprendendo
|
|
/// - ammortamenti
|
|
/// - costi di manutenzione ordinaria
|
|
/// - costi di manutenzione straordinaria (se stimabili, in periodo post ammortamento)
|
|
/// </summary>
|
|
public decimal FixedCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Costo totale (rif al CostDriverBudget) componente variabile (tipicamente Energia)
|
|
/// nb: stima basata sul (costo medio energia aziendale) * consumo effettivo (se disponibile), altrimenti (stima potenza media impiegata) * (ore di impiego stimate)
|
|
/// </summary>
|
|
public decimal VariableCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Costo della componente HR sulla gestione impianto (rif al CostDriverBudget)
|
|
/// </summary>
|
|
public decimal LaborCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Costi di OverHead (rif al CostDriverBudget) da ribaltare su risorsa (tipicamente struttura)
|
|
/// </summary>
|
|
public decimal OverHeadCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Costo di overhead (come % on top del resto)
|
|
/// </summary>
|
|
public decimal OverHeadPerc { get; set; } = 0.15M;
|
|
|
|
/// <summary>
|
|
/// EBT ovvero marginalità minima garantita on top del resto dei costi e OH
|
|
/// </summary>
|
|
public decimal EBTPerc { get; set; } = 0.1M;
|
|
|
|
/// <summary>
|
|
/// Margine sul prezzo ovvero valore da potersi eventualmente scontare
|
|
/// </summary>
|
|
public decimal PriceMargin { get; set; } = 0.2M;
|
|
|
|
/// <summary>
|
|
/// Costo Netto la risorsa su base CostDriver
|
|
/// </summary>
|
|
|
|
[NotMapped]
|
|
private decimal BaseNetCost
|
|
{
|
|
get => CostDriverBudget == 0 ? 0 : (FixedCost + VariableCost + OverHeadCost) / CostDriverBudget;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costo RockBottom Risorsa su base CostDriver
|
|
/// </summary>
|
|
[NotMapped]
|
|
public decimal BaseRockBottomCost
|
|
{
|
|
get => BaseNetCost * (1 + OverHeadPerc) * (1 + EBTPerc);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prezzo comprensivo di margine di ricarico massimo scontabile (sul RockBottom)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public decimal BasePrice
|
|
{
|
|
get => BaseRockBottomCost * (1 + PriceMargin);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Navigazione Driver costo
|
|
/// </summary>
|
|
[ForeignKey("CostDriverID")]
|
|
public virtual CostDriverModel DriverNav { get; set; } = null!;
|
|
#if false
|
|
/// <summary>
|
|
/// Indica gli asset/cespiti
|
|
/// </summary>
|
|
public bool IsAsset { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Indica che è un operatore umano
|
|
/// </summary>
|
|
public bool IsHuman { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Costo fisso risorsa per UM tipo ammortamento
|
|
/// </summary>
|
|
public double UnitCostFix { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Unità di misura della risorsa tipo fisso/ammortamento
|
|
/// </summary>
|
|
public string UmFix { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Costo unitario risorsa per UM tipo consumabili
|
|
/// </summary>
|
|
public double UnitCostProp { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Unità di misura della risorsa
|
|
/// </summary>
|
|
public string UmProp { get; set; } = string.Empty;
|
|
#endif
|
|
|
|
}
|
|
}
|