//Lay danh sach khach hang thuoc 1 phong nao do public List<Customers> SelectListCustomerInRoom(int IDBookingRoom) { CustomersBO aCustomersBO = new CustomersBO(); return aCustomersBO.SelectListCustomer_ByIDBookingRoom(IDBookingRoom); }
private void LoadServicesInRoom() { try { ServicesBO aServicesBO = new ServicesBO(); BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO(); List<BookingRooms_Services> aListTemp = aBookingRooms_ServicesBO.Select_ByIDBookingRooms(this.IDBookingRoom); BookingRoom_ServiceEN aBookingRoom_ServiceEN; for (int i = 0; i < aListTemp.Count; i++) { aBookingRoom_ServiceEN = new BookingRoom_ServiceEN(); aBookingRoom_ServiceEN.ID = aListTemp[i].ID; aBookingRoom_ServiceEN.Info = aListTemp[i].Info; aBookingRoom_ServiceEN.Type = aListTemp[i].Type; aBookingRoom_ServiceEN.Status = aListTemp[i].Status; aBookingRoom_ServiceEN.Disable = aListTemp[i].Disable; aBookingRoom_ServiceEN.IDBookingRoom = aListTemp[i].IDBookingRoom; aBookingRoom_ServiceEN.IDService = aListTemp[i].IDService; aBookingRoom_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name; aBookingRoom_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit; aBookingRoom_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost; aBookingRoom_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services; aBookingRoom_ServiceEN.Date = aListTemp[i].Date; aBookingRoom_ServiceEN.PercentTax = aListTemp[i].PercentTax; aBookingRoom_ServiceEN.Quantity = aListTemp[i].Quantity; aBookingRoom_ServiceEN.Tag = aListTemp[i].Tag; aListSelected.Add(aBookingRoom_ServiceEN); } dgvServiceInRoom.DataSource = aListSelected; dgvServiceInRoom.RefreshDataSource(); CustomersBO aCustomersBO = new CustomersBO(); lueUserInRoom.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRoom); } catch (Exception ex) { MessageBox.Show("frmIns_BookingRooms_Services.grvRooms_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Load lai du lieu cho cac control moi khi select vao 1 phong moi // Ngoc - done private void LoadDataCurrentRoomForControl() { if (this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList().Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN = this.aNewPaymentEN.aListBookingRoomUsed.Where(a => a.ID == this.CurrentIDBookingRoom).ToList()[0]; /*Ghi chu TypeBookingRooms * Type = 2: //Tính checkin sớm , không tính checkout muộn. * Type = 0: //Không tính checkIn sớm và checkout muộn. * Type = 3: //Tính checkin sớm và Checkout muộn * Type = 1: //Không tính checkin sớm , tính checkout muộn */ ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); if (aBookingRoomUsedEN.Status == 1 || aBookingRoomUsedEN.Status == 2) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInPlan; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = ""; // Phong chua su dung txtAddTimeEnd.Text = ""; txtAddTimeStart.Text = ""; lblCI.Text = "CI dự kiến"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang ở trạng thái đặt").ToUpper(); } else if (aBookingRoomUsedEN.Status == 3) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang có người ở").ToUpper(); } else if (aBookingRoomUsedEN.Status == 5) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutPlan; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutPlan).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO dự kiến"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đang khóa").ToUpper(); } else if (aBookingRoomUsedEN.Status == 7) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutActual; txtNumberDate.Text = aReceptionTaskBO.GetTimeInUsed(aBookingRoomUsedEN.CheckInActual, aBookingRoomUsedEN.CheckOutActual).ToString(); txtAddTimeEnd.Text = aReceptionTaskBO.GetAddTimeEnd(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckOutActual).ToString(); txtAddTimeStart.Text = aReceptionTaskBO.GetAddTimeStart(aBookingRoomUsedEN.Type.GetValueOrDefault(0), aBookingRoomUsedEN.CheckInActual).ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO thực tế"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đã checkout nhưng chưa thanh toán").ToUpper(); } else if (aBookingRoomUsedEN.Status == 8) { dtpCheckInActual.DateTime = aBookingRoomUsedEN.CheckInActual; dtpCheckOutActual.DateTime = aBookingRoomUsedEN.CheckOutActual; // Neu phong da dc thanh toan tuc la thong tin phong da chot. Vay lay thong tin nay de hien thi txtNumberDate.Text = (aBookingRoomUsedEN.TimeInUse.GetValueOrDefault(0)/(24*60)).ToString(); txtAddTimeEnd.Text = aBookingRoomUsedEN.AddTimeEnd.ToString(); txtAddTimeStart.Text = aBookingRoomUsedEN.AddTimeStart.ToString(); lblCI.Text = "CI thực tế"; lblCO.Text = "CO thực tế"; lblCaptionStatusRoom.Text = ("Phòng " + aBookingRoomUsedEN.RoomSku + " đã thanh toán").ToUpper(); } lblSkuRooms.Text = aBookingRoomUsedEN.RoomSku; txtPercentTax_Room.Text = Convert.ToString(aBookingRoomUsedEN.PercentTax); lblMoneyRoom.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetOnlyMoneyRoom(aBookingRoomUsedEN.ID)); if (string.IsNullOrEmpty(aBookingRoomUsedEN.Cost.ToString()) == false) { txtBookingRoomsCost.EditValue = aBookingRoomUsedEN.Cost; } else { txtBookingRoomsCost.EditValue = aAccountancyBO.CalculateCostRoom(this.CurrentIDBookingRoom, aBookingRoomUsedEN.PriceType, this.aNewPaymentEN.CustomerType.GetValueOrDefault(0), this.aNewPaymentEN.GetNumberCustomerInRoom(this.CurrentIDBookingRoom)); } // Danh sách khách dgvCustomers.DataSource = aBookingRoomUsedEN.ListCustomer; dgvCustomers.RefreshDataSource(); // Danh sách dịch vụ dgvServicesR.DataSource = aNewPaymentEN.GetListServiceUsedInRoom(aBookingRoomUsedEN.ID); dgvServicesR.RefreshDataSource(); //-----------Ngoc bổ sung -------------- CustomersBO aCustomersBO = new CustomersBO(); lueUserInBookingR.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.CurrentIDBookingRoom); //-----------Ngoc bổ sung -------------- lblTotalMoneyServiceR.Text = String.Format("{0:0,0} (VND)", this.aNewPaymentEN.GetMoneyListServiceUsedInARoom(aBookingRoomUsedEN.ID)); } //========================================= //========================================= //========================================= // Load lai control khac //-------------- Phòng --------------------- //Thong tin nguoi dat lblNameCompany_BookingR.Text = this.aNewPaymentEN.NameCompany; lblNameCustomerGroup_BookingR.Text = this.aNewPaymentEN.NameCustomerGroup; lblNameCustomer_BookingR.Text = this.aNewPaymentEN.NameCustomer; txtAddressR.Text = this.aNewPaymentEN.AddressCompany; txtTaxNumberCodeR.Text = this.aNewPaymentEN.TaxNumberCodeCompany; // Thông tin hóa đơn txtInvoiceNumberR.Text = this.aNewPaymentEN.InvoiceNumber; dtpAcceptDateR.DateTime = this.aNewPaymentEN.AcceptDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900")); dtpInvoiceDateR.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 lblTotalMoneyRooms.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(); }
// =============================================================================== // Khoi tao doi tuong Payment private void InitData(int IDBookingR, int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = new BookingHs(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); if (this.IDBookingH > 0) { aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } else { BookingRs_BookingHs aItem = (new BookingRs_BookingHsBO()).Select_ByIDBookingR(this.IDBookingR); if (aItem != null) { this.IDBookingH = aItem.IDBookingH.GetValueOrDefault(0); aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } } // Truyen du lieu chung cua NewPayment if (aBookingRs != null) { aNewPaymentEN.IDBookingR = aBookingRs.ID; aNewPaymentEN.IDCustomer = aBookingRs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingRs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingRs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingRs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.PayMenthodR = aBookingRs.PayMenthod; aNewPaymentEN.CreatedDate_BookingR = aBookingRs.CreatedDate; aNewPaymentEN.CustomerType = aBookingRs.CustomerType; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.StatusPay = aBookingRs.StatusPay; aNewPaymentEN.BookingRMoney = aBookingRs.BookingMoney; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.AcceptDate = aBookingRs.AcceptDate; aNewPaymentEN.InvoiceDate = aBookingRs.InvoiceDate; aNewPaymentEN.InvoiceNumber = aBookingRs.InvoiceNumber; // Truyen du lieu cho List BookingRoom cua NewPayment List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(this.IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (item.Status == 8 || item.Status == 7) { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutActual)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutActual) * 24 * 60); } else { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutPlan)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutPlan) * 24 * 60); } decimal? cost = 0; if (item.Cost == null) { cost = item.CostRef_Rooms; aBookingRoomUsedEN.Cost = cost + Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aRooms.Sku, aBookingRoomUsedEN.PriceType, aBookingRoomUsedEN.ListCustomer.Count).ExtraValue); } else { cost = item.Cost; aBookingRoomUsedEN.Cost = cost; } List<ServiceUsedEN> aListServiceRTemp = aReceptionTaskBO.GetListServiceUsedInRoom_ByIDBookingRoom(item.ID); foreach (ServiceUsedEN aTemp in aListServiceRTemp) { aBookingRoomUsedEN.ListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aListIndexTemp.Add(Convert.ToInt32(aBookingRoomUsedEN.IndexSubPayment)); aNewPaymentEN.aListBookingRoomUsed.Add(aBookingRoomUsedEN); } } //==================================================================================================== //==================================================================================================== //==================================================================================================== // Brucelee Thanh sửa ngày 04/06/2015 // //--------------- // Lỗi sai điều kiện câu lệnh if khiến aBookingHs truyền dữ liệu CustomerType sai cho NewPaymentEN //--------------- // Ban đầu : if (aBookingHs != null) //------------------------------------- if (aBookingHs.ID > 0) { aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment)); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentEN.ListIndex = aListIndexTemp.Distinct().ToList(); } }
public frmRpt_PersonalPayment(List<RptPaymentStyle1_ForPrint> aListData, string CompanyName, string Address, string NameCustomerGroup, string InvoiceNumber , DateTime FirstDate, DateTime LastDate, decimal? BookingHMoney, decimal? BookingRMoney,int IDBookingR) { InitializeComponent(); //Load dữ liệu BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); RoomsBO aRoomsBO = new RoomsBO(); string RoomSku = ""; string CustomerNames = ""; List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (RoomSku == "") { RoomSku = aBookingRoomUsedEN.RoomSku; } else { RoomSku = RoomSku + " + " + aBookingRoomUsedEN.RoomSku; } foreach (Customers aItem in aBookingRoomUsedEN.ListCustomer) { if (CustomerNames == "") { CustomerNames = aItem.Name; } else { CustomerNames = CustomerNames + " + " + aItem.Name; } } } } decimal MealCharge = 0; decimal DrinkCharge = 0; decimal RoomCharge= 0; decimal RoomServiceCharge= 0; decimal Tel= 0; decimal Laundry = 0; decimal OtherServiceCharge = 0; decimal TotalServiceMoney = 0; decimal TotalMoneyBeforeTax = 0; foreach (RptPaymentStyle1_ForPrint aItem in aListData) { MealCharge = MealCharge + aItem.ServiceGroup8_Fee; DrinkCharge = DrinkCharge + aItem.ServiceGroup7_Fee; RoomCharge = RoomCharge + aItem.Room_Fee; RoomServiceCharge = RoomServiceCharge + aItem.ServiceGroup5_Fee; Tel = Tel + aItem.ServiceGroup2_Fee; Laundry = Laundry + aItem.ServiceGroup3_Fee; OtherServiceCharge = OtherServiceCharge + aItem.ServiceGroup4_Fee + aItem.ServiceGroup5_Fee + aItem.ServiceGroup9_Fee; TotalServiceMoney = TotalServiceMoney + aItem.TotalServiceMoney; TotalMoneyBeforeTax = TotalMoneyBeforeTax + aItem.TotalMoney; } //Hiển thị dữ liệu BookingRs aBookingRs = new BookingRs(); aBookingRs = (new BookingRsBO()).Select_ByID(IDBookingR); lblIDBookingR.Text = IDBookingR.ToString(); lblInvoiceNumber.Text = aBookingRs.InvoiceNumber; lblInvoiceDate.Text = aBookingRs.InvoiceDate.GetValueOrDefault().Date.ToShortDateString(); lbAcceptDate.Text = aBookingRs.AcceptDate.GetValueOrDefault().Date.ToShortDateString(); lblCheckIn.Text = FirstDate.ToString("dd/MM/yyyy"); lblCheckOut.Text = LastDate.ToString("dd/MM/yyyy"); lblCustomerName.Text = CustomerNames; lblRoomSku.Text = RoomSku; lblMealChargeVN.Text = MealCharge.ToString("0,0"); lblDrinkChargeVN.Text = DrinkCharge.ToString("0,0"); lblRoomChargeVN.Text = RoomCharge.ToString("0,0"); lblRoomServiceVN.Text = RoomServiceCharge.ToString("0,0"); lblTelVN.Text = Tel.ToString("0,0"); lblLaundryVN.Text = Laundry.ToString("0,0"); lblOtherServiceVN.Text = OtherServiceCharge.ToString("0,0"); lblServiceChargeVN.Text = TotalServiceMoney.ToString("0,0"); lblTotalBTVN.Text = TotalMoneyBeforeTax.ToString("0,0"); lblTaxVN.Text = (TotalMoneyBeforeTax * 10 / 100).ToString("0,0"); lblMoneyAfterTaxVN.Text = (TotalMoneyBeforeTax * 110 / 100).ToString("0,0"); lblBookingMoneyVN.Text = Convert.ToDecimal(BookingHMoney + BookingHMoney).ToString("0,0"); lblTotalMoneyVN.Text = ((TotalMoneyBeforeTax * 110 / 100) - Convert.ToDecimal(BookingHMoney + BookingHMoney)).ToString("0,0"); string TotalMoney_String = UppercaseFirst(StringUtility.ConvertDecimalToString((TotalMoneyBeforeTax * 110 / 100) - Convert.ToDecimal(BookingHMoney + BookingHMoney))); lblConvertToString.Text = TotalMoney_String; int day = DateTime.Now.Day; int month = DateTime.Now.Month; int year = DateTime.Now.Year; lblDayMonthYear.Text = "Hà nội , ngày " + day.ToString() + " tháng " + month.ToString() + " năm " + year.ToString(); }
public void LoadData() { try { CustomersBO aCustomersBO = new CustomersBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms aBookingRooms = new BookingRooms(); RoomsBO aRoomsBO = new RoomsBO(); // Load các thông tin chung về phòng aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRooms); if (aBookingRooms != null) { lblCheckIn.Text = aBookingRooms.CheckInActual.ToString("dd/MM/yyyy HH:mm"); lblCheckOut.Text = aBookingRooms.CheckOutPlan.ToString("dd/MM/yyyy HH:mm"); lblRoomSku.Text = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom, 1).Sku; } BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs = aBookingRsBO.Select_ByID(this.IDBookingRs); if (aBookingRs != null) { lblCustomerType.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingRs.CustomerType)).Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByIDBookingRoom(this.IDBookingRooms).Name; lblCustomer.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Name; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); lblGroup.Text = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup).Name; lblTel.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Tel; this.IDCustomerGroup = aBookingRs.IDCustomerGroup; } //Load danh sách phòng còn trống lueRooms.Properties.DataSource = this.LoadListAvailableRooms(aBookingRooms.CheckInActual, aBookingRooms.CheckOutPlan); lueRooms.Properties.ValueMember = "RoomCode"; lueRooms.EditValue = this.IDBookingRooms; //Load danh sách khách trong phòng this.aListCustomersInRoom = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRooms); dgvAvailableCustomers.DataSource = this.aListCustomersInRoom; dgvAvailableCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_EditBooking.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private List<CustomerInfoEN> GetDataForSelectCustomerGridview(string CodeRoom) { BookingRsBO aBookingRsBO = new BookingRsBO(); List<Rooms> aListRoom = aBookingRsBO.SelectListRooms_ByIDBookingR(this.aBookingRoom.IDBookingR, 1); bool IsRoomInBookingR = false; if (aListRoom.Where(p=>p.Code == CodeRoom).Where(p=>p.Status <7).ToList().Count == 1) { IsRoomInBookingR = true; } // Kiem tra xem phong co phai cung hoa don tong khong (cung BookingR) if (IsRoomInBookingR == true) { // Kiem tra xem da co thong tin cap nhat trong aChangeRoom chua, neu chua thi lay danh sachs khach trong database if (this.aChangeRoomEn.IsExitRoom(CodeRoom) == false) { BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); int CurrentIDBookingRooms = aBookingRoomsBO.Select_ByIDBookingRsAndCodeRoom(this.aBookingRoom.IDBookingR, CodeRoom).Max(p=>p.ID); CustomersBO aCustomersBO = new CustomersBO(); List<Customers> aList = aCustomersBO.SelectListCustomer_ByIDBookingRoom(CurrentIDBookingRooms); List<CustomerInfoEN> aListRet = new List<CustomerInfoEN>(); for (int i = 0; i < aList.Count; i++) { CustomerInfoEN aItem = new CustomerInfoEN(aList[i]); aListRet.Add(aItem); } return aListRet; } // nếu thông tin phong đã có trong khối aChangeRoom thì lấy danh sách người ở trong khối đó ra else { return this.aChangeRoomEn.GetItemChangeRooms(CodeRoom).GetAllCustomers(); } } else { if (this.aChangeRoomEn.IsExitRoom(CodeRoom) == false) { return new List<CustomerInfoEN>(); } // nếu thông tin phong đã có trong khối aChangeRoom thì lấy danh sách người ở trong khối đó ra else { return this.aChangeRoomEn.GetItemChangeRooms(CodeRoom).GetAllCustomers(); } } }