194 lines
5.2 KiB
C#
194 lines
5.2 KiB
C#
using EgwCoreLib.Lux.Data.DbModel.Items;
|
|
using Microsoft.EntityFrameworkCore;
|
|
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;
|
|
|
|
namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
|
{
|
|
// <Auto-Generated>
|
|
// This is here so CodeMaid doesn't reorganize this document
|
|
// </Auto-Generated>
|
|
|
|
[Table("sales_offer_row")]
|
|
public class OfferRowModel
|
|
{
|
|
/// <summary>
|
|
/// ID del record
|
|
/// </summary>
|
|
[Key]
|
|
public int OfferRowID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Riferimento offerta
|
|
/// </summary>
|
|
public int OfferID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Riga Offerta (per ordinamento)
|
|
/// </summary>
|
|
public int RowNum { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Campo salvato dell'Environment
|
|
/// </summary>
|
|
public string Environment { get; set; } = "WINDOW";
|
|
|
|
/// <summary>
|
|
/// Campo salvato dell'UID da codice DataMatrix calcolato
|
|
/// </summary>
|
|
public string OfferRowUID { get; set; } = "OFF00001230AZ";
|
|
|
|
/// <summary>
|
|
/// Codice calcolato offerta ANNO.ID_RIGA_OFFERTA (0...Z come Dtx)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string OfferRowDtx
|
|
{
|
|
get => $"OFF{Inserted:yy}{OfferRowID:000000000}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// ID dell'articolo di vendita offerto
|
|
/// </summary>
|
|
public int SellingItemID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Quantità della risorsa
|
|
/// </summary>
|
|
public double Qty { get; set; } = 1;
|
|
|
|
/// <summary>
|
|
/// Costo dei componeti BOM (RockBottom)
|
|
/// </summary>
|
|
public double BomCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Prezzo dei componeti BOM (scontabile)
|
|
/// </summary>
|
|
public double BomPrice { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
/// Costo produzione Fase/Step (RockBottom)
|
|
/// </summary>
|
|
public double StepCost { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Prezzo produzione Fase/Step (scontabile)
|
|
/// </summary>
|
|
public double StepPrice { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Costo Totale Risorsa (BOM + Fase)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double UnitCost
|
|
{
|
|
get => BomCost + StepCost;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costo Totale Risorsa (BOM + Fase)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double UnitPrice
|
|
{
|
|
get => BomPrice + StepPrice;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sconto massimo applicabile
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double MaxDiscount
|
|
{
|
|
get => (UnitCost > 0 && UnitPrice > UnitCost) ? (UnitPrice - UnitCost) / UnitPrice : 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costo Totale risorsa
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double TotalCost
|
|
{
|
|
get => UnitCost * Qty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costo Totale risorsa
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double TotalPrice
|
|
{
|
|
get => UnitPrice * Qty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Valore serializzato della composizione articolo (in formato JWD x finestra)
|
|
/// </summary>
|
|
public string SerStruct { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Elenco StepDTO (Fasi) per la stima tempi / costi
|
|
/// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
|
|
/// </summary>
|
|
public string ItemSteps { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// BOM serializzata per la produzione dell'item
|
|
/// </summary>
|
|
public string ItemBOM { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti)
|
|
/// </summary>
|
|
public bool BomOk { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Validazione livello item per Costo e range dimensione
|
|
/// </summary>
|
|
public bool ItemOk { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Note libere
|
|
/// </summary>
|
|
public string Note { get; set; } = "";
|
|
|
|
#if false
|
|
/// <summary>
|
|
/// Stack degli ultimi item serializzati per Uno/Redo actions
|
|
/// </summary>
|
|
[NotMapped]
|
|
public List<string> UndoRedoSerStruct { get; set; } = new List<string>();
|
|
#endif
|
|
|
|
|
|
/// <summary>
|
|
/// DataOra inserimento
|
|
/// </summary>
|
|
public DateTime Inserted { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// DataOra ultima modifica
|
|
/// </summary>
|
|
public DateTime Modified { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// Navigazione Offer
|
|
/// </summary>
|
|
[ForeignKey("OfferID")]
|
|
public virtual OfferModel OfferNav { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Navigazione Item
|
|
/// </summary>
|
|
[ForeignKey("SellingItemID")]
|
|
public virtual SellingItemModel SellingItemNav { get; set; } = null!;
|
|
}
|
|
}
|