Beispiel #1
0
        /// <summary>
        /// 获取动态添加列
        /// </summary>
        /// <param name="dynamicAddColumns"></param>
        /// <returns></returns>
        private RuntimeFormat GetRunTimeFormatByDynamicColumn(string[] dynamicAddColumns)
        {
            RuntimeFormat runtimeFormat = null;

            if (dynamicAddColumns != null && dynamicAddColumns.Length > 0)
            {
                runtimeFormat = new RuntimeFormat();
                IConfigXmlItem addedCos = new RuntimeFormatInfo();
                addedCos.SetProperty(ConfigXmlContext.XmlKeyId, RuntimeFormatServerContext.ArgKeyDymanicAddedCols);
                runtimeFormat.SetSubItem(addedCos);
                foreach (string key in dynamicAddColumns)
                {
                    RuntimeFormatInfo rfi = new RuntimeFormatInfo();
                    rfi.SetProperty(ConfigXmlContext.XmlKeyId, key);
                    addedCos.SetSubItem(rfi);
                }
            }
            return(runtimeFormat);
        }
Beispiel #2
0
        internal void OpenReport(FilterArgs filter, string filterFlag, string[] dynamicAddColumns, byte[] rf, string cacheId = null, string rawTable = null)
        {
            string groupId = null;
            string crossId = null;

            GetGroupAndCrossId(filterFlag, ref groupId, ref crossId);

            #region 动态列处理的

            RuntimeFormat runtimeFormat = GetRunTimeFormatByDynamicColumn(dynamicAddColumns);

            if (rf != null)
            {
                if (runtimeFormat == null)
                {
                    runtimeFormat = new RuntimeFormat();
                }
                //var rff = SLElements.BinarySerializHelper.ObjectFromBinary<SLElements.RuntimeFormat>(rf);
                //if (rff.SummaryCols != null && rff.SummaryCols.Count > 0)
                //{
                //    IConfigXmlItem cols = runtimeFormat.GetSubItem("SummaryCols");
                //    if (cols == null)
                //    {
                //        cols = new RuntimeFormatInfo();
                //        cols.SetProperty(ConfigXmlContext.XmlKeyId, "SummaryCols");
                //        runtimeFormat.SetSubItem(cols);
                //    }
                //    foreach (var pair in rff.SummaryCols)
                //    {
                //        IConfigXmlItem config = new RuntimeFormatInfo();
                //        config.SetProperty(ConfigXmlContext.XmlKeyId, pair.Key);
                //        config.SetProperty(RuntimeFormatServerContext.XmlKeyOperatorType, pair.Value);
                //        cols.SetSubItem(config);
                //    }
                //}
            }

            #endregion

            //加载报表的样式
            //_reportEngine.LoadFormat(cacheId, slFilterArgs.ViewID, fileterFlag, groupId, null, rawtable, runtimeFormat);
            //添加FilterArgs的一些属性
            filter.Args.Add("NetDataConnString", _login.UfDataCnnString);
            filter.Args.Add("netmetaconnstring", _login.UfMetaCnnString);
            filter.Args.Add("curdate", _login.Date);
            filter.Args.Add("ciyear", _login.cYear);
            filter.AccID  = _login.cAccId;
            filter.LangID = _login.LocaleID;
            if (string.IsNullOrEmpty(rawTable))
            {
                filter = GetSql(filter);
            }
            else
            {
                filter.DataSource.SQL = rawTable;
            }
            int viewType = GetViewTypeByViewId(filter.ViewID);
            if (viewType == 3)//交叉视图
            {
                InnerOpenCrossReport(cacheId, filter.ViewID, filterFlag, groupId, rawTable, runtimeFormat, filter, crossId);
            }
            else
            {
                InnerOpenReport(cacheId, filter.ViewID, filterFlag, groupId, rawTable, runtimeFormat, filter, crossId);
            }
        }
Beispiel #3
0
        private void InnerOpenReport(string cacheId, string viewId, string fileterFlag, string groupId, string rawtable, RuntimeFormat runtimeFormat, FilterArgs args, string crossId)
        {
            //加载报表的样式
            ReportEngine reportEngine = new ReportEngine(_login, ReportStates.Browse, _datacontainer);
            string       allcolumns   = reportEngine.LoadFormat(cacheId, viewId, fileterFlag, groupId, null, rawtable, runtimeFormat);

            if (args != null)
            {
                if (!string.IsNullOrEmpty(allcolumns))
                {
                    //if (_context.Type == ReportType.IndicatorReport)
                    if (string.IsNullOrEmpty(args.ClassName))// &&! _context.FilterArgs.bAutoSource )
                    {
                        RowAuthFacade raf     = new RowAuthFacade();
                        string        rowauth = raf.GetRowAuthFromAllColumns(viewId, allcolumns, ClientReportContext.Login, true);
                        args.Args.Add("RowAuthString", rowauth);
                    }
                    string[] columns = Regex.Split(allcolumns, "@;@");//allcolumns.Split(new char[] { '@', ';', '@' });
                    //if( _context.FilterArgs.Args.Contains( "DataAccordingGroup" ) )
                    //{
                    if (columns.Length > 1)
                    {
                        string[] items = columns[1].Split(',');
                        for (int i = 0; i < items.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(items[i]))
                            {
                                args.GroupItems.Add(items[i]);
                            }
                        }
                    }
                    if (columns.Length > 2)
                    {
                        string[] items = columns[2].Split(',');
                        for (int i = 0; i < items.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(items[i]))
                            {
                                args.SumItems.Add(items[i]);
                            }
                        }
                    }
                    //}
                    args.DataSource.SelectString = string.IsNullOrEmpty(columns[0]) ? "" : columns[0];
                }
                else
                {
                    args.DataSource.SelectString = "";
                }

                args.Args.Add("columns", args.DataSource.SelectString);
            }

            string colAuthString = GetColAuthString(viewId);

            //运行报表
            reportEngine.CreateReport(true, args, null, null, null, rawtable, 0, colAuthString, ShowStyle.Normal, crossId, false);
        }
Beispiel #4
0
        /// <summary>
        /// 打开的crosstable,rawtable为NULL,
        /// basetable传入的是rawtable
        /// </summary>
        private void InnerOpenCrossReport(string cacheId, string viewId, string fileterFlag, string groupId, string rawtable, RuntimeFormat runtimeFormat, FilterArgs args, string crossId)
        {
            ReportEngine reportEngine = new ReportEngine(_login, ReportStates.Browse, _datacontainer);

            reportEngine.CrossLoadFormat(cacheId, viewId, runtimeFormat);
            string colAuthString = GetColAuthString(viewId);

            reportEngine.CreateCrossReport(true, true, fileterFlag, colAuthString, groupId, null, args, null, null, rawtable, 0, ShowStyle.Normal, crossId, false);
        }