Exemple #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!!!");
     }
 }
        public void loadPatients(string opd)
        {
            opd opd2 = new opd();

            opd2.loadVisitedPatients(opd);
            dataGridView1.DataSource = opd2.table;
        }
        public void loadPatientsName(string name)
        {
            opd opd2 = new opd();

            opd2.loadVisitedPatientsName(name);
            dataGridView1.DataSource = opd2.table;
        }
Exemple #4
0
        public void loadCount()
        {
            opd opd = new opd();

            opd.patientsVisited();
            textBox8.Text = opd.count;
        }
        public void loadPatients()
        {
            opd opd = new opd();

            opd.loadVisitedPatients();
            dataGridView1.DataSource = opd.table;
        }
        public void ageLoad()
        {
            opd opd = new opd();

            opd.patientAge(textBox1.Text);
            age = opd.age;
        }
Exemple #7
0
        public string getCode(string opd)
        {
            opd opd2 = new opd();

            opd2.getCode(opd);
            return(opd2.count);
        }
Exemple #8
0
        private void registrationReports_Load(object sender, EventArgs e)
        {
            yearsLoad();
            opd opd = new opd();

            opd.registrationStats();
            label4.Text                                  = opd.count;
            label6.Text                                  = opd.token;
            label9.Text                                  = opd.opdMax;
            dateTimePicker1.Format                       = DateTimePickerFormat.Custom;
            dateTimePicker1.CustomFormat                 = "dd MMM, yyyy";
            dateTimePicker1.Value                        = DateTime.Today;
            monthCalendar1.SelectionRange.Start          = DateTime.Today;
            printPreviewDialog1.PrintPreviewControl.Zoom = 1.0;
            ((Form)printPreviewDialog1).StartPosition    = FormStartPosition.CenterScreen;
            ((Form)printPreviewDialog1).Width            = 880;
            ((Form)printPreviewDialog1).Height           = 680;
            comboBox1.SelectedItem                       = DateTime.Today.Year.ToString();
            foreach (string printer in PrinterSettings.InstalledPrinters)
            {
                comboBox3.Items.Add(printer);
            }
            PrinterSettings settings = new PrinterSettings();

            comboBox3.SelectedItem = settings.PrinterName;
        }
Exemple #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            bool valid = false;

            if (!Convert.ToBoolean(textBox8.Text))
            {
                if (textBox4.Text == DateTime.Today.ToString("yyyy-MM-dd"))
                {
                    valid = true;
                }
                else
                {
                    MessageBox.Show("You can cancel todays tokens only.");
                }
            }
            else
            {
                MessageBox.Show("Patient already visited doctor. Token cannot be canceled.");
            }

            if (valid)
            {
                opd opd = new opd();
                opd.cancelToken(textBox1.Text);
                MessageBox.Show("Token canceled sucessfully!");
                clearData();
            }
        }
Exemple #10
0
        public void updatePatient()
        {
            string gender = comboBox2.SelectedItem.ToString();
            string cat    = comboBox1.SelectedItem.ToString();
            string date   = textBox4.Text;
            string month  = textBox5.Text;

            if (textBox4.Text.Length == 1)
            {
                date = "0" + date;
            }
            if (textBox5.Text.Length == 1)
            {
                month = "0" + month;
            }
            string dob = textBox6.Text + "-" + month + "-" + date;
            opd    opd = new opd();

            opd.updatePatient(textBox1.Text, textBox2.Text, dob, gender, textBox3.Text, cat);
            MessageBox.Show(opd.message);
            if (opd.message == "Details UPDATED Sucessfully!!")
            {
                loadData();
                clearData();
            }
        }
Exemple #11
0
        public void tokens2()
        {
            opd opd = new opd();

            opd.tokenLoad();
            label8.Text  = opd.token;
            label10.Text = opd.amount;
        }
Exemple #12
0
        public void loadDOB(string ID)
        {
            opd opd = new opd();

            opd.patientAge(ID);
            textBox4.Text = opd.dob.Substring(8, 2);
            textBox5.Text = opd.dob.Substring(5, 2);
            textBox6.Text = opd.dob.Substring(0, 4);
        }
Exemple #13
0
        public void ageLoad()
        {
            opd opd = new opd();

            opd.patientAge(textBox1.Text);
            age = opd.age;
            opd.totalPatientVisits(textBox1.Text);
            opdCount = opd.visits;
        }
