Example #1
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         if (MessageBox.Show("Are you sure you want to Print Year wise Patient History??", "Patient History Print??", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             opd       opd = new opd();
             dbconnect db  = new dbconnect();
             medicineCount = 0;
             opd.getPatientOPDHistory(textBox1.Text, comboBox2.Text + "0101", (Convert.ToInt32(comboBox2.Text) + 1).ToString() + "0101", db);
             while (opd.dr.Read())
             {
                 medicine_id    = opd.dr[2].ToString().Split(',');
                 medicineCount += medicine_id.Length;
             }
             db.dbclose();
             try
             {
                 j = 1;
                 printDocument2.PrinterSettings.PrinterName = comboBox3.SelectedItem.ToString();
                 printDocument2.Print();
             }
             catch (Exception Ex)
             {
                 MessageBox.Show(Ex.Message + "\n\nPrinter Not Connected Properly!! Please Check that and then Print!!");
             }
         }
     }
     else
     {
         MessageBox.Show("Please Select a Patient from the list!!!");
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool      details = false;
            opd       opd     = new opd();
            dbconnect db      = new dbconnect();

            opd.getPatientDetailsHistory(textBox1.Text, db);
            if (opd.dr.Read())
            {
                id         = textBox1.Text;
                name       = opd.dr[0].ToString();
                gender     = opd.dr[1].ToString();
                familyHead = opd.dr[2].ToString();
                details    = true;
            }
            else
            {
                MessageBox.Show("Invalid Patient ID!!");
                db.dbclose();
            }
            db.reader_close();
            if (details)
            {
                opdCount      = 0;
                medicineCount = 0;
                opd.patientAge(id);
                age = opd.age.ToString();
                opd.getPatientOPDHistory(textBox1.Text, db);
                while (opd.dr.Read())
                {
                    medicine_id    = opd.dr[2].ToString().Split(',');
                    medicineCount += medicine_id.Length;
                    opdCount      += 1;
                }
                db.dbclose();
                printPreviewDialog1.ShowDialog();
            }
        }
Example #3
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         opd       opd = new opd();
         dbconnect db  = new dbconnect();
         medicineCount = 0;
         opd.getPatientOPDHistory(textBox1.Text, dateTimePicker2.Value.ToString("yyyyMMdd"), dateTimePicker1.Value.ToString("yyyyMMdd"), db);
         while (opd.dr.Read())
         {
             medicine_id    = opd.dr[2].ToString().Split(',');
             medicineCount += medicine_id.Length;
         }
         db.dbclose();
         j = 1;
         printDocument3.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
         printPreviewDialog1.Document   = printDocument3;
         printPreviewDialog1.ShowDialog();
     }
     else
     {
         MessageBox.Show("Please Select a Patient from the list!!!");
     }
 }
Example #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         opd       opd = new opd();
         dbconnect db  = new dbconnect();
         medicineCount = 0;
         opd.getPatientOPDHistory(textBox1.Text, comboBox2.Text + "0101", (Convert.ToInt32(comboBox2.Text) + 1).ToString() + "0101", db);
         while (opd.dr.Read())
         {
             medicine_id    = opd.dr[2].ToString().Split(',');
             medicineCount += medicine_id.Length;
         }
         db.dbclose();
         j = 1;
         printDocument2.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
         printPreviewDialog1.Document   = printDocument2;
         printPreviewDialog1.ShowDialog();
     }
     else
     {
         MessageBox.Show("Please Select a Patient from the list!!!");
     }
 }
Example #5
0
        private void printDocument3_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;

            g.PageUnit = GraphicsUnit.Millimeter;
            Font messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            Pen  blackPen    = new Pen(Color.Black, 1);
            int  total;

            if (j == 1)
            {
                g.DrawString("INSTITUTE DISPENSARY", messageFont, Brushes.Black, 75, 5);
                g.DrawString("INDIAN INSTITUTE OF TECHNOLOGY ROORKEE, SAHARANPUR CAMPUS", messageFont, Brushes.Black, 22, 10);
                messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
                g.DrawString("PATIENT MEDICAL HISTORY", messageFont, Brushes.Black, 65, 15);
                messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
                g.DrawString("(From " + dateTimePicker2.Value.ToString("dd MMM, yyyy") + "   To   " + dateTimePicker1.Value.ToString("dd MMM, yyyy") + ")", messageFont, Brushes.Black, 77, 20);
                g.DrawLine(blackPen, 5, 26, 205, 26);
                messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
                g.DrawString("Patient Name: " + textBox2.Text, messageFont, Brushes.Black, 10, 27);
                g.DrawString("Patient ID: " + textBox1.Text, messageFont, Brushes.Black, 10, 33);
                g.DrawString("Age: " + textBox4.Text + " Years", messageFont, Brushes.Black, 120, 27);
                g.DrawString("Gender: " + comboBox2.Text, messageFont, Brushes.Black, 160, 27);
                if (textBox3.Text != "")
                {
                    g.DrawString("Family Head ID: " + textBox3.Text, messageFont, Brushes.Black, 120, 33);
                }
                g.DrawString("Dated: " + DateTime.Today.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 20);
                g.DrawLine(blackPen, 5, 39, 205, 39);
                total = 40;
            }
            else
            {
                total = 5;
            }

            opd       opd = new opd();
            dbconnect db  = new dbconnect();

            opd.getPatientOPDHistory(textBox1.Text, dateTimePicker2.Value.ToString("yyyyMMdd"), dateTimePicker1.Value.ToString("yyyyMMdd"), db);
            int sno = 1;

            while (opd.dr.Read())
            {
                if (sno < j)
                {
                    sno++;
                    continue;
                }
                if (total >= 275)
                {
                    e.HasMorePages = true;
                    return;
                }

                messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
                medicine_id = new string[0];
                medicines   = new string[0];
                dosage      = new string[0];
                quantity    = new string[0];
                if (m == 0)
                {
                    g.DrawString(j + ")", messageFont, Brushes.Black, 10, total + 1);
                    g.DrawString("OPD: " + opd.dr[0].ToString(), messageFont, Brushes.Black, 20, total + 1);
                    g.DrawString("Doctor: " + opd.dr[8].ToString(), messageFont, Brushes.Black, 55, total + 1);
                    g.DrawString("Symptoms: " + opd.dr[6].ToString(), messageFont, Brushes.Black, 105, total + 1);
                    g.DrawString("Visit Date: " + opd.dr[1].ToString().Substring(0, 4) + "-" + opd.dr[1].ToString().Substring(4, 2) + "-" + opd.dr[1].ToString().Substring(6, 2), messageFont, Brushes.Black, 20, total + 6);
                    g.DrawString("Remarks: " + opd.dr[7].ToString(), messageFont, Brushes.Black, 70, total + 6);
                    total += 12;
                }
                medicine_id = opd.dr[2].ToString().Split(',');
                medicines   = opd.dr[3].ToString().Split(',');
                dosage      = opd.dr[4].ToString().Split(',');
                quantity    = opd.dr[5].ToString().Split(',');
                for (int i = 0; i < medicine_id.Length; i++)
                {
                    if (i < m - 1)
                    {
                        continue;
                    }
                    m++;
                    if (total >= 275)
                    {
                        e.HasMorePages = true;
                        return;
                    }
                    g.DrawString((i + 1) + ".", messageFont, Brushes.Black, 20, total);
                    g.DrawString(medicines[i] + " -- ( " + quantity[i] + " ) -- ( " + dosage[i] + " )", messageFont, Brushes.Black, 27, total);
                    total += 4;
                    //m++;
                }
                m = 0;
                if (sno < Convert.ToInt32(opdCount))
                {
                    messageFont = new Font("Times New Roman", 8, FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
                    g.DrawString("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ", messageFont, Brushes.Black, 10, total - 1);
                    total += 1;
                }
                j++;
                sno++;
            }
            db.dbclose();
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 5);
        }
