public List <TreeDataModel> Process(string id, int excelId) { var result = new List <TreeDataModel>(); var items = new List <AccountItemModel>(); var datas = _financialDataBll.GetAccountByExcelRecordId(excelId); if (id == "0") { items = datas.Where(x => x.AccountLevel == 1).ToList(); } else { items = datas.Where(x => x.ParentCode == id).ToList(); } foreach (var item in items) { result.Add(new TreeDataModel() { id = item.AccountCode, text = string.Format("{0}({1})", item.AccountName, item.AccountCode), leaf = item.IsLeaf == 1, @checked = false }); } return(result); }
/// <summary> /// 获取grid的数据 /// </summary> /// <param name="excelId"></param> /// <param name="accountItemIds">科目</param> /// <param name="financialDataItemIds">项目</param> /// <param name="qiJianTypeId">期间类型</param> /// <param name="onlyStatisticChildren">是否只统计下级项目</param> /// <returns></returns> public DynamicGridDataModel GetGridData(int excelId, string accountItemIds, string financialDataItemIds, int qiJianTypeId, int onlyStatisticChildren, int xiangMuTreeTypeId, int statisticAccountChildren) { var gridData = new DynamicGridDataModel() { rows = new List <Dictionary <string, string> >() }; var shouRuDatas = new List <Dictionary <string, string> >(); var zhiChuDatas = new List <Dictionary <string, string> >(); var datas = _financialDataBll.GetFinancialDataByFilter(new FinancialDataModel() { ExcelRecordId = excelId }); datas = datas.Where(x => x.QiJianTypeId == qiJianTypeId).ToList(); var accountItems = _financialDataBll.GetAccountByExcelRecordId(excelId); var financialDataItems = _financialDataBll.GetFinancialDataItemByExcelRecordId(excelId, xiangMuTreeTypeId); var accountItemIdList = accountItemIds.Split(',').OrderBy(x => x).ToList(); if (statisticAccountChildren == 1) { accountItemIdList = GetAccountWidthChildren(accountItemIdList, accountItems); } if (statisticAccountChildren == 1) { } var financialDataItemIdList = GetFinancialDataItemIdList(financialDataItemIds, onlyStatisticChildren, financialDataItems); gridData.total = accountItemIdList.Count; foreach (var accountItemId in accountItemIdList) { var dataDic = new Dictionary <string, string>(); var accountItem = accountItems.First(x => x.AccountCode == accountItemId); var dataInAccountItem = datas.Where(x => x.AccountCode == accountItemId).ToList(); dataDic.Add("AccountCode", accountItem.AccountCode); dataDic.Add("AccountName", accountItem.AccountName); foreach (var financialDataItemId in financialDataItemIdList) { var financialDataItem = financialDataItems.FirstOrDefault(x => x.ItemId.ToString() == financialDataItemId); var financialData = GetFinancialDataForAccountItem(financialDataItem, financialDataItems, dataInAccountItem); dataDic.Add(financialDataItem.ItemId.ToString(), Math.Round(financialData, 2, MidpointRounding.AwayFromZero).ToString()); } if (accountItem.AccountTypeId == 1) { shouRuDatas.Add(dataDic); } else { zhiChuDatas.Add(dataDic); } } GetSumResultWithAccountItemType(gridData.rows, shouRuDatas, zhiChuDatas, accountItems); return(gridData); }
public ActionResult Index() { var a = bll.GetAccountByExcelRecordId(1); return(View()); }