Quote models created

This commit is contained in:
2021-07-23 22:09:58 +00:00
parent cac7d4f47d
commit 83618d6559
9 changed files with 452 additions and 14 deletions

View File

@@ -54,9 +54,9 @@ namespace AyaNova.Biz
[CoreBizObject]
PMItem = 22,
[CoreBizObject]
unused23 = 23,
QuoteItemExpense = 23,
[CoreBizObject]
unused24 = 24,
QuoteItemLabor = 24,
[CoreBizObject]
Project = 25,
[CoreBizObject]
@@ -66,9 +66,9 @@ namespace AyaNova.Biz
[CoreBizObject]
QuoteItem = 28,
[CoreBizObject]
unused29 = 29,
QuoteItemLoan = 29,
[CoreBizObject]
unused30 = 30,
QuoteItemPart = 30,
[CoreBizObject]
Unit = 31,
[CoreBizObject]
@@ -100,9 +100,9 @@ namespace AyaNova.Biz
WorkOrderItemUnit = 44,
//---
[CoreBizObject]
unused45 = 45,
QuoteItemScheduledUser = 45,
[CoreBizObject]
unused46 = 46,
QuoteItemTask = 46,
GlobalOps = 47,//really only used for rights, not an object type of any kind
BizMetrics = 48,//deprecate? Not used for anything as of nov 2020
Backup = 49,
@@ -113,7 +113,7 @@ namespace AyaNova.Biz
UnitMeterReading = 53,
[CoreBizObject]
CustomerServiceRequest = 54,
// ServiceBank = 55,
// ServiceBank = 55,
OpsNotificationSettings = 56,
Report = 57,
DashboardView = 58,
@@ -140,8 +140,14 @@ namespace AyaNova.Biz
WorkOrderStatus = 71,
TaskGroup = 72,
WorkOrderItemOutsideService = 73,
WorkOrderItemPriority=74,
WorkOrderItemStatus=75
WorkOrderItemPriority = 74,
WorkOrderItemStatus = 75,
[CoreBizObject]
QuoteItemTravel = 76,
[CoreBizObject]
QuoteItemUnit = 77,
QuoteStatus = 78,
QuoteItemOutsideService = 79

View File

@@ -103,8 +103,7 @@ namespace AyaNova.Models
public virtual DbSet<QuoteItemUnit> QuoteItemUnit { get; set; }
public virtual DbSet<QuoteItemOutsideService> QuoteItemOutsideService { get; set; }
public virtual DbSet<QuoteStatus> QuoteStatus { get; set; }
public virtual DbSet<QuoteItemPriority> QuoteItemPriority { get; set; }
public virtual DbSet<QuoteItemStatus> QuoteItemStatus { get; set; }

View File

