Exemple #1
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     try
     {
         discharge_bill db = new discharge_bill(richTextBox1.Text, label8.Text);
         db.Show();
     }
     catch
     {
     }
 }
Exemple #2
0
        private void button5_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    = dataGridView2.Rows.Count;
                db.sql.Close();
                db.sql.Open();
                for (n = 0; n <= c - 1; n++)
                {
                    val3 = dataGridView2.Rows[n].Cells[2].Value.ToString();
                    val4 = dataGridView2.Rows[n].Cells[3].Value.ToString();

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

            try
            {
                int aa = Convert.ToInt32(label15.Text);
                int b  = Convert.ToInt32(richTextBox5.Text);

                if (richTextBox5.Text == "")
                {
                    MessageBox.Show("Give a valid amount");
                }
                else
                {
                    if (b != aa)
                    {
                        MessageBox.Show("You have to pay the current due amount");
                    }
                    else
                    {
                        string   date = dateTimePicker1.Text;
                        DateTime d    = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        string   dd   = d.ToString("yyyy/MM/dd");
                        db.sql.Close();
                        db.sql.Open();
                        SqlCommand cmd2 = new SqlCommand("delete from discharge_bill where reg_no='" + richTextBox1.Text + "'", db.sql);
                        cmd2.ExecuteNonQuery();
                        db.sql.Close();
                        db.sql.Open();
                        SqlCommand cmd = new SqlCommand("insert into discharge_bill(reg_no,total,discount,paid,date,date2)values('" + richTextBox1.Text + "','" + label13.Text + "','" + richTextBox9.Text + "','" + richTextBox5.Text + "','" + date + "','" + dd + "')", db.sql);
                        int        a   = cmd.ExecuteNonQuery();
                        if (a > 0)
                        {
                            MessageBox.Show("Bill taken Sucessfully");
                            discharge_bill dbb = new discharge_bill(richTextBox1.Text, label8.Text);
                            dbb.Show();
                        }
                        else
                        {
                            MessageBox.Show("Not Paid");
                        }
                        db.sql.Close();
                    }
                }
            }
            catch
            {
            }
        }