示例#1
0
 private void vIEWToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         string    a   = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
         OPD_Print pei = new OPD_Print(a);
         pei.Show();
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
        private void button8_Click(object sender, EventArgs e)
        {
            try
            {
                int    exe  = 0;
                int    id   = 0;;
                string val1 = "";
                string val2 = "";
                string val3 = "";
                string val4 = "";
                int    n    = 0;
                int    c    = dataGridView5.Rows.Count;
                db.sql.Close();
                db.sql.Open();
                for (n = 0; n <= c - 1; n++)
                {
                    val3 = dataGridView5.Rows[n].Cells[2].Value.ToString();
                    val4 = dataGridView5.Rows[n].Cells[3].Value.ToString();

                    SqlCommand cmd = new SqlCommand("update opd_bill set bill='" + val3 + "' where reg_no='" + patient_id.Text + "' and bill_id='" + val4 + "'", db.sql);
                    exe = cmd.ExecuteNonQuery();
                }
                db.sql.Close();
            }
            catch
            {
            }

            try
            {
                int aa = Convert.ToInt32(label52.Text);
                int b  = Convert.ToInt32(richTextBox17.Text);

                if (richTextBox17.Text == "")
                {
                    MessageBox.Show("Give a valid amount");
                }
                else
                {
                    string   date = DateTime.Now.ToString("dd/MM/yyyy");
                    DateTime d    = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    string   dd   = d.ToString("yyyy/MM/dd");
                    db.sql.Close();
                    db.sql.Open();

                    SqlCommand cmd3 = new SqlCommand("delete from user_cash_collection_OPD where reg_no='" + patient_id.Text + "' and type='OPD Bill'", db.sql);


                    cmd3.ExecuteNonQuery();

                    db.sql.Close();
                    db.sql.Open();

                    SqlCommand cmd = new SqlCommand("insert into user_cash_collection_OPD(user_name,password,reg_no,name,total,discount,paid,due,date,type,date2) values('" + user_name + "','" + password + "','" + patient_id.Text + "','" + richTextBox1.Text + "','" + label55.Text + "','" + richTextBox16.Text + "','" + richTextBox17.Text + "','" + label52.Text + "','" + date + "','OPD Bill','" + dd + "')", db.sql);


                    int a = cmd.ExecuteNonQuery();
                    if (a > 0)
                    {
                        MessageBox.Show("Bill taken Sucessfully");
                        OPD_Print opd = new OPD_Print(patient_id.Text);
                        opd.Show();
                    }
                    else
                    {
                        MessageBox.Show("Not Paid");
                    }
                    db.sql.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }