public frmRpt_DetailMenus(int IDMenu,int IDBookingHall)
        {
            InitializeComponent();
            this.IDMenu = IDMenu;
            this.IDBookingHall = IDBookingHall;
            FoodsBO aFoodsBO = new FoodsBO();
            MenusBO aMenusBO = new MenusBO();
            ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
            List<Foods> aListTemp = aReceptionTaskBO.GetListFoods_ByIDMenu(this.IDMenu);
            List<Foods> aListFoods = new List<Foods>();

            foreach (Foods item in aListTemp)
            {
                Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                if (aFoods.Image1 != null)
                {
                    if (aFoods.Image1.Length <= 0)
                    {
                        Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                }
                else
                {
                    Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                    image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                    Byte[] aImageByte = this.ConvertImageToByteArray(image);
                    aFoods.Image1 = aImageByte;
                }

                aListFoods.Add(aFoods);
            }

            Menus aMenus = aMenusBO.Select_ByID(this.IDMenu);
            lblNameMenu.Text = aMenus.Name;
            //danh sach cac mon an co trong thuc don
            this.DataSource = aListFoods;
            picImage1Food.DataBindings.Add("Image", this.DataSource, "Image1");
            colNameFood.DataBindings.Add("Text", this.DataSource, "Name");
            colName1Food.DataBindings.Add("Text", this.DataSource, "Name1");
            colName2Food.DataBindings.Add("Text", this.DataSource, "Name2");
            colName3Food.DataBindings.Add("Text", this.DataSource, "Name3");
            // Thông tin buổi tiệc
            BookingHallsBO aBookingHallsBO = new BookingHallsBO();
            BookingHalls aTemp = aBookingHallsBO.Select_ByID(IDBookingHall);
            lblStartTime.Text = aTemp.StartTime.ToString();
            lblEndTime.Text = aTemp.EndTime.ToString();
            HallsBO aHallsBO = new HallsBO();
            lblHallSku.Text = aHallsBO.Select_ByCodeHall(aTemp.CodeHall,1).Sku;
            BookingHsBO aBookingHsBO = new BookingHsBO();
            lblSubject.Text = aBookingHsBO.Select_ByID(aTemp.IDBookingH).Subject;
        }
        //hiennv
        public void LoadDataListFoods()
        {
            try
            {

                FoodsBO aFoodsBO = new FoodsBO();
                List<Foods> aListFoods = new List<Foods>();
                List<Foods> aListTemp = aFoodsBO.Select_All();
                foreach (Foods item in aListTemp)
                {
                    Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                    if (aFoods.Image1 != null)
                    {
                        if (aFoods.Image1.Length <= 0)
                        {
                            Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                    }
                    else
                    {
                        Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }

                    aListFoods.Add(aFoods);
                }

                dgvFoods.DataSource = aListFoods;
                dgvFoods.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_SearchFood.LoadDataListFoods\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        // Author : Linhting
        public void LoadData()
        {
            lblCompany.Text = this.aNewPaymentEN.NameCompany;
            lblNameCustomerGroup.Text = this.aNewPaymentEN.NameCustomerGroup;
            lblNameCustomer.Text = this.aNewPaymentEN.NameCustomer;
            txtAddressH.Text = this.aNewPaymentEN.AddressCompany;
            txtTaxNumberCodeH.Text = this.aNewPaymentEN.TaxNumberCodeCompany;
            // Trang thai, hinh thuc thanh toan
            lblTotalMoneyBookingHs.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls());
            txtBookingMoney.EditValue = this.aNewPaymentEN.BookingHMoney;
            lblTotalMoney.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls() - this.aNewPaymentEN.BookingHMoney);
            // Thong tin gia tiền, đặt trước
            luePayMethod.Properties.DataSource = CORE.CONSTANTS.ListPayMethods;
            luePayMethod.Properties.DisplayMember = "Name";
            luePayMethod.Properties.ValueMember = "ID";
            luePayMethod.EditValue = CORE.CONSTANTS.SelectedPayMethod(Convert.ToInt32(this.aNewPaymentEN.PayMenthodH)).ID;
            // Danh sách các hội trường
            dgvHalls.DataSource = this.aNewPaymentEN.aListBookingHallUsed;
            dgvHalls.RefreshDataSource();

            if (this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList().Count > 0)
            {
                BookingHallUsedEN aBookingHallUsedEN = this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList()[0];
                lblSkuHall.Text = Convert.ToString(aBookingHallUsedEN.HallSku);
                decimal? cost = 0;
                if (aBookingHallUsedEN.Cost == null || aBookingHallUsedEN.Cost == 0)
                {
                    cost = aBookingHallUsedEN.CostRef_Halls;
                }
                else
                {
                    cost = aBookingHallUsedEN.Cost;
                }

                lblDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.Date);
                lblLunarDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.LunarDate);
                lblStartTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.StartTime);
                lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.EndTime);

                lueMenus.Properties.DataSource = aBookingHallUsedEN.aListMenuEN;
                lueMenus.Properties.DisplayMember = "Name";
                lueMenus.Properties.ValueMember = "ID";
                if (aBookingHallUsedEN.aListMenuEN.Count > 0)
                {
                    lueMenus.EditValue = aBookingHallUsedEN.aListMenuEN[0].ID;
                    MenusEN aMenusEN = aBookingHallUsedEN.aListMenuEN[0];

                    List<Foods> aListFoods = new List<Foods>();
                    FoodsBO aFoodsBO = new FoodsBO();
                    foreach (Foods item in aMenusEN.aListFoods)
                    {
                        Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                        if (aFoods.Image1 != null)
                        {
                            if (aFoods.Image1.Length <= 0)
                            {
                                Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                                image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                                Byte[] aImageByte = this.ConvertImageToByteArray(image);
                                aFoods.Image1 = aImageByte;
                            }
                        }
                        else
                        {
                            Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                        aListFoods.Add(aFoods);

                    }

                    dgvFoods.DataSource = aListFoods;
                    dgvFoods.RefreshDataSource();
                }
                txtPercentTax_Hall.EditValue = aBookingHallUsedEN.PercentTax;

                lblMoneyHall.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyAHall(aBookingHallUsedEN.ID));

                decimal? BookingHallsCost = aBookingHallUsedEN.Cost == null ? aBookingHallUsedEN.CostRef_Halls : aBookingHallUsedEN.Cost;

                txtBookingHallsCost.EditValue = BookingHallsCost;
                dgvServices.DataSource = this.aNewPaymentEN.GetListServiceUsedInHall(aBookingHallUsedEN.ID);
                dgvServices.RefreshDataSource();
                lblTotalMoneyService.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyListServiceUsedInAHall(aBookingHallUsedEN.ID));

            }
        }
        //hiennv
        private void btnEditBookingHall_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                lblSku.Visible = true;
                lblDate.Visible = true;
                lblLunarDate.Visible = true;
                lblStartTime.Visible = true;
                lblEndTime.Visible = true;
                txtBookingHallsCost.Visible = true;
                txtPercentTax_Hall.Visible = true;
                lblMoneyHall.Visible = true;
                lblNameMenu.Visible = true;

                IDBookingHall = Convert.ToInt32(viewHalls.GetFocusedRowCellValue("IDBookingHall"));
                BookingHalls aBookingHalls = aPaymentHallsEN.GetDetailBookingHall_ByID(IDBookingHall);
                HallsBO aHallsBO = new HallsBO();
                Halls aHalls = aHallsBO.Select_ByCodeHall(aBookingHalls.CodeHall, 1);
                lblSku.Text = aHalls.Sku;
                decimal? cost = 0;
                if (aBookingHalls.Cost == null || aBookingHalls.Cost == 0)
                {
                    cost = aBookingHalls.CostRef_Halls;
                }
                else
                {
                    cost = aBookingHalls.Cost;
                }

                lblDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHalls.Date);
                lblLunarDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHalls.LunarDate);
                lblStartTime.Text = String.Format(@"{0:hh\:mm}", aBookingHalls.StartTime);
                lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHalls.EndTime);

                MenusEN aMenusEN = aPaymentHallsEN.GetDetailMenus(IDBookingHall);
                lblNameMenu.Text = aMenusEN.Name;

                List<Foods> aListFoods = new List<Foods>();
                FoodsBO aFoodsBO = new FoodsBO();
                foreach (Foods item in aMenusEN.aListFoods)
                {
                    Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                    if (aFoods.Image1 != null)
                    {
                        if (aFoods.Image1.Length <= 0)
                        {
                            Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                    }
                    else
                    {
                        Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                    aListFoods.Add(aFoods);

                }

                dgvFoods.DataSource = aListFoods;
                dgvFoods.RefreshDataSource();

                txtPercentTax_Hall.EditValue =aBookingHalls.PercentTax;

                lblMoneyHall.Text = String.Format("{0:0,0} (VND)", aPaymentHallsEN.GetMoneyHall(IDBookingHall));

                decimal? BookingHallsCost = aBookingHalls.Cost == null ? aBookingHalls.CostRef_Halls : aBookingHalls.Cost;

                txtBookingHallsCost.EditValue =BookingHallsCost;

                this.LoadDataService(this.IDBookingHall);

                lblTotalMoneyService.Text = String.Format("{0:0,0} (VND)", aPaymentHallsEN.GetTotalMoneyServiceHallBehindTax_ByIDBookingHall(IDBookingHall));

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_PaymentHall.btnEditBookingHall_ButtonClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void lueMenus_EditValueChanged(object sender, EventArgs e)
        {
            BookingHallUsedEN aBookingHallUsedEN = this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList()[0];
            MenusEN aMenusEN = aBookingHallUsedEN.aListMenuEN.Where(a => a.ID == Convert.ToInt32(lueMenus.EditValue)).ToList()[0];
            List<Foods> aListFoods = new List<Foods>();
            FoodsBO aFoodsBO = new FoodsBO();
            foreach (Foods item in aMenusEN.aListFoods)
            {
                Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                if (aFoods.Image1 != null)
                {
                    if (aFoods.Image1.Length <= 0)
                    {
                        Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                }
                else
                {
                    Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                    image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                    Byte[] aImageByte = this.ConvertImageToByteArray(image);
                    aFoods.Image1 = aImageByte;
                }
                aListFoods.Add(aFoods);

            }

            dgvFoods.DataSource = aListFoods;
            dgvFoods.RefreshDataSource();
        }
 //hiennv
 public void LoadDataListSelectFoods(int ID)
 {
     try
     {
         FoodsBO aFoodsBO = new FoodsBO();
         ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
         List<Foods> aListTemp = aReceptionTaskBO.GetListFoods_ByIDMenu(ID);
         foreach (Foods item in aListTemp)
         {
             Foods aFoods = aFoodsBO.Select_ByID(item.ID);
             if (aFoods.Image1 != null)
             {
                 if (aFoods.Image1.Length > 0)
                 {
                     Image image = this.ConvertByteArrayToImage(aFoods.Image1);
                     image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                     Byte[] aImageByte = this.ConvertImageToByteArray(image);
                     aFoods.Image1 = aImageByte;
                 }
                 else
                 {
                     Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                     image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                     Byte[] aImageByte = this.ConvertImageToByteArray(image);
                     aFoods.Image1 = aImageByte;
                 }
             }
             else
             {
                 Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                 image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                 Byte[] aImageByte = this.ConvertImageToByteArray(image);
                 aFoods.Image1 = aImageByte;
             }
             this.aMenusEN.aListFoods.Add(aFoods);
         }
         dgvSelectFoods.DataSource = this.aMenusEN.aListFoods;
         dgvSelectFoods.RefreshDataSource();
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmUpd_Menus.LoadDataListSelectFoods\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void frmLst_DetailMenus_Load(object sender, EventArgs e)
        {
            try
            {

                MenusBO aMenusBO = new MenusBO();
                Menus aMenus = aMenusBO.Select_ByID(this.IDMenu);
                lblNameMenu.Text = aMenus.Name;

                ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                FoodsBO aFoodsBO = new FoodsBO();
                List<Foods> aListTemp = aReceptionTaskBO.GetListFoods_ByIDMenu(this.IDMenu);
                List<Foods> aListFoods = new List<Foods>();

                foreach (Foods item in aListTemp)
                {
                    Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                    if (aFoods.Image1 != null)
                    {
                        if (aFoods.Image1.Length <= 0)
                        {
                           Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                    }
                    else
                    {
                        Image image = SaleManagement.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }
                    aListFoods.Add(aFoods);

                }
                dgvFoods.DataSource = aListFoods;
                dgvFoods.RefreshDataSource();

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_DetailMenus.frmLst_DetailMenus_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        // Load du lieu len control
        private void LoadData()
        {
            //-------------- Phòng ---------------------
            //Thong tin nguoi dat
            lblCompany.Text = this.aNewPaymentEN.NameCompany;
            lblNameCustomerGroup.Text = this.aNewPaymentEN.NameCustomerGroup;
            lblNameCustomer.Text = this.aNewPaymentEN.NameCustomer;
            txtAddressR.Text = this.aNewPaymentEN.AddressCompany;
            txtTaxNumberCodeR.Text = this.aNewPaymentEN.TaxNumberCodeCompany;

            // Thông tin hóa đơn
            txtInvoiceNumber.Text = this.aNewPaymentEN.InvoiceNumber;
            dtpAcceptDate.DateTime = this.aNewPaymentEN.AcceptDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900"));
            dtpInvoiceDate.DateTime = this.aNewPaymentEN.InvoiceDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900"));
            // Trang thai, hinh thuc thanh toan
            lueBookingR_Paymethod.Properties.DataSource = CORE.CONSTANTS.ListPayMethods;
            lueBookingR_Paymethod.Properties.DisplayMember = "Name";
            lueBookingR_Paymethod.Properties.ValueMember = "ID";
            lueBookingR_Paymethod.EditValue = CORE.CONSTANTS.SelectedPayMethod(Convert.ToInt32(this.aNewPaymentEN.PayMenthodR)).ID;
            //--------------------------------------------------------------
            // Thong tin gia tiền, đặt trước
            lblTotalMoneyRooms1.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyRooms());
            txtBookingRMoney.EditValue = this.aNewPaymentEN.BookingRMoney;
            lblTotalMoneyR.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyRooms() - this.aNewPaymentEN.BookingRMoney);
            // Bang danh sach phong
            dgvRooms.DataSource = this.aNewPaymentEN.aListBookingRoomUsed;
            dgvRooms.RefreshDataSource();

            //--------- Hội trường ----------------
            if (this.IDBookingH > 0)
            {
                btnBookHall.Visible = false;
                //Thong tin nguoi dat
                lblNameCompany_BookingH.Text = this.aNewPaymentEN.NameCompany;
                lblNameCustomerGroup_BookingH.Text = this.aNewPaymentEN.NameCustomerGroup;
                lblNameCustomer_BookingH.Text = this.aNewPaymentEN.NameCustomer;
                txtAddressH.Text = this.aNewPaymentEN.AddressCompany;
                txtTaxNumberCodeH.Text = this.aNewPaymentEN.TaxNumberCodeCompany;
                // Trang thai, hinh thuc thanh toan
                lblTotalMoneyBookingHs.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls());
                txtBookingHMoney.EditValue = this.aNewPaymentEN.BookingHMoney;
                lblTotalMoneyH.Text = String.Format("{0:0,0}", this.aNewPaymentEN.GetMoneyHalls() - this.aNewPaymentEN.BookingHMoney);
                // Thong tin gia tiền, đặt trước
                lueBookingH_PayMethod.Properties.DataSource = CORE.CONSTANTS.ListPayMethods;
                lueBookingH_PayMethod.Properties.DisplayMember = "Name";
                lueBookingH_PayMethod.Properties.ValueMember = "ID";
                lueBookingH_PayMethod.EditValue = CORE.CONSTANTS.SelectedPayMethod(Convert.ToInt32(this.aNewPaymentEN.PayMenthodH)).ID;
                // Danh sách các hội trường
                dgvHalls.DataSource = this.aNewPaymentEN.aListBookingHallUsed;
                dgvHalls.RefreshDataSource();
                // Thông tin 1 hội trường

                if (this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList().Count > 0)
                {
                    BookingHallUsedEN aBookingHallUsedEN = this.aNewPaymentEN.aListBookingHallUsed.Where(a => a.ID == this.CurrentIDBookingHall).ToList()[0];
                    lblSkuHalls.Text = Convert.ToString(aBookingHallUsedEN.HallSku);
                    decimal? cost = 0;
                    if (aBookingHallUsedEN.Cost == null || aBookingHallUsedEN.Cost == 0)
                    {
                        cost = aBookingHallUsedEN.CostRef_Halls;
                    }
                    else
                    {
                        cost = aBookingHallUsedEN.Cost;
                    }

                    lblDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.Date);
                    lblLunarDate.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallUsedEN.LunarDate);
                    lblStartTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.StartTime);
                    lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallUsedEN.EndTime);

                    lueMenus.Properties.DataSource = aBookingHallUsedEN.aListMenuEN;
                    lueMenus.Properties.DisplayMember = "Name";
                    lueMenus.Properties.ValueMember = "ID";

                    if (aBookingHallUsedEN.aListMenuEN.Count > 0)
                    {
                        lueMenus.EditValue = aBookingHallUsedEN.aListMenuEN[0].ID;
                        MenusEN aMenusEN = aBookingHallUsedEN.aListMenuEN[0];

                        List<Foods> aListFoods = new List<Foods>();
                        FoodsBO aFoodsBO = new FoodsBO();
                        foreach (Foods item in aMenusEN.aListFoods)
                        {
                            Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                            if (aFoods.Image1 != null)
                            {
                                if (aFoods.Image1.Length <= 0)
                                {
                                    Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                                    image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                                    Byte[] aImageByte = this.ConvertImageToByteArray(image);
                                    aFoods.Image1 = aImageByte;
                                }
                            }
                            else
                            {
                                Image image = RoomManager.Properties.Resources.logo_nkcp_small;
                                image = image.GetThumbnailImage(70, 70, null, IntPtr.Zero);
                                Byte[] aImageByte = this.ConvertImageToByteArray(image);
                                aFoods.Image1 = aImageByte;
                            }
                            aListFoods.Add(aFoods);

                        }

                        dgvFoods.DataSource = aListFoods;
                        dgvFoods.RefreshDataSource();
                    }
                    else
                    {
                        List<Foods> aListFoods = new List<Foods>();
                        dgvFoods.DataSource = aListFoods;
                        dgvFoods.RefreshDataSource();
                    }
                    txtPercentTax_Hall.EditValue = aBookingHallUsedEN.PercentTax;

                    lblMoneyHall.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyAHall(aBookingHallUsedEN.ID));

                    decimal? BookingHallsCost = aBookingHallUsedEN.Cost == null ? aBookingHallUsedEN.CostRef_Halls : aBookingHallUsedEN.Cost;

                    txtBookingHallsCost.EditValue = BookingHallsCost;
                    dgvBookingHallUseServices.DataSource = this.aNewPaymentEN.GetListServiceUsedInHall(aBookingHallUsedEN.ID);
                    dgvBookingHallUseServices.RefreshDataSource();
                    lblTotalMoneyServices_BookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyListServiceUsedInAHall(aBookingHallUsedEN.ID));
                }
            }
            else
            {
                btnBookHall.Visible = true;
                btnPaymentHall.Enabled = false;
                btnPrintBookingH.Enabled = false;
                txtTaxNumberCodeH.Enabled = false;
                txtAddressH.Enabled = false;
            }
            // Thông tin tổng tiền
            lblTotalBookingRAndBookingHBeforeTax.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoneyBeforeTax());
            lblTotalBookingRAndBookingHAfterTax.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney());
            if (this.aNewPaymentEN.BookingHMoney != null)
            {
                lblBookingMoney_BookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.BookingHMoney + this.aNewPaymentEN.BookingRMoney);
                lblTotalBookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney() - (this.aNewPaymentEN.BookingHMoney + this.aNewPaymentEN.BookingRMoney));
            }
            else
            {
                lblBookingMoney_BookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.BookingRMoney);
                lblTotalBookingRAndBookingH.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetTotalMoney() - this.aNewPaymentEN.BookingRMoney);
            }
        }
        //hiennv
        public frmRpt_DetailBookingHalls(int IDBookingHall)
        {
            InitializeComponent();
            this.IDBookingHall = IDBookingHall;
            try
            {
                ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                BookingHallDetailEN aBookingHallDetailEN = aReceptionTaskBO.GetDetailBookingHalls_ByIDBookingHall(this.IDBookingHall);
                celNameCustomer.Text = aBookingHallDetailEN.NameCustomer;
                celNameCustomerGoup.Text = aBookingHallDetailEN.NameCustomerGroup;
                celSkuHall.Text = aBookingHallDetailEN.HallSku;
                celLunarDateBookingHall.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallDetailEN.LunarDate);
                celDateBookingHall.Text = String.Format("{0:dd/MM/yyyy}", aBookingHallDetailEN.Date);

                lblStartTime.Text = String.Format(@"{0:hh\:mm}",aBookingHallDetailEN.StartTime);
                lblEndTime.Text = String.Format(@"{0:hh\:mm}", aBookingHallDetailEN.EndTime);

                lblNameMenu.Text = aBookingHallDetailEN.NameMenu;

                celCustomerTypeBookingH.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingHallDetailEN.CustomerType)).Name;
                celLevelBookingH.Text = CORE.CONSTANTS.SelectedLevel(Convert.ToInt32(aBookingHallDetailEN.LevelBookingH)).Name;
                celBookingTypeBookingH.Text = CORE.CONSTANTS.SelectedBookingType(Convert.ToInt32(aBookingHallDetailEN.BookingTypeBookingH)).Name;
                celStatusBookingHall.Text = CORE.CONSTANTS.SelectedBookingHallStatus(Convert.ToInt32(aBookingHallDetailEN.Status)).Name;
                celStatusPayBookingH.Text = CORE.CONSTANTS.SelectedStatusPay(Convert.ToInt32(aBookingHallDetailEN.StatusPayBookingH)).Name;

                FoodsBO aFoodsBO = new FoodsBO();
                List<Foods> aListFoods = new List<Foods>();
                foreach (Foods item in aBookingHallDetailEN.aListFoods)
                {
                    Foods aFoods = aFoodsBO.Select_ByID(item.ID);
                    if (aFoods.Image1 != null)
                    {
                        if (aFoods.Image1.Length <= 0)
                        {
                           Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                            image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                            Byte[] aImageByte = this.ConvertImageToByteArray(image);
                            aFoods.Image1 = aImageByte;
                        }
                    }
                    else
                    {
                        Image image = SaleManager.Properties.Resources.logo_nkcp_small;
                        image = image.GetThumbnailImage(70,70, null, IntPtr.Zero);
                        Byte[] aImageByte = this.ConvertImageToByteArray(image);
                        aFoods.Image1 = aImageByte;
                    }

                    aListFoods.Add(aFoods);
                }

                //danh sach cac mon an co trong thuc don
                this.DetailReportMenu.DataSource =aListFoods;
                picImage1Food.DataBindings.Add("Image", this.DetailReportMenu.DataSource, "Image1");
                colNameFood.DataBindings.Add("Text", this.DetailReportMenu.DataSource, "Name");
                colName1Food.DataBindings.Add("Text", this.DetailReportMenu.DataSource, "Name1");
                colName2Food.DataBindings.Add("Text", this.DetailReportMenu.DataSource, "Name2");
                colName3Food.DataBindings.Add("Text", this.DetailReportMenu.DataSource, "Name3");

                //danh dach cac dich vu su dung
                this.DetailReportServiceInUse.DataSource = aBookingHallDetailEN.aListServicesHallsEN;
                colNameServices.DataBindings.Add("Text", this.DetailReportServiceInUse.DataSource,"NameService");
                colDate.DataBindings.Add("Text", this.DetailReportServiceInUse.DataSource, "Date","{0:dd/MM/yyyy}");
                colCostRef_Services.DataBindings.Add("Text", this.DetailReportServiceInUse.DataSource, "CostRef_Services","{0:0,0}");
                colPercentTax.DataBindings.Add("Text", this.DetailReportServiceInUse.DataSource, "PercentTax");
                colQuantity.DataBindings.Add("Text", this.DetailReportServiceInUse.DataSource, "Quantity","{0:0,0}");

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmRpt_DetailBookingHalls.frmRpt_DetailBookingHalls\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 //=======================================================
 //Author: Hiennv
 //Function : SelectListFoods_ByListIDFood()
 //=======================================================
 public List<Foods> SelectListFoods_ByListIDFood(List<int> aListIDFood)
 {
     FoodsBO aFoodsBO = new FoodsBO();
     List<Foods> aListFoods = new List<Foods>();
     for (int i = 0; i < aListIDFood.Count; i++)
     {
         aListFoods.Add(aFoodsBO.Select_ByID(aListIDFood[i]));
     }
     return aListFoods;
 }
        //=======================================================
        //Author: Hiennv
        //Function : SelectListFoods_ByIDMenu()
        //=======================================================
        public List<Foods> SelectListFoods_ByIDMenu(int IDMenu)
        {
            try
            {
                Menus_FoodsBO aMenus_FoodsBO = new Menus_FoodsBO();
                List<Menus_Foods> aList = aDatabaseDA.Menus_Foods.Where(a => a.IDMenu == IDMenu).ToList();
                List<Foods> aListFoods = new List<Foods>();
                Foods aFoods;
                FoodsBO aFoodsBO = new FoodsBO();
                for (int i = 0; i < aList.Count; i++)
                {
                    aFoods = new Foods();
                    aFoods = aFoodsBO.Select_ByID(aList[i].IDFood);
                    aListFoods.Add(aFoods);
                }
                return aListFoods;
            }
            catch (Exception ex)
            {

                throw new Exception("Menus_FoodsBO.SelectListFoods_ByIDMenu\n" + ex.ToString());
            }
        }