コード例 #1
0
        /// <summary>
        /// 输入实收金额规范,并计算和显示找零
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtPayCash_TextChanged(object sender, EventArgs e)
        {
            decimal payCash = 0;

            InputValidate.PayInputValidate(txtPayCash);

            if (txtPayCash.TextLength > 0)
            {
                payCash = Convert.ToDecimal(txtPayCash.Text);
            }

            txtPayCash.SelectionStart = txtPayCash.TextLength;

            Change = payCash - Cash;

            if (payCash != 0)
            {
                lbChange.Text = Change.ToString();
            }
            else
            {
                lbChange.Text = "0.0";
            }

            UpdateDisplay();
        }
コード例 #2
0
ファイル: InputBox.cs プロジェクト: leo-xzm/xjgjwl
 //整单打折时,规范输入格式
 private void txtInput_TextChanged(object sender, EventArgs e)
 {
     if (type == OrderHandleType.discountOverall)
     {
         InputValidate.DiscountInputValidate(txtInput);
     }
 }
コード例 #3
0
        public BaseResponse <string> Demo1(InputValidate input)
        {
            var response = new BaseResponse <string>
            {
                Status       = true,
                ErrorMessage = string.Empty,
                Data         = "Success"
            };

            return(response);
        }
コード例 #4
0
        private void txtCardCash_TextChanged(object sender, EventArgs e)
        {
            InputValidate.PayInputValidate(txtCardCash);

            //如果输入的值大于待付金额,就改成待付金额
            if (Convert.ToDecimal(txtCardCash.Text == "" ? "0" : txtCardCash.Text) > MoneyTotal)
            {
                txtCardCash.Text = MoneyTotal.ToString();
            }

            txtCardCash.SelectionStart = txtCardCash.TextLength;
        }
コード例 #5
0
ファイル: frmCash.cs プロジェクト: leo-xzm/xjgjwl
        /// <summary>
        /// 支票输入规范
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtCheck_TextChanged(object sender, EventArgs e)
        {
            InputValidate.CashInputValidate(txtCheck);

            //给支票赋值
            if (txtCheck.Text != "")
            {
                Check = Convert.ToDecimal(txtCheck.Text);
            }

            Calculate(false);
        }
コード例 #6
0
        /// <summary>
        /// 实收现金框按键绑定
        /// </summary>
        /// <param name="focusing"></param>
        private void Keyboard_Input(TextBox focusing)
        {
            if ((!focusing.Focused) && focusing.Text == "0.0")
            {
                focusing.Text = "";
            }

            //退格
            if (keyInput == miniKeyboard.Backspace)
            {
                InputValidate.InputBackspace(focusing);
            }
            else if (keyInput == miniKeyboard.KeyEnter)
            {
                //使用专门的结账按钮
                //Check();
            }
            //按取消,清空输入框
            else if (keyInput == miniKeyboard.Cancel)
            {
                focusing.Text = "";
            }
            //其他键直接输入
            //不能输入 X
            else if (keyInput != miniKeyboard.X)
            {
                //应收现金大于0才可以输入实收现金
                if (Cash != 0)
                {
                    if (focusing.SelectedText != "")
                    {
                        focusing.SelectedText = keyInput;
                    }
                    else
                    {
                        focusing.SelectedText += keyInput;
                    }
                }
            }

            //focusing.SelectionStart = focusing.SelectionStart;
            //按键完毕,保持焦点
            focusing.Focus();
        }
コード例 #7
0
ファイル: frmCash.cs プロジェクト: leo-xzm/xjgjwl
        /// <summary>
        ///输入支票
        /// </summary>
        /// <param name="focusing">当前焦点输入框</param>
        private void Keyboard_CheckInput(TextBox focusing)
        {
            if ((!focusing.Focused) && focusing.Text == "0.00")
            {
                focusing.Text = "";
            }

            //退格
            if (keyInput == miniKeyboard.Backspace)
            {
                InputValidate.InputBackspace(focusing);
            }
            //按确定
            else if (keyInput == miniKeyboard.KeyEnter)
            {
            }
            //按取消,清空输入框
            else if (keyInput == miniKeyboard.Cancel)
            {
                focusing.Text = "";
            }
            //其他键直接输入,不能输入 X
            else if (keyInput != miniKeyboard.X)
            {
                if (focusing.SelectedText != "")
                {
                    focusing.SelectedText = keyInput;
                }
                else
                {
                    focusing.SelectedText += keyInput;
                }
            }

            focusing.SelectionStart = focusing.SelectionStart;
            if (focusing.SelectionStart == 0)
            {
                focusing.SelectionStart = focusing.TextLength;
            }

            //按键完毕,保持焦点
            focusing.Focus();
        }
コード例 #8
0
ファイル: GoodsFrame.cs プロジェクト: leo-xzm/xjgjwl
 /// <summary>
 /// 打折修改,重新计算小计
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtDiscount_TextChanged(object sender, EventArgs e)
 {
     InputValidate.DiscountInputValidate(txtDiscount);
     lbSubtotal.Text = Math.Round(((txtDiscount.Text == "" ? 1 : Convert.ToDecimal(txtDiscount.Text))
                                   * goods.JYJ * goods.JYSL), 2).ToString();
 }
