/// <summary>
        /// 创建报告
        /// </summary>
        /// <param name="tigerPath">目标路径</param>
        /// <returns></returns>
        public Result CreatReport(string tigerPath)
        {
            return(RunFun(logpath =>
            {
                tigerPath = ToolFile.GetAbsolutelyPath(tigerPath);

                string modthPath = ToolFile.GetUpIndex(base.ModelPath, 1) + "Custom\\宝龙-满意度版块PDF的副本.rdl";

                string sqlStr = @"
                     Select distinct r.FormReportItemID,c.Text
                    From AskForm_FormReportItemParam r 
                    INNER JOIN AskForm_Choice c ON c.ChoiceID = r.[Value]
                    Where 
	                    r.CompanyID=@CompanyID And r.FormApplicationID =@FormApplicationID
                      And r.IsDeleted=0";

                DataTable dt = DbContent.GetTable(GetSqlParam() + sqlStr);

                foreach (DataRow dr in dt.Rows)
                {
                    ReportParameterCollection reportParameters = new ReportParameterCollection
                    {
                        new ReportParameter("CompanyID", @CompanyID),
                        new ReportParameter("FormApplicationID", FormApplicationID),
                        new ReportParameter("FormID", FormID),
                        new ReportParameter("MinValue", "0"),
                        new ReportParameter("ReportTitle", "板块报告"),
                        new ReportParameter("FormReportItemID", dr["FormReportItemID"] + "")
                    };

                    ToolReport.GenerateLocalReport(modthPath, tigerPath, dr["Text"] + ".pdf", reportParameters, true);
                }
                return Res;
            }));
        }
예제 #2
0
        /// <summary>
        /// 生成报告
        /// </summary>
        /// <param name="modelPath">报告模板</param>
        /// <param name="tigerPath">生成地址</param>
        /// <param name="formId">问卷编号</param>
        /// <param name="entryId">被评估人编号</param>
        /// <param name="suffix">报告格式</param>
        /// <param name="maxLength">最多生成报告数,0为不限制</param>
        /// <returns></returns>
        public Result CreateReport(string modelPath, string tigerPath, long formId, long entryId, string suffix, int maxLength)
        {
            return(RunFun(logPath =>
            {
                tigerPath = ToolFile.GetAbsolutelyPath(tigerPath);

                modelPath = base.ModelPath + modelPath;

                DataRow dr = GetFormInfo(formId);

                if (entryId > 0)
                {
                    ReportParameterCollection col = new ReportParameterCollection
                    {
                        new ReportParameter("CompanyID", dr["CompanyID"] + ""),
                        new ReportParameter("FormApplicationID", dr["FormApplicationID"] + ""),
                        new ReportParameter("FormID", dr["FormID"] + ""),
                        new ReportParameter("ObservedID", entryId + ""),
                        new ReportParameter("EntryID", entryId + ""),
                        new ReportParameter("MinValue", "1")
                    };

                    col = ToolReport.BindPara(modelPath, col);

                    ToolReport.GenerateLocalReport(modelPath, tigerPath, entryId + "." + suffix, col, false);
                }
                else
                {
                    DataTable dt = DbContent.GetTable(string.Format(GetObservedList(), dr["CompanyID"] + "", dr["FormApplicationID"] + ""));

                    int con = 0;

                    foreach (DataRow item in dt.Rows)
                    {
                        if (maxLength > 0 && con >= maxLength)
                        {
                            break;
                        }

                        ReportParameterCollection col = new ReportParameterCollection
                        {
                            new ReportParameter("CompanyID", dr["CompanyID"] + ""),
                            new ReportParameter("FormApplicationID", dr["FormApplicationID"] + ""),
                            new ReportParameter("FormID", dr["FormID"] + ""),
                            new ReportParameter("ObservedID", item["EntryID"] + ""),
                            new ReportParameter("EntryID", item["EntryID"] + ""),
                            new ReportParameter("MinValue", "1")
                        };

                        col = ToolReport.BindPara(modelPath, col);
                        con++;
                        WriteLog(logPath, dt.Rows.IndexOf(item) + "\t" + item["FullName"] + "_" + item["EntryID"]);
                        ToolReport.GenerateLocalReport(modelPath, tigerPath, item["FullName"] + "_" + item["EntryID"] + "." + suffix, col, false);
                    }
                }
                return Res;
            }));
        }
