コード例 #1
0
ファイル: Statistics.cs プロジェクト: goldmon/BPiaoBao
        internal static Statistics Transfer(List <AppServices.DataContracts.DomesticTicket.DataStatisticsDto> list)
        {
            Statistics result = new Statistics();

            foreach (var item in list)
            {
                //生成一个员工一天的数据
                var employeeItems = GeneralItem(item.DataStatisticsList, item);
                result.Items.Add(employeeItems);
            }

            //foreach (var item in list)
            //{
            //    item.OperatorAccount = "tes";

            //    //生成一个员工的3行数据
            //    var employeeItems = GeneralItem(item.DataStatisticsList, item);
            //    temp.Add(employeeItems);
            //}

            if (result.Items != null && result.Items.Count > 0)
            {
                //每日汇总3行
                StatisticsItem total = GeneralDayTotalItem(result.Items.ToList());
                result.TotalCommissionTotalMoney = total.Data[31].CommissionTotalMoney;
                result.TotalIssueTicketCount     = total.Data[31].IssueTicketCount;
                result.TotalTradeTotalMoney      = total.Data[31].TradeTotalMoney;
                result.Items.Add(total);
            }

            return(result);
        }
コード例 #2
0
ファイル: Statistics.cs プロジェクト: goldmon/BPiaoBao
        private static StatisticsItem GeneralItem(List <BPiaoBao.AppServices.DataContracts.DomesticTicket.DataStatisticsDto.DataStatistics> data, DataStatisticsDto statisticsDto)
        {
            var result = new StatisticsItem();

            result.EmployeeName = statisticsDto.OperatorAccount;

            foreach (var item in data)
            {
                result.Data[item.Day - 1] = (OneDayStatisticsItem)item;
            }
            //每月汇总
            result.Data[31] = new OneDayStatisticsItem()
            {
                CommissionTotalMoney = statisticsDto.TotalCommission,
                IssueTicketCount     = statisticsDto.TotalIssueTicket,
                TradeTotalMoney      = statisticsDto.TotalTradeMoney
            };

            return(result);
        }
コード例 #3
0
ファイル: Statistics.cs プロジェクト: goldmon/BPiaoBao
        //生成每日总汇
        private static StatisticsItem GeneralDayTotalItem(List <StatisticsItem> temp)
        {
            StatisticsItem result = new StatisticsItem();

            for (int i = 0; i < result.Data.Length; i++)
            {
                result.Data[i] = new OneDayStatisticsItem();
                result.Data[i].CommissionTotalMoney = temp.Sum(m => m.Data[i] == null ? 0 : m.Data[i].CommissionTotalMoney);
                result.Data[i].IssueTicketCount     = temp.Sum(m => m.Data[i] == null ? 0 : m.Data[i].IssueTicketCount);
                result.Data[i].TradeTotalMoney      = temp.Sum(m => m.Data[i] == null ? 0 : m.Data[i].TradeTotalMoney);
                //空数据恢复为空,界面上不显示0
                if (result.Data[i].CommissionTotalMoney == 0 &&
                    result.Data[i].IssueTicketCount == 0 &&
                    result.Data[i].TradeTotalMoney == 0)
                {
                    result.Data[i] = null;
                }
            }

            result.EmployeeName = "每日总汇";
            return(result);
        }