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(); }
/// <summary> /// 导出Excel /// </summary> public void CreateExcel(string FileName) { AirlinesValue = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetQueryStringValue("AirlinesValue")); string DepartId = EyouSoft.Common.Utils.GetQueryStringValue("DepartIds"); Datetime = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("DateTime")); ticketendtime = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("endtime")); LeaDateS = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("leaDateS")); LeaDateE = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("leaDateE")); //列表数据绑定 Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ".xls"); Response.ContentEncoding = System.Text.Encoding.Default; Response.ContentType = "application/ms-excel"; EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti QueryTicket = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); QueryTicket.CompanyId = SiteUserInfo.CompanyID; if (AirlinesValue > 0) { QueryTicket.AirLineIds = new int[1] { AirlinesValue } } ; QueryTicket.DepartIds = JiPiao_TuiList.GetIntArrByStr(DepartId); QueryTicket.EndTicketOutTime = ticketendtime; QueryTicket.StartTicketOutTime = Datetime; QueryTicket.LeaveDateStart = LeaDateS; QueryTicket.LeaveDateEnd = LeaDateE; IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticOffice> ticketlist = ticketlist = TicketBll.GetTicketOutStatisticOffice(QueryTicket); if (ticketlist != null && ticketlist.Count > 0) { //取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符 System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "售票处", "出票量", "应付机票款", "已付机票款", "未付机票款"); foreach (EyouSoft.Model.StatisticStructure.TicketOutStatisticOffice sh in ticketlist) { sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", sh.OfficeName, sh.TicketOutNum, "¥" + sh.TotalAmount, "¥" + sh.PayAmount, "¥" + sh.UnPaidAmount); } sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\n", "总计", ticketlist.Sum(p => p.TicketOutNum).ToString(), "¥" + ticketlist.Sum(p => p.TotalAmount).ToString(), "¥" + ticketlist.Sum(p => p.PayAmount).ToString(), "¥" + ticketlist.Sum(p => p.UnPaidAmount).ToString()); Response.Write(sb.ToString()); Response.End(); } }
/// <summary> /// 初始化方法 /// </summary> /// <param name="id"></param> /// <param name="departIds"></param> /// <param name="areaIds"></param> /// <param name="beginDate"></param> /// <param name="endDate"></param> /// <param name="leaDateStart"></param> /// <param name="leaDateEnd"></param> /// <param name="officeName"></param> protected void DataInit(int id, string departIds, string areaIds, DateTime?beginDate, DateTime?endDate, DateTime?leaDateStart , DateTime?leaDateEnd, string officeName) { //部门ID 的集合 int[] departIdList = JiPiao_TuiList.GetIntArrByStr(departIds); //航空公司 ID 集合 int[] areaIdList = JiPiao_TuiList.GetIntArrByStr(areaIds); //声明查询Model EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti searchModel = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); //查询Model 赋值 searchModel.CompanyId = SiteUserInfo.CompanyID; searchModel.DepartIds = departIdList; searchModel.AirLineIds = areaIdList; searchModel.StartTicketOutTime = beginDate; searchModel.EndTicketOutTime = endDate; searchModel.OfficeId = id; searchModel.LeaveDateStart = leaDateStart; searchModel.LeaveDateEnd = leaDateEnd; searchModel.OfficeName = officeName; //声明机票 bll 操作对象 EyouSoft.BLL.PlanStruture.PlaneTicket bll = new EyouSoft.BLL.PlanStruture.PlaneTicket(SiteUserInfo); //声明出票量集合对象 IList <EyouSoft.Model.PlanStructure.TicketOutStatisticInfo> list = bll.GetTicketOutStatisticList(pageSize, pageIndex, ref recordCount, searchModel); //判断list内数据条数大于0 if (list != null && list.Count > 0) { //绑定控件 this.rptList.DataSource = list; this.rptList.DataBind(); //设置分页 BindPage(); //隐藏提示 this.lblMsg.Visible = false; } else { //隐藏分页 this.ExportPageInfo1.Visible = false; //显示提示 this.lblMsg.Visible = true; } }
/// <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; }
protected void BindList() { //分页 PageIndex = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetQueryStringValue("Page"), 1); AirlinesValue = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetQueryStringValue("AirlinesValue")); string DepartMent = EyouSoft.Common.Utils.GetQueryStringValue("DepartMents"); string DepartId = EyouSoft.Common.Utils.GetQueryStringValue("DepartIds"); Datetime = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("DateTime")); ticketendtime = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("endtime")); LeaDateS = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("leaDateS")); LeaDateE = EyouSoft.Common.Utils.GetDateTimeNullable(EyouSoft.Common.Utils.GetQueryStringValue("leaDateE")); EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti QueryTicket = new EyouSoft.Model.StatisticStructure.QueryTicketOutStatisti(); QueryTicket.CompanyId = SiteUserInfo.CompanyID; if (AirlinesValue > 0) { QueryTicket.AirLineIds = new int[1] { AirlinesValue }; if (this.Airlineslist.Items.FindByValue(AirlinesValue.ToString()) != null) { this.Airlineslist.Items.FindByValue(AirlinesValue.ToString()).Selected = true; } } QueryTicket.DepartIds = JiPiao_TuiList.GetIntArrByStr(DepartId); QueryTicket.EndTicketOutTime = ticketendtime; QueryTicket.StartTicketOutTime = Datetime; QueryTicket.LeaveDateStart = LeaDateS; QueryTicket.LeaveDateEnd = LeaDateE; IList <EyouSoft.Model.StatisticStructure.TicketOutStatisticOffice> ticketlist = TicketBll.GetTicketOutStatisticOffice(QueryTicket); if (ticketlist != null && ticketlist.Count > 0) { this.prtticketlist.DataSource = EyouSoft.Common.Function.SelfExportPage.GetList <EyouSoft.Model.StatisticStructure.TicketOutStatisticOffice>(PageIndex, PageSize, out RecordCount, ticketlist); this.prtticketlist.DataBind(); BindPage(); lenght = ticketlist.Count; #region 设置总计 //总票数 this.lblAllTickets.Text = ticketlist.Sum(p => p.TicketOutNum).ToString(); //应付机票款 this.lblNeedMoney.Text = ticketlist.Sum(p => p.TotalAmount).ToString("c2"); //已付机票款 this.lblOverMoney.Text = ticketlist.Sum(p => p.PayAmount).ToString("c2"); //未付机票款 this.lblNoMoney.Text = ticketlist.Sum(p => p.UnPaidAmount).ToString("c2"); #endregion this.lblMsg.Visible = false; } else { this.lblMsg.Visible = true; this.ExportPageInfo1.Visible = false; } #region 设置查询值 UCselectDepart.GetDepartmentName = DepartMent; UCselectDepart.GetDepartId = DepartId; if (QueryTicket.LeaveDateStart.HasValue) { txtLeaveDateStart.Text = QueryTicket.LeaveDateStart.Value.ToShortDateString(); } if (QueryTicket.LeaveDateEnd.HasValue) { txtLeaveDateEnd.Text = QueryTicket.LeaveDateEnd.Value.ToShortDateString(); } #endregion }