Files
raven/server/AyaNova/models/PMItemLoan.cs
2021-07-27 23:23:14 +00:00

87 lines
3.4 KiB
C#

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<string> Tags { get; set; } = new List<string>();
[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
*/