@@ -72,8 +72,8 @@ namespace AyaNova.Models
public decimal? Latitude { get; set; }
public decimal? Longitude { get; set; }
public List<WorkOrderItem> Items { get; set; } = new List<WorkOrderItem>();
public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();
public List<QuoteItem> Items { get; set; } = new List<QuoteItem>();
public List<QuoteState> States { get; set; } = new List<QuoteState>();
//UTILITY FIELDS
@@ -107,7 +107,7 @@ namespace AyaNova.Models
public bool UserCanViewLoanerCosts { get; set; }
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.WorkOrder; }
public AyaType AyaType { get => AyaType.Quote; }
//workaround for notification
[NotMapped, JsonIgnore]

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
namespace AyaNova.Models
{
public class QuoteItemOutsideService : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public string Notes { get; set; }
[Required]
public long UnitId { get; set; }
[NotMapped]
public string UnitViz { get; set; }
public long? VendorSentToId { get; set; }
[NotMapped]
public string VendorSentToViz { get; set; }
public long? VendorSentViaId { get; set; }
[NotMapped]
public string VendorSentViaViz { get; set; }
public string RMANumber { get; set; }
public string TrackingNumber { get; set; }
public decimal RepairCost { get; set; }
public decimal RepairPrice { get; set; }
public decimal ShippingCost { get; set; }
public decimal ShippingPrice { get; set; }
public DateTime? SentDate { get; set; }
public DateTime? ETADate { get; set; }
public DateTime? ReturnDate { get; set; }
public long? TaxCodeId { get; set; }
[NotMapped]
public string TaxCodeViz { get; set; }
[NotMapped]
public decimal CostViz { get; set; }//Total cost shipping + repairs
[NotMapped]
public decimal PriceViz { get; set; }//Total price shipping + repairs
[NotMapped]
public decimal NetViz { get; set; }//=priceViz for standardization not because it's necessary (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.QuoteItemOutsideService; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AQuoteITEMOUTSIDESERVICE](
[AID] [uniqueidentifier] NOT NULL,
[AQuoteITEMID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ANOTES] [ntext] NULL,
[AVENDORSENTTOID] [uniqueidentifier] NULL,
[AVENDORSENTVIAID] [uniqueidentifier] NULL,
[ARMANUMBER] [nvarchar](255) NULL,
[ATRACKINGNUMBER] [nvarchar](255) NULL,
[AREPAIRCOST] [decimal](19, 5) NULL,
[AREPAIRPRICE] [decimal](19, 5) NULL,
[ASHIPPINGCOST] [decimal](19, 5) NULL,
[ASHIPPINGPRICE] [decimal](19, 5) NULL,
[ADATESENT] [datetime] NULL,
[ASENDERUSERID] [uniqueidentifier] NULL,
[ADATEETA] [datetime] NULL,
[ADATERETURNED] [datetime] NUL
*/

View File

@@ -0,0 +1,57 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
using System.Collections.Generic;
namespace AyaNova.Models
{
public class QuoteItemTask : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
//public int DisplayOrder { get; set; } = 0;
public int Sequence { get; set; }
[Required]
public string Task { get; set; }
[Required]
public WorkorderItemTaskCompletionType Status { get; set; } = WorkorderItemTaskCompletionType.Incomplete;
[NotMapped]
public string StatusViz { get; set; }
public long? CompletedByUserId { get; set; }
[NotMapped]
public string CompletedByUserViz { get; set; }
public DateTime? CompletedDate { get; set; }
//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.QuoteItemTask; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AQuoteITEMTASK](
[AID] [uniqueidentifier] NOT NULL,
[AQuoteITEMID] [uniqueidentifier] NOT NULL,
[ATASKID] [uniqueidentifier] NOT NULL,//drop, feeds now, Task it linked to is literally just a single string "Name" so this is an easy decision
[ATASKGROUPID] [uniqueidentifier] NOT NULL,//drop feeds now
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AQuoteITEMTASKCMPLTNTYPE] [smallint] NOT NULL//rename to Status
*/

View File

@@ -0,0 +1,88 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
using System.Collections.Generic;
namespace AyaNova.Models
{
public class QuoteItemTravel : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public long? UserId { get; set; }
[NotMapped]
public string UserViz { get; set; }
public DateTime? TravelStartDate { get; set; }
public DateTime? TravelStopDate { get; set; }
public long? TravelRateId { get; set; }
[NotMapped]
public string TravelRateViz { get; set; }
public string TravelDetails { get; set; }
public decimal TravelRateQuantity { get; set; }
public decimal NoChargeQuantity { get; set; }
//public long? ServiceBankId { get; set; }
public long? TaxCodeSaleId { get; set; }
[NotMapped]
public string TaxCodeViz { get; set; }
public decimal Distance { get; set; }
//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 decimal CostViz { get; set; }//cost from source record (e.g. serviceRate) or zero if no cost entered
[NotMapped]
public decimal ListPriceViz { get; set; }//List price from source record (e.g. serviceRate) or zero if no cost entered
[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.QuoteItemTravel; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AQuoteITEMTRAVEL](
[AID] [uniqueidentifier] NOT NULL,
[AQuoteITEMID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ANOTES] [ntext] NULL,
[AUSERID] [uniqueidentifier] NULL,
[ATRAVELSTARTDATE] [datetime] NULL,
[ATRAVELSTOPDATE] [datetime] NULL,
[ATRAVELRATEID] [uniqueidentifier] NULL,
[ATRAVELDETAILS] [nvarchar](255) NULL,
[ATRAVELRATEQUANTITY] [decimal](19, 5) NULL,
[ANOCHARGEQUANTITY] [decimal](19, 5) NULL,
[ADISTANCE] [decimal](19, 5) NULL,
[ATAXRATESALEID] [uniqueidentifier] NULL,
[ASERVICEBANKID] [uniqueidentifier] NULL
*/

View File

@@ -0,0 +1,89 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
namespace AyaNova.Models
{
public class QuoteItemUnit : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; } = new List<string>();
[Required]
public long UnitId { get; set; }
[NotMapped]
public string UnitViz { get; set; }
[Required]
public long QuoteItemId { get; set; }
[JsonIgnore]
public QuoteItem QuoteItem { get; set; }
[NotMapped]
public string UnitModelNameViz { get; set; }
[NotMapped]
public string UnitModelVendorViz { get; set; }
[NotMapped]
public string UnitModelModelNumberViz { get; set; }
[NotMapped]
public string UnitDescriptionViz { get; set; }
//PHYSICAL ADDRESS
[NotMapped]
public string AddressViz { get; set; }
[NotMapped]
public string CityViz { get; set; }
[NotMapped]
public string RegionViz { get; set; }
[NotMapped]
public string CountryViz { get; set; }
[NotMapped]
public decimal? LatitudeViz { get; set; }
[NotMapped]
public decimal? LongitudeViz { get; set; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name { get; set; }
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.QuoteItemUnit; }
}//eoc
}//eons
/*
New object that didnt' exist in v7 except as a singleton referenced inside woitem:
CREATE TABLE [dbo].[AQuoteITEM](
[AID] [uniqueidentifier] NOT NULL,
[AQuoteID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ATECHNOTES] [ntext] NULL,
[AQuoteSTATUSID] [uniqueidentifier] NULL,
[APRIORITYID] [uniqueidentifier] NULL,
[AREQUESTDATE] [datetime] NULL,
[ASUMMARY] [nvarchar](255) NULL,
[ATYPEID] [uniqueidentifier] NULL,
[AUNITID] [uniqueidentifier] NULL,//<--------UNIT
[AQuoteITEMUNITSERVICETYPEID] [uniqueidentifier] NULL,//<--------UNIT//NOW TAGS HMMM
[AWARRANTYSERVICE] [bit] NOT NULL,
[ACUSTOM1] [ntext] NULL,
[ACUSTOM2] [ntext] NULL,
[ACUSTOM3] [ntext] NULL,
[ACUSTOM4] [ntext] NULL,
[ACUSTOM5] [ntext] NULL,
[ACUSTOM6] [ntext] NULL,
[ACUSTOM7] [ntext] NULL,
[ACUSTOM8] [ntext] NULL,
[ACUSTOM9] [ntext] NULL,
[ACUSTOM0] [ntext] NULL,
*/

View File

@@ -0,0 +1,43 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
using System.Collections.Generic;
namespace AyaNova.Models
{
public class QuoteState : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public long QuoteId { get; set; }
[Required]
public long QuoteStatusId { get; set; }
public DateTime Created { get; set; } = DateTime.UtcNow;
[Required]
public long UserId { get; set; }
[NotMapped]
public string UserViz { get; set; }
//workaround for notification
[NotMapped, JsonIgnore]
public List<string> Tags { get; set; } = new List<string>();
[NotMapped, JsonIgnore]
public string Name { get; set; }
//UTILITY FIELDS
//related
// [JsonIgnore]//internal only here at server not used by client
// public QuoteStatus QuoteStatus { get; set; }
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.QuoteStatus; }
}//eoc
}//eons

