Kaynağa Gözat

Merge branch 'frank' of http://192.168.100.242:3000/PRSDigital/prs into frank

Frank van den Bos 1 yıl önce
ebeveyn
işleme
0ea9a19c70

+ 2 - 0
prs.desktop/Grids/TimesheetGrid.cs

@@ -19,6 +19,7 @@ namespace PRSDesktop
 
         private LeaveRequestGrid leavegrid;
 
+        private readonly BitmapImage post = PRSDesktop.Resources.post.AsBitmapImage();
         private readonly BitmapImage tick = PRSDesktop.Resources.tick.AsBitmapImage();
         private readonly BitmapImage warning = PRSDesktop.Resources.warning.AsBitmapImage();
 
@@ -44,6 +45,7 @@ namespace PRSDesktop
 
             //ActionColumns.Add(new DynamicImageColumn() { Image = WarningImage });
             ActionColumns.Add(new DynamicTickColumn<TimeSheet, DateTime>(x => x.Approved, tick, tick, null));
+            ActionColumns.Add(new DynamicTickColumn<TimeSheet, DateTime>(x => x.Processed, post, tick, null));
 
             HiddenColumns.Add(x => x.Date);
 

+ 4 - 0
prs.desktop/PRSDesktop.csproj

@@ -739,6 +739,10 @@
         <Resource Include="Resources\calendar.png">
           <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Resource>
+        <None Remove="Resources\money.png" />
+        <Resource Include="Resources\post.png">
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+        </Resource>
     </ItemGroup>
 
     <ItemGroup>

+ 23 - 30
prs.desktop/Panels/DataEntry/DataEntryPanel.xaml

@@ -8,42 +8,35 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>
-        <dynamic:DynamicSplitPanel View="Combined" AnchorWidth="600" Anchor="Detail" AllowableViews="Combined">
-            
-            <dynamic:DynamicSplitPanel.Header>
-                <Border BorderBrush="Gray" BorderThickness="0.75" Background="WhiteSmoke">
-                    <Label Content="Available Documents" HorizontalContentAlignment="Center"
-                       VerticalContentAlignment="Center" />
-                </Border>
-            </dynamic:DynamicSplitPanel.Header>
+        <dynamic:DynamicSplitPanel View="Combined" AnchorWidth="500" Anchor="Master" AllowableViews="Combined">
             
             <dynamic:DynamicSplitPanel.Master>
                 <local:ScanPanel x:Name="ScanPanel" OnSelectAppliesTo="ScanPanel_OnSelectAppliesTo"/>
             </dynamic:DynamicSplitPanel.Master>
             
-            <dynamic:DynamicSplitPanel.DetailHeader>
-                <Border BorderBrush="Gray" BorderThickness="0.75" Background="WhiteSmoke">
-                    <DockPanel x:Name="DetailHeader">
-                        <Label Content="Type"
-                               Margin="5"
-                              DockPanel.Dock="Left"/>
-                        <ComboBox Name="TypeBox"
-                                  Margin="0,5,5,5"
-                                  Width="120"
-                                  DockPanel.Dock="Left"
-                                  VerticalContentAlignment="Center"
-                                  SelectionChanged="TypeBox_SelectionChanged"/>
-                        <Label Content="Item"
-                               Margin="5"
-                               DockPanel.Dock="Left"/>                       
-                    </DockPanel>
-                </Border>
-            </dynamic:DynamicSplitPanel.DetailHeader>
-            
             <dynamic:DynamicSplitPanel.Detail>
-                <Border BorderBrush="Gray" BorderThickness="0.75" x:Name="DetailBorder">
-                    <dynamic:EmbeddedDynamicEditorForm x:Name="Editor"/>
-                </Border>
+                <DockPanel>
+                    <Border BorderBrush="Gray" BorderThickness="0.75" Background="WhiteSmoke" DockPanel.Dock="Top">
+                        <DockPanel x:Name="DetailHeader">
+                            <Label Content="Type"
+                                   Margin="5"
+                                   DockPanel.Dock="Left"/>
+                            <ComboBox Name="TypeBox"
+                                      Margin="0,5,5,5"
+                                      Width="120"
+                                      DockPanel.Dock="Left"
+                                      VerticalContentAlignment="Center"
+                                      SelectionChanged="TypeBox_SelectionChanged"/>
+                            <Label Content="Item"
+                                   Margin="5"
+                                   DockPanel.Dock="Left"/>                       
+                        </DockPanel>
+                    </Border>
+                    
+                    <Border BorderBrush="Gray" BorderThickness="0.75" x:Name="DetailBorder" DockPanel.Dock="Bottom" Margin="0,5,0,0">
+                        <dynamic:EmbeddedDynamicEditorForm x:Name="Editor"/>
+                    </Border>
+                </DockPanel>
             </dynamic:DynamicSplitPanel.Detail>
         </dynamic:DynamicSplitPanel>
     </Grid>

