protected EyouSoft.Model.StatisticStructure.QueryEarningsStatistic qesModel = new EyouSoft.Model.StatisticStructure.QueryEarningsStatistic();//查询实体 #endregion protected void Page_Load(object sender, EventArgs e) { if (!CheckGrant(global::Common.Enum.TravelPermission.客户关系管理_销售分析_利润统计栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.客户关系管理_销售分析_利润统计栏目, true); } esBll = new EyouSoft.BLL.StatisticStructure.EarningsStatistic(SiteUserInfo); string act = Utils.GetQueryStringValue("act"); if (!IsPostBack) { switch (act) { case "toexcel": CreateExcel("pro_time_" + DateTime.Now.ToShortDateString()); break; case "toprint": PrintInit(); break; default: DataInit(); break; } } }
private void InitProAreaStaticlist() { #region 获取参数 PageIndex = Utils.GetInt(Utils.GetQueryStringValue("Page"), 1); LeaveStartDate = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("LeaveStartDate"), new DateTime(DateTime.Now.Year, 1, 1)); LeaveEndDate = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("LeaveEndDate"), new DateTime(DateTime.Now.Year, 12, 31)); CheckStartTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("CheckStartDate")); CheckEndTime = Utils.GetDateTimeNullable(Utils.GetQueryStringValue("CheckEndDate")); TourType = Utils.GetInt(Utils.GetQueryStringValue("TourType"), -1); DeptIds = Utils.GetQueryStringValue("deptids"); OperatorIds = Utils.GetQueryStringValue("operatorids"); #endregion #region 实体赋值 EyouSoft.BLL.StatisticStructure.EarningsStatistic EarningBll = new EyouSoft.BLL.StatisticStructure.EarningsStatistic(this.SiteUserInfo); EyouSoft.Model.StatisticStructure.QueryEarningsStatistic model = new EyouSoft.Model.StatisticStructure.QueryEarningsStatistic(); model.OrderIndex = 0; model.LeaveDateStart = LeaveStartDate; model.LeaveDateEnd = LeaveEndDate; model.CheckDateStart = CheckStartTime; model.CheckDateEnd = CheckEndTime; model.CompanyId = this.SiteUserInfo.CompanyID; //设置查询model的ComputeOrderType值 EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType?computerOrderType = new EyouSoft.BLL.CompanyStructure.CompanySetting().GetComputeOrderType(SiteUserInfo.CompanyID); if (computerOrderType.HasValue) { model.ComputeOrderType = computerOrderType.Value; } TourTypeList1.TourType = TourType; if (TourType != -1) { model.TourType = (EyouSoft.Model.EnumType.TourStructure.TourType)TourType; } model.DepartIds = Utils.GetIntArray(DeptIds, ","); model.SaleIds = Utils.GetIntArray(OperatorIds, ","); #endregion #region 初始化表单元素 this.txtCheckStartDate.Value = CheckStartTime.HasValue ? CheckStartTime.Value.ToString("yyyy-MM-dd") : "";; this.txtCheckEndDate.Value = CheckEndTime.HasValue ? CheckEndTime.Value.ToString("yyyy-MM-dd") : ""; this.txtLeaveStartDate.Value = LeaveStartDate.HasValue ? LeaveStartDate.Value.ToString("yyyy-MM-dd") : ""; this.txtLeaveEndDate.Value = LeaveEndDate.HasValue ? LeaveEndDate.Value.ToString("yyyy-MM-dd") : ""; UCSelectDepartment1.GetDepartmentName = Utils.GetQueryStringValue("deptnames"); UCSelectDepartment1.GetDepartId = DeptIds; SelectOperator.OperName = Utils.GetQueryStringValue("operatornames"); SelectOperator.OperId = OperatorIds; #endregion IList <EyouSoft.Model.StatisticStructure.EarningsAreaStatistic> statisticList = new List <EyouSoft.Model.StatisticStructure.EarningsAreaStatistic>(); statisticList = EarningBll.GetEarningsAreaStatistic(model); #region 统计 by 田想兵 3.9 int teamNum = 0; decimal inMoney = 0; decimal outMoney = 0; decimal teamGross = 0; decimal pepoleGross = 0; decimal profitallot = 0; decimal comProfit = 0; int peopleNum = 0; int propleSum = 0; foreach (var v in statisticList) { peopleNum += v.TourPeopleNum; teamNum += v.TourNum; inMoney += v.GrossIncome; outMoney += v.GrossOut; teamGross += v.TourGross; //pepoleGross += v.PeopleGross; profitallot += v.TourShare; comProfit += v.CompanyShare; propleSum += v.TourPeopleNum; } if (peopleNum == 0) { pepoleGross = 0; } else { pepoleGross = teamGross / peopleNum; } lt_teamNum.Text = teamNum.ToString(); lt_InMoney.Text = inMoney.ToString("###,##0.00"); lt_outMoney.Text = outMoney.ToString("###,##0.00"); lt_teamgross_profit.Text = teamGross.ToString("###,##0.00"); lt_pepolegross_profit.Text = pepoleGross.ToString("###,##0.00"); lt_profitallot.Text = profitallot.ToString("###,##0.00"); lt_comProfit.Text = comProfit.ToString("###,##0.00"); lt_peopleSum.Text = propleSum.ToString(); if (inMoney != 0) { lt_lirunlv.Text = (Convert.ToDouble(comProfit) / Convert.ToDouble(inMoney)).ToString("0.00%"); } else { lt_lirunlv.Text = "0.00%"; } #endregion list = EyouSoft.Common.Function.SelfExportPage.GetList <EyouSoft.Model.StatisticStructure.EarningsAreaStatistic>(PageIndex, PageSize, out RecordCount, statisticList); if (Utils.GetInt(Utils.GetQueryStringValue("IsCartogram"), 0) > 0) //标识为统计图异步请求 { return; } if (list != null && list.Count != 0) { this.tbl_ExportPage.Visible = true; this.crp_GetProAreaList.DataSource = list; this.crp_GetProAreaList.DataBind(); BindPage();//绑定分页 } else { this.tbl_ExportPage.Visible = false; this.crp_GetProAreaList.EmptyText = "<tr><td id=\"EmptyData\" colspan='9' bgcolor='#e3f1fc' height='50px' align='center'>暂时没有数据!</td></tr>"; } RegisterScript(string.Format("var recordCount={0};", RecordCount)); model = null; EarningBll = null; }
/// <summary> /// 绑定销售利润列表 /// </summary> private void BindList() { //出团开始时间 string leaveSdate = Utils.GetQueryStringValue("leavesdate"); //出团结束时间 string leaveEdate = Utils.GetQueryStringValue("leaveedate"); //部门名称 string department = Utils.GetQueryStringValue("department"); //部门ID string departid = Utils.GetQueryStringValue("departid"); //销售员id string sellerid = Utils.InputText(Utils.GetQueryStringValue("sellerid")); //销售员name string sellername = Utils.InputText(Utils.GetQueryStringValue("seller")); //线路区域id string routeArea = Utils.GetQueryStringValue("routearea"); //省份id string province = Utils.GetQueryStringValue("province"); //城市集合id string citys = Utils.GetQueryStringValue("city").Trim(); this.UCSelectDepartment1.GetDepartmentName = department; this.UCSelectDepartment1.GetDepartId = departid; this.RouteAreaList1.RouteAreaId = Utils.GetInt(routeArea); this.SelectOperator.OperName = sellername; this.SelectOperator.OperId = sellerid; EyouSoft.Model.StatisticStructure.MTuanDuiLiRunTongJinSearchInfo searchModel = new EyouSoft.Model.StatisticStructure.MTuanDuiLiRunTongJinSearchInfo(); searchModel.AreaId = routeArea == "0" ? null : Utils.GetIntNull(routeArea); //线路区域 int[] provinceIds = Utils.GetIntArray(province, ","); //省份 int[] cityIds = Utils.GetIntArray(citys, ","); //城市 int[] DeptIds = Utils.GetIntArray(departid, ","); //部门 int[] sellIds = Utils.GetIntArray(sellerid, ","); //销售员 searchModel.CityIds = cityIds; searchModel.CTETime = Utils.GetDateTimeNullable(leaveEdate); searchModel.CTSTime = Utils.GetDateTimeNullable(leaveSdate); searchModel.DeptIds = DeptIds; searchModel.ProvinceIds = provinceIds; searchModel.XiaoShouYuanIds = sellIds; EyouSoft.BLL.StatisticStructure.EarningsStatistic bll = new EyouSoft.BLL.StatisticStructure.EarningsStatistic(SiteUserInfo); List = bll.GetTuanDuiLiRunTongJi(this.SiteUserInfo.CompanyID, searchModel, string.Empty); IList <EyouSoft.Model.StatisticStructure.MTuanDuiLiRunTongJiInfo> list = List; if (List != null && List.Count > 0) { recordCount = list.Count; list = list.Skip(pageSize * (Utils.GetInt(Utils.GetQueryStringValue("page") == "" ? "1" : Utils.GetQueryStringValue("page")) - 1)).Take(pageSize).ToList(); this.rptlist.DataSource = list; this.rptlist.DataBind(); } else { this.lbemptydata.Visible = true; this.lbemptydata.Text = "<tr class='even'><td colspan='6' align='center'>暂无数据!</td></tr>"; this.TrTotal.Visible = false; } #region 设置总计 //团队数 string TeamNum = List.Sum(p => p.TuanDuiShu).ToString(); this.lbTeamNum.InnerText = TeamNum; //人数 int PeopleNum = List.Sum(p => p.RenShu); this.lbPeopleNum.InnerText = PeopleNum.ToString(); //收入 decimal ShouRu = List.Sum(p => p.ShouRuJinE); this.lbShouRu.InnerText = ShouRu.ToString("c2"); //利润 decimal Profit = List.Sum(p => p.LiRun); this.lbProfit.InnerText = Profit.ToString("c2"); //平均利润 if (PeopleNum == 0) { lbAvgProfit.InnerText = "0"; } else { this.lbAvgProfit.InnerText = (Profit / PeopleNum).ToString("c2"); } #endregion #region 分页 ExportPageInfo1.intPageSize = pageSize; ExportPageInfo1.intRecordCount = recordCount; ExportPageInfo1.PageLinkURL = Request.Path + "?"; ExportPageInfo1.UrlParams = Request.QueryString; ExportPageInfo1.CurrencyPage = EyouSoft.Common.Utils.GetInt(Request.QueryString["page"], 1); #endregion }
private void InitProAreaStaticlist() { #region 页面参数初始化 PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); DeapartName = Utils.GetQueryStringValue("departName"); OperatorName = Utils.GetQueryStringValue("OperatorName"); OperatorId = Utils.GetQueryStringValue("OperatorId"); 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)); DepartId = Utils.GetQueryStringValue("DepartmentId"); CheckSDate = Utils.GetDateTimeNullable(Request.QueryString["CheckSDate"]); CheckEDate = Utils.GetDateTimeNullable(Request.QueryString["CheckEDate"]); #endregion #region 表单控件初始化 UCSelectDepartment1.GetDepartmentName = DeapartName; UCSelectDepartment1.GetDepartId = DepartId; SelectOperator.OperName = OperatorName; SelectOperator.OperId = OperatorId; txtStartDate.Value = StartDate.HasValue ? StartDate.Value.ToString("yyyy-MM-dd") : ""; txtEndDate.Value = EndDate.HasValue ? EndDate.Value.ToString("yyyy-MM-dd") : ""; txtCheckStartTime.Value = CheckSDate.HasValue ? CheckSDate.Value.ToString("yyyy-MM-dd") : ""; txtCheckEndTime.Value = CheckEDate.HasValue ? CheckEDate.Value.ToString("yyyy-MM-dd") : ""; #endregion #region 调用底层方法 查询Model赋值 EyouSoft.Model.StatisticStructure.QueryEarningsStatistic model = new EyouSoft.Model.StatisticStructure.QueryEarningsStatistic(); EyouSoft.BLL.StatisticStructure.EarningsStatistic EarningBll = new EyouSoft.BLL.StatisticStructure.EarningsStatistic(this.SiteUserInfo); model.CompanyId = base.SiteUserInfo.CompanyID; model.OrderIndex = 4; model.LeaveDateStart = StartDate; model.LeaveDateEnd = EndDate; if (!string.IsNullOrEmpty(OperatorId)) { model.SaleIds = Utils.GetIntArray(OperatorId, ","); } if (!string.IsNullOrEmpty(DepartId)) { model.DepartIds = Utils.GetIntArray(DepartId, ","); } //设置查询model的ComputeOrderType值 EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType?computerOrderType = new EyouSoft.BLL.CompanyStructure.CompanySetting().GetComputeOrderType(SiteUserInfo.CompanyID); if (computerOrderType.HasValue) { model.ComputeOrderType = computerOrderType.Value; } model.CheckDateStart = CheckSDate; model.CheckDateEnd = CheckEDate; IList <EyouSoft.Model.StatisticStructure.EarningsTypeStatistic> statisticList = new List <EyouSoft.Model.StatisticStructure.EarningsTypeStatistic>(); statisticList = EarningBll.GetEarningsTypeStatistic(model); #region 统计 by 田想兵 3.9 int teamNum = 0; decimal inMoney = 0; decimal outMoney = 0; decimal teamGross = 0; decimal pepoleGross = 0; decimal profitallot = 0; decimal comProfit = 0; int peopleNum = 0; int propleSum = 0; foreach (var v in statisticList) { peopleNum += v.TourPeopleNum; teamNum += v.TourNum; inMoney += v.GrossIncome; outMoney += v.GrossOut; teamGross += v.TourGross; //pepoleGross += v.PeopleGross; profitallot += v.TourShare; comProfit += v.CompanyShare; propleSum += v.TourPeopleNum; } if (peopleNum == 0) { pepoleGross = 0; } else { pepoleGross = teamGross / peopleNum; } lt_teamNum.Text = teamNum.ToString(); lt_InMoney.Text = inMoney.ToString("###,##0.00"); lt_outMoney.Text = outMoney.ToString("###,##0.00"); lt_teamgross_profit.Text = teamGross.ToString("###,##0.00"); lt_pepolegross_profit.Text = pepoleGross.ToString("###,##0.00"); lt_profitallot.Text = profitallot.ToString("###,##0.00"); lt_comProfit.Text = comProfit.ToString("###,##0.00"); lt_peopleSum.Text = propleSum.ToString(); if (inMoney != 0) { lt_lirunlv.Text = (Convert.ToDouble(comProfit) / Convert.ToDouble(inMoney)).ToString("0.00%"); } else { lt_lirunlv.Text = "0.00%"; } #endregion ProTypeStaList = EyouSoft.Common.Function.SelfExportPage.GetList <EyouSoft.Model.StatisticStructure.EarningsTypeStatistic>(PageIndex, PageSize, out RecordCount, EarningBll.GetEarningsTypeStatistic(model)); #endregion #region 数据源绑定 if (ProTypeStaList != null && ProTypeStaList.Count != 0) { this.crp_GetProTypeList.DataSource = ProTypeStaList; this.crp_GetProTypeList.DataBind(); BindPage();//绑定分页 } else { this.tbl_ExportPage.Visible = false; this.crp_GetProTypeList.EmptyText = "<tr><td colspan='9' id=\"EmptyData\" bgcolor='#e3f1fc' height='50px' align='center'>暂时没有数据!</td></tr>"; } #endregion RegisterScript(string.Format("var recordCount={0};", RecordCount)); }
private void InitProTimeStaticlist() { #region 获取参数 PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); RouteAreaName = Utils.GetQueryStringValue("RouteAreaName"); leaveTourStartDate = Utils.GetDateTimeNullable(Request.QueryString["leaveTourStarDate"], new DateTime(DateTime.Now.Year, 1, 1)); leaveTourEndDate = Utils.GetDateTimeNullable(Request.QueryString["leaveTourEndDate"], new DateTime(DateTime.Now.Year, 12, 31)); checkStartDate = Utils.GetDateTimeNullable(Request.QueryString["checkStartDate"]); checkEndDate = Utils.GetDateTimeNullable(Request.QueryString["checkEndDate"]); TourType = Utils.GetQueryStringValue("TourType"); OperatorName = Utils.GetQueryStringValue("OperatorName"); OperatorId = Utils.GetQueryStringValue("OperatorId"); DepartName = Utils.GetQueryStringValue("deptnames"); DepartId = Utils.GetQueryStringValue("deptids"); #endregion #region 初始化表单值 this.txtcheckStartDate.Value = checkStartDate.HasValue ? checkStartDate.Value.ToString("yyyy-MM-dd") : ""; this.txtcheckEndDate.Value = checkEndDate.HasValue ? checkEndDate.Value.ToString("yyyy-MM-dd") : ""; this.txtLeaveStarDate.Value = leaveTourStartDate.HasValue ? leaveTourStartDate.Value.ToString("yyyy-MM-dd") : ""; this.txtLeaveEndDate.Value = leaveTourEndDate.HasValue ? leaveTourEndDate.Value.ToString("yyyy-MM-dd") : ""; if (TourType != "")//团队类型 { this.TourTypeList1.TourType = int.Parse(TourType); } if (RouteAreaName != "")//线路区域名称 { this.RouteAreaList1.RouteAreaId = int.Parse(RouteAreaName); } this.SelectOperator.OperName = OperatorName; //销售员 this.SelectOperator.OperId = OperatorId; this.UCSelectDepartment1.GetDepartmentName = DepartName; //部门 this.UCSelectDepartment1.GetDepartId = DepartId; #endregion #region 调用底层方法 Model赋值 EyouSoft.Model.StatisticStructure.QueryEarningsStatistic model = new EyouSoft.Model.StatisticStructure.QueryEarningsStatistic(); EyouSoft.BLL.StatisticStructure.EarningsStatistic EarningBll = new EyouSoft.BLL.StatisticStructure.EarningsStatistic(this.SiteUserInfo); if (RouteAreaName != "" && RouteAreaName != "0") { model.AreaId = int.Parse(RouteAreaName); } if (TourType != "" && TourType != "-1") { model.TourType = (EyouSoft.Model.EnumType.TourStructure.TourType) int.Parse(TourType); } model.OrderIndex = 6; model.LeaveDateStart = leaveTourStartDate; model.LeaveDateEnd = leaveTourEndDate; //设置查询model的ComputeOrderType值 EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType?computerOrderType = new EyouSoft.BLL.CompanyStructure.CompanySetting().GetComputeOrderType(SiteUserInfo.CompanyID); if (computerOrderType.HasValue) { model.ComputeOrderType = computerOrderType.Value; } if (OperatorId != "") { model.SaleIds = Utils.GetIntArray(OperatorId, ","); } if (DepartId != "") { model.DepartIds = Utils.GetIntArray(DepartId, ","); } model.CheckDateStart = checkStartDate; model.CheckDateEnd = checkEndDate; IList <EyouSoft.Model.StatisticStructure.EarningsTimeStatistic> statisticList = new List <EyouSoft.Model.StatisticStructure.EarningsTimeStatistic>(); model.CompanyId = CurrentUserCompanyID; statisticList = EarningBll.GetEarningsTimeStatistic(model); #region 统计 by 田想兵 3.9 int teamNum = 0; decimal inMoney = 0; decimal outMoney = 0; decimal teamGross = 0; decimal pepoleGross = 0; decimal profitallot = 0; decimal comProfit = 0; int peopleNum = 0; int propleSum = 0; foreach (var v in statisticList) { peopleNum += v.TourPeopleNum; teamNum += v.TourNum; inMoney += v.GrossIncome; outMoney += v.GrossOut; teamGross += v.TourGross; //pepoleGross += v.PeopleGross; profitallot += v.TourShare; comProfit += v.CompanyShare; propleSum += v.TourPeopleNum; } if (peopleNum == 0) { pepoleGross = 0; } else { pepoleGross = teamGross / peopleNum; } lt_teamNum.Text = teamNum.ToString(); lt_InMoney.Text = inMoney.ToString("###,##0.00"); lt_outMoney.Text = outMoney.ToString("###,##0.00"); lt_teamgross_profit.Text = teamGross.ToString("###,##0.00"); lt_pepolegross_profit.Text = pepoleGross.ToString("###,##0.00"); lt_profitallot.Text = profitallot.ToString("###,##0.00"); lt_comProfit.Text = comProfit.ToString("###,##0.00"); lt_peopleSum.Text = propleSum.ToString(); if (inMoney != 0) { lt_lirunlv.Text = (Convert.ToDouble(comProfit) / Convert.ToDouble(inMoney)).ToString("0.00%"); } else { lt_lirunlv.Text = "0.00%"; } #endregion list = EyouSoft.Common.Function.SelfExportPage.GetList <EyouSoft.Model.StatisticStructure.EarningsTimeStatistic>(PageIndex, PageSize, out RecordCount, statisticList); #endregion if (list != null && list.Count != 0) { this.tbl_ExportPage.Visible = true; this.crp_GetProTimeList.DataSource = list; this.crp_GetProTimeList.DataBind(); BindPage();//绑定分页 } else { this.tbl_ExportPage.Visible = false; this.crp_GetProTimeList.EmptyText = "<tr><td colspan='8' id=\"EmptyData\" bgcolor='#e3f1fc' height='50px' align='center'>暂时没有数据!</td></tr>"; } //释放资源 model = null; EarningBll = null; RegisterScript(string.Format("var recordCount={0};", RecordCount)); }