| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.Data; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | |
| | | // 初始化表单控件 |
| | | InitializeComponent(); |
| | | |
| | | /* #region 自动汇总beg |
| | | gridView1.Columns["purchaseQty"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; |
| | | gridView1.Columns["yssl"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; |
| | | gridView1.Columns["wssl"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; |
| | | |
| | | gridView1.CustomSummaryCalculate += (sender, e) => |
| | | { |
| | | GridView view = sender as GridView; |
| | | if (e.SummaryProcess == CustomSummaryProcess.Start) |
| | | { |
| | | // 初始化汇总值 |
| | | e.TotalValue = 0m; |
| | | } |
| | | else if (e.SummaryProcess == CustomSummaryProcess.Calculate) |
| | | { |
| | | // 检查当前行的Status字段是否为1 |
| | | int status = Convert.ToInt32(view.GetListSourceRowCellValue(e.RowHandle, "chkInt")); |
| | | if (status == 1) |
| | | { |
| | | string _colCaption = e.Item.ToString(); |
| | | if (_colCaption.Contains("采购")) |
| | | { |
| | | decimal amount = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "purchaseQty")); |
| | | e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount; |
| | | } |
| | | else if (_colCaption.Contains("已收")) |
| | | { |
| | | decimal amount2 = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "yssl")); |
| | | e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount2; |
| | | } |
| | | else if (_colCaption.Contains("未收")) |
| | | { |
| | | decimal amount3 = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "wssl")); |
| | | e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount3; |
| | | } |
| | | } |
| | | } |
| | | else if (e.SummaryProcess == CustomSummaryProcess.Finalize) |
| | | { |
| | | // 设置最终汇总值 |
| | | e.TotalValue = e.TotalValue; |
| | | } |
| | | }; |
| | | |
| | | // 添加复选框变化事件,实时更新汇总 |
| | | gridView1.CellValueChanged += (s, e) => |
| | | { |
| | | if (e.Column.FieldName == "chkInt") |
| | | { |
| | | // 复选框值变化时强制刷新汇总 |
| | | gridView1.UpdateSummary(); |
| | | } |
| | | }; |
| | | #endregion |
| | | */ |
| | | |
| | | // 为GridView的列标题绘制事件添加处理方法,使用自定义绘制 |
| | | this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); }; |
| | | |
| | | // 为GridView的鼠标抬起事件添加处理方法,实现自定义交互 |
| | | // 添加鼠标点击事件处理复选框点击 |
| | | this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); }; |
| | | |
| | | // 配置复选列的排序和筛选选项,禁用排序和筛选功能 |
| | | this.colChkInt.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; |
| | | this.colChkInt.OptionsFilter.AllowAutoFilter = false; |
| | |
| | | { |
| | | getPageList(1); |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |