Browse Source

Added Comparison column and "Show only problems" button to bill screen.
Made some more columns of POItemLinks visible.

Kenric Nugteren 10 tháng trước cách đây
mục cha
commit
5413e9fbdb

+ 5 - 6
prs.classes/Entities/PurchaseOrder/PurchaseOrderItemLink.cs

@@ -45,20 +45,19 @@ namespace Comal.Classes
         
         [NullEditor]
         public ConsignmentLink Consignment { get; set; }
-        
-        [NullEditor]
+
+        [CurrencyEditor]
         public double ExTax { get; set; }
         
-        [NullEditor]
         public TaxCodeLink TaxCode { get; set; }
-        
+
         [NullEditor]
         public double TaxRate { get; set; }
         
-        [NullEditor]
+        [CurrencyEditor]
         public double Tax { get; set; }
         
-        [NullEditor]
+        [CurrencyEditor]
         public double IncTax { get; set; }
         
         [NullEditor]

+ 59 - 0
prs.desktop/Panels/Suppliers/Bills/SupplierBillLineGrid.cs

@@ -20,6 +20,11 @@ namespace PRSDesktop;
 public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
 {
     private static readonly BitmapImage pencil = InABox.Wpf.Resources.pencil.AsBitmapImage();
+    private static readonly BitmapImage up = PRSDesktop.Resources.red_up_arrow.AsBitmapImage();
+    private static readonly BitmapImage down = PRSDesktop.Resources.green_down_arrow.AsBitmapImage();
+
+    private bool OnlyShowProblems = false;
+    private Button ShowProblemsButton;
 
     public SupplierBillLineGrid()
     {
@@ -58,6 +63,7 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
         HiddenColumns.Add(x=>x.OrderItem.Tax);
         HiddenColumns.Add(x=>x.OrderItem.IncTax);
 
+        ActionColumns.Add(new DynamicImageColumn(Comparison_Image) { Position = DynamicActionColumnPosition.Start });
         ActionColumns.Add(
             new DynamicTextColumn(DisplayLinkText,DisplayLinkClick)
             {
@@ -70,6 +76,43 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
         );
         
         ActionColumns.Add(new DynamicImageColumn(pencil, BillLineEdit_Click));
+
+        ShowProblemsButton = AddButton("Only Show Problems", null, ShowProblems_Click);
+    }
+
+    private bool ShowProblems_Click(Button button, CoreRow[] rows)
+    {
+        OnlyShowProblems = !OnlyShowProblems;
+        if (OnlyShowProblems)
+        {
+            UpdateButton(ShowProblemsButton, null, "Show All");
+        }
+        else
+        {
+            UpdateButton(ShowProblemsButton, null, "Only Show Problems");
+        }
+        return true;
+    }
+
+    private BitmapImage? Comparison_Image(CoreRow? row)
+    {
+        if(row is null || row.Get<BillLine, Guid>(x => x.OrderItem.PurchaseOrderLink.ID) == Guid.Empty)
+        {
+            return null;
+        }
+        var diff = row.Get<BillLine, double>(x => x.IncTax).CompareTo(row.Get<BillLine, double>(x => x.OrderItem.IncTax));
+        if(diff < 0) // Bill < PO
+        {
+            return down;
+        }
+        else if(diff > 0)
+        {
+            return up;
+        }
+        else
+        {
+            return null;
+        }
     }
 
     private object DisplayLinkText(CoreRow? row)
@@ -586,6 +629,22 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
         
     }
 
+    protected override bool FilterRecord(CoreRow row)
+    {
+        if (!base.FilterRecord(row))
+        {
+            return false;
+        }
+        if (OnlyShowProblems && row.Get<BillLine, Guid>(x => x.OrderItem.PurchaseOrderLink.ID) != Guid.Empty)
+        {
+            if(row.Get<BillLine, double>(x => x.IncTax) <= row.Get<BillLine, double>(x => x.OrderItem.IncTax))
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
     protected override void HandleDragOver(object sender, DragEventArgs e)
     {
         base.HandleDragOver(sender, e);

+ 21 - 0
prs.desktop/Resources.Designer.cs

@@ -1,6 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -746,6 +747,16 @@ namespace PRSDesktop {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        /// </summary>
+        internal static System.Drawing.Bitmap green_down_arrow {
+            get {
+                object obj = ResourceManager.GetObject("green_down_arrow", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized resource of type System.Drawing.Bitmap.
         /// </summary>
@@ -1276,6 +1287,16 @@ namespace PRSDesktop {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        /// </summary>
+        internal static System.Drawing.Bitmap red_up_arrow {
+            get {
+                object obj = ResourceManager.GetObject("red_up_arrow", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized resource of type System.Drawing.Bitmap.
         /// </summary>

+ 15 - 9
prs.desktop/Resources.resx

@@ -776,28 +776,34 @@
   <data name="post" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>Resources\post.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="schedule_overdue"  type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\schedule - overdue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
+  <data name="schedule_overdue" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>.\Resources\schedule - overdue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
           Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="notification"  type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\notification.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
+  <data name="notification" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>.\Resources\notification.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
           Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="logikal"  type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\logikal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
+  <data name="logikal" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>.\Resources\logikal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0,
           Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
   <data name="v6" type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\v6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
+    <value>.\Resources\v6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
   <data name="sage" type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\sage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
+    <value>.\Resources\sage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
   <data name="myob" type="System.Resources.ResXFileRef, System.Windows.Forms">
-      <value>.\Resources\myob.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
+    <value>.\Resources\myob.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="green_down_arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>Resources\green_down_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="red_up_arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>Resources\red_up_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>

BIN
prs.desktop/Resources/green_down_arrow.png


BIN
prs.desktop/Resources/red_up_arrow.png