private void GUI_CTHD_Load(object sender, EventArgs e) { txtNgBan.Text = db.TAIKHOANs.Where(st => st.MATK.Equals(HD.MATK)).ToList().Select(b => b.HOTEN).Last(); txtNgay.Text = HD.NGAYBAN.ToString(); txtTongTien.Text = HD.TONGTIEN.ToString(); txtTSL.Text = HD.TONGSL.ToString(); txtTienKH.Text = HD.TIENKHACHDUA.ToString(); txtTienTra.Text = HD.TIENKHATRA.ToString(); lstCTHD.DataSource = ctl.loadListCTHD(HD.SOHD); List <CTHOADON> cthd = ctl.loadListCTHD(HD.SOHD); List <HOADON> tmp = ctl.loadListHD(); lstCTHD.DataSource = cthd.Select(b => new { MaHoaDon = b.SOHD, MaSP = b.MASP, Dongia = b.DONGIA, Soluong = b.SOLUONG, ThanhTien = b.SOLUONG * b.DONGIA }).ToList(); txtTongTien.Text = cthd.Sum(st => st.SOLUONG * st.DONGIA).ToString(); txtTSL.Text = cthd.Sum(st => st.SOLUONG).ToString(); ctl.updateHD(HD.SOHD, txtTongTien.Text, txtTienKH.Text, txtTienTra.Text, txtTSL.Text); }
private void GUI_QLHD_Load(object sender, EventArgs e) { lstHD.DataSource = ctl.loadListHD(); lstHD.Columns[8].Visible = false; lstHD.Columns[9].Visible = false; }