Exemplo n.º 1
0
        private void AmountdgOrderInfoSum(DataGridView dgvGoodsOrder, DataGridView dgvGoodsOrderSum)
        {
            dgvGoodsOrderSum.Rows.Clear();
            decimal totalPrice = 0, totalDiscount = 0;

            for (int i = 0; i < dgvGoodsOrder.Rows.Count; i++)
            {
                totalPrice    += Convert.ToDecimal(dgvGoodsOrder.Rows[i].Cells[2].Value);
                totalDiscount += Convert.ToDecimal(dgvGoodsOrder.Rows[i].Cells[3].Value);
            }
            int rowIndex = dgvGoodsOrderSum.Rows.Add(new DataGridViewRow());

            dgvGoodsOrderSum.Rows[rowIndex].Cells[0].Value = "金额合计";
            dgvGoodsOrderSum.Rows[rowIndex].Cells[1].Value = totalPrice;
            if (Math.Abs(totalDiscount) > 0)
            {
                rowIndex = dgvGoodsOrderSum.Rows.Add(new DataGridViewRow());
                dgvGoodsOrderSum.Rows[rowIndex].Cells[0].Value = "折扣合计";
                dgvGoodsOrderSum.Rows[rowIndex].Cells[1].Value = totalDiscount;
            }
            rowIndex = dgvGoodsOrderSum.Rows.Add(new DataGridViewRow());
            dgvGoodsOrderSum.Rows[rowIndex].Cells[0].Value = "实际应付";
            decimal actualSellPrice = CutOffDecimal.HandleCutOff(totalPrice + totalDiscount, ConstantValuePool.SysConfig.IsCutTail, ConstantValuePool.SysConfig.CutTailType, ConstantValuePool.SysConfig.CutTailDigit);

            dgvGoodsOrderSum.Rows[rowIndex].Cells[1].Value = actualSellPrice;
        }
Exemplo n.º 2
0
        private void CalculateOrderPrice()
        {
            decimal totalPrice = 0, totalDiscount = 0;

            for (int i = 0; i < dgvGoodsOrder.Rows.Count; i++)
            {
                OrderDetails orderDetails = dgvGoodsOrder.Rows[i].Cells["OrderDetailsID"].Tag as OrderDetails;
                totalPrice    += orderDetails.ItemQty * orderDetails.SellPrice;
                totalDiscount += Convert.ToDecimal(dgvGoodsOrder.Rows[i].Cells["GoodsDiscount"].Value);
            }
            m_TotalPrice = totalPrice;
            m_Discount   = totalDiscount;
            decimal wholePayMoney  = totalPrice + totalDiscount;
            decimal actualPayMoney = CutOffDecimal.HandleCutOff(wholePayMoney, ConstantValuePool.SysConfig.IsCutTail, ConstantValuePool.SysConfig.CutTailType, ConstantValuePool.SysConfig.CutTailDigit);

            m_ActualPayMoney = actualPayMoney;
            m_CutOff         = wholePayMoney - actualPayMoney;
            if (m_CutServiceFee)
            {
                m_ServiceFee = 0;
            }
            else
            {
                decimal  serviceFee = 0;
                DateTime curTime    = Convert.ToDateTime(DateTime.Now.ToString("T"));
                //时段1服务费
                if (curTime > Convert.ToDateTime(ConstantValuePool.SysConfig.ServiceFeeBeginTime1) && curTime < Convert.ToDateTime(ConstantValuePool.SysConfig.ServiceFeeEndTime1))
                {
                    if (ConstantValuePool.SysConfig.FixedServiceFee1 > 0)
                    {
                        serviceFee = ConstantValuePool.SysConfig.FixedServiceFee1;
                    }
                    if (ConstantValuePool.SysConfig.ServiceFeePercent1 > 0)
                    {
                        decimal tempServiceFee = actualPayMoney * ConstantValuePool.SysConfig.ServiceFeePercent1 / 100;
                        serviceFee = CutOffDecimal.HandleCutOff(tempServiceFee, ConstantValuePool.SysConfig.IsCutTail, ConstantValuePool.SysConfig.CutTailType, ConstantValuePool.SysConfig.CutTailDigit);
                    }
                }
                //时段2服务费
                if (curTime > Convert.ToDateTime(ConstantValuePool.SysConfig.ServiceFeeBeginTime2) && curTime < Convert.ToDateTime(ConstantValuePool.SysConfig.ServiceFeeEndTime2))
                {
                    if (ConstantValuePool.SysConfig.FixedServiceFee2 > 0)
                    {
                        serviceFee = ConstantValuePool.SysConfig.FixedServiceFee2;
                    }
                    if (ConstantValuePool.SysConfig.ServiceFeePercent2 > 0)
                    {
                        decimal tempServiceFee = actualPayMoney * ConstantValuePool.SysConfig.ServiceFeePercent2 / 100;
                        serviceFee = CutOffDecimal.HandleCutOff(tempServiceFee, ConstantValuePool.SysConfig.IsCutTail, ConstantValuePool.SysConfig.CutTailType, ConstantValuePool.SysConfig.CutTailDigit);
                    }
                }
                m_ServiceFee = serviceFee;
            }
        }
Exemplo n.º 3
0
        private void BindOrderInfoSum()
        {
            decimal totalPrice = 0, totalDiscount = 0;

            for (int i = 0; i < dgvItemOrder.Rows.Count; i++)
            {
                totalPrice    += Convert.ToDecimal(dgvItemOrder.Rows[i].Cells["GoodsPrice"].Value);
                totalDiscount += Convert.ToDecimal(dgvItemOrder.Rows[i].Cells["GoodsDiscount"].Value);
            }
            this.lbTotalPrice.Text = totalPrice.ToString("f2");
            this.lbDiscount.Text   = totalDiscount.ToString("f2");
            decimal wholePayMoney  = totalPrice + totalDiscount;
            decimal actualPayMoney = CutOffDecimal.HandleCutOff(wholePayMoney, ConstantValuePool.SysConfig.IsCutTail, ConstantValuePool.SysConfig.CutTailType, ConstantValuePool.SysConfig.CutTailDigit);

            this.lbNeedPayMoney.Text = actualPayMoney.ToString("f2");
        }