Exemplo n.º 1
0
 private void btnPayoff_Click(object sender, EventArgs e)
 {
     foreach (CrystalButton button in payoffButtonList)
     {
         PayoffWay payoffWay = button.Tag as PayoffWay;
         if (payoffWay !=null)
         {
             button.BackColor = dic.ContainsKey(payoffWay.PayoffID.ToString()) ? ConstantValuePool.PressedColor : button.DisplayColor;
         }
     }
     CrystalButton btn = sender as CrystalButton;
     if (btn == null) return;
     curPayoffWay = btn.Tag as PayoffWay;
     if (curPayoffWay == null) return;
     btn.BackColor = ConstantValuePool.PressedColor;
     
     if (curPayoffWay.PayoffType == (int) PayoffWayMode.MembershipCard)
     {
         //屏蔽数字键盘
         this.pnlNumericPad.Enabled = false;
     }
     else
     {
         this.pnlNumericPad.Enabled = true;
     }
     this.txtPayoff.Text = string.Format("{0}(1:{1})", curPayoffWay.PayoffName, curPayoffWay.AsPay.ToString("f2"));
     if (dic.ContainsKey(curPayoffWay.PayoffID.ToString()))
     {
         OrderPayoff orderPayoff = dic[curPayoffWay.PayoffID.ToString()];
         decimal totalPrice = orderPayoff.Quantity * orderPayoff.AsPay;
         if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon)
         {
             this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", orderPayoff.Quantity, totalPrice.ToString("f2"));
         }
         else
         {
             this.txtAmount.Text = string.Format("{0} 元", totalPrice.ToString("f2"));
         }
     }
     else
     {
         if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon)
         {
             this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", "0", "0.00");
         }
         else
         {
             this.txtAmount.Text = string.Format("{0} 元", "0.00");
         }
         if (curPayoffWay.PayoffType == (int)PayoffWayMode.MembershipCard)
         {
             decimal unPaidPrice = decimal.Parse(lbUnpaidAmount.Text.Substring(5));
             if (unPaidPrice > 0)
             {
                 Membership.FormVIPCardPayment formCardPayment = new Membership.FormVIPCardPayment(unPaidPrice);
                 formCardPayment.ShowDialog();
                 if (formCardPayment.CardPaidAmount > 0)
                 {
                     OrderPayoff orderPayoff = new OrderPayoff();
                     orderPayoff.OrderPayoffID = Guid.NewGuid();
                     orderPayoff.OrderID = m_SalesOrder.order.OrderID;
                     orderPayoff.PayoffID = curPayoffWay.PayoffID;
                     orderPayoff.PayoffName = curPayoffWay.PayoffName;
                     orderPayoff.PayoffType = curPayoffWay.PayoffType;
                     orderPayoff.AsPay = curPayoffWay.AsPay;
                     orderPayoff.Quantity = formCardPayment.CardPaidAmount / curPayoffWay.AsPay;
                     if (!string.IsNullOrEmpty(formCardPayment.CardNo))
                     {
                         orderPayoff.CardNo = formCardPayment.CardNo + "#" + formCardPayment.CardPassword;
                     }
                     orderPayoff.EmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID;
                     dic.Add(curPayoffWay.PayoffID.ToString(), orderPayoff);
                 }
                 this.txtAmount.Text = string.Format("{0} 元", formCardPayment.CardPaidAmount.ToString("f2"));
                 DisplayPayoffWay();
             }
         }
     }
     m_InputNumber = "0";
 }
Exemplo n.º 2
0
        private void btnPayoff_Click(object sender, EventArgs e)
        {
            foreach (CrystalButton button in payoffButtonList)
            {
                PayoffWay payoffWay = button.Tag as PayoffWay;
                if (payoffWay != null)
                {
                    button.BackColor = dic.ContainsKey(payoffWay.PayoffID.ToString()) ? ConstantValuePool.PressedColor : button.DisplayColor;
                }
            }
            CrystalButton btn = sender as CrystalButton;

            if (btn == null)
            {
                return;
            }
            curPayoffWay = btn.Tag as PayoffWay;
            if (curPayoffWay == null)
            {
                return;
            }
            btn.BackColor = ConstantValuePool.PressedColor;

            if (curPayoffWay.PayoffType == (int)PayoffWayMode.MembershipCard)
            {
                //屏蔽数字键盘
                this.pnlNumericPad.Enabled = false;
            }
            else
            {
                this.pnlNumericPad.Enabled = true;
            }
            this.txtPayoff.Text = string.Format("{0}(1:{1})", curPayoffWay.PayoffName, curPayoffWay.AsPay.ToString("f2"));
            if (dic.ContainsKey(curPayoffWay.PayoffID.ToString()))
            {
                OrderPayoff orderPayoff = dic[curPayoffWay.PayoffID.ToString()];
                decimal     totalPrice  = orderPayoff.Quantity * orderPayoff.AsPay;
                if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon)
                {
                    this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", orderPayoff.Quantity, totalPrice.ToString("f2"));
                }
                else
                {
                    this.txtAmount.Text = string.Format("{0} 元", totalPrice.ToString("f2"));
                }
            }
            else
            {
                if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon)
                {
                    this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", "0", "0.00");
                }
                else
                {
                    this.txtAmount.Text = string.Format("{0} 元", "0.00");
                }
                if (curPayoffWay.PayoffType == (int)PayoffWayMode.MembershipCard)
                {
                    decimal unPaidPrice = decimal.Parse(lbUnpaidAmount.Text.Substring(5));
                    if (unPaidPrice > 0)
                    {
                        Membership.FormVIPCardPayment formCardPayment = new Membership.FormVIPCardPayment(unPaidPrice);
                        formCardPayment.ShowDialog();
                        if (formCardPayment.CardPaidAmount > 0)
                        {
                            OrderPayoff orderPayoff = new OrderPayoff();
                            orderPayoff.OrderPayoffID = Guid.NewGuid();
                            orderPayoff.OrderID       = m_SalesOrder.order.OrderID;
                            orderPayoff.PayoffID      = curPayoffWay.PayoffID;
                            orderPayoff.PayoffName    = curPayoffWay.PayoffName;
                            orderPayoff.PayoffType    = curPayoffWay.PayoffType;
                            orderPayoff.AsPay         = curPayoffWay.AsPay;
                            orderPayoff.Quantity      = formCardPayment.CardPaidAmount / curPayoffWay.AsPay;
                            if (!string.IsNullOrEmpty(formCardPayment.CardNo))
                            {
                                orderPayoff.CardNo = formCardPayment.CardNo + "#" + formCardPayment.CardPassword;
                            }
                            orderPayoff.EmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID;
                            dic.Add(curPayoffWay.PayoffID.ToString(), orderPayoff);
                        }
                        this.txtAmount.Text = string.Format("{0} 元", formCardPayment.CardPaidAmount.ToString("f2"));
                        DisplayPayoffWay();
                    }
                }
            }
            m_InputNumber = "0";
        }