예제 #1
0
        //验证完全后,统计单元格数据
        private void superGridControl1_CellValidated(object sender, GridCellValidatedEventArgs e)
        {
            GridRow gr = e.GridPanel.Rows[e.GridCell.RowIndex] as GridRow;

            //若是没数据的行则不做处理
            if (gr.Cells["gridColumnid"].Value == null)
            {
                return;
            }
            if (e.GridCell.GridColumn.Name == "gridColumnNumber" ||
                e.GridCell.GridColumn.Name == "gridColumnPrice" ||
                e.GridCell.GridColumn.Name == "gridColumnDis")
            {
                //添加对应的单价和总价
                if (e.GridCell.GridColumn.Name == "gridColumnNumber" &&
                    !string.IsNullOrEmpty(e.GridCell.FormattedValue))
                {
                    _MaterialNumber += decimal.Parse(e.GridCell.FormattedValue);
                }
                if (e.GridCell.GridColumn.Name == "gridColumnPrice" &&
                    !string.IsNullOrEmpty(e.GridCell.FormattedValue))
                {
                    _MaterialMoney += decimal.Parse(e.GridCell.FormattedValue);
                }
                //计算金额
                decimal number   = Convert.ToDecimal(gr.Cells["gridColumnNumber"].FormattedValue);
                decimal dis      = Convert.ToDecimal(gr.Cells["gridColumnDis"].FormattedValue) / 100;
                decimal price    = Convert.ToDecimal(gr.Cells["gridColumnPrice"].FormattedValue);
                decimal disPrice = price * dis;
                decimal allPrice = number * disPrice;
                gr.Cells["gridColumnDisPrice"].Value = disPrice;
                gr.Cells["gridColumnMoney"].Value    = allPrice;
                //逐行统计数据总数
                decimal tempAllNumber = 0;
                decimal tempAllMoney  = 0;
                for (int i = 0; i < superGridControl1.PrimaryGrid.Rows.Count - 1; i++)
                {
                    GridRow tempGR = superGridControl1.PrimaryGrid.Rows[i] as GridRow;
                    tempAllNumber += Convert.ToDecimal(tempGR["gridColumnNumber"].FormattedValue);
                    tempAllMoney  += Convert.ToDecimal(tempGR["gridColumnMoney"].FormattedValue);
                }
                _MaterialMoney  = tempAllMoney;
                _MaterialNumber = tempAllNumber;
                gr = (GridRow)superGridControl1.PrimaryGrid.LastSelectableRow;
                gr["gridColumnNumber"].Value = _MaterialNumber.ToString();
                gr["gridColumnMoney"].Value  = _MaterialMoney.ToString();
                textBoxX3.Text      = _MaterialMoney.ToString();
                labtextboxTop5.Text = _MaterialMoney.ToString();

                //labtextboxTop3.Text = (Convert.ToDecimal(textBoxX3.Text) *
                //(Convert.ToDecimal(textBoxX2.Text) / 100)).ToString();
                labtextboxTop5.Text = (Convert.ToDecimal(textBoxX3.Text) -
                                       Convert.ToDecimal(labtextboxTop3.Text)).ToString();
            }
        }
예제 #2
0
 //验证完全后,统计单元格数据
 private void superGridControl1_CellValidated(object sender, GridCellValidatedEventArgs e)
 {
 }
예제 #3
0
 /// <summary>
 /// Resets the cell level InfoText after successful
 /// cell validation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SuperGridControl1CellValidated(
     object sender, GridCellValidatedEventArgs e)
 {
     e.GridCell.InfoText = null;
 }