예제 #3
0
        /// <summary>
        /// 生成团队报告
        /// </summary>
        /// <param name="modelPath">报告模板</param>
        /// <param name="tigerPath">生成地址</param>
        /// <param name="formId">问卷编号</param>
        /// <param name="suffix">报告格式</param>
        /// <returns></returns>
        public Result CreateTeamReport(string modelPath, string tigerPath, long formId, string suffix)
        {
            return(RunFun(logPath =>
            {
                tigerPath = ToolFile.GetAbsolutelyPath(tigerPath);

                modelPath = base.ModelPath + modelPath;

                string sqlFilter = $"SELECT * FROM AskForm_FormFilter  ff WHERE ff.FormID = {formId} AND ff.Name LIKE '%FieldFilter%' AND ff.IsDeleted = 0";

                DataTable dtFilter = DbContent.GetTable(sqlFilter);

                // 循环过滤条件
                foreach (DataRow filter in dtFilter.Rows)
                {
                    ReportParameterCollection col = new ReportParameterCollection
                    {
                        new ReportParameter("CompanyID", filter["CompanyID"] + ""),
                        new ReportParameter("FormApplicationID", filter["FormApplicationID"] + ""),
                        new ReportParameter("FormID", filter["FormID"] + ""),
                        new ReportParameter("FormFilterID", filter["FormFilterID"] + ""),
                        new ReportParameter("MinValue", "1")
                    };

                    col = ToolReport.BindPara(modelPath, col);

                    // 获取过滤字段
                    string sqlField = $"SELECT f.FieldID,f.Title,fff.Content FROM AskForm_FormFilterField fff INNER JOIN AskForm_Field f ON f.FieldID = fff.FieldID WHERE FormFilterID = {filter["FormFilterID"]} AND fff.IsDeleted = 0";
                    DataTable dtField = DbContent.GetTable(sqlField);

                    // 循环字段
                    foreach (DataRow field in dtField.Rows)
                    {
                        string sqlContent = $"SELECT distinct [Value] FROM AskForm_EntryText et WHERE et.FieldID = {field["FieldID"]} AND et.IsDeleted = 0";
                        DataTable dtContent = DbContent.GetTable(sqlContent);

                        // 循环内容
                        foreach (DataRow content in dtContent.Rows)
                        {
                            // 修改内容
                            string sqlUpFilterField = $"UPDATE AskForm_FormFilterField SET Content='{content["Value"]}' WHERE FormFilterID = {filter["FormFilterID"]} AND FieldID ={field["FieldID"]} ";

                            WriteLog(logPath, "修改【" + field["Title"] + "】为【" + content["Value"] + "】," + DbContent.ExecuteNonQuery(sqlUpFilterField));
                            ToolReport.GenerateLocalReport(modelPath, tigerPath, field["Title"] + "_" + content["Value"] + "." + suffix, col, false);
                        }
                    }
                }
                return Res;
            }));
        }
예제 #4
0
        /// <summary>
        /// 生成部门报告
        /// </summary>
        /// <param name="dsfd">dzhg</param>
        /// <returns></returns>
        public Result GeneratingReports()
        {
            //获取报告地址
            string modelFileName = "满意度-药明.rdl";
            string modelPath     = Path.Combine(ModelPath, modelFileName);

            //开始生成报告
            return(RunFun((logPath) =>
            {
                WriteLog(logPath, "开始生成报告");
                //绑定 CompanyID,FormApplicationID,FormID
                ReportParameterCollection col = ToolReport.BindPara(modelPath, Convert.ToInt32(FormID), false);

                //获取BUList
                string prefix = GetSqlParam();
                DataTable buList = DbContent.GetTable(prefix + BUListSQL);

                //BU循环
                foreach (DataRow buRow in buList.Rows)
                {
                    string bu = buRow.ItemArray[0].ToString();
                    WriteLog(logPath, $"当前BU:{bu}");
                    long time = Watch(() =>
                    {
                        string departmentListSQL = DepartmentListSQL.Replace("{BU}", $"'{bu}'");
                        DataTable departmentList = DbContent.GetTable(prefix + departmentListSQL);
                        //Department循环
                        foreach (DataRow departmentRow in departmentList.Rows)
                        {
                            string department = departmentRow.ItemArray[0].ToString();
                            WriteLog(logPath, $"当前Department:{department}");
                            //绑定 BU,Department参数
                            col.Add(new ReportParameter("BU", bu));
                            col.Add(new ReportParameter("Department", department));

                            // 绑定默认参数
                            col = ToolReport.BindPara(modelPath, col);

                            //生成部门报告
                            ToolReport.GenerateLocalReport(modelPath, Path.Combine(DataStarPath, bu) + "\\", $"Biologics-满意度-{department}.pdf", col, true);
                            WriteLog(logPath, $"Biologics-满意度-{department}.pdf 报告生成完毕");
                        }
                    });
                }
                WriteLog(logPath, "报告生成完毕");

                return Res;
            }));
        }
예제 #5
0
        private void ProcessExcelToolSUB()
        {
            string filePath;

            if (StartPeriod >= ReportSettings.July2009)
            {
                ToolSUB report = GetReportFactory().GetReportToolSUB(StartPeriod, EndPeriod, GetClientID());
                filePath = GenerateExcelSUB(report.Items, report.Summaries, "Tool");
            }
            else
            {
                BillingUnit SummaryUnit = new BillingUnit();
                ToolReport  rpt         = new ToolReport(StartPeriod, EndPeriod);
                DataTable   dtTool      = rpt.GenerateDataTable(SummaryUnit);
                filePath = rpt.GenerateExcelFile(dtTool);
            }

            OutputExcel(filePath);
        }