public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { HeTongBeiAn rpt = new HeTongBeiAn(); rpt.Site = this.Site; return(rpt); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //先处理下附件文件夹中的备案表,防止过大 DeleteSignedFile(Server.MapPath(Request.ApplicationPath + "/AttachStorage/")); HeTongBeiAn myReport = new HeTongBeiAn(); string strSql = ""; //先初始化项目信息 //看看该公司所在的地区 CRS_BeiAn.Report.FileName = System.Configuration.ConfigurationManager.AppSettings["BeiAnPrint_SN"]; //Epoint.Frame.Common.ApplicationOperate.GetConfigValueByName("BeiAnPrint_SN", ""); ; //CRS_BeiAn.Report. #region 人员 HeTongInfo ds = new HeTongInfo(); strSql = "select * from RG_XMAndRY RY where XMGuid='" + Request["RowGuid"] + "' order by substring(RY.ZhuanYeCode,1,4) asc,RY.DDRole desc "; DataView dvRY = Epoint.MisBizLogic2.DB.ExecuteDataView(strSql); int count = dvRY.Count; for (int i = 0; i < dvRY.Count; i++) { DataRow dr4; dr4 = ds.Tables["RYOfXM"].NewRow(); dr4["ZiZhiText"] = dvRY[i]["ZiZhiText"].ToString(); dr4["ZhuanYeText"] = dvRY[i]["ZhuanYeText"].ToString(); dr4["RYName"] = dvRY[i]["RYName"].ToString(); dr4["IDNum"] = dvRY[i]["IDNum"];//Convert.ToDecimal( dr4["ZhiCheng"] = DB_CM.GetCodeText_FromHash("职称", Convert.ToString(dvRY[i]["ZhiCheng"])); ; dr4["YinZhangNo"] = dvRY[i]["YinZhangNo"].ToString(); dr4["ZhuanYeSX"] = dvRY[i]["ZhuanYeSX"].ToString(); //处理下从事的专业,尽量缩小 string ZhuanYeCS = dvRY[i]["ZhuanYeCS"].ToString(); //string ZYCS = "";// RG_DW.GetItemTextByLen2("29b7967e-8098-42d5-8b40-ec757b0865a5", ZhuanYeCS, 4); //string[] CS = ZhuanYeCS.Split(';'); //for (int m = 0; m < CS.Length; m++) //{ // ZYCS += RG_DW.GetItemTextByLen2("29b7967e-8098-42d5-8b40-ec757b0865a5", CS[m], 4); // ZYCS += ";"; //} //if (ZYCS.Length > 0) //{ // ZYCS = ZYCS.Substring(0, ZYCS.Length - 1); //} dr4["ZhuanYeCS"] = ZhuanYeCS; dr4["GongLing"] = dvRY[i]["GongLing"]; dr4["DDRole"] = DB_CM.GetCodeText_FromHash("项目角色", Convert.ToString(dvRY[i]["DDRole"])); dr4["OrNo"] = i + 1; ds.Tables["RYOfXM"].Rows.Add(dr4); } //for (int m = 19; m > dvRY.Count; m--) //{ // DataRow dr4; // dr4 = ds.Tables["RYOfXM"].NewRow(); // dr4["ZiZhiText"] = ""; // dr4["ZhuanYeText"] = ""; // dr4["RYName"] = ""; // dr4["IDNum"] = "";//Convert.ToDecimal( // dr4["ZhiCheng"] = ""; ; // dr4["YinZhangNo"] = ""; // dr4["ZhuanYeSX"] = ""; // dr4["ZhuanYeCS"] = ""; // dr4["GongLing"] = ""; // dr4["DDRole"] = ""; // dr4["OrNo"] = dvRY.Count + 19 - m; // ds.Tables["RYOfXM"].Rows.Add(dr4); //} //HeTongBeiAn oCR = new HeTongBeiAn(); myReport.SetDataSource(ds.Tables["RYOfXM"]); #endregion #region 参数 strSql = "select * from RG_XMBeiAn where RowGuid='" + Request["RowGuid"] + "' "; DataView dv = Epoint.MisBizLogic2.DB.ExecuteDataView(strSql); string DWName = ""; string TJDate = ""; string XMName = ""; string XMAdd = ""; string ToTalMoney = ""; string GuiMoDJ = ""; string JSDWName = ""; string XMLXR_JS = ""; string LXDH_JS = ""; string XMLXR_KS = ""; string LXDH_KS = ""; string XMFZR = ""; string ZiZhiDJ = ""; string ZiZhiDJ_ZH = ""; string HeTongMoney = ""; string XMBH = ""; string STATUS = ""; if (dv.Count > 0) { STATUS = dv[0]["STATUS"].ToString(); strSql = "select EnterpriseName from RG_OUInfo where RowGuid='" + dv[0]["DWGuid"] + "'"; DWName = Epoint.MisBizLogic2.DB.ExecuteToString(strSql); myReport.SetParameterValue("DWName", DWName); if (dv[0]["TJDate"].ToString() != "") { TJDate = DateTime.Parse(dv[0]["TJDate"].ToString()).ToString("yyyy-MM-dd"); } else { TJDate = ""; } myReport.SetParameterValue("TJDate", TJDate); XMName = dv[0]["XMName"].ToString(); myReport.SetParameterValue("XMName", XMName); XMAdd = DB_CM.GetCodeText_FromHash("项目地点", Convert.ToString(dv[0]["XMAddress"])); myReport.SetParameterValue("XMAddress", XMAdd); ToTalMoney = dv[0]["ToTalMoney"] + "万元"; myReport.SetParameterValue("ToTalMoney", ToTalMoney); ZiZhiDJ = dv[0]["ZiZhiDJ"].ToString(); ZiZhiDJ_ZH = dv[0]["ZiZhiBH"].ToString(); myReport.SetParameterValue("ZiZhiDJ", ZiZhiDJ); myReport.SetParameterValue("ZiZhiDJ_ZH", ZiZhiDJ_ZH); HeTongMoney = dv[0]["HeTongMoney"] + "万元"; myReport.SetParameterValue("HeTongMoney", HeTongMoney); GuiMoDJ = DB_CM.GetCodeText_FromHash("项目规模等级", Convert.ToString(dv[0]["GuiMoDJ"])); myReport.SetParameterValue("GuiMoDJ", GuiMoDJ); JSDWName = dv[0]["JSDWName"].ToString(); myReport.SetParameterValue("JSDWName", JSDWName); XMLXR_JS = dv[0]["XMLXR_JS"].ToString(); myReport.SetParameterValue("XMLXR_JS", XMLXR_JS); LXDH_JS = dv[0]["LXDH_JS"].ToString(); myReport.SetParameterValue("LXDH_JS", LXDH_JS); XMLXR_KS = dv[0]["XMLXR_KS"].ToString(); myReport.SetParameterValue("XMLXR_KS", XMLXR_KS); LXDH_KS = dv[0]["LXDH_KS"].ToString();//+ "/" + dv[0]["SJ_KS"].ToString() myReport.SetParameterValue("LXDH_KS", LXDH_KS); XMFZR = dv[0]["XMFZR"].ToString(); myReport.SetParameterValue("XMFZR", XMFZR); XMBH = dv[0]["XMBH"].ToString(); //注意处理,如果没有的话,就把编号的前面取出来 XMBH = RG_DW.GetXMBH(dv[0]["RowGuid"], dv[0]["DWGuid"], dv[0]["XMAdd"], dv[0]["XMBH"], dv[0]["XMLB"]); myReport.SetParameterValue("XMBH", XMBH); //有效期 string YXQ = ""; //获取最后一次审核通过意见 if (dv[0]["Status"].ToString() == "90") { myReport.SetParameterValue("SHOpinion", RG_DW.GetLastSHOpinion(Request["RowGuid"], "")); if (dv[0]["TGDate"].ToString() != "") { DateTime dtPass = DateTime.Parse(dv[0]["TGDate"].ToString()); YXQ = "有效期至:" + dtPass.AddYears(2).ToString("yyyy年MM月dd日"); myReport.SetParameterValue("TGDate", dtPass.ToString("yyyy年MM月dd日") + "\n" + YXQ); } else { myReport.SetParameterValue("TGDate", " 年 月 日"); } } else { myReport.SetParameterValue("SHOpinion", ""); myReport.SetParameterValue("TGDate", " 年 月 日"); } //myReport.SetParameterValue("YXQ", YXQ); } #endregion CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions(); myReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; myReport.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; string thisTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); string fileName = thisTime + "XMBA.pdf"; DiskOpts.DiskFileName = Server.MapPath(Request.ApplicationPath + "/AttachStorage/" + fileName); myReport.ExportOptions.DestinationOptions = DiskOpts; myReport.Export(); //判断下状态,如果是已经审核通过了,那么就处理公章,否则直接加载 if (STATUS != "90") { if (this.LoginID == "admin") { string WatermarkImageUrl = Server.MapPath(Request.ApplicationPath + "/HTProject/Pages/Images/合同备案公章.gif"); string message = ""; string fileNewName = thisTime + "_2XMBA.pdf"; string fileNew = Request.ApplicationPath + "/AttachStorage/" + fileNewName; WatermarkPDF(DiskOpts.DiskFileName, Server.MapPath(fileNew), WatermarkImageUrl, 400, 500, 115, 115, out message, dvRY.Count); //Response.Write("<script language=javascript> window.location.href = '../../../AttachStorage/" + fileNewName + "'; </script> "); Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileNewName + "'; </script> "); //Response.Redirect(fileNew); } else { Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileName + "'; </script> "); } } else { string WatermarkImageUrl = Server.MapPath(Request.ApplicationPath + "/HTProject/Pages/Images/合同备案公章.gif"); string message = ""; string fileNewName = thisTime + "_2XMBA.pdf"; string fileNew = Request.ApplicationPath + "/AttachStorage/" + fileNewName; WatermarkPDF(DiskOpts.DiskFileName, Server.MapPath(fileNew), WatermarkImageUrl, 400, 500, 115, 115, out message, dvRY.Count); //Response.Write("<script language=javascript> window.location.href = '../../../AttachStorage/" + fileNewName + "'; </script> "); Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileNewName + "'; </script> "); //Response.Redirect(fileNew); } } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { HeTongBeiAn rpt = new HeTongBeiAn(); rpt.Site = this.Site; return rpt; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //先处理下附件文件夹中的备案表,防止过大 DeleteSignedFile(Server.MapPath(Request.ApplicationPath + "/AttachStorage/")); HeTongBeiAn myReport = new HeTongBeiAn(); string strSql = ""; //先初始化项目信息 //看看该公司所在的地区 CRS_BeiAn.Report.FileName = System.Configuration.ConfigurationManager.AppSettings["BeiAnPrint_SN"]; //Epoint.Frame.Common.ApplicationOperate.GetConfigValueByName("BeiAnPrint_SN", ""); ; //CRS_BeiAn.Report. #region 人员 HeTongInfo ds = new HeTongInfo(); strSql = "select * from RG_XMAndRY RY where XMGuid='" + Request["RowGuid"] + "' order by substring(RY.ZhuanYeCode,1,4) asc,RY.DDRole desc "; DataView dvRY = Epoint.MisBizLogic2.DB.ExecuteDataView(strSql); int count = dvRY.Count; for (int i = 0; i < dvRY.Count; i++) { DataRow dr4; dr4 = ds.Tables["RYOfXM"].NewRow(); dr4["ZiZhiText"] = dvRY[i]["ZiZhiText"].ToString(); dr4["ZhuanYeText"] = dvRY[i]["ZhuanYeText"].ToString(); dr4["RYName"] = dvRY[i]["RYName"].ToString(); dr4["IDNum"] = dvRY[i]["IDNum"];//Convert.ToDecimal( dr4["ZhiCheng"] = DB_CM.GetCodeText_FromHash("职称", Convert.ToString(dvRY[i]["ZhiCheng"]));; dr4["YinZhangNo"] = dvRY[i]["YinZhangNo"].ToString(); dr4["ZhuanYeSX"] = dvRY[i]["ZhuanYeSX"].ToString(); //处理下从事的专业,尽量缩小 string ZhuanYeCS = dvRY[i]["ZhuanYeCS"].ToString(); //string ZYCS = "";// RG_DW.GetItemTextByLen2("29b7967e-8098-42d5-8b40-ec757b0865a5", ZhuanYeCS, 4); //string[] CS = ZhuanYeCS.Split(';'); //for (int m = 0; m < CS.Length; m++) //{ // ZYCS += RG_DW.GetItemTextByLen2("29b7967e-8098-42d5-8b40-ec757b0865a5", CS[m], 4); // ZYCS += ";"; //} //if (ZYCS.Length > 0) //{ // ZYCS = ZYCS.Substring(0, ZYCS.Length - 1); //} dr4["ZhuanYeCS"] = ZhuanYeCS; dr4["GongLing"] = dvRY[i]["GongLing"]; dr4["DDRole"] = DB_CM.GetCodeText_FromHash("项目角色", Convert.ToString(dvRY[i]["DDRole"])); dr4["OrNo"] = i + 1; ds.Tables["RYOfXM"].Rows.Add(dr4); } //for (int m = 19; m > dvRY.Count; m--) //{ // DataRow dr4; // dr4 = ds.Tables["RYOfXM"].NewRow(); // dr4["ZiZhiText"] = ""; // dr4["ZhuanYeText"] = ""; // dr4["RYName"] = ""; // dr4["IDNum"] = "";//Convert.ToDecimal( // dr4["ZhiCheng"] = ""; ; // dr4["YinZhangNo"] = ""; // dr4["ZhuanYeSX"] = ""; // dr4["ZhuanYeCS"] = ""; // dr4["GongLing"] = ""; // dr4["DDRole"] = ""; // dr4["OrNo"] = dvRY.Count + 19 - m; // ds.Tables["RYOfXM"].Rows.Add(dr4); //} //HeTongBeiAn oCR = new HeTongBeiAn(); myReport.SetDataSource(ds.Tables["RYOfXM"]); #endregion #region 参数 strSql = "select * from RG_XMBeiAn where RowGuid='" + Request["RowGuid"] + "' "; DataView dv = Epoint.MisBizLogic2.DB.ExecuteDataView(strSql); string DWName = ""; string TJDate = ""; string XMName = ""; string XMAdd = ""; string ToTalMoney = ""; string GuiMoDJ = ""; string JSDWName = ""; string XMLXR_JS = ""; string LXDH_JS = ""; string XMLXR_KS = ""; string LXDH_KS = ""; string XMFZR = ""; string ZiZhiDJ = ""; string ZiZhiDJ_ZH = ""; string HeTongMoney = ""; string XMBH = ""; string STATUS = ""; if (dv.Count > 0) { STATUS = dv[0]["STATUS"].ToString(); strSql = "select EnterpriseName from RG_OUInfo where RowGuid='" + dv[0]["DWGuid"] + "'"; DWName = Epoint.MisBizLogic2.DB.ExecuteToString(strSql); myReport.SetParameterValue("DWName", DWName); if (dv[0]["TJDate"].ToString() != "") { TJDate = DateTime.Parse(dv[0]["TJDate"].ToString()).ToString("yyyy-MM-dd"); } else { TJDate = ""; } myReport.SetParameterValue("TJDate", TJDate); XMName = dv[0]["XMName"].ToString(); myReport.SetParameterValue("XMName", XMName); XMAdd = DB_CM.GetCodeText_FromHash("项目地点", Convert.ToString(dv[0]["XMAddress"])); myReport.SetParameterValue("XMAddress", XMAdd); ToTalMoney = dv[0]["ToTalMoney"] + "万元"; myReport.SetParameterValue("ToTalMoney", ToTalMoney); ZiZhiDJ = dv[0]["ZiZhiDJ"].ToString(); ZiZhiDJ_ZH = dv[0]["ZiZhiBH"].ToString(); myReport.SetParameterValue("ZiZhiDJ", ZiZhiDJ); myReport.SetParameterValue("ZiZhiDJ_ZH", ZiZhiDJ_ZH); HeTongMoney = dv[0]["HeTongMoney"] + "万元"; myReport.SetParameterValue("HeTongMoney", HeTongMoney); GuiMoDJ = DB_CM.GetCodeText_FromHash("项目规模等级", Convert.ToString(dv[0]["GuiMoDJ"])); myReport.SetParameterValue("GuiMoDJ", GuiMoDJ); JSDWName = dv[0]["JSDWName"].ToString(); myReport.SetParameterValue("JSDWName", JSDWName); XMLXR_JS = dv[0]["XMLXR_JS"].ToString(); myReport.SetParameterValue("XMLXR_JS", XMLXR_JS); LXDH_JS = dv[0]["LXDH_JS"].ToString(); myReport.SetParameterValue("LXDH_JS", LXDH_JS); XMLXR_KS = dv[0]["XMLXR_KS"].ToString(); myReport.SetParameterValue("XMLXR_KS", XMLXR_KS); LXDH_KS = dv[0]["LXDH_KS"].ToString();//+ "/" + dv[0]["SJ_KS"].ToString() myReport.SetParameterValue("LXDH_KS", LXDH_KS); XMFZR = dv[0]["XMFZR"].ToString(); myReport.SetParameterValue("XMFZR", XMFZR); XMBH = dv[0]["XMBH"].ToString(); //注意处理,如果没有的话,就把编号的前面取出来 XMBH = RG_DW.GetXMBH(dv[0]["RowGuid"], dv[0]["DWGuid"], dv[0]["XMAdd"], dv[0]["XMBH"], dv[0]["XMLB"]); myReport.SetParameterValue("XMBH", XMBH); //有效期 string YXQ = ""; //获取最后一次审核通过意见 if (dv[0]["Status"].ToString() == "90") { myReport.SetParameterValue("SHOpinion", RG_DW.GetLastSHOpinion(Request["RowGuid"], "")); if (dv[0]["TGDate"].ToString() != "") { DateTime dtPass = DateTime.Parse(dv[0]["TGDate"].ToString()); YXQ = "有效期至:" + dtPass.AddYears(2).ToString("yyyy年MM月dd日"); myReport.SetParameterValue("TGDate", dtPass.ToString("yyyy年MM月dd日") + "\n" + YXQ); } else { myReport.SetParameterValue("TGDate", " 年 月 日"); } } else { myReport.SetParameterValue("SHOpinion", ""); myReport.SetParameterValue("TGDate", " 年 月 日"); } //myReport.SetParameterValue("YXQ", YXQ); } #endregion CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions(); myReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; myReport.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; string thisTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); string fileName = thisTime + "XMBA.pdf"; DiskOpts.DiskFileName = Server.MapPath(Request.ApplicationPath + "/AttachStorage/" + fileName); myReport.ExportOptions.DestinationOptions = DiskOpts; myReport.Export(); //判断下状态,如果是已经审核通过了,那么就处理公章,否则直接加载 if (STATUS != "90") { if (this.LoginID == "admin") { string WatermarkImageUrl = Server.MapPath(Request.ApplicationPath + "/HTProject/Pages/Images/合同备案公章.gif"); string message = ""; string fileNewName = thisTime + "_2XMBA.pdf"; string fileNew = Request.ApplicationPath + "/AttachStorage/" + fileNewName; WatermarkPDF(DiskOpts.DiskFileName, Server.MapPath(fileNew), WatermarkImageUrl, 400, 500, 115, 115, out message, dvRY.Count); //Response.Write("<script language=javascript> window.location.href = '../../../AttachStorage/" + fileNewName + "'; </script> "); Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileNewName + "'; </script> "); //Response.Redirect(fileNew); } else { Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileName + "'; </script> "); } } else { string WatermarkImageUrl = Server.MapPath(Request.ApplicationPath + "/HTProject/Pages/Images/合同备案公章.gif"); string message = ""; string fileNewName = thisTime + "_2XMBA.pdf"; string fileNew = Request.ApplicationPath + "/AttachStorage/" + fileNewName; WatermarkPDF(DiskOpts.DiskFileName, Server.MapPath(fileNew), WatermarkImageUrl, 400, 500, 115, 115, out message, dvRY.Count); //Response.Write("<script language=javascript> window.location.href = '../../../AttachStorage/" + fileNewName + "'; </script> "); Response.Write("<script language=javascript> window.location.href = 'pdfReader.aspx?fileName=" + fileNewName + "'; </script> "); //Response.Redirect(fileNew); } } }