private void txt_enter_name_SelectedIndexChanged(object sender, EventArgs e)
        {
            UC_payments.studno = txt_enter_name.Text.Split('-').GetValue(0).ToString();
            UC_payments u = new UC_payments();

            metroPanel1.Controls.Clear();
            con.Open();
            SqlCommand    cmd = new SqlCommand("EXECUTE stud_details_for_payments '" + txt_enter_name.Text.Split('-').GetValue(0).ToString() + "'", con);
            SqlDataReader dr  = cmd.ExecuteReader();

            dr.Read();
            u.txt_studno.Text      = dr.GetValue(0).ToString();
            u.txt_studname.Text    = dr.GetValue(1).ToString();
            u.txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(2).ToString());
            u.txt_batch_no.Text    = dr.GetValue(3).ToString();
            u.txt_course_fee_for_full_payament.Text = u.txt_cfee.Text = u.txt_module_pay_course_fee.Text = dr.GetValue(4).ToString() + "/=";
            u.txt_nic.Text        = dr.GetValue(5).ToString();
            u.txt_batch_name.Text = General_methods.get_batch_name_from_batch_ne(dr.GetValue(3).ToString());
            General_methods.get_stud_pic(u.pictureBox1, dr.GetValue(0).ToString());
            u.txt_amount_payable.Text    = General_methods.calc_amount_payable(txt_enter_name.Text.Split('-').GetValue(0).ToString().ToString(), 0, "Diploma").ToString() + "/=";
            u.txt_reg_fee_of_course.Text = dr.GetValue(6).ToString() + "/=";
            metroPanel1.Controls.Add(u);
            dr.Close();
            con.Close();
            u.label1.TextChanged += handler;
        }
        public void handler2(object sender, EventArgs e)
        {
            UC_payements_certif.studno = txt_certif_enter_name.Text.Split('-').GetValue(0).ToString();
            UC_payements_certif u = new UC_payements_certif();

            metroPanel2.Controls.Clear();
            con.Open();
            SqlCommand    cmd = new SqlCommand("EXECUTE stud_details_for_payments '" + txt_certif_enter_name.Text.Split('-').GetValue(0).ToString() + "'", con);
            SqlDataReader dr  = cmd.ExecuteReader();

            dr.Read();
            u.txt_studno.Text      = dr.GetValue(0).ToString();
            u.txt_studname.Text    = dr.GetValue(1).ToString();
            u.txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(2).ToString());
            u.txt_batch_no.Text    = dr.GetValue(3).ToString();
            u.txt_reg_fee.Text     = u.txt_cfee.Text = u.txt_course_fee.Text = dr.GetValue(4).ToString() + "/=";
            u.txt_nic.Text         = dr.GetValue(5).ToString();
            u.txt_batch_name.Text  = General_methods.get_batch_name_from_batch_ne(dr.GetValue(3).ToString());
            General_methods.get_stud_pic(u.pictureBox1, dr.GetValue(0).ToString());
            u.txt_amount_payabme.Text = General_methods.calc_amount_payable(txt_certif_enter_name.Text.Split('-').GetValue(0).ToString().ToString(), 0, "Certificate").ToString() + "/=";
            u.txt_reg_fee.Text        = dr.GetValue(6).ToString() + "/=";
            metroPanel2.Controls.Add(u);
            dr.Close();
            con.Close();
            u.label1.TextChanged += handler2;
        }
 private void metroTile9_Click(object sender, EventArgs e)
 {
     if (txt_mod_wise_discount.Text.Any(char.IsLetter) == true || txt_mod_wise_discount.Text == "" || Convert.ToDouble(txt_mod_wise_discount.Text) > 100)
     {
         MessageBox.Show("Please enter valid discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         txt_mosule_wise_amount_after_discount.Text = (Convert.ToDouble(txt_amount_paying_module_wise.Text.Remove(txt_amount_paying_module_wise.Text.Length - 2, 2)) * Convert.ToDouble(100 - Convert.ToDouble(txt_mod_wise_discount.Text)) / 100).ToString("R") + "/=";
         txt_final_amount_mod_wise.Text             = General_methods.calc_amount_payable(txt_studno.Text, Convert.ToDouble(txt_amount_paying_module_wise.Text.Remove(txt_amount_paying_module_wise.Text.Length - 2, 2)), "Diploma").ToString("R") + "/=";
     }
 }
        private void metroTile10_Click(object sender, EventArgs e)
        {
            if (txt_amount_paying.Text.Any(char.IsLetter) == true || txt_amount_paying.Text == "" || Convert.ToDouble(txt_amount_paying.Text) > Convert.ToDouble(txt_amount_payabme.Text.Remove(txt_amount_payabme.Text.Length - 2, 2)))
            {
                MessageBox.Show("Please enter correct amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txt_discount.Text.Any(char.IsLetter) == true || txt_discount.Text == "" || Convert.ToDouble(txt_discount.Text) > 100)
            {
                MessageBox.Show("Please enter valid discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                txt_final_amount.Text     = (Convert.ToDouble(txt_amount_paying.Text) * Convert.ToDouble(100 - Convert.ToDouble(txt_discount.Text)) / 100).ToString("R") + "/=";
                txt_amount_payable_2.Text = General_methods.calc_amount_payable(txt_studno.Text, Convert.ToDouble(txt_amount_paying.Text), "Certificate").ToString();
            }
        }
        public UC_payements_certif()
        {
            InitializeComponent();
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            if (General_methods.calc_amount_payable(studno, 0, "Certificate") == 0)
            {
                groupBox3.Enabled = false;
                groupBox3.Text    = "Course fee fully Payed";
            }
            metroGrid1.DataSource = d.show("SELECT Payment_No,Gross_amount,Discount_percent,Net_amount,Date,Time,Remark FROM PaymentDetails WHERE stud_no_org_no='" + studno + "'");
            metroGrid1.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            metroGrid1.AllowUserToAddRows      = false;
            DataGridViewButtonColumn bt = new DataGridViewButtonColumn();

            bt.Text      = "Terminate Payment";
            bt.FlatStyle = FlatStyle.Flat;
            bt.UseColumnTextForButtonValue = true;
            bt.Width = 150;
            metroGrid1.Columns.Add(bt);
            DataGridViewButtonColumn bt2 = new DataGridViewButtonColumn();

            bt2.Text      = "Generate Recipt";
            bt2.FlatStyle = FlatStyle.Flat;
            bt2.UseColumnTextForButtonValue = true;
            bt2.Width = 150;
            metroGrid1.Columns.Add(bt2);
            con.Open();
            SqlCommand    cmd2 = new SqlCommand("SELECT reg_fee FROM Stud_details WHERE stud_no='" + studno + "'", con);
            SqlDataReader dr2  = cmd2.ExecuteReader();

            dr2.Read();
            if (!dr2.IsDBNull(0))
            {
                groupBox2.Enabled = false;
                groupBox2.Text    = "Registration fee  payed";
            }
            else
            {
            }
            con.Close();
        }