Files
raven/server/AyaNova/models/WorkOrderItemLabor.cs
2021-05-11 22:34:49 +00:00

97 lines
3.9 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
namespace AyaNova.Models
{
public class WorkOrderItemLabor : 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; }
public decimal ServiceRateQuantity { get; set; }
public decimal NoChargeQuantity { get; set; }
public long? ServiceBankId { get; set; }
public long? TaxCodeSaleId { get; set; }
/*
//from case 3748
- Cost, this is the entered Cost for the item at time of selection
- ListPrice, [REQUIRED] this is the un-discounted per unit price of the item be it labor, parts, loaner, travel etc. What is normally charged at that moment in time for this item if it wasn't discounted.
- Price, [NULLABLE] this is the EFFECTIVE PRICE either contract determined price calculated from ListPrice, otherwise it's a copy of the list price. User with sufficient rights can can override it to enter a different amount which effectively supports manual discount feature in v7 which was by %. This is the *actual* price used in calculations.
- TaxName copied from selected tax code, not directly editable
- TaxAPct copied from selected tax code, not directly editable
- TaxBPct copied from selected tax code, not directly editable
- TaxOnTax copied from selected tax code not directly editable
- TaxAViz, [calculated NOT persisted] (Price*Quantity)+TaxAPct
- TaxBViz, [calculated NOT persisted] (Price*Quantity)+TaxBPct OR if TaxOnTax = TaxAViz+TaxBPct
- LineTotalViz, [calculated NOT persisted] this is effectively Price * quantity + Taxes, handy for reports and viewing not editable as it's not stored
*/
//PRICE FIELDS
public decimal Cost { get; set; }
public decimal ListPrice { get; set; }
public decimal Price { get; set; }
public string TaxName { get; set; }
[Required]
public decimal TaxAPct { get; set; }
[Required]
public decimal TaxBPct { get; set; }
public bool TaxOnTax { get; set; }
[NotMapped]
public decimal TaxAViz { get; set; }
[NotMapped]
public decimal TaxBViz { get; set; }
[NotMapped]
public decimal LineTotalViz { get; set; }
//UTILITY FIELDS
[NotMapped]
public bool IsDirty { get; set; } = false;//never dirty coming from the server
[Required]
public long WorkOrderItemId { get; set; }
[JsonIgnore]
public WorkOrderItem WorkOrderItem { get; set; }
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.WorkOrderItemLabor; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AWORKORDERITEMLABOR](
[AID] [uniqueidentifier] NOT NULL,
[AWORKORDERITEMID] [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
*/