public JsonResult LoadReportTemplateSetting(string templateCode) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); ReportTemplate ReportTemplate = this.Engine.Analyzer.GetReportTemplateByCode(templateCode); if (null == ReportTemplate) { result.Success = false; result.Message = "ReportTemplate.ReportTemplateRequired"; return Json(result, JsonRequestBehavior.AllowGet); } ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(ReportTemplate.SourceCode); if (null == ReportSource) { result.Success = false; result.Message = "ReportTemplate.ReportSourceRequired"; return Json(result, JsonRequestBehavior.AllowGet); } ClearColumnData(ReportSource); ImproveColumnData(ReportSource); var SourceData = LoadSourceData(ReportSource); result.Success = true; result.Extend = new { ReportTemplate = ReportTemplate, ReportSource = ReportSource, SourceData = SourceData }; return Json(result, JsonRequestBehavior.AllowGet); })); }
public ActionResult GenerateReport(ReportSource rc, String ReportType) { if (!ModelState.IsValid) { return(View("ReportIndex", rc)); } Marker m = repo_.GetMarkerByIdentity(rc.Identity); if (m != null) { ViewBag.ObjectName = m.Address; } else { ViewBag.ObjectName = "-"; } if (ReportType.IndexOf("Месячный", StringComparison.OrdinalIgnoreCase) >= 0) { List <ByHourStat> values = repo_.GetStatByDays(rc.DateParam, rc.Identity).ToList(); return(View("StatByMonth", values)); } else { List <ByHourStat> values = repo_.GetStatByHour(rc.DateParam, rc.Identity).ToList(); return(View("StatByDay", values)); } }
public JsonResult ExportEchartsReport(string filterDatas, string reportTemplateSetting) { return(ExecuteFunctionRun(() => { ReportTemplate ReportTemplate = JsonConvert.DeserializeObject <ReportTemplate>(reportTemplateSetting); ReportTemplateParameter[] FilterDatas = JsonConvert.DeserializeObject <ReportTemplateParameter[]>(filterDatas); ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(ReportTemplate.SourceCode); Analytics.AnalyticalQuery Query = this.Engine.BPAQuery.GetAnalyticalQuery(this.Engine, ReportSource); DataTable dataTable = Query.QueryGroupTable(ReportSource.ExecuteTableName, ReportSource.Columns, ReportTemplate, FilterDatas); string FileUrl = string.Empty; if (string.IsNullOrWhiteSpace(ReportTemplate.RowTitle)) {//没有配置行标题的 FileUrl = ExportEchartsReportWithoutRowTitle(ReportTemplate, dataTable, ReportSource.Columns); } else {//有配置行标题 if (string.IsNullOrWhiteSpace(ReportTemplate.ColumnTitle)) { FileUrl = ExportEchartsReportWithoutColumnTitle(ReportTemplate, dataTable, ReportSource.Columns); } else { FileUrl = ExportEchartsReportQueryExistRowTitle(ReportTemplate, dataTable, ReportSource.Columns); } } var result = new { FileUrl = FileUrl }; return Json(result, JsonRequestBehavior.AllowGet);; })); }
/// <summary> /// Возвращает источник данных для вложенного отчета. /// </summary> /// <param name="context"></param> /// <param name="subReportSource"></param> /// <param name="parentReportOid"></param> /// <returns></returns> ReportSource GetSubReportSorce(ReportDbContext context, ReportSource subReportSource, Guid parentReportOid) { var subReportName = String.Empty; var subTypes = new System.Collections.Generic.List <string>() { "trdp", "trdx", "trbp" }; ParameterCollection parameters = subReportSource.Parameters; if (subReportSource is UriReportSource) { subReportName = ((UriReportSource)subReportSource).Uri; } else { subReportName = subReportSource.ToString(); } subReportName = subReportName.Split('/').Last(); if (!subTypes.Contains(subReportName.Split('.').Last()?.ToLower())) { return(subReportSource); } var subReport = _reportFileDBService.GetSubReportFile(context, parentReportOid, subReportName); return(GetReportSource(context, subReport, parentReportOid, parameters)); }
//private void imgSearch_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) //{ // if (SearchCommandRequested != null) // SearchCommandRequested(this, null); //} public void SetReportSource(ReportSource reportSource) { ReportViewer1.ReportSource = reportSource; //ReportViewer1.ReportEngineConnection = "engine=RestService;uri=http://localhost:25667/api/myreport;useDefaultCredentials=False"; //ReportViewer1.ReportSource = new UriReportSource() { Uri = "aa" }; }
/// <summary> /// 加载报表模板数据 /// </summary> /// <param name="ReportSource">报表数据源</param> /// <returns>报表模板数据</returns> private object LoadSourceData(ReportSource ReportSource) { Analytics.AnalyticalQuery Query = this.Engine.BPAQuery.GetAnalyticalQuery(this.Engine, ReportSource); List <Dictionary <string, object> > objList = new List <Dictionary <string, object> >(); Dictionary <string, object> obj; DataTable dataTable = Query.QueryTable(ReportSource.ExecuteTableName, ReportSource.Columns, null, 1, 5); foreach (DataRow row in dataTable.Rows) { obj = new Dictionary <string, object>(); foreach (ReportSourceColumn col in ReportSource.Columns) { if (col.DataType == DataType.DateTime)//时间类型做转换 { obj.Add(col.ColumnCode, row[col.ColumnCode].ToString()); } else if (col.ReportSourceColumnType != ReportSourceColumnType.CustomColumn) { obj.Add(col.ColumnCode, row[col.ColumnCode]); } } objList.Add(obj); } return(new { Rows = objList, Total = objList.Count }); }
/// <summary> /// 查询分组表 /// </summary> /// <param name="ReportSource"></param> /// <param name="ReportTemplate"></param> /// <param name="Parameters"></param> private JsonResult QueryGroupTable(ReportSource ReportSource, ReportTemplate ReportTemplate, ReportTemplateParameter[] Parameters) { Analytics.AnalyticalQuery Query = this.Engine.BPAQuery.GetAnalyticalQuery(this.Engine, ReportSource); DataTable dataTable = Query.QueryGroupTable(ReportSource.ExecuteTableName, ReportSource.Columns, ReportTemplate, Parameters); object QueryResult; if (string.IsNullOrWhiteSpace(ReportTemplate.ColumnTitle)) {//没有列标题 QueryResult = QueryNoneColumnTitle(ReportTemplate, dataTable, ReportSource.Columns); } else { //有行标题 if (string.IsNullOrWhiteSpace(ReportTemplate.RowTitle)) { //没有配置行标题的 QueryResult = QueryNoneRowTitle(ReportTemplate, dataTable, ReportSource.Columns); } else {//有配置行标题 QueryResult = QueryExistRowTitle(ReportTemplate, dataTable, ReportSource.Columns); } } return(Json(QueryResult, JsonRequestBehavior.AllowGet)); }
/// <inheritdoc /> /// <summary> /// Reads the bank report. /// </summary> /// <param name="request">The request.</param> /// <returns>Response.</returns> public override ReadReportResponse ReadReport(ReadReportRequest request) { var response = new ReadReportResponse { FilePath = request.FilePath }; var lines = ReportSource.GetLines(request.FilePath); foreach (var line in lines) { var row = line.ToString(); if (!response.BalanceIsRead) { decimal balance; if (DetermineBalance(row, out balance)) { response.Balance = balance; } } if (string.IsNullOrEmpty(response.SourceId)) { response.SourceId = DetermineSourceId(row); } var columns = GetReportColumns(row); if (columns.Length >= MaxColumnCount) { var transaction = DetermineTransaction(columns); if (transaction != null) { response.Transactions.Add(transaction); } } } return(response); }
public JsonResult ExportligerReport(string filterDatas, string reportTemplateSetting) { return(ExecuteFunctionRun(() => { ReportTemplateParameter[] FilterDatas = JsonConvert.DeserializeObject <ReportTemplateParameter[]>(filterDatas); ReportTemplate ReportTemplate = JsonConvert.DeserializeObject <ReportTemplate>(reportTemplateSetting); ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(ReportTemplate.SourceCode); SummaryReportResult SummaryReportResult = QueryTable(ReportSource, 0, 0, ReportTemplate.Columns, FilterDatas); Dictionary <string, string> heads = new Dictionary <string, string>(); foreach (ReportTemplateColumn Column in ReportTemplate.Columns) { if (Column.ReportSourceColumnType != ReportSourceColumnType.CustomColumn) { heads.Add(Column.ColumnCode, Column.DisplayName); } //heads.Add(Column.ColumnCode, Column.DisplayName); } List <Dictionary <string, object> > datas = new List <Dictionary <string, object> >(); Dictionary <string, object> data = new Dictionary <string, object>(); for (int i = 0; i < SummaryReportResult.Total; i++) { data = new Dictionary <string, object>(); foreach (string key in heads.Keys) { data.Add(key, SummaryReportResult.Rows[i][key]); } datas.Add(data); } var result = new { FileUrl = ExportExcel.ExportExecl(ReportTemplate.DisplayName + "." + ReportTemplate.Code, heads, datas) }; return Json(result, JsonRequestBehavior.AllowGet); })); }
private void detail_Format(object sender, EventArgs e) { DepartmentCode = Convert.ToString(Fields["DepartmentCode"].Value); StaffCode = Convert.ToString(Fields["StaffCode"].Value); var current = ReportSource[RowIndex]; var next = RowIndex + 1 < ReportSource.Count ? ReportSource[RowIndex + 1] : null; var difference = (next?.RowId.HasValue ?? true); lineBottomDetail.LineStyle = difference ? LineStyle.Solid : LineStyle.Dot; lineBottomDetail.Width = lineDetailTop.Width - (difference ? 0.0F : txtCategoryName.Left); lineBottomDetail.Left = difference ? lineDetailTop.Left : txtCategoryName.Left; // current customer if (current.RecordType == 0 && current.RowId.HasValue) { var sameCustomreCount = ReportSource .Skip(RowIndex).TakeWhile(x => x.CustomerCode == current.CustomerCode).Count(); if (MaxRowsCount < RowNumber + sameCustomreCount) { detail.NewPage = NewPage.Before; RowNumber = 0; } } else { detail.NewPage = NewPage.None; } RowIndex++; RowNumber++; }
//終端報表轉換 public static List <ReportSource> ConvertReportSourceModel(List <SourceReport> models) { List <ReportSource> reportSources = new List <ReportSource>(); foreach (var model in models) { ReportSource reportSource = new ReportSource() { group_name = model.SourceName, BetNum = model.SourceBetNum, PrepaidNum = model.SourceDepositNum, PrepaidMoney = model.SourceDepositMoney, OutMoney = model.SourceWithdrawMoney, BetMoney = model.SourceBetMoney, WinMoney = model.SourceWinMoney, BetOrderNum = model.SourceBetCount, ActivityDiscountAccountMoney = model.SourceActivityMoney, Out_RebateAccount = model.SourceRebateMoney, SourceAdminRejectMoney = model.SourceAdminRejectMoney, RegNum = model.SourceRegisterNum, NewPrepaidNum = model.SourceNewPayNum }; reportSources.Add(reportSource); } return(reportSources); }
/// <summary> /// 清理列数据 /// 这个处理很重要,新增的时候,得把所有列的序列化标志全部清空,因为这个表继承了父类,从客户端传过来时,把父类的标示页传过来 /// </summary> private void ClearColumnData(ReportSource ReportSource) { foreach (ReportSourceColumn Column in ReportSource.Columns) { Column.ObjectID = Guid.NewGuid().ToString(); Column.Serialized = false; } }
public frmReportViewer1(string reportEngine, ReportSource reportSource) { //var clientReportSource = new Telerik.ReportViewer.Wpf.WebForms.ReportSource(); InitializeComponent(); ReportViewer1.ReportEngineConnection = reportEngine; ReportViewer1.ReportSource = reportSource; }
public ReportViewModel(string title, ReportSource source, bool full, bool materials, bool gems) { this.Title = title; this.SourceReport = source; this.Full = full; this.Gems = gems; this.Materials = materials; }
private void Window_Loaded(object sender, RoutedEventArgs e) { reportViewer.ViewerCore.ReportSource = ReportSource; foreach (var item in Parameters) { ReportSource.SetParameterValue(item.Key, item.Value); } }
public I_ReportViewer(string title, ReportSource reportSource, bool full, bool materials, bool gems) { InitializeComponent(); this.Owner = App.Current.MainWindow; var vm = new ReportViewModel(title, reportSource, full, gems, materials); this.DataContext = vm; vm.SourceReport = reportSource; }
public JsonResult LoadSourceData(string sourceCode) { return(ExecuteFunctionRun(() => { ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(sourceCode); var jsonObj = LoadSourceData(ReportSource); return Json(jsonObj, JsonRequestBehavior.AllowGet); })); }
ReportSource CreateInstanceReportSource(IReportDocument report, ReportSource originalReportSource) { var instanceReportSource = new InstanceReportSource { ReportDocument = report }; instanceReportSource.Parameters.AddRange(originalReportSource.Parameters); return(instanceReportSource); }
public JsonResult LoadSourceData(string reportSourceSetting, string filterDatas, int page, int pageSize) { return(ExecuteFunctionRun(() => { ReportSource ReportSource = JsonConvert.DeserializeObject <ReportSource>(reportSourceSetting); SummaryReportResult SummaryReportResult = QueryTable(ReportSource, page, pageSize); return Json(SummaryReportResult, JsonRequestBehavior.AllowGet); })); }
public JsonResult LoadChartsData(string reportTemplateSetting, string filterDatas) { return(ExecuteFunctionRun(() => { ReportTemplate ReportTemplate = JsonConvert.DeserializeObject <ReportTemplate>(reportTemplateSetting); ReportTemplateParameter[] FilterDatas = JsonConvert.DeserializeObject <ReportTemplateParameter[]>(filterDatas) ?? ReportTemplate.Parameters; ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(ReportTemplate.SourceCode); return QueryGroupTable(ReportSource, ReportTemplate, FilterDatas); })); }
public override ReadReportResponse ReadReport(ReadReportRequest request) { var response = new ReadReportResponse { FilePath = request.FilePath, Transactions = new List <ReadTransaction>() }; var source = ReportSource.GetLines(request.FilePath); var list = ((string[])source).ToList(); for (var row = 0; row < list.Count; row++) { var line = list[row]; if (string.IsNullOrEmpty(response.SourceId)) { response.SourceId = DetermineSourceId(line); } if (line == TransactionBegin) { var transaction = new ReadTransaction(); for (var i = 1; i < MaxRecipRowsCount && row + i < list.Count; i++) { line = list[row + i]; decimal amount; if (ParseAmmount(line, TransactionAmountPosted, out amount) || ParseAmmount(line, TransactionAmount, out amount)) { transaction.Amount = amount; transaction.DirectionType = amount < 0 ? DirectionType.Expense : DirectionType.Incoming; } if (line.StartsWith(TransactionDate)) { transaction.DateIn = DateTime.Parse(line.Replace(TransactionDate, "")); } if (line.StartsWith(TransactionNumber)) { var number = line.Replace(TransactionNumber, ""); transaction.Comment += $"#{number}: "; } if (line.StartsWith(TransactionDescription)) { transaction.Comment += line.Replace(TransactionDescription, ""); } if (line.StartsWith(TransactionEnd)) { response.Transactions.Add(transaction); row += i; break; } } } } return(response); }
/// <summary> /// 优化报表数据源数据项 /// </summary> /// <param name="reportSource">报表数据源</param> private void ImproveColumnData(ReportSource reportSource) { //优化数据源列显示 foreach (ReportSourceColumn col in reportSource.Columns) { if (string.IsNullOrEmpty(col.DisplayName)) { col.DisplayName = col.ColumnCode; } } }
public void SetDataSource(string name, DataTable table) { ReportSource s = this.sources.Find(x => x.Name == name); if (s == null) { s = new ReportSource(name); this.sources.Add(s); } s.Data = table; }
// // GET: /Report/ public ActionResult Index() { List <Db_objects> objects = repo_.GetAllObjects().OrderBy(x => x.Address).ToList(); ReportSource rc = new ReportSource(); rc.Adresses = objects.Select(x => new SelectListItem() { Text = x.Address, Value = x.Identity }).ToList(); return(View("ReportIndex", rc)); }
public void Print() { List <DataRowView> rows = new List <DataRowView>(); for (int i = 0; i < winExplorerView1.RowCount; i++) { var view = (DataRowView)winExplorerView1.GetRow(i); if (Convert.ToBoolean(view["IsSelect"])) { rows.Add(view); } } if (rows.Count() > 4) { CommHelp.ShowWarning("一次只能打印4张图片"); return; } if (rows.Count() == 0) { CommHelp.ShowWarning("请选择要打印的图片"); return; } ReportSource source = new ReportSource(); source.Name = User.CurrentPatient.FName; source.Birthday = User.CurrentPatient.BirthDay; source.No = User.CurrentPatient.SECU; source.Yijian = currentHistory.Yijian; source.Img1 = Help.Base64Util.GetBase64FromImage((Bitmap)rows[0]["Image"]); if (rows.Count() > 1) { source.Img2 = Help.Base64Util.GetBase64FromImage((Bitmap)rows[1]["Image"]); } if (rows.Count() > 2) { source.Img3 = Help.Base64Util.GetBase64FromImage((Bitmap)rows[2]["Image"]); } if (rows.Count() > 3) { source.Img4 = Help.Base64Util.GetBase64FromImage((Bitmap)rows[3]["Image"]); } ReportViewerDialog dlg = new ReportViewerDialog(); dlg.DataSourceDict = new List <ReportSource>() { source }; dlg.ReportFilePath = "Report/Report.rdlc"; dlg.ShowDialog(); }
public JsonResult DelReportSource(string sourceCode) { return(ExecuteFunctionRun(() => { ActionResult result = CheckReportSource(sourceCode); if (result.Success) { ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(sourceCode); result.Success = this.Engine.Analyzer.RemoveReportSource(ReportSource.ObjectID); } return Json(result, JsonRequestBehavior.AllowGet); })); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var component = context.Instance as ReportComponent; if (component != null && value != null) { ReportSource source = component.Report.Sources.FirstOrDefault(i => i.Name == value.ToString()); if (source != null) { return(source.GUID); } } return(base.ConvertFrom(context, culture, value)); }
public JsonResult AddReportSourceSetting(string reportSourceSetting) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); ReportSource ReportSource = JsonConvert.DeserializeObject <ReportSource>(reportSourceSetting); //校验 result = ValidateSaveData(ReportSource); if (result.Success) { result.Success = this.Engine.Analyzer.AddReportSource(ReportSource); } return Json(result, JsonRequestBehavior.AllowGet); })); }
protected void Page_Load(object sender, EventArgs e) { Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); TypeReportSource reportSource = new TypeReportSource(); reportSource.TypeName = typeof(PatientRegistrationForm).AssemblyQualifiedName; ReportSource myrep = reportSource; myrep.Parameters.Add(new Telerik.Reporting.Parameter("patientpk", Session["PatientId"].ToString())); reportViewer1.ReportSource = reportSource; reportViewer1.ParametersAreaVisible = false; this.reportViewer1.RefreshReport(); }
public void SetSubReportDataSource(string sname, string name, DataTable table) { if (this.subSources.ContainsKey(sname) == false) { this.subSources.Add(sname, new List <ReportSource>()); } ReportSource s = this.subSources[sname].Find(x => x.Name == name); if (s == null) { s = new ReportSource(name); this.subSources[sname].Add(s); } s.Data = table; }
public void init() { ART.ReportSource rs = new ReportSource(); ARTService service = new ARTService(); dataSources.Add("TextBlockExecSummary", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.ExecSummary)); dataSources.Add("TextBlockScope", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.Scope)); dataSources.Add("TextBlockSpeciesOverview", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.SpeciesOverview)); dataSources.Add("TextBlockProductionStatistics", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.ProductionStatistics)); dataSources.Add("TextBlockImportance", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.ImportanceToMarket)); dataSources.Add("TextBlockMarketNames", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.CommonMarketNames)); dataSources.Add("TextBlockProductForms", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.ProductForms)); dataSources.Add("OverallRec", rs.OverallRec(m_ReportId)); dataSources.Add("Criteria1Grid", service.Criteria1ReportData(m_ReportId)); //dataSources.Add("Criteria1Synthesis", service.SynthesisGet(reportId, 1)); dataSources.Add("Criteria1", rs.Criteria1All(m_ReportId)); dataSources.Add("Criteria2Grid", service.Criteria2ReportData(m_ReportId)); //dataSources.Add("Criteria2Synthesis", service.SynthesisGet(reportId, 2)); dataSources.Add("Criteria2", rs.Criteria2All(m_ReportId)); dataSources.Add("Criteria3Grid", service.Criteria3ReportData(m_ReportId)); dataSources.Add("Criteria31Grid", service.Criteria31ReportData(m_ReportId)); dataSources.Add("Criteria32Grid", service.Criteria32ReportData(m_ReportId)); //dataSources.Add("Criteria3Synthesis", service.SynthesisGet(reportId, 3)); //dataSources.Add("Criteria31Synthesis", service.SynthesisGet(reportId, 5)); //dataSources.Add("Criteria32Synthesis", service.SynthesisGet(reportId, 6)); dataSources.Add("Criteria31", rs.Criteria31All(m_ReportId)); dataSources.Add("Criteria32", rs.Criteria32All(m_ReportId)); dataSources.Add("Criteria4Grid", service.Criteria4ReportData(m_ReportId)); //dataSources.Add("Criteria4Synthesis", service.SynthesisGet(reportId, 4)); dataSources.Add("Criteria4", rs.Criteria4All(m_ReportId)); dataSources.Add("TextBlockAck", service.TextBlockGetDataTable(m_ReportId, ARTService.TextBlock.Acknowledgements)); dataSources.Add("References", rs.References(m_ReportId)); dataSources.Add("AppendixAGrid", service.AppendixAReportData(m_ReportId)); }