public GoodsFrame(OrderItem goods, OrderHandleType type) { InitializeComponent(); this.goods = goods; lbCode.Text = goods.spbh; lbName.Text = goods.Name; lbTxm.Text = goods.txm; //数量 lbCount.Text = goods.JYSL.ToString(); txtCount.Text = goods.JYSL.ToString(); //打折 lbDiscount.Text = goods.Discount; txtDiscount.Text = goods.Discount; lbSellPrice.Text = goods.JYJ.ToString(); lbSubtotal.Text = goods.XJ.ToString(); this.type = type; }
/// <summary> /// 显示自定义输入窗 /// </summary> /// <param name="type"></param> private void InputBoxShow(OrderHandleType type) { inputBox = new InputBox(type); if (type == OrderHandleType.cash) { //输入框显示已有的数量 TextBox input = (TextBox)inputBox.Controls.Find("txtInput", false).FirstOrDefault(); input.Text = CashNum[SelectedCash].ToString(); } Controls.Add(inputBox); inputBox.BringToFront(); Point location = new Point(120, 140); inputBox.Location = location; InputBoxBindingMinikeyboard(); inputBox.VisibleChanged += new System.EventHandler(this.inputBox_VisibleChanged); }
/// <summary> /// 输入密码,type 为 password;整单打折,type 为 discountOverall;解款打印,type 为 cash /// </summary> /// <param name="type"></param> public InputBox(OrderHandleType type) { InitializeComponent(); this.type = type; }
/// <summary> /// 自定义输入窗口输入框按键绑定,根据 type 绑定确定按钮要打开的窗体 /// </summary> /// <param name="type"></param> private void Keyboard_Input(OrderHandleType type) { TextBox focusing = new TextBox(); focusing = (TextBox)inputBox.Controls.Find("txtInput", false).FirstOrDefault(); //退格 if (keyInput == miniKeyboard.Backspace) { InputValidate.InputBackspace(focusing); } //按确定 else if (keyInput == miniKeyboard.KeyEnter) { if (inputBox.type == OrderHandleType.password) { string pwd = focusing.Text; //根据密码获取主管 sup = new StaffBLL().GetStaffByPwd(pwd); if (sup != null) { inputBox.Hide(); Print prt = new Print(); prt.staff = this.staff; prt.PrintSalesDay(); Log.WriteNormalLog("打印本机当日销售汇总", sup.Staff_name, ""); } else { MessageBox.Show("密码不正确!"); focusing.Text = ""; } } else if (inputBox.type == OrderHandleType.cash) { if (focusing.Text != "") { CashNum[SelectedCash] = Convert.ToInt32(focusing.Text); //对应的数量标签 Label lb = new Label(); lb = (Label)gbCash.Controls.Find("lb" + SelectedCash.Replace(".", ""), true).FirstOrDefault(); lb.Text = "× " + Convert.ToInt32(focusing.Text); Calculate(true); } else { MessageBox.Show("请输入具体数量!"); } inputBox.Hide(); } } //按取消,隐藏商品小窗 else if (keyInput == miniKeyboard.Cancel) { inputBox.Hide(); } //其他键直接输入 else { //不能输入 . 和 X if (!(keyInput == miniKeyboard.Dot || keyInput == miniKeyboard.X)) { if (focusing.SelectedText != "") { focusing.SelectedText = keyInput; } else { focusing.SelectedText += keyInput; } } } //按键完毕,保持焦点 focusing.Focus(); }