Bladeren bron

Updated PRS Avalonia usages of double

Kenric Nugteren 2 weken geleden
bovenliggende
commit
0e02a143d0

+ 4 - 4
PRS.Avalonia/PRS.Avalonia/Modules/PurchaseOrders/PurchaseOrder/PurchaseOrderItemView.axaml.cs

@@ -7,16 +7,16 @@ using InABox.Avalonia.Converters;
 
 namespace PRS.Avalonia.Modules;
 
-public class NullToZeroConverter : AbstractConverter<double, decimal?>
+public class NullToZeroConverter : AbstractConverter<decimal, decimal?>
 {
-    protected override decimal? Convert(double value, object? parameter = null)
+    protected override decimal? Convert(decimal value, object? parameter = null)
     {
         return (decimal)value;
     }
 
-    protected override double Deconvert(decimal? value, object? parameter = null)
+    protected override decimal Deconvert(decimal? value, object? parameter = null)
     {
-        return value == null ? 0 : (double)value;
+        return value ?? 0;
     }
 }
 public partial class PurchaseOrderItemView : UserControl

+ 15 - 15
PRS.Avalonia/PRS.Avalonia/Modules/WarehouseModule/Common/DimensionsEditor/DimensionsEditorViewModel.cs

@@ -12,11 +12,11 @@ namespace PRS.Avalonia.Modules;
 
 public class BaseDimensions : IBaseDimensions
 {
-    public double Quantity { get; set; }
-    public double Length { get; set; }
-    public double Width { get; set; }
-    public double Height { get; set; }
-    public double Weight { get; set; }
+    public decimal Quantity { get; set; }
+    public decimal Length { get; set; }
+    public decimal Width { get; set; }
+    public decimal Height { get; set; }
+    public decimal Weight { get; set; }
 }
 
 public partial class DimensionsEditorViewModel : BasePopupViewModel<BaseDimensions?>, IAlignedPopup
@@ -62,11 +62,11 @@ public partial class DimensionsEditorViewModel : BasePopupViewModel<BaseDimensio
 
     partial void OnSelectedInstanceChanged(ProductInstanceShell? value)
     {
-        Length = value?.Length ?? 0.0;
-        Height = value?.Height ?? 0.0;
-        Width = value?.Width ?? 0.0;
-        Weight = value?.Weight ?? 0.0;
-        Quantity = value?.Quantity ?? 0.0;
+        Length = value?.Length ?? 0;
+        Height = value?.Height ?? 0;
+        Width = value?.Width ?? 0;
+        Weight = value?.Weight ?? 0;
+        Quantity = value?.Quantity ?? 0;
     }
 
     // [ObservableProperty] private bool _hasLength;
@@ -79,15 +79,15 @@ public partial class DimensionsEditorViewModel : BasePopupViewModel<BaseDimensio
     //
     // [ObservableProperty] private bool _hasWeight;
 
-    [ObservableProperty] private double _length;
+    [ObservableProperty] private decimal _length;
 
-    [ObservableProperty] private double _width;
+    [ObservableProperty] private decimal _width;
 
-    [ObservableProperty] private double _height;
+    [ObservableProperty] private decimal _height;
 
-    [ObservableProperty] private double _quantity;
+    [ObservableProperty] private decimal _quantity;
 
-    [ObservableProperty] private double _weight;
+    [ObservableProperty] private decimal _weight;
 
     public DimensionsEditorViewModel()
     {

+ 11 - 11
PRS.Avalonia/PRS.Avalonia/Repositories/Product/ProductShell.cs

@@ -33,20 +33,20 @@ public class ProductShell : Shell<ProductModel, Product>
     public string DefaultStyleDescription => Get<string>();
 
     public Guid DimensionsUnitID => Get<Guid>();
-    public double DimensionsQuantity => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Quantity);
-    public double DimensionsLength => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Length);
-    public double DimensionsWidth => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Width);
-    public double DimensionsHeight => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Height);
-    public double DimensionsWeight => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Weight);
-    public double DimensionsValue => Row.Get<Product, double>(x => x.DefaultInstance.Dimensions.Value);
+    public decimal DimensionsQuantity => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Quantity);
+    public decimal DimensionsLength => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Length);
+    public decimal DimensionsWidth => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Width);
+    public decimal DimensionsHeight => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Height);
+    public decimal DimensionsWeight => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Weight);
+    public decimal DimensionsValue => Row.Get<Product, decimal>(x => x.DefaultInstance.Dimensions.Value);
     public string DimensionsUnitSize => Row.Get<Product, string>(x => x.DefaultInstance.Dimensions.UnitSize);
 
