Ver código fonte

Merge commit 'aa9f95c2c6278cacb275eb0f29a0c1d3b1775783' into frank

Frank van den Bos 2 anos atrás
pai
commit
1b64d9a72e

+ 5 - 0
prs.classes/SecurityDescriptors/Common_Descriptors.cs

@@ -27,6 +27,11 @@ namespace Comal.Classes
     {
     {
     }
     }
 
 
+    [Caption("Bypass GPS For Clock In")]
+    public class CanBypassGPSClockIn : DisabledSecurityDescriptor<HumanResourcesLicense, TimeSheet>
+    {
+    }
+
     [Caption("Automatically Create Timesheet on Log In")]
     [Caption("Automatically Create Timesheet on Log In")]
     public class AutoGenerateTimesheet : DisabledSecurityDescriptor<HumanResourcesLicense, TimeSheet>
     public class AutoGenerateTimesheet : DisabledSecurityDescriptor<HumanResourcesLicense, TimeSheet>
     {
     {

+ 2 - 0
prs.desktop/Dashboards/Common/DigitalFormsDashboard.xaml.cs

@@ -940,6 +940,8 @@ namespace PRSDesktop
             }
             }
 
 
             data.Columns.Add("Description", typeof(string));
             data.Columns.Add("Description", typeof(string));
+            data.Columns.Add("Created By", typeof(string));
+            data.Columns.Add("Created", typeof(DateTime));
             data.Columns.Add("Completed", typeof(DateTime));
             data.Columns.Add("Completed", typeof(DateTime));
             data.Columns.Add("Completed By", typeof(string));
             data.Columns.Add("Completed By", typeof(string));
             if (IsEntityForm)
             if (IsEntityForm)

+ 22 - 4
prs.desktop/Dashboards/Common/QADashboard.xaml.cs

@@ -141,6 +141,18 @@ namespace PRSDesktop
                 e.Column.Width = 100;
                 e.Column.Width = 100;
                 e.Column.HeaderStyle = Resources["TemplateHeaderStyle"] as Style;
                 e.Column.HeaderStyle = Resources["TemplateHeaderStyle"] as Style;
             }
             }
+            else if (value.Path.Path.Equals("Created By"))
+            {
+                e.Column.Width = 100;
+                e.Column.HeaderStyle = Resources["TemplateHeaderStyle"] as Style;
+            }
+            else if (value.Path.Path.Equals("Created"))
+            {
+                e.Column.Width = 100;
+                e.Column.HeaderStyle = Resources["TemplateHeaderStyle"] as Style;
+                (e.Column as GridDateTimeColumn).Pattern = DateTimePattern.CustomPattern;
+                (e.Column as GridDateTimeColumn).CustomPattern = "dd MMM yy hh:mm";
+            }
             else
             else
             {
             {
                 var data = dataGrid.ItemsSource as DataTable;
                 var data = dataGrid.ItemsSource as DataTable;
@@ -480,6 +492,8 @@ namespace PRSDesktop
                 var colstype = typeof(Columns<>).MakeGenericType(type);
                 var colstype = typeof(Columns<>).MakeGenericType(type);
                 var cols = Activator.CreateInstance(colstype) as IColumns;
                 var cols = Activator.CreateInstance(colstype) as IColumns;
                 cols.Add("ID");
                 cols.Add("ID");
+                cols.Add("CreatedBy");
+                cols.Add("Created");
 
 
                 foreach (var col in parentcols.ColumnNames())
                 foreach (var col in parentcols.ColumnNames())
                     cols.Add("Parent." + col);
                     cols.Add("Parent." + col);
@@ -544,9 +558,12 @@ namespace PRSDesktop
                 }
                 }
 
 
                 data.Columns.Add("Description", typeof(string));
                 data.Columns.Add("Description", typeof(string));
+                data.Columns.Add("Created", typeof(DateTime));
+                data.Columns.Add("Created By", typeof(string));
                 data.Columns.Add("Completed", typeof(DateTime));
                 data.Columns.Add("Completed", typeof(DateTime));
                 data.Columns.Add("Completed By", typeof(string));
                 data.Columns.Add("Completed By", typeof(string));
