public frmRpt_Revenue_Rooms(DateTime From, DateTime To, int IDLang)
        {
            InitializeComponent();
            this.From = From;
            this.To = To;
            this.IDLang = IDLang;

            try
            {
                lblFrom.Text = From.ToString();
                lblTo.Text = To.ToString();
                ReportTaskBO aReportTaskBO = new ReportTaskBO();
                RoomsBO aRoomsBO = new RoomsBO();
                List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(IDLang);
                List<string> aListCodeRoom = new List<string>();
                for (int i = 0; i < aListRooms.Count; i++)
                {
                    string CodeRoom = aListRooms[i].Code;
                    aListCodeRoom.Add(CodeRoom);
                }
                List<RevenueEN> aListRevenueEN = aReportTaskBO.GetRevenueRoom(From, To, aListCodeRoom);
                this.DataSource = aListRevenueEN;

                cellSkuRoom.DataBindings.Add("Text", this.DataSource, "Sku");
                cellRevenue.DataBindings.Add("Text", this.DataSource, "Revenue","{0:0,0}");

                double TotalMoney = aListRevenueEN.Select(r => r.Revenue).Sum();
                lblRevenue.Text = String.Format("{0:0,0} (VND)",TotalMoney);
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmRpt_Revenue_Rooms.frmRpt_Revenue_Rooms\n" + ex.ToString());
            }
        }
        public frmRpt_Performance_Rooms(DateTime From, DateTime To, int IDLang)
        {
            InitializeComponent();
            this.From = From;
            this.To = To;
            this.IDLang = IDLang;

            lblFrom.Text = From.ToString();
            lblTo.Text = To.ToString();
            RoomsBO aRoomsBO = new RoomsBO();
            ReportTaskBO aReportTaskBO = new ReportTaskBO();
            List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(IDLang);
            List<string> aListCodeRoom = new List<string>();
            for (int i = 0; i < aListRooms.Count; i++)
            {
                string CodeRoom = aListRooms[i].Code;
                aListCodeRoom.Add(CodeRoom);
            }

            List<EfficiencyEN> aListEfficiencyEN = aReportTaskBO.GetEfficiencyRoom(From, To, aListCodeRoom);

            //List<EfficiencyEN> List1 = new List<EfficiencyEN>();
            //List<EfficiencyEN> List2 = new List<EfficiencyEN>();

            //List1 = aListEfficiencyEN.GetRange(0, Convert.ToInt32(Math.Floor(Convert.ToDouble(aListEfficiencyEN.Count / 2))));
            //List2 = aListEfficiencyEN.GetRange(Convert.ToInt32(Math.Ceiling(Convert.ToDouble(aListEfficiencyEN.Count / 2))), aListEfficiencyEN.Count);

            this.DataSource = aListEfficiencyEN;
            cellSkuRoom.DataBindings.Add("Text", this.DataSource, "Sku");
            cellPerformance.DataBindings.Add("Text", this.DataSource, "Efficiency");

            double x = aListEfficiencyEN.Select(a => a.Efficiency).Sum();
            double y = aListEfficiencyEN.Count;
            lblPerformance.Text = (Math.Round(x / y, 2)).ToString() + "%";
        }
        public void LoadDataRevenueRooms(DateTime FromDate,DateTime ToDate)
        {
            try
            {
                if (FromDate >= ToDate)
                {
                    MessageBox.Show("Vui lòng nhập ngày bắt đầu kiểm tra nhỏ hơn ngày kết thúc .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    ReportTaskBO aReportTaskBO = new ReportTaskBO();
                    RoomsBO aRoomsBO = new RoomsBO();
                    List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(1);
                    List<string> aListCodeRoom = new List<string>();
                    for (int i = 0; i < aListRooms.Count; i++)
                    {
                        string CodeRoom = aListRooms[i].Code;
                        aListCodeRoom.Add(CodeRoom);
                    }
                    List<RevenueEN> aListRevenueEN = aReportTaskBO.GetRevenueRoom(this.FromDate,this.ToDate,aListCodeRoom);
                    colRevenue.DisplayFormat.FormatType = FormatType.Numeric;
                    colRevenue.DisplayFormat.FormatString = "{0:0,0}";
                    dgvRevenue.DataSource = aListRevenueEN;

                    double TotalMoney = aListRevenueEN.Select(r => r.Revenue).Sum();
                    lblTotalRevenue.Text = String.Format("{0:0,0}", TotalMoney);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_Calculator_Revenue.LoadDataRevenueRooms\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //Hiennv
        private void frmIns_ExtraCostRooms_Load(object sender, EventArgs e)
        {
            try
            {
                RoomsBO aRoomsBO = new RoomsBO();

                List<Rooms> aListRooms = aRoomsBO.Select_ByIDLang(1).Where(r=>r.Disable==false).ToList();
                lueSku.Properties.DataSource = aListRooms;
                lueSku.Properties.DisplayMember = "Sku";
                lueSku.Properties.ValueMember = "ID";

                lueCustomerType.Properties.DataSource = CORE.CONSTANTS.ListCustomerTypes;
                lueCustomerType.Properties.DisplayMember = "Name";
                lueCustomerType.Properties.ValueMember = "ID";
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_ExtraCostRooms.frmIns_ExtraCostRooms_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 //=======================================================
 //Author: LinhTN
 //Function : ReLoad Rooms
 //=======================================================
 public void ReloadData()
 {
     RoomsBO aRoomsBO = new RoomsBO();
     dgvRooms.DataSource = aRoomsBO.Select_ByIDLang(1);
     dgvRooms.RefreshDataSource();
 }
        //=======================================================
        //Author: Ngoc
        //Function :
        //=======================================================
        public List<List<RptRoomStatusEN>> RoomsPerformanceInMonth(DateTime aDate)
        {
            List<sp_Get_Status_ListRooms_In_Month_Result> aList = aDatabaseDA.sp_Get_Status_ListRooms_In_Month(aDate.Date).ToList();
            RoomsBO aRoomsBO = new RoomsBO();
            List<RptRoomStatusEN> aRet = new List<RptRoomStatusEN>();
            List<List<RptRoomStatusEN>> aRet2 = new List<List<RptRoomStatusEN>>();

            for (int i = 1; i <= DateTime.DaysInMonth(aDate.Year, aDate.Month); i++)
            {
                aRet2.Add(GetTextInReport(aList, i, aRoomsBO.Select_ByIDLang(1).ToList()));
            }
            return aRet2;
        }
        // Linhting - Lay du lieu cho NewPayment
        public List<ServiceUsedEN> GetListServiceUsedInRoom_ByIDBookingRoom(int IDBookingRoom)
        {
            try
            {
                List<vw__BookingRooms_ServicesInfo__BookingRooms_BookingRoomsServices_Services_ServiceGroups> aListTemp = new List<vw__BookingRooms_ServicesInfo__BookingRooms_BookingRoomsServices_Services_ServiceGroups>();
                aListTemp = aDatabaseDA.vw__BookingRooms_ServicesInfo__BookingRooms_BookingRoomsServices_Services_ServiceGroups.Where(v => v.BookingRooms_Services_IDBookingRoom == IDBookingRoom).ToList();
                List<ServiceUsedEN> aListReturn = new List<ServiceUsedEN>();
                ServiceUsedEN aServiceUsedEN;
                RoomsBO aRoomsBO = new RoomsBO();

                List<Rooms> aListRoomTemp = aRoomsBO.Select_ByIDLang(1);

                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aServiceUsedEN = new ServiceUsedEN();
                    aServiceUsedEN.IDBookingService = aListTemp[i].BookingRooms_Services_ID;
                    aServiceUsedEN.IDServiceGroup = aListTemp[i].ServiceGroups_ID;
                    aServiceUsedEN.ServiceGroupName = aListTemp[i].ServiceGroups_Name;
                    aServiceUsedEN.IDService = aListTemp[i].Services_ID;
                    aServiceUsedEN.DateUsed = aListTemp[i].BookingRooms_Services_Date;
                    if (aListRoomTemp.Where(r => r.Code == aListTemp[i].BookingRooms_CodeRoom).ToList().Count > 0)
                    {
                        aServiceUsedEN.Sku = aListRoomTemp.Where(r => r.Code == aListTemp[i].BookingRooms_CodeRoom).ToList()[0].Sku;
                    }
                    aServiceUsedEN.IndexSubPayment = aListTemp[i].BookingRooms_Services_IndexSubPayment;
                    aServiceUsedEN.StatusPay = aListTemp[i].BookingRooms_Services_Status;
                    aServiceUsedEN.NameService = aListTemp[i].Services_Name;
                    aServiceUsedEN.Quantity = aListTemp[i].BookingRooms_Services_Quantity;
                    aServiceUsedEN.Cost = aListTemp[i].BookingRooms_Services_Cost;
                    aServiceUsedEN.CostRef_Service = aListTemp[i].Services_CostRef;
                    aServiceUsedEN.Tax = aListTemp[i].BookingRooms_Services_PercentTax;

                    aListReturn.Insert(i, aServiceUsedEN);
                }

                return aListReturn;

            }
            catch (Exception ex)
            {

                throw new Exception("ReceptionTaskBO.GetListServiceUsed_ByIDBookingRoom\n" + ex.ToString());
            }
        }