示例#1
0
        /// <summary>
        /// 初始化列表数据
        /// </summary>
        private void InitData()
        {
            _pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1);
            SumMoney   = new Model.StatStructure.MDepartmentPeopleListTongJi();
            int sunCompanyId = Utils.GetInt(Utils.GetQueryStringValue("SunCompanyId"));

            if (sunCompanyId <= 0 || !CheckGrant(Model.EnumType.PrivsStructure.Privs.统计分析_部门业绩统计_查看全部))
            {
                sunCompanyId = UtilsCommons.GetFirstDepartId(SiteUserInfo.CompanyId, SiteUserInfo.DeptId);
            }
            var list = new BLL.StatStructure.BStatistics().GetDepartmentPeopleListByDeptId(
                SiteUserInfo.CompanyId,
                _pageSize,
                _pageIndex,
                ref _recordCount,
                sunCompanyId,
                this.GetSearchModel(),
                ref SumMoney);

            rptSeller.DataSource = list;
            rptSeller.DataBind();

            //绑定分页
            BindPage();
        }
示例#2
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        private void ListToExcel()
        {
            int toXlsRecordCount = UtilsCommons.GetToXlsRecordCount();

            if (toXlsRecordCount < 1)
            {
                ResponseToXls(string.Empty);
            }

            var s = new StringBuilder();

            SumMoney = new Model.StatStructure.MDepartmentPeopleListTongJi();
            int sunCompanyId = Utils.GetInt(Utils.GetQueryStringValue("SunCompanyId"));

            if (sunCompanyId <= 0 || !CheckGrant(Model.EnumType.PrivsStructure.Privs.统计分析_部门业绩统计_查看全部))
            {
                sunCompanyId = UtilsCommons.GetFirstDepartId(SiteUserInfo.CompanyId, SiteUserInfo.DeptId);
            }
            s.Append("序号\t姓名\t订单人数\t订单数量\t收入\t支出\t毛利\t毛利率\n");
            var list = new BLL.StatStructure.BStatistics().GetDepartmentPeopleListByDeptId(
                SiteUserInfo.CompanyId,
                toXlsRecordCount,
                1,
                ref _recordCount,
                sunCompanyId,
                this.GetSearchModel(),
                ref SumMoney);

            if (list != null && list.Any())
            {
                int index = 1;
                foreach (var t in list)
                {
                    s.AppendFormat(
                        "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\n",
                        index,
                        t.SellerName,
                        t.PeopleNum,
                        t.OrderNum,
                        UtilsCommons.GetMoneyString(t.TotalIncome, ProviderToMoney),
                        UtilsCommons.GetMoneyString(t.TotalOutlay, ProviderToMoney),
                        UtilsCommons.GetMoneyString(t.GrossProfit, ProviderToMoney),
                        GetBfbString(t.GrossProfitRate, 0));

                    index++;
                }
                s.AppendFormat(
                    "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\n",
                    " ",
                    "合计:",
                    SumMoney.PeopleNum,
                    SumMoney.OrderNum,
                    UtilsCommons.GetMoneyString(SumMoney.InCome, ProviderToMoney),
                    UtilsCommons.GetMoneyString(SumMoney.Pay, ProviderToMoney),
                    UtilsCommons.GetMoneyString(SumMoney.GrossProfit, ProviderToMoney),
                    "");
            }

            ResponseToXls(s.ToString());
        }