-                if(isEntityForm)
+        
+                if (isEntityForm)
                     data.Columns.Add("Processed", typeof(bool));
                     data.Columns.Add("Processed", typeof(bool));
 
 
                 if (variables.Any())
                 if (variables.Any())
@@ -603,11 +620,12 @@ namespace PRSDesktop
                         }
                         }
 
 
                         datarow["Description"] = string.Join(" : ", desc);
                         datarow["Description"] = string.Join(" : ", desc);
-
+                        datarow["Created By"] = (string)row["CreatedBy"];
+                        datarow["Created"] = (DateTime)row["Created"];
                         datarow["Completed"] = (DateTime)row["FormCompleted"];
                         datarow["Completed"] = (DateTime)row["FormCompleted"];
-                        datarow["Completed By"] = (string)row["FormCompletedBy.UserID"];
+                        datarow["Completed By"] = (string)row["FormCompletedBy.UserID"];                
 
 
-                        if(isEntityForm)
+                        if (isEntityForm)
                             datarow["Processed"] = (bool)row["Processed"];
                             datarow["Processed"] = (bool)row["Processed"];
 
 
                         if(parentType == typeof(JobITP))
                         if(parentType == typeof(JobITP))

+ 6 - 13
prs.desktop/Panels/Jobs/JobBillOfMaterialsItemsGrid.cs

@@ -56,6 +56,7 @@ namespace PRSDesktop
             HiddenColumns.Add(x => x.PurchaseOrderItem.PurchaseOrderLink.PONumber);
             HiddenColumns.Add(x => x.PurchaseOrderItem.PurchaseOrderLink.PONumber);
             HiddenColumns.Add(x => x.PurchaseOrderItem.ReceivedDate);
             HiddenColumns.Add(x => x.PurchaseOrderItem.ReceivedDate);
             HiddenColumns.Add(x => x.PurchaseOrderItem.PONumber);
             HiddenColumns.Add(x => x.PurchaseOrderItem.PONumber);
+            HiddenColumns.Add(x => x.Packet.ID);
 
 
             AddButton("Create Requi", null, CreateRequi);
             AddButton("Create Requi", null, CreateRequi);
             AddButton("Create PO", null, CreatePO);
             AddButton("Create PO", null, CreatePO);
@@ -176,7 +177,7 @@ namespace PRSDesktop
             Guid POID = items[0].ID;
             Guid POID = items[0].ID;
 
 
             CoreTable table = new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(POID),
             CoreTable table = new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(POID),
