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!!!"); } }
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(); } }
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(); } }
public void medicineDetail(string id) { medicine med = new medicine(); dbconnect db = new dbconnect("medicines"); med.medicineDetail(id, db); if (med.dr.Read()) { textBox6.Text = med.dr[1].ToString(); textBox7.Text = med.dr[2].ToString(); comboBox2.SelectedItem = med.dr[3].ToString(); } db.dbclose(); }
public void loaddata(string search) { dbconnect db = new dbconnect(); db.data_adapter(search, db.con); DataSet ds = new DataSet(); db.da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; db.dbclose(); foreach (DataGridViewColumn column in dataGridView1.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } }
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(); }
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(); } }
public void loadToken(string token) { string query = "SELECT * FROM token WHERE token_no=" + token + " AND date='" + DateTime.Today.ToString("yyyy-MM-dd") + "'"; dbconnect db = new dbconnect(); db.command_reader(query, db.con); if (db.dr.Read()) { textBox1.Text = db.dr[0].ToString(); textBox3.Text = db.dr[4].ToString(); textBox4.Text = db.dr[3].ToString(); textBox5.Text = db.dr[6].ToString(); textBox6.Text = db.dr[7].ToString(); textBox7.Text = db.dr[1].ToString(); textBox8.Text = db.dr[9].ToString(); } else { MessageBox.Show("Enter todays valid Token No."); } db.dbclose(); }
public void loadOPD(string opd) { string query = "SELECT * FROM token WHERE opd=" + opd; dbconnect db = new dbconnect(); db.command_reader(query, db.con); if (db.dr.Read()) { textBox2.Text = db.dr[2].ToString(); textBox3.Text = db.dr[4].ToString(); textBox4.Text = db.dr[3].ToString().Substring(0, 10); textBox5.Text = db.dr[6].ToString(); textBox6.Text = db.dr[7].ToString(); textBox7.Text = db.dr[1].ToString(); textBox8.Text = db.dr[9].ToString(); } else { MessageBox.Show("Enter Valid OPD."); } db.dbclose(); }
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!!!"); } }
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!!!"); } }
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); }
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); }
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); }