public List <AccountStatement> GetAsNotInPlan(FilterAsNotInPlan filter)
        {
            var accountStatements = Context.AccountStatement
                                    .Include(x => x.Operation)
                                    .Include(x => x.OperationMethod)
                                    .Include(x => x.OperationType)
                                    .Include(x => x.OperationType.OperationTypeFamily)
                                    .AsQueryable();

            accountStatements = accountStatements.Where(x => x.DateIntegration.Value.Year == filter.Year);
            accountStatements = accountStatements.Where(x => x.OperationTypeFamily.Id != filter.IdInternalTransfert);
            accountStatements = accountStatements.Where(x => filter.Accounts.Contains(x.IdAccount));
            accountStatements = accountStatements.Where(x => !filter.AsInPlan.Contains(x.Id));
            accountStatements = accountStatements
                                .OrderBy(x => x.OperationMethod.Label)
                                .ThenBy(x => x.OperationTypeFamily.Label)
                                .ThenBy(x => x.OperationType.Label);
            return(accountStatements.ToList());
        }
Пример #2
0
        //Recherche des account statement non pris en compte dans le plan indiqué en parametre
        public List <AsForTableDto> GetAsNotInPlan(int idPlan, int idUserGroup)
        {
            //Recherche du plan
            var plan = _planService.GetById(idPlan);
            //Recherche des account statement pris en compte dans le plan
            var asInPlan = _accountStatementPlanRepository.GetByIdPlan(idPlan);
            //Recherche des Accounts utilisés dans le plan
            var planAccounts = _planAccountService.GetByIdPlan(idPlan);
            //Recherche du virement interne pour le user group (pas de prise en compte dess virements internes)
            var otfViri = _referentialService.OperationTypeFamilyService.GetByCodeUserGroupForSelect(EnumCodeOtf.VIRI, idUserGroup);
            FilterAsNotInPlan filterAsNotInPlan = new FilterAsNotInPlan
            {
                Year = plan.Year,
                IdInternalTransfert = otfViri.Id,
                AsInPlan            = asInPlan.Select(x => x.IdAccountStatement).ToList(),
                Accounts            = planAccounts.Select(x => x.IdAccount).ToList()
            };

            var accountStatements = _accountStatementPlanRepository.GetAsNotInPlan(filterAsNotInPlan);

            return(_mapper.Map <List <AsForTableDto> >(accountStatements));
            //return null;
        }