コード例 #1
0
ファイル: MainForm.cs プロジェクト: cubis/electronic-mis
        /*                  Layout for the table
                        *
                        *
                        *       ELECTRONIC MEDICAL INFORMATION SYSTEMS
                        *      --------------------------------------------
                        *       Your Recipt for Wednesday, August 3, 2011
                        *
                        *
                        * Total Charges:     |$100.00
                        * Amount Paid  :     | $50.00
                        *                    ---------
                        * Remaining Balance: | $50.00
                        *
                        * Your type of payment plan:  Monthly
                        *
                        * */
        private void createPDF(Appointment appt, Decimal copay)
        {
            Cursor.Current = Cursors.WaitCursor;

            string path = "./Appt_" + appt.AppointmentID + ".pdf";
            if (File.Exists(path))
            {
                File.Delete(path);
            }

            //Create the Document
            FileStream fs = File.Create(path);
            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, fs);
            document.Open();

            //Create the Table to manage layout for the page
            PdfPTable table = new PdfPTable(1);
            table.HorizontalAlignment = Element.ALIGN_CENTER;

            //Add the logo
            Image logo = Image.GetInstance(Electronic_MIS.Properties.Resources.horizontal_logo, System.Drawing.Imaging.ImageFormat.Bmp);
            logo.Alignment = Image.ALIGN_CENTER;
            document.Add(logo);

            /*
            //Create the Title
            Font titleFont = new Font(iTextSharp.text.Font.FontFamily.COURIER, 18.0f);
            PdfPCell titleCell = new PdfPCell(new Phrase("ELECTRONIC MEDICAL INFORMATION SYSTEMS", titleFont));
            titleCell.HorizontalAlignment = Element.ALIGN_CENTER;
            titleCell.BorderWidth = 0;
            titleCell.BorderWidthBottom = 2f;
             */

            //Create the Subtitle
            PdfPCell subTitleCell = new PdfPCell(new Phrase("Your Recipt For " + appt.AppointmentTime.ToLongDateString() + " at " + appt.AppointmentTime.ToShortTimeString()));
            subTitleCell.HorizontalAlignment = Element.ALIGN_CENTER;
            subTitleCell.BorderWidth = 0;

            //Spacer
            PdfPCell spacer = new PdfPCell();
            spacer.FixedHeight = 100.0f;
            spacer.BorderWidth = 0;

            //Create a table for Appointment Summary
            PdfPTable appointmentSummaryTable = new PdfPTable(2);
            PdfPCell summaryLabelCell = new PdfPCell();
            summaryLabelCell.AddElement(new Phrase("Blood Pressure :"));
            summaryLabelCell.AddElement(new Phrase("Weight :"));
            summaryLabelCell.AddElement(new Phrase("Symptoms :"));
            summaryLabelCell.AddElement(new Phrase("Diagnosis :"));
            summaryLabelCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            summaryLabelCell.Border = 0;
            PdfPCell summaryDataCell = new PdfPCell();
            summaryDataCell.AddElement(new Phrase(appt.BloodPressure));
            summaryDataCell.AddElement(new Phrase(appt.Weight));
            summaryDataCell.AddElement(new Phrase(appt.Symptoms));
            summaryDataCell.AddElement(new Phrase(appt.Diagnosis));
            summaryDataCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            summaryDataCell.Border = 0;
            appointmentSummaryTable.AddCell(summaryLabelCell);
            appointmentSummaryTable.AddCell(summaryDataCell);

            decimal bill;
            if(appt.Bill != "")
            {
                bill = decimal.Parse(appt.Bill);
            }
            else
            {
                bill = 0;
            }
            //Create a table for summary charges
            PdfPTable chargesSummaryTable = new PdfPTable(2);
            PdfPCell summaryLabel = new PdfPCell(new Phrase("Summary of Charges :"));
            summaryLabel.HorizontalAlignment = Element.ALIGN_LEFT;
            summaryLabel.BorderWidth = 0;
            PdfPCell chargesCell = new PdfPCell();
            chargesCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            chargesCell.AddElement(new Phrase("Basic Service Charge:  " + String.Format("{0:C}",(bill/2))));
            chargesCell.AddElement(new Phrase("Medical Supply Charge:  " + String.Format("{0:C}",(bill /4))));
            chargesCell.AddElement(new Phrase("Medicinal Charge:  " + String.Format("{0:C}",(bill /4))));
            chargesCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            chargesCell.BorderWidth = 0;
            chargesSummaryTable.AddCell(summaryLabel);
            chargesSummaryTable.AddCell(chargesCell);

            //Create a subtable for the balance summary
            PdfPTable chargesTable = new PdfPTable(2);
            PdfPCell labelCell = new PdfPCell();
            labelCell.AddElement(new Phrase("Total Charges :\n"));
            labelCell.AddElement(new Phrase("Copay Amount  :\n"));
            labelCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            labelCell.BorderWidth = 0;
            PdfPCell amountCell = new PdfPCell();
            amountCell.AddElement(new Phrase(String.Format("{0:C}",bill)));
            amountCell.AddElement(new Phrase(String.Format("{0:C}",copay)));
            amountCell.BorderWidth = 0;
            amountCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            amountCell.BorderWidthBottom = 1f;
            PdfPCell totalLabel = new PdfPCell();
            totalLabel.AddElement(new Phrase("Remaining Balance :\n"));
            totalLabel.HorizontalAlignment = Element.ALIGN_RIGHT;
            totalLabel.BorderWidth = 0;
            PdfPCell balance = new PdfPCell();
            balance.AddElement(new Phrase(String.Format("{0:C}",copay)));
            balance.HorizontalAlignment = Element.ALIGN_RIGHT;
            balance.BorderWidth = 0;
            chargesTable.AddCell(labelCell);
            chargesTable.AddCell(amountCell);
            chargesTable.AddCell(totalLabel);
            chargesTable.AddCell(balance);

            //table.AddCell(titleCell);
            table.AddCell(subTitleCell);
            table.AddCell(appointmentSummaryTable);
            table.AddCell(spacer);
            table.AddCell(chargesSummaryTable);
            table.AddCell(spacer);
            table.AddCell(chargesTable);

            document.Add(table);

            document.Close();

            System.Diagnostics.Process.Start(Path.GetDirectoryName(Application.ExecutablePath) + path);

            Cursor.Current = Cursors.Arrow;
        }
