protected override void LoadDataIntoGridDetail(string refId) { var buTransfer = _model.GetBUTransferVoucher(refId, true); if (buTransfer == null) { return; } bindingSourceDetail.DataSource = buTransfer.BUTransferDetailPurchases.OrderBy(c => c.SortOrder).ToList(); gridViewDetail.PopulateColumns(buTransfer.BUTransferDetailPurchases); ColumnsCollection.Add(new XtraColumn { ColumnName = "InventoryItemId", ColumnCaption = "Mã VT,HH", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 1, AllowEdit = true, RepositoryControl = _gridLookUpEditInventoryItem }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Description", ColumnCaption = "Diễn giải", ColumnVisible = true, ColumnWith = 250, ColumnPosition = 2 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "StockId", ColumnCaption = "Kho", ColumnVisible = true, ColumnWith = 150, ColumnPosition = 3, AllowEdit = true, RepositoryControl = _gridLookUpEditStock }); ColumnsCollection.Add(new XtraColumn { ColumnName = "DebitAccount", ColumnCaption = "TK nợ", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 4, AllowEdit = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "CreditAccount", ColumnCaption = "TK có", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 5, AllowEdit = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Unit", ColumnCaption = "ĐVT", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 6, AllowEdit = true, }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Quantity", ColumnCaption = "Số lượng", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 7, AllowEdit = true, IsNumeric = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "UnitPrice", ColumnCaption = "Đơn giá", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 8, AllowEdit = true, IsNumeric = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Amount", ColumnCaption = "Thành tiền", ColumnVisible = true, ColumnWith = 120, ColumnPosition = 9, AllowEdit = true, IsNumeric = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "TaxAmount", ColumnCaption = "Giá trị nhập kho", ColumnVisible = true, ColumnWith = 150, ColumnPosition = 10, AllowEdit = true, IsNumeric = true }); XtraColumnCollectionHelper <BUTransferDetailPurchaselModel> .ShowXtraColumnInGridView(ColumnsCollection, gridViewDetail); }
protected override void LoadDataIntoGridDetail(string refId) { var buTransfer = _model.GetBUTransferVoucher(refId, true); if (buTransfer == null) { return; } bindingSourceDetail.DataSource = buTransfer.BUTransferDetailFixedAssets.OrderBy(c => c.SortOrder).ToList(); gridViewDetail.PopulateColumns(buTransfer.BUTransferDetailFixedAssets); var columnsCollection = new List <XtraColumn>(); ColumnsCollection.Add(new XtraColumn { ColumnName = "Description", ColumnVisible = true, ColumnWith = 320, ColumnCaption = "Diễn giải", ColumnPosition = 1, }); ColumnsCollection.Add(new XtraColumn { ColumnName = "DebitAccount", ColumnVisible = true, ColumnWith = 100, ColumnCaption = "TK Nợ", ColumnPosition = 2 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "CreditAccount", ColumnVisible = true, ColumnWith = 100, ColumnCaption = "TK Có", ColumnPosition = 3 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Amount", ColumnVisible = true, ColumnWith = 120, ColumnCaption = "Số tiền", ColumnPosition = 4, IsNumeric = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = "BudgetSourceId", ColumnVisible = true, ColumnWith = 200, ColumnCaption = "Nguồn", ColumnPosition = 5, RepositoryControl = _gridLookUpEditBudgetSource }); ColumnsCollection.Add(new XtraColumn { ColumnName = "BudgetChapterCode", ColumnVisible = true, ColumnWith = 150, ColumnCaption = "Chương", ColumnPosition = 6 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "BudgetSubKindItemCode", ColumnVisible = true, ColumnWith = 150, ColumnCaption = "Khoản", ColumnPosition = 7 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "BudgetSubItemCode", ColumnVisible = true, ColumnWith = 150, ColumnCaption = "Tiểu mục", ColumnPosition = 8 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "BudgetItemCode", ColumnVisible = true, ColumnWith = 150, ColumnCaption = "Mục", ColumnPosition = 9 }); XtraColumnCollectionHelper <BUTransferDetailFixedAssetlModel> .ShowXtraColumnInGridView(ColumnsCollection, gridViewDetail); }
protected override void LoadDataIntoGridDetail(string refId) { var pUInvoice = _model.GetPUInvoice(refId, true); if (pUInvoice == null) { return; } var source = pUInvoice.PUInvoiceDetailFixedAssets ?? new List <PUInvoiceDetailFixedAssetModel>(); bindingSourceDetail.DataSource = source.OrderBy(c => c.SortOrder).ToList();; gridViewDetail.PopulateColumns(source); var columnsCollection = new List <XtraColumn>(); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.FixedAssetId), ColumnVisible = true, ColumnWith = 150, ColumnCaption = "Mã tài sản", ColumnPosition = 1, RepositoryControl = _gridLookUpEditFixedAsset }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.Description), ColumnVisible = true, ColumnWith = 320, ColumnCaption = "Diễn giải", ColumnPosition = 2, }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.DepartmentId), ColumnVisible = true, ColumnWith = 200, ColumnCaption = "Phòng ban", ColumnPosition = 3, RepositoryControl = _gridLookUpEditDepartment }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.DebitAccount), ColumnVisible = true, ColumnWith = 100, ColumnCaption = "TK Nợ", ColumnPosition = 4 }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.CreditAccount), ColumnVisible = true, ColumnWith = 100, ColumnCaption = "TK Có", ColumnPosition = 5 }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.Amount), ColumnVisible = true, ColumnWith = 120, ColumnCaption = "Số tiền", ColumnPosition = 6, IsNumeric = true }); ColumnsCollection.Add(new XtraColumn { ColumnName = nameof(PUInvoiceDetailFixedAssetModel.BankAccount), ColumnVisible = true, ColumnWith = 200, ColumnCaption = "Tài khoản NH, KB", ColumnPosition = 5, RepositoryControl = _gridLookUpEditBank }); XtraColumnCollectionHelper <PUInvoiceDetailFixedAssetModel> .ShowXtraColumnInGridView(ColumnsCollection, gridViewDetail); }
private void SetupFirtData() { //Data table Role var dtRole = new DataTable(); dtRole.Columns.Add("Vai trò"); DataRow dr = dtRole.NewRow(); DataRow dr2 = dtRole.NewRow(); dr[0] = "Trưởng ban"; dr2[0] = "Ủy viên"; dtRole.Rows.Add(dr); dtRole.Rows.Add(dr2); _gridlookupRoleview = new GridView(); _gridlookupRole = new RepositoryItemGridLookUpEdit { NullText = "", View = _gridlookupRoleview, TextEditStyle = TextEditStyles.Standard }; _gridlookupRole.DataSource = dtRole; _gridlookupRole.View.BestFitColumns(); _gridlookupRoleview.PopulateColumns(dtRole); _gridlookupRoleview.OptionsView.ColumnAutoWidth = true; _gridlookupRole.DisplayMember = "Vai trò"; _gridlookupRole.ValueMember = "Vai trò"; //Data binding var dt = new DataTable(); dt.Columns.Add("Name"); dt.Columns.Add("Position"); dt.Columns.Add("Represent"); dt.Columns.Add("Role"); grdMinutesInventoryFixedAsset.DataSource = dt; ColumnsCollection.Add(new XtraColumn { ColumnName = "Name", ColumnCaption = "Họ tên", ColumnPosition = 0, ColumnVisible = true, ColumnWith = 40 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Position", ColumnCaption = "Chức vụ", ColumnPosition = 1, ColumnVisible = true, ColumnWith = 40 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Represent", ColumnCaption = "Đại diện", ColumnPosition = 2, ColumnVisible = true, ColumnWith = 40 }); ColumnsCollection.Add(new XtraColumn { ColumnName = "Role", ColumnCaption = "Vai trò", ColumnPosition = 3, ColumnVisible = true, ColumnWith = 40, RepositoryControl = _gridlookupRole }); foreach (var column in ColumnsCollection) { if (grdMinutesInventoryFixedAssetView.Columns[column.ColumnName] != null) { if (column.ColumnVisible) { grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].Caption = column.ColumnCaption; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].VisibleIndex = column.ColumnPosition; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].Width = column.ColumnWith; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].AppearanceCell.TextOptions.HAlignment = column.Alignment; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].UnboundType = column.ColumnType; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].ColumnEdit = column.RepositoryControl; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].ToolTip = column.ToolTip; grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].OptionsColumn.AllowEdit = true; } else { grdMinutesInventoryFixedAssetView.Columns[column.ColumnName].Visible = false; } } } grdMinutesInventoryFixedAssetView.AddNewRow(); }