public GlobalPKAnalysisView(IPKAnalysisToolTipManager pkAnalysisToolTipManager, IExceptionManager exceptionManager, IImageListRetriever imageListRetriever) { InitializeComponent(); pivotGrid.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown; pivotGrid.ExceptionManager = exceptionManager; _calculateBioAvailabilityRepository = new UxRepositoryItemButtonImage(ApplicationIcons.Run, PKSimConstants.UI.CalculateBioavailability); _calculateDDIRatioRepository = new UxRepositoryItemButtonImage(ApplicationIcons.Run, PKSimConstants.UI.CalculateDDIRatio); _compoundField = new PivotGridField(PKSimConstants.PKAnalysis.Compound, PivotArea.ColumnArea); _parameterField = new PivotGridField(PKSimConstants.PKAnalysis.ParameterName, PivotArea.RowArea); _valueField = new PivotGridField(PKSimConstants.PKAnalysis.Value, PivotArea.DataArea) { SummaryType = PivotSummaryType.Custom }; pivotGrid.AddParameterField(_parameterField); pivotGrid.AddValueField(_valueField); pivotGrid.AddField(_compoundField); pivotGrid.SetParameterDisplay(s => _presenter.DisplayNameFor(s)); pivotGrid.ValueImages = imageListRetriever.AllImages16x16; _columUnitsMenuBinder = new PivotGridUnitsMenuBinder(pivotGrid, _parameterField); _pkAnalysisToolTipManager = pkAnalysisToolTipManager; _warningRepositoryEdit = new RepositoryItemIconTextEdit { ImageList = pivotGrid.ValueImages, ImageIndex = ApplicationIcons.Warning.Index }; }
void ResetField(PivotGridField field, FieldArea area, int areaIndex) { field.Area = area; field.AreaIndex = areaIndex; field.FilterValues.Clear(); field.FilterValues.FilterType = FieldFilterType.Excluded; }
void AddFields() { columnField = pivotGridControl1.Fields.Add("Category", PivotArea.ColumnArea); rowField = pivotGridControl1.Fields.Add("Product", PivotArea.RowArea); rowField.SortMode = PivotSortMode.Custom; dataField = pivotGridControl1.Fields.Add("Count", PivotArea.DataArea); }
private void AdjustPivotSize(PivotGridControl pivot) { PivotGridField columnField = pivot.GetFieldByArea(PivotArea.ColumnArea, 0); PivotGridField rowField = pivot.GetFieldByArea(PivotArea.RowArea, 0); columnField.Width = (pivot.ClientSize.Width - rowField.Width - 5) / numberOfYears; }
private void AssertHeadersFilterButtonVisibilityB183058() { PivotGridControl pivotGrid = FindElement <PivotGridControl>(DemoBaseTesting.CurrentDemoModule); List <FieldHeader> headers = FindAllElements <FieldHeader>(pivotGrid); foreach (FieldHeader header in headers) { PivotGridField field = header.Field; bool fieldFiltered = GetIsFiltered(field); Visibility filterVisibility = fieldFiltered || header.IsMouseOver ? Visibility.Visible : Visibility.Hidden; if (!field.GetInternalField().ShowFilterButton) { filterVisibility = Visibility.Collapsed; } if (filterVisibility != Visibility.Collapsed) { AssertLog.IsTrue(fieldFiltered == field.IsFiltered, "field.IsFiltered " + DemoBaseTesting.CurrentDemoModule.GetType().Name + " " + field.Name + " expected\real:" + fieldFiltered.ToString() + " \\ " + field.IsFiltered.ToString()); } AssertLog.IsTrue(filterVisibility == header.IsFilterButtonVisible, "header.IsFiltered " + DemoBaseTesting.CurrentDemoModule.GetType().Name + " " + field.Name + " expected\real:" + filterVisibility.ToString() + " \\ " + header.IsFilterButtonVisible.ToString()); } }
private void PivotGrid_OnDataSourceChanged(object sender, RoutedEventArgs e) { pivotGrid.RetrieveFields(); foreach (var field in pivotGrid.Fields) { field.Visible = false; field.Caption = field.ToString(); } var dateTimeFields = pivotGrid.Fields.Where(f => f.DataType == typeof(DateTime)).ToList(); foreach (var field in dateTimeFields) { AddGroupInterval(field); } var quantityField = new PivotGridField { Name = QuantityFieldName, UnboundType = FieldUnboundColumnType.Integer, Caption = QuantityFieldName, Area = FieldArea.DataArea }; pivotGrid.Fields.Add(quantityField); }
PivotGridField GetField(string fieldName, string name, PivotArea area) { PivotGridField field = new PivotGridField(fieldName, area); field.Name = name; return(field); }
void SetEditor(PivotGridField field, PivotGridControl sender) { if (field.Area == PivotArea.DataArea && field.DataType.IsPrimitive) { field.FieldEdit = _repositoryItemSpinEdits[sender]; } }
private void init_pivot_grid() { //fieldMaNV = new PivotGridField("MA_NV", PivotArea.RowArea); //fieldMaNV.Caption = "MA_NHAN_VIEN"; //fieldKhuVuc = new PivotGridField("TEN", PivotArea.RowArea); //fieldKhuVuc.Caption = "Khu vực"; //fieldKhuVuc.AreaIndex = 0; fieldTrungTam = new PivotGridField("TEN_PHONG", PivotArea.RowArea); fieldTrungTam.Caption = "Tên trung tâm"; //fieldNgach.AreaIndex = 1; //fieldNghiepVu = new PivotGridField("TEN_NGHIEP_VU", PivotArea.RowArea); //fieldNghiepVu.Caption = "Tên nghiệp vụ"; //fieldNghiepVu.AreaIndex = 2; fieldTenMonHoc = new PivotGridField("TEN_MON_HOC", PivotArea.RowArea); fieldTenMonHoc.Caption = "Tên môn học"; fieldTenMonHoc.AreaIndex = 3; fieldTenTrangThai = new PivotGridField("TEN", PivotArea.ColumnArea); fieldTenTrangThai.Caption = "Trạng thái"; fieldIDNHANSU = new PivotGridField("ID_NHAN_SU",PivotArea.DataArea); fieldIDNHANSU.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Count; fieldIDNHANSU.Caption = "Nhân viên"; pivotGridControl1.Fields.AddRange(new PivotGridField[] { fieldIDNHANSU, fieldTenMonHoc, fieldTenTrangThai }); }
static void OnPivotFieldAreaChanging(object sender, PivotFieldAreaChangingEventArgs e) { PivotGridField field = e.Field; if (field == null || field.Parent as PivotGridControl == null || ((PivotGridControl)field.Parent).OlapConnectionString != null || field.UnboundType != FieldUnboundColumnType.Bound) { return; } if (field.Area == FieldArea.DataArea) { if (e.NewArea != FieldArea.DataArea) { e.Allow = false; } } else { if (e.NewArea == FieldArea.DataArea) { e.Allow = false; } } }
private static void UpdatePivotSelection(PivotGridControl pivot, string fieldName, object value) { PivotGridField field = pivot.Fields[fieldName]; if (field.Area == PivotArea.DataArea || field.Area == PivotArea.FilterArea) { pivot.Cells.Selection = Rectangle.Empty; } int count = field.Area == PivotArea.ColumnArea ? pivot.Cells.ColumnCount : pivot.Cells.RowCount; List <int> range = new List <int>(); for (int i = 0; i < count; i++) { if (Comparer.Default.Compare(value, pivot.GetFieldValue(field, i)) == 0) { range.Add(i); } } if (range.Count == 0) { return; } pivot.Cells.Selection = field.Area == PivotArea.ColumnArea ? new Rectangle(range[0], 0, range.Count, pivot.Cells.RowCount) : new Rectangle(0, range[0], pivot.Cells.ColumnCount, range.Count); ((IPivotGridViewInfoDataOwner)pivot).DataViewInfo.ViewInfo.LeftTopCoord = pivot.Cells.Selection.Location; }
public PKAnalysisPivotView(IPKAnalysisToolTipManager pkAnalysisToolTipManager, IExceptionManager exceptionManager, IImageListRetriever imageListRetriever) { _pkAnalysisToolTipManager = pkAnalysisToolTipManager; InitializeComponent(); pivotGrid.ToolTipController = new ToolTipController(); pivotGrid.ExceptionManager = exceptionManager; var compoundName = new PivotGridField(PKSimConstants.PKAnalysis.Compound, PivotArea.ColumnArea); compoundName.Options.AllowExpand = DefaultBoolean.False; var curveField = new PivotGridField(PKSimConstants.PKAnalysis.CurveName, PivotArea.ColumnArea); curveField.Options.AllowExpand = DefaultBoolean.False; var parameterField = new PivotGridField(PKSimConstants.PKAnalysis.ParameterName, PivotArea.RowArea); _valueField = new PivotGridField(PKSimConstants.PKAnalysis.Value, PivotArea.DataArea) { SummaryType = PivotSummaryType.Custom }; pivotGrid.AddParameterField(parameterField); pivotGrid.AddValueField(_valueField); pivotGrid.AddField(compoundName); pivotGrid.AddField(curveField); pivotGrid.SetParameterDisplay(s => _presenter.DisplayNameFor(s)); pivotGrid.ValueImages = imageListRetriever.AllImages16x16; _columUnitsMenuBinder = new PivotGridUnitsMenuBinder(pivotGrid, parameterField); pivotGrid.PopupMenuShowing += (o, e) => OnEvent(() => onPopupMenuShowing(e)); pivotGrid.CustomCellEdit += (o, e) => OnEvent(onCustomCellEdit, e); _warningRepositoryEdit = new RepositoryItemIconTextEdit { ImageList = pivotGrid.ValueImages, ImageIndex = ApplicationIcons.Warning.Index }; }
bool GetIsFiltered(PivotGridField field) { PivotGridInternalField internalField = field.GetInternalField(); return(((internalField.Group == null || internalField.GroupFilterMode.Equals(DevExpress.XtraPivotGrid.PivotGroupFilterMode.List)) && !internalField.FilterValues.IsEmpty) || field.Group != null && internalField.GroupFilterMode.Equals(DevExpress.XtraPivotGrid.PivotGroupFilterMode.Tree) && !field.Group.FilterValues.IsEmpty); }
PivotGridField CreatePivotGridField(string fieldName, string caption, FieldArea area) { PivotGridField field = new PivotGridField(fieldName, area); field.Caption = caption; return(field); }
string GetFormat(FieldSummaryType fieldSummaryType, PivotGridField field) { if (field == fieldQuantity) { return(""); } switch (fieldSummaryType) { case FieldSummaryType.Average: case FieldSummaryType.Sum: case FieldSummaryType.Custom: case FieldSummaryType.Max: case FieldSummaryType.Min: return("c"); case FieldSummaryType.Count: return(""); case FieldSummaryType.StdDev: case FieldSummaryType.StdDevp: case FieldSummaryType.Var: case FieldSummaryType.Varp: return("p"); } return(string.Empty); }
public PivotGridField CreateColumnAreaNamed(string name) { var field = new PivotGridField(name, PivotArea.ColumnArea); field.Options.AllowExpand = DefaultBoolean.False; return(field); }
public override void InitializeBinding() { pivotGridControl.EditValueChanged += (o, e) => OnEvent(() => handleEditorChanged(e), notifyViewChanged: true); _presenter.RowAreaColumns.Each(columnName => { addField(pivotGridControl.CreateRowAreaNamed(columnName)); }); _presenter.VisibleColumnAreaColumns.Each(columnName => { addField(pivotGridControl.CreateColumnAreaNamed(columnName)); }); _presenter.HiddenColumnAreaColumns.Each(columnName => { addField(pivotGridControl.CreateColumnAreaNamed(columnName), visible: false); }); _valueField = pivotGridControl.CreateDataAreaNamed(_presenter.ValueAreaColumn); addField(_valueField); pivotGridControl.TotalsVisible = false; pivotGridControl.ShowHeaders = false; pivotGridControl.OptionsSelection.MultiSelect = false; var repositoryItemCheckEdit = new RepositoryItemCheckEdit(); pivotGridControl.RepositoryItems.Add(repositoryItemCheckEdit); pivotGridControl.OptionsCustomization.AllowEdit = true; pivotGridControl.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown; _valueField.FieldEdit = repositoryItemCheckEdit; _valueField.Options.AllowEdit = true; repositoryItemCheckEdit.EditValueChanged += (o, e) => OnEvent(() => pivotGridControl.PostEditor()); pivotGridControl.BestFitDataHeaders(considerRowArea: true); _categorialRunModeScreenBinder.Bind(x => x.AllTheSame) .To(chkAllTheSame) .Changed += () => OnEvent(_presenter.AllTheSameChanged, notifyViewChanged: true); }
public override void InitializeResources() { base.InitializeResources(); pivotGridControl.TotalsVisible = false; pivotGridControl.ShowHeaders = false; pivotGridControl.OptionsSelection.MultiSelect = false; var compoundName = new PivotGridField("Compound", PivotArea.RowArea); compoundName.Options.AllowExpand = DefaultBoolean.False; var curveField = new PivotGridField("Calculation Method", PivotArea.ColumnArea); curveField.Options.AllowExpand = DefaultBoolean.False; var categoryField = new PivotGridField("Category", PivotArea.ColumnArea); categoryField.Options.AllowExpand = DefaultBoolean.False; _valueField = new PivotGridField("Value", PivotArea.DataArea) { SummaryType = PivotSummaryType.Max }; pivotGridControl.Fields.Add(_valueField); pivotGridControl.Fields.Add(compoundName); pivotGridControl.Fields.Add(categoryField); pivotGridControl.Fields.Add(curveField); var repositoryItemCheckEdit = new RepositoryItemCheckEdit(); pivotGridControl.RepositoryItems.Add(repositoryItemCheckEdit); pivotGridControl.OptionsCustomization.AllowEdit = true; _valueField.FieldEdit = repositoryItemCheckEdit; _valueField.Options.AllowEdit = true; }
void ItemClick(object sender, EventArgs e) { DXMenuItem item = sender as DXMenuItem; PivotGridField field = item.Tag as PivotGridField; field.SummaryDisplayType = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), item.Caption); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { PivotGridField fieldProductName = ASPxPivotGrid1.Fields["fieldProductName"]; PivotGridField fieldCountry = ASPxPivotGrid1.Fields["fieldCountry"]; ASPxPivotGrid1.BeginUpdate(); try { fieldProductName.FilterValues.Clear(); fieldProductName.FilterValues.Add("Chai"); fieldProductName.FilterValues.Add("Chang"); fieldProductName.FilterValues.Add("Chartreuse verte"); fieldProductName.FilterValues.Add("Ipoh Coffee"); fieldProductName.FilterValues.Add("Aniseed Syrup"); fieldProductName.FilterValues.Add("Genen Shouyu"); fieldProductName.FilterValues.Add("Gula Malacca"); fieldProductName.FilterValues.Add("Vegie-spread"); fieldCountry.FilterValues.Add("UK"); fieldProductName.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; fieldCountry.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; } finally { ASPxPivotGrid1.EndUpdate(); } } }
/// <summary> /// Get the ResultsField associated with a PivotGridField /// </summary> /// <param name="Rf"></param> /// <param name="f0"></param> /// <returns></returns> internal ResultsField GetPivotGridFieldResultsField( PivotGridField pgf) { Query q = Rf.Query; string[] sa = pgf.UnboundFieldName.Split('.'); if (sa.Length < 2) { return(null); } QueryTable qt = q.GetTableByName(sa[0]); if (qt == null) { return(null); } QueryColumn qc = qt.GetQueryColumnByName(sa[1]); if (qc == null) { return(null); } ResultsField rfld = Rf.GetResultsField(qc); return(rfld); }
void InitPivotLayoutSampleOlapDB(AsyncOperationResult result) { PivotGrid.RetrieveFields(FieldArea.FilterArea, false); if (PivotGrid.Fields.Count == 0) { InitializationCompletedCallback.Invoke(null); return; } PivotGrid.BeginUpdate(); PivotGridField fieldProduct = PivotGrid.Fields[CategoryFieldName], fieldYear = PivotGrid.Fields[YearFieldName], fieldTotalCost = PivotGrid.Fields[TotalCostFieldName], fieldFreightCost = PivotGrid.Fields[FreightFieldName], fieldOrderQuantity = PivotGrid.Fields[QuantityOrderFieldName]; PivotGrid.Groups[1].Caption = "Calendar"; PivotGrid.Groups[2].Caption = "Products"; fieldProduct.Area = FieldArea.RowArea; fieldYear.Area = FieldArea.ColumnArea; fieldYear.SortOrder = FieldSortOrder.Descending; fieldTotalCost.Width = DefaultFieldWidth; fieldTotalCost.CellFormat = "c2"; fieldFreightCost.Width = DefaultFieldWidth; fieldFreightCost.CellFormat = "c2"; fieldOrderQuantity.Width = DefaultFieldWidth; fieldProduct.Visible = true; fieldYear.Visible = true; fieldTotalCost.Visible = true; fieldFreightCost.Visible = true; fieldOrderQuantity.Visible = true; PivotGrid.EndUpdateAsync(ExpandAll); }
private void Window_Loaded(object sender, RoutedEventArgs e) { pivotGridControl1.OlapConnectionString = "Provider=msolap;" + "Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" + "Initial Catalog=Adventure Works DW Standard Edition;" + "Cube Name=Adventure Works;"; pivotGridControl1.BeginUpdate(); // Create fields. PivotGridField fieldMeasuresInternetSalesAmount = new PivotGridField("[Measures].[Internet Sales Amount]", FieldArea.DataArea); fieldMeasuresInternetSalesAmount.Caption = "Internet Sales Amount"; PivotGridField fieldCustomerCountryCountry = new PivotGridField("[Customer].[Country].[Country]", FieldArea.RowArea); fieldCustomerCountryCountry.Caption = "Country"; PivotGridField fieldDateFiscalYearFiscalYear = new PivotGridField("[Date].[Fiscal Year].[Fiscal Year]", FieldArea.ColumnArea); fieldDateFiscalYearFiscalYear.Caption = "Fiscal Year"; // Add fields to the PivotGridControl pivotGridControl1.Fields.AddRange(fieldMeasuresInternetSalesAmount, fieldCustomerCountryCountry, fieldDateFiscalYearFiscalYear); pivotGridControl1.EndUpdate(); }
private static string GetLastLevelFieldName(PivotGridControl pivot, PivotGridField field) { PivotGridGroup group = pivot.Groups[field.GroupIndex]; PivotGridFieldBase lastLevelField = group[group.Count - 1]; return(lastLevelField.FieldName); }
private void button1_Click(object sender, EventArgs e) { pivotGridControl1.BeginUpdate(); pivotGridControl1.OptionsPrint.PrintColumnHeaders = DevExpress.Utils.DefaultBoolean.False; pivotGridControl1.OptionsPrint.PrintDataHeaders = DevExpress.Utils.DefaultBoolean.False; pivotGridControl1.OptionsPrint.PrintFilterHeaders = DevExpress.Utils.DefaultBoolean.False; PivotGridField fieldExportHeader = pivotGridControl1.Fields.Add(); fieldExportHeader.Caption = "Export"; fieldExportHeader.Name = "fieldExportHeader"; fieldExportHeader.Area = DevExpress.XtraPivotGrid.PivotArea.ColumnArea; fieldExportHeader.Visible = true; fieldExportHeader.AreaIndex = 0; fieldExportHeader.TotalsVisibility = PivotTotalsVisibility.None; pivotGridControl1.OptionsView.ShowGrandTotalsForSingleValues = true; pivotGridControl1.EndUpdate(); try { pivotGridControl1.ExportToXls(fileName); System.Diagnostics.Process.Start(fileName); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } finally { pivotGridControl1.Fields.Remove(fieldExportHeader); } }
private void PrepareGrid() { // Create a connection object. OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\DevExpress 2009.3\Components\Demos\Data\nwind.mdb"); // Create a data adapter. OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM SalesPerson", connection); // Create and fill a dataset. DataSet sourceDataSet = new DataSet(); adapter.Fill(sourceDataSet, "SalesPerson"); // Assign the data source to the XtraPivotGrid control. pivotGridControl1.DataSource = sourceDataSet.Tables["SalesPerson"]; // Create a row pivot grid field bound to the Country datasource field. PivotGridField fieldCountry = new PivotGridField("Country", PivotArea.RowArea); // Create a row pivot grid field bound to the Sales Person datasource field. PivotGridField fieldCustomer = new PivotGridField("Sales Person", PivotArea.RowArea); fieldCustomer.Caption = "Customer"; // Create a column pivot grid field bound to the OrderDate datasource field. PivotGridField fieldYear = new PivotGridField("OrderDate", PivotArea.ColumnArea); fieldYear.Caption = "Year"; // Group field values by years. fieldYear.GroupInterval = PivotGroupInterval.DateYear; // Create a column pivot grid field bound to the CategoryName datasource field. PivotGridField fieldCategoryName = new PivotGridField("CategoryName", PivotArea.ColumnArea); fieldCategoryName.Caption = "Product Category"; // Create a filter pivot grid field bound to the ProductName datasource field. PivotGridField fieldProductName = new PivotGridField("ProductName", PivotArea.FilterArea); fieldProductName.Caption = "Product Name"; // Create a data pivot grid field bound to the 'Extended Price' datasource field. PivotGridField fieldExtendedPrice = new PivotGridField("Extended Price", PivotArea.DataArea); fieldExtendedPrice.CellFormat.FormatType = FormatType.Numeric; // Specify the formatting setting to format summary values as integer currency amount. fieldExtendedPrice.CellFormat.FormatString = "c0"; // Add the fields to the control's field collection. pivotGridControl1.Fields.AddRange(new PivotGridField[] {fieldCountry, fieldCustomer, fieldCategoryName, fieldProductName, fieldYear, fieldExtendedPrice}); // Arrange the row fields within the Row Header Area. fieldCountry.AreaIndex = 0; fieldCustomer.AreaIndex = 1; // Arrange the column fields within the Column Header Area. fieldCategoryName.AreaIndex = 0; fieldYear.AreaIndex = 1; // Customize the control's look-and-feel via the Default LookAndFeel object. UserLookAndFeel.Default.UseWindowsXPTheme = false; UserLookAndFeel.Default.Style = LookAndFeelStyle.Skin; UserLookAndFeel.Default.SkinName = "Black"; }
/// <summary> /// Width of field changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Grid_FieldWidthChanged(object sender, PivotFieldEventArgs e) { PivotGridField f = GetViewField(e.Field); f.Width = e.Field.Width; return; }
void SyncFields(PivotGridField sourceField, PivotGridField visibleField) { sourceField.Area = visibleField.Area; sourceField.Visible = visibleField.Visible; sourceField.AreaIndex = visibleField.AreaIndex; sourceField.FilterValues.FilterType = visibleField.FilterValues.FilterType; sourceField.FilterValues.Values = visibleField.FilterValues.Values; }
private void Q201_NGForm_Load(object sender, EventArgs e) { percents = pivotGridControl1.Fields.Add(fieldNGItemQty1.FieldName, PivotArea.DataArea); percents.Caption = "占比(行)"; percents.SummaryDisplayType = DevExpress.Data.PivotGrid.PivotSummaryDisplayType.PercentOfRow; percents2 = pivotGridControl1.Fields.Add(fieldNGItemQty1.FieldName, PivotArea.FilterArea); percents2.Caption = "占比(列)"; percents2.SummaryDisplayType = DevExpress.Data.PivotGrid.PivotSummaryDisplayType.PercentOfColumn; }
internal static object[] GetValuesExcluded(PivotGridField field, string[] values) { values = values.OrderBy(v => v).ToArray(); var availableItems = ((Dictionary <string, CustomFilterItem[]>)HttpContext.Current.Session["pivotFilterValues"])[field.ID]; //object[] uniqueValues = field.GetUniqueValues(); object[] valuesExcluded = availableItems.Select(v => v.Value).Where(v => !ContainItem(values, Convert.ToString(v))).ToArray(); return(valuesExcluded); }
public static RepositoryItemCalcEdit FieldCalcEditDec(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int SoThapPhan, decimal Min, decimal Max, bool AllowNULL) { RepositoryItemCalcEdit element = FieldCalcEditInt(Field, FieldName, Caption, VisibleIndex, Min, Max, AllowNULL); ApplyFormatAction.applyElement(element, SoThapPhan); SetSummaryNumFormat(Field, SoThapPhan); return element; }
void PivotGridControl_PopupMenuShowing(object sender, DevExpress.XtraPivotGrid.PopupMenuShowingEventArgs e) { if (e.MenuType == PivotGridMenuType.FieldValue && e.HitInfo.ValueInfo != null) { e.Menu.Items.Add(CreateMenuItem(CreateCaptionForCondition(e.HitInfo.ValueInfo.DataField, true), "Simple")); e.Menu.Items.Add(CreateMenuItem(CreateCaptionForCondition(e.HitInfo.ValueInfo.DataField, false), "Expression")); field = e.HitInfo.ValueInfo.DataField; } }
void beExpression_Click(object sender, System.Windows.RoutedEventArgs e) { PivotGridField newBonus = GetNewInvisibleBonusField(); pivotGrid.Fields.Add(newBonus); pivotGrid.ShowUnboundExpressionEditor(newBonus); beExpression.Text = newBonus.UnboundExpression; pivotGrid.Fields.Remove(newBonus); }
public GroupAllocationReportOld() { InitializeComponent(); string tableName = "REP2"; DataSet ds = new DataSet(); DataTable dt = new DataTable(tableName); ds.Tables.Add(dt); string queryString = "[dbo].[rep_GroupAllocationReport]"; string connectionString = ConfigurationManager.ConnectionStrings["LorealReports.Properties.Settings.LorealConnectionString"].ConnectionString; int rowsCount = -1; using (SqlConnection connection = new SqlConnection(connectionString)) { try { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand(queryString, connection); rowsCount = adapter.Fill(ds, tableName); } catch (SqlException) { } } //this.DataSource = ds; xrPivot.DataSource = ds; bool b = false; foreach (DataColumn dc in ds.Tables[tableName].Columns) { if (dc.ColumnName != "ID" && dc.ColumnName != "ID1") { var col = new PivotGridField() { FieldName = dc.ColumnName, Caption = dc.ColumnName, Area = b ? PivotArea.DataArea : PivotArea.RowArea }; xrPivot.Fields.Add(col); } if (dc.ColumnName == "Multiple") { b = true; } } ParametersRequestSubmit += GroupAllocationReport_ParametersRequestSubmit; }
public static RepositoryItemCalcEdit FieldCalcEdit(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int SoThapPhan) { SetHorzAlignment(Field, HorzAlignment.Far); SetSummaryNumFormat(Field, SoThapPhan); Field.FieldEdit = HelpRepository.GetCalcEdit(SoThapPhan); if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = Caption; Field.Index = VisibleIndex; } return (RepositoryItemCalcEdit)Field.FieldEdit; }
public void init_pivot_grid() { fieldTenMonHoc = new PivotGridField("TEN_MON_HOC", PivotArea.RowArea); fieldTenMonHoc.Caption = "TÊN MÔN HỌC"; fieldTenPhong = new PivotGridField("TEN_TRUNG_TAM", PivotArea.ColumnArea); fieldTenPhong.Caption = "TÊN TRUNG TÂM"; fieldIDNHANVIEN = new PivotGridField("ID", PivotArea.DataArea); fieldIDNHANVIEN.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Count; fieldChucVu = new PivotGridField("CHUC_VU", PivotArea.RowArea); fieldChucVu.Caption = "CHỨC VỤ"; //fieldTenKhuVuc = new PivotGridField("TEN", PivotArea.ColumnArea); //fieldTenKhuVuc.Caption = "Khu vực"; pivotGridControl1.Fields.AddRange(new PivotGridField[] { fieldTenMonHoc, fieldTenPhong, fieldChucVu, fieldIDNHANVIEN }); }
void InitPivotGridAndChart() { string[] products = { "A", "B", "C", "D", "E" }; BindingList<PivotGridDataItem> orders = new BindingList<PivotGridDataItem>(); Random random = new Random(); for (int productIndex = 0; productIndex < products.Length; productIndex++) { string product = products[productIndex]; for (int year = 2010; year < 2012; year++) for (int month = 1; month < 13; month++) { DateTime date = new DateTime(year, month, 1); double price = (double)random.Next(10000) / 100; orders.Add(new PivotGridDataItem(product, price, date)); } } pivotGridControl.DataSource = orders; pivotGridControl.Fields.Add(new PivotGridField("Product", PivotArea.RowArea)); pivotGridControl.Fields.Add(new PivotGridField("Price", PivotArea.DataArea)); PivotGridField yearField = new PivotGridField("Date", PivotArea.ColumnArea); yearField.Caption = "Year"; yearField.GroupInterval = PivotGroupInterval.DateYear; PivotGridField monthField = new PivotGridField("Date", PivotArea.ColumnArea); monthField.Caption = "Month"; monthField.GroupInterval = PivotGroupInterval.DateMonth; pivotGridControl.Fields.Add(yearField); pivotGridControl.Fields.Add(monthField); pivotGridControl.Groups.Add(yearField, monthField); yearField.CollapseAll(); pivotGridControl.OptionsChartDataSource.ProvideDataByColumns = false; pivotGridControl.OptionsChartDataSource.ProvideRowTotals = false; pivotGridControl.OptionsChartDataSource.ProvideRowGrandTotals = false; pivotGridControl.OptionsChartDataSource.ProvideRowCustomTotals = false; pivotGridControl.OptionsChartDataSource.ProvideColumnTotals = false; pivotGridControl.OptionsChartDataSource.ProvideColumnGrandTotals = false; pivotGridControl.OptionsChartDataSource.ProvideColumnCustomTotals = false; pivotGridControl.Cells.Selection = new Rectangle(0, 0, pivotGridControl.Cells.ColumnCount, pivotGridControl.Cells.RowCount); }
public static RepositoryItemCalcEdit FieldCalcEditInt(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, decimal Min, bool AllowNULL) { return FieldCalcEditInt(Field, FieldName, Caption, VisibleIndex, Min, decimal.MaxValue, AllowNULL); }
public static RepositoryItemSpinEdit FieldSpinEditInt(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, decimal Min, decimal Max, bool AllowNULL) { SetHorzAlignment(Field, HorzAlignment.Far); SetSummaryNumFormat(Field, 0); RepositoryItemSpinEdit spinEdit = HelpRepository.GetSpinEdit(-1); Field.FieldEdit = spinEdit; if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = Caption; Field.Index = VisibleIndex; } if ((Min != decimal.MinValue) || (Max != decimal.MaxValue)) { if (Min >= 0) { spinEdit.KeyPress += new KeyPressEventHandler(delegate(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals('-')) { e.Handled = true; } }); } spinEdit.Spin += new SpinEventHandler(delegate(object sender, SpinEventArgs e) { BaseEdit edit = sender as BaseEdit; if (edit.EditValue != null) { try { if (((decimal)edit.EditValue) == Min) { if (!e.IsSpinUp) { e.Handled = true; } } else if ((((decimal)edit.EditValue) == Max) && e.IsSpinUp) { e.Handled = true; } } catch { } } }); spinEdit.ParseEditValue += new ConvertEditValueEventHandler(delegate(object sender, ConvertEditValueEventArgs e) { BaseEdit edit = sender as BaseEdit; if (edit.EditValue == null) { if (!AllowNULL) { e.Value = Min; e.Handled = true; } } else { try { if (((decimal)edit.EditValue) < Min) { e.Value = Min; e.Handled = true; } else if (((decimal)edit.EditValue) > Max) { e.Value = Max; e.Handled = true; ; } } catch { } } }); } return spinEdit; }
public static void SetDateDisplayFormat(PivotGridField Field, string formatStr) { Field.CellFormat.FormatType = DevExpress.Utils.FormatType.DateTime; Field.CellFormat.FormatString = formatStr; }
public static RepositoryItemComboBox FieldVAT(PivotGridField Field, string FieldName, int VisibleIndex) { Field.FieldEdit = HelpRepository.GetCotVAT(); if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = "VAT"; Field.Index = VisibleIndex; } Field.Width = 60; return (RepositoryItemComboBox)Field.FieldEdit; }
private void MenuItemAddNewField_Click(object sender, EventArgs e) { DevExpress.Utils.Menu.DXMenuItem item = (DevExpress.Utils.Menu.DXMenuItem)sender; PivotGridControl pivot = (PivotGridControl)item.Tag; PivotGridField field = new PivotGridField("New Claculated Field", PivotArea.FilterArea); field.UnboundType = DevExpress.Data.UnboundColumnType.Decimal; field.UnboundExpression = "0"; pivot.Fields.Add(field); pgcProperties.SelectedObject = field; dockPanelProperties.ParentPanel.ActiveChild = dockPanelProperties; dockPanelProperties.ParentPanel.ActiveControl = dockPanelProperties; dockPanelProperties.ParentPanel.Show(); dockPanelProperties.ParentPanel.ShowSliding(); }
public static void SetHorzAlignment(PivotGridField Field, HorzAlignment Content) { Field.Appearance.Header.Options.UseTextOptions = true; Field.Appearance.Header.TextOptions.HAlignment = Content; Field.Appearance.Value.Options.UseTextOptions = true; Field.Appearance.Value.TextOptions.HAlignment = Content; }
public static void FieldRepository(PivotGridField Field, string FieldName,string Caption, int VisibleIndex, RepositoryItem Repos, HorzAlignment HorzAlign) { SetHorzAlignment(Field, HorzAlign); Field.FieldEdit = Repos; if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = Caption; Field.Index = VisibleIndex; } }
public static RepositoryItemCheckedComboBoxEdit InitPivotFieldMulti(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int Width, string tableName) { Field.Area = PivotArea.RowArea; Field.AreaIndex = VisibleIndex; Field.Caption = Caption; Field.Width = Width; const string valueField = "ID"; const string displayField = "NAME"; const string fieldSort = "NAME"; var rep = new RepositoryItemCheckedComboBoxEdit(); var ds = HelpDB.getDatabase().LoadDataSet( string.Format("select {0},{1} from {2} order by {3} ", valueField, displayField, tableName, fieldSort), tableName); if (ds == null || ds.Tables.Count == 0) return rep; //if (isReadOnly) //{ // foreach (DataRow row in ds.Tables[0].Rows) // { // rep.Items.Add(row[valueField], row[displayField].ToString(), CheckState.Unchecked, false); // } //} //else rep.DataSource = ds.Tables[0]; rep.ValueMember = valueField; rep.DisplayMember = displayField; rep.ShowButtons = false; rep.TextEditStyle = TextEditStyles.DisableTextEditor; rep.SelectAllItemVisible = false; Field.FieldEdit = rep; Field.FieldName = FieldName; return rep; }
private void UpdateApperance(PivotGridField field) { var apperance = field.Appearance; var area = field.Area; switch (area) { case PivotArea.DataArea: apperance.Header.TextOptions.HAlignment = HorzAlignment.Center; apperance.Header.Options.UseTextOptions = true; break; case PivotArea.ColumnArea: apperance.Value.Font = new Font(apperance.Value.Font, FontStyle.Bold); apperance.Value.TextOptions.HAlignment = HorzAlignment.Center; apperance.Value.Options.UseFont = true; apperance.Value.Options.UseTextOptions = true; break; default: apperance.Value.Options.UseFont = false; apperance.Value.Options.UseTextOptions = false; apperance.Header.Options.UseTextOptions = false; break; } }
public static void SetNumDisplayFormat(PivotGridField Field, int soThapPhan) { Field.CellFormat.FormatType = FormatType.Numeric; Field.CellFormat.FormatString = ApplyFormatAction.GetDisplayFormat(soThapPhan); }
public static RepositoryItemCalcEdit FieldCalcEditInt(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, decimal Min, decimal Max, bool AllowNULL) { SetHorzAlignment(Field, HorzAlignment.Far); SetSummaryNumFormat(Field, 0); RepositoryItemCalcEdit calcEdit = HelpRepository.GetCalcEdit(-1); Field.FieldEdit = calcEdit; if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = Caption; Field.Index = VisibleIndex; } if ((Min != decimal.MinValue) || (Max != decimal.MaxValue)) { if (Min >= 0) { calcEdit.KeyPress += new KeyPressEventHandler(delegate(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals('-')) { e.Handled = true; } }); } calcEdit.ParseEditValue += new ConvertEditValueEventHandler(delegate(object sender, ConvertEditValueEventArgs e) { CalcEdit edit = sender as CalcEdit; if (edit.EditValue == null) { if (!AllowNULL) { e.Value = Min; e.Handled = true; } } else { decimal num = decimal.MinValue; try { num = decimal.Parse(edit.EditValue.ToString()); } catch { return; } if (num < Min) { e.Value = Min; e.Handled = true; } else if (num > Max) { e.Value = Max; e.Handled = true; } } }); } return calcEdit; }
public static void SetSummaryNumFormat(PivotGridField Field, int soThapPhan) { //... }
public static RepositoryItemCheckedComboBoxEdit AddTuyBienCot(BarManager barManager, Bar menuBar, PivotGridField[] choseFields, bool[] defaultCheck) { var repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit { AutoHeight = false, BestFitWidth = 180, Name = "repositoryItemCheckedCotHienThi" }; // // repositoryItemCheckedCotHienThi // // var barEditItemCotHienThi = new BarEditItem { Caption = "&Cột hiển thị", Edit = repositoryItemCheckedCotHienThi, Name = "barEditItemHienThi", PaintStyle = BarItemPaintStyle.CaptionGlyph, Width = 200 }; // // barEditItemCotHienThi // // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new RepositoryItem[] { repositoryItemCheckedCotHienThi }); // menuBar.LinksPersistInfo.Add(new LinkPersistInfo(barEditItemCotHienThi, true)); //Gán các cột vào CheckedComboBox // choseFields = choseFields.OrderBy(f => f.Caption).ToArray(); var checkedListItems = new CheckedListBoxItem[choseFields.Length]; for (int i = 0; i < choseFields.Length; i++) { PivotGridField field = choseFields[i]; var ischeck = defaultCheck[i]; var item = new CheckedListBoxItem(field, field.Caption, ischeck ? CheckState.Checked : CheckState.Unchecked); checkedListItems[i] = item; } var list = checkedListItems.OrderBy(c => c.Description); repositoryItemCheckedCotHienThi.Items.AddRange(list.ToArray()); var checkedItems = list.Where(l => l.CheckState == CheckState.Checked); var text = checkedItems.Aggregate("", (current, item) => current + (" " + item.Description + repositoryItemCheckedCotHienThi.SeparatorChar)); repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; barEditItemCotHienThi.Hint = text.TrimEnd(repositoryItemCheckedCotHienThi.SeparatorChar); barEditItemCotHienThi.EditValue = barEditItemCotHienThi.Hint; //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, CloseUpEventArgs e) { var value = new StringBuilder(); foreach ( CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit). Properties.SeparatorChar. ToString()); ((PivotGridField)item.Value).Visible = true; } else { ((PivotGridField)item.Value).Visible = false; } } var description = value.Length > 0 ? value.ToString().Remove(value.Length - 1) : string.Empty; e.Value = text; barEditItemCotHienThi.Hint = description; }; //Set các cột hiển thị mặc định //if (choseFields != null) //{ // List<string> listDefaultField = new List<string>(choseFields); // StringBuilder displayText = new StringBuilder(); // for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) // { // if (listDefaultField.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())) // { // repositoryItemCheckedCotHienThi.Items[i].CheckState = CheckState.Checked; // displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); // } // } // if (displayText.ToString() != string.Empty) // barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); // repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; // DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); //} return repositoryItemCheckedCotHienThi; }
public static RepositoryItemSpinEdit FieldSpinEditDec(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int SoThapPhan, decimal Min, bool AllowNULL) { return FieldSpinEditDec(Field, FieldName, Caption, VisibleIndex, SoThapPhan, Min, decimal.MaxValue, AllowNULL); }
public static void FieldReadOnlyVAT(PivotGridField Field, string FieldName, int VisibleIndex) { SetHorzAlignment(Field, HorzAlignment.Far); if (FieldName != null) { Field.Area = PivotArea.DataArea; Field.FieldName = FieldName; Field.Caption = "VAT"; Field.Index = VisibleIndex; } Field.Width = 60; }
public static void FieldRow(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int Width) { SetField(Field); Field.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea; Field.AreaIndex = VisibleIndex; Field.Caption = Caption; Field.FieldName = FieldName; Field.Width = Width; }
public static RepositoryItemLookUpEdit InitPivotFieldCombobox(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int Width, string tableName) { Field.Area = PivotArea.RowArea; Field.AreaIndex = VisibleIndex; Field.Caption = Caption; Field.Width = Width; const string valueField = "ID"; const string displayField = "NAME"; const string fieldSort = "NAME"; var rep = new RepositoryItemLookUpEdit(); var ds = HelpDB.getDatabase().LoadDataSet( string.Format("select {0},{1} from {2} order by {3} ", valueField, displayField, tableName, fieldSort), tableName); if (ds == null || ds.Tables.Count == 0) return rep; rep.DataSource = ds.Tables[0]; rep.ValueMember = valueField; rep.DisplayMember = displayField; rep.TextEditStyle = TextEditStyles.DisableTextEditor; Field.FieldEdit = rep; Field.FieldName = FieldName; rep.NullText = ""; return rep; }
public static RepositoryItemCheckedComboBoxEdit AddTuyBienCot(BarManager barManager, Bar menuBar, PivotGridControl pivot,PivotGridField[] choseFields, bool[] defaultCheck) { RepositoryItemCheckedComboBoxEdit repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit(); // // repositoryItemCheckedCotHienThi // repositoryItemCheckedCotHienThi.AutoHeight = false; repositoryItemCheckedCotHienThi.BestFitWidth = 180; repositoryItemCheckedCotHienThi.Name = "repositoryItemCheckedCotHienThi"; // BarEditItem barEditItemCotHienThi = new BarEditItem(); // // barEditItemCotHienThi // barEditItemCotHienThi.Caption = "&Cột hiển thị"; barEditItemCotHienThi.Edit = repositoryItemCheckedCotHienThi; barEditItemCotHienThi.Name = "barEditItem1"; barEditItemCotHienThi.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; barEditItemCotHienThi.Width = 200; // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { repositoryItemCheckedCotHienThi}); // menuBar.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(barEditItemCotHienThi, true)); //Gán các cột vào CheckedComboBox PivotGridField field = null; StringBuilder text = new StringBuilder(); for (int i = 0; i < choseFields.Length; i++) { field = choseFields[i]; if (defaultCheck[i]) { repositoryItemCheckedCotHienThi.Items.Add(field.Name, field.Caption, CheckState.Checked, true); field.Visible = true; text.Append(" " + field.Caption + repositoryItemCheckedCotHienThi.SeparatorChar); } else { repositoryItemCheckedCotHienThi.Items.Add(field.Name, field.Caption, CheckState.Unchecked, true); field.Visible = false; } } repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; barEditItemCotHienThi.EditValue = text.ToString().TrimEnd(repositoryItemCheckedCotHienThi.SeparatorChar); //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, DevExpress.XtraEditors.Controls.CloseUpEventArgs e) { StringBuilder value = new StringBuilder(); foreach (CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == System.Windows.Forms.CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit).Properties.SeparatorChar.ToString()); } } if (value.Length > 0) e.Value = value.ToString().Remove(value.Length - 1); else e.Value = string.Empty; }; //Set các cột hiển thị mặc định //if (choseFields != null) //{ // List<string> listDefaultField = new List<string>(choseFields); // StringBuilder displayText = new StringBuilder(); // for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) // { // if (listDefaultField.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())) // { // repositoryItemCheckedCotHienThi.Items[i].CheckState = System.Windows.Forms.CheckState.Checked; // displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); // } // } // if (displayText.ToString() != string.Empty) // barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); // repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; // DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); //} return repositoryItemCheckedCotHienThi; }
public static bool _setField(FieldPivot fieldPivot, PivotGridField pivotGridField) { if (_checkField(fieldPivot, pivotGridField)) { pivotGridField.FieldName = fieldPivot.FieldName; pivotGridField.Caption = fieldPivot.Caption; pivotGridField.AreaIndex = fieldPivot.VisibleIndex; pivotGridField.Width = fieldPivot.Width; if (fieldPivot.TypeField == TypeField.NgayThang) { if (fieldPivot.FollowGroupField == FollowGroupField.Ngay) pivotGridField.GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.DateDay; else if (fieldPivot.FollowGroupField == FollowGroupField.Thang) pivotGridField.GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.DateMonth; else if (fieldPivot.FollowGroupField == FollowGroupField.Quy) pivotGridField.GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.DateQuarter; else if (fieldPivot.FollowGroupField == FollowGroupField.Nam) pivotGridField.GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.DateYear; } else if (fieldPivot.TypeField == TypeField.So) { pivotGridField.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric; pivotGridField.CellFormat.FormatString = fieldPivot.FormatString; pivotGridField.ValueFormat.FormatString = fieldPivot.FormatString; } else if (fieldPivot.TypeField == TypeField.VND) { pivotGridField.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric; pivotGridField.CellFormat.FormatString = "{0:###,##0}"; pivotGridField.ValueFormat.FormatString = "{0:###,##0}"; } else if (fieldPivot.TypeField == TypeField.USD) { pivotGridField.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric; pivotGridField.CellFormat.FormatString = "c"; pivotGridField.ValueFormat.FormatString = "c"; } return true; } else { return false; } }
private void InitializeFields(IEnumerable<Column> dimensions) { foreach (var dimension in dimensions) { if (dimension.Name == "DIM_ITEMLOC_TRANSITWH" || dimension.Name == "DIM_ITEMLOC_STATUS_OLD") continue; var field = new PivotGridField { FieldName = dimension.Name, Caption = dimension.Desc, Visible = false }; if (dimension.Name.Contains("ITEMLOC")) { field.CellFormat = "{0}"; field.SummaryType = FieldSummaryType.Custom; if (dimension.Name.Contains("NEW")) field.CellTemplate = (DataTemplate)FindResource("CellTemplateRowOriented"); } else if (dimension.Name.Contains("ITEM")) { if (dimension.Name.Equals("DIM_ITEM_DESC")) { field.Width = 350; } } else if (dimension.Name.Contains("LOC")) { } else if (dimension.Name.Contains("MEASURE")) { field.FilterValues.ShowBlanks = true; field.CellFormat = "{0}"; field.SummaryType = FieldSummaryType.Sum; } Fields.Add(field); } }
public static bool _set(PivotGridControl pivotGrid, FieldPivot[] fieldPivots, PivotArea pivotArea) { foreach (FieldPivot field in fieldPivots) { PivotGridField _field = new PivotGridField(); _field.Area = pivotArea; if (!_setField(field, _field)) { PLMessageBox.ShowErrorMessage( (pivotArea == PivotArea.RowArea ? "Row" : (pivotArea == PivotArea.ColumnArea ? "Column" : "Data")) + "Field cấu hình không đúng."); return false; } pivotGrid.Fields.Add(_field); } return true; }
/// <summary> /// DUYVT: Kiểm tra ràng buộc về kiểu dữ liệu cho phép /// _ RowField: Text /// _ ColumnField: Text, DateTime /// _ DataField: Numeric /// </summary> /// <param name="fieldPivot"></param> /// <returns></returns> private static bool _checkField(FieldPivot fieldPivot, PivotGridField pivotGridField) { if (pivotGridField.Area == PivotArea.RowArea && fieldPivot.TypeField == TypeField.VanBan) { return true; } else if (pivotGridField.Area == PivotArea.ColumnArea && (fieldPivot.TypeField == TypeField.VanBan || fieldPivot.TypeField == TypeField.NgayThang)) { return true; } else if ((pivotGridField.Area == PivotArea.DataArea || pivotGridField.Area == PivotArea.FilterArea) && (fieldPivot.TypeField == TypeField.So || fieldPivot.TypeField == TypeField.VND || fieldPivot.TypeField == TypeField.USD)) { return true; } else return false; }
/// <summary> /// Khởi tạo giá trị mặc định /// </summary> /// <param name="Field"></param> private static void SetField(PivotGridField Field) { //... }