public bool CreatePdf()
{
bool result = true;
try
{
if (calendarEvent == null)
{
result = false;
}
else
{
PdfDocument.Open();
Chapter chapter = AddChapter(new Paragraph(GetTitleText("Záznam o návšteve"))
{
SpacingAfter = 10f, Alignment = HAlingmentLeft
}, 0, 0);
iTextSharp.text.Section firstSection = AddSection(chapter, 0f,
new Paragraph(GetSectionText(calendarEvent.Patient.FullName + " " + calendarEvent.StartDate.ToString("d. MMMM yyyy, HH:mm")))
, 0);
firstSection.Add(CreateInfoTable());
iTextSharp.text.Section actionsSection = AddSection(chapter, 0f, new Paragraph(GetSectionText("Vykonané")), 0);
if (!string.IsNullOrEmpty(calendarEvent.ExecutedActionText))
{
actionsSection.Add(new Paragraph(GetText(calendarEvent.ExecutedActionText)));
}
actionsSection.Add(CreateActionsTable());
iTextSharp.text.Section billingSection = AddSection(chapter, 0f, new Paragraph(GetSectionText("Vyúčtovanie")), 0);
EventBill eventBill = calendarEvent.EventBills.FirstOrDefault();
if (eventBill != null && eventBill.EventBillItems.Count != 0)
{
billingSection.Add(CreateBillingTable(eventBill));
}
else
{
billingSection.Add(new Paragraph(GetBoldText("Návšteva neobsahuje žiadne účtovné položky")));
}
PdfDocument.Add(chapter);
AddFooter();
PdfDocument.Close();
}
}
catch (Exception ex)
{
BasicMessagesHandler.LogException(ex);
result = false;
}
return(result);
}