95 lines
2.5 KiB
C#
95 lines
2.5 KiB
C#
namespace EgwCoreLib.Lux.Data.DbModel.Catalog
|
|
{
|
|
/// <summary>
|
|
/// Classe dei template di oggetti gestiti
|
|
/// </summary>
|
|
[Table("sales_template")]
|
|
public class TemplateModel
|
|
{
|
|
/// <summary>
|
|
/// ID del record
|
|
/// </summary>
|
|
[Key]
|
|
public int TemplateID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Environment del template
|
|
/// </summary>
|
|
public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
|
|
|
|
|
/// <summary>
|
|
/// SourceType dell'Item
|
|
/// </summary>
|
|
public ItemSourceType SourceType { get; set; } = ItemSourceType.ND;
|
|
|
|
/// <summary>
|
|
/// Denominazione
|
|
/// </summary>
|
|
public string Name { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Descrizione
|
|
/// </summary>
|
|
public string Description { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Numero Item compresi
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double NumItems
|
|
{
|
|
get => TemplateRowNav?.Sum(x => x.Qty) ?? 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Numero ProdItem compresi
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double NumProdItems
|
|
{
|
|
get => TemplateRowNav?.Sum(x => x.ProdItemQtyTot) ?? 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Numero Item compresi
|
|
/// </summary>
|
|
[NotMapped]
|
|
public int NumRows
|
|
{
|
|
get => TemplateRowNav?.Count ?? 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costo totale offerta (rock bottom)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double TotalCost
|
|
{
|
|
get => TemplateRowNav?.Sum(x => x.TotalCost) ?? 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prezzo totale offerta (compreso di amrginalità)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double TotalPrice
|
|
{
|
|
get => TemplateRowNav?.Sum(x => x.TotalPrice) ?? 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sconto massimo applicabile
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double MaxDiscount
|
|
{
|
|
get => (TotalCost > 0 && TotalPrice > TotalCost) ? (TotalPrice - TotalCost) / TotalPrice : 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Navigazione alle righe offerta
|
|
/// </summary>
|
|
public virtual ICollection<TemplateRowModel> TemplateRowNav { get; set; } = new List<TemplateRowModel>();
|
|
}
|
|
} |