public void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { //Ловит номер заявки из грида 2 date = gridView2.GetFocusedDataRow()[1].ToString(); //product = gridView2.GetFocusedDataRow()[3].ToString(); string OwnerID = gridView2.GetFocusedDataRow()[4].ToString(); string RentID = gridView2.GetFocusedDataRow()[0].ToString(); OwnerName = gridView2.GetFocusedDataRow()[3].ToString(); Grid2Id = Convert.ToInt32(RentID); OwnerIDS = Convert.ToInt32(OwnerID); gridControl3.DataSource = null; gridView3.Columns.Clear(); string Search = "exec dbo.Rent_Search_By_Parametrs_2 " + "@Rent_id = '" + Grid2Id.ToString() + "'," + "@Type = " + 1; gridControl3.DataSource = DbConnection.DBConnect(Search); gridView3.Columns[0].Visible = false; GridColumnSummaryItem item3 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Номер В/Ц", "Кол.во={0}"); gridView3.Columns["Номер В/Ц"].Summary.Add(item3); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridView3_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { //Ловит номер вагона из грида 3 string Id = gridView3.GetFocusedDataRow()[1].ToString(); SelectItemRow2 = Convert.ToInt32(Id); gridControl1.DataSource = null; gridView1.Columns.Clear(); string Search = "exec dbo.Rent_Search_By_Parametrs_3 " + "@Car_Num = '" + SelectItemRow2.ToString() + "'"; gridControl1.DataSource = DbConnection.DBConnect(Search); gridView1.Columns[0].Visible = false; gridView1.Columns[6].Visible = false; gridView1.Columns[7].Visible = false; GridColumnSummaryItem item2 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Номер заявки", "Кол.во={0}"); gridView1.Columns["Номер заявки"].Summary.Add(item2); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void customerQuery() { try { string query = @"SELECT CustomerTable.CustomerName, Pickuptable.Pickup_Intersaction_name AS PickUp, Pickuptable_1.Pickup_Intersaction_name AS Destination, CourierTable.CourierName, TicketTable.EstimatedRate FROM(((TicketTable INNER JOIN CustomerTable ON TicketTable.CustomerId = CustomerTable.ID) INNER JOIN Pickuptable ON TicketTable.PickupIntersectionId = Pickuptable.ID) INNER JOIN Pickuptable AS Pickuptable_1 ON TicketTable.DeliverIntersectionId = Pickuptable_1.ID) INNER JOIN CourierTable ON TicketTable.CourierId = CourierTable.ID WHERE(((TicketTable.DeliverStatus) = 'Delivered')) ORDER BY TicketTable.DOC DESC"; string connString = ConfigurationManager.ConnectionStrings["ecourier.Properties.Settings.ecourierDatabaseConnectionString"].ConnectionString; DataTable results = new DataTable(); using (OleDbConnection conn = new OleDbConnection(connString)) { OleDbCommand cmd = new OleDbCommand(query, conn); conn.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); adapter.Fill(results); conn.Close(); } if (results != null && results.Rows.Count > 0) { gridControl.DataSource = results; GridColumnSummaryItem item = gridColumn5.Summary.Add(SummaryItemType.Custom); item.FieldName = "EstimatedRate"; item.DisplayFormat = "{0:n2}"; } } catch (Exception) { } }
private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { if (e.Item is GridColumnSummaryItem) { GridView currentView = sender as GridView; GridColumnSummaryItem summaryItem = e.Item as GridColumnSummaryItem; // Initialization if (e.SummaryProcess == CustomSummaryProcess.Start) { summaryCache[summaryItem.FieldName] = 0; } // Calculation if (e.SummaryProcess == CustomSummaryProcess.Calculate) { bool needsToCalulate = (bool)currentView.GetRowCellValue(e.RowHandle, currentView.Columns["Selected"]); if (needsToCalulate) { summaryCache[summaryItem.FieldName] += Convert.ToInt32(e.FieldValue); } } // Finalization if (e.SummaryProcess == CustomSummaryProcess.Finalize) { e.TotalValue = summaryCache[summaryItem.FieldName]; } } }
private void OrderAddForm_Load(object sender, EventArgs e) { try { GetData(); FillCombobox(); string GetDocStatus = "select ds.Name, u.FIO, h.Invoice from d__RenderedServiceHead h left join dbo.Users u on u.AID = h.ID_USER_INS left join dbo.d__Docstate ds on ds.ID = h.ID_DocState where h.NUM = '" + GetStatus + "'"; DataTable GetDocStatusDT = DbConnection.DBConnect(GetDocStatus); label9.Text = GetDocStatusDT.Rows[0][0].ToString(); label10.Text = GetDocStatusDT.Rows[0][1].ToString(); textBox1.Text = GetDocStatusDT.Rows[0][2].ToString(); dateTimePicker1.Text = GetDate; textEdit1.Visible = false; memoEdit1.Visible = false; simpleButton1.Visible = false; GridColumnSummaryItem Carnumber = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "№ вагона", "{0}"); GridColumnSummaryItem Cost = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Цена", "{0}"); gridView1.Columns["№ вагона"].Summary.Add(Carnumber); gridView1.Columns["Цена"].Summary.Add(Cost); } catch (SqlException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exp) { MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void AddSpinEditColumn( this GridView gridView, string fieldName, string caption, int width, bool isAllowEdit = true, string formatString = "#,###0", SummaryItemType summaryType = SummaryItemType.None, string summaryFormat = "", KeyEventHandler keyDown = null) { RepositoryItemSpinEdit itemCtrl = new RepositoryItemSpinEdit(); itemCtrl.DisplayFormat.FormatString = formatString; itemCtrl.DisplayFormat.FormatType = FormatType.Custom; itemCtrl.EditFormat.FormatString = formatString; itemCtrl.EditFormat.FormatType = FormatType.Custom; itemCtrl.EditMask = formatString; GridColumnSummaryItem summaryItem = new GridColumnSummaryItem(); if (summaryType != SummaryItemType.None) { summaryFormat = string.IsNullOrEmpty(summaryFormat) ? "{0: " + formatString + "}" : summaryFormat; summaryItem = new GridColumnSummaryItem(summaryType, fieldName, summaryFormat); } if (keyDown != null) { itemCtrl.KeyDown += new KeyEventHandler(keyDown); } gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl, summaryItem: summaryItem); }
private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { this.gridControl1.DataSource = null; this.gridControl2.DataSource = null; UserEntity user = this.gridView3.GetFocusedRow() as UserEntity; if (user == null) { return; } DateTime dateBegin = this.dateBegin.EditValue == null ? DateTime.Now : ConvertUtil.ToDatetime(this.dateBegin.EditValue); DateTime dateEnd = this.dateEnd.EditValue == null ? DateTime.Now : ConvertUtil.ToDatetime(this.dateEnd.EditValue); this.gridControl1.DataSource = QueryTransRecords( dateBegin, dateEnd, user.UserCode); this.gridControl2.DataSource = GetPutawayRecords( dateBegin, dateEnd, user.UserCode); if (Grid2Item0 == null) { Grid2Item0 = this.gridView2.Columns[0].Summary.Add(DevExpress.Data.SummaryItemType.Custom); } Grid2Item0.DisplayFormat = string.Format("共 {0} 次", GetPutawayRecordsCount(dateBegin, dateEnd, user.UserCode)); } catch (Exception ex) { MsgBox.Err(ex.Message); } }
private async void LoadTransactions() { var store = await _storeManager.GetById(StoreId); if (store != null) { var user = _userManager.GetByID(store.UserID); lblStoreUser.Text = $@"Store user: { user.FirstName } {user.LastName }"; lblStoreDate.Text = $@"{Convert.ToDateTime(store.DateOpen).ToString("MMM. dd, yyyy hh:mm tt")}"; _transactions = await _saleManager.GetTransactionsByStoreID(StoreId); gridControl1.DataSource = null; foreach (GridColumn column in gridView1.Columns) { GridSummaryItem item = column.SummaryItem; if (item != null) { column.Summary.Remove(item); } } if (_transactions.Any()) { var source = _transactions.Select(m => new GridItem() { Items = m.Items, GrossSales = m.Total, NetSales = m.Net, AmountPaid = m.AmountPaid, Change = m.Change, Date = m.DateTime, Id = m.SaleID, Time = m.DateTime }); gridControl1.DataSource = source; GridColumnSummaryItem item1 = new GridColumnSummaryItem(SummaryItemType.Sum, "GrossSales", "{0:N}"); GridColumnSummaryItem item2 = new GridColumnSummaryItem(SummaryItemType.Sum, "NetSales", "{0:N}"); gridView1.Columns["GrossSales"].Summary.Add(item1); gridView1.Columns["NetSales"].Summary.Add(item2); } //foreach (SaleDTO transaction in _transactions) //{ // ListViewItem lvi = new ListViewItem(transaction.SaleID.ToString()); // lvi.SubItems.Add(transaction.DateStr); // lvi.SubItems.Add(transaction.TimeStr); // lvi.SubItems.Add(transaction.Items); // lvi.SubItems.Add(transaction.Total.ToString("C2").Replace("$", "")); // lvi.SubItems.Add(transaction.Net.ToString("C2").Replace("$", "")); // lvi.SubItems.Add(transaction.AmountPaid.ToString("C2").Replace("$", "")); // lvi.SubItems.Add(transaction.Change.ToString("C2").Replace("$", "")); // lvi.SubItems.Add($@"{ transaction.Firstname } { transaction.Lastname }"); // lvwSales.Items.Add(lvi); // _net += transaction.Net; // _gross += transaction.Total; //} } }
public void AllUserForm_Load(object sender, EventArgs e) { Refreshh(); GridColumnSummaryItem Count = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "AID", "{0}"); gridView1.Columns["AID"].Summary.Add(Count); }
//AppearanceDefault amountCostTempSumAppr = new AppearanceDefault(Color.Black, Color.Empty, new Font(AppearanceObject.DefaultFont, FontStyle.Bold)); //Rectangle amountCostSummaryBound; //string amountCostSummaryText; //private void orderDetailGridView_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e) //{ //} private void orderDetailGridView_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { GridColumnSummaryItem customSummaryItem = e.Item as GridColumnSummaryItem; vp100kgInWIR = currentOrder.OilPrice * currentOrder.WIRFactor; vp100kgInWIR = Math.Round(vp100kgInWIR, 2, MidpointRounding.AwayFromZero); //vp100kgInWIR = vp100kgInWIR + GetOrderDetailsPrice(); //if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate) //{ // //amountCostTemp = parentOrder.OilPrice + GetOrderDetailPrice(); //} if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) { //summary column 1 if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col1Row1.Key) { currentOrder.AdditionalCosts = Convert.ToDecimal(e.TotalValue); currentOrder.Total2CashPrice = currentOrder.Total2CashPrice + currentOrder.AdditionalCosts + +currentOrder.UnloadCost; e.TotalValue = GetOrderDetailsPrice(); } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col1Row2.Key) { e.TotalValue = GetUnloadPlaceCost(); } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col1Row3.Key) { e.TotalValue = vp100kgInWIR; } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col1Row4.Key) { e.TotalValue = currentOrder.OilPrice; } //summary column2 if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col2Row1.Key) { currentOrder.Total1Price = GetTotalIPrice(); currentOrder.Total2CashPrice = GetTotalIIPrice() + GetUnloadPlaceCost() + currentOrder.AdditionalCosts; e.TotalValue = currentOrder.Total1Price + currentOrder.Total2CashPrice; } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col2Row2.Key) { e.TotalValue = (GetTotalIPrice() + (GetTotalIIPrice() + GetUnloadPlaceCost() + currentOrder.AdditionalCosts)) / 2; } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col2Row3.Key) { e.TotalValue = GetTotalIIPrice() + GetUnloadPlaceCost() + currentOrder.AdditionalCosts; } else if (customSummaryItem.FieldName == OilOrderDetailSummaryColumnCategory.Col2Row4.Key) { e.TotalValue = GetTotalIPrice(); } } }
private async void PopulateListview(string search = "") { var items = await _storeManager.GetStoreProductsByStoreID(Global.Store.StoreID); gridControl1.DataSource = null; foreach (GridColumn column in gridView1.Columns) { GridSummaryItem item = column.SummaryItem; if (item != null) { column.Summary.Remove(item); } } if (items.Any()) { var source = items.Select(m => new FrmStoreGridItem { Quantity = m.Quantity, Name = m.Name, Id = m.StoreProductID, Left = m.UnitsLeft, Price = m.SalesPrice, Sold = m.UnitsSold, TotalPriceLeft = m.TotalPriceLeft, TotalPriceSold = m.TotalPriceSold }); gridControl1.DataSource = source; GridColumnSummaryItem item3 = new GridColumnSummaryItem(SummaryItemType.Sum, "TotalPriceSold", "{0:N}"); GridColumnSummaryItem item5 = new GridColumnSummaryItem(SummaryItemType.Sum, "TotalPriceLeft", "{0:N}"); gridView1.Columns["TotalPriceSold"].Summary.Add(item3); gridView1.Columns["TotalPriceLeft"].Summary.Add(item5); } //if (!string.IsNullOrWhiteSpace(search)) //{ // items.RemoveAll(m => !m.Name.ToLower().Contains(search.ToLower())); //} //listView1.Items.Clear(); //if (items.Any()) //{ // foreach(var item in items) // { // var lvi = new ListViewItem(item.StoreProductID.ToString()); // lvi.SubItems.Add(item.Name); // lvi.SubItems.Add(item.Code); // lvi.SubItems.Add(item.SalesPrice.ToString("C2").Replace("$","")); // lvi.SubItems.Add(item.Quantity.ToString()); // lvi.SubItems.Add(item.UnitsSold.ToString()); // lvi.SubItems.Add(item.TotalPriceSold.ToString("C2").Replace("$", "")); // lvi.SubItems.Add(item.UnitsLeft.ToString()); // lvi.SubItems.Add(item.TotalPriceLeft.ToString("C2").Replace("$", "")); // listView1.Items.Add(lvi); // } //} }
private void gvMain_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Summary) { sumItem = e.HitInfo.FooterCell.SummaryItem as GridColumnSummaryItem; DXMenuItem item = new DXMenuItem("Copy to clipboard"); e.Menu.Items.Add(item); item.Click += new EventHandler(item_Click); } }
private void gridView2_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { GridColumnSummaryItem customSummaryItem = e.Item as GridColumnSummaryItem; if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) { //summary column 1 if (customSummaryItem.FieldName == "Col1Row1") { e.TotalValue = _MarginCalculation.GetMarginSummarize(_Model); } } }
private void Refreshh() { string Refreshh = "exec dbo.GetUser"; DataTable dt = DbConnection.DBConnect(Refreshh); gridControl1.DataSource = dt; gridView1.Columns[0].Visible = false; gridView1.Columns[1].Visible = false; GridColumnSummaryItem Count = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Имя", "{0}"); gridView1.Columns["Имя"].Summary.Add(Count); }
private void ServiceCostForm_Load(object sender, EventArgs e) { try { if (role == "1") { Btn_Add.Enabled = true; Btn_Updt.Enabled = true; Btn_Delete.Enabled = true; Btn_Refresh.Enabled = true; } else { if (role == "2") { Btn_Add.Enabled = true; Btn_Updt.Enabled = true; Btn_Delete.Enabled = false; Btn_Refresh.Enabled = true; } else { Btn_Add.Enabled = true; Btn_Updt.Enabled = true; Btn_Delete.Enabled = true; Btn_Refresh.Enabled = true; } } string Reffresh = "exec dbo.GetServiceCost"; DataTable dataTable = new DataTable(); dataTable = DbConnection.DBConnect(Reffresh); gridControl1.DataSource = dataTable; gridView1.Columns[0].Visible = false; gridView1.Columns[2].Visible = false; GridColumnSummaryItem Service = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Услуга", "Кол-во: {0}"); GridColumnSummaryItem Cost = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Цена", "{0}"); gridView1.Columns["Услуга"].Summary.Add(Service); gridView1.Columns["Цена"].Summary.Add(Cost); } catch (SqlException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exp) { MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void AddColumn( this GridView gridView, string fieldName, string caption, int width, bool?isAllowEdit = null, bool fixedWidth = true, HorzAlignment textAlignment = HorzAlignment.Default, RepositoryItem itemCtrl = null, GridColumnSummaryItem summaryItem = null) { GridColumn col = new GridColumn { Caption = caption, Name = fieldName, FieldName = fieldName, Visible = true }; if (width > 0) { col.Width = width; } if (isAllowEdit != null) { col.OptionsColumn.AllowEdit = isAllowEdit.Value; } col.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; col.AppearanceHeader.Options.UseTextOptions = true; col.OptionsColumn.FixedWidth = fixedWidth; col.AppearanceCell.TextOptions.HAlignment = textAlignment; col.AppearanceCell.Options.UseTextOptions = true; if (itemCtrl != null) { col.ColumnEdit = itemCtrl; } // Add Summary Item if (summaryItem != null) { col.Summary.Add(summaryItem); } gridView.Columns.Add(col); }
public static void AddColumn( this BandedGridView gridView, string fieldName, string caption, int width, bool isAllowEdit = false, bool fixedWidth = true, HorzAlignment textAlignment = HorzAlignment.Default, RepositoryItem itemCtrl = null, GridColumnSummaryItem summaryItem = null) { BandedGridColumn col = new BandedGridColumn { Caption = caption, Name = fieldName, FieldName = fieldName, Visible = true }; col.OptionsColumn.ShowCaption = !string.IsNullOrEmpty(caption); if (width > 0) { col.Width = width; } col.OptionsColumn.ReadOnly = !isAllowEdit; col.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; col.AppearanceHeader.Options.UseTextOptions = true; col.OptionsColumn.FixedWidth = fixedWidth; col.OptionsColumn.AllowSize = false; col.AppearanceCell.TextOptions.HAlignment = textAlignment; col.AppearanceCell.Options.UseTextOptions = true; if (itemCtrl != null) { col.ColumnEdit = itemCtrl; } // Add Summary Item if (summaryItem != null) { col.Summary.Add(summaryItem); } gridView.Columns.Add(col); }
/// <summary> /// 設定column Summary (如果沒有該column也不會出錯) /// </summary> /// <param name="gv"></param> /// <param name="showColFieldName">要在哪個欄位顯示Summary Value</param> /// <param name="summaryFieldName">要Summary 哪個欄位</param> /// <param name="DisplayFormat"></param> /// <param name="summaryItemType"></param> public static void SetGridSummary(this DevExpress.XtraGrid.Views.Grid.GridView gv, string showColFieldName, string summaryFieldName, string DisplayFormat, SummaryItemType summaryItemType) { if (gv.Columns[showColFieldName] != null && gv.Columns[summaryFieldName] != null) { GridColumnSummaryItem columnSummary = new GridColumnSummaryItem(); columnSummary.FieldName = summaryFieldName; columnSummary.SummaryType = summaryItemType; columnSummary.DisplayFormat = DisplayFormat; gv.Columns[showColFieldName].Summary.Add(columnSummary); } }
private new void Refresh() { gridControl1.DataSource = null; gridView1.Columns.Clear(); string GetCarriage = "Select dc.ID, dc.CarNumber [№ Вагона],dc.AXIS [Осность],do.ID [OwnerID], do.Name [Наименование],do.FullName [Полное наименование], dc.Current_owner[Текущий собственник] From d__Carriage dc Left Join d__Owner do on do.ID = dc.Owner_ID"; DataTable dataTable = DbConnection.DBConnect(GetCarriage); gridControl1.DataSource = dataTable; gridView1.Columns[0].Visible = false; gridView1.Columns[3].Visible = false; GridColumnSummaryItem item1 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Количество", "Кол.во={0}"); gridView1.Columns["№ Вагона"].Summary.Add(item1); }
//Обновление public void RefreshGrid() { gridControl1.DataSource = null; gridView1.Columns.Clear(); string Refresh = "exec Get_MultiCar '" + User_ID + "'"; dt = DbConnection.DBConnect(Refresh); gridControl1.DataSource = dt; gridView1.Columns[0].Visible = false; gridView1.Columns[3].Visible = false; GridColumnSummaryItem Carnumber = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "Номер вагона", "Кол.во: {0}"); gridView1.Columns["Номер вагона"].Summary.Add(Carnumber); }
public static void AddColumn( this GridView gridView, ColumnInfo column, bool isAllowEdit = false, bool fixedWidth = true, HorzAlignment textAlignment = HorzAlignment.Default, RepositoryItem itemCtrl = null, GridColumnSummaryItem summaryItem = null) { gridView.AddColumn(column.FieldName, column.Caption, column.Width, isAllowEdit: isAllowEdit, fixedWidth: fixedWidth, textAlignment: textAlignment, itemCtrl: itemCtrl, summaryItem: summaryItem); }
private void TedarikciDegerlendirme_Load(object sender, EventArgs e) { if (firma == "" || firma == null) { firmasec(); listele(); } else { combo_firma.Text = firma; firmabul(); listele(); } GridColumnSummaryItem item2 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Puan", "Toplam={0}"); gridView1.Columns["Puan"].Summary.Add(item2); }
private void bandedGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { if (e.SummaryProcess == CustomSummaryProcess.Start) { //InitStartValue(); } if (e.SummaryProcess == CustomSummaryProcess.Calculate) { try { GridColumnSummaryItem _obj = e.Item as GridColumnSummaryItem; string _fName = _obj.FieldName; e.TotalValue = CurrentValues[_fName]; } catch { e.TotalValue = ""; } } }
private void StokDetay_Load(object sender, EventArgs e) { detaybul(); yetkibul(); if (yetki == 2) { listele2(); sertbul2(); } else { listele(); sertbul(); } GridColumnSummaryItem item2 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Miktar", "Toplam={0}"); gridView1.Columns["Miktar"].Summary.Add(item2); }
private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) { decimal tut, tutOdm, tutVde; if (e.IsGroupSummary) { GridGroupSummaryItem itm = (GridGroupSummaryItem)e.Item; tut = Convert.ToDecimal(gridView1.GetRowSummaryItem(e.GroupRowHandle, colTOPTUT).Value); tutOdm = Convert.ToDecimal(gridView1.GetRowSummaryItem(e.GroupRowHandle, colTOPTUTXODMGUN).Value); tutVde = Convert.ToDecimal(gridView1.GetRowSummaryItem(e.GroupRowHandle, colTOPTUTXVDEGUN).Value); if (itm.FieldName == "ORTVDEGUN") { e.TotalValue = Math.Round(tutVde / tut, 0); } else if (itm.FieldName == "ORTODMGUN") { e.TotalValue = Math.Round(tutOdm / tut, 0); } } else if (e.IsTotalSummary) { GridColumnSummaryItem itm = (GridColumnSummaryItem)e.Item; tut = Convert.ToDecimal(colTOPTUT.SummaryItem.SummaryValue); tutOdm = Convert.ToDecimal(colTOPTUTXODMGUN.SummaryItem.SummaryValue); tutVde = Convert.ToDecimal(colTOPTUTXVDEGUN.SummaryItem.SummaryValue); if (tut != 0) { if (itm.FieldName == "ORTVDEGUN") { e.TotalValue = Math.Round(tutVde / tut, 0); } else if (itm.FieldName == "ORTODMGUN") { e.TotalValue = Math.Round(tutOdm / tut, 0); } } } } }
private async void GetStoresByDateRange() { stores = await _storeManager.GetStoresByDateRange(this.dateFrom, this.dateTo); selectedStoreId = 0; gridControl1.DataSource = null; foreach (GridColumn column in gridView1.Columns) { GridSummaryItem item = column.SummaryItem; if (item != null) { column.Summary.Remove(item); } } if (stores.Any()) { var source = stores.Select(m => new BrowseStoreGridItem { StoreId = m.StoreId, User = m.Firstname + " " + m.Lastname, NetSales = m.NetSales, GrossSales = m.TotalSales, DateOpened = m.DateOpen }); gridControl1.DataSource = source; GridColumnSummaryItem item1 = new GridColumnSummaryItem(SummaryItemType.Sum, "GrossSales", "{0:N}"); gridView1.Columns["GrossSales"].Summary.Add(item1); GridColumnSummaryItem item2 = new GridColumnSummaryItem(SummaryItemType.Sum, "NetSales", "{0:N}"); gridView1.Columns["NetSales"].Summary.Add(item2); } //foreach (var store in stores) //{ // ListViewItem lvi = new ListViewItem(store.StoreId.ToString()); // lvi.SubItems.Add(store.DateOpen.ToString("MMM. dd hh:mm tt")); // lvi.SubItems.Add(store.Firstname + " " + store.Lastname); // lvi.SubItems.Add($@"{ store.TotalSales.ToString("C2").Replace("$", "") }"); // lvi.SubItems.Add($@"{ store.NetSales.ToString("C2").Replace("$", "") }"); // lvwStores.Items.Add(lvi); //} }
private void SnoImplForm_Load(object sender, EventArgs e) { if (role == "1") { button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; } else { if (role == "2") { button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; } else { button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; } } GetSNO(); GridColumnSummaryItem Capacity = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Объем", "{0}"); GridColumnSummaryItem Cost = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Цена", "{0}"); GridColumnSummaryItem SumOutVat = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Сумма, без НДС", "{0}"); GridColumnSummaryItem SumVat = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Сумма, с НДС", "{0}"); gridView1.Columns["Объем"].Summary.Add(Capacity); gridView1.Columns["Цена"].Summary.Add(Cost); gridView1.Columns["Сумма, без НДС"].Summary.Add(SumOutVat); gridView1.Columns["Сумма, с НДС"].Summary.Add(SumVat); }
private void SnoComForm_Load(object sender, EventArgs e) { if (role == "1") { button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; } else { if (role == "2") { button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; } else { button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; } } GetSNO(); GridColumnSummaryItem CapacitySum = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Остаток", "{0}"); GridColumnSummaryItem FirstContainerSum = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Резервуар № 1", "{0}"); GridColumnSummaryItem SecondContainerSum = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "Резервуар № 2", "{0}"); gridView1.Columns["Остаток"].Summary.Add(CapacitySum); gridView1.Columns["Резервуар № 1"].Summary.Add(FirstContainerSum); gridView1.Columns["Резервуар № 2"].Summary.Add(SecondContainerSum); }
/// <summary> /// /// </summary> /// <param name="gridView"></param> /// <param name="fieldName"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="isAllowEdit"></param> /// <param name="formatString"></param> /// <param name="summaryType"></param> /// <param name="summaryFormat"></param> public static void AddSpinEditColumn( this GridView gridView, string fieldName, string caption, int width, bool isAllowEdit = true, string formatString = "###,###,###,###,##0", SummaryItemType summaryType = SummaryItemType.None, string summaryFormat = "", string editFormat = "##############0", FormatType formatType = FormatType.Custom) { RepositoryItemSpinEdit itemCtrl = new RepositoryItemSpinEdit(); itemCtrl.DisplayFormat.FormatString = formatString; itemCtrl.DisplayFormat.FormatType = formatType; itemCtrl.EditFormat.FormatString = editFormat; itemCtrl.EditFormat.FormatType = formatType; //Edit phải set # như vầy: ###,###,###,###,##0 itemCtrl.EditMask = editFormat; if (!isAllowEdit) { itemCtrl.Buttons[0].Visible = false; } GridColumnSummaryItem summaryItem = new GridColumnSummaryItem(); if (summaryType != SummaryItemType.None) { summaryFormat = string.IsNullOrEmpty(summaryFormat) ? "{0: " + formatString + "}" : summaryFormat; summaryItem = new GridColumnSummaryItem(summaryType, fieldName, summaryFormat); } gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl, summaryItem: summaryItem); }
private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) { GridColumnSummaryItem item = e.Item as GridColumnSummaryItem; GridView view = sender as GridView; if (Equals("Count", item.Tag)) { if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start) { validRowCount = 0; } if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate) { if (!Convert.ToBoolean(view.GetRowCellValue(e.RowHandle, "Discontinued"))) { validRowCount++; } } if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) { e.TotalValue = validRowCount; } } }