Example #6
0
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;

            g.PageUnit = GraphicsUnit.Millimeter;
            Font messageFont = new Font("Times New Roman", 14, System.Drawing.GraphicsUnit.Point);

            g.DrawString("INSTITUTE DISPENSARY", messageFont, Brushes.Black, 75, 9);
            g.DrawString("INDIAN INSTITUTE OF TECHNOLOGY ROORKEE, SAHARANPUR CAMPUS", messageFont, Brushes.Black, 22, 15);
            messageFont = new Font("Times New Roman", 20, System.Drawing.GraphicsUnit.Point);
            g.DrawString("PATIENT MEDICAL HISTORY", messageFont, Brushes.Black, 60, 25);
            Pen blackPen = new Pen(Color.Black, 1);

            g.DrawLine(blackPen, 5, 38, 205, 38);
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Patient Name: " + name, messageFont, Brushes.Black, 10, 42);
            g.DrawString("Patient ID: " + id, messageFont, Brushes.Black, 10, 49);
            g.DrawString("Age: " + age + " Years", messageFont, Brushes.Black, 120, 42);
            g.DrawString("Gender: " + gender, messageFont, Brushes.Black, 160, 42);
            if (familyHead != "")
            {
                g.DrawString("Family Head ID: " + familyHead, messageFont, Brushes.Black, 120, 49);
            }
            g.DrawString("Dated: " + DateTime.Today.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 30);
            g.DrawLine(blackPen, 5, 56, 205, 56);
            int       total = 56;
            opd       opd   = new opd();
            dbconnect db    = new dbconnect();

            opd.getPatientOPDHistory(textBox1.Text, db);
            int sno = 1;

            while (opd.dr.Read())
            {
                messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
                medicine_id = new string[0];
                medicines   = new string[0];
                dosage      = new string[0];
                quantity    = new string[0];
                g.DrawString(sno + ")", messageFont, Brushes.Black, 10, total + 2);
                g.DrawString("OPD: " + opd.dr[0].ToString(), messageFont, Brushes.Black, 20, total + 2);
                g.DrawString("Doctor: " + opd.dr[8].ToString(), messageFont, Brushes.Black, 55, total + 2);
                g.DrawString("Symptoms: " + opd.dr[6].ToString(), messageFont, Brushes.Black, 105, total + 2);
                g.DrawString("Visit Date: " + opd.dr[1].ToString().Substring(0, 4) + "-" + opd.dr[1].ToString().Substring(4, 2) + "-" + opd.dr[1].ToString().Substring(6, 2), messageFont, Brushes.Black, 20, total + 10);
                g.DrawString("Remarks: " + opd.dr[7].ToString(), messageFont, Brushes.Black, 70, total + 10);
                medicine_id = opd.dr[2].ToString().Split(',');
                medicines   = opd.dr[3].ToString().Split(',');
                dosage      = opd.dr[4].ToString().Split(',');
                quantity    = opd.dr[5].ToString().Split(',');
                total      += 20;
                for (int i = 0; i < medicine_id.Length; i++)
                {
                    g.DrawString((i + 1) + ".", messageFont, Brushes.Black, 20, total);
                    g.DrawString(medicines[i] + " -- ( " + quantity[i] + " ) -- ( " + dosage[i] + " )", messageFont, Brushes.Black, 27, total);
                    total += 6;
                }
                if (sno < opdCount)
                {
                    messageFont = new Font("Times New Roman", 8, FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
                    g.DrawString("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ", messageFont, Brushes.Black, 10, total - 1);
                    total += 3;
                }
                sno++;
            }
            db.dbclose();
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 5);
        }