Browse Source

Fixed PurchaseOrderItem not calculating correctly.

Kenric Nugteren 1 year ago
parent
commit
b881ee269c
2 changed files with 22 additions and 12 deletions
  1. 16 11
      prs.classes/Entities/PurchaseOrder/PurchaseOrderItem.cs
  2. 6 1
      prs.server/PRSServer.csproj

+ 16 - 11
prs.classes/Entities/PurchaseOrder/PurchaseOrderItem.cs

@@ -247,21 +247,26 @@ namespace Comal.Classes
             if (bChanging)
                 return;
 
-            bChanging = true;
-
-            if (qty.IsEqualTo(name))
-                ExTax = (double)after /* * Dimensions.Value */ * Cost;
+            try
+            {
+                bChanging = true;
 
-            else if (cost.IsEqualTo(name))
-                ExTax = Qty /* * Dimensions.Value */ * (double)after;
+                if (qty.IsEqualTo(name))
+                    ExTax = (double)after /* * Dimensions.Value */ * Cost;
 
-            else if (inctax.IsEqualTo(name))
-                Balance = ReceivedDate.IsEmpty() ? (double)after : 0.00F;
+                else if (cost.IsEqualTo(name))
+                    ExTax = Qty /* * Dimensions.Value */ * (double)after;
 
-            else if (received.IsEqualTo(name))
-                Balance = ((DateTime)after).IsEmpty() ? IncTax : 0.00F;
+                else if (inctax.IsEqualTo(name))
+                    Balance = ReceivedDate.IsEmpty() ? (double)after : 0.00F;
 
-            bChanging = false;
+                else if (received.IsEqualTo(name))
+                    Balance = ((DateTime)after).IsEmpty() ? IncTax : 0.00F;
+            }
+            finally
+            {
+                bChanging = false;
+            }
             base.DoPropertyChanged(name, before, after);
         }
     }

+ 6 - 1
prs.server/PRSServer.csproj

@@ -12,7 +12,7 @@
         <AssemblyName>PRSServer</AssemblyName>
         <RootNamespace>$(AssemblyName)</RootNamespace>
         <StartupObject>PRSServer.App</StartupObject>
-        <Configurations>Debug;Release</Configurations>
+        <Configurations>Debug;Release;Debug - DB</Configurations>
         <ApplicationIcon>hollow.ico</ApplicationIcon>
 		<PreserveCompilationContext>true</PreserveCompilationContext>
     </PropertyGroup>
@@ -22,6 +22,11 @@
         <Optimize>False</Optimize>
     </PropertyGroup>
 
+    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - DB|AnyCPU'">
+      <NoWarn />
+      <Optimize>False</Optimize>
+    </PropertyGroup>
+
     <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
         <NoWarn></NoWarn>
         <Optimize>True</Optimize>