private void BindPayoffWay() { this.pnlPayoffWay.Controls.Clear(); //support six buttons int space = 5; int px = 0, py = 0; int width = (pnlPayoffWay.Width - 2 * space) / 3; int height = (pnlPayoffWay.Height - space) / 2; List<PayoffWay> payoffWayList = new List<PayoffWay>(); foreach (PayoffWay item in ConstantValuePool.PayoffWayList) { if (item.AsVIPCardPayWay) { payoffWayList.Add(item); } } int pageSize = 0; if (payoffWayList.Count > 6) { pageSize = 6; } else { pageSize = payoffWayList.Count; } for (int index = 0; index < pageSize; index++) { PayoffWay payoff = payoffWayList[index]; CrystalButton btn = new CrystalButton(); btn.Name = payoff.PayoffID.ToString(); btn.Text = payoff.PayoffName; btn.Width = width; btn.Height = height; btn.BackColor = btn.DisplayColor = Color.Blue; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Location = new Point(px, py); foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { float emSize = (float)btnStyle.FontSize; FontStyle style = FontStyle.Regular; btn.Font = new Font(btnStyle.FontName, emSize, style); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Tag = payoff; btn.Click += new System.EventHandler(this.btnPayoff_Click); pnlPayoffWay.Controls.Add(btn); px += width + space; if ((index + 1) % 3 == 0) { px = 0; py += height + space; } } }
private void FormChoseMultiOrder_Load(object sender, EventArgs e) { if (m_OrderList != null && m_OrderList.Count > 0) { InitialOrderButton(m_OrderList); } if (m_DeskChange != null) { pnlBottom.Controls.Clear(); int px = 0, py = 5; int space = 10; int width = (this.pnlBottom.Width - 2 * space) / 3; int height = 43; CrystalButton btnMoveBill = new CrystalButton(); btnMoveBill.BackColor = Color.Teal; btnMoveBill.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular); btnMoveBill.ForeColor = System.Drawing.Color.White; btnMoveBill.Location = new Point(px, py); btnMoveBill.Name = "btnMoveBill"; btnMoveBill.Size = new Size(width, height); btnMoveBill.Text = "转台"; btnMoveBill.Click += new System.EventHandler(this.btnMoveBill_Click); this.pnlBottom.Controls.Add(btnMoveBill); px += width + space; CrystalButton btnMerge = new CrystalButton(); btnMerge.BackColor = Color.Teal; btnMerge.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular); btnMerge.ForeColor = System.Drawing.Color.White; btnMerge.Location = new Point(px, py); btnMerge.Name = "btnMerge"; btnMerge.Size = new Size(width, height); btnMerge.Text = "合并"; btnMerge.Click += new System.EventHandler(this.btnMerge_Click); this.pnlBottom.Controls.Add(btnMerge); px += width + space; btnCancel.Location = new Point(px, py); btnCancel.Size = new Size(width, height); this.pnlBottom.Controls.Add(btnCancel); } }
private void dataGirdViewExt1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dataGirdViewExt1.CurrentRow != null) { int selectIndex = dataGirdViewExt1.CurrentRow.Index; Guid goodsID = new Guid(dataGirdViewExt1.Rows[selectIndex].Cells["colGoodsID"].Value.ToString()); Goods goods = null; foreach (GoodsGroup goodsGroup in ConstantValuePool.GoodsGroupList) { if (goodsGroup.GoodsList != null) { foreach (Goods item in goodsGroup.GoodsList) { if (item.GoodsID == goodsID) { //修改当前品项组的值,为了读取可能存在的折扣 m_GoodsGroup.GoodsGroupID = goodsGroup.GoodsGroupID; m_GoodsGroup.GoodsGroupNo = goodsGroup.GoodsGroupNo; m_GoodsGroup.GoodsGroupName = goodsGroup.GoodsGroupName; m_GoodsGroup.GoodsGroupName2nd = goodsGroup.GoodsGroupName2nd; m_GoodsGroup.ButtonStyleID = goodsGroup.ButtonStyleID; m_GoodsGroup.GoodsList = goodsGroup.GoodsList; goods = item; break; } } if (goods != null) { break; } } } CrystalButton btn = new CrystalButton(); btn.Tag = goods; if (m_OrderAction != null) { m_OrderAction(btn, null); } } }
private void DisplayGroupButton() { pnlGroup.Controls.Clear(); int space = 3; int width = (pnlGroup.Width - (_dicGoodsSetMealByGroup.Count - 1) * space) / _dicGoodsSetMealByGroup.Count; int height = pnlGroup.Height - space; int px = 0, py = 0; foreach (KeyValuePair<int, List<GoodsSetMeal>> item in _dicGoodsSetMealByGroup) { CrystalButton btn = new CrystalButton(); btn.Name = "button" + item.Key; btn.Text = item.Value[0].GroupName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.ForeColor = Color.White; btn.BackColor = Color.DodgerBlue; btn.Tag = item.Value; btn.Click += new EventHandler(btnGroup_Click); pnlGroup.Controls.Add(btn); px += width + space; } }
private void btnGroup_Click(object sender, EventArgs e) { CrystalButton btnGroup = sender as CrystalButton; if (btnGroup == null) return; if (btnGroup.Tag is GoodsGroup) { _currentGoodsGroup = btnGroup.Tag as GoodsGroup; Color pressedColor = ConstantValuePool.PressedColor; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (_currentGoodsGroup.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { pressedColor = ColorConvert.RGB(btnStyle.ClickedBackColor); break; } } btnGroup.BackColor = pressedColor; if (_prevPressedButton == null) { _prevPressedButton = btnGroup; } else { if (btnGroup.Text != _prevPressedButton.Text) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; } _prevPressedButton = btnGroup; } _itemPageIndex = 0; DisplayGoodsButton(); } if (btnGroup.Tag is DetailsGroup) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; DetailsGroup detailsGroup = btnGroup.Tag as DetailsGroup; Color pressedColor = ConstantValuePool.PressedColor; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (detailsGroup.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { pressedColor = ColorConvert.RGB(btnStyle.ClickedBackColor); break; } } btnGroup.BackColor = pressedColor; _prevPressedButton = btnGroup; if (detailsGroup.DetailsList != null && detailsGroup.DetailsList.Count > 0) { _currentDetailsGroup = detailsGroup; _itemPageIndex = 0; DisplayDetailButton(); } } }
private void InitDeliveryButton() { if (_btnDeliveryList.Count == 0) { int space = 2; int px = 0, py = space; int height = (this.pnlDelivery.Height - this.pnlPage.Height - (PageSize + 1) * space) / PageSize; for (int i = 0; i < PageSize; i++) { CrystalButton btnDelivery = new CrystalButton(); btnDelivery.Name = "btnDelivery" + i; btnDelivery.BackColor = btnDelivery.DisplayColor = Color.DodgerBlue; btnDelivery.Font = new Font("Microsoft YaHei", 12F); btnDelivery.ForeColor = Color.White; btnDelivery.Location = new Point(px, py); btnDelivery.Size = new Size(pnlDelivery.Width - space, height); btnDelivery.Click += new System.EventHandler(this.btnDelivery_Click); this.pnlDelivery.Controls.Add(btnDelivery); _btnDeliveryList.Add(btnDelivery); py += height + space; } } }
private void InitializeItemButton() { if (_btnItemList.Count == 0) { if (ConstantValuePool.BizSettingConfig.bizUIConfig.BizControls != null && ConstantValuePool.BizSettingConfig.bizUIConfig.BizControls.Count > 0) { foreach (BizControl control in ConstantValuePool.BizSettingConfig.bizUIConfig.BizControls) { if (control.Name == "Item") { int width = (this.pnlItem.Width - BlankSpace * (control.ColumnsCount + 1)) / control.ColumnsCount; int height = (this.pnlItem.Height - BlankSpace * (control.RowsCount + 1)) / control.RowsCount; _itemPageSize = control.ColumnsCount * control.RowsCount - 2; //扣除向前、向后两个按钮 //坐标 int px = BlankSpace, py = BlankSpace, times = 0; for (int i = 0; i < _itemPageSize; i++) { CrystalButton btnItem = new CrystalButton(); btnItem.Name = "btnItem" + i; btnItem.BackColor = btnItem.DisplayColor = Color.DodgerBlue; btnItem.Location = new Point(px, py); btnItem.Size = new Size(width, height); btnItem.Click += new System.EventHandler(this.btnItem_Click); this.pnlItem.Controls.Add(btnItem); _btnItemList.Add(btnItem); //计算Button位置 times++; px += BlankSpace + width; if (times == control.ColumnsCount) { px = BlankSpace; times = 0; py += BlankSpace + height; } } px = (control.ColumnsCount - 2) * width + (control.ColumnsCount - 2 + 1) * BlankSpace; py = (control.RowsCount - 1) * height + control.RowsCount * BlankSpace; btnHead.Width = width; btnHead.Height = height; btnHead.Location = new Point(px, py); px += width + BlankSpace; btnBack.Width = width; btnBack.Height = height; btnBack.Location = new Point(px, py); //向前 this.pnlItem.Controls.Add(btnHead); //向后 this.pnlItem.Controls.Add(btnBack); break; } } } } }
private void btnDelivery_Click(object sender, EventArgs e) { CrystalButton btnDelivery = sender as CrystalButton; if (btnDelivery == null) return; if (btnDelivery.Tag != null) { DeliveryOrder deliveryOrder = btnDelivery.Tag as DeliveryOrder; if (deliveryOrder == null) return; if (deliveryOrder.PayTime == null) { if (_prevDeliveryButton == null) { btnDelivery.ForeColor = Color.DodgerBlue; _prevDeliveryButton = btnDelivery; } else { if (btnDelivery.Text != _prevDeliveryButton.Text) { _prevDeliveryButton.ForeColor = Color.White; btnDelivery.ForeColor = Color.DodgerBlue; } _prevDeliveryButton = btnDelivery; } if (deliveryOrder.EatType == (int)EatWayType.OutsideOrder && deliveryOrder.DeliveryTime == null) { btnDeliveryGoods.Enabled = true; btnDeliveryGoods.BackColor = btnDeliveryGoods.DisplayColor; } else { btnDeliveryGoods.Enabled = false; btnDeliveryGoods.BackColor = ConstantValuePool.DisabledColor; } if (deliveryOrder.EatType == (int)EatWayType.OutsideOrder && deliveryOrder.DeliveryTime != null) { btnOutsideOrder.Enabled = false; btnOutsideOrder.BackColor = ConstantValuePool.DisabledColor; btnDiscount.Enabled = false; btnDiscount.BackColor = ConstantValuePool.DisabledColor; btnWholeDiscount.Enabled = false; btnWholeDiscount.BackColor = ConstantValuePool.DisabledColor; btnTakeOut.Enabled = false; btnTakeOut.BackColor = ConstantValuePool.DisabledColor; } else { btnOutsideOrder.Enabled = true; btnOutsideOrder.BackColor = btnOutsideOrder.DisplayColor; btnDiscount.Enabled = true; btnDiscount.BackColor = btnDiscount.DisplayColor; btnWholeDiscount.Enabled = true; btnWholeDiscount.BackColor = btnWholeDiscount.DisplayColor; btnTakeOut.Enabled = true; btnTakeOut.BackColor = btnTakeOut.DisplayColor; } SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(deliveryOrder.OrderID); if (salesOrder != null) { _salesOrder = salesOrder; BindGoodsOrderInfo(); //绑定订单信息 BindOrderInfoSum(); CustomerOrder customerOrder = CustomersService.GetInstance().GetCustomerOrder(_salesOrder.order.OrderID); if (customerOrder != null) { this.txtTelephone.Text = customerOrder.Telephone; this.txtName.Text = customerOrder.CustomerName; this.txtAddress.Text = customerOrder.Address; txtTelephone.ReadOnly = true; txtName.ReadOnly = true; } else { this.txtTelephone.Text = string.Empty; this.txtName.Text = string.Empty; this.txtAddress.Text = string.Empty; txtTelephone.ReadOnly = false; txtName.ReadOnly = false; } } else { MessageBox.Show("获取账单信息失败,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(deliveryOrder.OrderID); if (salesOrder != null) { FormTakeGoods form = new FormTakeGoods(salesOrder); form.ShowDialog(); if (form.HasDeliveried) { IList<DeliveryOrder> deliveryOrderList = OrderService.GetInstance().GetDeliveryOrderList(); if (deliveryOrderList != null) { _deliveryOrderList = deliveryOrderList; } btnDelivery.Enabled = false; btnDelivery.BackColor = ConstantValuePool.DisabledColor; } } } } }
private void FormTakeout_VisibleChanged(object sender, EventArgs e) { if (_onShow) { this.dgvGoodsOrder.Rows.Clear(); //初始化外卖单按钮 InitDeliveryButton(); //初始化品项组按钮 InitializeGroupButton(); //初始化品项按钮 InitializeItemButton(); //初始化 LoadDefaultGoodsGroupButton(); _goodsOrDetails = true; _detailsPrefix = string.Empty; _prevDeliveryButton = null; _prevPressedButton = null; _showSilverCode = false; //清除 txtTelephone.Text = string.Empty; txtName.Text = string.Empty; txtAddress.Text = string.Empty; btnDeliveryGoods.Enabled = false; btnDeliveryGoods.BackColor = ConstantValuePool.DisabledColor; //加载外卖单列表 IList<DeliveryOrder> deliveryOrderList = OrderService.GetInstance().GetDeliveryOrderList(); if (deliveryOrderList != null) { _pageIndex = 0; _deliveryOrderList = deliveryOrderList; DisplayDeliveryOrderButton(); } } }
private void InitializeRegionDeskButton() { //禁止引发Layout事件 this.pnlRegion.SuspendLayout(); this.pnlDesk.SuspendLayout(); this.SuspendLayout(); //动态加载区域控件 foreach (BizRegion region in ConstantValuePool.RegionList) { CrystalButton btn = new CrystalButton(); btn.Name = region.RegionID.ToString(); btn.Text = region.RegionName; btn.Width = region.Width; btn.Height = region.Height; btn.Location = new Point(region.PX, region.PY); btn.Tag = region; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (region.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { btn.Font = new Font(btnStyle.FontName, (float)btnStyle.FontSize, FontStyle.Regular); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Click += new System.EventHandler(this.btnRegion_Click); if (_prevRegionButton == null) { _prevRegionButton = btn; _prevRegionButton.BackColor = ConstantValuePool.PressedColor; } this.pnlRegion.Controls.Add(btn); } //动态加载第一区域的桌况信息 BizRegion firstRegion = ConstantValuePool.RegionList[0]; _currentRegionId = firstRegion.RegionID; if (!_dicDeskInRegion.ContainsKey(_currentRegionId)) { List<CrystalButton> btnList = new List<CrystalButton>(); foreach (BizDesk desk in firstRegion.BizDeskList) { CrystalButton btn = new CrystalButton(); btn.Name = desk.DeskID.ToString(); btn.Text = desk.DeskName; btn.Width = desk.Width; btn.Height = desk.Height; btn.Location = new Point(desk.PX, desk.PY); btn.Tag = desk; btn.Font = new Font("Arial", ConstantValuePool.BizSettingConfig.FontSize, FontStyle.Regular); btn.ForeColor = Color.White; btn.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btn.Click += new System.EventHandler(this.btnDesk_Click); btnList.Add(btn); } _dicDeskInRegion.Add(firstRegion.RegionID, btnList); } foreach (CrystalButton btn in _dicDeskInRegion[firstRegion.RegionID]) { this.pnlDesk.Controls.Add(btn); } //恢复引发Layout事件 this.pnlRegion.ResumeLayout(false); this.pnlRegion.PerformLayout(); this.pnlDesk.ResumeLayout(false); this.pnlDesk.PerformLayout(); this.ResumeLayout(false); }
private void InitialOrderButton(IList<Order> orderList) { int maxColumn = 0; if (orderList.Count <= 5) { maxColumn = 1; } else if (orderList.Count > 5 && orderList.Count <= 10) { maxColumn = 2; } else { maxColumn = 3; } int width = (this.pnlContainer.Width - 12) / maxColumn; int height = Convert.ToInt32((this.pnlContainer.Height - 12) / Math.Ceiling((decimal)orderList.Count / maxColumn)); int count = 1; int px = 6, py = 6; foreach (Order order in orderList) { StringBuilder sbOrderInfo = new StringBuilder(); sbOrderInfo.Append("桌号:" + order.DeskName + "-" + order.SubOrderNo); sbOrderInfo.Append("\n"); sbOrderInfo.Append("人数:" + order.PeopleNum); sbOrderInfo.Append("\n"); sbOrderInfo.Append("消费金额:" + order.ActualSellPrice.ToString("N")); CrystalButton btnOrder = new CrystalButton(); btnOrder.BackColor = btnOrder.DisplayColor = Color.Olive; btnOrder.ForeColor = Color.White; btnOrder.Name = order.OrderID.ToString(); btnOrder.Text = sbOrderInfo.ToString(); btnOrder.Tag = order; btnOrder.Width = width; btnOrder.Height = height; btnOrder.Location = new Point(px, py); btnOrder.Click += new EventHandler(btnOrder_Click); this.pnlContainer.Controls.Add(btnOrder); count++; if (count > maxColumn) { px = 6; py += height; count = 1; continue; } px += width; } }
private void btnReason_Click(object sender, EventArgs e) { CrystalButton btn = sender as CrystalButton; m_CurrentReason = btn.Tag as Reason; if (m_PreviousBtn == null) { btn.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btn; } else { m_PreviousBtn.BackColor = m_PreviousBtn.DisplayColor; btn.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btn; } }
private void GetPayoffButton() { foreach (PayoffWay payoff in ConstantValuePool.PayoffWayList) { CrystalButton btn = new CrystalButton(); btn.Name = payoff.PayoffID.ToString(); btn.Text = payoff.PayoffName; btn.Width = m_Width; btn.Height = m_Height; btn.BackColor = btn.DisplayColor = Color.Blue; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { float emSize = (float)btnStyle.FontSize; FontStyle style = FontStyle.Regular; btn.Font = new Font(btnStyle.FontName, emSize, style); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Tag = payoff; btn.Click += new System.EventHandler(this.btnPayoff_Click); payoffButtonList.Add(btn); } }
private void btnTurnTable_Click(object sender, EventArgs e) { _deskName1St = string.Empty; _orderId1St = Guid.Empty; _firstDeskSingleOrder = false; if (_prevPressedButton != null) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; if (btn == null) return; btn.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.CHANGE_DESK; _prevPressedButton = btn; }
private void btnCheckOut_Click(object sender, EventArgs e) { if (_prevPressedButton != null) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; if (btn == null) return; btn.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.CHECKOUT; _prevPressedButton = btn; }
private void FormDesk_Load(object sender, EventArgs e) { InitializeRegionDeskButton(); const int space = 5; const int width = 75; const int height = 28; int px = this.pnlDesk.Width - 3 * (width + space); int py = this.pnlDesk.Height - height - space; this.btnFreeColor.Width = width; this.btnFreeColor.Height = height; this.btnFreeColor.Location = new Point(px, py); px += width + space; this.btnTakeColor.Width = width; this.btnTakeColor.Height = height; this.btnTakeColor.Location = new Point(px, py); px += width + space; this.btnLookColor.Width = width; this.btnLookColor.Height = height; this.btnLookColor.Location = new Point(px, py); this.pnlSysTools.Width = this.scrollingText1.Width = this.pnlToolBar.Width; int toolsBarNum = 6; if (ConstantValuePool.BizSettingConfig.SaleType == ShopSaleType.DineInAndTakeout) { toolsBarNum++; } else { btnTakeOut.Visible = false; } int btnWidth = this.pnlSysTools.Width / toolsBarNum; int btnHeight = this.pnlSysTools.Height; px = 0; py = 0; btnManager.Size = new System.Drawing.Size(btnWidth, btnHeight); btnManager.Location = new Point(px, py); px += btnWidth; btnOrder.Size = new System.Drawing.Size(btnWidth, btnHeight); btnOrder.Location = new Point(px, py); px += btnWidth; btnClear.Size = new System.Drawing.Size(btnWidth, btnHeight); btnClear.Location = new Point(px, py); px += btnWidth; btnTurnTable.Size = new System.Drawing.Size(btnWidth, btnHeight); btnTurnTable.Location = new Point(px, py); px += btnWidth; btnCheckOut.Size = new System.Drawing.Size(btnWidth, btnHeight); btnCheckOut.Location = new Point(px, py); if (ConstantValuePool.BizSettingConfig.SaleType == ShopSaleType.DineInAndTakeout) { px += btnWidth; btnTakeOut.Size = new System.Drawing.Size(btnWidth, btnHeight); btnTakeOut.Location = new Point(px, py); } px += btnWidth; btnExit.Size = new System.Drawing.Size(this.pnlSysTools.Width - px, btnHeight); btnExit.Location = new Point(px, py); btnOrder.DisplayColor = btnOrder.BackColor; btnClear.DisplayColor = btnClear.BackColor; btnTurnTable.DisplayColor = btnTurnTable.BackColor; btnCheckOut.DisplayColor = btnCheckOut.BackColor; if (RightsItemCode.FindRights(RightsItemCode.TAKEORDER)) { if (_haveDailyClose) { btnOrder.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.ORDER; _prevPressedButton = btnOrder; } else { btnOrder.Enabled = false; btnOrder.BackColor = ConstantValuePool.DisabledColor; _operateType = ButtonOperateType.NONE; } } else { btnOrder.Enabled = false; btnOrder.BackColor = ConstantValuePool.DisabledColor; _operateType = ButtonOperateType.NONE; } if (!RightsItemCode.FindRights(RightsItemCode.CLEARDESK)) { btnClear.Enabled = false; btnClear.BackColor = ConstantValuePool.DisabledColor; } if (!RightsItemCode.FindRights(RightsItemCode.TURNTABLE)) { btnTurnTable.Enabled = false; btnTurnTable.BackColor = ConstantValuePool.DisabledColor; } if (!RightsItemCode.FindRights(RightsItemCode.CHECKOUT)) { btnCheckOut.Enabled = false; btnCheckOut.BackColor = ConstantValuePool.DisabledColor; } string strNotice = string.Empty; foreach (Notice item in ConstantValuePool.NoticeList) { strNotice += item.NoticeContent + "\t\t\t"; } if (!string.IsNullOrEmpty(strNotice)) { scrollingText1.ScrollText = strNotice; } Thread backWork = new Thread(new ThreadStart(DoWork)); backWork.IsBackground = true; backWork.Start(); }
private void btnRegion_Click(object sender, EventArgs e) { CrystalButton btnRegion = sender as CrystalButton; if (btnRegion == null) return; BizRegion region = btnRegion.Tag as BizRegion; if (region == null) return; _currentFormActivate = false; lock (_dicDeskInRegion) { //禁止引发Layout事件 this.pnlDesk.SuspendLayout(); this.SuspendLayout(); //清除pnlDesk内所有控件 this.pnlDesk.Controls.Clear(); //获取Desk List _prevRegionButton.BackColor = _prevRegionButton.DisplayColor; btnRegion.BackColor = ConstantValuePool.PressedColor; _prevRegionButton = btnRegion; _currentRegionId = region.RegionID; if (!_dicDeskInRegion.ContainsKey(_currentRegionId)) { List<CrystalButton> btnList = new List<CrystalButton>(); if (region.BizDeskList != null && region.BizDeskList.Count > 0) { foreach (BizDesk desk in region.BizDeskList) { CrystalButton btn = new CrystalButton(); btn.Name = desk.DeskID.ToString(); btn.Text = desk.DeskName; btn.Width = desk.Width; btn.Height = desk.Height; btn.Location = new Point(desk.PX, desk.PY); btn.Tag = desk; btn.Font = new Font("Arial", ConstantValuePool.BizSettingConfig.FontSize, FontStyle.Regular); btn.ForeColor = Color.White; btn.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btn.Click += new System.EventHandler(this.btnDesk_Click); btnList.Add(btn); } } _dicDeskInRegion.Add(region.RegionID, btnList); } foreach (CrystalButton btn in _dicDeskInRegion[region.RegionID]) { this.pnlDesk.Controls.Add(btn); } this.pnlDesk.Controls.Add(btnFreeColor); this.pnlDesk.Controls.Add(btnTakeColor); this.pnlDesk.Controls.Add(btnLookColor); //恢复引发Layout事件 this.pnlDesk.ResumeLayout(false); this.pnlDesk.PerformLayout(); this.ResumeLayout(false); } _currentFormActivate = true; }
private void UpdateDeskButtonInfo(CrystalButton btnDesk, DeskRealTimeInfo deskInfo) { if (btnDesk.InvokeRequired) { DelegateUpdateDeskButton myDelegate = new DelegateUpdateDeskButton(UpdateDeskButtonInfo); btnDesk.Invoke(myDelegate, new object[] { btnDesk, deskInfo }); } else { if (_currentFormActivate) { if (deskInfo == null) { BizDesk desk = btnDesk.Tag as BizDesk; if (desk != null) { desk.Status = (int) DeskButtonStatus.IDLE_MODE; desk.DeviceNo = string.Empty; btnDesk.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btnDesk.Text = desk.DeskName; } } else { btnDesk.BackColor = GetColorByStatus(deskInfo.DeskStatus, deskInfo.DeviceNo); if (deskInfo.IsSplitOrder) { btnDesk.Text = "**"; } else { btnDesk.Text = deskInfo.DeskName + "\n" + deskInfo.PeopleNum + "\n" + deskInfo.ConsumptionMoney.ToString("N"); } } } } }
private void DisplayGoodsSetMealButton() { pnlItem.Controls.Clear(); int space = 3; int width = (pnlItem.Width - 4 * space) / 5; int height = (pnlItem.Height - 4 * space) / 4; int px = 0, py = 0; int i = 0; for (int index = _itemPageIndex * 18; index < _currentGoodsSetMealList.Count; index++) { CrystalButton btn = new CrystalButton(); btn.Text = _currentGoodsSetMealList[index].GoodsName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.ForeColor = Color.White; btn.BackColor = btn.DisplayColor = Color.OrangeRed; if (IsGoodsSetMealItemInList(_currentGoodsSetMealList[index])) { btn.BackColor = Color.Black; } btn.Tag = _currentGoodsSetMealList[index]; btn.Click += new EventHandler(btnItem_Click); pnlItem.Controls.Add(btn); i++; px += width + space; if (i % 5 == 0) { px = 0; py += height + space; } } btnPageUp.Width = width; btnPageUp.Height = height; btnPageUp.Location = new Point(3 * (width + space), 3 * (height + space)); pnlItem.Controls.Add(btnPageUp); btnPageDown.Width = width; btnPageDown.Height = height; btnPageDown.Location = new Point(4 * (width + space), 3 * (height + space)); pnlItem.Controls.Add(btnPageDown); }
private void FormFunctionPanel_Load(object sender, EventArgs e) { CrystalButton btnBillManage = new CrystalButton(); btnBillManage.Name = "btnBillManage"; btnBillManage.Text = "账单管理"; btnBillManage.BackColor = Color.Teal; btnBillManage.ForeColor = Color.White; btnBillManage.Click += new EventHandler(this.btnBillManage_Click); btnList.Add(btnBillManage); CrystalButton btnHandover = new CrystalButton(); btnHandover.Name = "btnHandover"; btnHandover.Text = "交班"; btnHandover.BackColor = Color.Teal; btnHandover.ForeColor = Color.White; btnHandover.Click += new EventHandler(this.btnHandover_Click); btnList.Add(btnHandover); //加载权限按钮 InitializeManagerButton(); CrystalButton btnMemberStored = new CrystalButton(); btnMemberStored.Name = "btnMemberStored"; btnMemberStored.Text = "会员储值"; btnMemberStored.BackColor = Color.Teal; btnMemberStored.ForeColor = Color.White; btnMemberStored.Click += new EventHandler(this.btnMemberStored_Click); btnList.Add(btnMemberStored); CrystalButton btnMemberSearch = new CrystalButton(); btnMemberSearch.Name = "btnMemberSearch"; btnMemberSearch.Text = "会员查询"; btnMemberSearch.BackColor = Color.Teal; btnMemberSearch.ForeColor = Color.White; btnMemberSearch.Click += new EventHandler(this.btnMemberSearch_Click); btnList.Add(btnMemberSearch); CrystalButton btnMemberTradeRecord = new CrystalButton(); btnMemberTradeRecord.Name = "btnMemberTradeRecord"; btnMemberTradeRecord.Text = "会员交易记录"; btnMemberTradeRecord.BackColor = Color.Teal; btnMemberTradeRecord.ForeColor = Color.White; btnMemberTradeRecord.Click += new EventHandler(this.btnMemberTradeRecord_Click); btnList.Add(btnMemberTradeRecord); CrystalButton btnMemberStatus = new CrystalButton(); btnMemberStatus.Name = "btnMemberStatus"; btnMemberStatus.Text = "会员状态管理"; btnMemberStatus.BackColor = Color.Teal; btnMemberStatus.ForeColor = Color.White; btnMemberStatus.Click += new EventHandler(this.btnMemberStatus_Click); btnList.Add(btnMemberStatus); CrystalButton btnUploadBill = new CrystalButton(); btnUploadBill.Name = "btnUploadBill"; btnUploadBill.Text = "上传单据"; btnUploadBill.BackColor = Color.Teal; btnUploadBill.ForeColor = Color.White; btnUploadBill.Click += new EventHandler(this.btnUploadBill_Click); btnList.Add(btnUploadBill); CrystalButton btnDownloadData = new CrystalButton(); btnDownloadData.Name = "btnDownloadData"; btnDownloadData.Text = "下载基础数据"; btnDownloadData.BackColor = Color.Teal; btnDownloadData.ForeColor = Color.White; btnDownloadData.Click += new EventHandler(this.btnDownloadData_Click); btnList.Add(btnDownloadData); CrystalButton btnModifyPassword = new CrystalButton(); btnModifyPassword.Name = "btnModifyPassword"; btnModifyPassword.Text = "修改密码"; btnModifyPassword.BackColor = Color.Teal; btnModifyPassword.ForeColor = Color.White; btnModifyPassword.Click += new EventHandler(this.btnModifyPassword_Click); btnList.Add(btnModifyPassword); CrystalButton btnCheckStock = new CrystalButton(); btnCheckStock.Name = "btnCheckStock"; btnCheckStock.Text = "沽清功能"; btnCheckStock.BackColor = Color.Teal; btnCheckStock.ForeColor = Color.White; btnCheckStock.Click += new EventHandler(this.btnCheckStock_Click); btnList.Add(btnCheckStock); CrystalButton btnPunchIn = new CrystalButton(); btnPunchIn.Name = "btnPunchIn"; btnPunchIn.Text = "上班打卡"; btnPunchIn.BackColor = Color.Teal; btnPunchIn.ForeColor = Color.White; btnPunchIn.Click += new EventHandler(this.btnPunchIn_Click); btnList.Add(btnPunchIn); CrystalButton btnSetting = new CrystalButton(); btnSetting.Name = "btnSetting"; btnSetting.Text = "系统设置"; btnSetting.BackColor = Color.Teal; btnSetting.ForeColor = Color.White; btnSetting.Click += new EventHandler(this.btnSetting_Click); btnList.Add(btnSetting); CrystalButton btnCancel = new CrystalButton(); btnCancel.Name = "btnCancel"; btnCancel.Text = "取消"; btnCancel.BackColor = Color.Red; btnCancel.ForeColor = Color.White; btnCancel.Click += new EventHandler(this.btnCancel_Click); btnList.Add(btnCancel); //判断每行显示多少列 int count = btnList.Count; int maxColumn = Convert.ToInt32(Math.Ceiling((Math.Sqrt(Convert.ToDouble(count))))); //显示多少行 int perLine = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(count) / maxColumn)); //计算button长宽 int space = 6; int width = (this.pnlFunction.Width - space * (maxColumn + 1)) / maxColumn; int height = (this.pnlFunction.Height - space * (perLine + 1)) / perLine; int index = 1; int px = space, py = space; foreach (CrystalButton btn in btnList) { btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Font = new Font("Microsoft YaHei", 10.5F, FontStyle.Bold); this.pnlFunction.Controls.Add(btn); index++; if (index > maxColumn) { px = space; py += height + space; index = 1; } else { px += width + space; } } }
private void FormOrder_VisibleChanged(object sender, EventArgs e) { if (_onShow) { //初始化品项组按钮 InitializeGroupButton(); //初始化品项按钮 InitializeItemButton(); //初始化 LoadDefaultGoodsGroupButton(); _goodsOrDetails = true; _goodsNum = string.Empty; _detailsPrefix = string.Empty; _prevPressedButton = null; _showSilverCode = false; this.lbTotalPrice.Text = "总金额:"; this.lbDiscount.Text = "折扣:"; this.lbNeedPayMoney.Text = "实际应付:"; this.lbCutOff.Text = "去零:"; this.btnDeskNo.Text = "桌号:" + _currentDeskName; this.txtShopNo.Text = "店铺号:" + ConstantValuePool.CurrentShop.ShopNo; this.txtDeviceNo.Text = "设备号:" + ConstantValuePool.BizSettingConfig.DeviceNo; this.txtSoftwareProvider.Width += this.Width - 1024; this.txtSoftwareProvider.Text = "软件提供商:凡趣科技有限公司"; this.txtCurrentDateTime.Text = "日期:" + DateTime.Now.ToLongDateString() + " " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek); this.dgvGoodsOrder.Rows.Clear(); if (_salesOrder == null) //new bill { _employeeId = ConstantValuePool.CurrentEmployee.EmployeeID; _employeeNo = ConstantValuePool.CurrentEmployee.EmployeeNo; } else { _personNum = _salesOrder.order.PeopleNum; _employeeId = _salesOrder.order.EmployeeID; _employeeNo = _salesOrder.order.EmployeeNo; BindGoodsOrderInfo(); //绑定订单信息 BindOrderInfoSum(); //更新第二屏信息 if (Screen.AllScreens.Length > 1 && ConstantValuePool.BizSettingConfig.SecondScreenEnabled) { if (ConstantValuePool.SecondScreenForm != null && ConstantValuePool.SecondScreenForm is FormSecondScreen) { ((FormSecondScreen)ConstantValuePool.SecondScreenForm).BindGoodsOrderInfo(dgvGoodsOrder); } } } this.btnEmployee.Text = "服务员:" + _employeeNo; this.btnPersonNum.Text = "人数:" + _personNum; } }
private void btnPayoff_Click(object sender, EventArgs e) { if (_curButton != null) { _curButton.BackColor = _curButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; btn.BackColor = ConstantValuePool.PressedColor; _curButton = btn; _curPayoffWay = btn.Tag as PayoffWay; }
private void InitializeReasonButton() { int reasonCount = 0; foreach (Reason item in ConstantValuePool.ReasonList) { if (item.ReasonType == (int)ReasonItemType.DeleteItem) { reasonCount++; } } if (reasonCount > 0) { //判断每行显示多少列 int maxColumn = Convert.ToInt32(Math.Sqrt(Convert.ToDouble(reasonCount))); if (maxColumn * maxColumn < reasonCount) { maxColumn++; } //显示多少行 int perLine = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(reasonCount) / maxColumn)); //计算button长宽 int space = 6; int width = (this.pnlReason.Width - space * (maxColumn - 1)) / maxColumn; int height = (this.pnlReason.Height - space * (perLine - 1)) / perLine; int count = 1; int px = 0, py = 0; CrystalButton btn; foreach (Reason item in ConstantValuePool.ReasonList) { if (item.ReasonType == (int)ReasonItemType.DeleteItem) { btn = new CrystalButton(); btn.Name = item.ReasonID.ToString(); btn.Tag = item; btn.Text = item.ReasonName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.BackColor = Color.Blue; btn.DisplayColor = btn.BackColor; btn.Click += new System.EventHandler(this.btnReason_Click); this.pnlReason.Controls.Add(btn); count++; if (count > maxColumn) { px = 0; py += height + space; count = 1; } else { px += width + space; } } } } }
private void btnOrder_Click(object sender, EventArgs e) { CrystalButton btnOrder = sender as CrystalButton; m_Order = btnOrder.Tag as Order; if (m_PreviousBtn == null) { btnOrder.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btnOrder; } else { m_PreviousBtn.BackColor = m_PreviousBtn.DisplayColor; btnOrder.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btnOrder; } }
/// <summary> /// /// </summary> /// <param name="displayModel">显示模式 1:单品折扣, 2:整单折扣</param> /// <param name="expenditure">未打折的消费金额</param> /// <param name="actualSellPrice">整单实际金额</param> public FormDiscount(DiscountDisplayModel displayModel, decimal expenditure, decimal actualSellPrice) { m_ActualSellPrice = actualSellPrice; InitializeComponent(); //显示折扣方式 //1:折扣率 2:固定折扣 IList<Discount> discountRateList = new List<Discount>(); IList<Discount> discountOffPayList = new List<Discount>(); foreach (Discount item in ConstantValuePool.DiscountList) { if (item.DisplayModel == (int)DiscountDisplayModel.ALL || item.DisplayModel == (int)displayModel) { if (expenditure == -1 || expenditure > item.MinQuotas) { if (item.DiscountType == (int)DiscountItemType.DiscountRate) { if (item.DiscountRate <= ConstantValuePool.CurrentEmployee.MinDiscount) { discountRateList.Add(item); } } if (item.DiscountType == (int)DiscountItemType.OffFixPay) { if (item.OffFixPay / item.MinQuotas <= ConstantValuePool.CurrentEmployee.MinDiscount) { discountOffPayList.Add(item); } } } } } //显示折扣率 int count = discountRateList.Count; int maxColumn = (int)Math.Ceiling(Convert.ToDecimal(count) / 5); int maxRow = (int)Math.Ceiling(Convert.ToDecimal(count) / maxColumn); int space = 8; int width = (this.tabPage1.Width - (maxColumn - 1) * space) / maxColumn; int height = (this.tabPage1.Height - (maxRow - 1) * space) / maxRow; int px = 0, py = 0, index = 1; foreach (Discount item in discountRateList) { CrystalButton btn = new CrystalButton(); btn.Name = item.DiscountID.ToString(); btn.Text = item.DiscountName; btn.BackColor = Color.Teal; btn.Font = new Font("微软雅黑", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Tag = item; btn.Click += new System.EventHandler(this.btnDiscount_Click); this.tabPage1.Controls.Add(btn); index++; if (index > maxColumn) { px = 0; py += height + space; index = 1; } else { px += width + space; } } //显示固定折扣 if (discountOffPayList.Count > 0) { count = discountOffPayList.Count; maxColumn = (int)Math.Ceiling(Convert.ToDecimal(count) / 5); maxRow = (int)Math.Ceiling(Convert.ToDecimal(count) / maxColumn); width = (this.tabPage2.Width - (maxColumn - 1) * space) / maxColumn; height = (this.tabPage2.Height - (maxRow - 1) * space) / maxRow; px = 0; py = 0; index = 1; foreach (Discount item in discountOffPayList) { CrystalButton btn = new CrystalButton(); btn.Name = item.DiscountID.ToString(); btn.Text = item.DiscountName; btn.BackColor = Color.Teal; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Tag = item; btn.Click += new System.EventHandler(this.btnDiscount_Click); this.tabPage2.Controls.Add(btn); index++; if (index > maxColumn) { px = 0; py += height + space; index = 1; } else { px += width + space; } } } }
private void InitializeManagerButton() { if (RightsItemCode.FindRights(RightsItemCode.DAILYSTATEMENT)) { CrystalButton btnDailyStatement = new CrystalButton(); btnDailyStatement.Name = "btnDailyStatement"; btnDailyStatement.Text = "日结"; btnDailyStatement.BackColor = Color.Teal; btnDailyStatement.ForeColor = Color.White; btnDailyStatement.Click += new EventHandler(this.btnDailyStatement_Click); btnList.Add(btnDailyStatement); } if (RightsItemCode.FindRights(RightsItemCode.PETTYCASHMODIFY)) { CrystalButton btnPettyCashModify = new CrystalButton(); btnPettyCashModify.Name = "btnPettyCashModify"; btnPettyCashModify.Text = "零用金修改"; btnPettyCashModify.BackColor = Color.Teal; btnPettyCashModify.ForeColor = Color.White; btnPettyCashModify.Click += new EventHandler(this.btnPettyCashModify_Click); btnList.Add(btnPettyCashModify); } if (RightsItemCode.FindRights(RightsItemCode.HOURSTURNOVER)) { CrystalButton btnHoursTurnover = new CrystalButton(); btnHoursTurnover.Name = "btnHoursTurnover"; btnHoursTurnover.Text = "小时营业额"; btnHoursTurnover.BackColor = Color.Teal; btnHoursTurnover.ForeColor = Color.White; btnHoursTurnover.Click += new EventHandler(this.btnHoursTurnover_Click); btnList.Add(btnHoursTurnover); } if (RightsItemCode.FindRights(RightsItemCode.HISTORYSEARCH)) { CrystalButton btnHistorySearch = new CrystalButton(); btnHistorySearch.Name = "btnHistorySearch"; btnHistorySearch.Text = "历史日结/交班查询"; btnHistorySearch.BackColor = Color.Teal; btnHistorySearch.ForeColor = Color.White; btnHistorySearch.Click += new EventHandler(this.btnHistorySearch_Click); btnList.Add(btnHistorySearch); } if (RightsItemCode.FindRights(RightsItemCode.SINGLEGOODSSTATISTICS)) { CrystalButton btnSingleGoodsStatistics = new CrystalButton(); btnSingleGoodsStatistics.Name = "btnSingleGoodsStatistics"; btnSingleGoodsStatistics.Text = "单品销量统计"; btnSingleGoodsStatistics.BackColor = Color.Teal; btnSingleGoodsStatistics.ForeColor = Color.White; btnSingleGoodsStatistics.Click += new EventHandler(this.btnSingleGoodsStatistics_Click); btnList.Add(btnSingleGoodsStatistics); } if (RightsItemCode.FindRights(RightsItemCode.DELETEDGOODSREPORT)) { CrystalButton btnDeletedGoodsReport = new CrystalButton(); btnDeletedGoodsReport.Name = "btnDeletedGoodsReport"; btnDeletedGoodsReport.Text = "删除品项报表"; btnDeletedGoodsReport.BackColor = Color.Teal; btnDeletedGoodsReport.ForeColor = Color.White; btnDeletedGoodsReport.Click += new EventHandler(this.btnDeletedGoodsReport_Click); btnList.Add(btnDeletedGoodsReport); } if (RightsItemCode.FindRights(RightsItemCode.PETTYCASHREPORT)) { CrystalButton btnPettyCashReport = new CrystalButton(); btnPettyCashReport.Name = "btnPettyCashReport"; btnPettyCashReport.Text = "零用金报表"; btnPettyCashReport.BackColor = Color.Teal; btnPettyCashReport.ForeColor = Color.White; btnPettyCashReport.Click += new EventHandler(this.btnPettyCashReport_Click); btnList.Add(btnPettyCashReport); } if (RightsItemCode.FindRights(RightsItemCode.HISTORYDAILYREPORT)) { CrystalButton btnHistoryDailyReport = new CrystalButton(); btnHistoryDailyReport.Name = "btnHistoryDailyReport"; btnHistoryDailyReport.Text = "历史日结汇总表"; btnHistoryDailyReport.BackColor = Color.Teal; btnHistoryDailyReport.ForeColor = Color.White; btnHistoryDailyReport.Click += new EventHandler(this.btnHistoryDailyReport_Click); btnList.Add(btnHistoryDailyReport); } if (RightsItemCode.FindRights(RightsItemCode.PUNCHINREPORT)) { CrystalButton btnPunchInReport = new CrystalButton(); btnPunchInReport.Name = "btnPunchInReport"; btnPunchInReport.Text = "打卡报表"; btnPunchInReport.BackColor = Color.Teal; btnPunchInReport.ForeColor = Color.White; btnPunchInReport.Click += new EventHandler(this.btnPunchInReport_Click); btnList.Add(btnPunchInReport); } if (RightsItemCode.FindRights(RightsItemCode.LOGSEARCH)) { CrystalButton btnLogSearch = new CrystalButton(); btnLogSearch.Name = "btnLogSearch"; btnLogSearch.Text = "日志查询"; btnLogSearch.BackColor = Color.Teal; btnLogSearch.ForeColor = Color.White; btnLogSearch.Click += new EventHandler(this.btnLogSearch_Click); btnList.Add(btnLogSearch); } }