public List <InternalTransferDto> GetAsInternalTransfer(FilterAsTableSelected filter)
        {
            List <InternalTransferDto> internalTransferDtos = new List <InternalTransferDto>();

            var date    = Convert.ToDateTime($"01/{filter.MonthYear.Month.Id}/{filter.MonthYear.Year}");
            var dateMin = DateHelper.GetFirstDayOfMonth(date);
            var dateMax = DateHelper.GetLastDayOfMonth(date);

            var accountStatements = _accountStatementRepository.GetAsInternalTransfer(filter.User.IdUserGroup, filter.IdAccount, dateMin, dateMax);
            var asDtos            = _mapper.Map <List <AsForTableDto> >(accountStatements);

            foreach (var asDtoFirst in asDtos)
            {
                AsForTableDto    asDtoSecond = null; // = new AsForTableDto();
                AccountStatement asCouple    = _accountStatementRepository.GetAsInternalTransferCouple(filter.User.IdUserGroup, asDtoFirst.Id);
                if (asCouple != null)
                {
                    var account = _referentialService.AccountService.GetFullById(asCouple.IdAccount);
                    asCouple.Account = account;
                    asDtoSecond      = _mapper.Map <AsForTableDto>(asCouple);
                }

                InternalTransferDto internalTransferDto = new InternalTransferDto()
                {
                    AsFirst  = asDtoFirst,
                    AsSecond = asDtoSecond
                };
                internalTransferDtos.Add(internalTransferDto);
            }

            return(internalTransferDtos);
        }
        public FilterAsTable GetFilterAsTable(FilterAsTableSelected filter)
        {
            FilterAsTable filterAsTable = new FilterAsTable();

            filterAsTable.Selected            = filter;
            filterAsTable.Selected.Pagination = new Pagination();

            var operationMethods = _referentialService.OperationMethodService.GetSelectList(EnumSelectType.Empty);

            filterAsTable.OperationMethod          = operationMethods;
            filterAsTable.Selected.OperationMethod = filter.OperationMethod == null ? null : filter.OperationMethod;

            var operationTypeFamilies = _referentialService.OperationTypeFamilyService.GetSelectGroup(filter.User.IdUserGroup);

            filterAsTable.OperationTypeFamily          = operationTypeFamilies;
            filterAsTable.Selected.OperationTypeFamily = filter.OperationTypeFamily == null ? null : filter.OperationTypeFamily;

            var operationTypes = _referentialService.OperationTypeService.GetSelectGroup(filter.User.IdUserGroup, filterAsTable.Selected.OperationTypeFamily);

            filterAsTable.OperationType          = operationTypes;
            filterAsTable.Selected.OperationType = filter.OperationType == null ? null : filter.OperationType;

            var operations = _referentialService.OperationService.GetSelectList(filter.User.IdUserGroup, filterAsTable.Selected.OperationType);

            filterAsTable.Operation          = operations;
            filterAsTable.Selected.Operation = filter.Operation == null ? null : filter.Operation;

            return(filterAsTable);
        }
        private AsChartEvolutionCdb GetAsChartEvolutionCdb(FilterAsTableSelected filterAsTableSelected, string evolutionType)
        {
            List <AsEvolutionCdbDto> asEvolutionCdbDtos = GetAsEvolutionDto(filterAsTableSelected, evolutionType);

            AsChartEvolutionCdb asChartEvolutionCdb = new AsChartEvolutionCdb();

            asChartEvolutionCdb.Debit = GetWidgetCardChartBar(asEvolutionCdbDtos
                                                              .Select(x => new BaseChartData {
                Id = x.Id, Month = x.Month, Year = x.Year, Amount = x.Debit
            })
                                                              .ToList(), EnumAmountState.Debit.ToString());

            asChartEvolutionCdb.Credit = GetWidgetCardChartBar(asEvolutionCdbDtos
                                                               .Select(x => new BaseChartData {
                Id = x.Id, Month = x.Month, Year = x.Year, Amount = x.Credit
            })
                                                               .ToList(), EnumAmountState.Credit.ToString());

            asChartEvolutionCdb.Balance = GetWidgetCardChartBar(asEvolutionCdbDtos
                                                                .Select(x => new BaseChartData {
                Id = x.Id, Month = x.Month, Year = x.Year, Amount = x.Balance
            })
                                                                .ToList(), EnumAmountState.Balance.ToString());

            return(asChartEvolutionCdb);
        }
        private List <BaseChartData> GetAsEvolutionCustomOtf(FilterAsTableSelected filterAsTableSelected, int idOperationTypeFamily)
        {
            var date    = Convert.ToDateTime($"01/{filterAsTableSelected.MonthYear.Month.Id}/{filterAsTableSelected.MonthYear.Year}");
            var dateMax = DateHelper.GetLastDayOfMonth(date);
            var dateMin = DateHelper.GetFirstDayOfMonth(dateMax.AddMonths(-12));

            return(_accountStatementChartRepository.GetAsChartEvolutionCustomOtf(filterAsTableSelected.IdAccount, idOperationTypeFamily, dateMin, dateMax));
        }
        public SoldeDto GetSolde(FilterAsTableSelected filter)
        {
            var date    = Convert.ToDateTime($"01/{filter.MonthYear.Month.Id}/{filter.MonthYear.Year}");
            var dateMin = DateHelper.GetFirstDayOfMonth(date);
            var dateMax = DateHelper.GetLastDayOfMonth(date);
            var solde   = GetSolde(filter.User.Id, filter.IdAccount, dateMin, dateMax, filter.IsWithITransfer);

            return(solde);
        }
