From d5639972f9fb824799e06d3a64cdefc43ab39958 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 27 Jul 2021 23:23:14 +0000 Subject: [PATCH] --- server/AyaNova/models/PMItem.cs | 64 ++++++++----- server/AyaNova/models/PMItemExpense.cs | 74 +++++++++++++++ server/AyaNova/models/PMItemLabor.cs | 90 ++++++++++++++++++ server/AyaNova/models/PMItemLoan.cs | 87 +++++++++++++++++ server/AyaNova/models/PMItemOutsideService.cs | 89 ++++++++++++++++++ server/AyaNova/models/PMItemPart.cs | 94 +++++++++++++++++++ server/AyaNova/models/PMItemScheduledUser.cs | 52 ++++++++++ server/AyaNova/models/PMItemTask.cs | 57 +++++++++++ server/AyaNova/models/PMItemTravel.cs | 88 +++++++++++++++++ server/AyaNova/models/PMItemUnit.cs | 89 ++++++++++++++++++ 10 files changed, 759 insertions(+), 25 deletions(-) create mode 100644 server/AyaNova/models/PMItemExpense.cs create mode 100644 server/AyaNova/models/PMItemLabor.cs create mode 100644 server/AyaNova/models/PMItemLoan.cs create mode 100644 server/AyaNova/models/PMItemOutsideService.cs create mode 100644 server/AyaNova/models/PMItemPart.cs create mode 100644 server/AyaNova/models/PMItemScheduledUser.cs create mode 100644 server/AyaNova/models/PMItemTask.cs create mode 100644 server/AyaNova/models/PMItemTravel.cs create mode 100644 server/AyaNova/models/PMItemUnit.cs diff --git a/server/AyaNova/models/PMItem.cs b/server/AyaNova/models/PMItem.cs index c47fbdd8..97a8464f 100644 --- a/server/AyaNova/models/PMItem.cs +++ b/server/AyaNova/models/PMItem.cs @@ -1,42 +1,56 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; using AyaNova.Biz; + 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 PMItem : ICoreBizObjectModel { - 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; } - public string Wiki { get; set; } - public string CustomFields { get; set; } - public List Tags { get; set; } - - //Principle - [Required]//this required annotation should cause a cascade delete to happen automatically when wo is deleted, need to test that - public long PMId { get; set; }//fk - public PM PM { get; set; } - - //Dependents - - public PMItem() - { - Tags = new List(); - } - [NotMapped, JsonIgnore] public AyaType AyaType { get => AyaType.PMItem; } + + public long Id { get; set; } + public uint Concurrency { get; set; } + public string Notes { get; set; }//"Summary" field + public string Wiki { get; set; } + public string CustomFields { get; set; } + public List Tags { get; set; } = new List(); + + [Required] + public long PMId { get; set; } + public string TechNotes { get; set; } + public long? WorkOrderItemStatusId { get; set; } + public long? WorkOrderItemPriorityId { get; set; } + public DateTime? RequestDate { get; set; } + public bool WarrantyService { get; set; } = false; + public int Sequence { get; set; } + + //workaround for notification + [NotMapped, JsonIgnore] + public string Name { get; set; } + + //Principle + [JsonIgnore] + public PM PM { get; set; } + //dependents + public List Expenses { get; set; } = new List(); + public List Labors { get; set; } = new List(); + public List Loans { get; set; } = new List(); + public List Parts { get; set; } = new List(); + public List ScheduledUsers { get; set; } = new List(); + public List Tasks { get; set; } = new List(); + public List Travels { get; set; } = new List(); + public List Units { get; set; } = new List(); + public List OutsideServices { get; set; } = new List(); + }//eoc }//eons + + diff --git a/server/AyaNova/models/PMItemExpense.cs b/server/AyaNova/models/PMItemExpense.cs new file mode 100644 index 00000000..c3e4feb4 --- /dev/null +++ b/server/AyaNova/models/PMItemExpense.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Newtonsoft.Json; +using AyaNova.Biz; + +namespace AyaNova.Models +{ + public class PMItemExpense : ICoreBizObjectModel + { + + public long Id { get; set; } + public uint Concurrency { get; set; } + + public string Description { get; set; } + public string Name { get; set; } + [Required] + public decimal TotalCost { get; set; } + [Required] + public decimal ChargeAmount { get; set; } + [Required] + public decimal TaxPaid { get; set; } + public long? ChargeTaxCodeId { get; set; } + [NotMapped] + public string TaxCodeViz { get; set; } + + public bool ReimburseUser { get; set; } = false; + public long? UserId { get; set; } + [NotMapped] + public string UserViz { get; set; } + public bool ChargeToCustomer { get; set; } = false; + + [NotMapped] + public decimal TaxAViz { get; set; } + [NotMapped] + public decimal TaxBViz { get; set; } + [NotMapped] + public decimal LineTotalViz { get; set; } + + + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + //workaround for notification + [NotMapped, JsonIgnore] + public List Tags { get; set; } = new List(); + + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemExpense; } + + }//eoc +}//eons +/* +[dbo].[APMITEMMISCEXPENSE]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [uniqueidentifier] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [ATOTALCOST] [decimal](19, 5) NULL, + [ACHARGEAMOUNT] [decimal](19, 5) NULL, + [ADESCRIPTION] [nvarchar](255) NULL, + [ATAXPAID] [decimal](19, 5) NULL, + [ACHARGETAXCODEID] [uniqueidentifier] NULL, + [ANAME] [nvarchar](255) NULL, + [AREIMBURSEUSER] [bit] NOT NULL, + [AUSERID] [uniqueidentifier] NULL, + [ACHARGETOCLIENT] [bit] NOT NULL, +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemLabor.cs b/server/AyaNova/models/PMItemLabor.cs new file mode 100644 index 00000000..9b18871b --- /dev/null +++ b/server/AyaNova/models/PMItemLabor.cs @@ -0,0 +1,90 @@ +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 PMItemLabor : ICoreBizObjectModel + { + + public long Id { get; set; } + public uint Concurrency { get; set; } + + public long? UserId { get; set; } + [NotMapped] + public string UserViz { get; set; } + public DateTime? ServiceStartDate { get; set; } + public DateTime? ServiceStopDate { get; set; } + public long? ServiceRateId { get; set; } + [NotMapped] + public string ServiceRateViz { get; set; } + public string ServiceDetails { get; set; } + [Required] + public decimal ServiceRateQuantity { get; set; } + [Required] + public decimal NoChargeQuantity { get; set; } + //public long? ServiceBankId { get; set; } + public long? TaxCodeSaleId { get; set; } + [NotMapped] + public string TaxCodeViz { 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 + + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemLabor; } + + //workaround for notification + [NotMapped, JsonIgnore] + public List Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + }//eoc +}//eons + +/* +CREATE TABLE [dbo].[APMITEMLABOR]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [uniqueidentifier] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [AUSERID] [uniqueidentifier] NULL, + [ASERVICESTARTDATE] [datetime] NULL, + [ASERVICESTOPDATE] [datetime] NULL, + [ASERVICERATEID] [uniqueidentifier] NULL, + [ASERVICEDETAILS] [ntext] NULL, + [ASERVICERATEQUANTITY] [decimal](19, 5) NULL, + [ANOCHARGEQUANTITY] [decimal](19, 5) NULL, + [ASERVICEBANKID] [uniqueidentifier] NULL, + [ATAXRATESALEID] [uniqueidentifier] NULL +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemLoan.cs b/server/AyaNova/models/PMItemLoan.cs new file mode 100644 index 00000000..d4850fdc --- /dev/null +++ b/server/AyaNova/models/PMItemLoan.cs @@ -0,0 +1,87 @@ +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 PMItemLoan : ICoreBizObjectModel + { + public long Id { get; set; } + public uint Concurrency { get; set; } + public string Notes { get; set; } + public DateTime? OutDate { get; set; } + public DateTime? DueDate { get; set; } + public DateTime? ReturnDate { get; set; } + // [Required] + // public decimal Charges { get; set; }//removed in favor of ListPRice snapshot which normalizes fields to other objects + public long? TaxCodeId { get; set; } + [NotMapped] + public string TaxCodeViz { get; set; } + [Required] + public long LoanUnitId { get; set; } + [NotMapped] + public string LoanUnitViz { get; set; } + [Required] + public decimal Quantity { get; set; } + [Required] + public LoanUnitRateUnit Rate { get; set; } + + 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 Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemLoan; } + + }//eoc +}//eons +/* +CREATE TABLE [dbo].[APMITEMLOAN]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NULL, + [AMODIFIED] [datetime] NULL, + [ACREATOR] [uniqueidentifier] NULL, + [AMODIFIER] [uniqueidentifier] NULL, + [ANOTES] [ntext] NULL, + [AOUTDATE] [datetime] NULL, + [ADUEDATE] [datetime] NULL, + [ARETURNDATE] [datetime] NULL, + [ACHARGES] [decimal](19, 5) NOT NULL, + [ATAXCODEID] [uniqueidentifier] NULL, + [ALOANITEMID] [uniqueidentifier] NOT NULL, + [AQUANTITY] [decimal](19, 5) NOT NULL, + [ARATE] [smallint] NOT NULL +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemOutsideService.cs b/server/AyaNova/models/PMItemOutsideService.cs new file mode 100644 index 00000000..e8bca974 --- /dev/null +++ b/server/AyaNova/models/PMItemOutsideService.cs @@ -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 PMItemOutsideService : 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 Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemOutsideService; } + + }//eoc +}//eons +/* +CREATE TABLE [dbo].[APMITEMOUTSIDESERVICE]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [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 +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemPart.cs b/server/AyaNova/models/PMItemPart.cs new file mode 100644 index 00000000..1f40df83 --- /dev/null +++ b/server/AyaNova/models/PMItemPart.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Newtonsoft.Json; +using AyaNova.Biz; + +namespace AyaNova.Models +{ + public class PMItemPart : 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 PartViz { 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 Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemPart; } + + }//eoc +}//eons + +/* +CREATE TABLE [dbo].[APMITEMPART]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [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 +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemScheduledUser.cs b/server/AyaNova/models/PMItemScheduledUser.cs new file mode 100644 index 00000000..0de8d086 --- /dev/null +++ b/server/AyaNova/models/PMItemScheduledUser.cs @@ -0,0 +1,52 @@ +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 PMItemScheduledUser : ICoreBizObjectModel + { + public long Id { get; set; } + public uint Concurrency { get; set; } + public long? UserId { get; set; } + [NotMapped] + public string UserViz { get; set; } + public decimal EstimatedQuantity { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? StopDate { get; set; } + public long? ServiceRateId { get; set; } + [NotMapped] + public string ServiceRateViz { get; set; } + + + //workaround for notification + [NotMapped, JsonIgnore] + public List Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemScheduledUser; } + }//eoc +}//eons +/* +CREATE TABLE [dbo].[APMITEMSCHEDULEDUSER]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [uniqueidentifier] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [AUSERID] [uniqueidentifier] NULL, + [AESTIMATEDQUANTITY] [decimal](19, 5) NULL, + [ASTARTDATE] [datetime] NULL, + [ASTOPDATE] [datetime] NULL, + [ASERVICERATEID] [uniqueidentifier] NULL +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemTask.cs b/server/AyaNova/models/PMItemTask.cs new file mode 100644 index 00000000..1bd2015c --- /dev/null +++ b/server/AyaNova/models/PMItemTask.cs @@ -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 PMItemTask : 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 Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemTask; } + + }//eoc +}//eons +/* +CREATE TABLE [dbo].[APMITEMTASK]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [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, + [APMITEMTASKCMPLTNTYPE] [smallint] NOT NULL//rename to Status +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemTravel.cs b/server/AyaNova/models/PMItemTravel.cs new file mode 100644 index 00000000..6f3a51bd --- /dev/null +++ b/server/AyaNova/models/PMItemTravel.cs @@ -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 PMItemTravel : 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 Tags { get; set; } = new List(); + [NotMapped, JsonIgnore] + public string Name { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { get; set; } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.PMItemTravel; } + + }//eoc +}//eons +/* +CREATE TABLE [dbo].[APMITEMTRAVEL]( + [AID] [uniqueidentifier] NOT NULL, + [APMITEMID] [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 +*/ \ No newline at end of file diff --git a/server/AyaNova/models/PMItemUnit.cs b/server/AyaNova/models/PMItemUnit.cs new file mode 100644 index 00000000..9f5639ec --- /dev/null +++ b/server/AyaNova/models/PMItemUnit.cs @@ -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 PMItemUnit : 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 Tags { get; set; } = new List(); + [Required] + public long UnitId { get; set; } + [NotMapped] + public string UnitViz { get; set; } + + [Required] + public long PMItemId { get; set; } + [JsonIgnore] + public PMItem PMItem { 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.PMItemUnit; } + + }//eoc +}//eons +/* +New object that didnt' exist in v7 except as a singleton referenced inside woitem: + +CREATE TABLE [dbo].[APMITEM]( + [AID] [uniqueidentifier] NOT NULL, + [APMID] [uniqueidentifier] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [ATECHNOTES] [ntext] NULL, + [APMSTATUSID] [uniqueidentifier] NULL, + [APRIORITYID] [uniqueidentifier] NULL, + [AREQUESTDATE] [datetime] NULL, + [ASUMMARY] [nvarchar](255) NULL, + [ATYPEID] [uniqueidentifier] NULL, + [AUNITID] [uniqueidentifier] NULL,//<--------UNIT + [APMITEMUNITSERVICETYPEID] [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, +*/ \ No newline at end of file