Ejemplo n.º 1
0
        public SoSanhThongKeDTO SoSanhThongKeTheoQuy(int quy, int nam)
        {
            double doanhThuThuePhongHT = 0;
            double doanhThuDichVuHT    = 0;
            double doanhThuThuePhongQK = 0;
            double doanhThuDichVuQK    = 0;
            List <ThongKeTheoQuyDTO> lstThongKeTheoQuyHienTai;
            List <ThongKeTheoQuyDTO> lstThongKeTheoQuyTruoc;

            lstThongKeTheoQuyHienTai = BaoCaoThongKeTheoQuy(quy, nam);
            if (quy != 1)
            {
                lstThongKeTheoQuyTruoc = BaoCaoThongKeTheoQuy(quy - 1, nam);
            }
            else
            {
                lstThongKeTheoQuyTruoc = BaoCaoThongKeTheoQuy(4, nam - 1);
            }
            foreach (var thongKe in lstThongKeTheoQuyHienTai)
            {
                if (thongKe.TenDichVu.Equals("Cho thuê phòng"))
                {
                    doanhThuThuePhongHT += thongKe.TrungBinh;
                }
                else
                {
                    doanhThuDichVuHT += thongKe.TrungBinh;
                }
            }
            foreach (var thongKe in lstThongKeTheoQuyTruoc)
            {
                if (thongKe.TenDichVu.Equals("Cho thuê phòng"))
                {
                    doanhThuThuePhongQK += thongKe.TrungBinh;
                }
                else
                {
                    doanhThuDichVuQK += thongKe.TrungBinh;
                }
            }
            SoSanhThongKeDTO soSanhThongKeDTO = new SoSanhThongKeDTO();

            if (doanhThuDichVuQK == 0)
            {
                doanhThuDichVuQK = doanhThuDichVuHT;
            }
            if (doanhThuThuePhongQK == 0)
            {
                doanhThuThuePhongQK = doanhThuThuePhongHT;
            }
            if (doanhThuDichVuHT == 0 && doanhThuDichVuQK == 0)
            {
                soSanhThongKeDTO.TienDichVu = 0;
            }
            else
            {
                soSanhThongKeDTO.TienDichVu = (doanhThuDichVuHT / doanhThuDichVuQK) * 100;
            }
            if (doanhThuThuePhongHT == 0 && doanhThuThuePhongQK == 0)
            {
                soSanhThongKeDTO.TienThuePhong = 0;
            }
            else
            {
                soSanhThongKeDTO.TienThuePhong = (doanhThuThuePhongHT / doanhThuThuePhongQK) * 100;
            }
            return(soSanhThongKeDTO);
        }
Ejemplo n.º 2
0
        public SoSanhThongKeDTO SoSanhThongKeTheoThang(int thang, int nam)
        {
            double doanhThuThuePhongHT = 0;
            double doanhThuDichVuHT    = 0;
            double doanhThuThuePhongQK = 0;
            double doanhThuDichVuQK    = 0;
            List <ThongKeTheoThangDTO> lstThongKeTheoThangHienTai;
            List <ThongKeTheoThangDTO> lstThongKeTheoThangTruoc;

            lstThongKeTheoThangHienTai = BaoCaoThongKeTheoThang(thang, nam);
            if (thang != 1)
            {
                lstThongKeTheoThangTruoc = BaoCaoThongKeTheoThang(thang - 1, nam);
            }
            else
            {
                lstThongKeTheoThangTruoc = BaoCaoThongKeTheoThang(12, nam - 1);
            }
            foreach (var thongKe in lstThongKeTheoThangHienTai)
            {
                if (thongKe.TenDichVu.Equals("Cho thuê phòng"))
                {
                    doanhThuThuePhongHT += thongKe.DoanThu;
                }
                else
                {
                    doanhThuDichVuHT += thongKe.DoanThu;
                }
            }
            foreach (var thongKe in lstThongKeTheoThangTruoc)
            {
                if (thongKe.TenDichVu.Equals("Cho thuê phòng"))
                {
                    doanhThuThuePhongQK += thongKe.DoanThu;
                }
                else
                {
                    doanhThuDichVuQK += thongKe.DoanThu;
                }
            }
            SoSanhThongKeDTO soSanhThongKeDTO = new SoSanhThongKeDTO();

            if (doanhThuDichVuQK == 0)
            {
                doanhThuDichVuQK = doanhThuDichVuHT;
            }
            if (doanhThuThuePhongQK == 0)
            {
                doanhThuThuePhongQK = doanhThuThuePhongHT;
            }
            if (doanhThuDichVuHT == 0 && doanhThuDichVuQK == 0)
            {
                soSanhThongKeDTO.TienDichVu = 0;
            }
            else
            {
                soSanhThongKeDTO.TienDichVu = (doanhThuDichVuHT / doanhThuDichVuQK) * 100;
            }
            if (doanhThuThuePhongHT == 0 && doanhThuThuePhongQK == 0)
            {
                soSanhThongKeDTO.TienThuePhong = 0;
            }
            else
            {
                soSanhThongKeDTO.TienThuePhong = (doanhThuThuePhongHT / doanhThuThuePhongQK) * 100;
            }

            return(soSanhThongKeDTO);
        }