//close form
        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialog = MessageBox.Show("Do you really want to clear the bill?", "Clear", MessageBoxButtons.YesNo);
                if (dialog == DialogResult.Yes)
                {
                    MySqlConnection myConn    = new MySqlConnection(Connection.myConnection);
                    MySqlCommand    SelectCom = new MySqlCommand("delete from sales where invoiceNum = '" + label7.Text + "'", myConn);
                    MySqlDataReader myReader;

                    myConn.Open();
                    myReader = SelectCom.ExecuteReader();

                    this.Close();
                    cashier_from_admin c = new cashier_from_admin();
                    c.Show();
                }
                else if (dialog == DialogResult.No)
                {
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        //payment button
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox3.Text == "")
            {
                MessageBox.Show("You have not calculated the balance");
                textBox2.Text = "";
                textBox3.Text = "";
                textBox4.Text = "";
            }

            else
            {
                try
                {
                    DialogResult dialog = MessageBox.Show("Confirm the Payment?", "Payment Confirm", MessageBoxButtons.YesNo);
                    if (dialog == DialogResult.Yes)
                    {
                        MySqlConnection myConn     = new MySqlConnection(Connection.myConnection);
                        MySqlCommand    SelectCom  = new MySqlCommand("insert into sales_invoice  (invoiceNum,date,time,details,totalBill,discount,cashPaid,balance) values ('" + label7.Text + "','" + label1.Text + "','" + DateTime.Now.ToLongTimeString() + "','" + richTextBox1.Text + "','" + textBox1.Text + "','" + label9.Text + "','" + label10.Text + "','" + textBox3.Text + "') ", myConn);
                        MySqlCommand    SelectCom1 = new MySqlCommand("insert into cash_received_from_sales (invoiceNum,date,time,cashPaid) values ('" + label7.Text + "','" + label1.Text + "','" + DateTime.Now.ToLongTimeString() + "','" + label10.Text + "')", myConn);
                        MySqlDataReader myReader;
                        MySqlDataReader myReader1;

                        myConn.Open();
                        myReader = SelectCom.ExecuteReader();
                        myConn.Close();
                        if (label10.Text != "0.00")
                        {
                            myConn.Open();
                            myReader1 = SelectCom1.ExecuteReader();
                        }

                        MessageBox.Show("Payment has been completed");

                        this.Close();
                        foreach (Form s in Application.OpenForms)
                        {
                            if (s.Text == "Admin Cashier")
                            {
                                s.Close();
                                break;
                            }
                        }

                        cashier_from_admin c = new cashier_from_admin();
                        c.Show();
                    }
                    else if (dialog == DialogResult.No)
                    {
                        textBox2.Text = "";
                        textBox3.Text = "";
                        textBox4.Text = "";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
示例#3
0
        private void cashierLoginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool IsOpen = false;


            foreach (Form s in Application.OpenForms)
            {
                if (s.Text == "Admin Cashier")
                {
                    IsOpen = true;
                    s.BringToFront();
                    break;
                }
            }

            if (IsOpen == false)
            {
                cashier_from_admin c = new cashier_from_admin();
                c.Show();
            }
        }