private void IntiUnCollectCashList() { #region 获取表单值 PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); TourType = Utils.GetQueryStringValue("TourType"); StartDate = Utils.GetDateTimeNullable(Request.QueryString["StartDate"], new DateTime(DateTime.Now.Year, 1, 1)); EndDate = Utils.GetDateTimeNullable(Request.QueryString["EndDate"], new DateTime(DateTime.Now.Year, 12, 31)); TourType = Utils.GetQueryStringValue("TourType"); RouteName = Utils.GetQueryStringValue("RouteName"); OperatorId = Utils.GetQueryStringValue("OperatorId"); sup = Utils.GetQueryStringValue("CompanyName"); #endregion #region 实体赋值 EyouSoft.BLL.PlanStruture.TravelAgency TravelAgencyBLL = new EyouSoft.BLL.PlanStruture.TravelAgency(SiteUserInfo); EyouSoft.Model.PlanStructure.ArrearSearchInfo SearchModel = new EyouSoft.Model.PlanStructure.ArrearSearchInfo(); if (TourType != "-1" && TourType != "") { SearchModel.TourType = int.Parse(TourType); } if (RouteName != "0" && RouteName != "") { SearchModel.AreaId = int.Parse(RouteName); } SearchModel.LeaveDate1 = StartDate; SearchModel.LeaveDate2 = EndDate; SearchModel.CompanyId = this.SiteUserInfo.CompanyID; SearchModel.SeachType = Utils.GetInt(Utils.GetQueryStringValue("searchType"), 3); SearchModel.SupplierName = sup; if (OperatorId != "" && OperatorId != "0") { SearchModel.OperateId = int.Parse(OperatorId); } list = EyouSoft.Common.Function.SelfExportPage.GetList <ArrearInfo>(PageIndex, PageSize, out RecordCount, TravelAgencyBLL.GetArrear(SearchModel)); TravelAgencyBLL.GetArrearAllMoeny(SearchModel, ref sumMoney, ref arrear); #endregion //调用底层方法 if (list != null && list.Count != 0) { this.tbl_ExportPage.Visible = true; this.crp_GetDepartUncollList.DataSource = list; this.crp_GetDepartUncollList.DataBind(); BindPage(); } else { this.tbl_ExportPage.Visible = false; this.crp_GetDepartUncollList.EmptyText = "<tr class='odd' align='center'><td colspan='8' height='40px' class='even'>暂时没有数据!</td></tr>"; } }
/// <summary> /// 统计中心-获取欠款列表(总支出;已付;未付)(统计分析-支出对账单总支出、已付、未付明细列表) /// </summary> /// <param name="SearchModel"></param> /// <returns></returns> public IList <ArrearInfo> GetArrear(EyouSoft.Model.PlanStructure.ArrearSearchInfo SearchModel) { if (SearchModel != null) { SearchModel = new ArrearSearchInfo() { AreaId = SearchModel.AreaId, CompanyId = SearchModel.CompanyId, IsAccount = SearchModel.IsAccount, LeaveDate1 = SearchModel.LeaveDate1, LeaveDate2 = SearchModel.LeaveDate2, OperateId = SearchModel.OperateId, SalerId = SearchModel.SalerId, SeachType = SearchModel.SeachType, SupplierId = SearchModel.SupplierId, SupplierName = SearchModel.SupplierName, TourType = SearchModel.TourType }; if (!SearchModel.LeaveDate2.HasValue) { SearchModel.LeaveDate2 = new DateTime(DateTime.Now.Year + 1, 1, 1).AddMilliseconds(-1); } else { SearchModel.LeaveDate2 = SearchModel.LeaveDate2.Value.AddDays(1).AddMilliseconds(-1); } if (!SearchModel.LeaveDate1.HasValue) { SearchModel.LeaveDate1 = new DateTime(DateTime.Now.Year, 1, 1); } } return(dal.GetArrear(SearchModel, HaveUserIds)); }
protected decimal arrear; //未付 #endregion #region 初始化加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 根据URL参数初始化PageSize if (Utils.GetInt(Request.QueryString["isAll"], 0) == 1 || Utils.GetInt(Request.QueryString["isExport"], 0) == 1 || Utils.GetInt(Request.QueryString["IsCartogram"], 0) == 1) { PageSize = int.MaxValue - 1; //-1为了避免存储过程报错 } #endregion IntiUnCollectCashList(); #region 导出报表请求 if (Utils.GetInt(Request.QueryString["isExport"], 0) == 1) { #region 获取表单值 PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); TourType = Utils.GetQueryStringValue("TourType"); StartDate = Utils.GetDateTimeNullable(Request.QueryString["StartDate"], new DateTime(DateTime.Now.Year, 1, 1)); EndDate = Utils.GetDateTimeNullable(Request.QueryString["EndDate"], new DateTime(DateTime.Now.Year, 12, 31)); TourType = Utils.GetQueryStringValue("TourType"); RouteName = Utils.GetQueryStringValue("RouteName"); OperatorId = Utils.GetQueryStringValue("OperatorId"); sup = Utils.GetQueryStringValue("CompanyName"); #endregion #region 实体赋值 EyouSoft.BLL.PlanStruture.TravelAgency TravelAgencyBLL = new EyouSoft.BLL.PlanStruture.TravelAgency(SiteUserInfo); EyouSoft.Model.PlanStructure.ArrearSearchInfo SearchModel = new EyouSoft.Model.PlanStructure.ArrearSearchInfo(); if (TourType != "-1" && TourType != "") { SearchModel.TourType = int.Parse(TourType); } if (RouteName != "0" && RouteName != "") { SearchModel.AreaId = int.Parse(RouteName); } SearchModel.LeaveDate1 = StartDate; SearchModel.LeaveDate2 = EndDate; SearchModel.CompanyId = this.SiteUserInfo.CompanyID; SearchModel.SeachType = Utils.GetInt(Utils.GetQueryStringValue("searchType"), 3); SearchModel.SupplierName = sup; if (OperatorId != "" && OperatorId != "0") { SearchModel.OperateId = int.Parse(OperatorId); } list = EyouSoft.Common.Function.SelfExportPage.GetList <ArrearInfo>(1, 9999, out RecordCount, TravelAgencyBLL.GetArrear(SearchModel)); TravelAgencyBLL.GetArrearAllMoeny(SearchModel, ref sumMoney, ref arrear); #endregion if (list != null && list.Count != 0) { ToExcel(this.crp_GetDepartUncollList, list); } } #endregion } }
/// <summary> /// 统计中心-获取欠款列表(总支出;已付;未付)(统计分析-支出对账单总支出、已付、未付明细列表) /// </summary> /// <param name="searchModel">查询实体</param> /// <param name="haveUserIds">用户Ids</param> /// <returns></returns> public IList <ArrearInfo> GetArrear(EyouSoft.Model.PlanStructure.ArrearSearchInfo searchModel, string haveUserIds) { if (searchModel.CompanyId <= 0) { return(null); } StringBuilder searchCon = new StringBuilder(); searchCon.AppendFormat("select * from View_TravelAndTicketArrear where companyid={0} ", searchModel.CompanyId); if (searchModel.SeachType == 1) //总支出 { searchCon.Append(" and TotalAmount <> 0 "); } if (searchModel.SeachType == 2) //已付 { searchCon.Append(" and PayAmount <> 0 "); } if (searchModel.SeachType == 3) //未付 { searchCon.Append(" and arrear <> 0 "); } if (searchModel.LeaveDate1 != null) { searchCon.AppendFormat(" and LeaveDate>='{0}' ", searchModel.LeaveDate1.Value); } if (searchModel.LeaveDate1 != null) { searchCon.AppendFormat(" and LeaveDate<='{0}' ", searchModel.LeaveDate2.Value); } if (searchModel.OperateId > 0) { searchCon.AppendFormat(" and operateid={0}", searchModel.OperateId); } if (searchModel.SalerId > 0) { searchCon.AppendFormat(" and salerid={0}", searchModel.SalerId); } if (searchModel.AreaId > 0) { searchCon.AppendFormat(" and areaid={0}", searchModel.AreaId); } if (searchModel.TourType > 0) { searchCon.AppendFormat(" and TourType={0}", searchModel.TourType); } if (searchModel.SupplierId != null && searchModel.SupplierId.Length > 0) { string strIds = string.Empty; foreach (int i in searchModel.SupplierId) { if (i > 0) { strIds += i.ToString() + ","; } } strIds = strIds.Trim(','); if (!string.IsNullOrEmpty(strIds)) { searchCon.AppendFormat(" and ServerId in ({0})", strIds); } } if (!string.IsNullOrEmpty(searchModel.SupplierName)) { searchCon.AppendFormat(" and Supplier like '%{0}%' ", searchModel.SupplierName); } if (searchModel.IsAccount.HasValue) { searchCon.Append(searchModel.IsAccount.Value ? " and Arrear = 0 " : " and Arrear <> 0 "); } /*if (!string.IsNullOrEmpty(haveUserIds)) * searchCon.AppendFormat(" and TourOperatorId in ({0}) ", haveUserIds);*/ DbCommand cmd = this._db.GetSqlStringCommand(searchCon.ToString()); IList <ArrearInfo> ArrearList = new List <ArrearInfo>(); ArrearInfo model = null; using (IDataReader rd = DbHelper.ExecuteReader(cmd, this._db)) { while (rd.Read()) { model = new ArrearInfo(); model.Arrear = rd.GetDecimal(rd.GetOrdinal("Arrear")); model.LeaveDate = rd.IsDBNull(rd.GetOrdinal("LeaveDate")) ? DateTime.MinValue : rd.GetDateTime(rd.GetOrdinal("LeaveDate")); model.RouteName = rd.IsDBNull(rd.GetOrdinal("RouteName")) ? "" : rd.GetString(rd.GetOrdinal("RouteName")); model.TotalAmount = rd.GetDecimal(rd.GetOrdinal("TotalAmount"));; model.TourCode = rd.IsDBNull(rd.GetOrdinal("TourCode")) ? "" : rd.GetString(rd.GetOrdinal("TourCode")); model.TourId = rd.IsDBNull(rd.GetOrdinal("TourId")) ? "" : rd.GetString(rd.GetOrdinal("TourId")); model.Supplier = rd.IsDBNull(rd.GetOrdinal("Supplier")) ? "" : rd.GetString(rd.GetOrdinal("Supplier")); model.Operator = rd.IsDBNull(rd.GetOrdinal("Operator")) ? "" : rd.GetString(rd.GetOrdinal("Operator")); model.TourType = (EyouSoft.Model.EnumType.TourStructure.TourType)rd.GetByte(rd.GetOrdinal("TourType")); ArrearList.Add(model); } } return(ArrearList); }