1969 lines
69 KiB
C#
1969 lines
69 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
|
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Core;
|
|
using Sarand.Net.Standard.Base.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
|
{
|
|
//=======================================================================
|
|
public abstract class SbmCommodity : SbmHierarchyItem
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Columns.
|
|
public enum Column
|
|
{
|
|
Hidden,
|
|
Pos,
|
|
Id,
|
|
// Commodity.
|
|
Type,
|
|
Type_Code,
|
|
Type_Desc,
|
|
Code,
|
|
DescBrief,
|
|
DescOrder,
|
|
DescDetail,
|
|
DrawingNo,
|
|
DrawingIssue,
|
|
ImagePath,
|
|
Image,
|
|
Category1Code, Category1_Desc,
|
|
Category2Code, Category2_Desc,
|
|
Category3Code, Category3_Desc,
|
|
Location,
|
|
Department,
|
|
CatalogRef,
|
|
// Specification.
|
|
Weight, Weight_UomId, Weight_Unit, Weight_ValueUnits,
|
|
Length, Length_UomId, Length_Unit, Length_ValueUnits,
|
|
Volume, Volume_UomId, Volume_Unit, Volume_ValueUnits,
|
|
Density, Density_UomId, Density_Unit, Density_ValueUnits,
|
|
BoxQuantity, BoxQuantity_UomId, BoxQuantity_Unit, BoxQuantity_ValueUnits,
|
|
Dimensions,
|
|
SpecSummary,
|
|
ICNTariffCode,
|
|
Barcode,
|
|
// Codings with its Desc.
|
|
RangeCode, RangeDesc,
|
|
ColourCode, ColourDesc,
|
|
SourceCode, SourceDesc,
|
|
SupplyMethodCode, SupplyMethodDesc,
|
|
HandlingCode, HandlingDesc,
|
|
DeliveryCode, DeliveryDesc,
|
|
MaterialCode, MaterialDesc,
|
|
FinishCode, FinishDesc,
|
|
PromotionCode, PromotionDesc,
|
|
NominalCode, NominalCodePurchase,
|
|
// Purchasing.
|
|
AssociationIdSupplier, Supplier_Name, Supplier_Ref,
|
|
CostPrice, CostPrice_Fmt,
|
|
PlaceOfOrigin,
|
|
// Material currency amount.
|
|
MaterialCost, MaterialCost_Fmt, MaterialCurrencyId, MaterialCurrency_Code, MaterialCurrency_Symbol,
|
|
// ExWorks currency amount.
|
|
ExWorksCost, ExWorksCost_Fmt, ExWorksCurrencyId, ExWorksCurrency_Code, ExWorksCurrency_Symbol,
|
|
ReorderLevel,
|
|
ReorderQty,
|
|
QtyOnOrder,
|
|
// Sales.
|
|
AssociationIdCustomer, Customer_Name,
|
|
SalesPrice, SalesPrice_Fmt,
|
|
RetailPrice, RetailPrice_Fmt,
|
|
RetailPricePlanned, RetailPricePlanned_Fmt,
|
|
UomIdSale,
|
|
GrossPrice, GrossPrice_Fmt,
|
|
UnitOfSale,
|
|
CarriageCostIndicative, CarriageCostIndicative_Fmt,
|
|
MinOrderQty,
|
|
PackQty, PackQtySale,
|
|
TaxCodeId, TaxCode, TaxRate,
|
|
LastOrderDate,
|
|
LastOrderQty,
|
|
// Customer definition.
|
|
Cust_ProductCode,
|
|
Cust_AmountRetail, Cust_AmountRetail_Fmt,
|
|
Cust_CurrencyIdRetail, Cust_CurrencyIdRetail_Code, Cust_CurrencyIdRetail_Symbol,
|
|
Cust_PromotionCode, Cust_PromotionDesc,
|
|
// Stock.
|
|
QtyInStock,
|
|
QtyAllocated,
|
|
FreeStock,
|
|
// Stock take - held against commodity, eg. imported from Sage.
|
|
StockTakeDate, StockTakeQty, StockTake_Date,
|
|
// Sales budget.
|
|
OrderQtyDecimals,
|
|
CommodityIdSalesProj,
|
|
SalesProj_Annual,
|
|
SalesProjMonthlyProp,
|
|
SalesProjMonth01, SalesProjMonth02, SalesProjMonth03, SalesProjMonth04, SalesProjMonth05, SalesProjMonth06,
|
|
SalesProjMonth07, SalesProjMonth08, SalesProjMonth09, SalesProjMonth10, SalesProjMonth11, SalesProjMonth12,
|
|
SalesProj_Jan, SalesProj_Feb, SalesProj_Mar, SalesProj_Apr, SalesProj_May, SalesProj_Jun,
|
|
SalesProj_Jul, SalesProj_Aug, SalesProj_Sep, SalesProj_Oct, SalesProj_Nov, SalesProj_Dec,
|
|
|
|
SalesProj_Period, // Derived from monthly figures - projected stock during specified period.
|
|
SalesYtdFinancial, // Current year.
|
|
SalesYtdCalendar,
|
|
SalesPyFinancial, // Prior year.
|
|
SalesPyCalendar,
|
|
SalesMonthCurrent,
|
|
SalesMonthPast01, SalesMonthPast02, SalesMonthPast03, SalesMonthPast04, SalesMonthPast05, SalesMonthPast06,
|
|
SalesMonthPast07, SalesMonthPast08, SalesMonthPast09, SalesMonthPast10, SalesMonthPast11, SalesMonthPast12,
|
|
// Quantity of stock sold.
|
|
/// <summary>Completed orders during period defined by parameter dates.</summary>
|
|
StockSold_Period,
|
|
// Stock Levels:
|
|
// Quantity current level at selected or defined location filter.
|
|
Stock_CurrentLevel, Stock_CurrentLevel_Sales, Stock_CurrentLevel_Calc, Stock_CurrentLevel_All,
|
|
Stock_ImminentLevel,
|
|
//Quantity allocated at selected or defined location filter.
|
|
Stock_Allocated, Stock_Allocated_Sales, Stock_Allocated_Calc, Stock_Allocated_All,
|
|
Stock_Available, Stock_Available_MinZero, Stock_Available_Sales, Stock_Available_Sales_MinZero,
|
|
Stock_ImminentAvailable,
|
|
Stock_CurrentVsReorder, Stock_ImminentVsReorder, Stock_AvailVsReorder, Stock_ImminentAvailVsReorder,
|
|
// Stock bays.
|
|
Stock_Bays, Stock_Bay1, Stock_Bay2, Stock_Bay3,
|
|
// Stock date due/
|
|
Stock_NextDue_Date,
|
|
Stock_NextDue_Quantity,
|
|
Stock_NextDue_Commodity_Date, Stock_NextDue_Commodity_Quantity,
|
|
Stock_NextDue_Container_Date, Stock_NextDue_Container_Quantity,
|
|
Stock_Due_Imminently,
|
|
// Stock due in weeks for commodity & container
|
|
Stock_DueIn_Week1, Stock_DueIn_Week2, Stock_DueIn_Week3, Stock_DueIn_Week4,
|
|
Stock_DueIn_Week5, Stock_DueIn_Week6, Stock_DueIn_Week7, Stock_DueIn_Week8,
|
|
Stock_DueIn_Week9, Stock_DueIn_Week10, Stock_DueIn_Week11, Stock_DueIn_Week12,
|
|
//Stock due range of weeks
|
|
Stock_DueIn_Week1To2, Stock_DueIn_Week3To4, Stock_DueIn_Week5To6,
|
|
Stock_DueIn_Week7To8, Stock_DueIn_Week9To10, Stock_DueIn_Week11To12,
|
|
// Stock due week onwards
|
|
Stock_DueIn_Week7On, Stock_DueIn_Week13On,
|
|
// Stock due in by calendar month.
|
|
Stock_DueIn_MonthCurrent,
|
|
Stock_DueIn_Month01, Stock_DueIn_Month02, Stock_DueIn_Month03, Stock_DueIn_Month04,
|
|
Stock_DueIn_Month05, Stock_DueIn_Month06, Stock_DueIn_Month07, Stock_DueIn_Month08,
|
|
Stock_DueIn_Month09, Stock_DueIn_Month10, Stock_DueIn_Month11, Stock_DueIn_Month12,
|
|
// Stock due up to 3+ months
|
|
Stock_DueIn_MonthTo03, Stock_DueIn_MonthTo06, Stock_DueIn_MonthTo09, Stock_DueIn_MonthTo12,
|
|
// Stock due range of months
|
|
Stock_DueIn_Month04To06, Stock_DueIn_Month07To09, Stock_DueIn_Month10To12, Stock_DueIn_Month07To12,
|
|
// Stock due month onwards
|
|
Stock_DueIn_Month04On, Stock_DueIn_Month05On, Stock_DueIn_Month06On, Stock_DueIn_Month07On, Stock_DueIn_Month13On,
|
|
// Stock Provisional due in (via containers).
|
|
Stock_DueIn_Provisional,
|
|
// Stock allocations.
|
|
// Stock allocated by future weeks
|
|
Stock_Allocated_Week1, Stock_Allocated_Week2, Stock_Allocated_Week3To4, Stock_Allocated_Week5To6,
|
|
Stock_Allocated_Week7To8, Stock_Allocated_Week9To10, Stock_Allocated_Week11To12, Stock_Allocated_Week13On,
|
|
// Stock allocated in current month with tis future months.
|
|
Stock_Allocated_MonthCurrent,
|
|
Stock_Allocated_Month01, Stock_Allocated_Month02, Stock_Allocated_Month03, Stock_Allocated_Month04,
|
|
Stock_Allocated_Month05, Stock_Allocated_Month06, Stock_Allocated_Month07, Stock_Allocated_Month08,
|
|
Stock_Allocated_Month09, Stock_Allocated_Month10, Stock_Allocated_Month11, Stock_Allocated_Month12,
|
|
// End of month stock level in future (derived):
|
|
Stock_EndOfMonth_Current, // Stock level at end of current month [derived] with its future months.
|
|
Stock_EndOfMonth_01, Stock_EndOfMonth_02, Stock_EndOfMonth_03, Stock_EndOfMonth_04, Stock_EndOfMonth_05, Stock_EndOfMonth_06,
|
|
Stock_EndOfMonth_07, Stock_EndOfMonth_08, Stock_EndOfMonth_09, Stock_EndOfMonth_10, Stock_EndOfMonth_11, Stock_EndOfMonth_12,
|
|
// Requirements.
|
|
/// <summary>Earliest item price irrespective of status, by commodity Id (specific to issue).</summary>
|
|
Reqnt_AmountUnit_Earliest_ById,
|
|
/// <summary>Earliest item price irrespective of status, by commodity code (ie. any issue).</summary>
|
|
Reqnt_AmountUnit_Earliest_ByCode,
|
|
// Associated data.
|
|
CommodityCustomer_Count,
|
|
CommoditySupplier_Count,
|
|
Process_Count,
|
|
PortfolioItem_Count,
|
|
// Barcode images.
|
|
BarcodeImagePath,
|
|
BarcodeImage,
|
|
// Common properties.
|
|
Notes,
|
|
Flag,
|
|
Status,
|
|
Status_Desc,
|
|
Status_Ind,
|
|
Status_Current_Y,
|
|
Status_Current_X,
|
|
Status_Current_Tick,
|
|
CreateOn_Date,
|
|
UpdateOn_Date,
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Properties other than common.</summary>
|
|
public class DataProperties
|
|
{
|
|
// Commodity.
|
|
public SysId AffiliateIdOwner { get; set; } = new SysId();
|
|
public Sbm.CommodityType CommodityType { get; set; } = Sbm.CommodityType.Unknown;
|
|
public String Code { get; set; } = "";
|
|
public String DescBrief { get; set; } = "";
|
|
public String DescOrder { get; set; } = "";
|
|
public String DescDetail { get; set; } = "";
|
|
public String DrawingNumber { get; set; } = "";
|
|
public String DrawingIssue { get; set; } = "";
|
|
public String IncrementDrawingIssue { get; set; } = "";
|
|
public SysId AssetCatId { get; set; } = new SysId();
|
|
public String ImagePath { get; set; } = "";
|
|
public String Category1 { get; set; } = "";
|
|
public String Category2 { get; set; } = "";
|
|
public String Category3 { get; set; } = "";
|
|
public String Location { get; set; } = "";
|
|
public String Department { get; set; } = "";
|
|
public String CatalogRef { get; set; } = "";
|
|
// Specification.
|
|
public decimal Weight { get; set; } = 0.0m;
|
|
public SysId UomIdWeight { get; set; } = new SysId();
|
|
public decimal Length { get; set; } = 0.0m;
|
|
public SysId UomIdLength { get; set; } = new SysId();
|
|
public decimal Volume { get; set; } = 0.0m;
|
|
public SysId UomIdVolume { get; set; } = new SysId();
|
|
public decimal Density { get; set; } = 0.0m;
|
|
public SysId UomIdDensity { get; set; } = new SysId();
|
|
public decimal BoxQuantity { get; set; } = 0.0m;
|
|
public SysId UomIdBox { get; set; } = new SysId();
|
|
public String Dimensions { get; set; } = "";
|
|
public String SpecSummary { get; set; } = "";
|
|
// Codings.
|
|
public String RangeCode { get; set; } = "";
|
|
public String ColourCode { get; set; } = "";
|
|
public String SourceCode { get; set; } = "";
|
|
public String SupplyMethodCode { get; set; } = "";
|
|
public String HandlingCode { get; set; } = "";
|
|
public String DeliveryCode { get; set; } = "";
|
|
public String MaterialCode { get; set; } = "";
|
|
public String FinishCode { get; set; } = "";
|
|
public String PromotionCode { get; set; } = "";
|
|
public String NominalCode { get; set; } = "";
|
|
public String NominalCodePurchase { get; set; } = "";
|
|
public String ICNTariffCode { get; set; } = "";
|
|
// Production time.
|
|
public decimal TimeProd { get; set; } = 0.0m;
|
|
public SysId UomIdTimeProd { get; set; } = new SysId();
|
|
// Purchasing.
|
|
public SysId AssociationIdSupplier { get; set; } = new SysId();
|
|
public String SupplierRef { get; set; } = "";
|
|
public decimal CostPrice { get; set; } = 0.0m;
|
|
public String PlaceOfOrigin { get; set; } = "";
|
|
public decimal MaterialCost { get; set; } = 0.0m;
|
|
public SysId CurrencyIdMaterial { get; set; } = new SysId();
|
|
public decimal ExWorksCost { get; set; } = 0.0m;
|
|
public SysId CurrencyIdExWorks { get; set; } = new SysId();
|
|
public decimal ReorderLevel { get; set; } = 0.0m;
|
|
public decimal ReorderQty { get; set; } = 0.0m;
|
|
public decimal QtyOnOrder { get; set; } = 0.0m;
|
|
// Sales.
|
|
public SysId AssociationIdCustomer { get; set; } = new SysId();
|
|
public decimal SalesPrice { get; set; } = 0.0m;
|
|
public decimal RetailPrice { get; set; } = 0.0m;
|
|
public decimal RetailPricePlanned { get; set; } = 0.0m;
|
|
public SysId UomIdSale { get; set; } = new SysId();
|
|
public decimal CarriageCostIndicative { get; set; } = 0.0m;
|
|
public decimal MinOrderQty { get; set; } = 0.0m;
|
|
public decimal PackQtySale { get; set; } = 0.0m;
|
|
public SysId TaxCodeId { get; set; } = new SysId();
|
|
public DateTime LastOrderDate { get; set; } = DateTime.MinValue;
|
|
public decimal LastOrderQty { get; set; } = 0.0m;
|
|
// Stock.
|
|
public decimal QtyInStock { get; set; } = 0.0m;
|
|
public decimal QtyAllocated { get; set; } = 0.0m;
|
|
public decimal FreeStock { get; set; } = 0.0m;
|
|
public DateTime StockTakeDate { get; set; } = DateTime.MinValue;
|
|
public decimal StockTakeQty { get; set; } = 0.0m;
|
|
// Projected sales.
|
|
public SysId CommodityIdSalesProj { get; set; } = new SysId();
|
|
public decimal SalesProjAnnual { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth01 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth02 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth03 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth04 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth05 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth06 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth07 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth08 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth09 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth10 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth11 { get; set; } = 0.0m;
|
|
public decimal SalesProjMonth12 { get; set; } = 0.0m;
|
|
// Proposed sales - budget.
|
|
public decimal SalesPropAnnual { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth01 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth02 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth03 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth04 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth05 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth06 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth07 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth08 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth09 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth10 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth11 { get; set; } = 0.0m;
|
|
public decimal SalesPropMonth12 { get; set; } = 0.0m;
|
|
}
|
|
|
|
// Data.
|
|
public new class Data : SacsHierarchyItem.Data
|
|
{
|
|
// Data members.
|
|
private readonly DataProperties data = new DataProperties();
|
|
// Construction.
|
|
public Data()
|
|
{
|
|
Status = DefaultStatus;
|
|
}
|
|
// Commodity.
|
|
public SysId AffiliateIdOwner
|
|
{
|
|
get { return data.AffiliateIdOwner; }
|
|
set { CheckChanged(data.AffiliateIdOwner, value); data.AffiliateIdOwner = value; }
|
|
}
|
|
public Sbm.CommodityType CommodityType
|
|
{
|
|
get { return data.CommodityType; }
|
|
set { CheckChanged((int)data.CommodityType, (int)value); data.CommodityType = value; }
|
|
}
|
|
public String Code
|
|
{
|
|
get { return data.Code; }
|
|
set { CheckChanged(data.Code, value); data.Code = value; }
|
|
}
|
|
public String DescBrief
|
|
{
|
|
get { return data.DescBrief; }
|
|
set { CheckChanged(data.DescBrief, value); data.DescBrief = value; }
|
|
}
|
|
public String DescOrder
|
|
{
|
|
get { return data.DescOrder; }
|
|
set { CheckChanged(data.DescOrder, value); data.DescOrder = value; }
|
|
}
|
|
public String DescDetail
|
|
{
|
|
get { return data.DescDetail; }
|
|
set { CheckChanged(data.DescDetail, value); data.DescDetail = value; }
|
|
}
|
|
public String DrawingNumber
|
|
{
|
|
get { return data.DrawingNumber; }
|
|
set { CheckChanged(data.DrawingNumber, value); data.DrawingNumber = value; }
|
|
}
|
|
public String DrawingIssue
|
|
{
|
|
get { return data.DrawingIssue; }
|
|
set { CheckChanged(data.DrawingIssue, value); data.DrawingIssue = value; }
|
|
}
|
|
public static String IncrementDrawingIssue(String issueOld)
|
|
{
|
|
String sIssue = issueOld;
|
|
if (!sIssue.IsEmpty())
|
|
{
|
|
bool bCarryOver = true;
|
|
bool bLastPosNumeric = true;
|
|
// Work from right to left:
|
|
for (int i = sIssue.Length - 1; bCarryOver && i >= 0; i--)
|
|
{
|
|
char c = sIssue[i];
|
|
if (c >= '0' && c <= '8')
|
|
{
|
|
// Numbers '0' through '8' are incremented with no carry:
|
|
c = c++;
|
|
bLastPosNumeric = true;
|
|
bCarryOver = false;
|
|
}
|
|
else if (c == '9')
|
|
{
|
|
// Number '9' becomes '0' with carry:
|
|
c = '0';
|
|
bLastPosNumeric = true;
|
|
bCarryOver = true;
|
|
}
|
|
else if ((c >= 'A' && c <= 'Y') || (c >= 'a' && c <= 'y'))
|
|
{
|
|
// Letters 'A' through 'Y' are incremented with no carry:
|
|
c = c++;
|
|
bLastPosNumeric = false;
|
|
bCarryOver = false;
|
|
}
|
|
else if (c == 'Z' || c == 'z')
|
|
{
|
|
// Number 'Z' becomes 'A' with carry:
|
|
c = c == 'Z' ? 'A' : 'a';
|
|
bLastPosNumeric = false;
|
|
bCarryOver = true;
|
|
}
|
|
if (bCarryOver)
|
|
sIssue = (bLastPosNumeric ? "1" : "A") + sIssue;
|
|
}
|
|
}
|
|
return sIssue;
|
|
}
|
|
public SysId AssetCatId
|
|
{
|
|
get { return data.AssetCatId; }
|
|
set { CheckChanged(data.AssetCatId, value); data.AssetCatId = value; }
|
|
}
|
|
public String ImagePath
|
|
{
|
|
get { return data.ImagePath; }
|
|
set { CheckChanged(data.ImagePath, value); data.ImagePath = value; }
|
|
}
|
|
public String Category1
|
|
{
|
|
get { return data.Category1; }
|
|
set { CheckChanged(data.Category1, value); data.Category1 = value; }
|
|
}
|
|
public String Category2
|
|
{
|
|
get { return data.Category2; }
|
|
set { CheckChanged(data.Category2, value); data.Category2 = value; }
|
|
}
|
|
public String Category3
|
|
{
|
|
get { return data.Category3; }
|
|
set { CheckChanged(data.Category3, value); data.Category3 = value; }
|
|
}
|
|
public String Location
|
|
{
|
|
get { return data.Location; }
|
|
set { CheckChanged(data.Location, value); data.Location = value; }
|
|
}
|
|
public String Department
|
|
{
|
|
get { return data.Department; }
|
|
set { CheckChanged(data.Department, value); data.Department = value; }
|
|
}
|
|
public String CatalogRef
|
|
{
|
|
get { return data.CatalogRef; }
|
|
set { CheckChanged(data.CatalogRef, value); data.CatalogRef = value; }
|
|
}
|
|
// Specification.
|
|
public decimal Weight
|
|
{
|
|
get { return data.Weight; }
|
|
set { CheckChanged(data.Weight, value); data.Weight = value; }
|
|
}
|
|
public SysId UomIdWeight
|
|
{
|
|
get { return data.UomIdWeight; }
|
|
set { CheckChanged(data.UomIdWeight, value); data.UomIdWeight = value; }
|
|
}
|
|
public decimal Length
|
|
{
|
|
get { return data.Length; }
|
|
set { CheckChanged(data.Length, value); data.Length = value; }
|
|
}
|
|
public SysId UomIdLength
|
|
{
|
|
get { return data.UomIdLength; }
|
|
set { CheckChanged(data.UomIdLength, value); data.UomIdLength = value; }
|
|
}
|
|
public decimal Volume
|
|
{
|
|
get { return data.Volume; }
|
|
set { CheckChanged(data.Volume, value); data.Volume = value; }
|
|
}
|
|
public SysId UomIdVolume
|
|
{
|
|
get { return data.UomIdVolume; }
|
|
set { CheckChanged(data.UomIdVolume, value); data.UomIdVolume = value; }
|
|
}
|
|
public decimal Density
|
|
{
|
|
get { return data.Density; }
|
|
set { CheckChanged(data.Density, value); data.Density = value; }
|
|
}
|
|
public SysId UomIdDensity
|
|
{
|
|
get { return data.UomIdDensity; }
|
|
set { CheckChanged(data.UomIdDensity, value); data.UomIdDensity = value; }
|
|
}
|
|
public decimal BoxQuantity
|
|
{
|
|
get { return data.BoxQuantity; }
|
|
set { CheckChanged(data.BoxQuantity, value); data.BoxQuantity = value; }
|
|
}
|
|
public SysId UomIdBox
|
|
{
|
|
get { return data.UomIdBox; }
|
|
set { CheckChanged(data.UomIdBox, value); data.UomIdBox = value; }
|
|
}
|
|
public String Dimensions
|
|
{
|
|
get { return data.Dimensions; }
|
|
set { CheckChanged(data.Dimensions, value); data.Dimensions = value; }
|
|
}
|
|
public String SpecSummary
|
|
{
|
|
get { return data.SpecSummary; }
|
|
set { CheckChanged(data.SpecSummary, value); data.SpecSummary = value; }
|
|
}
|
|
// Codings.
|
|
public String RangeCode
|
|
{
|
|
get { return data.RangeCode; }
|
|
set { CheckChanged(data.RangeCode, value); data.RangeCode = value; }
|
|
}
|
|
public String ColourCode
|
|
{
|
|
get { return data.ColourCode; }
|
|
set { CheckChanged(data.ColourCode, value); data.ColourCode = value; }
|
|
}
|
|
public String SourceCode
|
|
{
|
|
get { return data.SourceCode; }
|
|
set { CheckChanged(data.SourceCode, value); data.SourceCode = value; }
|
|
}
|
|
public String SupplyMethodCode
|
|
{
|
|
get { return data.SupplyMethodCode; }
|
|
set { CheckChanged(data.SupplyMethodCode, value); data.SupplyMethodCode = value; }
|
|
}
|
|
public String HandlingCode
|
|
{
|
|
get { return data.HandlingCode; }
|
|
set { CheckChanged(data.HandlingCode, value); data.HandlingCode = value; }
|
|
}
|
|
public String DeliveryCode
|
|
{
|
|
get { return data.DeliveryCode; }
|
|
set { CheckChanged(data.DeliveryCode, value); data.DeliveryCode = value; }
|
|
}
|
|
public String MaterialCode
|
|
{
|
|
get { return data.MaterialCode; }
|
|
set { CheckChanged(data.MaterialCode, value); data.MaterialCode = value; }
|
|
}
|
|
public String FinishCode
|
|
{
|
|
get { return data.FinishCode; }
|
|
set { CheckChanged(data.FinishCode, value); data.FinishCode = value; }
|
|
}
|
|
public String PromotionCode
|
|
{
|
|
get { return data.PromotionCode; }
|
|
set { CheckChanged(data.PromotionCode, value); data.PromotionCode = value; }
|
|
}
|
|
public String NominalCode
|
|
{
|
|
get { return data.NominalCode; }
|
|
set { CheckChanged(data.NominalCode, value); data.NominalCode = value; }
|
|
}
|
|
public String NominalCodePurchase
|
|
{
|
|
get { return data.NominalCodePurchase; }
|
|
set { CheckChanged(data.NominalCodePurchase, value); data.NominalCodePurchase = value; }
|
|
}
|
|
public String ICNTariffCode
|
|
{
|
|
get { return data.ICNTariffCode; }
|
|
set { CheckChanged(data.ICNTariffCode, value); data.ICNTariffCode = value; }
|
|
}
|
|
// Production time.
|
|
public decimal TimeProd
|
|
{
|
|
get { return data.TimeProd; }
|
|
set { CheckChanged(data.TimeProd, value); data.TimeProd = value; }
|
|
}
|
|
public SysId UomIdTimeProd
|
|
{
|
|
get { return data.UomIdTimeProd; }
|
|
set { CheckChanged(data.UomIdTimeProd, value); data.UomIdTimeProd = value; }
|
|
}
|
|
// Purchasing.
|
|
public SysId AssociationIdSupplier
|
|
{
|
|
get { return data.AssociationIdSupplier; }
|
|
set { CheckChanged(data.AssociationIdSupplier, value); data.AssociationIdSupplier = value; }
|
|
}
|
|
public String SupplierRef
|
|
{
|
|
get { return data.SupplierRef; }
|
|
set { CheckChanged(data.SupplierRef, value); data.SupplierRef = value; }
|
|
}
|
|
public decimal CostPrice
|
|
{
|
|
get { return data.CostPrice; }
|
|
set { CheckChanged(data.CostPrice, value); data.CostPrice = value; }
|
|
}
|
|
public String PlaceOfOrigin
|
|
{
|
|
get { return data.PlaceOfOrigin; }
|
|
set { CheckChanged(data.PlaceOfOrigin, value); data.PlaceOfOrigin = value; }
|
|
}
|
|
public decimal MaterialCost
|
|
{
|
|
get { return data.MaterialCost; }
|
|
set { CheckChanged(data.MaterialCost, value); data.MaterialCost = value; }
|
|
}
|
|
public SysId CurrencyIdMaterial
|
|
{
|
|
get { return data.CurrencyIdMaterial; }
|
|
set { CheckChanged(data.CurrencyIdMaterial, value); data.CurrencyIdMaterial = value; }
|
|
}
|
|
public decimal ExWorksCost
|
|
{
|
|
get { return data.ExWorksCost; }
|
|
set { CheckChanged(data.ExWorksCost, value); data.ExWorksCost = value; }
|
|
}
|
|
public SysId CurrencyIdExWorks
|
|
{
|
|
get { return data.CurrencyIdExWorks; }
|
|
set { CheckChanged(data.CurrencyIdExWorks, value); data.CurrencyIdExWorks = value; }
|
|
}
|
|
public decimal ReorderLevel
|
|
{
|
|
get { return data.ReorderLevel; }
|
|
set { CheckChanged(data.ReorderLevel, value); data.ReorderLevel = value; }
|
|
}
|
|
public decimal ReorderQty
|
|
{
|
|
get { return data.ReorderQty; }
|
|
set { CheckChanged(data.ReorderQty, value); data.ReorderQty = value; }
|
|
}
|
|
public decimal QtyOnOrder
|
|
{
|
|
get { return data.QtyOnOrder; }
|
|
set { CheckChanged(data.QtyOnOrder, value); data.QtyOnOrder = value; }
|
|
}
|
|
// Sales.
|
|
public SysId AssociationIdCustomer
|
|
{
|
|
get { return data.AssociationIdCustomer; }
|
|
set { CheckChanged(data.AssociationIdCustomer, value); data.AssociationIdCustomer = value; }
|
|
}
|
|
public decimal SalesPrice
|
|
{
|
|
get { return data.SalesPrice; }
|
|
set { CheckChanged(data.SalesPrice, value); data.SalesPrice = value; }
|
|
}
|
|
public decimal RetailPrice
|
|
{
|
|
get { return data.RetailPrice; }
|
|
set { CheckChanged(data.RetailPrice, value); data.RetailPrice = value; }
|
|
}
|
|
public decimal RetailPricePlanned
|
|
{
|
|
get { return data.RetailPricePlanned; }
|
|
set { CheckChanged(data.RetailPricePlanned, value); data.RetailPricePlanned = value; }
|
|
}
|
|
public SysId UomIdSale
|
|
{
|
|
get { return data.UomIdSale; }
|
|
set { CheckChanged(data.UomIdSale, value); data.UomIdSale = value; }
|
|
}
|
|
public decimal CarriageCostIndicative
|
|
{
|
|
get { return data.CarriageCostIndicative; }
|
|
set { CheckChanged(data.CarriageCostIndicative, value); data.CarriageCostIndicative = value; }
|
|
}
|
|
public decimal MinOrderQty
|
|
{
|
|
get { return data.MinOrderQty; }
|
|
set { CheckChanged(data.MinOrderQty, value); data.MinOrderQty = value; }
|
|
}
|
|
public decimal PackQtySale
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { CheckChanged(data.PackQtySale, value); data.PackQtySale = value; }
|
|
}
|
|
public SysId TaxCodeId
|
|
{
|
|
get { return data.TaxCodeId; }
|
|
set { CheckChanged(data.TaxCodeId, value); data.TaxCodeId = value; }
|
|
}
|
|
public DateTime LastOrderDate
|
|
{
|
|
get { return data.LastOrderDate; }
|
|
set { CheckChanged(data.LastOrderDate, value); data.LastOrderDate = value; }
|
|
}
|
|
public decimal LastOrderQty
|
|
{
|
|
get { return data.LastOrderQty; }
|
|
set { CheckChanged(data.LastOrderQty, value); data.LastOrderQty = value; }
|
|
}
|
|
// Stock.
|
|
public decimal QtyInStock
|
|
{
|
|
get { return data.QtyInStock; }
|
|
set { CheckChanged(data.QtyInStock, value); data.QtyInStock = value; }
|
|
}
|
|
public decimal QtyAllocated
|
|
{
|
|
get { return data.QtyAllocated; }
|
|
set { CheckChanged(data.QtyAllocated, value); data.QtyAllocated = value; }
|
|
}
|
|
public decimal FreeStock
|
|
{
|
|
get { return data.FreeStock; }
|
|
set { CheckChanged(data.FreeStock, value); data.FreeStock = value; }
|
|
}
|
|
public DateTime StockTakeDate
|
|
{
|
|
get { return data.StockTakeDate; }
|
|
set { CheckChanged(data.StockTakeDate, value); data.StockTakeDate = value; }
|
|
}
|
|
public decimal StockTakeQty
|
|
{
|
|
get { return data.StockTakeQty; }
|
|
set { CheckChanged(data.StockTakeQty, value); data.StockTakeQty = value; }
|
|
}
|
|
// Projected sales.
|
|
public SysId CommodityIdSalesProj
|
|
{
|
|
get { return data.CommodityIdSalesProj; }
|
|
set { CheckChanged(data.CommodityIdSalesProj, value); data.CommodityIdSalesProj = value; }
|
|
}
|
|
public decimal SalesProjAnnual
|
|
{
|
|
get { return data.SalesProjAnnual; }
|
|
set { CheckChanged(data.SalesProjAnnual, value); data.SalesProjAnnual = value; }
|
|
}
|
|
public decimal SalesProjMonth01
|
|
{
|
|
get { return data.SalesProjMonth01; }
|
|
set { CheckChanged(data.SalesProjMonth01, value); data.SalesProjMonth01 = value; }
|
|
}
|
|
public decimal SalesProjMonth02
|
|
{
|
|
get { return data.SalesProjMonth02; }
|
|
set { CheckChanged(data.SalesProjMonth02, value); data.SalesProjMonth02 = value; }
|
|
}
|
|
public decimal SalesProjMonth03
|
|
{
|
|
get { return data.SalesProjMonth03; }
|
|
set { CheckChanged(data.SalesProjMonth03, value); data.SalesProjMonth03 = value; }
|
|
}
|
|
public decimal SalesProjMonth04
|
|
{
|
|
get { return data.SalesProjMonth04; }
|
|
set { CheckChanged(data.SalesProjMonth04, value); data.SalesProjMonth04 = value; }
|
|
}
|
|
public decimal SalesProjMonth05
|
|
{
|
|
get { return data.SalesProjMonth05; }
|
|
set { CheckChanged(data.SalesProjMonth05, value); data.SalesProjMonth05 = value; }
|
|
}
|
|
public decimal SalesProjMonth06
|
|
{
|
|
get { return data.SalesProjMonth06; }
|
|
set { CheckChanged(data.SalesProjMonth06, value); data.SalesProjMonth06 = value; }
|
|
}
|
|
public decimal SalesProjMonth07
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { CheckChanged(data.SalesProjMonth07, value); data.SalesProjMonth07 = value; }
|
|
}
|
|
public decimal SalesProjMonth08
|
|
{
|
|
get { return data.SalesProjMonth08; }
|
|
set { CheckChanged(data.SalesProjMonth08, value); data.SalesProjMonth08 = value; }
|
|
}
|
|
public decimal SalesProjMonth09
|
|
{
|
|
get { return data.SalesProjMonth09; }
|
|
set { CheckChanged(data.SalesProjMonth09, value); data.SalesProjMonth09 = value; }
|
|
}
|
|
public decimal SalesProjMonth10
|
|
{
|
|
get { return data.SalesProjMonth10; }
|
|
set { CheckChanged(data.SalesProjMonth10, value); data.SalesProjMonth10 = value; }
|
|
}
|
|
public decimal SalesProjMonth11
|
|
{
|
|
get { return data.SalesProjMonth11; }
|
|
set { CheckChanged(data.SalesProjMonth11, value); data.SalesProjMonth11 = value; }
|
|
}
|
|
public decimal SalesProjMonth12
|
|
{
|
|
get { return data.SalesProjMonth12; }
|
|
set { CheckChanged(data.SalesProjMonth12, value); data.SalesProjMonth12 = value; }
|
|
}
|
|
// Proposed sales - budget.
|
|
public decimal SalesPropAnnual
|
|
{
|
|
get { return data.SalesPropAnnual; }
|
|
set { CheckChanged(data.SalesPropAnnual, value); data.SalesPropAnnual = value; }
|
|
}
|
|
public decimal SalesPropMonth01
|
|
{
|
|
get { return data.SalesPropMonth01; }
|
|
set { CheckChanged(data.SalesPropMonth01, value); data.SalesPropMonth01 = value; }
|
|
}
|
|
public decimal SalesPropMonth02
|
|
{
|
|
get { return data.SalesPropMonth02; }
|
|
set { CheckChanged(data.SalesPropMonth02, value); data.SalesPropMonth02 = value; }
|
|
}
|
|
public decimal SalesPropMonth03
|
|
{
|
|
get { return data.SalesPropMonth03; }
|
|
set { CheckChanged(data.SalesPropMonth03, value); data.SalesPropMonth03 = value; }
|
|
}
|
|
public decimal SalesPropMonth04
|
|
{
|
|
get { return data.SalesPropMonth04; }
|
|
set { CheckChanged(data.SalesPropMonth04, value); data.SalesPropMonth04 = value; }
|
|
}
|
|
public decimal SalesPropMonth05
|
|
{
|
|
get { return data.SalesPropMonth05; }
|
|
set { CheckChanged(data.SalesPropMonth05, value); data.SalesPropMonth05 = value; }
|
|
}
|
|
public decimal SalesPropMonth06
|
|
{
|
|
get { return data.SalesPropMonth06; }
|
|
set { CheckChanged(data.SalesPropMonth06, value); data.SalesPropMonth06 = value; }
|
|
}
|
|
public decimal SalesPropMonth07
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { CheckChanged(data.SalesPropMonth07, value); data.SalesPropMonth07 = value; }
|
|
}
|
|
public decimal SalesPropMonth08
|
|
{
|
|
get { return data.SalesPropMonth08; }
|
|
set { CheckChanged(data.SalesPropMonth08, value); data.SalesPropMonth08 = value; }
|
|
}
|
|
public decimal SalesPropMonth09
|
|
{
|
|
get { return data.SalesPropMonth09; }
|
|
set { CheckChanged(data.SalesPropMonth09, value); data.SalesPropMonth09 = value; }
|
|
}
|
|
public decimal SalesPropMonth10
|
|
{
|
|
get { return data.SalesPropMonth10; }
|
|
set { CheckChanged(data.SalesPropMonth10, value); data.SalesPropMonth10 = value; }
|
|
}
|
|
public decimal SalesPropMonth11
|
|
{
|
|
get { return data.SalesPropMonth11; }
|
|
set { CheckChanged(data.SalesPropMonth11, value); data.SalesPropMonth11 = value; }
|
|
}
|
|
public decimal SalesPropMonth12
|
|
{
|
|
get { return data.SalesPropMonth12; }
|
|
set { CheckChanged(data.SalesPropMonth12, value); data.SalesPropMonth12 = value; }
|
|
}
|
|
|
|
internal void PopulateFrom(Data data)
|
|
{
|
|
// Commodity.
|
|
AffiliateIdOwner = data.AffiliateIdOwner;
|
|
CommodityType = data.CommodityType;
|
|
Code = data.Code;
|
|
DescBrief = data.DescBrief;
|
|
DescOrder = data.DescOrder;
|
|
DescDetail = data.DescDetail;
|
|
DrawingNumber = data.DrawingNumber;
|
|
DrawingIssue = data.DrawingIssue;
|
|
AssetCatId = data.AssetCatId;
|
|
ImagePath = data.ImagePath;
|
|
Category1 = data.Category1;
|
|
Category2 = data.Category2;
|
|
Category3 = data.Category3;
|
|
Location = data.Location;
|
|
Department = data.Department;
|
|
CatalogRef = data.CatalogRef;
|
|
// Specification.
|
|
Weight = data.Weight;
|
|
UomIdWeight = data.UomIdWeight;
|
|
Length = data.Length;
|
|
UomIdLength = data.UomIdLength;
|
|
Volume = data.Volume;
|
|
UomIdVolume = data.UomIdVolume;
|
|
Density = data.Density;
|
|
UomIdDensity = data.UomIdDensity;
|
|
BoxQuantity = data.BoxQuantity;
|
|
UomIdBox = data.UomIdBox;
|
|
Dimensions = data.Dimensions;
|
|
SpecSummary = data.SpecSummary;
|
|
// Codings.
|
|
RangeCode = data.RangeCode;
|
|
ColourCode = data.ColourCode;
|
|
SourceCode = data.SourceCode;
|
|
SupplyMethodCode = data.SupplyMethodCode;
|
|
HandlingCode = data.HandlingCode;
|
|
DeliveryCode = data.DeliveryCode;
|
|
MaterialCode = data.MaterialCode;
|
|
FinishCode = data.FinishCode;
|
|
PromotionCode = data.PromotionCode;
|
|
NominalCode = data.NominalCode;
|
|
NominalCodePurchase = data.NominalCodePurchase;
|
|
ICNTariffCode = data.ICNTariffCode;
|
|
// Production time.
|
|
TimeProd = data.TimeProd;
|
|
UomIdTimeProd = data.UomIdTimeProd;
|
|
// Purchasing.
|
|
AssociationIdSupplier = data.AssociationIdSupplier;
|
|
SupplierRef = data.SupplierRef;
|
|
CostPrice = data.CostPrice;
|
|
PlaceOfOrigin = data.PlaceOfOrigin;
|
|
MaterialCost = data.MaterialCost;
|
|
CurrencyIdMaterial = data.CurrencyIdMaterial;
|
|
ExWorksCost = data.ExWorksCost;
|
|
CurrencyIdExWorks = data.CurrencyIdExWorks;
|
|
ReorderLevel = data.ReorderLevel;
|
|
ReorderQty = data.ReorderQty;
|
|
QtyOnOrder = data.QtyOnOrder;
|
|
// Sales.
|
|
AssociationIdCustomer = data.AssociationIdCustomer;
|
|
SalesPrice = data.SalesPrice;
|
|
RetailPrice = data.RetailPrice;
|
|
RetailPricePlanned = data.RetailPricePlanned;
|
|
UomIdSale = data.UomIdSale;
|
|
CarriageCostIndicative = data.CarriageCostIndicative;
|
|
MinOrderQty = data.MinOrderQty;
|
|
PackQtySale = data.PackQtySale;
|
|
TaxCodeId = data.TaxCodeId;
|
|
LastOrderDate = data.LastOrderDate;
|
|
LastOrderQty = data.LastOrderQty;
|
|
// Stock.
|
|
QtyInStock = data.QtyInStock;
|
|
QtyAllocated = data.QtyAllocated;
|
|
FreeStock = data.FreeStock;
|
|
StockTakeDate = data.StockTakeDate;
|
|
StockTakeQty = data.StockTakeQty;
|
|
// Projected sales.
|
|
CommodityIdSalesProj = data.CommodityIdSalesProj;
|
|
SalesProjAnnual = data.SalesProjAnnual;
|
|
SalesProjMonth01 = data.SalesProjMonth01;
|
|
SalesProjMonth02 = data.SalesProjMonth02;
|
|
SalesProjMonth03 = data.SalesProjMonth03;
|
|
SalesProjMonth04 = data.SalesProjMonth04;
|
|
SalesProjMonth05 = data.SalesProjMonth05;
|
|
SalesProjMonth06 = data.SalesProjMonth06;
|
|
SalesProjMonth07 = data.SalesProjMonth07;
|
|
SalesProjMonth08 = data.SalesProjMonth08;
|
|
SalesProjMonth09 = data.SalesProjMonth09;
|
|
SalesProjMonth10 = data.SalesProjMonth10;
|
|
SalesProjMonth11 = data.SalesProjMonth11;
|
|
SalesProjMonth12 = data.SalesProjMonth12;
|
|
// Proposed sales - budget.
|
|
SalesPropAnnual = data.SalesPropAnnual;
|
|
SalesPropMonth01 = data.SalesPropMonth01;
|
|
SalesPropMonth02 = data.SalesPropMonth02;
|
|
SalesPropMonth03 = data.SalesPropMonth03;
|
|
SalesPropMonth04 = data.SalesPropMonth04;
|
|
SalesPropMonth05 = data.SalesPropMonth05;
|
|
SalesPropMonth06 = data.SalesPropMonth06;
|
|
SalesPropMonth07 = data.SalesPropMonth07;
|
|
SalesPropMonth08 = data.SalesPropMonth08;
|
|
SalesPropMonth09 = data.SalesPropMonth09;
|
|
SalesPropMonth10 = data.SalesPropMonth10;
|
|
SalesPropMonth11 = data.SalesPropMonth11;
|
|
SalesPropMonth12 = data.SalesPropMonth12;
|
|
base.PopulateFrom(data);
|
|
}
|
|
public Data Clone()
|
|
{
|
|
Data data = new Data();
|
|
data.PopulateFrom(this);
|
|
return data;
|
|
}
|
|
}
|
|
|
|
public new class ErrField : SacsHierarchyItem.ErrField
|
|
{
|
|
// Identifies the field that has invalid data.
|
|
// Commodity.
|
|
public ValidValue AffiliateIdOwner { get; set; } = ValidValue.Valid;
|
|
public ValidValue CommodityType { get; set; } = ValidValue.Valid;
|
|
public ValidValue Code { get; set; } = ValidValue.Valid;
|
|
public ValidValue DescBrief { get; set; } = ValidValue.Valid;
|
|
public ValidValue DescOrder { get; set; } = ValidValue.Valid;
|
|
public ValidValue DescDetail { get; set; } = ValidValue.Valid;
|
|
public ValidValue DrawingNumber { get; set; } = ValidValue.Valid;
|
|
public ValidValue DrawingIssue { get; set; } = ValidValue.Valid;
|
|
public ValidValue AssetCatId { get; set; } = ValidValue.Valid;
|
|
public ValidValue ImagePath { get; set; } = ValidValue.Valid;
|
|
public ValidValue Category1 { get; set; } = ValidValue.Valid;
|
|
public ValidValue Category2 { get; set; } = ValidValue.Valid;
|
|
public ValidValue Category3 { get; set; } = ValidValue.Valid;
|
|
public ValidValue Location { get; set; } = ValidValue.Valid;
|
|
public ValidValue Department { get; set; } = ValidValue.Valid;
|
|
public ValidValue CatalogRef { get; set; } = ValidValue.Valid;
|
|
// Specification.
|
|
public ValidValue Weight { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdWeight { get; set; } = ValidValue.Valid;
|
|
public ValidValue Length { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdLength { get; set; } = ValidValue.Valid;
|
|
public ValidValue Volume { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdVolume { get; set; } = ValidValue.Valid;
|
|
public ValidValue Density { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdDensity { get; set; } = ValidValue.Valid;
|
|
public ValidValue BoxQuantity { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdBox { get; set; } = ValidValue.Valid;
|
|
public ValidValue Dimensions { get; set; } = ValidValue.Valid;
|
|
public ValidValue SpecSummary { get; set; } = ValidValue.Valid;
|
|
// Codings.
|
|
public ValidValue RangeCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue ColourCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue SourceCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue SupplyMethodCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue HandlingCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue DeliveryCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue MaterialCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue FinishCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue PromotionCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue NominalCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue NominalCodePurchase { get; set; } = ValidValue.Valid;
|
|
public ValidValue ICNTariffCode { get; set; } = ValidValue.Valid;
|
|
// Production time.
|
|
public ValidValue TimeProd { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdTimeProd { get; set; } = ValidValue.Valid;
|
|
// Purchasing.
|
|
public ValidValue AssociationIdSupplier { get; set; } = ValidValue.Valid;
|
|
public ValidValue SupplierRef { get; set; } = ValidValue.Valid;
|
|
public ValidValue CostPrice { get; set; } = ValidValue.Valid;
|
|
public ValidValue PlaceOfOrigin { get; set; } = ValidValue.Valid;
|
|
public ValidValue MaterialCost { get; set; } = ValidValue.Valid;
|
|
public ValidValue CurrencyIdMaterial { get; set; } = ValidValue.Valid;
|
|
public ValidValue ExWorksCost { get; set; } = ValidValue.Valid;
|
|
public ValidValue CurrencyIdExWorks { get; set; } = ValidValue.Valid;
|
|
public ValidValue ReorderLevel { get; set; } = ValidValue.Valid;
|
|
public ValidValue ReorderQty { get; set; } = ValidValue.Valid;
|
|
public ValidValue QtyOnOrder { get; set; } = ValidValue.Valid;
|
|
// Sales.
|
|
public ValidValue AssociationIdCustomer { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPrice { get; set; } = ValidValue.Valid;
|
|
public ValidValue RetailPrice { get; set; } = ValidValue.Valid;
|
|
public ValidValue RetailPricePlanned { get; set; } = ValidValue.Valid;
|
|
public ValidValue UomIdSale { get; set; } = ValidValue.Valid;
|
|
public ValidValue CarriageCostIndicative { get; set; } = ValidValue.Valid;
|
|
public ValidValue MinOrderQty { get; set; } = ValidValue.Valid;
|
|
public ValidValue PackQtySale { get; set; } = ValidValue.Valid;
|
|
public ValidValue TaxCodeId { get; set; } = ValidValue.Valid;
|
|
public ValidValue LastOrderDateTime { get; set; } = ValidValue.Valid;
|
|
public ValidValue LastOrderQty { get; set; } = ValidValue.Valid;
|
|
// Stock.
|
|
public ValidValue QtyInStock { get; set; } = ValidValue.Valid;
|
|
public ValidValue QtyAllocated { get; set; } = ValidValue.Valid;
|
|
public ValidValue FreeStock { get; set; } = ValidValue.Valid;
|
|
public ValidValue StockTakeDateTime { get; set; } = ValidValue.Valid;
|
|
public ValidValue StockTakeQty { get; set; } = ValidValue.Valid;
|
|
// Projected sales.
|
|
public ValidValue CommodityIdSalesProj { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonthlyProp { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjAnnual { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth01 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth02 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth03 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth04 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth05 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth06 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth07 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth08 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth09 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth10 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth11 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesProjMonth12 { get; set; } = ValidValue.Valid;
|
|
// Proposed sales - budget.
|
|
public ValidValue SalesPropAnnual { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth01 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth02 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth03 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth04 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth05 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth06 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth07 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth08 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth09 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth10 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth11 { get; set; } = ValidValue.Valid;
|
|
public ValidValue SalesPropMonth12 { get; set; } = ValidValue.Valid;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly Data data = new Data();
|
|
public static readonly Byte Flag_SellingProhibited = 0x01;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SbmCommodity(SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code) : base(id)
|
|
{
|
|
base.SetData(data);
|
|
AffiliateIdOwner = affiliateIdOwner;
|
|
CommodityType = commodityType;
|
|
Code = code;
|
|
Status = DefaultStatus;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Commodity status.
|
|
private static readonly List<SaStatus> commodityStatuses = new List<SaStatus>()
|
|
{
|
|
SaStatus.Current,
|
|
SaStatus.Superseded,
|
|
SaStatus.Discontinued,
|
|
};
|
|
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
|
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(commodityStatuses); } }
|
|
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
|
{
|
|
switch (status)
|
|
{
|
|
case SaStatus.Active:
|
|
case SaStatus.Current:
|
|
return DataValue.TriStateType.Green;
|
|
case SaStatus.OnHold:
|
|
return DataValue.TriStateType.Amber;
|
|
case SaStatus.Inactive:
|
|
case SaStatus.Cancelled:
|
|
case SaStatus.Disabled:
|
|
return DataValue.TriStateType.Red;
|
|
case SaStatus.Deleted:
|
|
return DataValue.TriStateType.Purple;
|
|
}
|
|
return DataValue.TriStateType.Unknown;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Utilities.
|
|
public SbmItemId GetItemId()
|
|
{
|
|
return new SbmItemId(Sbm.ItemType.Commodity, Id);
|
|
}
|
|
|
|
public String GetCaption()
|
|
{
|
|
return StringUtil.TrimWhitespace($"{Code} - {DescBrief}");
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public Data GetData() { return data.Clone(); }
|
|
public void SetData(Data data)
|
|
{
|
|
// Properties that cannot be changed if previously specified.
|
|
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
|
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
|
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
|
this.data.PopulateFrom(data);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Attributes.
|
|
public SysId AffiliateIdOwner
|
|
{
|
|
get { return data.AffiliateIdOwner; }
|
|
set { data.AffiliateIdOwner = value; }
|
|
}
|
|
public Sbm.CommodityType CommodityType
|
|
{
|
|
get { return data.CommodityType; }
|
|
set { data.CommodityType = value; }
|
|
}
|
|
public String Code
|
|
{
|
|
get { return data.Code; }
|
|
set { data.Code = value; }
|
|
}
|
|
public String GetCodeIssue(String delim = "/")
|
|
{
|
|
String CodeIssue = Code;
|
|
if (!DrawingIssue.IsEmpty())
|
|
CodeIssue += delim + DrawingIssue;
|
|
return CodeIssue;
|
|
}
|
|
public String DescBrief
|
|
{
|
|
get { return data.DescBrief; }
|
|
set { data.DescBrief = value; }
|
|
}
|
|
public String DescOrder
|
|
{
|
|
get { return data.DescOrder; }
|
|
set { data.DescOrder = value; }
|
|
}
|
|
public String DescDetail
|
|
{
|
|
get { return data.DescDetail; }
|
|
set { data.DescDetail = value; }
|
|
}
|
|
public String DrawingNumber
|
|
{
|
|
get { return data.DrawingNumber; }
|
|
set { data.DrawingNumber = value; }
|
|
}
|
|
public String DrawingIssue
|
|
{
|
|
get { return data.DrawingIssue; }
|
|
set { data.DrawingIssue = value; }
|
|
}
|
|
public static String IncrementDrawingIssue(String issueOld)
|
|
{
|
|
String sIssue = issueOld;
|
|
if (!sIssue.IsEmpty())
|
|
{
|
|
bool bCarryOver = true;
|
|
bool bLastPosNumeric = true;
|
|
// Work from right to left:
|
|
for (int i = sIssue.Length - 1; bCarryOver && i >= 0; i--)
|
|
{
|
|
char c = sIssue[i];
|
|
if (c >= '0' && c <= '8')
|
|
{
|
|
// Numbers '0' through '8' are incremented with no carry:
|
|
c = c++;
|
|
bLastPosNumeric = true;
|
|
bCarryOver = false;
|
|
}
|
|
else if (c == '9')
|
|
{
|
|
// Number '9' becomes '0' with carry:
|
|
c = '0';
|
|
bLastPosNumeric = true;
|
|
bCarryOver = true;
|
|
}
|
|
else if ((c >= 'A' && c <= 'Y') || (c >= 'a' && c <= 'y'))
|
|
{
|
|
// Letters 'A' through 'Y' are incremented with no carry:
|
|
c = c++;
|
|
bLastPosNumeric = false;
|
|
bCarryOver = false;
|
|
}
|
|
else if (c == 'Z' || c == 'z')
|
|
{
|
|
// Number 'Z' becomes 'A' with carry:
|
|
c = c == 'Z' ? 'A' : 'a';
|
|
bLastPosNumeric = false;
|
|
bCarryOver = true;
|
|
}
|
|
if (bCarryOver)
|
|
sIssue = (bLastPosNumeric ? "1" : "A") + sIssue;
|
|
}
|
|
}
|
|
return sIssue;
|
|
}
|
|
public SysId AssetCatId
|
|
{
|
|
get { return data.AssetCatId; }
|
|
set { data.AssetCatId = value; }
|
|
}
|
|
public String ImagePath
|
|
{
|
|
get { return data.ImagePath; }
|
|
set { data.ImagePath = value; }
|
|
}
|
|
public String Category1
|
|
{
|
|
get { return data.Category1; }
|
|
set { data.Category1 = value; }
|
|
}
|
|
public String Category2
|
|
{
|
|
get { return data.Category2; }
|
|
set { data.Category2 = value; }
|
|
}
|
|
public String Category3
|
|
{
|
|
get { return data.Category3; }
|
|
set { data.Category3 = value; }
|
|
}
|
|
public String Location
|
|
{
|
|
get { return data.Location; }
|
|
set { data.Location = value; }
|
|
}
|
|
public String Department
|
|
{
|
|
get { return data.Department; }
|
|
set { data.Department = value; }
|
|
}
|
|
public String CatalogRef
|
|
{
|
|
get { return data.CatalogRef; }
|
|
set { data.CatalogRef = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public decimal Weight
|
|
{
|
|
get { return data.Weight; }
|
|
set { data.Weight = value; }
|
|
}
|
|
public SysId UomIdWeight
|
|
{
|
|
get { return data.UomIdWeight; }
|
|
set { data.UomIdWeight = value; }
|
|
}
|
|
public decimal Length
|
|
{
|
|
get { return data.Length; }
|
|
set { data.Length = value; }
|
|
}
|
|
public SysId UomIdLength
|
|
{
|
|
get { return data.UomIdLength; }
|
|
set { data.UomIdLength = value; }
|
|
}
|
|
public decimal Volume
|
|
{
|
|
get { return data.Volume; }
|
|
set { data.Volume = value; }
|
|
}
|
|
public SysId UomIdVolume
|
|
{
|
|
get { return data.UomIdVolume; }
|
|
set { data.UomIdVolume = value; }
|
|
}
|
|
public decimal Density
|
|
{
|
|
get { return data.Density; }
|
|
set { data.Density = value; }
|
|
}
|
|
public SysId UomIdDensity
|
|
{
|
|
get { return data.UomIdDensity; }
|
|
set { data.UomIdDensity = value; }
|
|
}
|
|
public decimal BoxQuantity
|
|
{
|
|
get { return data.BoxQuantity; }
|
|
set { data.BoxQuantity = value; }
|
|
}
|
|
public SysId UomIdBox
|
|
{
|
|
get { return data.UomIdBox; }
|
|
set { data.UomIdBox = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public String Dimensions
|
|
{
|
|
get { return data.Dimensions; }
|
|
set { data.Dimensions = value; }
|
|
}
|
|
public String SpecSummary
|
|
{
|
|
get { return data.SpecSummary; }
|
|
set { data.SpecSummary = value; }
|
|
}
|
|
public String RangeCode
|
|
{
|
|
get { return data.RangeCode; }
|
|
set { data.RangeCode = value; }
|
|
}
|
|
public String ColourCode
|
|
{
|
|
get { return data.ColourCode; }
|
|
set { data.ColourCode = value; }
|
|
}
|
|
public String SourceCode
|
|
{
|
|
get { return data.SourceCode; }
|
|
set { data.SourceCode = value; }
|
|
}
|
|
public String SupplyMethodCode
|
|
{
|
|
get { return data.SupplyMethodCode; }
|
|
set { data.SupplyMethodCode = value; }
|
|
}
|
|
public String HandlingCode
|
|
{
|
|
get { return data.HandlingCode; }
|
|
set { data.HandlingCode = value; }
|
|
}
|
|
public String DeliveryCode
|
|
{
|
|
get { return data.DeliveryCode; }
|
|
set { data.DeliveryCode = value; }
|
|
}
|
|
public String MaterialCode
|
|
{
|
|
get { return data.MaterialCode; }
|
|
set { data.MaterialCode = value; }
|
|
}
|
|
public String FinishCode
|
|
{
|
|
get { return data.FinishCode; }
|
|
set { data.FinishCode = value; }
|
|
}
|
|
public String PromotionCode
|
|
{
|
|
get { return data.PromotionCode; }
|
|
set { data.PromotionCode = value; }
|
|
}
|
|
public String NominalCode
|
|
{
|
|
get { return data.NominalCode; }
|
|
set { data.NominalCode = value; }
|
|
}
|
|
public String NominalCodePurchase
|
|
{
|
|
get { return data.NominalCodePurchase; }
|
|
set { data.NominalCodePurchase = value; }
|
|
}
|
|
public String ICNTariffCode
|
|
{
|
|
get { return data.ICNTariffCode; }
|
|
set { data.ICNTariffCode = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public decimal TimeProd
|
|
{
|
|
get { return data.TimeProd; }
|
|
set { data.TimeProd = value; }
|
|
}
|
|
public SysId UomIdTimeProd
|
|
{
|
|
get { return data.UomIdTimeProd; }
|
|
set { data.UomIdTimeProd = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public SysId AssociationIdSupplier
|
|
{
|
|
get { return data.AssociationIdSupplier; }
|
|
set { data.AssociationIdSupplier = value; }
|
|
}
|
|
public String SupplierRef
|
|
{
|
|
get { return data.SupplierRef; }
|
|
set { data.SupplierRef = value; }
|
|
}
|
|
public decimal CostPrice
|
|
{
|
|
get { return data.CostPrice; }
|
|
set { data.CostPrice = value; }
|
|
}
|
|
public String PlaceOfOrigin
|
|
{
|
|
get { return data.PlaceOfOrigin; }
|
|
set { data.PlaceOfOrigin = value; }
|
|
}
|
|
public decimal MaterialCost
|
|
{
|
|
get { return data.MaterialCost; }
|
|
set { data.MaterialCost = value; }
|
|
}
|
|
public SysId CurrencyIdMaterial
|
|
{
|
|
get { return data.CurrencyIdMaterial; }
|
|
set { data.CurrencyIdMaterial = value; }
|
|
}
|
|
public decimal ExWorksCost
|
|
{
|
|
get { return data.ExWorksCost; }
|
|
set { data.ExWorksCost = value; }
|
|
}
|
|
public SysId CurrencyIdExWorks
|
|
{
|
|
get { return data.CurrencyIdExWorks; }
|
|
set { data.CurrencyIdExWorks = value; }
|
|
}
|
|
public decimal ReorderLevel
|
|
{
|
|
get { return data.ReorderLevel; }
|
|
set { data.ReorderLevel = value; }
|
|
}
|
|
public decimal ReorderQty
|
|
{
|
|
get { return data.ReorderQty; }
|
|
set { data.ReorderQty = value; }
|
|
}
|
|
public decimal QtyOnOrder
|
|
{
|
|
get { return data.QtyOnOrder; }
|
|
set { data.QtyOnOrder = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public SysId AssociationIdCustomer
|
|
{
|
|
get { return data.AssociationIdCustomer; }
|
|
set { data.AssociationIdCustomer = value; }
|
|
}
|
|
public decimal SalesPrice
|
|
{
|
|
get { return data.SalesPrice; }
|
|
set { data.SalesPrice = value; }
|
|
}
|
|
public decimal RetailPrice
|
|
{
|
|
get { return data.RetailPrice; }
|
|
set { data.RetailPrice = value; }
|
|
}
|
|
public decimal RetailPricePlanned
|
|
{
|
|
get { return data.RetailPricePlanned; }
|
|
set { data.RetailPricePlanned = value; }
|
|
}
|
|
public SysId UomIdSale
|
|
{
|
|
get { return data.UomIdSale; }
|
|
set { data.UomIdSale = value; }
|
|
}
|
|
public decimal CarriageCostIndicative
|
|
{
|
|
get { return data.CarriageCostIndicative; }
|
|
set { data.CarriageCostIndicative = value; }
|
|
}
|
|
public decimal MinOrderQty
|
|
{
|
|
get { return data.MinOrderQty; }
|
|
set { data.MinOrderQty = value; }
|
|
}
|
|
public decimal PackQtySale
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { data.PackQtySale = value; }
|
|
}
|
|
public SysId TaxCodeId
|
|
{
|
|
get { return data.TaxCodeId; }
|
|
set { data.TaxCodeId = value; }
|
|
}
|
|
public DateTime LastOrderDate
|
|
{
|
|
get { return data.LastOrderDate; }
|
|
set { data.LastOrderDate = value.Date; }
|
|
}
|
|
public decimal LastOrderQty
|
|
{
|
|
get { return data.LastOrderQty; }
|
|
set { data.LastOrderQty = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public decimal QtyInStock
|
|
{
|
|
get { return data.QtyInStock; }
|
|
set { data.QtyInStock = value; }
|
|
}
|
|
public decimal QtyAllocated
|
|
{
|
|
get { return data.QtyAllocated; }
|
|
set { data.QtyAllocated = value; }
|
|
}
|
|
public decimal FreeStock
|
|
{
|
|
get { return data.FreeStock; }
|
|
set { data.FreeStock = value; }
|
|
}
|
|
public DateTime StockTakeDate
|
|
{
|
|
get { return data.StockTakeDate; }
|
|
set { data.StockTakeDate = value.Date; }
|
|
}
|
|
public decimal StockTakeQty
|
|
{
|
|
get { return data.StockTakeQty; }
|
|
set { data.StockTakeQty = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
public SysId CommodityIdSalesProj
|
|
{
|
|
get { return data.CommodityIdSalesProj; }
|
|
set { data.CommodityIdSalesProj = value; }
|
|
}
|
|
public decimal SalesProjAnnual
|
|
{
|
|
get { return data.SalesProjAnnual; }
|
|
set { data.SalesProjAnnual = value; }
|
|
}
|
|
public decimal SalesProjMonth01
|
|
{
|
|
get { return data.SalesProjMonth01; }
|
|
set { data.SalesProjMonth01 = value; }
|
|
}
|
|
public decimal SalesProjMonth02
|
|
{
|
|
get { return data.SalesProjMonth02; }
|
|
set { data.SalesProjMonth02 = value; }
|
|
}
|
|
public decimal SalesProjMonth03
|
|
{
|
|
get { return data.SalesProjMonth03; }
|
|
set { data.SalesProjMonth03 = value; }
|
|
}
|
|
public decimal SalesProjMonth04
|
|
{
|
|
get { return data.SalesProjMonth04; }
|
|
set { data.SalesProjMonth04 = value; }
|
|
}
|
|
public decimal SalesProjMonth05
|
|
{
|
|
get { return data.SalesProjMonth05; }
|
|
set { data.SalesProjMonth05 = value; }
|
|
}
|
|
public decimal SalesProjMonth06
|
|
{
|
|
get { return data.SalesProjMonth06; }
|
|
set { data.SalesProjMonth06 = value; }
|
|
}
|
|
public decimal SalesProjMonth07
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { data.SalesProjMonth07 = value; }
|
|
}
|
|
public decimal SalesProjMonth08
|
|
{
|
|
get { return data.SalesProjMonth08; }
|
|
set { data.SalesProjMonth08 = value; }
|
|
}
|
|
public decimal SalesProjMonth09
|
|
{
|
|
get { return data.SalesProjMonth09; }
|
|
set { data.SalesProjMonth09 = value; }
|
|
}
|
|
public decimal SalesProjMonth10
|
|
{
|
|
get { return data.SalesProjMonth10; }
|
|
set { data.SalesProjMonth10 = value; }
|
|
}
|
|
public decimal SalesProjMonth11
|
|
{
|
|
get { return data.SalesProjMonth11; }
|
|
set { data.SalesProjMonth11 = value; }
|
|
}
|
|
public decimal SalesProjMonth12
|
|
{
|
|
get { return data.SalesProjMonth12; }
|
|
set { data.SalesProjMonth12 = value; }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Projected sales.
|
|
/// <summary>Get projected sale by month (1-12)</summary>
|
|
public decimal GetSalesProj(int month)
|
|
{
|
|
if (month == 1) return SalesProjMonth01;
|
|
else if (month == 2) return SalesProjMonth02;
|
|
else if (month == 3) return SalesProjMonth03;
|
|
else if (month == 4) return SalesProjMonth04;
|
|
else if (month == 5) return SalesProjMonth05;
|
|
else if (month == 6) return SalesProjMonth06;
|
|
else if (month == 7) return SalesProjMonth07;
|
|
else if (month == 8) return SalesProjMonth08;
|
|
else if (month == 9) return SalesProjMonth09;
|
|
else if (month == 10) return SalesProjMonth10;
|
|
else if (month == 11) return SalesProjMonth11;
|
|
else if (month == 12) return SalesProjMonth12;
|
|
// etc
|
|
return 0;
|
|
}
|
|
/// <summary>Set projected sale by month (1-12)</summary>
|
|
public void SetSalesProj(int month, decimal value)
|
|
{
|
|
if (month == 1) SalesProjMonth01 = value;
|
|
else if (month == 2) SalesProjMonth02 = value;
|
|
else if (month == 4) SalesProjMonth04 = value;
|
|
else if (month == 5) SalesProjMonth05 = value;
|
|
else if (month == 6) SalesProjMonth06 = value;
|
|
else if (month == 7) SalesProjMonth07 = value;
|
|
else if (month == 8) SalesProjMonth08 = value;
|
|
else if (month == 9) SalesProjMonth09 = value;
|
|
else if (month == 10) SalesProjMonth10 = value;
|
|
else if (month == 11) SalesProjMonth11 = value;
|
|
else if (month == 12) SalesProjMonth12 = value;
|
|
// etc
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
public decimal SalesPropAnnual
|
|
{
|
|
get { return data.SalesPropAnnual; }
|
|
set { data.SalesPropAnnual = value; }
|
|
}
|
|
public decimal SalesPropMonth01
|
|
{
|
|
get { return data.SalesPropMonth01; }
|
|
set { data.SalesPropMonth01 = value; }
|
|
}
|
|
public decimal SalesPropMonth02
|
|
{
|
|
get { return data.SalesPropMonth02; }
|
|
set { data.SalesPropMonth02 = value; }
|
|
}
|
|
public decimal SalesPropMonth03
|
|
{
|
|
get { return data.SalesPropMonth03; }
|
|
set { data.SalesPropMonth03 = value; }
|
|
}
|
|
public decimal SalesPropMonth04
|
|
{
|
|
get { return data.SalesPropMonth04; }
|
|
set { data.SalesPropMonth04 = value; }
|
|
}
|
|
public decimal SalesPropMonth05
|
|
{
|
|
get { return data.SalesPropMonth05; }
|
|
set { data.SalesPropMonth05 = value; }
|
|
}
|
|
public decimal SalesPropMonth06
|
|
{
|
|
get { return data.SalesPropMonth06; }
|
|
set { data.SalesPropMonth06 = value; }
|
|
}
|
|
public decimal SalesPropMonth07
|
|
{
|
|
get { return data.PackQtySale; }
|
|
set { data.SalesPropMonth07 = value; }
|
|
}
|
|
public decimal SalesPropMonth08
|
|
{
|
|
get { return data.SalesPropMonth08; }
|
|
set { data.SalesPropMonth08 = value; }
|
|
}
|
|
public decimal SalesPropMonth09
|
|
{
|
|
get { return data.SalesPropMonth09; }
|
|
set { data.SalesPropMonth09 = value; }
|
|
}
|
|
public decimal SalesPropMonth10
|
|
{
|
|
get { return data.SalesPropMonth10; }
|
|
set { data.SalesPropMonth10 = value; }
|
|
}
|
|
public decimal SalesPropMonth11
|
|
{
|
|
get { return data.SalesPropMonth11; }
|
|
set { data.SalesPropMonth11 = value; }
|
|
}
|
|
public decimal SalesPropMonth12
|
|
{
|
|
get { return data.SalesPropMonth12; }
|
|
set { data.SalesPropMonth12 = value; }
|
|
}
|
|
//-------------------------------------------------------------------
|
|
// Proported sales.
|
|
/// <summary>Get proported sale by month (1-12)</summary>
|
|
public decimal GetSalesProp(int month)
|
|
{
|
|
if (month == 1) return SalesPropMonth01;
|
|
else if (month == 2) return SalesPropMonth02;
|
|
else if (month == 3) return SalesPropMonth03;
|
|
else if (month == 4) return SalesPropMonth04;
|
|
else if (month == 5) return SalesPropMonth05;
|
|
else if (month == 6) return SalesPropMonth06;
|
|
else if (month == 7) return SalesPropMonth07;
|
|
else if (month == 8) return SalesPropMonth08;
|
|
else if (month == 9) return SalesPropMonth09;
|
|
else if (month == 10) return SalesPropMonth10;
|
|
else if (month == 11) return SalesPropMonth11;
|
|
else if (month == 12) return SalesPropMonth12;
|
|
// etc
|
|
return 0;
|
|
}
|
|
/// <summary>Set proported sale by month (1-12)</summary>
|
|
public void SetSalesProp(int month, decimal value)
|
|
{
|
|
if (month == 1) SalesPropMonth01 = value;
|
|
else if (month == 2) SalesPropMonth02 = value;
|
|
else if (month == 4) SalesPropMonth04 = value;
|
|
else if (month == 5) SalesPropMonth05 = value;
|
|
else if (month == 6) SalesPropMonth06 = value;
|
|
else if (month == 7) SalesPropMonth07 = value;
|
|
else if (month == 8) SalesPropMonth08 = value;
|
|
else if (month == 9) SalesPropMonth09 = value;
|
|
else if (month == 10) SalesPropMonth10 = value;
|
|
else if (month == 11) SalesPropMonth11 = value;
|
|
else if (month == 12) SalesPropMonth12 = value;
|
|
// etc
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Flags.
|
|
public bool SellingProhibited
|
|
{
|
|
get { return GetFlag(Flag_SellingProhibited); }
|
|
set { SetFlag(Flag_SellingProhibited, value); }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Associated data.
|
|
public List<SbmCostEstimate> CostEstimates { get; set; }
|
|
public List<SbmItemProcess> ItemProcesses { get; set; }
|
|
|
|
//-------------------------------------------------------------------
|
|
// P a r a m s
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Commodity status categories.</summary>
|
|
public enum StatusCat
|
|
{
|
|
Any = 0,
|
|
NotDeleted,
|
|
Current,
|
|
}
|
|
/// <summary>Parameters - filters for a List of Commodities</summary>
|
|
public new class Params : SacsHierarchyItem.Params
|
|
{
|
|
// Commodity Ids.
|
|
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
|
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
|
// Commodity.
|
|
public Sbm.CommodityType CommodityType { get; set; }
|
|
public bool StockItemsOnly { get; set; } = false;
|
|
public String CodeFull { get; set; }
|
|
public String CodePartial { get; set; }
|
|
public String DescBriefFull { get; set; }
|
|
public String DescBriefPartial { get; set; }
|
|
public String DrawingNoFull { get; set; }
|
|
public String DrawingNoPartial { get; set; }
|
|
public String DrawingIssueFull { get; set; }
|
|
public String DrawingIssuePartial { get; set; }
|
|
/// <summary>Generic search value - code, descriptions, drawing no etc.</summary>
|
|
public String Search { get; set; }
|
|
// Category.
|
|
public String CatalogRefPartial { get; set; }
|
|
public HashSet<String> Categories { get; } = new HashSet<string>();
|
|
// Customer.
|
|
public SysId AssociationIdCustomer { get; set; }
|
|
public String CustomerName { get; set; }
|
|
public SysId AssociationIdCommodityCustomer { get; set; }
|
|
public String AccountCodeCommodityCustomer { get; set; }
|
|
// Supplier.
|
|
public SysId AssociationIdSupplier { get; set; }
|
|
public String SupplierName { get; set; }
|
|
// Order references.
|
|
public String OrderRef { get; set; }
|
|
public String SalesOrderRef { get; set; }
|
|
public String PurchaseOrderRef { get; set; }
|
|
// Codes.
|
|
public String RangeCode { get; set; }
|
|
public String ColourCode { get; set; }
|
|
public String SourceCode { get; set; }
|
|
public String SupplyMethodCode { get; set; }
|
|
public String HandlingCode { get; set; }
|
|
public String DeliveryCode { get; set; }
|
|
public String MaterialCode { get; set; }
|
|
public String FinishCode { get; set; }
|
|
public String PromotionCode { get; set; }
|
|
// Price Set.
|
|
public HashSet<SysId> PriceSetIdsIncluded { get; } = new HashSet<SysId>();
|
|
public HashSet<SysId> PriceSetIdsExcluded { get; } = new HashSet<SysId>();
|
|
// Stock Control.
|
|
public Sbm.LocationFilter StockLocationFilter { get; set; }
|
|
public SysId LocationIdStock { get; set; }
|
|
public DateTime StockSoldFrom { get; set; }
|
|
public DateTime StockSoldTo { get; set; }
|
|
public DateTime ProjectedSalesFrom { get; set; }
|
|
public DateTime ProjectedSalesTo { get; set; }
|
|
// Stock level.
|
|
public decimal StockLevelMin { get; set; } = decimal.MinValue;
|
|
public decimal StockLevelMax { get; set; } = decimal.MinValue;
|
|
// Portfolio.
|
|
public SysId PortfolioIdInclude { get; set; }
|
|
public SysId PortfolioIdExclude { get; set; }
|
|
public SysId PortfolioForItemCountId { get; set; }
|
|
// Currency.
|
|
public SysId CurrencyIdMaterial { get; set; }
|
|
public SysId CurrencyIdExWorks { get; set; }
|
|
// Price.
|
|
public decimal SalesPrice { get; set; }
|
|
public decimal RetailPrice { get; set; }
|
|
public SysId UomIdSale { get; set; }
|
|
public SysId TaxCodeId { get; set; }
|
|
public DateTime StockTakeDateTime { get; set; }
|
|
public SysId CommodityIdSalesProj { get; set; }
|
|
public decimal SalesProjAnnual { get; set; }
|
|
/// <summary>Commodity status.</summary>
|
|
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
|
// Utilities.
|
|
public List<StringPair> GetDisplayValues(SbmInternals internals)
|
|
{
|
|
List<StringPair> values = new List<StringPair>();
|
|
// Commodities to exclude.
|
|
if (IdsIncluded.Count > 0) values.Add("Included commodities", IdsIncluded.Count.ToString());
|
|
if (IdsExcluded.Count > 0) values.Add("Excluded commodities", IdsExcluded.Count.ToString());
|
|
// Commodity type.
|
|
if (CommodityType > 0) values.Add("Type", SbmSystem.GetSystemCodes(Sbm.ApplicationCode.CommodityType).GetDescForType(CommodityType, CommodityType.ToString()));
|
|
else if (CommodityType == Sbm.CommodityType.AnyProduct) values.Add("Type", "Any product");
|
|
if (StockItemsOnly) values.Add("Stock items only", "True");
|
|
// Commodity code.
|
|
if (!StringUtil.IsEmpty(CodeFull)) values.Add("Code", CodeFull);
|
|
else if (!StringUtil.IsEmpty(CodePartial)) values.Add("Code contains", CodePartial);
|
|
// Drawing number.
|
|
if (!StringUtil.IsEmpty(DrawingNoFull)) values.Add("Drawing no", DrawingNoFull);
|
|
else if (!StringUtil.IsEmpty(DrawingNoPartial)) values.Add("Drawing no starts", DrawingNoPartial);
|
|
if (!StringUtil.IsEmpty(DrawingIssueFull)) values.Add("Drawing issue", DrawingIssueFull);
|
|
else if (!StringUtil.IsEmpty(DrawingIssuePartial)) values.Add("Drawing issue starts", DrawingIssuePartial);
|
|
// Commodity description.
|
|
if (!StringUtil.IsEmpty(DescBriefFull)) values.Add("Description", DescBriefFull);
|
|
if (!StringUtil.IsEmpty(DescBriefPartial)) values.Add("Description starts", DescBriefPartial);
|
|
// Category.
|
|
if (Categories.Count > 0) values.Add("Categories", Categories.Concat(","));
|
|
// Catalog reference.
|
|
if (!StringUtil.IsEmpty(CatalogRefPartial)) values.Add("Catalog ref start", CatalogRefPartial);
|
|
// Codings.
|
|
if (!StringUtil.IsEmpty(RangeCode)) values.Add("Range code", RangeCode);
|
|
if (!StringUtil.IsEmpty(ColourCode)) values.Add("Colour code", ColourCode);
|
|
if (!StringUtil.IsEmpty(SourceCode)) values.Add("Source code", SourceCode);
|
|
if (!StringUtil.IsEmpty(SupplyMethodCode)) values.Add("SupplyMethod code", SupplyMethodCode);
|
|
if (!StringUtil.IsEmpty(HandlingCode)) values.Add("Handling code", HandlingCode);
|
|
if (!StringUtil.IsEmpty(DeliveryCode)) values.Add("Delivery code", DeliveryCode);
|
|
if (!StringUtil.IsEmpty(MaterialCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode);
|
|
if (!StringUtil.IsEmpty(FinishCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode);
|
|
if (!StringUtil.IsEmpty(PromotionCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode);
|
|
// Price sets.
|
|
if (PriceSetIdsIncluded.Count > 0) values.Add("Included in price sets", PriceSetIdsIncluded.Count.ToString());
|
|
if (PriceSetIdsExcluded.Count > 0) values.Add("Excluded from price sets", PriceSetIdsExcluded.Count.ToString());
|
|
// Customer.
|
|
if (SysId.IsValid(AssociationIdCustomer))
|
|
values.Add("Customer", internals.AccountMgr.GetAssociationTargetName(AssociationIdCustomer));
|
|
if (!StringUtil.IsEmpty(CustomerName)) values.Add("Customer name starts", CustomerName);
|
|
if (!StringUtil.IsEmpty(SupplierName)) values.Add("Supplier name starts", SupplierName);
|
|
if (!StringUtil.IsEmpty(SalesOrderRef)) values.Add("SO reference starts", SalesOrderRef);
|
|
if (!StringUtil.IsEmpty(PurchaseOrderRef)) values.Add("PO reference starts", PurchaseOrderRef);
|
|
|
|
// Transaction.
|
|
if (!StringUtil.IsEmpty(OrderRef)) values.Add("Transaction reference", OrderRef);
|
|
|
|
// Stock:
|
|
if (StockLocationFilter == Sbm.LocationFilter.Sales) values.Add("Stock location", "Sales locations only");
|
|
else if (StockLocationFilter == Sbm.LocationFilter.Calc) values.Add("Stock location", "Calculated locations only");
|
|
else if (StockLocationFilter == Sbm.LocationFilter.All) values.Add("Stock location", "All locations");
|
|
if (SysId.IsValid(LocationIdStock)) values.Add("Stock location", SysId.ToString(LocationIdStock));
|
|
if (DateUtil.IsValid(StockSoldFrom)) values.Add("Stock sold from", DateUtil.Format(StockSoldFrom, "d-MMM-yyyy"));
|
|
if (DateUtil.IsValid(StockSoldTo)) values.Add("Stock sold to", DateUtil.Format(StockSoldTo, "d-MMM-yyyy"));
|
|
if (DateUtil.IsValid(ProjectedSalesFrom)) values.Add("Proj sales from", DateUtil.Format(ProjectedSalesFrom, "d-MMM-yyyy"));
|
|
if (DateUtil.IsValid(ProjectedSalesTo)) values.Add("Proj sales to", DateUtil.Format(ProjectedSalesTo, "d-MMM-yyyy"));
|
|
|
|
if (StockLevelMin > decimal.MinValue) values.Add("Stock level >= ", StockLevelMin.ToString("N2"));
|
|
if (StockLevelMax > decimal.MinValue) values.Add("Stock level <= ", StockLevelMax.ToString("N2"));
|
|
|
|
// Commodities with definitions for Customer.
|
|
if (SysId.IsValid(AssociationIdCommodityCustomer))
|
|
values.Add("Commodity definitions for customer", internals.AccountMgr.GetAssociationTargetName(AssociationIdCommodityCustomer));
|
|
if (!StringUtil.IsEmpty(AccountCodeCommodityCustomer))
|
|
values.Add("Commodity definitions for customer", AccountCodeCommodityCustomer);
|
|
|
|
// Commodity status category.
|
|
if (StatusCat == StatusCat.Current)
|
|
values.Add("Status", "Current");
|
|
|
|
// Portfolio:
|
|
//PortfolioIdInclude;
|
|
//PortfolioIdExclude;
|
|
return values;
|
|
}
|
|
}
|
|
}
|
|
//=======================================================================
|
|
// C o m m o d i t y D a t a L i s t
|
|
//=======================================================================
|
|
public static class SbmCommodityList
|
|
{
|
|
/// <summary>Check whether commodity exists/locate in list with specified Id.</summary>
|
|
public static bool FindById(this List<SbmCommodity> values, SysId commodityId)
|
|
{
|
|
if (!SysId.IsValid(commodityId)) return false;
|
|
return values.Exists(item => item.Id.Equals(commodityId));
|
|
}
|
|
public static bool FindByType(this List<SbmCommodity> values, String commodityType)
|
|
{
|
|
if (StringUtil.IsEmpty(commodityType)) return false;
|
|
return values.Exists(item => item.CommodityType.ToString().EqualsCI(commodityType));
|
|
}
|
|
public static bool FindByCode(this List<SbmCommodity> values, String commodityCode)
|
|
{
|
|
if (StringUtil.IsEmpty(commodityCode)) return false;
|
|
return values.Exists(item => item.Code.EqualsCI(commodityCode));
|
|
}
|
|
}
|
|
//=======================================================================
|
|
}
|