Exemple #14
0
        private void printDocument2_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e)
        {
            opd opd = new opd();

            opd.dailyOPDCount(dateTimePicker1.Value.Date.ToString("yyyy-MM-dd"));
            int patients = Convert.ToInt32(opd.count);

            e.PageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4 (210 x 297 mm)", 827, (55 + (patients * 5) + 13) * 4);
            e.PageSettings.Margins   = new System.Drawing.Printing.Margins(0, 0, 0, 0);
        }
Exemple #15
0
        private void printDocument4_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", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("MONTHLY DATE WISE REPORT(" + monthCalendar1.SelectionRange.Start.ToString("MMMM, yyyy") + ")", messageFont, Brushes.Black, 55, 23);
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Dated: " + DateTime.Today.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 30);
            Pen blackPen = new Pen(Color.Black, 1);

            g.DrawLine(blackPen, 5, 38, 205, 38);
            int total = 38;

            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 2);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 12);
            messageFont = new Font("Times New Roman", 11, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Sno.", messageFont, Brushes.Black, 15, total + 8);
            g.DrawString("Date", messageFont, Brushes.Black, 45, total + 8);
            g.DrawString("Total Patients", messageFont, Brushes.Black, 95, total + 8);
            g.DrawString("Amount Collected", messageFont, Brushes.Black, 160, total + 8);
            total += 17;
            opd       opd = new opd();
            dbconnect db  = new dbconnect();

            opd.monthlyReportDatewise(monthCalendar1.SelectionRange.Start.ToString("yyyy-MM-") + "01", monthCalendar1.SelectionRange.Start.AddMonths(1).ToString("yyyy-MM-") + "01", db);
            int i      = 1;
            int amount = 0;

            while (opd.dr.Read())
            {
                messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
                g.DrawString(i.ToString(), messageFont, Brushes.Black, 15, total);
                g.DrawString(opd.dr[0].ToString(), messageFont, Brushes.Black, 45, total);
                g.DrawString(opd.dr[1].ToString(), messageFont, Brushes.Black, 100, total);
                g.DrawString(opd.dr[2].ToString(), messageFont, Brushes.Black, 165, total);
                messageFont = new Font("Times New Roman", 5, System.Drawing.GraphicsUnit.Point);
                g.DrawString("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", messageFont, Brushes.Black, 10, total + 4);
                total  += 6;
                amount += Convert.ToInt32(opd.dr[2].ToString());
                i++;
            }
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Total Amount :" + amount.ToString(), messageFont, Brushes.Black, 139, total + 2);
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 5);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 10);
        }
Exemple #16
0
        public void loadData(string like)
        {
            opd opd = new opd();

            opd.loadPatients(like);
            dataGridView1.DataSource = opd.table;
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            dataGridView1.ClearSelection();
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int i = e.RowIndex;

            //MessageBox.Show(i.ToString());
            if (i >= 0)
            {
                dataGridView2.Rows.Clear();
                //string query = "SELECT opd.opd, opd.patient_id, patients.name, patients.dob, patients.gender, opd.doctor, patients.category, patients.family_head, opd.symptoms, opd.remarks, opd.medicine_id, opd.medicines, opd.dosage, opd.quantity, opd.storemedicine_id, opd.storequantity FROM opd INNER JOIN patients ON opd.patient_id=patients.patient_id WHERE opd.opd="+opd;
                dbconnect db  = new dbconnect();
                opd       opd = new opd();
                opd.loadOPDDetails(dataGridView1.Rows[i].Cells[0].Value.ToString(), db);
                if (opd.dr.Read())
                {
                    textBox8.Text  = opd.dr[0].ToString();
                    textBox10.Text = opd.dr[1].ToString();
                    textBox9.Text  = opd.dr[2].ToString();
                    int age = DateTime.Today.Year - Convert.ToInt32(opd.dr[3].ToString().Substring(0, 4));
                    if (Convert.ToInt32(opd.dr[3].ToString().Substring(5, 2)) > DateTime.Today.Month)
                    {
                        age--;
                    }
                    textBox1.Text  = age.ToString();
                    textBox2.Text  = opd.dr[4].ToString();
                    textBox5.Text  = opd.dr[5].ToString();
                    textBox3.Text  = opd.dr[6].ToString();
                    textBox4.Text  = opd.dr[7].ToString();
                    textBox6.Text  = opd.dr[8].ToString();
                    textBox13.Text = opd.dr[9].ToString();
                    medicinesID    = new string[0];
                    medicines      = new string[0];
                    dosage         = new string[0];
                    qty            = new string[0];
                    medicinesID    = opd.dr[10].ToString().Split(',');
                    medicines      = opd.dr[11].ToString().Split(',');
                    dosage         = opd.dr[12].ToString().Split(',');
                    qty            = opd.dr[13].ToString().Split(',');
                    if (opd.dr[14].ToString() != "")
                    {
                        medicinesIDStore = opd.dr[14].ToString().Split(',');
                        qtyStore         = opd.dr[15].ToString().Split(',');
                    }
                    for (int q = 0; q < medicinesID.Length; q++)
                    {
                        dataGridView2.Rows.Add(medicinesID[q], medicines[q], qty[q], dosage[q]);
                    }
                    dataGridView2.ClearSelection();
                    issuedLP = medicinesID.Contains("LP");
                }
                db.dbclose();
            }
        }
