Пример #1
0
        public async ValueTask Handle(BeginClosingAccountingPeriod command,
                                      CancellationToken cancellationToken = default)
        {
            var generalLedger = await _generalLedger.Get(cancellationToken);

            var chartOfAccounts = await _chartOfAccounts.Get(cancellationToken);

            generalLedger.BeginClosingPeriod(
                (EquityAccount)chartOfAccounts[new AccountNumber(command.RetainedEarningsAccountNumber)],
                new GeneralLedgerEntryIdentifier(command.ClosingGeneralLedgerEntryId),
                command.GeneralLedgerEntryIds.Select(id => new GeneralLedgerEntryIdentifier(id)).ToArray(),
                LocalDateTime.FromDateTime(command.ClosingOn.DateTime));
        }
Пример #2
0
        public async ValueTask Handle(BeginClosingAccountingPeriod command,
                                      CancellationToken cancellationToken = default)
        {
            var generalLedger = await _generalLedger.Get(cancellationToken);

            var retainedEarningsAccountNumber = new AccountNumber(command.RetainedEarningsAccountNumber);

            AccountType.OfAccountNumber(retainedEarningsAccountNumber).MustBe(AccountType.Equity);

            generalLedger.BeginClosingPeriod(retainedEarningsAccountNumber,
                                             new GeneralLedgerEntryIdentifier(command.ClosingGeneralLedgerEntryId),
                                             Array.ConvertAll(command.GeneralLedgerEntryIds, id => new GeneralLedgerEntryIdentifier(id)),
                                             command.ClosingOn);
        }