예제 #1
0
        private ReportDataSource GetRecAccount(EnumAccountCatType accountCatType, string costCenterId, string recPeriodId)
        {
            IList <TRecAccount> dets;
            TRecPeriod          recPeriod = _tRecPeriodRepository.Get(recPeriodId);

            if (!string.IsNullOrEmpty(costCenterId))
            {
                MCostCenter costCenter = _mCostCenterRepository.Get(costCenterId);
                dets = _tRecAccountRepository.GetByAccountType(accountCatType.ToString(), costCenter, recPeriod);
            }
            else
            {
                dets = _tRecAccountRepository.GetByAccountType(accountCatType.ToString(), null, recPeriod);
            }

            var list = from det in dets
                       select new
            {
                det.RecAccountStart,
                det.RecAccountEnd,
                det.RecAccountDesc,
                CostCenterId = det.CostCenterId.Id,
                det.CostCenterId.CostCenterName,
                AccountId = det.AccountId.Id,
                det.AccountId.AccountName,
                AccountCatId = det.AccountId.AccountCatId.Id,
                det.AccountId.AccountCatId.AccountCatName,
                AccountParentId = det.AccountId.AccountParentId != null ? det.AccountId.AccountParentId.Id : ""
            }
            ;

            ReportDataSource reportDataSource = new ReportDataSource("RecAccountViewModel", list.ToList());

            return(reportDataSource);
        }
예제 #2
0
        private ReportDataSource GetRecAccount(EnumAccountCatType accountCatType, string costCenterId, string recPeriodId, bool generateDetail)
        {
            //if generatedetail is false, generate only level 1
            IList <string> listLevel2Account = new List <string>();

            if (!generateDetail)
            {
                //get account to level 2
                listLevel2Account = _mAccountRepository.GetLevelAccounts(0, accountCatType.ToString());
            }

            IList <TRecAccount> dets = _tRecAccountRepository.GetByAccount(listLevel2Account, costCenterId, recPeriodId);
            //IList<TRecAccount> dets = _tRecAccountRepository.GetByAccountType(accountCatType.ToString(), costCenterId, recPeriodId);

            var list = from det in dets
                       select new
            {
                det.RecAccountStart,
                det.RecAccountEnd,
                det.RecAccountDesc,
                CostCenterId = det.CostCenterId.Id,
                det.CostCenterId.CostCenterName,
                AccountId = det.AccountId.Id,
                det.AccountId.AccountName,
                AccountCatId = det.AccountId.AccountCatId.Id,
                det.AccountId.AccountCatId.AccountCatName,
                AccountParentId = det.AccountId.AccountParentId != null ? det.AccountId.AccountParentId.Id : ""
            }
            ;

            ReportDataSource reportDataSource = new ReportDataSource("RecAccountViewModel", list.ToList());

            return(reportDataSource);
        }