public DataTable TongTienTheoThangCuaPhong(ThongKe thongke) { String sql = "select PARSENAME(convert(varchar,convert(money,((sum(GiaDichVu*DonViSuDung))+GIA_THUE.GiaTien)),1),2 ) as giatien from CT_DICHVU, DICH_VU, HOA_DON, PHONG_TRO, GIA_THUE where CT_DICHVU.MaDichVu = DICH_VU.MaDichVu and CT_DICHVU.MaHoaDon = HOA_DON.MaHoaDon and GIA_THUE.SoNguoi = PHONG_TRO.SoNguoi and PHONG_TRO.MaPhong = HOA_DON.MaPhong and PHONG_TRO.MaPhong = '" + thongke.getMaphong() + "' and RIGHT(CONVERT(varchar(10), NgayLap, 103),7) = RIGHT(CONVERT(varchar(10), '" + thongke.getNgaylap() + "', 103),7) group by HOA_DON.MaHoaDon, ngaylap, HOA_DON.MaPhong, PHONG_TRO.SoNguoi, GIA_THUE.GiaTien"; rs = manager.executeQuery(sql); return(rs); }
//Load tiền phòng theo mã phòng public DataTable loadTienPhongTheoMa(ThongKe thongke) { String sql = "select MaPhong, PARSENAME(convert(varchar,convert(money,GiaTien),1),2 ) as giatien from GIA_THUE, PHONG_TRO where GIA_THUE.SoNguoi = PHONG_TRO.SoNguoi and MaPhong = '" + thongke.getMaphong() + "'"; rs = manager.executeQuery(sql); return(rs); }