Example #1
0
 private void comboBoxdoctor_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (comboBoxdoctor.SelectedIndex == -1)
         {
         }
         else
         {
             label2.Text = ""; Lab_Msg.Hide();
             drctid      = comboBoxdoctor.SelectedItem.ToString();
             string dt = this.cntrl.Get_DoctorId(drctid);
             if (dt != "")
             {
                 Selected_drid = dt.ToString();
             }
             if (comboBoxdoctor.SelectedIndex == 0)
             {
                 DataTable dt1 = this.cntrl.vishistCombo(dateTimePickerdailyappointcount1.Value.ToString("yyyy-MM-dd"), dateTimePickerdailyappointcount2.Value.ToString("yyyy-MM-dd"));
                 dgvVisitingHistory.AutoGenerateColumns = false;
                 if (dt1.Rows.Count > 0)
                 {
                     dgvVisitingHistory.DataSource = dt1;
                     int count = dt1.Rows.Count;
                     label2.Text = count.ToString();
                     Lab_Msg.Hide();
                 }
                 else
                 {
                     dgvVisitingHistory.DataSource = null;
                     int x = (panel1.Size.Width - Lab_Msg.Size.Width) / 2;
                     Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                     Lab_Msg.Show();
                     label2.Text = "0";
                 }
             }
             else if (comboBoxdoctor.SelectedIndex > 0)
             {
                 DataTable dt1 = this.cntrl.vishistCombo1(dateTimePickerdailyappointcount1.Value.ToString("yyyy-MM-dd"), dateTimePickerdailyappointcount2.Value.ToString("yyyy-MM-dd"), Selected_drid);
                 dgvVisitingHistory.AutoGenerateColumns = false;
                 if (dt1.Rows.Count > 0)
                 {
                     dgvVisitingHistory.DataSource = dt1;
                     int count = dt1.Rows.Count;
                     label2.Text = count.ToString();
                     Lab_Msg.Hide();
                 }
                 else
                 {
                     dgvVisitingHistory.DataSource = null;
                     int x = (panel1.Size.Width - Lab_Msg.Size.Width) / 2;
                     Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                     Lab_Msg.Show();
                     label2.Text = "0";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error !...", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
        private void Ledger_Load(object sender, EventArgs e)
        {
            toolStripButton9.ToolTipText = PappyjoeMVC.Model.GlobalVariables.Version;
            string docnam = this.cntrl.Get_DoctorName(doctor_id);

            if (docnam != "")
            {
                toolStripTextDoctor.Text = "Logged In As : " + docnam;
            }
            DataTable clinicname = this.cntrl.Get_CompanyNAme();

            if (clinicname.Rows.Count > 0)
            {
                string clinicn = "";
                clinicn = clinicname.Rows[0][0].ToString();
                toolStripButton1.Text = clinicn.Replace("¤", "'");
                path = clinicname.Rows[0]["path"].ToString();
                if (path != "")
                {
                    string curFile = this.cntrl.server() + "\\Pappyjoe_utilities\\Logo\\" + path;
                    if (File.Exists(curFile))
                    {
                        logo_name = "";
                        logo_name = path;
                        string Apppath = System.IO.Directory.GetCurrentDirectory();
                        if (!File.Exists(Apppath + "\\" + logo_name))
                        {
                            System.IO.File.Copy(curFile, Apppath + "\\" + logo_name);
                        }
                    }
                    else
                    {
                        logo_name = "";
                    }
                }
            }
            DataTable dtadvance = this.cntrl.Get_Advance(patient_id);

            if (dtadvance.Rows.Count > 0)
            {
                label31.Text = "Available advance: " + string.Format("{0:C}", decimal.Parse(dtadvance.Rows[0][0].ToString()));
            }
            else
            {
                label31.Text = "Available advance: " + string.Format("{0:C}", 0);
            }
            listpatientsearch.Hide();
            System.Data.DataTable pat = this.cntrl.Get_pat_iDName(patient_id);
            linkLabel_id.Text   = pat.Rows[0]["pt_id"].ToString();
            linkLabel_Name.Text = pat.Rows[0]["pt_name"].ToString();
            DataTable dt_invoice = this.cntrl.LedgerInvoice(patient_id);

            DGV_Transaction.Size = new System.Drawing.Size(1038, 500);
            DGV_Transaction.Columns.Add("abc", "DATE");
            DGV_Transaction.Columns["abc"].Width = 170;
            DGV_Transaction.Columns.Add("ac", "INVOICE NO");
            DGV_Transaction.Columns["ac"].Width = 170;
            DGV_Transaction.Columns.Add("dds", "DETAILS");
            DGV_Transaction.Columns["dds"].Width = 170;
            DGV_Transaction.Columns.Add("sdfd", "CREDIT");
            DGV_Transaction.Columns["sdfd"].Width = 100;
            DGV_Transaction.Columns["sdfd"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns["sdfd"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns.Add("sde", "DEBIT");
            DGV_Transaction.Columns["sde"].Width = 100;
            DGV_Transaction.Columns["sde"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns["sde"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns.Add("q", "  BALANCE");
            DGV_Transaction.Columns["q"].Width = 100;
            DGV_Transaction.Columns["q"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns["q"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns["q"].Visible = false;
            DGV_Transaction.Columns.Add("q1", "BALANCE");
            DGV_Transaction.Columns["q1"].Width = 150;
            DGV_Transaction.Columns["q1"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.Columns["q1"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            DGV_Transaction.ColumnHeadersDefaultCellStyle.Font       = new System.Drawing.Font("Sego UI", 10, FontStyle.Bold);
            DGV_Transaction.ColumnHeadersDefaultCellStyle.BackColor  = Color.Gray;
            DGV_Transaction.ColumnHeadersDefaultCellStyle.ForeColor  = Color.White;
            DGV_Transaction.EnableHeadersVisualStyles = false;
            decimal totalcredit = 0;

            if (dt_invoice.Rows.Count > 0)
            {
                for (int z = 0; z < dt_invoice.Rows.Count; z++)
                {
                    string   date         = dt_invoice.Rows[z]["date"].ToString();
                    DateTime d            = Convert.ToDateTime(date);
                    string   day          = d.Day.ToString();
                    string   year         = d.Year.ToString();
                    string   strMonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(d.Month);
                    string   sr           = d.Month.ToString();
                    string   invoiceno    = dt_invoice.Rows[z]["invoice_no"].ToString();
                    string   details      = dt_invoice.Rows[z]["services"].ToString();
                    decimal  cost         = decimal.Parse(dt_invoice.Rows[z]["cost"].ToString());
                    decimal  unit         = decimal.Parse(dt_invoice.Rows[z]["unit"].ToString());
                    decimal  discount     = decimal.Parse(dt_invoice.Rows[z]["discountin_rs"].ToString());
                    decimal  tax          = decimal.Parse(dt_invoice.Rows[z]["tax_inrs"].ToString());
                    //credit = (cost * unit) - (tax + discount);
                    credit      = ((cost * unit) + tax) - discount;
                    totalcredit = totalcredit + credit;
                    DGV_Transaction.Rows.Add(day + ' ' + strMonthName + ' ' + year, invoiceno, details, String.Format("{0:C}", credit), String.Format("{0:C}", 0), String.Format("{0:C}", totalcredit));
                    DGV_Transaction.Rows[z].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[1].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[3].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[4].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[5].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[z].Cells[0].Style.ForeColor = Color.Green;
                }
            }
            DataTable dtb = this.cntrl.LedgerPay(patient_id);

            if (dtb.Rows.Count > 0)
            {
                for (int u = 0; u < dtb.Rows.Count; u++)
                {
                    string   recpno    = dtb.Rows[u]["receipt_no"].ToString();
                    string   date      = dtb.Rows[u]["payment_date"].ToString();
                    DateTime d         = Convert.ToDateTime(date);
                    string   day       = d.Day.ToString();
                    string   month     = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(d.Month);
                    string   year      = d.Year.ToString();
                    string   invoiceno = dtb.Rows[u]["invoice_no"].ToString();
                    string[] invoice1  = new string[100];
                    invoice1 = invoiceno.Split(',');
                    decimal total     = Convert.ToDecimal(dtb.Rows[u]["amount_paid"].ToString());
                    string  invAmount = DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[5].Value.ToString();
                    balance = decimal.Parse(invAmount, NumberStyles.Currency);
                    decimal balance1 = balance - total;
                    DGV_Transaction.Rows.Add(day + ' ' + month + ' ' + year, recpno, invoiceno, String.Format("{0:C}", 0), String.Format("{0:C}", total), String.Format("{0:C}", balance1));
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[1].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[3].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[4].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[5].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Regular);
                    DGV_Transaction.Rows[dtb.Rows.Count + u].Cells[0].Style.ForeColor = Color.Blue;
                }
            }
            decimal credittot = 0;
            decimal debittot  = 0;

            if (DGV_Transaction.Rows.Count > 0)
            {
                for (int j = 0; j < DGV_Transaction.Rows.Count; j++)
                {
                    decimal credit = decimal.Parse(DGV_Transaction.Rows[j].Cells[3].Value.ToString(), NumberStyles.Currency);
                    decimal debit  = decimal.Parse(DGV_Transaction.Rows[j].Cells[4].Value.ToString(), NumberStyles.Currency);
                    credittot = credittot + credit;
                    debittot  = debittot + debit;
                    string credittot1 = String.Format("{0:C}", credittot);
                    Lab_Due.Text = credittot1.ToString();
                    string debittot1 = String.Format("{0:C}", debittot);
                    Lab_DebitTotal.Text = debittot1.ToString();
                    decimal tot = credittot - debittot;
                    totalamt = tot.ToString();
                    string tot1 = String.Format("{0:C}", tot);
                    Lab_BalanTotal.Text = tot1;
                    string rr = DGV_Transaction.Rows[j].Cells[1].Value.ToString();
                }
            }
            decimal c = a - b;

            DGV_Transaction.Rows.Add("", "", "TOTAL", Lab_Due.Text, Lab_DebitTotal.Text, Lab_BalanTotal.Text, Lab_BalanTotal.Text);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[0].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[1].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[2].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[3].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[4].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[5].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[6].Style.Font        = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].DefaultCellStyle.BackColor = Color.FromArgb(224, 224, 224);
            DGV_Transaction.Rows[DGV_Transaction.Rows.Count - 1].Cells[6].Style.ForeColor   = Color.Red;
            DGV_Transaction.AllowUserToAddRows = false;
            if (DGV_Transaction.Rows.Count < 2)
            {
                DGV_Transaction.CurrentCell.Selected = false;
                DGV_Transaction.Visible = false;
                btnprint.Hide();
                btnpayreminder.Hide();
            }
            else
            {
                btnprint.Show();
                DGV_Transaction.CurrentCell.Selected = false;
            }
            if (DGV_Transaction.Rows.Count <= 1)
            {
                int x = (panel9.Size.Width - Lab_Msg.Size.Width) / 2;
                Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                Lab_Msg.Show();
                //Lab_Msg.Location = new System.Drawing.Point(350, 165);
            }
            else
            {
                Lab_Msg.Hide();
                //Lab_Msg.Location = new System.Drawing.Point(350, 165);
            }
        }
Example #3
0
 private void Vital_Signs_Load(object sender, EventArgs e)
 {
     try
     {
         toolStripButton9.ToolTipText         = PappyjoeMVC.Model.GlobalVariables.Version;
         toolStripButton8.ToolTipText         = "Settings";
         toolStripDropDownButton1.ToolTipText = "Add New";
         DataTable clinicname = this.cntrl.Get_CompanyNAme();
         if (clinicname.Rows.Count > 0)
         {
             string clinicn = "";
             clinicn = clinicname.Rows[0]["name"].ToString();
             toolStripButton1.Text = clinicn.Replace("¤", "'");
         }
         string docnam = this.cntrl.Get_DoctorName(doctor_id);
         if (docnam != "")
         {
             toolStripTextDoctor.Text = "Logged In As : " + docnam;
         }
         DataTable rs_patients = this.cntrl.Get_patient_id_name_gender(patient_id);
         if (rs_patients.Rows[0]["pt_name"].ToString() != "")
         {
             linkLabel_Name.Text = rs_patients.Rows[0]["pt_name"].ToString();
         }
         if (rs_patients.Rows[0]["pt_id"].ToString() != "")
         {
             linkLabel_id.Text = rs_patients.Rows[0]["pt_id"].ToString();
         }
         dataGridView_invoice.Show();
         dataGridView_invoice.ColumnCount      = 4;
         dataGridView_invoice.Columns[0].Width = 225;
         dataGridView_invoice.Columns[1].Width = 15;
         dataGridView_invoice.Columns[2].Width = 250;
         dataGridView_invoice.Columns[3].Width = 900;
         dataGridView_invoice.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
         dataGridView_invoice.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
         DataTable vital = this.cntrl.vital(patient_id);
         if (vital.Rows.Count > 0)
         {
             int i = 0;
             for (int j = 0; j < vital.Rows.Count; j++)
             {
                 dataGridView_invoice.Rows.Add(String.Format("{0:dddd, MMMM d, yyyy}", Convert.ToDateTime(vital.Rows[j]["date"].ToString())), "", "", "");
                 dataGridView_invoice.Rows.Add("", "", "", "");
                 dataGridView_invoice.Rows[i].Cells[0].Style.BackColor = Color.Gray;
                 dataGridView_invoice.Rows[i].Cells[1].Style.BackColor = Color.Gray;
                 dataGridView_invoice.Rows[i].Cells[2].Style.BackColor = Color.Gray;
                 dataGridView_invoice.Rows[i].Cells[3].Style.BackColor = Color.Gray;
                 dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.White;
                 dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 i = i + 1;
                 if (vital.Rows[j]["pulse"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("PULSE ", ":", vital.Rows[j]["pulse"].ToString(), "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["temp"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("TEMPERATURE ", ":", vital.Rows[j]["temp"].ToString() + " ( " + vital.Rows[j]["temp_type"].ToString() + " ) ", "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["bp_syst"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("BLOOD PRESSURE ( SYSTOLIC ) ", ":", vital.Rows[j]["bp_syst"].ToString() + " ( " + vital.Rows[j]["bp_type"].ToString() + " ) ", "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["bp_dia"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("BLOOD PRESSURE ( DIASTOLIC )  ", ":", vital.Rows[j]["bp_dia"].ToString() + " ( " + vital.Rows[j]["bp_type"].ToString() + " ) ", "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["Height"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("HEIGHT  ", ":", vital.Rows[j]["Height"].ToString() + "(Cm)", "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["weight"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("WEIGHT  ", ":", vital.Rows[j]["weight"].ToString() + "(Kg)", "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["resp"].ToString() != "")
                 {
                     dataGridView_invoice.Rows.Add("RESPIRATORY RATE ", ":", vital.Rows[j]["resp"].ToString(), "");
                     i = i + 1;
                     dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                     dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                     dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                     dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                 }
                 if (vital.Rows[j]["weight"].ToString() != null && vital.Rows[j]["weight"].ToString() != "" && vital.Rows[j]["Height"].ToString() != null && vital.Rows[j]["Height"].ToString() != "")
                 {
                     weight = Convert.ToDouble(vital.Rows[j]["weight"].ToString());
                     height = Convert.ToDouble(vital.Rows[j]["Height"].ToString());
                 }
                 else
                 {
                     weight = Convert.ToDouble("0.00");
                     height = Convert.ToDouble("0.00");
                 }
                 gender = rs_patients.Rows[0]["gender"].ToString();
                 string msg = "";
                 if (weight > 0 && height > 0)
                 {
                     BMI = Math.Round((weight / (height * height)) * 10000, 1);
                     if (BMI != null)
                     {
                         if (BMI < 19 && gender == "Female")
                         {
                             msg = "BMI is low";
                         }
                         if (BMI >= 19 & BMI <= 24 & gender == "Female")
                         {
                             msg = "Normal";
                         }
                         if (BMI > 24 & gender == "Female")
                         {
                             msg = "BMI is High";
                         }
                         if (BMI < 20 & gender == "Male")
                         {
                             msg = "BMI is low";
                         }
                         if (BMI >= 20 & BMI <= 25 & gender == "Male")
                         {
                             msg = "Normal";
                         }
                         if (BMI > 25 & gender == "Male")
                         {
                             msg = "BMI is High";
                         }
                     }
                     if (BMI > 0)
                     {
                         dataGridView_invoice.Rows.Add("BMI(BOADY MASS INDEX) ", ":", BMI + "  ,   " + msg, "");
                         i = i + 1;
                         if (msg == "BMI is low")
                         {
                             dataGridView_invoice.Rows[i].Cells[3].Style.ForeColor = Color.Red;
                         }
                         else if (msg == "Normal")
                         {
                             dataGridView_invoice.Rows[i].Cells[3].Style.ForeColor = Color.DarkGreen;
                         }
                         else if (msg == "BMI is High")
                         {
                             dataGridView_invoice.Rows[i].Cells[3].Style.ForeColor = Color.Red;
                         }
                         dataGridView_invoice.Rows[i].Cells[0].Style.ForeColor = Color.DimGray;
                         dataGridView_invoice.Rows[i].Cells[0].Style.Font      = new System.Drawing.Font("Segoe UI", 9, FontStyle.Bold);
                         dataGridView_invoice.Rows[i].Cells[2].Style.ForeColor = Color.DarkGreen;
                         dataGridView_invoice.Rows[i].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Bold);
                     }
                 }
                 dataGridView_invoice.Rows.Add("Recorded By : Dr." + vital.Rows[j]["dr_name"].ToString(), "", "", "");
                 dataGridView_invoice.Rows[i + 1].Cells[0].Style.ForeColor = Color.Red;
                 dataGridView_invoice.Rows[i + 1].Cells[2].Style.Font      = new System.Drawing.Font("Segoe UI", 10, FontStyle.Italic);
                 i = i + 2;
             }
         }
         if (dataGridView_invoice.Rows.Count <= 0)
         {
             int x = (panel1.Size.Width - Lab_Msg.Size.Width) / 2;
             Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
             Lab_Msg.Show();
         }
         else
         {
             Lab_Msg.Hide();
             Lab_Msg.Location = new System.Drawing.Point(165, 165);
         }
         if (PappyjoeMVC.Model.Connection.MyGlobals.Staff_id != "")
         {
             btn_ADD.Hide();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error !...", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
 public void fillAll()
 {
     try
     {
         string    date1       = dateTimePickerappointperpatientgroup1.Value.ToString("yyyy-MM-dd") + " 00:01:00";
         string    date2       = dateTimePickerappointperpatientgroup2.Value.ToString("yyyy-MM-dd") + " 23:59:00";
         DataTable dtb_grid    = new DataTable();
         DataTable Dt_Sidegrid = new DataTable();
         foreach (var series in chartappointeachpatientgroup.Series)
         {
             series.Points.Clear();
         }
         if (cmbptgrp.SelectedIndex == -1)
         {
         }
         else
         {
             gpid = cmbptgrp.SelectedItem.ToString();
             string dt = this.cntrl.grp_id(gpid);
             if (dt != "")
             {
                 select_id = dt.ToString();
             }
             if (cmbptgrp.SelectedIndex == 0)
             {
                 dtb_grid    = this.cntrl.dtb_grid(date1, date2);
                 Dt_Sidegrid = this.cntrl.Appointmenteachpatientgroup(date1, date2);
             }
             else
             {
                 dtb_grid    = this.cntrl.dtb_grid_gpid(gpid, date1, date2);
                 Dt_Sidegrid = this.cntrl.Appointmenteachpatientgroup_DrWise(date1, date2, gpid);
             }
         }
         Grvappointeachgroup.Rows.Clear();
         dataGridViewappoinmentpatientgroup.Rows.Clear();
         if (Dt_Sidegrid.Rows.Count > 0)
         {
             for (int i = 0; i < Dt_Sidegrid.Rows.Count; i++)
             {
                 Grvappointeachgroup.Rows.Add(Dt_Sidegrid.Rows[i][0].ToString(), Dt_Sidegrid.Rows[i][1].ToString());
             }
         }
         if (dtb_grid.Rows.Count > 0)
         {
             int count = 0, k = 1;
             for (int i = 0; i < dtb_grid.Rows.Count; i++)
             {
                 DataTable dt_group = this.cntrl.dt_group(dtb_grid.Rows[i]["id"].ToString());
                 dataGridViewappoinmentpatientgroup.Rows.Add();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["pt_id"].Value                 = dtb_grid.Rows[i]["pt_id"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["pt_name"].Value               = dtb_grid.Rows[i]["pt_name"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["book_datetime"].Value         = Convert.ToDateTime(dtb_grid.Rows[i]["book_datetime"].ToString()).ToString("MM/dd/yyyy");
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["primary_mobile_number"].Value = dtb_grid.Rows[i]["primary_mobile_number"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["duration"].Value              = dtb_grid.Rows[i]["duration"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["start_datetime"].Value        = dtb_grid.Rows[i]["start_datetime"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["booked_by"].Value             = dtb_grid.Rows[i]["booked_by"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["note"].Value          = dtb_grid.Rows[i]["note"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["email_address"].Value = dtb_grid.Rows[i]["email_address"].ToString();
                 dataGridViewappoinmentpatientgroup.Rows[i].Cells["doctor_name"].Value   = dtb_grid.Rows[i]["doctor_name"].ToString();
                 if (dt_group.Rows.Count > 0)
                 {
                     for (int j = 0; j < dt_group.Rows.Count; j++)
                     {
                         dataGridViewappoinmentpatientgroup.Rows[i].Cells["group_id"].Value += dt_group.Rows[j]["group_id"].ToString() + ",";
                     }
                     string str         = dataGridViewappoinmentpatientgroup.Rows[i].Cells["group_id"].Value.ToString();
                     string removecomma = str.Remove(str.Length - 1);
                     dataGridViewappoinmentpatientgroup.Rows[i].Cells["group_id"].Value = removecomma;
                 }
                 else
                 {
                     dataGridViewappoinmentpatientgroup.Rows[i].Cells["group_id"].Value = "No Group";
                     count = count + 1;
                 }
                 k = k + 1;
             }
             int index = Grvappointeachgroup.Rows.Count;
             Grvappointeachgroup.Rows.Add();
             Grvappointeachgroup.Rows[index].Cells[0].Value = "No Group";
             Grvappointeachgroup.Rows[index].Cells[1].Value = count;
             fill_chart();
         }
         int total_Count = dataGridViewappoinmentpatientgroup.Rows.Count;
         Lab_Total.Text = total_Count.ToString();
         if (dataGridViewappoinmentpatientgroup.Rows.Count < 1)
         {
             int x = (panel2.Size.Width - Lab_Msg.Size.Width) / 2;
             Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
             Lab_Msg.Show();
         }
         else
         {
             Lab_Msg.Hide();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error !..", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        private void btnselect_Click(object sender, EventArgs e)
        {
            var d1 = dateTimePickerdailytreatment1.Value.ToShortDateString();
            var d2 = dateTimePickerdailytreatment2.Value.ToShortDateString();

            if (Convert.ToDateTime(d1).Date > Convert.ToDateTime(d2).Date)
            {
                MessageBox.Show("From date should be less than two date");
                dateTimePickerdailytreatment1.Value = DateTime.Today;
                return;
            }
            fill_grid();
            if (Dgv_Expense.Visible)
            {
                if (Dgv_ChartExpanse.Rows.Count < 1)
                {
                    int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                    Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                    Lab_Msg.Show();
                }
                else
                {
                    Lab_Msg.Hide();
                }
                if (rad_Expanse.Checked)
                {
                    Dgv_Expense.Columns["colAmountdr"].Visible = false;
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
                }
                else if (rad_Income.Checked)
                {
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = false;
                    Dgv_Expense.Columns["colAmountdr"].Visible = true;
                }
                else
                {
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
                    Dgv_Expense.Columns["colAmountdr"].Visible = true;
                }
                int row = Dgv_Expense.Rows.Count;
                label2.Text = row.ToString();
                Dgv_Expense.Show();
                chart_monthlyExpense.Hide();
                btngrddailytreatment.Visible  = true;
                chart_monthlyExpense.Location = new Point(22, 50);
                chart_monthlyExpense.Size     = new Size(1306, 378);
            }
            else
            {
                Dgv_Expense.Hide();
                chart_monthlyExpense.Show();
                btngrddailytreatment.Visible  = true;
                chart_monthlyExpense.Location = new Point(22, 50);
                chart_monthlyExpense.Size     = new Size(1306, 378);
                this.Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
                dateTimePickerdailytreatment1.MaxDate = DateTime.Now;
                dateTimePickerdailytreatment2.MaxDate = DateTime.Now;
                DateTime now  = DateTime.Now;
                DateTime date = new DateTime(now.Year, now.Month, 1);
                if (Dgv_ChartExpanse.Rows.Count < 1)
                {
                    int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                    Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                    Lab_Msg.Show();
                }
                else
                {
                    Lab_Msg.Hide();
                }
            }
        }
        private void Monthly_Expense_Report_Load(object sender, EventArgs e)
        {
            try
            {
                this.Dgv_Expense.RowPostPaint += new DataGridViewRowPostPaintEventHandler(Dgv_Expense_RowPostPaint);
                Dgv_Expense.Hide();
                comboFlag = true;
                this.Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
                //AddStaff.Select s = new AddStaff.Select();
                this.chart_monthlyExpense.Titles.Add("Daily Expense Count");
                dateTimePickerdailytreatment1.MaxDate = DateTime.Now;
                dateTimePickerdailytreatment2.MaxDate = DateTime.Now;
                DateTime now  = DateTime.Now;
                DateTime date = new DateTime(now.Year, now.Month, 1);
                dateTimePickerdailytreatment1.Value = date;
                string date1 = dateTimePickerdailytreatment1.Value.ToString("MM/dd/yyyy");
                string date2 = dateTimePickerdailytreatment2.Value.ToString("MM/dd/yyyy");
                chart_monthlyExpense.Location = new Point(22, 50);
                chart_monthlyExpense.Size     = new Size(1306, 378);
                foreach (var series in chart_monthlyExpense.Series)
                {
                    series.Points.Clear();
                }
                Cmb_AccountName.Items.Add("All Accounts");
                Cmb_AccountName.ValueMember   = "0";
                Cmb_AccountName.DisplayMember = "All Accounts";
                System.Data.DataTable doctor_rs = this.cntrl.Expense_type_data();
                // db.table("select distinct id,name from tbl_expense_type");
                if (doctor_rs.Rows.Count > 0)
                {
                    for (int i = 0; i < doctor_rs.Rows.Count; i++)
                    {
                        Cmb_AccountName.Items.Add(doctor_rs.Rows[i]["name"].ToString());
                        Cmb_AccountName.ValueMember   = doctor_rs.Rows[i]["id"].ToString();
                        Cmb_AccountName.DisplayMember = doctor_rs.Rows[i]["name"].ToString();
                    }
                }
                Cmb_AccountName.SelectedIndex = 0;
                fill_grid();
                if (Dgv_ChartExpanse.Rows.Count < 1)
                {
                    int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                    Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                    Lab_Msg.Show();
                }
                else
                {
                    Lab_Msg.Hide();
                }
                Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.BackColor = Color.DimGray;
                Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.Font      = new System.Drawing.Font("Sego UI", 8, FontStyle.Bold);
                Dgv_ChartExpanse.EnableHeadersVisualStyles = false;
                foreach (DataGridViewColumn cl in Dgv_ChartExpanse.Columns)
                {
                    cl.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                Dgv_Expense.ColumnHeadersDefaultCellStyle.BackColor = Color.DimGray;
                Dgv_Expense.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                Dgv_Expense.ColumnHeadersDefaultCellStyle.Font      = new System.Drawing.Font("Sego UI", 8, FontStyle.Bold);
                Dgv_Expense.EnableHeadersVisualStyles = false;

                foreach (DataGridViewColumn cl in Dgv_Expense.Columns)
                {
                    cl.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                comboFlag = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error !..", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 public void fillDGV_Receipt(DataTable dtb_Receipt, string d1, string d2)
 {
     try
     {
         DGV_Receipt.RowCount = 0;
         if (dtb_Receipt.Rows.Count > 0)
         {
             for (int i = 0; i < dtb_Receipt.Rows.Count; i++)
             {
                 tax      = 0; discount = 0; amount = 0; paid = 0; due = 0;
                 Totaltax = 0; Totaldiscount = 0; Totalamount = 0; Totalpaid = 0; Totaldue = 0;
                 DGV_Receipt.Rows.Add();
                 DGV_Receipt.Rows[i].Cells["ColSLNo"].Value          = i + 1;
                 DGV_Receipt.Rows[i].Cells["ColPtName"].Value        = dtb_Receipt.Rows[i]["pt_name"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColInv"].Value           = dtb_Receipt.Rows[i]["invoice_no"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColReceipt"].Value       = dtb_Receipt.Rows[i]["receipt_no"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColAmountPaid"].Value    = dtb_Receipt.Rows[i]["amount_paid"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColTotalDue"].Value      = dtb_Receipt.Rows[i]["Total Amount Due"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColModeofpayment"].Value = dtb_Receipt.Rows[i]["mode_of_payment"].ToString();
                 DGV_Receipt.Rows[i].Cells["DATE"].Value             = Convert.ToDateTime(dtb_Receipt.Rows[i]["payment_date"].ToString()).ToString("dd-MM-yyyy");
                 DGV_Receipt.Rows[i].Cells["ColDrName"].Value        = dtb_Receipt.Rows[i]["doctor_name"].ToString();
                 DataTable inv = this.ctrlr.getinvdata(dtb_Receipt.Rows[i]["invoice_no"].ToString(), dtb_Receipt.Rows[i]["procedure_name"].ToString());
                 getinvdata(inv);
                 service = dtb_Receipt.Rows[i]["procedure_name"].ToString();
                 DGV_Receipt.Rows[i].Cells["ColProcedure"].Value   = service + " (Qty:" + qty + ")";
                 DGV_Receipt.Rows[i].Cells["ColTax"].Value         = tax;
                 DGV_Receipt.Rows[i].Cells["ColTotalIncome"].Value = amount;
                 DGV_Receipt.Rows[i].Cells["COlDIS"].Value         = discount;
                 DGV_Receipt.Rows[i].Cells["ColTotao_Cost"].Value  = cost;
                 due  = decimal.Parse(dtb_Receipt.Rows[i]["Total Amount Due"].ToString());
                 paid = decimal.Parse(dtb_Receipt.Rows[i]["amount_paid"].ToString());
             }
             int count = DGV_Receipt.Rows.Count;
             Lab_Total.Text = count.ToString();
             for (int j = 0; j < count; j++)
             {
                 Totaltax      = Totaltax + Convert.ToDecimal(DGV_Receipt.Rows[j].Cells["ColTax"].Value);
                 Totaldiscount = Totaldiscount + Convert.ToDecimal(DGV_Receipt.Rows[j].Cells["COlDIS"].Value);
                 Totalamount   = Totalamount + Convert.ToDecimal(DGV_Receipt.Rows[j].Cells["ColTotalIncome"].Value);
                 Totalpaid     = Totalpaid + Convert.ToDecimal(DGV_Receipt.Rows[j].Cells["ColAmountPaid"].Value);
                 Totaldue      = Totaldue + Convert.ToDecimal(DGV_Receipt.Rows[j].Cells["ColTotalDue"].Value);
             }
             Lab_Discount.Text = Convert.ToDecimal(Totaldiscount).ToString("#0.00");
             Lab_tax.Text      = Convert.ToDecimal(Totaltax).ToString("#0.00");
             Lab_Amount.Text   = Convert.ToDecimal(Totalamount).ToString("#0.00");
             Lab_Paid.Text     = Convert.ToDecimal(Totalpaid).ToString("#0.00");
             Lab_Due.Text      = Convert.ToDecimal(Totaldue).ToString("#0.00");
             DGV_Receipt.Columns["ColTotalDue"].Visible = true;
             Lab_Msg.Hide();
         }
         else
         {
             int x = (panel4.Size.Width - Lab_Msg.Size.Width) / 2;
             Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
             Lab_Msg.Show();
             Lab_Total.Text    = "0";
             Lab_Discount.Text = "0.00";
             Lab_tax.Text      = "0.00";
             Lab_Amount.Text   = "0.00";
             Lab_Paid.Text     = "0.00";
             Lab_Due.Text      = "0.00";
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message, "Error!...", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
Example #8
0
 private void Show_Appointment_Load(object sender, EventArgs e)
 {
     try
     {
         this.Size = Screen.PrimaryScreen.WorkingArea.Size;
         string doctr_id = this.ctrlr.privilege_A(doctor_id);
         if (int.Parse(doctr_id) > 0)
         {
             btn_Add.Enabled = false;
         }
         else
         {
             btn_Add.Enabled = true;
         }
         DataTable ptntdtls = this.ctrlr.Get_Patient_Details(patient_id);
         Get_Patient_Details(ptntdtls);
         toolStripButton9.ToolTipText = PappyjoeMVC.Model.GlobalVariables.Version;
         DataTable cmpny = this.ctrlr.Get_CompanyNAme();
         if (cmpny.Rows.Count > 0)
         {
             string clinicn = "";
             clinicn = cmpny.Rows[0][0].ToString();
             toolStripButton1.Text = clinicn.Replace("¤", "'");
         }
         string docname = this.ctrlr.Get_DoctorName(doctor_id);
         if (docname != "")
         {
             toolStripTextDoctor.Text = "Logged In As : " + docname;
         }
         panelmain.Show();
         label41.Text                       = "APPOINTMENTS";
         dataGridView2.Width                = 1040;
         dataGridView2.Height               = 510;
         dataGridView2.Visible              = true;
         dataGridView2.RowCount             = 0;
         dataGridView2.Height               = 404;
         dataGridView2.ColumnCount          = 12;
         dataGridView2.ColumnHeadersVisible = false;
         dataGridView2.RowHeadersVisible    = false;
         dataGridView2.Columns[0].Name      = "id";
         dataGridView2.Columns[0].Width     = 0;
         dataGridView2.Columns[1].Name      = "id";
         dataGridView2.Columns[1].Width     = 0;
         dataGridView2.Columns[2].Name      = "edit";
         dataGridView2.Columns[2].Width     = 40;
         dataGridView2.Columns[3].Name      = "del";
         dataGridView2.Columns[3].Width     = 40;
         dataGridView2.Columns[4].Name      = "Name";
         dataGridView2.Columns[4].Width     = 200;
         dataGridView2.Columns[5].Name      = "payment";
         dataGridView2.Columns[5].Width     = 200;
         dataGridView2.Columns[6].Name      = "sum";
         dataGridView2.Columns[6].Width     = 150;
         dataGridView2.Columns[7].Name      = "sum";
         dataGridView2.Columns[7].Width     = 75;
         dataGridView2.Columns[8].Name      = "sum";
         dataGridView2.Columns[8].Width     = 75;
         dataGridView2.Columns[9].Name      = "sum";
         dataGridView2.Columns[9].Width     = 75;
         dataGridView2.Columns[10].Name     = "sum";
         dataGridView2.Columns[10].Width    = 75;
         dataGridView2.Columns[11].Name     = "sum";
         dataGridView2.Columns[11].Width    = 75;
         dataGridView2.Columns[0].Visible   = false;
         dataGridView2.Columns[1].Visible   = false;
         DataTable dt = this.ctrlr.show(patient_id);
         show(dt);
         if (dataGridView2.Rows.Count <= 0)
         {
             Lab_Msg.Show();
             Lab_Msg.Location = new System.Drawing.Point(146, 233);
         }
         else
         {
             Lab_Msg.Hide();
             Lab_Msg.Location = new System.Drawing.Point(146, 233);
         }
     }
     catch (Exception ex)
     { MessageBox.Show("Error!..", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }