Пример #1
0
 public async Task StoreEmissionAsync(string period, string user,
                                      string reason, AccountWithAmount awa)
 {
     await _storeOp.StoreAsync(period, user, reason,
                               new List <AccountWithAmount>
     {
         new AccountWithAmount(new Account(Constants.CashAccount, awa.Account.Currency), -awa.Amount),
         awa
     });
 }
Пример #2
0
 public async Task ClosePeriodAsync(List <AccountWithAmount> oldTotals, string oldPeriod)
 {
     if (oldTotals.Count > 0)
     {
         var ops        = GenerateOperations(oldTotals, oldPeriod);
         var aggregated = ops.AggregateOperations();
         await _store.StoreAsync(oldPeriod, Constants.SystemUser, $"Система: Закрытие периода {oldPeriod}",
                                 aggregated);
     }
 }
Пример #3
0
        public async Task <OperationDescription> TransferAsync(string period, string from,
                                                               string to,
                                                               decimal amount, string currency)
        {
            var fromAcc = new Account(from, currency);
            var toAcc   = new Account(to, currency);
            var ops     = new List <AccountWithAmount>
            {
                new AccountWithAmount(fromAcc, -amount),
                new AccountWithAmount(toAcc, amount)
            };

            return(await _store.StoreAsync(period, from, "Перевод по запросу пользователя", ops));
        }