Explorar o código

Added ProductPrice Enclosed Entity

Frank van den Bos %!s(int64=2) %!d(string=hai) anos
pai
achega
d96f242c15

+ 8 - 1
prs.classes/Entities/Product/Product.cs

@@ -98,7 +98,11 @@ namespace Comal.Classes
 
         [EditorSequence("Pricing", 12)]
         public CostSheetSectionLink CostSheetSection { get; set; }
-
+        
+        [ProductPriceEditor]
+        [EditorSequence("Pricing", 99)]
+        public ProductPrice Pricing { get; set; }
+        
         /// <summary>
         ///     Flag to indicate whether stock movements are to be tracked for this item
         ///     If set, no stock movements will be recorded, even if the Warehouse and/or default location are set
@@ -176,6 +180,8 @@ namespace Comal.Classes
         {
             return string.Format("{0}: {1} ({2})", Code, Name, Dimensions.UnitSize);
         }
+        
+
 
         protected override void Init()
         {
@@ -202,6 +208,7 @@ namespace Comal.Classes
             UseDefaultSupplierPricing = true;
         
             Dimensions = new ProductDimensions(() => this);
+            Pricing = new ProductPrice();
         }
 
 

+ 4 - 0
prs.classes/Entities/Product/ProductLink.cs

@@ -71,6 +71,9 @@ namespace Comal.Classes
 
         [CheckBoxEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
         public ProductPricingStrategy PricingStrategy { get; set; }
+        
+        [NullEditor]
+        public ProductPrice Pricing { get; set; }
 
         [NullEditor]
         public DigitalFormLink DigitalForm { get; set; }
@@ -92,6 +95,7 @@ namespace Comal.Classes
             DigitalForm = new DigitalFormLink();
             Group = new ProductGroupLink();
             Dimensions = new ProductDimensions(LinkedEntity);
+            Pricing = new ProductPrice();
         }
     }
 

+ 30 - 0
prs.classes/Entities/Product/ProductPrice.cs

@@ -0,0 +1,30 @@
+using InABox.Core;
+
+namespace Comal.Classes
+{
+    public enum ProductPriceType
+    {
+        FixedPrice,
+        CostPlus
+    }
+
+    public class ProductPrice :  BaseObject, IEnclosedEntity
+    {
+        [EnumLookupEditor(typeof(ProductPriceType))]
+        public ProductPriceType PriceType { get; set; }
+        
+        [CurrencyEditor]
+        public double Price { get; set; }
+        
+        [EditorSequence("Pricing",13)]
+        public double Markup { get; set; }
+    }
+    
+    public class ProductPriceEditor : BaseEditor
+    {
+        protected override BaseEditor DoClone()
+        {
+            return new ProductPriceEditor();
+        }
+    }
+}