-                new Columns<PurchaseOrderItem>(x => x.ID, x => x.Product.ID, x => x.Qty, x => x.Dimensions.UnitSize, x => x.DueDate, x => x.Job.ID));
+                new Columns<PurchaseOrderItem>(x => x.ID, x => x.Product.ID, x => x.Qty, x => x.Dimensions.UnitSize, x => x.Dimensions.Value, x => x.Style.ID, x => x.DueDate, x => x.Job.ID));
 
 
             if (table.Rows.Any())
             if (table.Rows.Any())
             {
             {
@@ -216,18 +217,6 @@ namespace PRSDesktop
                 JobBillOfMaterialsItem bomItem = row.ToObject<JobBillOfMaterialsItem>();
                 JobBillOfMaterialsItem bomItem = row.ToObject<JobBillOfMaterialsItem>();
                 foreach (var item in poItems)
                 foreach (var item in poItems)
                 {
                 {
-                    if (string.IsNullOrWhiteSpace(bomItem.Dimensions.UnitSize))
-                        bomItem.Dimensions.UnitSize = QueryUnitSize(bomItem.Product.ID);
-
-                    if (string.IsNullOrWhiteSpace(item.Dimensions.UnitSize))
-                        item.Dimensions.UnitSize = QueryUnitSize(item.Product.ID);
-
-                    if (bomItem.Job.ID == Guid.Empty)
-                        bomItem.Job.ID = QueryJobID(bomItem.BillOfMaterials.ID);
-
-                    if (item.Job.ID == Guid.Empty)
-                        item.Job.ID = QueryJobID(bomItem.BillOfMaterials.ID);
-
                     if (MatchBOMItemToPOItem(bomItem, item))
                     if (MatchBOMItemToPOItem(bomItem, item))
                         bomItems.Add(UpdateBOMItemWithPODetails(bomItem, item));
                         bomItems.Add(UpdateBOMItemWithPODetails(bomItem, item));
                 }
                 }
@@ -260,6 +249,9 @@ namespace PRSDesktop
         {
         {
             if (bomItem.Product.ID == item.Product.ID &&
             if (bomItem.Product.ID == item.Product.ID &&
                                 bomItem.Dimensions.UnitSize == item.Dimensions.UnitSize &&
                                 bomItem.Dimensions.UnitSize == item.Dimensions.UnitSize &&
+                                bomItem.Dimensions.Value == item.Dimensions.Value &&
+                                bomItem.Style.ID == item.Style.ID &&
+                                bomItem.Quantity == item.Qty &&
                                 bomItem.Job.ID == item.Job.ID)
                                 bomItem.Job.ID == item.Job.ID)
                 return true;
                 return true;
             else
             else
@@ -281,6 +273,7 @@ namespace PRSDesktop
                 POItem.Product.Name = BOMItem.Product.Name;               
                 POItem.Product.Name = BOMItem.Product.Name;               
                 POItem.Qty = BOMItem.Quantity;
                 POItem.Qty = BOMItem.Quantity;
                 POItem.Dimensions.CopyFrom(BOMItem.Dimensions);
                 POItem.Dimensions.CopyFrom(BOMItem.Dimensions);
+                POItem.Dimensions.Value = BOMItem.Dimensions.Value;
                 POItem.Style.ID = BOMItem.Style.ID;
                 POItem.Style.ID = BOMItem.Style.ID;
                 POItem.Style.Code = BOMItem.Style.Code;
                 POItem.Style.Code = BOMItem.Style.Code;
                 POItem.Style.Description = BOMItem.Style.Description;
                 POItem.Style.Description = BOMItem.Style.Description;

+ 2 - 1
prs.desktop/Panels/Products/Reservation Management/JobRequisitionHoldingsReview.xaml.cs

@@ -134,7 +134,8 @@ namespace PRSDesktop
                     x => x.Dimensions.Weight,
                     x => x.Dimensions.Weight,
                     x => x.Dimensions.Width,
                     x => x.Dimensions.Width,
                     x => x.Dimensions.Length,
                     x => x.Dimensions.Length,
-                    x => x.Dimensions.UnitSize
+                    x => x.Dimensions.UnitSize,
+                    x => x.Dimensions.Value
                     ));
                     ));
 
 
             List<StockMovement> stockMovements = new List<StockMovement>();
             List<StockMovement> stockMovements = new List<StockMovement>();

+ 6 - 6
prs.desktop/Panels/Suppliers/SupplierPurchaseOrderItems.cs

@@ -90,21 +90,21 @@ namespace PRSDesktop
                 return false;
                 return false;
             }
             }
 
 
-            if (MessageBox.Show("Create new location?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
+            var menu = new ContextMenu();
+            menu.AddItem("Create New Location", null, () =>
             {
             {
                 var grid = new StockLocationGrid();
                 var grid = new StockLocationGrid();
                 var location = new StockLocation();
                 var location = new StockLocation();
                 if (grid.EditItems(new StockLocation[] { location }))
                 if (grid.EditItems(new StockLocation[] { location }))
                     AssignLocationToItems(location.ID, rows);
                     AssignLocationToItems(location.ID, rows);
-            }
-            else
+            });
+            menu.AddItem("Choose Existing", null, () =>
             {
             {
                 var popup = new PopupList(typeof(StockLocation), Guid.Empty, new string[] { });
                 var popup = new PopupList(typeof(StockLocation), Guid.Empty, new string[] { });
-
                 if (popup.ShowDialog() == true)
                 if (popup.ShowDialog() == true)
                     AssignLocationToItems(popup.ID, rows);
                     AssignLocationToItems(popup.ID, rows);
-
-            }
+            });
+            menu.IsOpen = true;
             return true;
             return true;
         }
         }
 
 

+ 26 - 11
prs.desktop/Panels/Users/UserGrid.cs

@@ -11,6 +11,7 @@ using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.DynamicGrid;
 using InABox.Mail;
 using InABox.Mail;
 using InABox.WPF;
 using InABox.WPF;