-    public double AverageCost => Get<double>();
+    public decimal AverageCost => Get<decimal>();
 
-    public double Units => Get<double>();
-    public double TotalStock => Get<double>();
-    public double ReservedStock => Get<double>();
-    public double AvailableStock => TotalStock - ReservedStock;
+    public decimal Units => Get<decimal>();
+    public decimal TotalStock => Get<decimal>();
+    public decimal ReservedStock => Get<decimal>();
+    public decimal AvailableStock => TotalStock - ReservedStock;
 
     // public ProductDimensionUnitShell DimensionsUnit =>
     //     App.Data.ProductDimensionUnits.FirstOrDefault(x => x.ID == DimensionsUnitID);

+ 8 - 8
PRS.Avalonia/PRS.Avalonia/Repositories/ProductInstance/ProductInstanceShell.cs

@@ -7,15 +7,15 @@ namespace PRS.Avalonia;
 public class ProductInstanceShell : Shell<ProductInstanceModel, ProductInstance>
 {
     public Guid ProductID { get; set; }
-    public double Height => Get<double>();
-    public double Length => Get<double>();
-    public double Width => Get<double>();
-    public double Weight => Get<double>();
-    public double Quantity => Get<double>();
-    public double Value => Get<double>();
+    public decimal Height => Get<decimal>();
+    public decimal Length => Get<decimal>();
+    public decimal Width => Get<decimal>();
+    public decimal Weight => Get<decimal>();
+    public decimal Quantity => Get<decimal>();
+    public decimal Value => Get<decimal>();
     public string UnitSize => Get<string>();
-    public double NettCost => Get<double>();
-    public double AverageCost => Get<double>();
+    public decimal NettCost => Get<decimal>();
+    public decimal AverageCost => Get<decimal>();
 
     protected override void ConfigureColumns(ShellColumns<ProductInstanceModel, ProductInstance> columns)
     {

+ 2 - 2
PRS.Avalonia/PRS.Avalonia/Repositories/PurchaseOrder/PurchaseOrderShell.cs

@@ -28,8 +28,8 @@ public class PurchaseOrderShell : Shell<PurchaseOrderModel, PurchaseOrder>
     }
     public DateTime DueDate => Get<DateTime>();
     public DateTime IssuedDate => Get<DateTime>();
-    public double Received => Get<double>();
-    public double Unreceived => Get<double>();
+    public decimal Received => Get<decimal>();
+    public decimal Unreceived => Get<decimal>();
     public DateTime ClosedDate => Get<DateTime>();
     public DateTime CancelledDate => Get<DateTime>();
 

+ 2 - 2
PRS.Avalonia/PRS.Avalonia/Repositories/PurchaseOrderItem/PurchaseOrderItemShell.cs

@@ -45,9 +45,9 @@ public class PurchaseOrderItemShell : Shell<PurchaseOrderItemModel, PurchaseOrde
         set => Set(value);
     }
 
-    public double Qty
+    public decimal Qty
     {
-        get => Get<double>(); 
+        get => Get<decimal>(); 
         set => Set(value);
     }
 

+ 18 - 18
PRS.Avalonia/PRS.Avalonia/Repositories/Requisition/RequisitionItemShell.cs

@@ -61,42 +61,42 @@ public class RequisitionItemShell : Shell<RequisitionItemModel, RequisitionItem>
         set => Set(value);
     }
 