Exemple #18
0
        public void loadPatients(string token)
        {
            opd opd = new opd();

            opd.patientsToVisit(token);
            dataGridView1.DataSource = opd.table;
            dataGridView1.ClearSelection();
            clearData();
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        }
Exemple #19
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", 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", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("ANNUAL REPORT(" + comboBox1.SelectedItem.ToString() + "-" + (Convert.ToInt32(comboBox1.SelectedItem.ToString()) + 1).ToString() + ")", messageFont, Brushes.Black, 75, 25);
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Dated: " + DateTime.Today.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 30);
            Pen blackPen = new Pen(Color.Black, 1);

            g.DrawLine(blackPen, 5, 38, 205, 38);
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, 38 + 2);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, 38 + 12);
            messageFont = new Font("Times New Roman", 13, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Sno.", messageFont, Brushes.Black, 10, 46);
            g.DrawString("Month", messageFont, Brushes.Black, 30, 46);
            g.DrawString("Total Patients", messageFont, Brushes.Black, 90, 46);
            g.DrawString("Total Amount", messageFont, Brushes.Black, 155, 46);
            DateTime month    = new DateTime(Convert.ToInt32(comboBox1.SelectedItem.ToString()), 4, 1);
            int      total    = 60;
            int      amount   = 0;
            int      patients = 0;

            for (int i = 1; i < 13; i++)
            {
                opd opd = new opd();
                opd.annualReport(month.AddMonths(i - 1).ToString("yyyy-MM-dd"), month.AddMonths(i).ToString("yyyy-MM-dd"));
                g.DrawString(i.ToString() + ")", messageFont, Brushes.Black, 10, total);
                g.DrawString(month.AddMonths(i - 1).ToString("MMMM, yyyy").ToUpper(), messageFont, Brushes.Black, 30, total);
                g.DrawString(opd.count, messageFont, Brushes.Black, 95, total);
                g.DrawString(opd.token, messageFont, Brushes.Black, 160, total);
                total    += 10;
                amount   += Convert.ToInt32(opd.token);
                patients += Convert.ToInt32(opd.count);
            }
            messageFont = new Font("Times New Roman", 13, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Total Patients : " + patients.ToString(), messageFont, Brushes.Black, 63, total + 2);
            g.DrawString("Total Amount : " + amount.ToString(), messageFont, Brushes.Black, 130, total + 2);
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 5);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 10);
        }
Exemple #20
0
        public void loadPatients()
        {
            opd opd = new opd();

            opd.patientsToVisit();
            dataGridView1.DataSource = opd.table;
            dataGridView1.ClearSelection();
            loadCount();
            clearData();
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            textBox6.Text = dataGridView1.Rows.Count.ToString();
        }
