IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticAirLine> list = null;//未收集合 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!CheckGrant(TravelPermission.机票管理_机票管理_出票统计)) { Utils.ResponseNoPermit(TravelPermission.机票管理_机票管理_出票统计, false); } Bind(); #region 导出报表请求 if (Utils.GetInt(Request.QueryString["isExport"], 0) == 1) { var bll = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(SiteUserInfo); var model = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); model.OfficeName = Utils.GetQueryStringValue("OfficeName"); model.CompanyId = SiteUserInfo.CompanyID; model.DepartName = Utils.GetQueryStringValue("DepartMents"); string strDepIds = Utils.GetQueryStringValue("DepartIds"); model.DepartIds = JiPiao_TuiList.GetIntArrByStr(strDepIds); model.StartTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("DateTime")); model.EndTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("endtime")); model.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); model.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); list = bll.GetTicketOutStatisticAirLine(model); if (list != null && list.Count != 0) { ToExcel(this.rpt_list, list); } } #endregion } }
void Bind() { pageIndex = EyouSoft.Common.Utils.GetInt(Request.QueryString["page"], 1); EyouSoft.BLL.StatisticStructure.TicketOutStatistic bll = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(SiteUserInfo); EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti model = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); model.OfficeName = Utils.GetQueryStringValue("OfficeName"); model.CompanyId = SiteUserInfo.CompanyID; model.DepartName = Utils.GetQueryStringValue("DepartMents"); string strDepIds = Utils.GetQueryStringValue("DepartIds"); model.DepartIds = JiPiao_TuiList.GetIntArrByStr(strDepIds); model.StartTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("DateTime")); model.EndTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("endtime")); model.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); model.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); list = bll.GetTicketOutStatisticAirLine(model); if (list != null && list.Count > 0) { recordCount = list.Count; rpt_list.DataSource = list.Skip((pageIndex - 1) * pageSize).Take(pageSize); rpt_list.DataBind(); #region 设置总计 //总票数 this.lblAllTickets = list.Sum(p => p.TicketOutNum).ToString(); //应付机票款 this.lblNeedMoney = list.Sum(p => p.TotalAmount).ToString("¥#,###0.00"); //已付机票款 this.lblOverMoney = list.Sum(p => p.PayAmount).ToString("¥#,###0.00"); //未付机票款 this.lblNoMoney = list.Sum(p => p.UnPaidAmount).ToString("¥#,###0.00"); #endregion #region 设置分页 ExportPageInfo1.intPageSize = pageSize; ExportPageInfo1.intRecordCount = recordCount; ExportPageInfo1.PageLinkURL = Request.Path + "?"; ExportPageInfo1.UrlParams = Request.QueryString; ExportPageInfo1.CurrencyPage = pageIndex; #endregion } else { //没有数据隐藏控件 ExportPageInfo1.Visible = false; } UCselectDepart.GetDepartmentName = model.DepartName; UCselectDepart.GetDepartId = strDepIds; txt_date.Value = model.StartTicketOutTime.HasValue ? model.StartTicketOutTime.Value.ToString("yyyy-MM-dd") : ""; txt_endDate.Value = model.EndTicketOutTime.HasValue ? model.EndTicketOutTime.Value.ToString("yyyy-MM-dd") : ""; txt_spq.Value = model.OfficeName; txtLeaveDateStart.Text = model.LeaveDateStart.HasValue ? model.LeaveDateStart.Value.ToString("yyyy-MM-dd") : string.Empty; txtLeaveDateEnd.Text = model.LeaveDateEnd.HasValue ? model.LeaveDateEnd.Value.ToString("yyyy-MM-dd") : string.Empty; }
/// <summary> /// 导出Excel /// </summary> public void toExcel(string FileName) { EyouSoft.SSOComponent.Entity.UserInfo UserModel = new EyouSoft.SSOComponent.Entity.UserInfo(); UserModel.CompanyID = SiteUserInfo.CompanyID; EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti ssModel = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); //查询条件 ssModel.CompanyId = SiteUserInfo.CompanyID; string departId = Utils.GetQueryStringValue("DepartIds"); string OfficeName = Utils.GetQueryStringValue("OfficeName");//获取航空公司查询条件 int[] AirLineIds = new int[1]; AirLineIds[0] = Utils.GetInt(Utils.GetQueryStringValue("areaId"));//获取售票处查询条件 if (AirLineIds[0] > 0) { ssModel.AirLineIds = AirLineIds; } ssModel.DepartIds = JiPiao_TuiList.GetIntArrByStr(departId); ssModel.OfficeName = OfficeName; ssModel.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); ssModel.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); EyouSoft.BLL.StatisticStructure.TicketOutStatistic ssBLL = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(UserModel); IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticTime> ssList = null; ssList = ssBLL.GetTicketOutStatisticTime(ssModel); Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ".xls"); Response.ContentEncoding = System.Text.Encoding.Default; Response.ContentType = "application/ms-excel"; //取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符 StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "月份", "出票量", "应付机票款", "已付机票款", "未付机票款"); foreach (EyouSoft.Model.StatisticStructure.TicketOutStatisticTime cs in ssList) { sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", cs.CurrYear + "年" + cs.CurrMonth + "月", cs.TicketOutNum + "(张)", cs.TotalAmount.ToString("¥#,##0.00 "), cs.PayAmount.ToString("¥#,##0.00 "), cs.UnPaidAmount.ToString("¥#,##0.00 ")); } sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "总计", lblAllTickets.Text + "(张)", lblNeedMoney.Text, lblOverMoney.Text, lblNoMoney.Text); Response.Write(sb.ToString()); Response.End(); }
//导出 protected void ToExcel(string title) { EyouSoft.BLL.StatisticStructure.TicketOutStatistic ticketBll = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(SiteUserInfo); IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticDepart> list = null; EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti searchInfo = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); int tmpAirLineId = Utils.GetInt(Utils.GetQueryStringValue("areaId"), -1); if (tmpAirLineId > 0) { searchInfo.AirLineIds = new int[1] { tmpAirLineId }; } searchInfo.CompanyId = SiteUserInfo.CompanyID; searchInfo.OfficeName = Utils.GetQueryStringValue("OfficeName"); searchInfo.StartTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("DateTime")); searchInfo.EndTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("endTime")); searchInfo.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); searchInfo.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); //用gerList方法取得总记录的条数 list = ticketBll.GetTicketOutStatisticDepart(searchInfo); Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + title + ".xls"); Response.ContentEncoding = System.Text.Encoding.Default; Response.ContentType = "application/ms-excel"; //取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符 StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "部门", "出票量", "应付机票款", "已付机票款", "未付机票款"); foreach (EyouSoft.Model.StatisticStructure.TicketOutStatisticDepart ticket in list) { sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", ticket.DepartName, ticket.TicketOutNum, "¥" + ticket.TotalAmount, "¥" + ticket.PayAmount, "¥" + ticket.UnPaidAmount); } sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "总计", list.Sum(p => p.TicketOutNum).ToString(), list.Sum(p => p.TotalAmount).ToString("c2"), list.Sum(p => p.PayAmount).ToString("c2"), list.Sum(p => p.UnPaidAmount).ToString("c2")); Response.Write(sb.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { ticketmodel = new EyouSoft.Model.StatisticStructure.TicketOutStatisticOffice(); TicketBll = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(SiteUserInfo); //权限判断 if (!CheckGrant(global::Common.Enum.TravelPermission.机票管理_出票统计_栏目)) { EyouSoft.Common.Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.机票管理_出票统计_栏目, false); return; } if (!IsPostBack) { BindAirlines(); BindList(); if (EyouSoft.Common.Utils.GetQueryStringValue("action") == "toexcel") { CreateExcel("TicketOutNum" + DateTime.Now.ToShortDateString()); } } }
//绑定数据 protected void Bind() { pageIndex = EyouSoft.Common.Utils.GetInt(Request.QueryString["page"], 1); EyouSoft.BLL.StatisticStructure.TicketOutStatistic ticketBll = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(SiteUserInfo); EyouSoft.Model.StatisticStructure.TicketOutStatisticDepart ticketDepart = new EyouSoft.Model.StatisticStructure.TicketOutStatisticDepart(); EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti queryTicket = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); int tmpAirLineId = Utils.GetInt(Utils.GetQueryStringValue("areaId"), -1); if (tmpAirLineId > 0) { queryTicket.AirLineIds = new int[1] { tmpAirLineId }; } queryTicket.CompanyId = SiteUserInfo.CompanyID; queryTicket.OfficeName = Utils.GetQueryStringValue("OfficeName"); queryTicket.StartTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("DateTime")); queryTicket.EndTicketOutTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("endtime")); queryTicket.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); queryTicket.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticDepart> list = ticketBll.GetTicketOutStatisticDepart(queryTicket); if (list != null && list.Count > 0) { recordCount = list.Count; retList.DataSource = list.Skip((pageIndex - 1) * pageSize).Take(pageSize); this.retList.DataBind(); BindPage(); this.lblMsg.Visible = false; #region 设置总计 //总票数 this.lblAllTickets.Text = list.Sum(p => p.TicketOutNum).ToString(); //应付机票款 this.lblNeedMoney.Text = list.Sum(p => p.TotalAmount).ToString("c2"); //已付机票款 this.lblOverMoney.Text = list.Sum(p => p.PayAmount).ToString("c2"); //未付机票款 this.lblNoMoney.Text = list.Sum(p => p.UnPaidAmount).ToString("c2"); #endregion } else { this.lblMsg.Visible = true; this.ExportPageInfo1.Visible = false; } this.ddlAirLineIds.SelectedValue = tmpAirLineId.ToString(); if (queryTicket.StartTicketOutTime.HasValue) { this.txt_date.Value = queryTicket.StartTicketOutTime.Value.ToShortDateString(); } if (queryTicket.EndTicketOutTime.HasValue) { this.txt_endDate.Value = queryTicket.EndTicketOutTime.Value.ToShortDateString(); } if (queryTicket.LeaveDateStart.HasValue) { txtLeaveDateStart.Text = queryTicket.LeaveDateStart.Value.ToShortDateString(); } if (queryTicket.LeaveDateEnd.HasValue) { txtLeaveDateEnd.Text = queryTicket.LeaveDateEnd.Value.ToShortDateString(); } this.txt_spq.Value = queryTicket.OfficeName; }
/// <summary> /// 绑定列表 /// </summary> private void DataBindLs() { //获取显示页数 pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1); //用户信息实体 EyouSoft.SSOComponent.Entity.UserInfo UserModel = new EyouSoft.SSOComponent.Entity.UserInfo(); //公司编号 UserModel.CompanyID = SiteUserInfo.CompanyID; //出票统计查询实体 EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti ssModel = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); //查询条件 ssModel.CompanyId = SiteUserInfo.CompanyID; string DepartName = Utils.GetQueryStringValue("DepartMents"); //获取部门查询条件 string departId = Utils.GetQueryStringValue("DepartIds"); string OfficeName = Utils.GetQueryStringValue("OfficeName"); //获取航空公司查询条件 int[] AirLineIds = new int[1]; AirLineIds[0] = Utils.GetInt(Utils.GetQueryStringValue("areaId"));//获取售票处查询条件 if (AirLineIds[0] > 0) { ssModel.AirLineIds = AirLineIds; } ssModel.DepartIds = JiPiao_TuiList.GetIntArrByStr(departId); ssModel.OfficeName = OfficeName; ssModel.LeaveDateStart = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateS")); ssModel.LeaveDateEnd = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("leaDateE")); //出票统计BLL EyouSoft.BLL.StatisticStructure.TicketOutStatistic ssBLL = new EyouSoft.BLL.StatisticStructure.TicketOutStatistic(UserModel); //按日期获取出票统计 IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticTime> ssList = ssBLL.GetTicketOutStatisticTime(ssModel); if (ssList != null && ssList.Count > 0) { retList.DataSource = ssList.Skip((pageIndex - 1) * pageSize).Take(pageSize);; retList.DataBind(); recordCount = ssList.Count; BindPage(); #region 设置总计 //总票数 this.lblAllTickets.Text = ssList.Sum(p => p.TicketOutNum).ToString(); //应付机票款 this.lblNeedMoney.Text = ssList.Sum(p => p.TotalAmount).ToString("¥#,##0.00"); //已付机票款 this.lblOverMoney.Text = ssList.Sum(p => p.PayAmount).ToString("¥#,##0.00"); //未付机票款 this.lblNoMoney.Text = ssList.Sum(p => p.UnPaidAmount).ToString("¥#,##0.00"); #endregion this.lblMsg.Visible = false; } else { this.ExportPageInfo1.Visible = false; } ssList = null; Bindddl(AirLineIds); txt_spq.Value = ssModel.OfficeName; if (ssModel.LeaveDateStart.HasValue) { txtLeaveDateStart.Text = ssModel.LeaveDateStart.Value.ToShortDateString(); } if (ssModel.LeaveDateEnd.HasValue) { txtLeaveDateEnd.Text = ssModel.LeaveDateEnd.Value.ToShortDateString(); } UCselectDepart.GetDepartmentName = DepartName; UCselectDepart.GetDepartId = departId; }