private void btnWholeDelete_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null && _salesOrder != null && _salesOrder.order != null) { if (_salesOrder.order.Status == 1) { int selectedIndex = dataGridView1.CurrentRow.Index; if (dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value != null) { //权限验证 bool hasRights = false; if (RightsItemCode.FindRights(RightsItemCode.CANCELBILL)) { hasRights = true; } else { FormRightsCode formRightsCode = new FormRightsCode(); formRightsCode.ShowDialog(); if (formRightsCode.ReturnValue) { IList <string> rightsCodeList = formRightsCode.RightsCodeList; if (RightsItemCode.FindRights(rightsCodeList, RightsItemCode.CANCELBILL)) { hasRights = true; } } } if (!hasRights) { return; } FormCancelOrder form = new FormCancelOrder(); form.ShowDialog(); if (form.CurrentReason != null) { //删除订单 DeletedOrder deletedOrder = new DeletedOrder(); deletedOrder.OrderID = _salesOrder.order.OrderID; deletedOrder.AuthorisedManager = ConstantValuePool.CurrentEmployee.EmployeeID; deletedOrder.CancelEmployeeNo = ConstantValuePool.CurrentEmployee.EmployeeNo; deletedOrder.CancelReasonName = form.CurrentReason.ReasonName; if (DeletedOrderService.GetInstance().DeletePaidWholeOrder(deletedOrder)) { dataGridView1.Rows[selectedIndex].Cells["BillType"].Value = "已删除"; _salesOrder.order.Status = 2; } else { MessageBox.Show("删除账单失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } }
private void btnCustomDiscountTo_Click(object sender, EventArgs e) { //权限验证 bool hasRights = false; if (RightsItemCode.FindRights(RightsItemCode.CUSTOMDISCOUNT)) { hasRights = true; } else { FormRightsCode form = new FormRightsCode(); form.ShowDialog(); if (form.ReturnValue) { IList <string> rightsCodeList = form.RightsCodeList; if (RightsItemCode.FindRights(rightsCodeList, RightsItemCode.CUSTOMDISCOUNT)) { hasRights = true; } } } if (!hasRights) { return; } FormNumericKeypad keyForm = new FormNumericKeypad(); keyForm.DisplayText = "请输入打折之后整单的金额"; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue)) { if (decimal.Parse(keyForm.KeypadValue) < 0 || decimal.Parse(keyForm.KeypadValue) > m_ActualSellPrice) { MessageBox.Show("折扣的金额不能小于零或者超过原始金额!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { decimal discountRate = (m_ActualSellPrice - decimal.Parse(keyForm.KeypadValue)) / m_ActualSellPrice; if (discountRate > ConstantValuePool.CurrentEmployee.MinDiscount) { MessageBox.Show("当前已超过您的最低折扣!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.txtDiscount.Text = string.Format("打折后整单金额({0}元)", keyForm.KeypadValue); Discount discount = new Discount(); discount.DiscountID = new Guid("88888888-8888-8888-8888-888888888888"); discount.DiscountName = "自定义折扣"; discount.DiscountName2nd = "自定义折扣"; discount.DiscountType = (int)DiscountItemType.OffFixPay; discount.OffFixPay = m_ActualSellPrice - decimal.Parse(keyForm.KeypadValue); m_DiscountItem = discount; } } }
private void FormPayment_Load(object sender, EventArgs e) { CalculateButtonSize(); GetPayoffButton(); DisplayPayoffButton(); if (!RightsItemCode.FindRights(RightsItemCode.PAYMENT)) { btnCheckOut.Enabled = false; btnCheckOut.BackColor = ConstantValuePool.DisabledColor; } }
private void FormVIPCardStatus_Load(object sender, EventArgs e) { cmbCardStatus.Items.Clear(); cmbCardStatus.Items.Add("开卡"); if (RightsItemCode.FindRights(RightsItemCode.REPORTLOSS)) { cmbCardStatus.Items.Add("挂失"); } if (RightsItemCode.FindRights(RightsItemCode.LOCKCARD)) { cmbCardStatus.Items.Add("锁卡"); } if (RightsItemCode.FindRights(RightsItemCode.CANCELCARD)) { cmbCardStatus.Items.Add("作废"); } cmbCardStatus.SelectedIndex = 0; }
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); } }
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 btnWholeDiscount_Click(object sender, EventArgs e) { //权限验证 bool hasRights = false; if (RightsItemCode.FindRights(RightsItemCode.WHOLEDISCOUNT)) { hasRights = true; } else { FormRightsCode form = new FormRightsCode(); form.ShowDialog(); if (form.ReturnValue) { IList <string> rightsCodeList = form.RightsCodeList; if (RightsItemCode.FindRights(rightsCodeList, RightsItemCode.WHOLEDISCOUNT)) { hasRights = true; } } } if (!hasRights) { return; } //计算能打折的总金额 decimal canDiscountPrice = 0; foreach (DataGridViewRow dr in dgvGoodsOrder.Rows) { OrderDetails orderDetails = dr.Cells["OrderDetailsID"].Tag as OrderDetails; if (orderDetails != null) { if (orderDetails.CanDiscount) { canDiscountPrice += Convert.ToDecimal(dr.Cells["GoodsPrice"].Value); } } } FormDiscount formDiscount = new FormDiscount(DiscountDisplayModel.WholeDiscount, canDiscountPrice, m_ActualPayMoney); formDiscount.ShowDialog(); if (formDiscount.CurrentDiscount != null) { Discount discount = formDiscount.CurrentDiscount; int firstIndex = -1; //折价索引 decimal offFixedPay = 0; for (int index = 0; index < dgvGoodsOrder.Rows.Count; index++) { DataGridViewRow dr = dgvGoodsOrder.Rows[index]; OrderDetails orderDetails = dr.Cells["OrderDetailsID"].Tag as OrderDetails; if (orderDetails != null) { if (orderDetails.CanDiscount) { if (discount.DiscountType == (int)DiscountItemType.DiscountRate) { dr.Cells["GoodsDiscount"].Value = -Convert.ToDecimal(dr.Cells["GoodsPrice"].Value) * discount.DiscountRate; } else { if (firstIndex < 0) { firstIndex = index; } decimal discountPrice = orderDetails.TotalSellPrice / canDiscountPrice * discount.OffFixPay; discountPrice = Math.Round(discountPrice, 2); dr.Cells["GoodsDiscount"].Value = -discountPrice; offFixedPay += discountPrice; } orderDetails.TotalDiscount = Convert.ToDecimal(dr.Cells["GoodsDiscount"].Value); dr.Cells["OrderDetailsID"].Tag = orderDetails; dr.Cells["GoodsDiscount"].Tag = discount; } } } if (firstIndex >= 0) { decimal gap = discount.OffFixPay - offFixedPay; gap = Math.Round(gap, 2); decimal discountPrice = Math.Abs(Convert.ToDecimal(dgvGoodsOrder.Rows[firstIndex].Cells["GoodsDiscount"].Value)); discountPrice += gap; dgvGoodsOrder.Rows[firstIndex].Cells["GoodsDiscount"].Value = -discountPrice; OrderDetails orderDetails = dgvGoodsOrder.Rows[firstIndex].Cells["OrderDetailsID"].Tag as OrderDetails; orderDetails.TotalDiscount = Convert.ToDecimal(dgvGoodsOrder.Rows[firstIndex].Cells["GoodsDiscount"].Value); dgvGoodsOrder.Rows[firstIndex].Cells["OrderDetailsID"].Tag = orderDetails; } //重新计算 CalculateOrderPrice(); txtReceAmount.Text = (m_ActualPayMoney + m_ServiceFee).ToString("f2"); } }
private void btnDiscount_Click(object sender, EventArgs e) { if (dgvGoodsOrder.CurrentRow != null) { //权限验证 bool hasRights = false; if (RightsItemCode.FindRights(RightsItemCode.SINGLEDISCOUNT)) { hasRights = true; } else { FormRightsCode form = new FormRightsCode(); form.ShowDialog(); if (form.ReturnValue) { IList <string> rightsCodeList = form.RightsCodeList; if (RightsItemCode.FindRights(rightsCodeList, RightsItemCode.SINGLEDISCOUNT)) { hasRights = true; } } } if (!hasRights) { return; } int selectIndex = dgvGoodsOrder.CurrentRow.Index; OrderDetails orderDetails = dgvGoodsOrder.Rows[selectIndex].Cells["OrderDetailsID"].Tag as OrderDetails; if (orderDetails.ItemType == (int)OrderItemType.Goods) //主项才能打折 { if (orderDetails.CanDiscount) { FormDiscount formDiscount = new FormDiscount(DiscountDisplayModel.SingleDiscount, -1, orderDetails.TotalSellPrice); formDiscount.ShowDialog(); if (formDiscount.CurrentDiscount != null) { Discount discount = formDiscount.CurrentDiscount; if (discount.DiscountType == (int)DiscountItemType.DiscountRate) { dgvGoodsOrder.Rows[selectIndex].Cells["GoodsDiscount"].Value = -Convert.ToDecimal(dgvGoodsOrder.Rows[selectIndex].Cells["GoodsPrice"].Value) * discount.DiscountRate; } else { dgvGoodsOrder.Rows[selectIndex].Cells["GoodsDiscount"].Value = -discount.OffFixPay; } dgvGoodsOrder.Rows[selectIndex].Cells["GoodsDiscount"].Tag = discount; //更新细项 if (selectIndex < dgvGoodsOrder.Rows.Count - 1) { for (int index = selectIndex + 1; index < dgvGoodsOrder.Rows.Count; index++) { orderDetails = dgvGoodsOrder.Rows[index].Cells["OrderDetailsID"].Tag as OrderDetails; if (orderDetails.ItemType == (int)OrderItemType.Goods) { break; } else { if (discount.DiscountType == (int)DiscountItemType.DiscountRate) { dgvGoodsOrder.Rows[index].Cells["GoodsDiscount"].Value = -Convert.ToDecimal(dgvGoodsOrder.Rows[index].Cells["GoodsPrice"].Value) * discount.DiscountRate; } else { dgvGoodsOrder.Rows[index].Cells["GoodsDiscount"].Value = -discount.OffFixPay; } dgvGoodsOrder.Rows[index].Cells["GoodsDiscount"].Tag = discount; } } } //重新计算 CalculateOrderPrice(); txtReceAmount.Text = (m_ActualPayMoney + m_ServiceFee).ToString("f2"); } } } } }