Exemple #21
0
    public static opd Login(string username, string password)
    {
        string query = String.Format("select count(*) from ((opd inner JOIN position On opd.pos_id = position.pos_id) inner JOIN user_control On user_control.opd_id = opd.opd_id) where user_control.uct_user =  '******'", username);

        command.CommandText = query;
        try
        {
            conn.Open();
            int countuser = (int)command.ExecuteScalar();
            if (countuser == 1)
            {
                query = String.Format("select user_control.uct_password from ((opd inner JOIN position On opd.pos_id = position.pos_id) inner JOIN user_control On user_control.opd_id = opd.opd_id) where user_control.uct_user = '******'", username);
                command.CommandText = query;
                string dbpassword = command.ExecuteScalar().ToString();
                if (dbpassword == password)
                {
                    query = String.Format("select opd.opd_name,position.pos_name from ((opd FULL OUTER JOIN position On opd.pos_id = position.pos_id) FULL OUTER JOIN user_control On user_control.opd_id = opd.opd_id) FULL OUTER JOIN employee_doctor On employee_doctor.emp_doc_id = user_control.emp_doc_id where user_control.uct_user ='******' ", username);
                    command.CommandText = query;
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        string emp_ru_name = reader.GetString(0);
                        string pos_name    = reader.GetString(1);
                        opd    ru          = new opd(emp_ru_name, username, password, pos_name);
                        return(ru);
                    }



                    return(null);
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }
        finally
        {
            conn.Close();
        }

        return(null);
    }
Exemple #22
0
        private void button4_Click(object sender, EventArgs e)
        {
            opd       opd = new opd();
            dbconnect db  = new dbconnect();

            opd.dailyReportDoctor(dateTimePicker2.Value.Date.ToString("yyyyMMdd"), db);
            opdCount      = 0;
            medicineCount = 0;
            while (opd.dr.Read())
            {
                medicine_id    = opd.dr[9].ToString().Split(',');
                medicineCount += medicine_id.Length;
                opdCount      += 1;
            }
            //MessageBox.Show(medicineCount.ToString());
            db.dbclose();
            printPreviewDialog1.ShowDialog();
        }
Exemple #23
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         opd       opd = new opd();
         dbconnect db  = new dbconnect();
         opd.duplicatePatientSlip(textBox4.Text, db);
         if (opd.dr.Read())
         {
             //MessageBox.Show(opd.dr[9].ToString());
             opd.patientAge(db.dr[0].ToString());
             medicine_id = opd.dr[9].ToString().Split(',');
             medicines   = opd.dr[10].ToString().Split(',');
             dosage      = opd.dr[11].ToString().Split(',');
             quantity    = opd.dr[12].ToString().Split(',');
             id          = db.dr[0].ToString();
             symptoms    = db.dr[1].ToString();
             remarks     = db.dr[2].ToString();
             doctor      = db.dr[3].ToString();
             date        = db.dr[4].ToString().Substring(6, 2) + "-" + db.dr[4].ToString().Substring(4, 2) + "-" + db.dr[4].ToString().Substring(0, 4);
             name        = db.dr[5].ToString();
             gender      = db.dr[7].ToString();
             age         = opd.age.ToString();
             for (int i = 0; i < medicine_id.Length; i++)
             {
                 if (medicine_id[i] == "LP")
                 {
                     LP = true;
                     break;
                 }
             }
             if (MessageBox.Show("Are you sure you want to Print Duplicate Patient Slip??", "Duplicat Patient Slip??", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 printDocument1.Print();
                 //  printPreviewDialog1.ShowDialog();
             }
         }
         else
         {
             MessageBox.Show("Invalid OPD!!");
         }
         db.dbclose();
     }
 }
Exemple #24
0
        public void issueToken()
        {
            tokens();
            opd opd = new opd();

            opd.issueToken(username, (Convert.ToInt32(label8.Text) + 1).ToString(), textBox1.Text, comboBox1.Text, comboBox3.Text, code.ToString());
            try
            {
                //printPreviewDialog1.ShowDialog();
                printDocument1.Print();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message + "\n\nPrinter Not Connected Properly!! Please Check that and Issue the token!!");
            }
            loadData();
            clearData();
            tokens();
        }
Exemple #25
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();
            }
        }
Exemple #26
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!!!");
     }
 }
Exemple #27
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!!!");
     }
 }
