private void btnAnDanhMuc_Click(object sender, EventArgs e) { if (flag) { wPanel3 = splitContainerControl2.Panel2.Width; } SplitPanelVisibility pv = hideTreeview == false ? SplitPanelVisibility.Both : SplitPanelVisibility.Panel1; splitContainerControl2.PanelVisibility = pv; hideTreeview = !hideTreeview; splitContainerControl1.SplitterPosition = (flag) ? splitContainerControl1.SplitterPosition + wPanel3 : splitContainerControl1.SplitterPosition - wPanel3; flag = !flag; }
private void splitContainerControl4_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { if (e.Button.Properties.Caption == "Hide") { if (flag) { wPanel3 = splitContainerControl2.Panel2.Width; } SplitPanelVisibility pv = hideTreeview == false ? SplitPanelVisibility.Both : SplitPanelVisibility.Panel1; splitContainerControl2.PanelVisibility = pv; hideTreeview = !hideTreeview; splitContainerControl1.SplitterPosition = (flag) ? splitContainerControl1.SplitterPosition + wPanel3 : splitContainerControl1.SplitterPosition - wPanel3; flag = !flag; } else if (e.Button.Properties.Caption == "Hủy bàn") { var tenban = Data.GetData($@"select tenban from view_hoadon where mahoadon='{lblMaHD.Text}'"); var dgr = XtraMessageBox.Show($@"Bạn có muốn hủy bàn {tenban} này không?", "Xác Nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dgr == DialogResult.Yes) { Data.RunCMD($@"update tbl_hoadon set huyhoadon=1 where mahoadon='{lblMaHD.Text}'"); LoadHoaDon(); } } else if (e.Button.Properties.Caption == "Excel") { xtraSaveFileDialog1.Filter = "Excel files |*.xlsx"; xtraSaveFileDialog1.FileName = "DanhMucBanHang_Ban_" + DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss"); if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK) { string strLenh = $@"SELECT mahoadon as [Mã hóa đơn], ngayban as [Ngày bán], tenban as [Tên bàn], strftime('%H:%M', giobd) as [Bắt đầu], strftime('%H:%M', giokt) as [Kết thúc], mahang as [Mã hàng], nhomhang as [Nhóm hàng], tenhang as [Tên hàng], tendvt as [ĐVT], soluong as [Số lượng], dongia as [Đơn giá], thanhtien as [Thành tiền], tienchieckhau as [Chiếc khấu], phidichvu as [Phí dịch vụ], tongthanhtien as [Tổng thành tiền] from view_chitiet_hoadon where ngayban>='{Convert.ToDateTime(dateTuNgay.EditValue).ToString("yyyy-MM-dd")}' and ngayban<='{Convert.ToDateTime(dateDenNgay.EditValue).ToString("yyyy-MM-dd")}' and maban='{strMaBan}'"; var arr = mdl_ExportExcel.LoadSQL2ListArr(strLenh); mdl_ExportExcel.ExportListArr2Excel(arr, xtraSaveFileDialog1.FileName); } } }
/// <summary>Cập nhật hiển thị menu và phần detail /// </summary> public void _setEnableMenu(bool _status, SplitPanelVisibility _type) { PhieuQuanLyUtil.ShowMenu( that.barSubItem1, _status, that.gridControlMaster, that.splitContainerControl1, _type); #region Hàm cũ - Xóa //that.barSubItem1.Enabled = _status;//ẩn đi menu trên menu chính //if (that.gridControlMaster.ContextMenuStrip != null) //{ // foreach (ToolStripItem var in that.gridControlMaster.ContextMenuStrip.Items)//ẩn đi menu trên grid // { // var.Enabled = _status; // } //} //that.splitContainerControl1.PanelVisibility = _type; #endregion }
public static void ShowMenu( DevExpress.XtraBars.BarSubItem barSubItem1, bool _status, GridControl gridControlMaster, SplitContainerControl splitContainerControl1, SplitPanelVisibility _type) { barSubItem1.Enabled = _status; if (gridControlMaster.ContextMenuStrip != null) { foreach (ToolStripItem var in gridControlMaster.ContextMenuStrip.Items) { var.Enabled = _status; } } splitContainerControl1.PanelVisibility = _type; }