+using NPOI.SS.Formula.Functions;
 using PRS.Shared;
 using PRS.Shared;
 using PRSDesktop.Panels.Users;
 using PRSDesktop.Panels.Users;
 using Syncfusion.Windows.Shared;
 using Syncfusion.Windows.Shared;
@@ -43,24 +44,40 @@ namespace PRSDesktop
 
 
         private bool SendEmail(CoreRow? row)
         private bool SendEmail(CoreRow? row)
         {
         {
-            if (row is null) return false;
+            if (row is null) 
+                return false;
 
 
             User user = row.ToObject<User>();
             User user = row.ToObject<User>();
 
 
-            string ioslink = @"prsmobile://open/";
-            string androidlink = @"http://www.prsmobile.com/open/";
+            var menu = new ContextMenu();
+            menu.AddItem("PRS Site App", null, () =>
+            {
+                CreateLink(user, @"prssite://open/", @"http://www.prssite.com/open/", CreateURLs(new string[] { "remote.com-al.com.au:8050" }));
+            });
+
+            menu.AddItem("PRS Timebench", null, () =>
+            {
+                CreateLink(user, @"prsmobile://open/", @"http://www.prsmobile.com/open/", CreateURLs(App.DatabaseSettings.URLs));
+            });
+            menu.IsOpen = true;    
+            return true;
+        }
+
+        private void CreateLink(User user, string ioslink, string androidlink, string URLs)
+        {
+            if (string.IsNullOrWhiteSpace(ioslink))
+                return;
 
 
-            int expiry = 10;
             var edt = new NumberEdit("Enter link expiry time in minutes", 10, 300, 10);
             var edt = new NumberEdit("Enter link expiry time in minutes", 10, 300, 10);
-            var result = edt.ShowDialog();
-            if (result == true)
-                expiry = edt.Value;
+            bool result = (bool)edt.ShowDialog();
+            if (!result)
+                return;
 
 
-            string URLs = CreateURLs(App.DatabaseSettings.URLs);
+            var expiry = edt.Value;
 
 
             string toEncrypt = URLs + "," + user.UserID + "," + user.Password + "," + DateTime.Now.AddMinutes(expiry);
             string toEncrypt = URLs + "," + user.UserID + "," + user.Password + "," + DateTime.Now.AddMinutes(expiry);
             string encrypted = Encryption.Encrypt(toEncrypt, "logindetailslink", true);
             string encrypted = Encryption.Encrypt(toEncrypt, "logindetailslink", true);
-            
+
             ioslink = ioslink + encrypted;
             ioslink = ioslink + encrypted;
             androidlink = androidlink + encrypted;
             androidlink = androidlink + encrypted;
 
 
@@ -71,8 +88,6 @@ namespace PRSDesktop
                 "These links will expire after " + expiry + " minutes.";
                 "These links will expire after " + expiry + " minutes.";
 
 
             EmailUtils.CreateEMLFile(user.EmailAddress, "PRS Mobile Configuration Links", emailcontent);
             EmailUtils.CreateEMLFile(user.EmailAddress, "PRS Mobile Configuration Links", emailcontent);
-
-            return true;
         }
         }
 
 
         private string CreateURLs(string[] urls)
         private string CreateURLs(string[] urls)

+ 1 - 1
prs.desktop/prsdesktop.iss

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

+ 1 - 1
prs.server/PRSServer.iss

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

+ 42 - 0
prs.stores/JobBillOfMaterialsItemStore.cs

