|
@@ -66,6 +66,7 @@ using PixelFormat = System.Drawing.Imaging.PixelFormat;
|
|
|
using Role = Comal.Classes.Role;
|
|
|
using SortDirection = InABox.Core.SortDirection;
|
|
|
using ValidationResult = InABox.Clients.ValidationResult;
|
|
|
+using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
|
namespace PRSDesktop
|
|
|
{
|
|
@@ -3500,11 +3501,35 @@ namespace PRSDesktop
|
|
|
SizeForm = SizeForm.Large,
|
|
|
MinWidth = 60
|
|
|
};
|
|
|
+
|
|
|
+ if (Security.IsAllowed<CanDesignReports>())
|
|
|
+ {
|
|
|
+ var menu = new ContextMenu();
|
|
|
+ menu.AddItem("Design Report", PRSDesktop.Resources.pencil, report.Item2, ReportButtonMenu_DesignReport_Click);
|
|
|
+ button.ContextMenu = menu;
|
|
|
+ }
|
|
|
+
|
|
|
button.Click += ReportMenu_Checked;
|
|
|
ReportsBar.Items.Add(button);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void ReportButtonMenu_DesignReport_Click(Guid templateID)
|
|
|
+ {
|
|
|
+ if (CurrentPanel is null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ var template = new Client<ReportTemplate>().Load(new Filter<ReportTemplate>(x => x.ID).IsEqualTo(templateID)).FirstOrDefault();
|
|
|
+ if (template is null)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, "", $"No Report Template with ID '{templateID}'");
|
|
|
+ MessageBox.Show("Report does not exist!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ReportUtils.DesignReport(template, CurrentPanel.DataModel(Selection.None));
|
|
|
+ }
|
|
|
|
|
|
private void ReportMenu_Checked(object sender, RoutedEventArgs e)
|
|
|
{
|