Report Erzeugung aus ENI funktional, das alte Kontext-menü ist aber noch drin

This commit is contained in:
Daniel Schick 2021-12-21 18:29:38 +01:00
parent c1a4540c86
commit 04a086548a
5 changed files with 19 additions and 11 deletions

View File

@ -556,7 +556,8 @@ namespace ENI2.DetailViewControls
// create PDF from message classes
if (rm.Create(sfd.FileName, this.Core, sicd.SelectedClasses, out string importResultText))
{
MessageBox.Show("Report created", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show("Report created: " + sfd.FileName, "Success", MessageBoxButton.OK, MessageBoxImage.Information);
// Clipboard.SetText(sfd.FileName);
}
else
{

View File

@ -702,6 +702,14 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Content Include="..\misc\Logo.gif">
<Link>Report\Logo.gif</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\misc\report.db">
<Link>report.db</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="ENI2_2_TemporaryKey.pfx" />
<None Include="ENI2_3_TemporaryKey.pfx" />
<None Include="ENI2_4_TemporaryKey.pfx" />

View File

@ -22,7 +22,7 @@ namespace ENI2.Report
static LabelStorage()
{
_con = new SQLiteConnection(string.Format("data source={0}; Version=3;", _locode_DB_NAME));
_con.Open();
_con.Open();
}
#region public static properties

View File

@ -77,10 +77,8 @@ namespace ENI2.Report
#region create document
internal static Document CreateSingleClassDocument(MessageCore reportCore, List<Message> reportMessages,
Dictionary<string, string> coverInfos, string classes, ReportingParty rp)
internal static Document CreateSingleClassDocument(MessageCore reportCore, Dictionary<string, string> coverInfos, string classes, ReportingParty rp)
{
Document document = new Document();
document.Info.Title = string.Format("{0} for {1}", classes, reportCore.DisplayId);
document.Info.Subject = "Reporting class info";
@ -260,7 +258,7 @@ namespace ENI2.Report
table.AddColumn(140);
Row row = table.AddRow();
Image logoImage = row.Cells[0].AddImage("Logo.gif"); // kann man offenbar nur von einem Pfad laden
Image logoImage = row.Cells[0].AddImage(@"Report\Logo.gif"); // kann man offenbar nur von einem Pfad laden
logoImage.Width = 80;
row.Cells[0].MergeDown = 6;
@ -880,7 +878,7 @@ namespace ENI2.Report
for (int i = 0; i < mdh.InfectedAreas.Count; i++)
{
Row row = table.AddRow();
row.Cells[0].AddParagraph(mdh.InfectedAreas[i].Identifier);
row.Cells[0].AddParagraph(mdh.InfectedAreas[i].Identifier ?? i.ToString());
row.Cells[1].AddParagraph(mdh.InfectedAreas[i].InfectedAreaPort);
row.Cells[2].AddParagraph(mdh.InfectedAreas[i].InfectedAreaDate.HasValue ? mdh.InfectedAreas[i].InfectedAreaDate.Value.ToShortDateString() : "");
}
@ -1447,10 +1445,10 @@ namespace ENI2.Report
row.Cells[5].AddParagraph(towd.TowageOnDepartureDraught_DMT.HasValue ? towd.TowageOnDepartureDraught_DMT.Value.ToString() : "");
row.Cells[6].AddParagraph(towd.TowageOnDepartureRemarks ?? "");
row.Cells[7].AddParagraph(towd.TowageOnDepartureOperatorCompanyName ?? "");
row.Cells[8].AddParagraph(towd.TowageOnDepartureOperatorStreetNameAndNumber);
row.Cells[9].AddParagraph(towd.TowageOnDepartureOperatorPostalCode);
row.Cells[8].AddParagraph(towd.TowageOnDepartureOperatorStreetNameAndNumber ?? "");
row.Cells[9].AddParagraph(towd.TowageOnDepartureOperatorPostalCode ?? "");
row.Cells[10].AddParagraph(towd.TowageOnDepartureOperatorCountry ?? "");
row.Cells[11].AddParagraph(towd.TowageOnDepartureOperatorPhone);
row.Cells[11].AddParagraph(towd.TowageOnDepartureOperatorPhone ?? "");
row.Cells[12].AddParagraph(towd.TowageOnDepartureOperatorFax ?? "");
row.Cells[13].AddParagraph(towd.TowageOnDepartureOperatorEmail ?? "");
}

View File

@ -55,7 +55,7 @@ namespace ENI2.Report
coverInfos.Add("Visit-ID", core.DisplayId);
coverInfos.Add("Class", classes);
Document migraDocument = ReportDocument.CreateSingleClassDocument(core, reportMessages, coverInfos, classes, ReportingParty.CurrentReportingParty);
Document migraDocument = ReportDocument.CreateSingleClassDocument(core, coverInfos, classes, ReportingParty.CurrentReportingParty);
// print messages to document
foreach (Message message in reportMessages)
@ -65,6 +65,7 @@ namespace ENI2.Report
ReportDocument.RenderDocument(migraDocument, filePath);
_log.InfoFormat("Created PDF document: {0}", filePath);
result = true;
}
catch (Exception ex)
{