/// <summary> /// 产生一个报表 /// </summary> /// <param name="ens">要产生报表的集合</param> /// <param name="cyclostyfilename">参数文件名称。</param> public static string GenerRptByPeng(Entity en) { string temp = Web.WebUser.No + DateTime.Now.ToString("yyyyMMddhhmmss") + ".Doc"; BP.Rpt.Rtf rpt = new BP.Rpt.Rtf(); string BillTemplatePath = SystemConfig.GetConfigXmlEns("BillTemplatePath", en.GetNewEntities.ToString()); if (BillTemplatePath == null) { throw new Exception("生成单据出现错误:您没有在ConfigEns.xml设置他的单据模板位置。"); } rpt.LoadCyclostyle(BillTemplatePath, temp); rpt.DataEns.AddEntity(en); rpt.MakeDocument(); string url = System.Web.HttpContext.Current.Request.ApplicationPath + "Temp/" + rpt.FileName; PubClass.OpenWordDoc(url, rpt.FileName); return(url); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { UAC uac = this.HisEn.HisUAC; if (uac.IsView == false) { throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限."); } if (this.IsPostBack == false) { BP.Sys.Contrast c = new BP.Sys.Contrast(); c.MyPK = this.EnsName + WebUser.No; if (c.RetrieveFromDBSources() == 0) { c.ContrastKey = this.Request.QueryString["ContrastKey"]; } try { #region 设置tool bar 1 的contral #region 判断权限 if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } #endregion // 比较对象。 Map map = this.HisEn.EnMap; string NoShowCont = "@FK_Dot@FK_Rate@"; // string NoShowCont = SystemConfig.GetConfigXmlEns("NoShowContrast", this.EnsName); foreach (Attr attr in map.Attrs) { if (attr.MyFieldType == FieldType.FK || attr.MyFieldType == FieldType.PKFK) { if (NoShowCont.Contains(attr.Key)) { continue; } this.DDL_ContrastKey.Items.Add(new ListItem(attr.Desc, attr.Key)); } } this.DDL_ContrastKey.SetSelectItem(c.ContrastKey); foreach (Attr attr in map.Attrs) { if (attr.IsPK) { continue; } if (attr.UIContralType == UIContralType.TB == false) { continue; } if (attr.MyFieldType == FieldType.FK) { continue; } if (attr.MyFieldType == FieldType.Enum) { continue; } if (attr.MyFieldType == FieldType.PKEnum) { continue; } if (attr.Key == "OID" || attr.Key == "WorkID" || attr.Key == "MID") { continue; } switch (attr.MyDataType) { case DataType.AppDouble: case DataType.AppFloat: case DataType.AppInt: case DataType.AppMoney: case DataType.AppRate: this.DDL_GroupField.Items.Add(new ListItem(attr.Desc, attr.Key)); break; default: break; } } this.DDL_GroupField.SetSelectItem(this.ContrastObj); this.DDL_GroupWay.Items.Add(new ListItem("求和", "0")); this.DDL_GroupWay.Items.Add(new ListItem("求平均", "1")); this.DDL_OrderWay.Items.Add(new ListItem("降序", "0")); this.DDL_OrderWay.Items.Add(new ListItem("升序", "1")); if (this.Request.QueryString["OperateCol"] != null) { string[] strs = this.Request.QueryString["OperateCol"].Split('_'); this.DDL_GroupField.SetSelectItem(strs[0]); this.DDL_GroupWay.SetSelectItem(strs[1]); } #endregion this.ToolBar1.InitByMapV2(this.HisEn.EnMap, 1); this.BindContrastKey(map); InitState(c); this.SetDGData(); } catch (Exception ex) { this.HisEns.DoDBCheck(DBCheckLevel.High); throw new Exception("@装载出现错误:" + ex.Message); } } //this.ToolBar1.ButtonClick += new System.EventHandler(this.ToolBar1_ButtonClick); string lab = SystemConfig.GetConfigXmlEns("Contrast", this.EnsName); if (lab == null) { lab = this.HisEn.EnMap.EnDesc; } this.Label2.Text = this.ContrastLab + "1"; this.Label3.Text = this.ContrastLab + "2"; this.Label1.Text = this.GenerCaption(lab); // this.Label1.Controls.Add(this.GenerLabel("<img src='../Img/Btn/DataGroup.gif' border=0 />" + lab)); this.DDL_ContrastKey.AutoPostBack = true; this.DDL_ContrastKey.SelectedIndexChanged += new EventHandler(DDL_ContrastKey_SelectedIndexChanged); this.BindDDLMore(); }
/// <summary> /// BindEntities /// </summary> /// <param name="ens">ens</param> /// <param name="refkey">refkey</param> /// <param name="reftext">reftext</param> /// <param name="isShowKey">is show key</param> /// <param name="isClearItems">is clear item</param> /// <param name="where">where the -=all=- location.</param> public void BindEntities(Entities ens, string refkey, string reftext, bool isShowKey, bool isClearItems, AddAllLocation where) { string val = SystemConfig.GetConfigXmlEns("ShowTextLen", this.SelfBindKey); int len = 0; if (val != null) { len = int.Parse(val); } if (isClearItems) { this.Items.Clear(); } if (where == AddAllLocation.Top || where == AddAllLocation.TopAndEnd) { ListItem li = new ListItem("-=全部=-", "all"); this.Items.Add(li); } if (SystemConfig.MaxDDLNum <= ens.Count) { ListItem liMore = new ListItem(); liMore.Text = "请用更多..."; liMore.Value = "all"; this.Items.Add(liMore); BP.Web.Controls.BPToolBar blb = (BP.Web.Controls.BPToolBar) this.Parent; blb.AddLab("<a href=\"javascript:onDDLSelectedMore('" + this.ID + "', '" + this.EnsName + "', '" + ens.ToString() + "', 'No','Name')\" >...</a>"); return; } /// #warning 处理多选择的问题 int maxNum = SystemConfig.MaxDDLNum; string text = ""; string key = ""; int i = 0; foreach (Entity en in ens) { text = en.GetValStringByKey(reftext); key = en.GetValStringByKey(refkey); ListItem li = new ListItem(); if (len > 0) { if (text.Length > len) { li.Attributes["title"] = text; text = text.Substring(0, len); } } if (isShowKey) { li.Text = key + " " + text; li.Value = key; } else { li.Text = text; li.Value = key; } this.Items.Add(li); i++; if (i >= maxNum) { li = new ListItem(); li.Text = "请用更多..."; li.Value = "all"; this.Items.Add(li); BP.Web.Controls.BPToolBar blb = (BP.Web.Controls.BPToolBar) this.Parent; blb.AddLab("<a href=\"javascript:onDDLSelectedMore('" + this.ID + "', '" + this.EnsName + "', '" + ens.ToString() + "', 'No','Name')\" >...</a>"); // this.AutoPostBack = true; // this.SelectedIndexChanged += new EventHandler(ToolbarDDL_SelectedIndexChanged); //li.Attributes["class"] = "sssssss"; //li.Attributes["bgColor"] = "Red"; // writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red"); // li.Attributes[ //ToolbarBtn btn = new ToolbarBtn(); //btn.Text="..."; // blb.AddBtn("Btn_" // blb.Attributes.Add("selcecChange", "alert('hello')"); //blb.Attributes.Add("onclick", "onDDLSelectedMore('" + blb.ClientID + "')"); // this.Attributes["onclick"] = "alert('hello')"; // li.Attributes["onclick"] = "alert('hello')"; //this.Items.Add(li); //System.IO.TextWriter; //System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(; //this.AddAttributesToRender(HtmlTextWriterAttribute.o // this.AddAttributesToRender(htw); break; } } if (where == AddAllLocation.End || where == AddAllLocation.TopAndEnd) { ListItem li = new ListItem("-=全部=-", "all"); this.Items.Add(li); //this.Items. } }