using EgwCoreLib.Lux.Data.DbModel.Items; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; // // This is here so CodeMaid doesn't reorganize this document // namespace EgwCoreLib.Lux.Data.DbModel.Sales { [Table("sales_offer_row")] public class OfferRowModel { /// /// ID del record /// [Key] public int OfferRowID { get; set; } /// /// Riferimento offerta /// public int OfferID { get; set; } /// /// Riga Offerta (per ordinamento) /// public int RowNum { get; set; } = 0; /// /// Environment della richiesta /// public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; /// /// Campo salvato dell'UID da codice DataMatrix calcolato /// inizia per SOR = SalesOfferRow /// public string OfferRowUID { get; set; } = "SOR.25.0123ABCD"; /// /// Codice calcolato offerta ANNO.ID_RIGA_OFFERTA in HEX (0xFFFFFFFF) /// [NotMapped] public string OfferRowDtx { get => $"SOR.{Inserted:yy}.{OfferRowID:X8}"; } /// /// ID dell'articolo di vendita offerto /// public int SellingItemID { get; set; } /// /// Quantità della risorsa /// public double Qty { get; set; } = 1; /// /// Costo dei componeti BOM (RockBottom) /// public double BomCost { get; set; } = 0; /// /// Prezzo dei componeti BOM (scontabile) /// public double BomPrice { get; set; } = 0; /// /// Costo produzione Fase/Step (RockBottom) /// public double StepCost { get; set; } = 0; /// /// Prezzo produzione Fase/Step (scontabile) /// public double StepPrice { get; set; } = 0; /// /// Costo Totale Risorsa (BOM + Fase) /// [NotMapped] public double UnitCost { get => BomCost + StepCost; } /// /// Costo Totale Risorsa (BOM + Fase) /// [NotMapped] public double UnitPrice { get => BomPrice + StepPrice; } /// /// Sconto massimo applicabile /// [NotMapped] public double MaxDiscount { get => (UnitCost > 0 && UnitPrice > UnitCost) ? (UnitPrice - UnitCost) / UnitPrice : 0; } /// /// Costo Totale risorsa /// [NotMapped] public double TotalCost { get => UnitCost * Qty; } /// /// Costo Totale risorsa /// [NotMapped] public double TotalPrice { get => UnitPrice * Qty; } /// /// Valore serializzato della composizione articolo (in formato JWD x finestra) /// public string SerStruct { get; set; } = ""; /// /// Nomi risorsa file associato alla riga offerta (es per BTL) /// URI come risorsa dentro folder offerta/riga-offerta/guid /// public string FileResource { get; set; } = ""; /// /// Nomi file originale associato alla riga offerta (es per BTL) /// public string FileName { get; set; } = ""; /// /// Dimensione del file (per visualizzazione rapida) /// public long FileSize { get; set; } = 0; /// /// Elenco StepDTO (Fasi) per la stima tempi / costi /// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali /// public string ItemSteps { get; set; } = ""; /// /// BOM serializzata per la produzione dell'item /// public string ItemBOM { get; set; } = ""; /// /// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti) /// public bool BomOk { get; set; } = false; /// /// Validazione livello item per Costo e range dimensione /// public bool ItemOk { get; set; } = false; /// /// Note libere /// public string Note { get; set; } = ""; #if false /// /// Stack degli ultimi item serializzati per Uno/Redo actions /// [NotMapped] public List UndoRedoSerStruct { get; set; } = new List(); #endif /// /// DataOra inserimento /// public DateTime Inserted { get; set; } = DateTime.Now; /// /// DataOra ultima modifica /// public DateTime Modified { get; set; } = DateTime.Now; /// /// Indica che è in attesa aggiornamento BOM /// public bool AwaitBom { get; set; } = false; /// /// Indica che è in attesa aggiornamento Price /// public bool AwaitPrice { get; set; } = false; /// /// Navigazione Offer /// [ForeignKey("OfferID")] public virtual OfferModel OfferNav { get; set; } = null!; /// /// Navigazione Item /// [ForeignKey("SellingItemID")] public virtual SellingItemModel SellingItemNav { get; set; } = null!; } }