private void btnXuatHD_Click(object sender, EventArgs e) { frmXuatHD frm = new frmXuatHD(); var hoadon = db.GetMaHD(MaPhong); foreach (var item in hoadon) { sdt = item.SoDienThoai; frm.sdt = item.SoDienThoai; } var xbc = (db.XuatBaoCao(sdt)).ToList(); foreach (var item in xbc) { frm.PhiDv += (float)(item.SoLuong * item.GiaDichVu); } var bc = db.HD(sdt).ToList(); foreach (var item in bc) { frm.Tiencoc += (float)item.SoTienDat; frm.PhiThue += (float)(item.GiaPhong * item.SoNgayDaO); } frm.ShowDialog(); }
private void FormXuatHoaDon_Load(object sender, EventArgs e) { /*RptHoaDon rpt = new RptHoaDon(); * var data = db.XuatBaoCao(mahd).Select(x => new HoaDon * { * TenKhachHang = x.TenKhachHang, * TenNhanVien = x.TenNhanVien, * TenPhong = x.TenPhong, * GiaPhong = (float)(x.GiaPhong), * TenDichVu = x.TenDichVu, * SoLuong = (int)x.SoLuong, * GiaDichVu = (float)x.GiaDichVu, * Mapd = x.Mapd, * TienCoc = (float)x.SoTienDat, * PhiDichVu = frmChiTiet.PhiDV, * PhiThue = frmChiTiet.PhiThue, * TongTien = frmChiTiet.PhiDV + frmChiTiet.PhiThue - (float)x.SoTienDat * * * }).ToList(); * rpt.SetDataSource(data); * rptViewer.ReportSource = rpt; * * rptViewer.Show();*/ RptHoaDon rpt = new RptHoaDon(); var dt = db.XuatBaoCao(sdt).Select(x => new HoaDon { TenKhachHang = x.TenKhachHang, TenNhanVien = x.TenNhanVien, TenPhong = x.TenPhong, GiaPhong = (float)x.GiaPhong, TenDichVu = x.TenDichVu, SoLuong = (int)x.SoLuong, GiaDichVu = (float)x.GiaDichVu, Mapd = x.Mapd, TienCoc = Tiencoc, PhiDichVu = PhiDv, PhiThue = PhiThue, TongTien = PhiDv + PhiThue - Tiencoc }).ToList(); rpt.SetDataSource(dt); rptViewer.ReportSource = rpt; rptViewer.Show(); }