Exemplo n.º 1
0
        public async Task <IActionResult> Getjournal(DateTimeOffset?from, DateTimeOffset?to, DateTimeOffset?fromReleaseDate, DateTimeOffset?toReleaseDate, long?accountId, long?costCenterId, bool ShowNotPostedEntries = false, bool ShowTotalEntries = true)
        {
            Guid?accountGuid = null, costCenterGuid = null;

            if (accountId.HasValue)
            {
                var account = await _accountRepo.GetAsync(accountId.Value);

                if (account == null)
                {
                    return(NotFound("AcountNotFound"));
                }
                accountGuid = account.Id;
            }

            if (costCenterId.HasValue)
            {
                var costCenter = await _costCenterRepo.GetAsync(costCenterId.Value);

                if (costCenter == null)
                {
                    return(NotFound("CostCenterNotFound"));
                }
                costCenterGuid = costCenter.Id;
            }
            JournalOptions options = new JournalOptions
            {
                ShowNotPostedEntries = ShowNotPostedEntries,
                ShowTotalEntries     = ShowTotalEntries,
            };
            var journalViewModel = _reportService.GetjournalEntry(accountGuid, costCenterGuid, from, to, fromReleaseDate, toReleaseDate, options);

            return(Ok(journalViewModel));
        }
Exemplo n.º 2
0
        public JournalEntryViewModel CreateJournalEntryViewModel(Entry entry, JournalOptions op)
        {
            var model = new JournalEntryViewModel();

            model.EntryNo     = entry.Number;
            model.EntryOrigin = entry.EntryOrigin;
            switch (entry.EntryOrigin)
            {
            case EntryOrigin.None:
                model.EntryOriginNo = entry.Number;
                break;

            case EntryOrigin.Pay:
                model.EntryOriginNo = entry.PayEntry.Number;
                break;

            case EntryOrigin.Bill:
                model.EntryOriginNo = entry.BillEntry.Bill.Number;
                break;
            }
            model.Date         = entry.Date;
            model.CreationDate = entry.CreatedDateTime;
            model.Items        = entry.Items.Select(this.CreateJournalEntryItemViewModel).ToList();
            if (op.ShowTotalEntries)
            {
                model.DebitSum  = model.Items.Sum(e => e.Debit);
                model.CreditSum = model.Items.Sum(e => e.Credit);
            }
            return(model);
        }
Exemplo n.º 3
0
 public ActionsController(ILogger <ActionsController> logger, ActionsService actionService, IProviderType glProvider, IOptions <ViewOptions> options, IOptions <JournalOptions> journalOptions)
 {
     _logger         = logger;
     _actionService  = actionService;
     _glProvider     = glProvider;
     _options        = options.Value;
     _journalOptions = journalOptions.Value;
 }
Exemplo n.º 4
0
        public JournalViewModel GetjournalEntry(Guid?accountId, Guid?costCenterId, DateTimeOffset?from, DateTimeOffset?fromReleaseDate, DateTimeOffset?toReleaseDate, DateTimeOffset?to, JournalOptions options)
        {
            var dataQurey = _entryRep.NativeGetAll();

            if (from.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.Date.Date.Date >= from);
            }

            if (to.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.Date.Date <= to);
            }

            if (fromReleaseDate.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.CreatedDateTime.Date.Date >= fromReleaseDate);
            }

            if (toReleaseDate.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.CreatedDateTime.Date <= toReleaseDate);
            }

            if (accountId.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.Items.Any(I => I.AccountId == accountId));
            }

            if (costCenterId.HasValue)
            {
                dataQurey = dataQurey.Where(e => e.Items.Any(I => I.CostCenterId == costCenterId));
            }

            if (!options.ShowNotPostedEntries)
            {
                dataQurey = dataQurey.Where(e => e.IsPosted);
            }

            var journalViewModel = new JournalViewModel();

            journalViewModel.Items = dataQurey.Select(e => _modelFactory.CreateJournalEntryViewModel(e, options)).ToList();

            return(journalViewModel);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Регистрирует новый журнал или обновляет старый на основе компонента <paramref name="component"/>.
 /// </summary>
 /// <param name="component">Компонент приложения (см. <see cref="IComponentSingleton{TAppCore}"/>) для которого регистрируется журнал.</param>
 /// <param name="nameJournal">См. <see cref="JournalNameDAO.Name"/>.</param>
 /// <param name="journalOptions">Дополнительные параметры журнала.</param>
 /// <returns>Возвращает объект <see cref="ExecutionResultJournalName"/> со свойством <see cref="ExecutionResult.IsSuccess"/> в зависимости от успешности выполнения операции. В случае ошибки свойство <see cref="ExecutionResult.Message"/> содержит сообщение об ошибке.</returns>
 /// <exception cref="ArgumentNullException">Возникает, если <paramref name="nameJournal"/> представляет пустую строку или null.</exception>
 public static ExecutionResult <Journaling.Model.JournalInfo> RegisterJournal(this IComponentSingleton component, string nameJournal, JournalOptions journalOptions = null)
 {
     return(component.GetAppCore().Get <JournalingManager>().RegisterJournalTypedInternal(component.GetType(), nameJournal, journalOptions));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Устанавливает свойства журнала на основе компонента <paramref name="component"/>.
 /// </summary>
 /// <param name="component">Компонент приложения (см. <see cref="IComponentSingleton{TAppCore}"/>) для которого регистрируется событие.</param>
 /// <param name="journalOptions">Параметры журнала.</param>
 /// <returns>Возвращает объект <see cref="ExecutionResult"/> со свойством <see cref="ExecutionResult.IsSuccess"/> в зависимости от успешности выполнения операции. В случае ошибки свойство <see cref="ExecutionResult.Message"/> содержит сообщение об ошибке.</returns>
 public static ExecutionResult SetJournalOptions(this IComponentSingleton component, JournalOptions journalOptions)
 {
     return(component.GetAppCore().Get <JournalingManager>().SetJournalOptions(component.GetType(), journalOptions));
 }
Exemplo n.º 7
0
 public HomeController(PageService pageService, IOptions <ViewOptions> viewOptions, IOptions <JournalOptions> journalOptions)
 {
     _pageService    = pageService;
     _viewOptions    = viewOptions.Value;
     _journalOptions = journalOptions.Value;
 }