View File

@@ -0,0 +1,67 @@
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class QuoteStatus
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
/*
Hexadecimal notation: #RGB[A]
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
*/
[MaxLength(12)]
public string Color { get; set; }
public AuthorizationRoles SelectRoles { get; set; }
public AuthorizationRoles RemoveRoles { get; set; }
public bool Completed { get; set; }
public bool Locked { get; set; }
public QuoteStatus()
{
Color = "#ffffff";//white / no color is the default
}
}//eoc
}//eons
/*
[dbo].[AQuoteSTATUS](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NOT NULL,
[ADESCRIPTION] [nvarchar](255) NULL,
[AARGB] [int] NOT NULL
V8: add the following properties:
SelectRoles - who can select the status (still shows if they can't select but that's the current status, like active does)
This is best handled at the client. It prefetches all the status out of the normal picklist process, more like how other things are separately handled now without a picklist
client then knows if a status is available or not and can process to only present available ones
Server can use a biz rule to ensure that it can't be circumvented
UI defaults to any role
DeselectRoles - who can unset this status (important for process control)
UI defaults to any role
CompletedStatus bool - this is a final status indicating all work on the Quote is completed, affects notification etc
UI defaults to false but when set to true auto sets lockQuote to true (but user can just unset lockQuote)
LockQuote - this status is considered read only and the Quote is locked
Just a read only thing, can just change status to "unlock" it
to support states where no one should work on a wo for whatever reason but it's not necessarily completed
e.g. "Hold for inspection", "On hold" generally etc
*/