Esempio n. 1
0
 private void btnDiscount_Click(object sender, EventArgs e)
 {
     if (dgvGoodsOrder.Rows.Count > 0 && 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;
         int itemType = Convert.ToInt32(dgvGoodsOrder.Rows[selectIndex].Cells["ItemType"].Value);
         if (itemType == (int)OrderItemType.Goods)   //主项才能打折
         {
             bool canDiscount = Convert.ToBoolean(dgvGoodsOrder.Rows[selectIndex].Cells["CanDiscount"].Value);
             if (canDiscount)
             {
                 decimal itemPrice = Convert.ToDecimal(dgvGoodsOrder.Rows[selectIndex].Cells["GoodsPrice"].Value);
                 FormDiscount formDiscount = new FormDiscount(DiscountDisplayModel.SingleDiscount, -1, itemPrice);
                 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++)
                         {
                             if (Convert.ToInt32(dgvGoodsOrder.Rows[index].Cells["ItemType"].Value) == (int)OrderItemType.Goods)
                             {
                                 break;
                             }
                             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;
                         }
                     }
                     //统计
                     BindOrderInfoSum();
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private void btnWholeDiscount_Click(object sender, EventArgs e)
 {
     if (dgvGoodsOrder.Rows.Count > 0 && dgvGoodsOrder.CurrentRow != null)
     {
         //权限验证
         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 noDiscountPrice = 0;
         foreach (DataGridViewRow dr in dgvGoodsOrder.Rows)
         {
             bool canDiscount = Convert.ToBoolean(dr.Cells["CanDiscount"].Value);
             if (canDiscount)
             {
                 decimal itemPrice = Convert.ToDecimal(dr.Cells["GoodsPrice"].Value);
                 noDiscountPrice += itemPrice;
             }
         }
         FormDiscount formDiscount = new FormDiscount(DiscountDisplayModel.WholeDiscount, noDiscountPrice, _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];
                 bool canDiscount = Convert.ToBoolean(dr.Cells["CanDiscount"].Value);
                 if (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 itemPrice = Convert.ToDecimal(dr.Cells["GoodsPrice"].Value);
                         decimal discountPrice = itemPrice / noDiscountPrice * discount.OffFixPay;
                         discountPrice = Math.Round(discountPrice, 2);
                         dr.Cells["GoodsDiscount"].Value = -discountPrice;
                         offFixedPay += discountPrice;
                     }
                     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;
             }
             //统计
             BindOrderInfoSum();
         }
     }
 }
Esempio n. 3
0
 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");
     }
 }
Esempio n. 4
0
 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");
                 }
             }
         }
     }
 }
Esempio n. 5
0
 private void btnDiscount_Click(object sender, EventArgs e)
 {
     if (dgvGoodsOrder.RowCount > 0)
     {
         if (m_SalesOrder.order.Status == 3)
         {
             MessageBox.Show("当前处于预结状态,请先解锁!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (m_SalesOrder.order.Status == 0)
         {
             //权限验证
             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 noDiscountPrice = 0;
             foreach (DataGridViewRow dr in dgvGoodsOrder.Rows)
             {
                 OrderDetails orderDetails = dr.Cells["OrderDetailsID"].Tag as OrderDetails;
                 if (orderDetails != null)
                 {
                     Discount itemDiscount = dr.Cells["GoodsDiscount"].Tag as Discount;
                     decimal itemDiscountPrice = Convert.ToDecimal(dr.Cells["GoodsDiscount"].Value);
                     if (orderDetails.CanDiscount && (itemDiscount != null || itemDiscountPrice == 0))
                     {
                         noDiscountPrice += orderDetails.TotalSellPrice;
                     }
                 }
             }
             FormDiscount formDiscount = new FormDiscount(DiscountDisplayModel.WholeDiscount, noDiscountPrice, m_ActualPayMoney);
             formDiscount.ShowDialog();
             if (formDiscount.CurrentDiscount != null)
             {
                 m_MembershipCard = string.Empty;
                 m_MemberDiscountRate = 0M;
                 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)
                     {
                         Discount itemDiscount = dr.Cells["GoodsDiscount"].Tag as Discount;
                         decimal itemDiscountPrice = Convert.ToDecimal(dr.Cells["GoodsDiscount"].Value);
                         if (orderDetails.CanDiscount && (itemDiscount != null || itemDiscountPrice == 0))
                         {
                             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 / noDiscountPrice * 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;
                 }
                 //统计
                 BindOrderInfoSum();
                 this.lbUnpaidAmount.Text = (decimal.Parse(lbReceMoney.Text) + decimal.Parse(lbServiceFee.Text) - decimal.Parse(lbPaidInMoney.Text)).ToString("f2");
                 //更新第二屏信息
                 if (Screen.AllScreens.Length > 1 && ConstantValuePool.BizSettingConfig.SecondScreenEnabled)
                 {
                     if (ConstantValuePool.SecondScreenForm != null && ConstantValuePool.SecondScreenForm is FormSecondScreen)
                     {
                         ((FormSecondScreen)ConstantValuePool.SecondScreenForm).BindGoodsOrderInfo(dgvGoodsOrder);
                         ((FormSecondScreen)ConstantValuePool.SecondScreenForm).ShowOrderServiceFee(m_ActualPayMoney + m_ServiceFee, m_ServiceFee);
                     }
                 }
             }
         }
     }
 }
Esempio n. 6
0
        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");
            }
        }
Esempio n. 7
0
 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");
                 }
             }
         }
     }
 }