+ 2 - 23
prs.desktop/Panels/DataEntry/DataEntryPanel.xaml.cs

@@ -2,31 +2,12 @@
 using InABox.Clients;
 using InABox.Core;
 using InABox.DynamicGrid;
-using InABox.WPF;
-using Syncfusion.Data.Extensions;
-using Syncfusion.Pdf;
-using Syncfusion.Pdf.Graphics;
 using System;
 using System.Collections.Generic;
-using System.Drawing.Imaging;
-using System.Drawing;
-using System.IO;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using Syncfusion.Pdf.Parsing;
-using Encoder = System.Drawing.Imaging.Encoder;
-using Image = System.Windows.Controls.Image;
 using System.Reflection;
-using System.Windows.Forms.VisualStyles;
 
 namespace PRSDesktop
 {
@@ -276,10 +257,8 @@ namespace PRSDesktop
 
         private void ScanPanel_OnSelectAppliesTo(string appliesTo)
         {
-            if(CoreUtils.TryGetEntity(appliesTo, out var entity))
-            {
-                TypeBox.SelectedValue = entity;
-            }
+            CoreUtils.TryGetEntity(appliesTo, out var entity);
+            TypeBox.SelectedValue = entity;
         }
     }
 }

+ 29 - 17
prs.desktop/Panels/DataEntry/ScanGrid.cs

@@ -26,23 +26,22 @@ namespace PRSDesktop
         public ScanGrid()
         {
             Options.BeginUpdate()
-                .AddRange(DynamicGridOption.MultiSelect, DynamicGridOption.DragSource, DynamicGridOption.FilterRows, DynamicGridOption.SelectColumns)
-                .Remove(DynamicGridOption.ImportData)
+                .Clear()
+                .Add(DynamicGridOption.MultiSelect)
+                .Add(DynamicGridOption.DragSource)
+                .Add(DynamicGridOption.SelectColumns)
                 .EndUpdate();
 
             if (Security.CanEdit<Scan>() || Security.IsAllowed<CanSetupScanTags>())
             {
                 ActionColumns.Add(new DynamicMenuColumn(MenuBuild, null));
             }
-            if (Security.CanEdit<Scan>())
-            {
-                ExplodeBtn = AddButton("Explode", null, Explode_Click);
-            }
-
-            if (Security.IsAllowed<CanSetupScanTags>())
-            {
-                AddButton("Setup Tags", null, SetupTags_Click);
-            }
+            
+            // if (Security.CanEdit<Scan>())
+            // {
+            //     ExplodeBtn = AddButton("Explode", null, Explode_Click);
+            // }
+            
 
             HiddenColumns.Add(x => x.Tag.ID);
             HiddenColumns.Add(x => x.Tag.AppliesTo);
@@ -59,17 +58,28 @@ namespace PRSDesktop
             }
         }
 
+        public void DoExplode()
+        {
+            if (DoExplode(SelectedRows))
+                Refresh(false,true);
+        }
+
         private bool Explode_Click(Button button, CoreRow[] rows)
+        {
+            return DoExplode(rows);
+        }
+
+        private bool DoExplode(CoreRow[] rows)
         {
             Guid tagID = Guid.Empty;
-            foreach(var row in rows)
+            foreach (var row in rows)
             {
                 var rowTag = row.Get<Scan, Guid>(x => x.Tag.ID);
                 if (tagID == Guid.Empty)
                 {
                     tagID = rowTag;
                 }
-                else if(rowTag != tagID)
+                else if (rowTag != tagID)
                 {
                     tagID = Guid.Empty;
                     break;
@@ -85,25 +95,27 @@ namespace PRSDesktop
 
             var pages = new List<DocumentManipulationWindow.Page>();
             string filename = "";
-            foreach(var docID in docIDs)
+            foreach (var docID in docIDs)
             {
-                if(docs.TryGetValue(docID, out var doc))
+                if (docs.TryGetValue(docID, out var doc))
                 {
                     filename = doc.FileName;
                     var ms = new MemoryStream(doc.Data);
                     var pdfDoc = DocumentManipulationWindow.RenderToPDF(doc.FileName, ms);
-                    foreach(var page in DocumentManipulationWindow.SplitIntoPages(doc.FileName, pdfDoc))
+                    foreach (var page in DocumentManipulationWindow.SplitIntoPages(doc.FileName, pdfDoc))
                     {
                         pages.Add(page);
                     }
                 }
             }
-            if(ShowDocumentWindow(pages, filename, tagID))
+
+            if (ShowDocumentWindow(pages, filename, tagID))
             {
                 // ShowDocumentWindow already saves new scans, so we just need to get rid of the old ones.
                 DeleteItems(rows);
                 return true;
             }
+
             return false;
         }
 

+ 11 - 1
prs.desktop/Panels/DataEntry/ScanPanel.xaml

@@ -30,7 +30,17 @@
         <Border Grid.Row="2"
                 BorderBrush="Gray" Background="DimGray">
             <ScrollViewer VerticalScrollBarVisibility="Auto">
-                <StackPanel x:Name="ViewListPanel" Orientation="Vertical" Margin="10"/>
+                <StackPanel x:Name="ViewListPanel" Orientation="Vertical" Margin="10">
+                    <StackPanel.ContextMenu>
+                        <ContextMenu
+                            x:Name="_contextMenu">
+                            <ContextMenu.Items>
+                                <MenuItem x:Name="_Explode" Header="Regroup Pages" Click="_Explode_OnClick"/>
+                            </ContextMenu.Items>
+                        </ContextMenu>
+                    </StackPanel.ContextMenu>
+                    
+                </StackPanel>
             </ScrollViewer>
         </Border>
     </Grid>

+ 10 - 0
prs.desktop/Panels/DataEntry/ScanPanel.xaml.cs

@@ -224,6 +224,7 @@ namespace PRSDesktop
                             Source = bitmap,
                             Margin = new Thickness(0, 0, 0, 20)
                         };
+                        image.ContextMenu = ViewListPanel.ContextMenu;
                         ViewListPanel.Children.Add(image);
                     }
                 }
