Files
raven/server/AyaNova/models/PurchaseOrder.cs
2022-12-13 22:49:47 +00:00

222 lines
7.3 KiB
C#

using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations.Schema;
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 PurchaseOrder : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public long Serial { get; set; }//WAS PO NUMBER
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public string VendorMemo { get; set; }
public long? DropShipToCustomerId { get; set; }
[NotMapped]
public string DropShipToCustomerViz { get; set; }
public string ReferenceNumber { get; set; }
public long VendorId { get; set; }
[NotMapped]
public string VendorViz { get; set; }
public DateTime? OrderedDate { get; set; }
public DateTime? ExpectedReceiveDate { get; set; }
public PurchaseOrderStatus Status { get; set; }
[NotMapped]
public string StatusViz { get; set; }
public long? ProjectId { get; set; }
[NotMapped]
public string ProjectViz { get; set; }
public string Text1 { get; set; }//was in poreceipt in v7
public string Text2 { get; set; }//was in poreceipt in v7
public List<PurchaseOrderItem> Items { get; set; } = new List<PurchaseOrderItem>();
//VIZ FIELDS
//POSTAL ADDRESS
[NotMapped]
public string DropShipToCustomerPostAddressViz { get; set; }
[NotMapped]
public string DropShipToCustomerPostCityViz { get; set; }
[NotMapped]
public string DropShipToCustomerPostRegionViz { get; set; }
[NotMapped]
public string DropShipToCustomerPostCountryViz { get; set; }
[NotMapped]
public string DropShipToCustomerPostCodeViz { get; set; }
//PHYSICAL ADDRESS
[NotMapped]
public string DropShipToCustomerAddressViz { get; set; }
[NotMapped]
public string DropShipToCustomerCityViz { get; set; }
[NotMapped]
public string DropShipToCustomerRegionViz { get; set; }
[NotMapped]
public string DropShipToCustomerCountryViz { get; set; }
[NotMapped]
public string DropShipToCustomerAddressPostalViz { get; set; }
[NotMapped]
public decimal? DropShipToCustomerLatitudeViz { get; set; }
[NotMapped]
public decimal? DropShipToCustomerLongitudeViz { get; set; }
[NotMapped]
public string DropShipToCustomerPhone1Viz { get; set; }
[NotMapped]
public string DropShipToCustomerPhone2Viz { get; set; }
[NotMapped]
public string DropShipToCustomerPhone3Viz { get; set; }
[NotMapped]
public string DropShipToCustomerPhone4Viz { get; set; }
[NotMapped]
public string DropShipToCustomerPhone5Viz { get; set; }
[NotMapped]
public string DropShipToCustomerEmailAddressViz { get; set; }
//POSTAL ADDRESS
[NotMapped]
public string VendorPostAddressViz { get; set; }
[NotMapped]
public string VendorPostCityViz { get; set; }
[NotMapped]
public string VendorPostRegionViz { get; set; }
[NotMapped]
public string VendorPostCountryViz { get; set; }
[NotMapped]
public string VendorPostCodeViz { get; set; }
//PHYSICAL ADDRESS
[NotMapped]
public string VendorAddressViz { get; set; }
[NotMapped]
public string VendorCityViz { get; set; }
[NotMapped]
public string VendorRegionViz { get; set; }
[NotMapped]
public string VendorCountryViz { get; set; }
[NotMapped]
public string VendorAddressPostalViz { get; set; }
[NotMapped]
public decimal? VendorLatitudeViz { get; set; }
[NotMapped]
public decimal? VendorLongitudeViz { get; set; }
[NotMapped]
public string VendorContactViz { get; set; }
[NotMapped]
public string VendorContactNotesViz { get; set; }
[NotMapped]
public string VendorPhone1Viz { get; set; }
[NotMapped]
public string VendorPhone2Viz { get; set; }
[NotMapped]
public string VendorPhone3Viz { get; set; }
[NotMapped]
public string VendorPhone4Viz { get; set; }
[NotMapped]
public string VendorPhone5Viz { get; set; }
[NotMapped]
public string VendorEmailAddressViz { get; set; }
[NotMapped]
public string VendorAlertNotesViz { get; set; }
[NotMapped]
public string VendorAccountNumberViz { get; set; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name { get; set; }
public PurchaseOrder()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PurchaseOrder; }
[NotMapped]
public bool HasSelectableWarehouses { get; set; }
[NotMapped]
public bool HasPartRequest { get; set; }
[NotMapped]
public bool HasTaxes { get; set; }
[NotMapped]
public bool HasReceipt { get; set; }
[NotMapped]
public bool HasVendorNumber { get; set; }
[NotMapped]
public bool HasUnreceived { get; set; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[APURCHASEORDER](
[AID] [uniqueidentifier] NOT NULL,
[AVENDORMEMO] [nvarchar](255) NULL,
[ADROPSHIPTOCLIENTID] [uniqueidentifier] NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[APONUMBER] [int] IDENTITY(1,1) NOT NULL,
[AREFERENCENUMBER] [nvarchar](255) NULL,
[AVENDORID] [uniqueidentifier] NOT NULL,
[AORDEREDDATE] [datetime] NULL,
[AEXPECTEDRECEIVEDATE] [datetime] NULL,
[ANOTES] [ntext] NULL,
[ASTATUS] [smallint] NOT NULL, <---Allow 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,
[APROJECTID] [uniqueidentifier] NULL,
CREATE TABLE [dbo].[APURCHASEORDERRECEIPT](<---- DROP
[AID] [uniqueidentifier] NOT NULL,<---- DROP
[ACREATED] [datetime] NOT NULL,<---- DROP
[AMODIFIED] [datetime] NOT NULL,<---- DROP
[ACREATOR] [uniqueidentifier] NOT NULL,<---- DROP
[AMODIFIER] [uniqueidentifier] NOT NULL,<---- DROP
[ARECEIVEDDATE] [datetime] NOT NULL, <---- DROP BUT MIGRATES INTO LINE ITEM RECEIVE DATE
[AVENDORID] [uniqueidentifier] NOT NULL, <---- DROP
[ATEXT1] [nvarchar](255) NULL, <----KEEP MOVE INTO PO HEADER
[ATEXT2] [nvarchar](255) NULL, <----KEEP MOVE INTO PO HEADER
*/