private void bttThem_Click(object sender, EventArgs e)
        {
            string sql;

            if (comboMaTour.Text.Length == 0)
            {
                MessageBox.Show("Bạn phải nhập mã tour", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comboMaTour.Focus();
                return;
            }
            if (comboMaKH.Text.Length == 0)
            {
                MessageBox.Show("Bạn phải nhập mã khách hàng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comboMaKH.Focus();
                return;
            }
            txtNgayLapHD.Text = DateTime.Now.ToString();
            txtSoHD.Text      = creakeyDK();

            sql = "INSERT INTO HOADON$ (SoHD,MSNV,MaKT,MaKH,MATOUR,NgayLap) values(" + txtSoHD.Text + ", N'" + comboNVT.SelectedValue + "',N'" +
                  comboKT.SelectedValue + "',N'" + comboMaKH.SelectedValue + "',N'" + comboMaTour.SelectedValue + "','" + txtNgayLapHD.Text + "')";
            Functions.RunSQL(sql);
            HoaDon hd = new HoaDon();

            hd.LoadDataGridViewHD();
            hd.StartPosition = FormStartPosition.CenterParent;
            hd.ShowDialog();
            Reset_ValuesDK();
        }
        private void bttXoa_Click(object sender, EventArgs e)
        {
            string sql;


            if (txtSoHD.Text == "")
            {
                MessageBox.Show("Bạn chưa chọn hóa đơn nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                sql = "DELETE FROM HOADON$ WHERE SoHD=N'" + txtSoHD.Text + "'";
                Functions.RunSqlDel(sql);

                HoaDon hd = new HoaDon();
                hd.LoadDataGridViewHD();
                hd.StartPosition = FormStartPosition.CenterParent;
                hd.ShowDialog();
                Reset_ValuesDK();
            }
        }
Exemple #3
0
        private void toolStripMenuItem14_Click(object sender, EventArgs e)
        {
            HoaDon hd = new HoaDon();

            hd.ShowDialog();
        }