-    public double DimensionsQuantity
+    public decimal DimensionsQuantity
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double DimensionsLength
+    public decimal DimensionsLength
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsWidth
+    public decimal DimensionsWidth
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsHeight
+    public decimal DimensionsHeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsWeight
+    public decimal DimensionsWeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double DimensionsValue
+    public decimal DimensionsValue
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
@@ -113,15 +113,15 @@ public class RequisitionItemShell : Shell<RequisitionItemModel, RequisitionItem>
         set => Set(value);
     }
 
-    public double Quantity
+    public decimal Quantity
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double ActualQuantity
+    public decimal ActualQuantity
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
@@ -157,9 +157,9 @@ public class RequisitionItemShell : Shell<RequisitionItemModel, RequisitionItem>
         set => Set(value);
     }
 
-    public double Cost
+    public decimal Cost
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 

+ 18 - 18
PRS.Avalonia/PRS.Avalonia/Repositories/StockHolding/StockHoldingShell.cs

@@ -129,9 +129,9 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         set => Set(value);
     }
 
-    public double DimensionsQuantity
+    public decimal DimensionsQuantity
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value, notify: nameof(DimensionsUnitSize));
     }
 
@@ -141,9 +141,9 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         set => Set(value);
     }
 
-    public double DimensionsLength
+    public decimal DimensionsLength
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value, notify: nameof(DimensionsUnitSize));
     }
 
@@ -153,9 +153,9 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         set => Set(value);
     }
 
-    public double DimensionsWidth
+    public decimal DimensionsWidth
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value, notify: nameof(DimensionsUnitSize));
     }
 
@@ -165,9 +165,9 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         set => Set(value);
     }
 
-    public double DimensionsHeight
+    public decimal DimensionsHeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value, notify: nameof(DimensionsUnitSize));
     }
 
@@ -177,15 +177,15 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         set => Set(value);
     }
 
-    public double DimensionsWeight
+    public decimal DimensionsWeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value, notify: nameof(DimensionsUnitSize));
     }
 
-    public double DimensionsValue
+    public decimal DimensionsValue
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
@@ -227,21 +227,21 @@ public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
         }
     }
 
-    public double Units
+    public decimal Units
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double Available
+    public decimal Available
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double AverageCost
+    public decimal AverageCost
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 

+ 1 - 1
PRS.Avalonia/PRS.Avalonia/Repositories/StockLocation/StockLocationShell.cs

@@ -109,7 +109,7 @@ public class StockLocationShell : Shell<StockLocationModel, StockLocation>
         set => Set(value);
     }
 
-    public double Holdings => Get<double>();
+    public decimal Holdings => Get<decimal>();
 
     public Guid StocktakeId
     {

+ 22 - 22
PRS.Avalonia/PRS.Avalonia/Repositories/StockMovement/StockMovementShell.cs

@@ -95,42 +95,42 @@ public class StockMovementShell : Shell<StockMovementModel, StockMovement>
         set => Set(value);
     }
 
-    public double DimensionsQuantity
+    public decimal DimensionsQuantity
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double DimensionsLength
+    public decimal DimensionsLength
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsWidth
+    public decimal DimensionsWidth
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsHeight
+    public decimal DimensionsHeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
 
-    public double DimensionsWeight
+    public decimal DimensionsWeight
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double DimensionsValue
+    public decimal DimensionsValue
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
@@ -178,31 +178,31 @@ public class StockMovementShell : Shell<StockMovementModel, StockMovement>
         set => Set(value);
     }
 
-    public double Received
+    public decimal Received
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double Issued
+    public decimal Issued
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double Units => Received - Issued;
+    public decimal Units => Received - Issued;
 
-    public double Qty => Units * DimensionsValue;
+    public decimal Qty => Units * DimensionsValue;
 
-    public double Cost
+    public decimal Cost
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }
 
-    public double Balance
+    public decimal Balance
     {
-        get => Get<double>();
+        get => Get<decimal>();
         set => Set(value);
     }