Files
raven/server/AyaNova/models/QuoteItemPart.cs

94 lines
4.2 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
namespace AyaNova.Models
{
public class QuoteItemPart : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public string Description { get; set; }
public string Serials { get; set; }
[Required]
public long PartId { get; set; }
[NotMapped]
public string PartDescriptionViz { get; set; }
[NotMapped]
public string PartNameViz { get; set; }
[NotMapped]
public string UpcViz { get; set; }
[Required]
public long PartWarehouseId { get; set; }
[NotMapped]
public string PartWarehouseViz { get; set; }
[Required]
public decimal Quantity { get; set; }
public long? TaxPartSaleId { get; set; }
[NotMapped]
public string TaxCodeViz { get; set; }
//NOTE: part prices are volatile and expected to be frequently edited so snapshotted when newly added unlike other things like rates etc that are protected from change
public decimal Cost { get; set; }//cost from source record (e.g. serviceRate) or zero if no cost entered
public decimal ListPrice { get; set; }//List price from source record (e.g. serviceRate) or zero if no cost entered
//Standard pricing fields (mostly to support printed reports though some show in UI)
//some not to be sent with record depending on role (i.e. cost and charge in some cases)
public decimal? PriceOverride { get; set; }//user entered manually overridden price, if null then ignored in calcs otherwise this *is* the price even if zero
[NotMapped]
public string UnitOfMeasureViz { get; set; }//"each", "hour" etc
[NotMapped]
public decimal PriceViz { get; set; }//per unit price used in calcs after discounts or manual price if non-null or just ListPrice if no discount or manual override
[NotMapped]
public decimal NetViz { get; set; }//quantity * price (before taxes line total essentially)
[NotMapped]
public decimal TaxAViz { get; set; }//total amount of taxA
[NotMapped]
public decimal TaxBViz { get; set; }//total amount of taxB
[NotMapped]
public decimal LineTotalViz { get; set; }//line total netViz + taxes
//workaround for notification
[NotMapped, JsonIgnore]
public List<string> Tags { get; set; } = new List<string>();
[NotMapped, JsonIgnore]
public string Name { get; set; }
[Required]
public long QuoteItemId { get; set; }
[JsonIgnore]
public QuoteItem QuoteItem { get; set; }
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.QuoteItemPart; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AQuoteITEMPART](
[AID] [uniqueidentifier] NOT NULL,
[AQuoteITEMID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[APARTSERIALID] [uniqueidentifier] NULL,//DROP REPLACE WITH SERIALS text field same as whatever is done with POITEM
[APARTID] [uniqueidentifier] NULL,
[AQUANTITY] [decimal](19, 5) NULL,//CHANGE TO NOT NULL DEFAULT 0
[ACOST] [decimal](19, 5) NULL,
[APRICE] [decimal](19, 5) NULL,
[ADISCOUNT] [decimal](19, 5) NULL,
[ADISCOUNTTYPE] [smallint] NULL,//DROP WAS NEVER USED IN V7
[APARTWAREHOUSEID] [uniqueidentifier] NULL,
[ADESCRIPTION] [nvarchar](255) NULL,
[AUSED] [bit] NOT NULL,//DROP True = Part has been consumed False = Part is only "suggested", not actually consumed yet (used with quantityreserved)
[AHASAFFECTEDINVENTORY] [bit] NOT NULL,//DROP, now every save will affect inventory immediately
[ATAXPARTSALEID] [uniqueidentifier] NULL,
[AQUANTITYRESERVED] [decimal](19, 5) NULL //DROP, case 3789 due to immediately affecting inventory changes before would reserve separately, now will remove from inventory immediately or generate a request if insufficient
*/