@@ -271,11 +272,20 @@ namespace PRSDesktop
         private void ScanGrid_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
         {
             UpdateViewList();
+            var appliesTo = e?.Rows?.Length == 1 
+                ? e.Rows[0].Get<Scan, string>(x => x.Tag.AppliesTo) 
+                : "";
+            OnSelectAppliesTo?.Invoke(appliesTo);
         }
 
         private void ScanGrid_OnSelectAppliesTo(string appliesTo)
         {
             OnSelectAppliesTo?.Invoke(appliesTo);
         }
+
+        private void _Explode_OnClick(object sender, RoutedEventArgs e)
+        {
+           this.ScanGrid.DoExplode();
+        }
     }
 }

+ 3 - 1
prs.desktop/Panels/Invoices/InvoiceListGrid.cs

@@ -17,6 +17,7 @@ namespace PRSDesktop
 {
     public class InvoiceListGrid : DynamicDataGrid<Invoice>
     {
+        private static readonly BitmapImage? post = PRSDesktop.Resources.post.AsBitmapImage();
         private static readonly BitmapImage? tick = PRSDesktop.Resources.tick.AsBitmapImage();
         private static readonly BitmapImage? warning = PRSDesktop.Resources.warning.AsBitmapImage();
         private static readonly BitmapImage? refresh = PRSDesktop.Resources.refresh.AsBitmapImage();
@@ -59,7 +60,8 @@ namespace PRSDesktop
 
         private BitmapImage? Posted_Image(CoreRow? arg)
         {
-            if(arg is null) return tick;
+            if(arg is null) 
+                return post;
             return arg.Get<Invoice, PostedStatus>(x => x.PostedStatus) switch
             {
                 PostedStatus.PostFailed => warning,

+ 4 - 1
prs.desktop/Panels/Suppliers/SupplierBillPanel.xaml

@@ -21,7 +21,10 @@
         </dynamicGrid:DynamicSplitPanel.Master>
         
         <dynamicGrid:DynamicSplitPanel.Detail>
-            <dynamicGrid:EmbeddedDynamicEditorForm x:Name="Bill" OnOK="Bill_OnOnOK" OnCancel="Bill_OnOnCancel" Margin="-5"/>
+            <Border BorderBrush="Gray" BorderThickness="0.75" x:Name="DetailBorder">
+                <dynamicGrid:EmbeddedDynamicEditorForm x:Name="Bill" OnOK="Bill_OnOnOK" OnCancel="Bill_OnOnCancel"/>
+            </Border>
+            
         </dynamicGrid:DynamicSplitPanel.Detail>
         
     </dynamicGrid:DynamicSplitPanel>

+ 13 - 1
prs.desktop/Panels/Suppliers/SupplierBills.cs

@@ -15,6 +15,7 @@ namespace PRSDesktop
     public class SupplierBills : DynamicDataGrid<Bill>
     {
         private static readonly BitmapImage? tick = PRSDesktop.Resources.tick.AsBitmapImage();
+        private static readonly BitmapImage? post = PRSDesktop.Resources.post.AsBitmapImage();
         private static readonly BitmapImage? warning = PRSDesktop.Resources.warning.AsBitmapImage();
         private static readonly BitmapImage? refresh = PRSDesktop.Resources.refresh.AsBitmapImage();
         private readonly BitmapImage pdf = PRSDesktop.Resources.doc_pdf.AsBitmapImage();
@@ -32,8 +33,11 @@ namespace PRSDesktop
                 .Add(DynamicGridOption.ShowHelp)
                 .EndUpdate();
             HiddenColumns.Add(x => x.PostedStatus);
+            HiddenColumns.Add(x => x.PostedStatus);
             HiddenColumns.Add(x => x.PostedNote);
 
+            ActionColumns.Add(new DynamicImageColumn(Approved_Image, null));
+            
             ActionColumns.Add(new DynamicImageColumn(Posted_Image, null)
             {
                 ToolTip = Posted_ToolTip
@@ -54,10 +58,18 @@ namespace PRSDesktop
                 PostedStatus.NeverPosted or _ => "Not posted yet",
             });
         }
+        
+        private BitmapImage? Approved_Image(CoreRow? row)
+        {
+            return (row != null) && row.Get<Bill, DateTime>(x => x.Approved).IsEmpty()
+                ? null
+                : post;
+        }
 
         private BitmapImage? Posted_Image(CoreRow? row)
         {
-            if (row is null) return tick;
+            if (row is null) 
+                return post;
             return row.Get<Bill, PostedStatus>(x => x.PostedStatus) switch
             {
                 PostedStatus.PostFailed => warning,

+ 4 - 1
prs.desktop/Panels/Suppliers/SupplierPurchaseOrderPanel.xaml

@@ -32,7 +32,10 @@
         </dynamicgrid:DynamicSplitPanel.Master>
 
         <dynamicgrid:DynamicSplitPanel.Detail>
-            <dynamicgrid:EmbeddedDynamicEditorForm x:Name="PurchaseOrder" OnOK="PurchaseOrder_OnOK" OnCancel="PurchaseOrder_OnCancel" Margin="-5"/>
+            <Border BorderBrush="Gray" BorderThickness="0.75" x:Name="DetailBorder">
+                <dynamicgrid:EmbeddedDynamicEditorForm x:Name="PurchaseOrder" OnOK="PurchaseOrder_OnOK" OnCancel="PurchaseOrder_OnCancel"/>
+            </Border>
+            
 
             <!-- <DockPanel> -->
             <!--     <Border DockPanel.Dock="Top" BorderBrush="Gray" BorderThickness="1" Background="WhiteSmoke"> -->

+ 4 - 2
prs.desktop/Panels/Suppliers/SupplierPurchaseOrders.cs

@@ -18,6 +18,7 @@ namespace PRSDesktop
     public class SupplierPurchaseOrders : DynamicDataGrid<PurchaseOrder>
     {
         private readonly Button close;
+        private static readonly BitmapImage? post = PRSDesktop.Resources.post.AsBitmapImage();
         private static readonly BitmapImage? tick = PRSDesktop.Resources.tick.AsBitmapImage();
         private static readonly BitmapImage? warning = PRSDesktop.Resources.warning.AsBitmapImage();
         private static readonly BitmapImage? refresh = PRSDesktop.Resources.refresh.AsBitmapImage();
@@ -36,7 +37,7 @@ namespace PRSDesktop
             HiddenColumns.Add(x => x.Balance);
             HiddenColumns.Add(x => x.PostedStatus);
             HiddenColumns.Add(x => x.PostedNote);
-
+            
             ActionColumns.Add(new DynamicImageColumn(Posted_Image, null)
             {
                 ToolTip = Posted_ToolTip
@@ -62,7 +63,8 @@ namespace PRSDesktop
 
         private BitmapImage? Posted_Image(CoreRow? row)
         {
-            if (row is null) return tick;
+            if (row is null) 
+                return post;
             return row.Get<PurchaseOrder, PostedStatus>(x => x.PostedStatus) switch
             {
                 PostedStatus.PostFailed => warning,

+ 10 - 1
prs.desktop/Resources.Designer.cs

@@ -1,7 +1,6 @@
 //------------------------------------------------------------------------------
 // <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.
@@ -1137,6 +1136,16 @@ namespace PRSDesktop {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
+        /// </summary>
+        internal static System.Drawing.Bitmap post {
+            get {
+                object obj = ResourceManager.GetObject("post", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized resource of type System.Drawing.Bitmap.
         /// </summary>

+ 3 - 0
prs.desktop/Resources.resx

@@ -773,4 +773,7 @@
   <data name="emailreport" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>Resources\emailreport.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <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>
 </root>

BIN
prs.desktop/Resources/post.png


+ 1 - 1
prs.desktop/prsdesktop.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Desktop"
-#define MyAppVersion "7.25"
+#define MyAppVersion "7.26"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSDesktop.exe"

+ 1 - 1
prs.server/PRSServer.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Server"
-#define MyAppVersion "7.25"
+#define MyAppVersion "7.26"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSServer.exe"