コード例 #9
0
        /// <summary>
        /// 会员卡支付小窗按键绑定
        /// </summary>
        /// <param></param>
        private void Keyboard_mCardPayInput()
        {
            TextBox focusing = (TextBox)mCardPay.Controls.Find("txtCardCash", true).FirstOrDefault();

            if (focusing.Text == "0.0" && (!focusing.Focused))
            {
                focusing.Text = "";
            }

            //退格
            if (keyInput == miniKeyboard.Backspace)
            {
                InputValidate.InputBackspace(focusing);
            }
            else if (keyInput == miniKeyboard.KeyEnter)
            {
                if (focusing.Text == "")
                {
                    MessageBox.Show("请输入支付金额");
                    return;
                }
                else if (Convert.ToDecimal(focusing.Text) == 0)
                {
                    MessageBox.Show("支付金额必须大于零");
                    return;
                }

                //增加员工卡模型,员工卡结算方式编号 "5"
                PayedCard payedCard = new PayedCard("5");
                if (payedCardList != null)
                {
                    payedCard.je = Convert.ToDecimal(focusing.Text);

                    string mdh = ConfigHelper.GetAppConfig("MDH");
                    string jh  = ConfigHelper.GetAppConfig("JH");
                    string xph = GetXPH();

                    //会员卡支付接口
                    string result = CardTran.cardTran(mdh, jh, sell.Membercard, xph, focusing.Text);//提交SVN和生产环境使用(生成Release版本)
                    //string result = "OK";//pos上测试时使用(生成Release版本)
                    //#if DEBUG
                    //            result = "OK";
                    //#endif

                    if (result.Substring(0, 2) == "OK")
                    {
                        //MessageBox.Show("支付成功!");
                        payedCardList.Add(payedCard);

                        if (mName != mCardPay.mName)
                        {
                            mIniBalance = mCardPay.Balance;
                        }

                        mName = mCardPay.mName;

                        mEndBalance = mCardPay.Balance - payedCard.je;

                        Log.WriteNormalLog(mName + " 卡付 " + payedCard.je + "元", "", "");

                        btnReturn.Enabled = false;
                        btnReturn.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show(result);
                        return;
                    }
                }
                else
                {
                    return;
                }

                ////根据标记判断是增加还是修改操作
                //if (isAddorAlter)
                //    payedCardList.Add(payedCard);
                //else
                //    payedCardList[cardIndex] = payedCard;

                dgvCardPay_DataBind();
                mCardPay.Hide();
            }
            //按取消,关闭小窗
            else if (keyInput == miniKeyboard.Cancel)
            {
                mCardPay.Hide();
            }
            //其他键直接输入
            //不能输入 X
            else if (keyInput != miniKeyboard.X)
            {
                if (focusing.SelectedText != "")
                {
                    focusing.SelectedText = keyInput;
                }
                else
                {
                    focusing.SelectedText += keyInput;
                }
            }

            //按键完毕,保持焦点
            focusing.Focus();
        }
コード例 #10
0
        /// <summary>
        /// 支付小窗按键绑定
        /// </summary>
        /// <param></param>
        private void Keyboard_CardInput()
        {
            TextBox focusing = (TextBox)box.Controls.Find("txtCardCash", true).FirstOrDefault();

            if (focusing.Text == "0.0" && (!focusing.Focused))
            {
                focusing.Text = "";
            }

            //退格
            if (keyInput == miniKeyboard.Backspace)
            {
                InputValidate.InputBackspace(focusing);
            }
            else if (keyInput == miniKeyboard.KeyEnter)
            {
                Panel panelCard     = (Panel)box.Controls.Find("panelCard", false).FirstOrDefault();
                Panel panelCardCash = (Panel)box.Controls.Find("panelCardCash", false).FirstOrDefault();
                if (panelCard.Visible)
                {
                    MessageBox.Show("请选择支付方式");
                    return;
                }
                else if (focusing.Text == "" && panelCardCash.Visible)
                {
                    MessageBox.Show("请输入支付金额");
                    return;
                }

                PayedCard payedCard = new PayedCard(box.cardList[box.index]);
                payedCard.je = Convert.ToDecimal(focusing.Text);

                //根据标记判断是增加还是修改操作
                if (isAddorAlter)
                {
                    payedCardList.Add(payedCard);
                }
                else
                {
                    payedCardList[cardIndex] = payedCard;
                }

                dgvCardPay_DataBind();
                box.Hide();
            }
            //按取消,关闭小窗
            else if (keyInput == miniKeyboard.Cancel)
            {
                Panel panelCard     = (Panel)box.Controls.Find("panelCard", false).FirstOrDefault();
                Panel panelCardCash = (Panel)box.Controls.Find("panelCardCash", false).FirstOrDefault();
                //根据面板判断:如果输入支付金额面板显示,就隐藏并显示选择支付方式面板
                //否则说明显示的是选择支付方式面板,取消键直接关闭支付小窗
                if (panelCardCash.Visible)
                {
                    panelCard.Show();
                    box.MoneyTotal = Convert.ToDecimal(box.txtCardCash.Text == "" ? "0" : box.txtCardCash.Text);
                    panelCardCash.Hide();
                }
                else
                {
                    dgvCardPay_DataBind();
                    box.Hide();
                }
            }
            //其他键直接输入
            //不能输入 X
            else if (keyInput != miniKeyboard.X)
            {
                if (focusing.SelectedText != "")
                {
                    focusing.SelectedText = keyInput;
                }
                else
                {
                    focusing.SelectedText += keyInput;
                }
            }

            //按键完毕,保持焦点
            focusing.Focus();
        }
コード例 #11
0
ファイル: frmCash.cs プロジェクト: leo-xzm/xjgjwl
        /// <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();
        }