private void btThem_Click(object sender, EventArgs e)
        {
            DTO_CTHD curCTHD = new DTO_CTHD(lbMaHD.Text, TD.MaTD, (int)nudSoLuong.Value);


            busBan.ThemCTHDTam(curCTHD);
            LoadCTHD();



            lbTongTien.Text = (busBan.TongTienHDTam(hd) - busBan.TongTienHDTam(hd) * hd.KhuyenMai / 100).ToString();
        }
Exemple #2
0
        private void btOK_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Gộp " + OldBan.TenBan + " vào " + cbBan.Text + "?", "Confirm",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DTO_HoaDon oldHD  = busBan.curhd(OldBan);
                DTO_Ban    NewBan = busBan.curBan(cbBan.Text);
                DTO_HoaDon newHD  = busBan.curhd(NewBan);

                DataTable dtCTHDOld = busBan.CTHDtheoMaHD(oldHD.MaHD);
                foreach (DataRow dr in dtCTHDOld.Rows)
                {
                    DTO_CTHD cthd = new DTO_CTHD(newHD.MaHD, dr[1].ToString(), (int)dr[2]);

                    busBan.ThemCTHDTam(cthd).ToString();
                    busBan.DeleteCTHDSoluong(dr[0].ToString(), dr[1].ToString(), (int)dr[2]);
                }
                FormKhuVucBan.IndexBan = NewBan.IdBan - 1;
                busBan.UpdateTrangThaiBan(OldBan, 0);
                busBan.ClearTemp(oldHD.MaHD);


                this.Close();
            }
        }