Extended PDF Report with new fields

This commit is contained in:
Daniel Schick 2023-11-09 10:27:00 +01:00
parent 7232a455a6
commit 5e85294375
3 changed files with 126 additions and 41 deletions

View File

@ -394,8 +394,11 @@ namespace ENI2.Report
} }
string title = messageParagraph.Title; string title = messageParagraph.Title;
if (title.Equals("CREW")) title = "CREWA"; // evil if (message.MessageNotificationClass == Message.NotificationClass.CREWA) title = "CREWA";
if (title.Equals("PAS")) title = "PASA"; if (message.MessageNotificationClass == Message.NotificationClass.CREWD) title = "CREWD";
if (message.MessageNotificationClass == Message.NotificationClass.PASA) title = "PASA";
if (message.MessageNotificationClass == Message.NotificationClass.PASD) title = "PASD";
document.LastSection.AddParagraph(ReplaceTitle(title), "Heading2"); document.LastSection.AddParagraph(ReplaceTitle(title), "Heading2");
document.LastSection.AddParagraph(ReplaceTitle(messageParagraph.Subtitle), "Heading3"); document.LastSection.AddParagraph(ReplaceTitle(messageParagraph.Subtitle), "Heading3");
@ -408,13 +411,9 @@ namespace ENI2.Report
{ {
ReportDocument.DefineContentSection(document, Orientation.Portrait, false); ReportDocument.DefineContentSection(document, Orientation.Portrait, false);
_lastOrientation = Orientation.Portrait; _lastOrientation = Orientation.Portrait;
} }
string title = messageParagraph.Title; document.LastSection.AddParagraph(ReplaceTitle(messageParagraph.Title), "Heading2");
if (title.Equals("CREW")) title = "CREWA"; // evil
if (title.Equals("PAS")) title = "PASA";
document.LastSection.AddParagraph(ReplaceTitle(title), "Heading2");
document.LastSection.AddParagraph(ReplaceTitle(messageParagraph.Subtitle), "Heading3"); document.LastSection.AddParagraph(ReplaceTitle(messageParagraph.Subtitle), "Heading3");
} }
break; break;
@ -527,13 +526,27 @@ namespace ENI2.Report
#region CREW #region CREW
private static void CreateCrewTable(Document document, Message message) private static void CreateCrewTable(Document document, Message message)
{ {
string textSchengen = "[ ] Schengen";
if(message.Elements.Count > 0)
{
CREW firstCREW = message.Elements[0] as CREW;
if(firstCREW.NotificationSchengen ?? false)
{
textSchengen = "[X] Schengen";
}
document.LastSection.AddParagraph(firstCREW.NotificationPAX ?? false ? "[X] PAX notification" : "[ ] PAX notification");
}
Table table = AddGrayTable(document); Table table = AddGrayTable(document);
table.Format.Font.Size = 9; table.Format.Font.Size = 8;
// width: 25
Column column = table.AddColumn(); Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(1); column.Width = Unit.FromCentimeter(0.75);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(3);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(3);
column = table.AddColumn(); column = table.AddColumn();
@ -541,17 +554,28 @@ namespace ENI2.Report
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2.5); column.Width = Unit.FromCentimeter(2.5);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5); column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(1); column.Width = Unit.FromCentimeter(0.75);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(2);
Row firstRow = table.AddRow();
firstRow.Cells[7].AddParagraph(textSchengen);
firstRow.Cells[7].Shading.Color = Colors.LightGray;
firstRow.Cells[7].MergeRight = 5;
Row hRow = table.AddRow(); Row hRow = table.AddRow();
hRow.Cells[1].AddParagraph("Last name"); hRow.Cells[1].AddParagraph("Last name");
@ -562,13 +586,16 @@ namespace ENI2.Report
hRow.Cells[6].AddParagraph("Nat."); hRow.Cells[6].AddParagraph("Nat.");
hRow.Cells[7].AddParagraph("Id doc. type"); hRow.Cells[7].AddParagraph("Id doc. type");
hRow.Cells[8].AddParagraph("Id doc. number"); hRow.Cells[8].AddParagraph("Id doc. number");
hRow.Cells[9].AddParagraph("Visa number"); hRow.Cells[9].AddParagraph("Iss. state");
hRow.Cells[10].AddParagraph("Duty"); hRow.Cells[10].AddParagraph("Exp. date");
hRow.Cells[11].AddParagraph("Visa number");
hRow.Cells[12].AddParagraph("Duty");
for (int i = 0; i < message.Elements.Count; i++) for (int i = 0; i < message.Elements.Count; i++)
{ {
CREW crew = message.Elements[i] as CREW; CREW crew = message.Elements[i] as CREW;
Row row = table.AddRow(); Row row = table.AddRow();
row.Cells[0].AddParagraph((i + 1).ToString()); row.Cells[0].AddParagraph((i + 1).ToString());
row.Cells[1].AddParagraph(crew.CrewMemberLastName ?? ""); row.Cells[1].AddParagraph(crew.CrewMemberLastName ?? "");
row.Cells[2].AddParagraph(crew.CrewMemberFirstName ?? ""); row.Cells[2].AddParagraph(crew.CrewMemberFirstName ?? "");
@ -577,9 +604,11 @@ namespace ENI2.Report
row.Cells[5].AddParagraph(crew.CrewMemberGenderDisplay); row.Cells[5].AddParagraph(crew.CrewMemberGenderDisplay);
row.Cells[6].AddParagraph(crew.CrewMemberNationality ?? ""); row.Cells[6].AddParagraph(crew.CrewMemberNationality ?? "");
row.Cells[7].AddParagraph(crew.CrewMemberIdentityDocumentTypeDisplay); row.Cells[7].AddParagraph(crew.CrewMemberIdentityDocumentTypeDisplay);
row.Cells[8].AddParagraph(crew.CrewMemberIdentityDocumentId ?? ""); row.Cells[8].AddParagraph(crew.CrewMemberIdentityDocumentId ?? "");
row.Cells[9].AddParagraph(crew.CrewMemberVisaNumber ?? ""); row.Cells[9].AddParagraph(crew.CrewMemberIdentityDocumentIssuingState ?? "");
row.Cells[10].AddParagraph(crew.CrewMemberDuty ?? ""); row.Cells[10].AddParagraph(crew.CrewMemberIdentityDocumentExpiryDateDisplay ?? "");
row.Cells[11].AddParagraph(crew.CrewMemberVisaNumber ?? "");
row.Cells[12].AddParagraph(crew.CrewMemberDuty ?? "");
} }
} }
#endregion #endregion
@ -587,17 +616,36 @@ namespace ENI2.Report
#region PAS #region PAS
private static void CreatePassengerTable(Document document, Message message) private static void CreatePassengerTable(Document document, Message message)
{ {
string textSchengen = "[ ] Schengen";
string textPAX = "[ ] PAX";
if (message.Elements.Count > 0)
{
PAS firstPAS = message.Elements[0] as PAS;
if (firstPAS.NotificationSchengen ?? false)
textSchengen = "[X] Schengen";
if (firstPAS.NotificationPAX ?? false)
textPAX = "[X] PAX";
}
Table table = AddGrayTable(document); Table table = AddGrayTable(document);
table.Format.Font.Size = 9; table.Format.Font.Size = 7;
Column column = table.AddColumn(); Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(0.8); column.Width = Unit.FromCentimeter(0.8);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.2);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
@ -607,15 +655,24 @@ namespace ENI2.Report
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(2); column.Width = Unit.FromCentimeter(2);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(3); column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.8);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5); column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5); column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn(); column = table.AddColumn();
column.Width = Unit.FromCentimeter(0.5); column.Width = Unit.FromCentimeter(0.5);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5);
column = table.AddColumn();
column.Width = Unit.FromCentimeter(1.5);
Row h1Row = table.AddRow();
h1Row.Cells[7].AddParagraph(textSchengen);
h1Row.Cells[7].MergeRight = 7;
h1Row.Cells[7].Shading.Color = Colors.LightGray;
h1Row.Cells[15].AddParagraph(textPAX);
h1Row.Cells[15].MergeRight = 1;
Row hRow = table.AddRow(); Row hRow = table.AddRow();
hRow.Cells[1].AddParagraph("Last name"); hRow.Cells[1].AddParagraph("Last name");
@ -626,10 +683,14 @@ namespace ENI2.Report
hRow.Cells[6].AddParagraph("Nat."); hRow.Cells[6].AddParagraph("Nat.");
hRow.Cells[7].AddParagraph("Id doc. type"); hRow.Cells[7].AddParagraph("Id doc. type");
hRow.Cells[8].AddParagraph("Id doc. number"); hRow.Cells[8].AddParagraph("Id doc. number");
hRow.Cells[9].AddParagraph("Visa number"); hRow.Cells[9].AddParagraph("Iss. state");
hRow.Cells[10].AddParagraph("Emb."); hRow.Cells[10].AddParagraph("Exp. date");
hRow.Cells[11].AddParagraph("Disemb."); hRow.Cells[11].AddParagraph("Visa number");
hRow.Cells[12].AddParagraph("T"); hRow.Cells[12].AddParagraph("Emb.");
hRow.Cells[13].AddParagraph("Disemb.");
hRow.Cells[14].AddParagraph("T");
hRow.Cells[15].AddParagraph("Em. care");
hRow.Cells[16].AddParagraph("Em. number");
for (int i = 0; i < message.Elements.Count; i++) for (int i = 0; i < message.Elements.Count; i++)
{ {
@ -644,10 +705,14 @@ namespace ENI2.Report
row.Cells[6].AddParagraph(pas.PassengerNationality ?? ""); row.Cells[6].AddParagraph(pas.PassengerNationality ?? "");
row.Cells[7].AddParagraph(pas.PassengerIdentityDocumentTypeDisplay); row.Cells[7].AddParagraph(pas.PassengerIdentityDocumentTypeDisplay);
row.Cells[8].AddParagraph(pas.PassengerIdentityDocumentId ?? ""); row.Cells[8].AddParagraph(pas.PassengerIdentityDocumentId ?? "");
row.Cells[9].AddParagraph(pas.PassengerVisaNumber ?? ""); row.Cells[9].AddParagraph(pas.PassengerIdentityDocumentIssuingState ?? "");
row.Cells[10].AddParagraph(pas.PassengerPortOfEmbarkation ?? ""); row.Cells[10].AddParagraph(pas.PassengerIdentityDocumentExpiryDateDisplay);
row.Cells[11].AddParagraph(pas.PassengerPortOfDisembarkation ?? ""); row.Cells[11].AddParagraph(pas.PassengerVisaNumber ?? "");
row.Cells[12].AddParagraph(pas.PassengerInTransit ?? false ? "X" : ""); row.Cells[12].AddParagraph(pas.PassengerPortOfEmbarkation ?? "");
row.Cells[13].AddParagraph(pas.PassengerPortOfDisembarkation ?? "");
row.Cells[14].AddParagraph(pas.PassengerInTransit ?? false ? "X" : "");
row.Cells[15].AddParagraph(pas.EmergencyCare ?? "");
row.Cells[16].AddParagraph(pas.EmergencyContactNumber ?? "");
} }
} }
#endregion #endregion

