Esempio n. 1
0
        private static StatisticsItem GeneralItem(IEnumerable <TradeStatDataObject> data, BusinessmanTradeDataObject statisticsDto)
        {
            var result = new StatisticsItem();

            result.EmployeeName = statisticsDto.BusinessmanName;

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

            return(result);
        }
Esempio n. 2
0
        //生成每日总汇
        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);
        }
Esempio n. 3
0
        internal static Statistics Transfer(IEnumerable <AppServices.DataContracts.TPos.BusinessmanTradeDataObject> list)
        {
            Statistics result = new Statistics();

            foreach (var item in list)
            {
                //生成一个员工一天的数据
                var employeeItems = GeneralItem(item.BusinessmanTradeStat, item);
                result.Items.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);
        }