/// <summary> /// 执行sql语句,获取DataTable /// </summary> private DataTable GetDataTableBySql() { //执行sql语句 if (string.IsNullOrEmpty(this.sqlId.Trim())) { return(null); } if (this.dtpFromDate.Value > this.dtpEndDate.Value) { MessageBox.Show("开始时间不能大于截止时间,请重新输入"); return(null); } Neusoft.HISFC.BizLogic.Manager.Report reportMgr = new Neusoft.HISFC.BizLogic.Manager.Report(); string[] parm = null; if (this.isHaveDept) { parm = new string[] { this.dtpFromDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.dtpEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbDept.Tag.ToString() }; } else { parm = new string[] { this.dtpFromDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.dtpEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") }; } DataSet ds = new DataSet(); if (reportMgr.ExecQuery(this.sqlId, ref ds, parm) < 0) { MessageBox.Show("查询数据出错:" + reportMgr.Err); return(null); } return(ds.Tables[0]); }
public int Query() { DateTime myBeginDate = this.dtpBeginDate.Value; //取开始时间 DateTime myEndDate = this.dtpEndDate.Value; //取结束时间 //判断时间的有效性 if (myEndDate.CompareTo(myBeginDate) < 0) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("终止时间必须大于起始时间")); return(-1); } this.lblTop.Text = Neusoft.FrameWork.Management.Language.Msg("统计时间:") + myBeginDate.ToString() + " - " + myEndDate.ToString(); Neusoft.HISFC.BizLogic.Manager.Report report = new Neusoft.HISFC.BizLogic.Manager.Report(); Neusoft.HISFC.BizLogic.Manager.Person ps = new Neusoft.HISFC.BizLogic.Manager.Person(); Neusoft.HISFC.Models.Base.Employee var = new Neusoft.HISFC.Models.Base.Employee(); var = ps.GetPersonByID(ps.Operator.ID); this.myDataSet = new DataSet(); int parm = report.ExecQuery(reportParm, ref this.myDataSet, myBeginDate.ToString(), myEndDate.ToString(), var.Dept.ID); if (parm == -1) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(report.Err)); return(-1); } //对farpoint绑定数据源 this.myDataView = new DataView(myDataSet.Tables[0]); this.neuSpread1_Sheet1.DataSource = this.myDataView; //格式化 该函数不在起作用 this.SetFormat(); if (this.iIndex != null) { this.SetSum(this.iTextIndex, this.iIndex); } return(1); }
/// <summary> /// 获取已经月结的操作时间列 /// </summary> /// <returns></returns> private ArrayList QueryDateList() { string strSql = string.Empty; strSql = string.Format("select distinct(to_char(t.oper_date,'yyyymmdd')) from pha_com_ms_drug t "); Neusoft.HISFC.BizLogic.Manager.Report reportManager = new Neusoft.HISFC.BizLogic.Manager.Report(); if (reportManager.ExecQuery(strSql) == -1) { MessageBox.Show("没有找到索引!"); return(null); } ArrayList arrdayList = new ArrayList(); string strday = string.Empty; Neusoft.HISFC.Models.Base.Const constObj = new Neusoft.HISFC.Models.Base.Const(); try { while (reportManager.Reader.Read()) { constObj = new Neusoft.HISFC.Models.Base.Const(); constObj.ID = reportManager.Reader[0].ToString(); constObj.Name = reportManager.Reader[0].ToString(); arrdayList.Add(constObj); } reportManager.Reader.Close(); return(arrdayList); } catch (Exception ex) { MessageBox.Show(ex.Message); if (!reportManager.Reader.IsClosed) { reportManager.Reader.Close(); } return(null); } }
/// <summary> /// 执行sql语句,获取DataTable /// </summary> private DataTable GetDataTableBySql(string sql) { //执行sql语句 if (string.IsNullOrEmpty(sql.Trim())) { return(null); } if (this.dtpFromDate.Value > this.dtpEndDate.Value) { MessageBox.Show("开始时间不能大于截止时间,请重新输入"); return(null); } Neusoft.HISFC.BizLogic.Manager.Report reportMgr = new Neusoft.HISFC.BizLogic.Manager.Report(); DataSet ds = new DataSet(); if (reportMgr.ExecQuery(sql, ref ds, detailParm) < 0) { MessageBox.Show("查询数据出错:" + reportMgr.Err); return(null); } return(ds.Tables[0]); }
/// <summary> /// 检索查询结果 /// </summary> public virtual void Query() { // TODO: 添加 ucReportBase.Query 实现 this.myBeginDate = this.dtpBeginDate.Value; //取开始时间 this.myEndDate = this.dtpEndDate.Value; //取结束时间 //判断时间的有效性 if (this.myEndDate.CompareTo(this.myBeginDate) < 0) { MessageBox.Show("终止时间必须大于起始时间!", "提示"); return; } this.lblTop.Text = "统计时间:" + this.myBeginDate.ToString() + " - " + this.myEndDate.ToString(); this.lblTop.Text = "统计科室:" + this.cmbDept.Text + " 统计日期:" //+ this.myBeginDate.ToString() + " - " + this.myEndDate.ToString(); + System.DateTime.Now.ToString("yyyy-MM-dd"); Neusoft.HISFC.BizLogic.Manager.Report report = new Neusoft.HISFC.BizLogic.Manager.Report(); //检索数据,返回dataset //this.myDataSet = report.Query(reportParm, this.myBeginDate, this.myEndDate); Neusoft.HISFC.BizLogic.Manager.Person ps = new Neusoft.HISFC.BizLogic.Manager.Person(); Neusoft.HISFC.Models.Base.Employee var = new Neusoft.HISFC.Models.Base.Employee();// Neusoft.FrameWork.WinForms.BaseVar(); var = ps.GetPersonByID(ps.Operator.ID); this.myDataSet = new DataSet(); try { if (this.cmbItem.Tag == null || this.cmbItem.Tag.ToString() == "" || this.cmbItem.SelectedIndex < 0) { this.cmbItem.Tag = "ALL"; } if (this.cmbDept.Tag == null || this.cmbItem.Tag == null) { MessageBox.Show("请先选择好申请科室!"); return; } int parm = report.ExecQuery("Material.Report.GetApplyInfoHistory", ref this.myDataSet, this.cmbDept.Tag.ToString(), this.cmbItem.Tag.ToString(), this.dtpBeginDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.dtpEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); if (parm == -1) { MessageBox.Show(report.Err); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } //格式配置文件地址 //对farpoint绑定数据源 this.myDataView = new DataView(myDataSet.Tables[0]); this.neuSpread1_Sheet1.DataSource = this.myDataView; this.neuSpread1_Sheet1.ColumnHeader.DefaultStyle.BackColor = System.Drawing.Color.White; this.neuSpread1_Sheet1.RowHeader.DefaultStyle.BackColor = System.Drawing.Color.White; this.neuSpread1_Sheet1.SheetCornerStyle.BackColor = System.Drawing.Color.White; this.neuSpread1_Sheet1.GrayAreaBackColor = System.Drawing.Color.White; this.SetFormat(); if (this.iIndex != null) { this.SetSum(this.iTextIndex, this.iIndex); } }