Exemple #6
0
        public AsChartCategorisationSelect GetAsChartCategorisationDebit(FilterAsTableSelected filterAsTableSelected)
        {
            DateRange dateRange = DateHelper.GetDateRange(filterAsTableSelected.MonthYear);

            AsChartCategorisationSelect asChartCategorisationSelect = new AsChartCategorisationSelect();

            asChartCategorisationSelect.OperationMethod     = GetWidgetCardChartPieSelect(filterAsTableSelected.IdAccount, dateRange.DateMin, dateRange.DateMax, EnumTableRef.OperationMethod);
            asChartCategorisationSelect.OperationTypeFamily = GetWidgetCardChartPieSelect(filterAsTableSelected.IdAccount, dateRange.DateMin, dateRange.DateMax, EnumTableRef.OperationTypeFamily);
            asChartCategorisationSelect.OperationType       = GetWidgetCardChartPieSelect(filterAsTableSelected.IdAccount, dateRange.DateMin, dateRange.DateMax, EnumTableRef.OperationType);

            return(asChartCategorisationSelect);
        }
        public PagedList <AsForTableDto> GetAsTable(FilterAsTableSelected filter)
        {
            var pagedList = _accountStatementRepository.GetAsTable(filter);

            var result = new PagedList <AsForTableDto>(_mapper.Map <List <AsForTableDto> >(pagedList.Datas), pagedList.Pagination);

            foreach (var data in result.Datas)
            {
                data.Plans = _accountStatementPlanService.GetPlansByIdAccountStatement(data.Id, data.DateIntegration.Value.Year);
            }

            return(result);
        }
        public List <WidgetCardChartBar> GetAsChartEvolutionCustomOtf(FilterAsTableSelected filterAsTableSelected)
        {
            //Rechercher les operationTypeFamily favori pour l'utilisateur
            List <SelectDto>          otfs = _userCustomOtfService.GetOperationTypeFamilySelect(filterAsTableSelected.User.Id, filterAsTableSelected.IdAccount);
            List <WidgetCardChartBar> widgetCardChartBars = new List <WidgetCardChartBar>();

            foreach (var otf in otfs)
            {
                var baseChartDatas = GetAsEvolutionCustomOtf(filterAsTableSelected, otf.Id);
                WidgetCardChartBar widgetCardChartBar = GetWidgetCardChartBar(baseChartDatas, otf.Label);
                widgetCardChartBars.Add(widgetCardChartBar);
            }

            return(widgetCardChartBars);
        }
        public AsChartEvolutionCustomOtfFilter GetAsChartEvolutionCustomOtfFilter(FilterAsTableSelected filter)
        {
            var operationTypeFamilies = _referentialService.OperationTypeFamilyService.GetSelectGroup(filter.User.IdUserGroup);
            AsChartEvolutionCustomOtfFilter asChartEvolutionCustomOtfFilter = new AsChartEvolutionCustomOtfFilter {
                Selected = new AsChartEvolutionCustomOtfFilterSelected
                {
                    User                  = filter.User,
                    IdAccount             = filter.IdAccount,
                    MonthYear             = filter.MonthYear,
                    OperationTypeFamilies = _userCustomOtfService.GetOperationTypeFamilySelect(filter.User.Id, filter.IdAccount)
                },
                OperationTypeFamilies = operationTypeFamilies,
            };

            return(asChartEvolutionCustomOtfFilter);
        }
        private List <AsEvolutionCdbDto> GetAsEvolutionDto(FilterAsTableSelected filterAsTableSelected, string evolutionType)
        {
            var date    = Convert.ToDateTime($"01/{filterAsTableSelected.MonthYear.Month.Id}/{filterAsTableSelected.MonthYear.Year}");
            var dateMax = DateHelper.GetLastDayOfMonth(date);
            var dateMin = DateHelper.GetFirstDayOfMonth(dateMax.AddMonths(-12));

            switch (evolutionType)
            {
            case "Brut":
                return(_accountStatementChartRepository.GetAsChartEvolutionBrut(filterAsTableSelected.IdAccount, dateMin, dateMax));

            case "NoIntTransfer":
                return(_accountStatementChartRepository.GetAsChartEvolutionNoIntTransfer(filterAsTableSelected.IdAccount, filterAsTableSelected.User.IdUserGroup, dateMin, dateMax));;

            default:
                throw new Exception("No matching Evolution type ");
            }
        }
 public AsChartEvolutionCdb GetAsChartEvolutionNoIntTransfer(FilterAsTableSelected filterAsTableSelected)
 {
     return(GetAsChartEvolutionCdb(filterAsTableSelected, "NoIntTransfer"));
 }
 public AsChartEvolutionCdb GetAsChartEvolutionBrut(FilterAsTableSelected filterAsTableSelected)
 {
     return(GetAsChartEvolutionCdb(filterAsTableSelected, "Brut"));
 }
