public static void CreateExportExcelPart(VLayoutPanel vPanel, DFBrowseGrid grid, string displayName) { HLayoutPanel hbox = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); var exporter = new Exporter(); hbox.Add(new TSButton("导出到Excel", delegate { var lastQuery = grid.LastQuery; if (lastQuery == null) { throw new Exception("请先进行查询"); } var dom = new LoadArguments((DQueryDom)lastQuery.DQuery.Clone()); foreach (var colIndex in lastQuery.SumColumns) { dom.SumColumns.Add(colIndex); } foreach (var colIndex in lastQuery.GroupSumColumns) { dom.GroupSumColumns.Add(colIndex); } dom.DQuery.Range = SelectRange.All; exporter.Export(new TSingSoft.WebPluginFramework.Exports.QueryResultExcelExporter(displayName, GetQueryResult(dom))); })); hbox.Add(exporter); }
private Control CreateReport() { var result = new TemplateBillReport(); var parameters = new Dictionary <string, object>(); parameters.Add("$CurrentUserName", BLContext.User.Name); AddParameters(parameters); var autoAdd = new Dictionary <string, object>(); foreach (KeyValuePair <string, object> pair in parameters) { if (pair.Value != null && pair.Value is ICollection) { string newKey = pair.Key + "_RecordCount"; if (!parameters.ContainsKey(newKey)) { autoAdd.Add(newKey, ((ICollection)pair.Value).Count); } } else if (pair.Value != null && pair.Value is LoadArguments) { string newKey = pair.Key + "_RecordCount"; if (!parameters.ContainsKey(newKey)) { var loadArguments = new LoadArguments(((LoadArguments)pair.Value).DQuery.Clone() as DQueryDom); loadArguments.DQuery.Range = SelectRange.Top(0); var adapater = new DFDataAdapter(loadArguments); var table = adapater.PagedFill(); autoAdd.Add(newKey, table.TotalCount); } } } foreach (KeyValuePair <string, object> pair in autoAdd) { parameters.Add(pair.Key, pair.Value); } var printTemplateFile = Path.Combine(Wpf.Settings.ConfigFolder, GetTemplateFile()); result.ParseTemplate(FS.OpenRead(printTemplateFile), parameters); return(result); }
void InitToolBar(TitlePanel panel) { var toolbar = new HLayoutPanel(); toolbar.CssClass += "LeftPaddingWrapper"; panel.EAdd(toolbar); var exporter = new Exporter(); toolbar.Add(new TSButton("导出到Excel", delegate { var lastQuery = detailGrid.LastQuery; if (lastQuery == null) { throw new Exception("请先进行查询"); } var dom = new LoadArguments((DQueryDom)lastQuery.DQuery.Clone()); foreach (var colIndex in lastQuery.SumColumns) { dom.SumColumns.Add(colIndex); } foreach (var colIndex in lastQuery.GroupSumColumns) { dom.GroupSumColumns.Add(colIndex); } dom.DQuery.Range = SelectRange.All; string fileName = "班组包材领用测算表.xlsx"; exporter.Export(new QueryResultExcelExporter(fileName, GetQueryResult(dom))); })); toolbar.Add(exporter); var preBtn = new TSButton("预览"); preBtn.OnClientClick = "preventEventDefault(event);if(window.__printUrl){Preview(window.__printUrl);}else{alert('先搜索出结果才能打印');}"; toolbar.Add(preBtn); var printBtn = new TSButton("打印"); printBtn.OnClientClick = "preventEventDefault(event);if(window.__printUrl){Print(window.__printUrl);}else{alert('先搜索出结果才能打印');}"; toolbar.Add(printBtn); }
//包装模式 private Control CreatePackModePart() { packModeFilterTree = new FilterTree(); packModeFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = packModeFilterTree.DataSource; var packModeInfo = GetPackModeInfo(); foreach (var item in packModeInfo) { packModeFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Value, item.Key.ToString())); } } }; mTreeContainer.Add("packMode", packModeFilterTree); packModeFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var packMode = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ("Goods_PackageModel", packMode)); } }; mTreeContainer.Select += delegate { var shift = ""; var packModel = ""; var beginDate = ""; var endDate = ""; if (shiftFilterTree != null) { var shiftNode = shiftFilterTree.GetSelecteItem(); shift = shiftNode.Value; } if (packModeFilterTree != null) { var packNode = packModeFilterTree.GetSelecteItem(); packModel = packNode.Value; } if (dateInput.Value != null) { beginDate = dateInput.Value.ToString(); } if (enddateInput.Value != null) { endDate = enddateInput.Value.ToString(); } var printUrl = string.Format("PackingMaterialReportPrint.aspx?Shift={0}&PackMode={1}&BeginDate={2}&EndDate={3}", shift, packModel, beginDate, endDate); Page.ClientScript.RegisterStartupScript(this.GetType(), "__printUrl", string.Format("window.__printUrl='{0}';", printUrl), true); var query = GetQueryDom(); mTreeContainer.AddConditions(query); var args = new LoadArguments(query); foreach (var item in detailSumIndex) { args.SumColumns.Add(item); } foreach (var item in detailGroupSumIndex) { args.GroupSumColumns.Add(item); } detailGrid.LoadArguments = args; detailGrid.DataBind(); }; return(packModeFilterTree); }
private QueryResult GetQueryResult(LoadArguments arg) { var data = new DFDataTableEditor().Load(arg); return(new QueryResult(data.TotalCount, data.Data.Rows, data.Data.Columns, arg.SumColumns.Any() ? data.Data.SumRow : null)); }
//存货类别 private Control CreatGoodsCategoryPart() { goodsCategoryFilterTree = new FilterTree(); goodsCategoryFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = goodsCategoryFilterTree.DataSource; var packModeInfo = GetGoodsCategoryInfo(); foreach (var item in packModeInfo) { goodsCategoryFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } } }; mTreeContainer.Add("goodsCategory", goodsCategoryFilterTree); goodsCategoryFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var packMode = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ(main, "GoodsCategory_ID", packMode)); } }; mTreeContainer.Select += delegate { //当选中的是 会计单位的时候 if (mTreeContainer.SelectName == mAccName) { var rootNode = proudceUnitFilterTree.DataSource; var packModeInfo = GetProduceUnitInfo(); proudceUnitFilterTree.DataSource.Childs.Clear(); foreach (var item in packModeInfo) { proudceUnitFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } proudceUnitFilterTree.DataBind(); } var query = GetQueryDom(); mTreeContainer.AddConditions(query); var args = new LoadArguments(query); foreach (var item in detailSumIndex) { args.SumColumns.Add(item); } foreach (var item in detailGroupSumIndex) { args.GroupSumColumns.Add(item); } detailGrid.LoadArguments = args; detailGrid.DataBind(); }; return(goodsCategoryFilterTree); }