View File

@ -122,13 +122,23 @@ namespace bsmd.database
[MaxLength(2)] [MaxLength(2)]
[ENI2Validation] [ENI2Validation]
public string CrewMemberIdentityDocumentIssuingState { get; set; } public string CrewMemberIdentityDocumentIssuingState { get; set; }
[ShowReport]
[ReportDisplayName("Expiry date")]
[Validation(ValidationCode.PAST_DATE)] [Validation(ValidationCode.PAST_DATE)]
[ENI2Validation] [ENI2Validation]
public DateTime? CrewMemberIdentityDocumentExpiryDate { get; set; } public DateTime? CrewMemberIdentityDocumentExpiryDate { get; set; }
[ShowReport]
[ReportDisplayName("Doc. Expiry date")]
public string CrewMemberIdentityDocumentExpiryDateDisplay
{
get
{
if (CrewMemberIdentityDocumentExpiryDate.HasValue)
return this.CrewMemberIdentityDocumentExpiryDate.Value.ToShortDateString();
return string.Empty;
}
}
[ENI2Validation] [ENI2Validation]
[MaxLength(256)] [MaxLength(256)]
public string Effects { get; set; } public string Effects { get; set; }

View File

@ -128,13 +128,23 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public string PassengerIdentityDocumentIssuingState { get; set; } public string PassengerIdentityDocumentIssuingState { get; set; }
[ShowReport]
[ReportDisplayName("Expiry date")]
[Validation(ValidationCode.PAST_DATE)] [Validation(ValidationCode.PAST_DATE)]
[ENI2Validation] [ENI2Validation]
public DateTime? PassengerIdentityDocumentExpiryDate { get; set; } public DateTime? PassengerIdentityDocumentExpiryDate { get; set; }
[ShowReport]
[ReportDisplayName("Expiry date")]
public string PassengerIdentityDocumentExpiryDateDisplay
{
get
{
if (this.PassengerIdentityDocumentExpiryDate.HasValue)
return this.PassengerIdentityDocumentExpiryDate.Value.ToShortDateString();
return string.Empty;
}
}
[ENI2Validation] [ENI2Validation]
public bool? NotificationSchengen { get; set; } public bool? NotificationSchengen { get; set; }