Exemple #13
0
        public IActionResult GetAsChartCategorisationDebit([FromBody] FilterAsTableSelected filter)
        {
            var result = _asChartCategorisationService.GetAsChartCategorisationDebit(filter);

            return(Ok(result));
        }
        public IActionResult getAsTable([FromBody] FilterAsTableSelected filter)
        {
            var pagedList = _accountStatementService.GetAsTable(filter);

            return(Ok(pagedList));
        }
        public IActionResult getAsTableFilter([FromBody] FilterAsTableSelected filter)
        {
            var result = _filterService.GetFilterAsTable(filter);

            return(Ok(result));
        }
        public async Task <IActionResult> GetSolde([FromBody] FilterAsTableSelected filter)
        {
            var pagedList = _accountStatementService.GetSolde(filter);

            return(Ok(pagedList));
        }
        public PagedList <AccountStatement> GetAsTable(FilterAsTableSelected filter)
        {
            var accountStatements = Context.AccountStatement
                                    .Include(x => x.Operation)
                                    .Include(x => x.OperationMethod)
                                    .Include(x => x.OperationType)
                                    .Include(x => x.OperationType.OperationTypeFamily)
                                    .AsQueryable();

            if (filter.IdAccount != null)
            {
                accountStatements = accountStatements.Where(x => x.IdAccount == filter.IdAccount);
            }

            if (filter.OperationMethod != null && filter.OperationMethod.Count > 0)
            {
                var idOperationMethods = filter.OperationMethod.Select(x => x.Id).ToList();

                accountStatements = accountStatements.Where(x => idOperationMethods.Contains(x.IdOperationMethod));
            }

            if (filter.Operation != null && filter.Operation.Count > 0)
            {
                var idOperations = filter.Operation.Select(x => x.Id).ToList();

                accountStatements = accountStatements.Where(x => idOperations.Contains(x.IdOperation));
            }

            if (filter.OperationTypeFamily != null && filter.OperationTypeFamily.Count > 0)
            {
                var idOperationTypeFamilies = filter.OperationTypeFamily.Select(x => x.Id).ToList();

                accountStatements = accountStatements.Where(x => idOperationTypeFamilies.Contains(x.IdOperationTypeFamily));
            }

            if (filter.OperationType != null && filter.OperationType.Count > 0)
            {
                var idOperationTypes = filter.OperationType.Select(x => x.Id).ToList();

                accountStatements = accountStatements.Where(x => idOperationTypes.Contains(x.IdOperationType));
            }

            if (filter.DateIntegration != null && filter.DateIntegration.DateMin != null)
            {
                accountStatements = accountStatements
                                    .Where(x => x.DateIntegration >= filter.DateIntegration.DateMin);

                if (filter.DateIntegration != null && filter.DateIntegration.DateMax != null)
                {
                    accountStatements = accountStatements
                                        .Where(x => x.DateIntegration <= filter.DateIntegration.DateMax);
                }
            }
            else if (filter.MonthYear != null)
            {
                var date    = Convert.ToDateTime($"01/{filter.MonthYear.Month.Id}/{filter.MonthYear.Year}");
                var dateMin = DateHelper.GetFirstDayOfMonth(date);
                var dateMax = DateHelper.GetLastDayOfMonth(date);

                accountStatements = accountStatements
                                    .Where(x => x.DateIntegration >= dateMin && x.DateIntegration <= dateMax);
            }
            if (filter.Amount != null && filter.Amount.NumberMin != null)
            {
                accountStatements = accountStatements
                                    .Where(x => x.AmountOperation >= filter.Amount.NumberMin);
            }
            if (filter.Amount != null && filter.Amount.NumberMax != null)
            {
                accountStatements = accountStatements
                                    .Where(x => x.AmountOperation <= filter.Amount.NumberMax);
            }

            string columnSorted;

            if (filter.Pagination.SortColumn.Contains("operationTypeFamily"))
            {
                columnSorted = $"OperationType.{filter.Pagination.SortColumn}.Label";
            }
            else
            {
                columnSorted = filter.Pagination.SortColumn.Contains("operation") ? $"{filter.Pagination.SortColumn}.Label" : filter.Pagination.SortColumn;
            }

            if (filter.Pagination.SortDirection == "asc")
            {
                accountStatements = accountStatements.OrderBy(columnSorted);
            }
            else
            {
                accountStatements = accountStatements.OrderByDescending(columnSorted);
            }
            var results = PagedListRepository <AccountStatement> .Create(accountStatements, filter.Pagination);

            return(results);
        }
Exemple #18
0
        public IActionResult getAsInternalTransfer([FromBody] FilterAsTableSelected filter)
        {
            var result = _accountStatementService.GetAsInternalTransfer(filter);

            return(Ok(result));
        }
Exemple #19
0
        public IActionResult GetAsChartEvolutionCustomOtfFilter([FromBody] FilterAsTableSelected filter)
        {
            var result = _asChartEvolutionService.GetAsChartEvolutionCustomOtfFilter(filter);

            return(Ok(result));
        }