Exemple #28
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);
            int  total;

            if (j == 1)
            {
                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("DAILY REPORT", messageFont, Brushes.Black, 75, 25);
                messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
                g.DrawString("Dated: " + dateTimePicker1.Value.Date.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 30);
                Pen blackPen = new Pen(Color.Black, 1);
                g.DrawLine(blackPen, 5, 38, 205, 38);
                total = 38;
            }
            else
            {
                total = 5;
            }
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 2);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 12);
            messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Sno.", messageFont, Brushes.Black, 10, total + 8);
            g.DrawString("OPD", messageFont, Brushes.Black, 20, total + 8);
            g.DrawString("Booklet No.", messageFont, Brushes.Black, 35, total + 8);
            g.DrawString("Patient Name", messageFont, Brushes.Black, 60, total + 8);
            g.DrawString("Age", messageFont, Brushes.Black, 115, total + 8);
            g.DrawString("Gender", messageFont, Brushes.Black, 125, total + 8);
            g.DrawString("Family Head", messageFont, Brushes.Black, 140, total + 8);
            g.DrawString("Amt.", messageFont, Brushes.Black, 165, total + 8);
            g.DrawString("Doctor", messageFont, Brushes.Black, 178, total + 8);
            total += 17;
            opd       opd = new opd();
            dbconnect db  = new dbconnect();

            opd.dailyReportRegistration(dateTimePicker1.Value.Date.ToString("yyyy-MM-dd"), db);
            int i = 1;

            while (opd.dr.Read())
            {
                if (i < j)
                {
                    i++;
                    continue;
                }
                if (total >= 270)
                {
                    e.HasMorePages = true;
                    return;
                }
                g.DrawString(i + ")", messageFont, Brushes.Black, 10, total);
                g.DrawString(opd.dr[0].ToString(), messageFont, Brushes.Black, 20, total);
                g.DrawString(opd.dr[1].ToString(), messageFont, Brushes.Black, 35, total);
                g.DrawString(opd.dr[2].ToString(), messageFont, Brushes.Black, 60, total);
                int age2 = DateTime.Today.Year - Convert.ToInt32(db.dr[3].ToString().Substring(0, 4));
                if (Convert.ToInt32(db.dr[3].ToString().Substring(5, 2)) > DateTime.Today.Month)
                {
                    age2--;
                }
                g.DrawString(age2.ToString(), messageFont, Brushes.Black, 115, total);
                g.DrawString(opd.dr[4].ToString(), messageFont, Brushes.Black, 125, total);
                g.DrawString(opd.dr[5].ToString(), messageFont, Brushes.Black, 140, total);
                int amt = 0;
                if (opd.dr[6].ToString() == "general")
                {
                    amt          = 1;
                    totalAmount += 1;
                }
                g.DrawString(amt.ToString(), messageFont, Brushes.Black, 165, total);
                g.DrawString(opd.dr[7].ToString(), messageFont, Brushes.Black, 178, total);
                total += 5;
                i++;
                j++;
                e.HasMorePages = false;
            }
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Total Amount :" + totalAmount.ToString(), messageFont, Brushes.Black, 139, total + 2);
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 5);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 10);
        }
Exemple #29
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("DAILY REPORT", messageFont, Brushes.Black, 75, 25);
            messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
            g.DrawString("Dated: " + dateTimePicker2.Value.Date.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 160, 30);
            g.DrawString("Doctor: Dr. Manoj Jain", messageFont, Brushes.Black, 15, 30);
            Pen blackPen = new Pen(Color.Black, 1);

            g.DrawLine(blackPen, 5, 38, 205, 38);

            int       total = 38;
            opd       opd   = new opd();
            dbconnect db    = new dbconnect();

            opd.dailyReportDoctor(dateTimePicker2.Value.Date.ToString("yyyyMMdd"), db);
            int sno = 1;

            while (opd.dr.Read())
            {
                int age = DateTime.Today.Year - Convert.ToInt32(db.dr[4].ToString().Substring(0, 4));
                if (Convert.ToInt32(db.dr[4].ToString().Substring(5, 2)) > DateTime.Today.Month)
                {
                    age--;
                }
                medicine_id = new string[0];
                medicines   = new string[0];
                dosage      = new string[0];
                quantity    = new string[0];
                messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
                g.DrawString("Patient Name: " + opd.dr[3].ToString(), messageFont, Brushes.Black, 20, total + 4);
                g.DrawString("Patient ID: " + opd.dr[0].ToString(), messageFont, Brushes.Black, 55, total + 11);
                g.DrawString("Age: " + age + " Years", messageFont, Brushes.Black, 110, total + 4);
                g.DrawString("Gender: " + opd.dr[5].ToString(), messageFont, Brushes.Black, 150, total + 4);
                g.DrawString("Family Head ID: " + opd.dr[6].ToString(), messageFont, Brushes.Black, 110, total + 11);
                g.DrawString(sno + ")", messageFont, Brushes.Black, 10, total + 4);
                g.DrawString("OPD: " + opd.dr[7].ToString(), messageFont, Brushes.Black, 20, total + 11);
                g.DrawString("Symptoms: " + opd.dr[1].ToString(), messageFont, Brushes.Black, 20, total + 18);
                g.DrawString("Remarks: " + opd.dr[2].ToString(), messageFont, Brushes.Black, 110, total + 18);
                total += 27;

                medicine_id = opd.dr[8].ToString().Split(',');
                medicines   = opd.dr[9].ToString().Split(',');
                dosage      = opd.dr[10].ToString().Split(',');
                quantity    = opd.dr[11].ToString().Split(',');
                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);
        }
Exemple #30
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);
        }