/// <summary> /// Prints the next appointment. /// </summary> /// <param name="patient">The patient.</param> /// <param name="diagnoses">The diagnoses.</param> /// <param name="todo">The todo.</param> /// <param name="date">The date.</param> /// <param name="time">The time.</param> /// <param name="numberOfSheets">The number of sheets.</param> public void PrintNextAppointment(PatientData patient, string diagnoses, string todo, string date, string time, int numberOfSheets) { if (patient == null) { return; } float leftMargin = 100; float topMargin = 100; Font headlineFont = new Font("Arial", 18.0f, FontStyle.Bold); Font dateFont = new Font("Arial", 12f, FontStyle.Bold); Font pointFont = new Font("Arial", 15f, FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Regular); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point); } //HeadlineFont: 27,59766 //dateFont: 18,39844 //printFont: 16,86523 PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Next Appointment"; PrintablePage pp = new PrintablePage(); OperationData od = patComp.GetLastOperationByPatientID(patient.Id); putLetterhead(pp); float yPos = (float)topMargin + (float)(4 * 16.86523); pp.AddPrintableObject(new PrintableTextObject("NEXT OUTPATIENT APPOINTMENT", headlineFont, Brushes.Red, leftMargin + 100, yPos)); yPos += 16.86523F; yPos += 16.86523F; yPos += 16.86523F; if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, yPos)); } pp.AddPrintableObject(new PrintableTextObject("Printed: " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Patient ID: " + patient.Id.ToString(), pointFont, Brushes.Black, leftMargin, yPos)); yPos += 25F; pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, pointFont, Brushes.Black, leftMargin, yPos)); yPos += 25F; pp.AddPrintableObject(new PrintableTextObject("Date: " + date, pointFont, Brushes.Black, leftMargin, yPos)); yPos += 25F; pp.AddPrintableObject(new PrintableTextObject("Time: " + time, pointFont, Brushes.Black, leftMargin, yPos)); yPos += 25F; pp.AddPrintableObject(new PrintableTextObject("Place: " + SPD.GUI.Properties.Settings.Default.Location, pointFont, Brushes.Black, leftMargin, yPos)); yPos += 25F; yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; yPos += 16.86523F; yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Diagnoses:", dateFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; List<string> diagnosesList = new List<string>(); diagnosesList.Add(diagnoses); diagnosesList = SplitStringsForPrinting(80, diagnosesList); foreach (string diagnosesLine in diagnosesList) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; if (yPos > 1050) { yPos = topMargin; pd.AddPrintPage(pp); pp = new PrintablePage(); } } yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("TODO:", dateFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; List<string> todoList = new List<string>(); todoList.Add(todo); todoList = SplitStringsForPrinting(80, todoList); foreach (string todoLine in todoList) { pp.AddPrintableObject(new PrintableTextObject(todoLine, printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; if (yPos > 1050) { yPos = topMargin; pd.AddPrintPage(pp); pp = new PrintablePage(); } } pd.AddPrintPage(pp); pd.duplicate(numberOfSheets); pd.DoPrint(); }
/// <summary> /// Prints the a3 temperatur curve. /// </summary> /// <param name="patients">The patients.</param> /// <param name="weeks">The weeks.</param> /// <param name="copies">The copies.</param> /// <param name="printFormat">The print format.</param> /// <param name="opParam">The op.</param> public void PrintA3TemperaturCurve(IList<PatientData> patients, int weeks, int copies, PrintFormat printFormat, OperationData opParam) { if (patients == null || patients.Count == 0) { return; } if (copies < 1 || copies > 20) { return; } if (opParam != null && patients.Count != 1) { return; } IList<PrintablePage> printablePageA4 = new List<PrintablePage>(); IList<PrintablePage> printablePageA3 = new List<PrintablePage>(); PrintableDocument pd = new PrintableDocument(); Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold); Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Bold); Font medicationFont = new Font("Arial", 10, FontStyle.Bold); Font symbolFont = new Font("Arial", 22, FontStyle.Bold); float leftMargin = 65; float topMargin = 30; foreach (PatientData patient in patients) { int daysSinceOp = 0; OperationData op; if (opParam == null) { op = patComp.GetLastOperationByPatientID(patient.Id); } else { op = opParam; } IList<string> medications = new List<string>(); IList<int> medDays = new List<int>(); bool hasCatheter = op.KathDays > 0; long kathDays = op.KathDays + 1; //CR ignoring OP Day. fillMedications(op, medications, medDays); //count = 0; DateTime opDate = op.Date; for (int week = 0; week < weeks; week++) { //PrintablePage pp = new PrintablePage(); PrintablePage a4Page = new PrintablePage(); PrintablePage a3Page = new PrintablePage(); //Organ Images... handleOrganImage(topMargin, op, a4Page, a3Page); addPrintableTextObject(1, a4Page, a3Page, "Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, topMargin + (float)(0 * 17.56)); addPrintableTextObject(1, a4Page, a3Page, "Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, topMargin + (float)(0 * 17.56)); addPrintableTextObject(1, a4Page, a3Page, op.Date.Month.ToString() + " " + op.Date.Year.ToString() + " Page: " + (week + 1), dateFont, Brushes.Red, leftMargin, topMargin + (float)28.74); addPrintableTextObject(1, a4Page, a3Page, "Additional Information:", printFont, Brushes.Black, leftMargin + (float)610, topMargin + 10F); //pp.AddPrintableObject(new PrintableTextObject("Notes - Final Report:", printFont, Brushes.Black, leftMargin + (float)635, topMargin + 120F)); addPrintableLineObject(1, a4Page, a3Page, Pens.Black, (int)leftMargin + 610, (int)topMargin + 27, (int)leftMargin + 635 + 175, (int)topMargin + 27); //pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin + 635, (int)topMargin + 137, (int)leftMargin + 635 + 200, (int)topMargin + 137)); Bitmap imgKinderurologieLogo = SPD.GUI.Properties.Resources.KinderurologieLogo; imgKinderurologieLogo.SetResolution(408, 408); addPrintableImageObject(1, a4Page, a3Page, imgKinderurologieLogo, 500, (int)topMargin); addPrintableRectangleObject(1, a4Page, a3Page, Brushes.Yellow, (int)leftMargin - 5 + 3, (int)topMargin + 198 - (2 * 17), 600, (int)printFont.GetHeight()); //Additional Info Rectangle addPrintableRectangleObject(1, a4Page, a3Page, Pens.Black, (int)(leftMargin + 605), (int)topMargin, 300, 220); addPrintableLineObject(1, a4Page, a3Page, Pens.Black, (int)(leftMargin + 605), (int)topMargin + 110, (int)(leftMargin + 605 + 300), (int)topMargin + 110); List<string> addInfo = new List<string>(); addInfo.Add(op.Additionalinformation.Replace(Environment.NewLine, " ")); addInfo = this.SplitStringsForPrinting(40, addInfo); int count = 0; foreach (string line in addInfo) { addPrintableTextObject(1, a4Page, a3Page, line, printFont, Brushes.Black, leftMargin + (float)610, topMargin + 27F + count * 17); count++; } float y = (float)topMargin + (float)(3 * 17.56) + 9; addPrintableTextObject(1, a4Page, a3Page, "Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, y); y += 17; addPrintableTextObject(1, a4Page, a3Page, "First name: " + patient.FirstName.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y); y += 17; addPrintableTextObject(1, a4Page, a3Page, "Surname: " + patient.SurName.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y); y += 17; if (patient.DateOfBirth != null && patient.DateOfBirth.Year > 1800) { addPrintableTextObject(1, a4Page, a3Page, "Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, y); y += 17; } addPrintableTextObject(1, a4Page, a3Page, "Resident of Asmara: " + patient.ResidentOfAsmara.ToString(), printFont, Brushes.Black, leftMargin, y); y += 17; addPrintableTextObject(1, a4Page, a3Page, "OP Date: " + op.Date.ToShortDateString(), printFont, Brushes.Black, leftMargin, y); y += 17; addPrintableTextObject(1, a4Page, a3Page, "OP Diagnosis:", printFont, Brushes.Black, leftMargin, y); if (op.Diagnoses.Replace(Environment.NewLine, " ").Length > 60) { List<string> diagnosesList = new List<string>(); diagnosesList.Add(op.Diagnoses.Replace(Environment.NewLine, " ")); diagnosesList = SplitStringsForPrinting(60, diagnosesList); if (diagnosesList.Count >= 1) { addPrintableTextObject(1, a4Page, a3Page, diagnosesList[0], printFont, Brushes.Black, leftMargin + 110, y); } if (diagnosesList.Count >= 2) { y += 17; addPrintableTextObject(1, a4Page, a3Page, diagnosesList[1], printFont, Brushes.Black, leftMargin + 110, y); } } else { addPrintableTextObject(1, a4Page, a3Page, op.Diagnoses.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin + 110, y); } y += 17; addPrintableTextObject(1, a4Page, a3Page, "Performed OP: " + op.Performed.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y); y += 17; addPrintableTextObject(1, a4Page, a3Page, "OP Team: " + op.Team.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y); //Gray Box addPrintableRectangleObject(1, a4Page, a3Page, Brushes.LightGray, 40, 270, 6 * 182, 30); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, 270, 40 + j * 182, 270 + 7 * 30); } //horizintal lines for (int j = 0; j < 8; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, 270 + j * 30, 40 + 6 * 182, 270 + j * 30); } ////Beschriftung begin if (kathDays > (week * 12)) { addPrintableTextObject(1, a4Page, a3Page, "catheter", printFont, Brushes.Black, 41, 305 + 5 * 30); } count = 0; foreach (string medication in medications) { if (week == 0) { addPrintableTextObject(1, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, 305 + count * 30); } else if (medDays[medications.IndexOf(medication)] >= ((week * 12) + 1)) { addPrintableTextObject(1, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, 305 + count * 30); } for (int j = 0; j < 6; j++) { int currentMedDay = (week * 12 + j) + 1; if ((currentMedDay > 1) && (((currentMedDay - 1) % 6) != 0) && (medDays[count] >= (currentMedDay + 1))) { addPrintableTextObject(1, a4Page, a3Page, " -", symbolFont, Brushes.Black, 41 + j * 182, (305 + count * 30) - 10); } if ((medDays[count] == currentMedDay)) { addPrintableTextObject(1, a4Page, a3Page, " - >", symbolFont, Brushes.Black, 41 + j * 182, (305 + count * 30) - 10); } } count++; } for (int j = 0; j < 6; j++) { int currentMedDay = (week * 12 + j) + 1; if (hasCatheter && (currentMedDay == kathDays)) { if (((kathDays - 1) % 12) == 0) { addPrintableTextObject(1, a4Page, a3Page, " DK ex ", printFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30); } else { addPrintableTextObject(1, a4Page, a3Page, "DK ex ", printFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30); } } else if (hasCatheter && (currentMedDay < kathDays) && ((currentMedDay - 1) % 12) != 0) { addPrintableTextObject(1, a4Page, a3Page, " -", symbolFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30 - 9); } } //Kalendar Überschrift for (int j = 0; j < 6; j++) { addPrintableTextObject(1, a4Page, a3Page, " " + opDate.DayOfWeek.ToString() + " " + opDate.ToShortDateString(), dateFont, Brushes.Blue, 41 + j * 182, 275); if (daysSinceOp == 0) { addPrintableTextObject(1, a4Page, a3Page, "op", dateFont, Brushes.Red, 41 + j * 182, 275); } else { addPrintableTextObject(1, a4Page, a3Page, daysSinceOp.ToString(), dateFont, Brushes.Red, 41 + j * 182, 275); } opDate = opDate.AddDays(1.0); daysSinceOp++; } //// Beschriftung ende int yNursing = 500; addPrintableTextObject(1, a4Page, a3Page, "Nursing and medical orders:", printFont, Brushes.Black, 41, yNursing); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yNursing + 20, 40 + j * 182, yNursing + 150); } //horizintal lines addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yNursing + 20, 40 + 6 * 182, yNursing + 20); addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yNursing + 150, 40 + 6 * 182, yNursing + 150); int yTemperature = 670; addPrintableTextObject(1, a4Page, a3Page, "Temperature:", printFont, Brushes.Black, 41, yTemperature); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yTemperature + 20, 40 + j * 182, yTemperature + 20 + 1/*=number of lines*/ * 30); } //horizintal lines for (int j = 0; j < 2; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yTemperature + 20 + j * 30, 40 + 6 * 182, yTemperature + 20 + j * 30); } //Local status int yLocalStatus = 735; addPrintableTextObject(1, a4Page, a3Page, "Localstatus:", printFont, Brushes.Black, 41, yLocalStatus); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yLocalStatus + 20, 40 + j * 182, yLocalStatus + 20 + 1/*=number of lines*/ * 30); } //horizintal lines for (int j = 0; j < 2; j++) { addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yLocalStatus + 20 + j * 30, 40 + 6 * 182, yLocalStatus + 20 + j * 30); } printablePageA4.Add(a4Page); a4Page = new PrintablePage(); a3Page.AddPrintableObject(new PrintableLineObject(Pens.LightGray, 0, A4smallSite + 45, A4LargeSite, A4smallSite + 45)); //2. seite addPrintableTextObject(2, a4Page, a3Page, "Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, 13 + 45); //Gray Box int calendary = (int)topMargin + 45; addPrintableRectangleObject(2, a4Page, a3Page, Brushes.LightGray, 40, calendary, 6 * 182, 30); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, calendary, 40 + j * 182, calendary + 7 * 30); } //horizintal lines for (int j = 0; j < 8; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, calendary + j * 30, 40 + 6 * 182, calendary + j * 30); } ////Beschriftung begin if (kathDays > ((week * 12) + 6)) { addPrintableTextObject(2, a4Page, a3Page, "catheter", printFont, Brushes.Black, 41, calendary + 5 + 6 * 30); } count = 0; foreach (string medication in medications) { if (medDays[medications.IndexOf(medication)] >= ((week * 12) + 7)) { addPrintableTextObject(2, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, calendary + 5 + 30 + count * 30); } for (int j = 0; j < 6; j++) { int currentMedDay = (week * 12 + j) + 1 + 6; if (((currentMedDay - 1) % 6) != 0 && (medDays[count] >= (currentMedDay + 1))) { addPrintableTextObject(2, a4Page, a3Page, " -", symbolFont, Brushes.Black, 41 + j * 182, (calendary + 5 + 30 + count * 30) - 10); } if ((medDays[count] == currentMedDay)) { addPrintableTextObject(2, a4Page, a3Page, " - >", symbolFont, Brushes.Black, 41 + j * 182, (calendary + 5 + 30 + count * 30) - 10); } } count++; } for (int j = 0; j < 6; j++) { int currentMedDay = (week * 12 + j) + 1 + 6; if (hasCatheter && (currentMedDay == kathDays)) { if (((kathDays - 7) % 12) == 0) { addPrintableTextObject(2, a4Page, a3Page, " DK ex ", printFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30); } else { addPrintableTextObject(2, a4Page, a3Page, "DK ex ", printFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30); } } else if (hasCatheter && (currentMedDay < kathDays) && ((currentMedDay - 7) % 12) != 0) { addPrintableTextObject(2, a4Page, a3Page, " -", symbolFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30 - 9); } } //Kalendar Überschrift for (int j = 0; j < 6; j++) { addPrintableTextObject(2, a4Page, a3Page, " " + opDate.DayOfWeek.ToString() + " " + opDate.ToShortDateString(), dateFont, Brushes.Blue, 41 + j * 182, calendary + 5); if (daysSinceOp == 0) { addPrintableTextObject(2, a4Page, a3Page, "op", dateFont, Brushes.Red, 41 + j * 182, calendary + 5); } else { addPrintableTextObject(2, a4Page, a3Page, daysSinceOp.ToString(), dateFont, Brushes.Red, 41 + j * 182, calendary + 5); } opDate = opDate.AddDays(1.0); daysSinceOp++; } //// Beschriftung ende yNursing = 295; addPrintableTextObject(2, a4Page, a3Page, "Nursing and medical orders:", printFont, Brushes.Black, 41, yNursing); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yNursing + 20, 40 + j * 182, yNursing + 150); } //horizintal lines addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yNursing + 20, 40 + 6 * 182, yNursing + 20); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yNursing + 150, 40 + 6 * 182, yNursing + 150); yTemperature = 455; addPrintableTextObject(2, a4Page, a3Page, "Temperature:", printFont, Brushes.Black, 41, yTemperature); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yTemperature + 20, 40 + j * 182, yTemperature + 20 + 1/*=number of lines*/ * 30); } //horizintal lines for (int j = 0; j < 2; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yTemperature + 20 + j * 30, 40 + 6 * 182, yTemperature + 20 + j * 30); } //Local Status yLocalStatus = 520; addPrintableTextObject(2, a4Page, a3Page, "Localstatus:", printFont, Brushes.Black, 41, yLocalStatus); //vertical lines for (int j = 0; j < 7; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yLocalStatus + 20, 40 + j * 182, yLocalStatus + 20 + 1/*=number of lines*/ * 30); } //horizintal lines for (int j = 0; j < 2; j++) { addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yLocalStatus + 20 + j * 30, 40 + 6 * 182, yLocalStatus + 20 + j * 30); } int y3rdBlock = 580; int widthlastbox = 335; int xft = 41; int xcont = xft + widthlastbox + xft; int xfo = xft + widthlastbox + xft + widthlastbox + xft; addPrintableTextObject(2, a4Page, a3Page, "Further Treatment for discharge:", printFont, Brushes.Black, xft, y3rdBlock); addPrintableTextObject(2, a4Page, a3Page, "Control(s) planned for:", printFont, Brushes.Black, xcont, y3rdBlock); addPrintableTextObject(2, a4Page, a3Page, "Further operation planned for:", printFont, Brushes.Black, xfo, y3rdBlock); //3 oberen Linien der Boxen addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 20, xft + widthlastbox, y3rdBlock + 20); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20); //3 unteren Linien der Boxen addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 177, xft + widthlastbox, y3rdBlock + 177); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 200, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 200, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200); //vertikale Linien der Boxen addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 20, xft, y3rdBlock + 177); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox, y3rdBlock + 177); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft, y3rdBlock + 200); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 200); addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200); addPrintableTextObject(2, a4Page, a3Page, "Treatment completed: yes no", printFont, Brushes.Black, xft, y3rdBlock + 180); addPrintableRectangleObject(2, a4Page, a3Page, Pens.Black, xft + 195, y3rdBlock + 180, 20, 20); addPrintableRectangleObject(2, a4Page, a3Page, Pens.Black, xft + 246, y3rdBlock + 180, 20, 20); printablePageA4.Add(a4Page); printablePageA3.Add(a3Page); } } pd.PrintPageList = printablePageA3; pd.duplicate(copies); pd.Landscape = false; pd.DocumentName = "SPD Temperature Curve A3"; PrintDialog printDialog = null; if (printFormat == PrintFormat.A3) { pd.PaperKindOrNothing = PaperKind.A3; printDialog = pd.DoPrint(); if (printDialog != null) { pd.PaperKindOrNothing = PaperKind.A4; pd.Landscape = true; pd.PrintPageList = printablePageA4; pd.duplicate(copies); printDialog = pd.DoPrint(printDialog); } } else if (printFormat == PrintFormat.A4) { pd.PaperKindOrNothing = PaperKind.A4; printDialog = pd.DoPrint(); } if (printDialog != null) { MessageBox.Show("Sorry - printing not possible!"); } }
/// <summary> /// Prints the next action faxlist. /// </summary> /// <param name="patients">List of Patients</param> /// <param name="year">The year.</param> /// <param name="halfYear">The half year.</param> /// <param name="actionKind">Kind of the action.</param> public void PrintNextActionFaxlist(IList<PatientData> patients, long year, long halfYear, ActionKind actionKind) { if (patients == null || patients.Count == 0) { return; } PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Next Action Fax List"; pd.Landscape = true; Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold); Font tableHeadFont = new Font("Arial", 10, FontStyle.Bold); Font printFont = new Font("Arial", 10, FontStyle.Regular); float leftMargin = 30; float topMargin = 30; int page = 1; int xId = (int)leftMargin; int xName = 70; int xAge = 350; int xSex = 400; int xPhone = 450; int xDiagnoses = 600; // private int A4smallSite = 826; //private int A4LargeSite = 1169; PrintablePage pp = new PrintablePage(); int yTable = (int)topMargin + 22; //Headline DrawNextActionFaxListHeadline(patients, pp, actionKind, halfYear, year, page, headlineFont, leftMargin, topMargin, tableHeadFont, xId, xName, xAge, xSex, xPhone, xDiagnoses); int patientCount = 0; foreach (PatientData patient in patients) { //pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, yTable, (int)leftMargin + 1109, yTable)); pp.AddPrintableObject(new PrintableTextObject(patient.Id.ToString(), printFont, Brushes.Black, xId, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xName, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, xName, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xAge, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); pp.AddPrintableObject(new PrintableTextObject(StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, xAge, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xSex, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); pp.AddPrintableObject(new PrintableTextObject(patient.Sex.ToString() , printFont, Brushes.Black, xSex, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xPhone, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); pp.AddPrintableObject(new PrintableTextObject(patient.Phone , printFont, Brushes.Black, xPhone, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xDiagnoses, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); string diagnoses = string.Empty; OperationData op = patComp.GetLastOperationByPatientID(patient.Id); if (op != null && !string.IsNullOrEmpty(op.Diagnoses)) { diagnoses = "OP: " + op.Diagnoses; } else { VisitData visit = patComp.GetLastVisitByPatientID(patient.Id); if (visit != null && !string.IsNullOrEmpty(visit.ExtraDiagnosis)) { diagnoses = "Visit: " + visit.ExtraDiagnosis; } } pp.AddPrintableObject(new PrintableTextObject(diagnoses, printFont, Brushes.Black, xDiagnoses, yTable + 1 + 16 + (patientCount * 16))); pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, (int)leftMargin + 1109, yTable + 1 + 16 + (patientCount * 16), 1000, 16)); patientCount++; if (patientCount > 45) { drawNextActionFaxListTable(pp, leftMargin, yTable, xId, xName, xAge, xSex, xPhone, xDiagnoses); page++; pd.AddPrintPage(pp); pp = new PrintablePage(); patientCount = 0; DrawNextActionFaxListHeadline(patients, pp, actionKind, halfYear, year, page, headlineFont, leftMargin, topMargin, tableHeadFont, xId, xName, xAge, xSex, xPhone, xDiagnoses); } } drawNextActionFaxListTable(pp, leftMargin, yTable, xId, xName, xAge, xSex, xPhone, xDiagnoses); pd.AddPrintPage(pp); pd.DoPrint(); }
/// <summary> /// Prints the next action list. /// </summary> /// <param name="patients">The patients.</param> /// <param name="year">The year.</param> /// <param name="halfyear">The halfyear.</param> /// <param name="actionKind">Kind of the action.</param> public void PrintNextActionList(IList<PatientData> patients, long year, long halfyear, ActionKind actionKind) { if (patients == null || patients.Count == 0) { return; } PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Next Action List"; pd.Landscape = false; Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold); Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Regular); Font boldPrintFont = new Font("Arial", 11, FontStyle.Bold); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 30, FontStyle.Regular, GraphicsUnit.Point); } float leftMargin = 65; float topMargin = 30; int page = 1; int line = 2; PrintablePage pp = new PrintablePage(); pp.AddPrintableObject(new PrintableTextObject("SPD - NextAction - " + actionKind.ToString(), headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(year + " - " + halfyear + " " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); foreach (PatientData patient in patients) { pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Sex: " + patient.Sex, printFont, Brushes.Black, leftMargin + 100, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Phone: " + patient.Phone, printFont, Brushes.Black, leftMargin + 200, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - " + CommonUtilities.StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth) + " years", printFont, Brushes.Black, leftMargin + 450, topMargin + (float)(line * 17.56))); line++; if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, topMargin + (float)(line * 17.56))); } pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; List<string> extradiagnoses = new List<string>(); OperationData operation = this.patComp.GetLastOperationByPatientID(patient.Id); VisitData visit = this.patComp.GetLastVisitByPatientID(patient.Id); if (operation != null && !String.IsNullOrEmpty(operation.Diagnoses)) { extradiagnoses.Add(operation.Diagnoses); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("OP Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } if (visit != null && !String.IsNullOrEmpty(visit.ExtraDiagnosis)) { extradiagnoses.Add(visit.ExtraDiagnosis); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("Visit Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } //Therapy if (visit != null && !String.IsNullOrEmpty(visit.ExtraTherapy)) { List<string> therapy = new List<string>(); therapy.Add(visit.ExtraTherapy); therapy = this.SplitStringsForPrinting(80, therapy); pp.AddPrintableObject(new PrintableTextObject("Visit Therapy:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string therapyLine in therapy) { pp.AddPrintableObject(new PrintableTextObject(therapyLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } //TODO List<string> todo = new List<string>(); foreach(NextActionData nextAction in patComp.GetNextActionsByPatientID(patient.Id)) { if (nextAction.ActionYear == year && nextAction.ActionhalfYear == halfyear && nextAction.ActionKind == actionKind && !String.IsNullOrEmpty(nextAction.Todo)) { todo.Add(nextAction.Todo); } } if (todo.Count > 0) { pp.AddPrintableObject(new PrintableTextObject("ToDo:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; todo = this.SplitStringsForPrinting(80, todo); foreach (string todoLine in todo) { pp.AddPrintableObject(new PrintableTextObject(todoLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)((line + 2) * 17.56), (int)leftMargin + 680, (int)((line + 2) * 17.56))); line++; if (line > 50) { page++; pd.AddPrintPage(pp); pp = new PrintablePage(); line = 2; pp.AddPrintableObject(new PrintableTextObject("NextAction - " + actionKind.ToString() + " " + year + "\\" + halfyear + " " + patients.Count + " Patients", headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject("SPD", headlineFont, Brushes.Black, leftMargin + 400, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, headlineFont, Brushes.Black, leftMargin + 500, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); } } pd.AddPrintPage(pp); pd.DoPrint(); }
/// <summary> /// Prints the final report. /// </summary> /// <param name="patients">The patients.</param> public void PrintFinalReport(IList<PatientData> patients) { if (patients == null || patients.Count == 0) { return; } float leftMargin = 100; float topMargin = 100; Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold); Font dateFont = new Font("Arial", 12f, FontStyle.Bold); Font finalReportFont = new Font("Arial", 14.0f, FontStyle.Underline | FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Regular); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point); } //HeadlineFont: 27,59766 //dateFont: 18,39844 //finalReportFont: 21,46484 //printFont: 16,86523 PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Final Report"; foreach (PatientData patient in patients) { PrintablePage pp = new PrintablePage(); OperationData od = patComp.GetLastOperationByPatientID(patient.Id); //pp.AddPrintableObject(new PrintableTextObject("Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, (float)(topMargin + (0 * 16.86523)))); pp.AddPrintableObject(new PrintableTextObject(od.Date.Month.ToString() + " " + od.Date.Year.ToString(), dateFont, Brushes.Red, leftMargin, (float)(topMargin + 40))); pp.AddPrintableObject(new PrintableFillRectangleObject(Brushes.Yellow, (int)(leftMargin - 5 + 3), 320, 600, (int)(16.86523 + 1))); //Bitmap img = SPD.GUI.Properties.Resources.KinderurologieLogo; //img.SetResolution(408, 408); //pp.AddPrintableObject(new PrintableImageObject(img, 550, (int)topMargin)); //img = SPD.GUI.Properties.Resources.HFO; //img.SetResolution(550, 550); //pp.AddPrintableObject(new PrintableImageObject(img, 550, (int)topMargin + 40)); putLetterhead(pp); float yPos = (float)topMargin + (float)(4 * 16.86523); if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, yPos)); } pp.AddPrintableObject(new PrintableTextObject("Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("First name: " + patient.FirstName, printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Surname: " + patient.SurName, printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; yPos += 16.86523F; yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("OP Date: " + od.Date.ToShortDateString(), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; List<string> strs = new List<string>(); strs.Add(od.Diagnoses.Replace('\n', ' ').Replace('\r', ' ')); strs = SplitStringsForPrinting(75, strs); pp.AddPrintableObject(new PrintableTextObject("OP Diagnosis: " + strs[0], printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; if (strs.Count > 1) { pp.AddPrintableObject(new PrintableTextObject(" " + strs[1], printFont, Brushes.Black, leftMargin, yPos)); } yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("Performed OP: " + od.Performed.Replace('\n', ' ').Replace('\r', ' '), printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; pp.AddPrintableObject(new PrintableTextObject("OP Team: " + od.Team.Replace('\n', ' ').Replace('\r', ' '), printFont, Brushes.Black, leftMargin, yPos)); pp.AddPrintableObject(new PrintableTextObject("Final Report:", finalReportFont, Brushes.Red, leftMargin, 380)); List<string> finalReportList = new List<string>(); finalReportList.Add(patComp.GetFinalReportByPatientId(patient.Id)); finalReportList = SplitStringsForPrinting(80, finalReportList); yPos = 410; foreach (string finalReportLine in finalReportList) { pp.AddPrintableObject(new PrintableTextObject(finalReportLine, printFont, Brushes.Black, leftMargin, yPos)); yPos += 16.86523F; if (yPos > 1050) { yPos = topMargin; pd.AddPrintPage(pp); pp = new PrintablePage(); } } pd.AddPrintPage(pp); } pd.DoPrint(); }
/// <summary> /// Prints Id Cards 86 mm * 54 mm /// </summary> /// <param name="patients">List of Patients</param> public void PrintIdCard(IList<PatientData> patients) { if (patients == null || patients.Count == 0) { return; } if (patients.Count > 1) { throw new NotImplementedException("More Id-Cards not supported until now!"); } PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD ID Card"; pd.Landscape = true; Font idFont = new Font("Arial", 22, FontStyle.Bold); Font nameFont = new Font("Arial", 14, FontStyle.Bold); PrintablePage pp = new PrintablePage(); PatientData patient = patients[0]; pp.AddPrintableObject(new PrintableTextObject("ID " + patient.Id, idFont, Brushes.Black, 15, 163)); pp.AddPrintableObject(new PrintableTextObject(patient.FirstName, nameFont, Brushes.Black, 140, 161)); pp.AddPrintableObject(new PrintableTextObject(patient.SurName, nameFont, Brushes.Black, 140, 181)); pd.AddPrintPage(pp); PrintDialog oPrintDialog = new PrintDialog(); string printername = null; foreach (string printernameloop in PrinterSettings.InstalledPrinters) { if (printernameloop.ToLower().Contains("zebra") || printernameloop.ToLower().Contains("p110")) { printername = printernameloop; break; } } if (printername != null) { pd.PrinterName = printername; } pd.DoPrint(null, printername == null); }
private void drawNextActionFaxListTable(PrintablePage pp, float leftMargin, int yTable, int xId, int xName, int xAge, int xSex, int xPhone, int xDiagnoses) { //Horizontal Lines: int numberOflines = 47; for (int i = 0; i <= numberOflines; i++) { pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, yTable + (i * 16), (int)leftMargin + 1109, yTable + (i * 16))); } //Vertikal Lines pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xId, yTable, xId, yTable + (numberOflines * 16))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xName, yTable, xName, yTable + (numberOflines * 16))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xAge, yTable, xAge, yTable + (numberOflines * 16))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xSex, yTable, xSex, yTable + (numberOflines * 16))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xPhone, yTable, xPhone, yTable + (numberOflines * 16))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, xDiagnoses, yTable, xDiagnoses, yTable + (numberOflines * 16))); //Last verticalLine... pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin + 1109, yTable, (int)leftMargin + 1109, yTable + (numberOflines * 16))); }
private void putLetterhead(PrintablePage pp) { Bitmap img = SPD.GUI.Properties.Resources.letterhead; //img.SetResolution(); pp.AddPrintableObject(new PrintableImageObject(img, 0, 0)); }
/// <summary> /// Adds the printable text object. /// </summary> /// <param name="a3page">The a3page.</param> /// <param name="pA4">The p a4.</param> /// <param name="pA3">The p a3.</param> /// <param name="text">The text.</param> /// <param name="font">The font.</param> /// <param name="brush">The brush.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> private void addPrintableTextObject(int a3page, PrintablePage pA4, PrintablePage pA3, string text, Font font, Brush brush, float x, float y) { pA4.AddPrintableObject(new PrintableTextObject(text, font, brush, x, y)); if (a3page > 1) { pA3.AddPrintableObject(new PrintableTextObject(text, font, brush, x, y + A4smallSite)); } else { pA3.AddPrintableObject(new PrintableTextObject(text, font, brush, x, y)); } }
private void DrawNextActionFaxListHeadline(IList<PatientData> patients, PrintablePage pp, ActionKind actionKind, long halfYear, long year, int page, Font headlineFont, float leftMargin, float topMargin, Font tableHeadFont, int xId, int xName, int xAge, int xSex, int xPhone, int xDiagnoses) { pp.AddPrintableObject(new PrintableTextObject("SPD - NextAction - FAX List " + actionKind.ToString() + " " + halfYear + "/" + year + " Page: " + page + " No of Patients: " + patients.Count, headlineFont, Brushes.Black, leftMargin, topMargin)); //TableHead pp.AddPrintableObject(new PrintableFillRectangleObject(Brushes.LightGray, (int)leftMargin, (int)topMargin + 22, 1109, 16)); pp.AddPrintableObject(new PrintableTextObject("ID", tableHeadFont, Brushes.Black, xId, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Name", tableHeadFont, Brushes.Black, xName, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Age", tableHeadFont, Brushes.Black, xAge, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Sex", tableHeadFont, Brushes.Black, xSex, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Phone", tableHeadFont, Brushes.Black, xPhone, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Diagnoses", tableHeadFont, Brushes.Black, xDiagnoses, topMargin + 23)); }
/// <summary> /// Adds the printable rectangle object. /// </summary> /// <param name="a3page">The a3page.</param> /// <param name="pA4">The p a4.</param> /// <param name="pA3">The p a3.</param> /// <param name="pen">The pen.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> private void addPrintableRectangleObject(int a3page, PrintablePage pA4, PrintablePage pA3, Pen pen, int x, int y, int width, int height) { pA4.AddPrintableObject(new PrintableRectangleObject(pen, x, y, width, height)); if (a3page > 1) { pA3.AddPrintableObject(new PrintableRectangleObject(pen, x, y + A4smallSite, width, height)); } else { pA3.AddPrintableObject(new PrintableRectangleObject(pen, x, y, width, height)); } }
/// <summary> /// Adds the printable line object. /// </summary> /// <param name="a3page">The a3page.</param> /// <param name="pA4">The p a4.</param> /// <param name="pA3">The p a3.</param> /// <param name="pen">The pen.</param> /// <param name="x1">The x1.</param> /// <param name="y1">The y1.</param> /// <param name="x2">The x2.</param> /// <param name="y2">The y2.</param> private void addPrintableLineObject(int a3page, PrintablePage pA4, PrintablePage pA3, Pen pen, int x1, int y1, int x2, int y2) { pA4.AddPrintableObject(new PrintableLineObject(pen, x1, y1, x2, y2)); if (a3page > 1) { pA3.AddPrintableObject(new PrintableLineObject(pen, x1, y1 + A4smallSite, x2, y2 + A4smallSite)); } else { pA3.AddPrintableObject(new PrintableLineObject(pen, x1, y1, x2, y2)); } }
/// <summary> /// Adds the printable rectangle object. /// </summary> /// <param name="a3page">The a3page.</param> /// <param name="pA4">The p a4.</param> /// <param name="pA3">The p a3.</param> /// <param name="image">The image.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> private void addPrintableImageObject(int a3page, PrintablePage pA4, PrintablePage pA3, Image image, int x, int y) { pA4.AddPrintableObject(new PrintableImageObject(image, x, y)); if (a3page > 1) { pA3.AddPrintableObject(new PrintableImageObject(image, x, y + A4smallSite)); } else { pA3.AddPrintableObject(new PrintableImageObject(image, x, y)); } }
/// <summary> /// Prints the patients. /// </summary> /// <param name="patients">The patients.</param> /// <param name="patientPrintDetails">The patient print details.</param> public void PrintPatients(IList<PatientData> patients, PatientPrintDetails patientPrintDetails) { if (patients == null || patients.Count == 0) { return; } float leftMargin = 100; float topMargin = 100; Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold); Font dateFont = new Font("Arial", 12f, FontStyle.Bold); Font finalReportFont = new Font("Arial", 14.0f, FontStyle.Underline | FontStyle.Bold); Font printFont = new Font("Arial", 12, FontStyle.Regular); Font boldFont = new Font("Arial", 12, FontStyle.Bold); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point); } //HeadlineFont: 27,59766 //dateFont: 18,39844 //finalReportFont: 21,46484 //printFont: 16,86523 PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Patient Data"; foreach (PatientData patient in patients) { PrintablePage pp = new PrintablePage(); OperationData od = patComp.GetLastOperationByPatientID(patient.Id); if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, 110)); } List<string> printList = new List<string>(); printList.Add("Patient ID: " + patient.Id.ToString()); printList.Add("First name: " + patient.FirstName); printList.Add("Surname: " + patient.SurName); printList.Add("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth)); printList.Add("Sex: " + patient.Sex.ToString()); if (!string.IsNullOrEmpty(patient.Address)) printList.Add("Address: " + patient.Address); printList.Add("Weight: " + patient.Weight); printList.Add("Phone: " + patient.Phone.ToString()); if ((patientPrintDetails & PatientPrintDetails.Fotolinks) == PatientPrintDetails.Fotolinks) { if (this.patComp.GetImagesByPatientID(patient.Id).Count > 0) { printList.Add(""); printList.Add("Image Links:"); } foreach (ImageData image in this.patComp.GetImagesByPatientID(patient.Id)) { printList.Add(image.Kommentar); printList.Add(image.Link); } } if ((patientPrintDetails & PatientPrintDetails.Visits) == PatientPrintDetails.Visits) { foreach (VisitData visit in this.patComp.GetVisitsByPatientID(patient.Id)) { printList.Add(""); printList.Add("Visit ID: " + visit.Id.ToString()); printList.Add("Visit date: " + visit.VisitDate.ToShortDateString()); if (!visit.Cause.Equals("")) printList.Add("Cause: " + visit.Cause); if (!visit.Localis.Equals("")) printList.Add("STATUS localis: " + visit.Localis); if (!visit.ExtraDiagnosis.Equals("")) printList.Add("Diagnosis: " + visit.ExtraDiagnosis); if (!visit.Procedure.Equals("")) printList.Add("Procedure: " + visit.Procedure); if (!visit.ExtraTherapy.Equals("")) printList.Add("Therapy: " + visit.ExtraTherapy); if (!visit.Anesthesiology.Equals("")) printList.Add("Anaesthesia: " + visit.Anesthesiology); if (!visit.Blooddiagnostic.Equals("")) printList.Add("Blooddiagnostic: " + visit.Blooddiagnostic); if (!visit.Radiodiagnostics.Equals("")) printList.Add("Radiodiagnostics: " + visit.Radiodiagnostics); if (!visit.Todo.Equals("")) printList.Add("Todo: " + visit.Todo); if (!visit.Ultrasound.Equals("")) { string ultrasound = visit.Ultrasound; ultrasound = " " + ultrasound; ultrasound = ultrasound.Replace(Environment.NewLine, Environment.NewLine + " "); printList.Add("Ultrasound:" + Environment.NewLine + ultrasound); } } } if ((patientPrintDetails & PatientPrintDetails.Operations) == PatientPrintDetails.Operations) { foreach (OperationData operation in this.patComp.GetOperationsByPatientID(patient.Id)) { printList.Add(""); printList.Add("Operation ID: " + operation.OperationId.ToString()); printList.Add("Date: " + operation.Date.ToShortDateString()); if (!operation.Team.Equals("")) printList.Add("Team: " + operation.Team); if (!operation.Process.Equals("")) printList.Add("Process: " + operation.Process); if (!operation.Diagnoses.Equals("")) printList.Add("Diagnosis: " + operation.Diagnoses); if (!operation.Performed.Equals("")) printList.Add("Performed: " + operation.Performed); if (!operation.Additionalinformation.Equals("")) printList.Add("Additional Information: " + operation.Additionalinformation); if (!operation.Medication.Equals("")) printList.Add("Medication: " + operation.Medication); printList.Add("Intdiagnosis: " + operation.IntDiagnoses.ToString()); printList.Add("PP PS: " + operation.Ppps.ToString()); printList.Add("Result: " + operation.Result.ToString()); } } if ((patientPrintDetails & PatientPrintDetails.FinalReport) == PatientPrintDetails.FinalReport) { if (!this.patComp.GetFinalReportByPatientId(patient.Id).Equals("")) { printList.Add(""); printList.Add("Final Report"); printList.Add(this.patComp.GetFinalReportByPatientId(patient.Id)); } } printList = SplitStringsForPrinting(80, printList); int lineNo = 0; int page = 1; float yPos = topMargin;// + (count * printFont.GetHeight(ev.Graphics)); pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin - 20)); pp.AddPrintableObject(new PrintableTextObject("SPD " + DateTime.Now.ToShortDateString() + " Page " + page, printFont, Brushes.Black, leftMargin + 300, topMargin - 20)); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin - 2, (int)leftMargin + 650, (int)topMargin - 2)); foreach (string line in printList) { if (lineNo >= 50) { // Neue Seite anfangen pp.AddPrintableObject(new PrintableTextObject("Page " + page, printFont, Brushes.Black, leftMargin, 1069F)); lineNo = 0; page++; pd.AddPrintPage(pp); pp = new PrintablePage(); yPos = topMargin; pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin - 20)); pp.AddPrintableObject(new PrintableTextObject("SPD " + DateTime.Now.ToShortDateString() + " Page " + page, printFont, Brushes.Black, leftMargin + 300, topMargin - 20)); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin - 2, (int)leftMargin + 650, (int)topMargin - 2)); } yPos += 16.86523F; if (line.StartsWith("Surname:") || line.StartsWith("Visit ID:") || line.StartsWith("Operation ID:") || line.StartsWith("Final Report") || line.StartsWith("Image Links:")) { pp.AddPrintableObject(new PrintableTextObject(line, boldFont, Brushes.Black, leftMargin, yPos)); } else { pp.AddPrintableObject(new PrintableTextObject(line, printFont, Brushes.Black, leftMargin, yPos)); } lineNo++; } pd.AddPrintPage(pp); } pd.DoPrint(); }
/// <summary> /// Prints the next action list. /// </summary> /// <param name="patients">The patients.</param> /// <param name="headline">The headline.</param> public void PrintPatientList(IList<PatientData> patients, string headline, bool useOpData) { if (patients == null || patients.Count == 0) { return; } PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Next Action List"; pd.Landscape = false; Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold); Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Regular); Font boldPrintFont = new Font("Arial", 11, FontStyle.Bold); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 30, FontStyle.Regular, GraphicsUnit.Point); } float leftMargin = 65; float topMargin = 30; int page = 1; int line = 2; PrintablePage pp = new PrintablePage(); pp.AddPrintableObject(new PrintableTextObject("SPD - " + headline, headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(" " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); foreach (PatientData patient in patients) { pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Sex: " + patient.Sex, printFont, Brushes.Black, leftMargin + 100, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Phone: " + patient.Phone, printFont, Brushes.Black, leftMargin + 200, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - " + CommonUtilities.StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth) + " years", printFont, Brushes.Black, leftMargin + 450, topMargin + (float)(line * 17.56))); line++; if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, topMargin + (float)(line * 17.56))); } pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; OperationData operation = this.patComp.GetLastOperationByPatientID(patient.Id); VisitData visit = this.patComp.GetLastVisitByPatientID(patient.Id); if (operation != null && useOpData) { if (!String.IsNullOrEmpty(operation.Diagnoses)) { List<string> extradiagnoses = new List<string>(); extradiagnoses.Add(operation.Diagnoses); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("OP Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float) (line*17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float) (line*17.56))); line++; } } if (!String.IsNullOrEmpty(operation.Performed)) { List<string> performed = new List<string>(); performed.Add(operation.Performed); performed = this.SplitStringsForPrinting(80, performed); pp.AddPrintableObject(new PrintableTextObject("OP Performed:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string performedLine in performed) { pp.AddPrintableObject(new PrintableTextObject(performedLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } if (!String.IsNullOrEmpty(operation.Team)) { List<string> team = new List<string>(); team.Add(operation.Diagnoses); team = this.SplitStringsForPrinting(80, team); pp.AddPrintableObject(new PrintableTextObject("OP Team:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string teamLine in team) { pp.AddPrintableObject(new PrintableTextObject(teamLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } } else { if (visit != null && !String.IsNullOrEmpty(visit.ExtraDiagnosis)) { List<string> extradiagnoses = new List<string>(); extradiagnoses.Add(visit.ExtraDiagnosis); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("Visit Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } } pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)((line + 2) * 17.56), (int)leftMargin + 680, (int)((line + 2) * 17.56))); line++; if (line > 50) { page++; pd.AddPrintPage(pp); pp = new PrintablePage(); line = 2; pp.AddPrintableObject(new PrintableTextObject("SPD - " + headline, headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(" " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); } } pd.AddPrintPage(pp); pd.DoPrint(); }