コード例 #2
0
        private void selectAppointment()
        {
            Appointment appt = (Appointment)cmbAppointments.SelectedItem;
            selectedAppointment = appt;

            calAppointments.SetDate(appt.AppointmentTime);
            appointmentListBox.SelectedItem = appt;

            StringBuilder sb = new StringBuilder();
            sb.Append(appt.AppointmentTime.ToLongDateString());
            sb.Append(" ");
            sb.AppendLine(appt.AppointmentTime.ToLongTimeString());
            sb.AppendLine("Appointment with Dr. " + appt.Doctor);
            sb.AppendLine("Reason: \n\t" + appt.Reason);
            sb.AppendLine("Appointment Status:\t" + appt.Status);

            textBox1.Text = sb.ToString();

            if (appt.Remind != 0)
            {
                remindMeChkBox.CheckState = CheckState.Checked;
            }

            if (appt.Status != "Completed")
            {
                CancelButton.Visible = true;
                btnReschedule.Visible = true;
                remindMeChkBox.Visible = true;
            }
            else
            {
                btnReciept.Visible = true;
            }
        }
コード例 #3
0
 public PrintEventArgs(Appointment appointment, Decimal copay)
 {
     appt = appointment;
     copayment = copay;
 }
コード例 #4
0
        /* Example incoming data
         * -<Appointment>
         * <APPTID>9</APPTID>
         * <PatID>3</PatID>
         * <DocID>1</DocID> <
         * DocName>J</DocName>
         * <PatFirstName>Basil</PatFirstName>
         * <PatLastName>Sattler</PatLastName>
         * <REASON>Getting out of work sutff
         * </REASON> <DATE>2011-07-27</DATE>
         * <TIME>09:45:00</TIME>
         * <STATUS>Scheduled</STATUS>
         * <REMINDER>0</REMINDER>
         * </Appointment>
         */
        private void getAppointments()
        {
            StringBuilder data = new StringBuilder();
            data.Append(server);
            data.Append("apptViewREST.php");
            data.Append("?u=" + WebUtility.HtmlEncode(sessionManager.UserName.ToString()));
            data.Append("&key=" + WebUtility.HtmlEncode(sessionManager.Key));

            string url = data.ToString();
            Debug.WriteLine(url);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";

            Debug.WriteLine(request.ToString());

            request.Timeout = 50000;

            try
            {
                WebResponse response = request.GetResponse();

                /*
                StreamReader reader = new StreamReader(response.GetResponseStream());
                Debug.WriteLine("");
                Debug.WriteLine("LOGIN XML:");
                Debug.WriteLine(reader.ReadToEnd());

                response = request.GetResponse();
                //*/

                XmlTextReader xmlReader = new XmlTextReader(response.GetResponseStream());

                while (xmlReader.Read())
                {
                    switch (xmlReader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (xmlReader.Name == "Appointment")
                            {
                                Appointment newAppt = new Appointment();
                                StringBuilder sb = new StringBuilder();
                                xmlReader.Read();
                                while (xmlReader.Name != "Appointment")
                                {
                                    switch (xmlReader.Name)
                                    {
                                        case "APPTID":
                                            newAppt.AppointmentID = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "PatID":
                                            newAppt.PatientID = xmlReader.ReadElementContentAsInt();
                                            break;

                                        case "DATE":
                                            sb.Append(xmlReader.ReadElementContentAsString() + " ");
                                            break;

                                        case "TIME":
                                            sb.Append(xmlReader.ReadElementContentAsString());
                                            break;

                                        case "PatFirstName":
                                            newAppt.PatientFirstName = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "PatLastName":
                                            newAppt.PatientLastName = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "DocID":
                                            newAppt.Doctor.DoctorID = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "DocName":
                                            newAppt.Doctor.DoctorName = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "REASON":
                                            newAppt.Reason = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "STATUS": ;
                                            newAppt.Status = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "REMINDER":
                                            newAppt.Remind = int.Parse(xmlReader.ReadElementContentAsString());
                                            break;

                                        case "BP":
                                            newAppt.BloodPressure = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "WEIGHT":
                                            newAppt.Weight = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "SYMPTOMS":
                                            newAppt.Symptoms = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "DIAGNOSIS":
                                            newAppt.Diagnosis = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "BILL":
                                            newAppt.Bill = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "PAYMENTPLAN":
                                            newAppt.PaymentPlan = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "NUMMONTHS":
                                            newAppt.PaymentPlan = xmlReader.ReadElementContentAsString();
                                            break;

                                        default:
                                            break;
                                    }
                                    xmlReader.Read();
                                }
                                newAppt.AppointmentTime = DateTime.Parse(sb.ToString());
                                appointments.Add(newAppt);
                            }
                            break;

                        default:
                            break;
                    }
                }
            }
            catch (Exception exp)
            {
                if (exp.Message.Contains("404"))
                {
                    MessageBox.Show("Cannot connect to server.\n  Please try again later.", "Server connection error", MessageBoxButtons.OK);
                }
                else
                {
                    Debug.WriteLine(exp.Message);
                    MessageBox.Show("The program encountered an error.\n  Please try again later.", "Yeah... We didn't plan for this.", MessageBoxButtons.OK);
                }
            }
        }