@@ -0,0 +1,42 @@
+using Comal.Classes;
+using Comal.Stores;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using InABox.Core;
+
+namespace PRSStores
+{
+    public class JobBillOfMaterialsItemStore : BaseStore<JobBillOfMaterialsItem>
+    {
+        protected override void AfterSave(JobBillOfMaterialsItem entity)
+        {
+            if (entity.Packet.ID != Guid.Empty && entity.PurchaseOrderItem.ID != Guid.Empty)
+            {
+                var packet = Provider.Query<ManufacturingPacket>(new Filter<ManufacturingPacket>(x => x.ID).IsEqualTo(entity.Packet.ID),
+                    new Columns<ManufacturingPacket>(x => x.ID, x => x.OrderItem.ID))
+                    .Rows.FirstOrDefault().ToObject<ManufacturingPacket>();
+                    ;
+
+                if (packet != null)
+                {
+                    packet.OrderItem.ID = entity.PurchaseOrderItem.ID;
+                    Provider.Save(packet);
+                }
+
+                var poItem = Provider.Query<PurchaseOrderItem>(new Filter<PurchaseOrderItem>(x => x.ID).IsEqualTo(entity.PurchaseOrderItem.ID),
+                    new Columns<PurchaseOrderItem>(x => x.ID, x => x.Packet.ID)
+                    ).
+                    Rows.FirstOrDefault().ToObject<PurchaseOrderItem>();
+
+                if (poItem != null)
+                {
+                    poItem.Packet.ID = entity.Packet.ID;
+                    Provider.Save(poItem);
+                }              
+            }
+            base.AfterSave(entity);
+        }
+    }
+}

+ 1 - 0
prs.stores/PRSStores.projitems

@@ -34,6 +34,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)GPSTrackerStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)GPSTrackerStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)InvoiceReceiptStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)InvoiceReceiptStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)InvoiceStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)InvoiceStore.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)JobBillOfMaterialsItemStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobMaterialRequsitionStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobMaterialRequsitionStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobRequisitionItemStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobRequisitionItemStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobRequisitionStore.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)JobRequisitionStore.cs" />

+ 2 - 2
prs.stores/PurchaseOrderItemStore.cs

@@ -245,9 +245,9 @@ namespace Comal.Stores
         {
         {
             base.AfterSave(entity);
             base.AfterSave(entity);
 
 
-            if (entity.ReceivedDate.IsEmpty() && entity.HasOriginalValue<PurchaseOrderItem>("RecievedDate"))
+            if (entity.ReceivedDate == DateTime.MinValue && entity.HasOriginalValue<PurchaseOrderItem>("ReceivedDate"))
             {                 
             {                 
-                if(DateTime.Parse(entity.OriginalValues["RecievedDate"].ToString()) != entity.ReceivedDate)
+                if(DateTime.Parse(entity.OriginalValues["ReceivedDate"].ToString()) != entity.ReceivedDate)
                     DeleteStockMovements(entity);
                     DeleteStockMovements(entity);
             }            
             }            
             else if(!entity.ReceivedDate.IsEmpty())
             else if(!entity.ReceivedDate.IsEmpty())

+ 27 - 0
prs.stores/PurchaseOrderStore.cs

@@ -1,4 +1,9 @@
 using Comal.Classes;
 using Comal.Classes;
+using InABox.Core;
+using NPOI.HPSF;
+using System;
+using System.Collections.Generic;
+using System.Linq;
 
 
 namespace Comal.Stores
 namespace Comal.Stores
 {
 {
@@ -21,6 +26,28 @@ namespace Comal.Stores
         protected override void BeforeDelete(PurchaseOrder entity)
         protected override void BeforeDelete(PurchaseOrder entity)
         {
         {
             UnlinkTrackingKanban<PurchaseOrderKanban, PurchaseOrder, PurchaseOrderLink>(entity);
             UnlinkTrackingKanban<PurchaseOrderKanban, PurchaseOrder, PurchaseOrderLink>(entity);
+            DeleteStockMovements(entity);
         }
         }
+
+        private void DeleteStockMovements(PurchaseOrder entity)
+        {
+            var items = Provider.Query(
+                new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(entity.ID),
+                new Columns<PurchaseOrderItem>(x => x.ID)
+            ).Rows.Select(x => x.ToObject<PurchaseOrderItem>());
+
+            List<Guid> ids = new List<Guid>();
+            foreach ( var item in items) 
+                ids.Add(item.ID);
+
+            var movements = Provider.Query(
+                new Filter<StockMovement>(x => x.OrderItem.ID).InList(ids.ToArray()),
+                new Columns<StockMovement>(x => x.ID)
+            ).Rows.Select(x => x.ToObject<StockMovement>());
+
+            if (movements.Any())
+                FindSubStore<StockMovement>().Delete(movements, "Purchase Order Deleted");
+        }
+
     }
     }
 }
 }