internal FixedList <TrialBalanceEntry> ConsolidateToTargetCurrency( FixedList <TrialBalanceEntry> trialBalance, TrialBalanceCommandPeriod commandPeriod) { var targetCurrency = Currency.Parse(commandPeriod.ValuateToCurrrencyUID); var summaryEntries = new EmpiriaHashTable <TrialBalanceEntry>(); foreach (var entry in trialBalance) { string hash = $"{entry.Account.Number}||{entry.Sector.Code}||{targetCurrency.Id}||{entry.Ledger.Id}"; if (entry.Currency.Equals(targetCurrency)) { summaryEntries.Insert(hash, entry); } else if (summaryEntries.ContainsKey(hash)) { summaryEntries[hash].Sum(entry); } else { entry.Currency = targetCurrency; summaryEntries.Insert(hash, entry); } } return(summaryEntries.Values.ToList() .ToFixedList()); }
private void GenerateOrIncreaseEntries(EmpiriaHashTable <TrialBalanceEntry> summaryEntries, TrialBalanceEntry entry, StandardAccount targetAccount, Sector targetSector, TrialBalanceItemType itemType, string hash) { TrialBalanceEntry summaryEntry; summaryEntries.TryGetValue(hash, out summaryEntry); if (summaryEntry == null) { summaryEntry = new TrialBalanceEntry { Ledger = entry.Ledger, Currency = entry.Currency, Sector = targetSector, Account = targetAccount, ItemType = itemType, GroupNumber = entry.GroupNumber, GroupName = entry.GroupName, DebtorCreditor = entry.DebtorCreditor, SubledgerAccountIdParent = entry.SubledgerAccountIdParent }; summaryEntry.Sum(entry); summaryEntries.Insert(hash, summaryEntry); } else { summaryEntry.Sum(entry); } }
static CurrenciesRulesChart() { var list = AccountsChartData.GetAccountsCurrenciesRules() .GroupBy(x => x.StandardAccountId); foreach (var item in list) { _currenciesRules.Insert(item.Key.ToString(), item.ToList().ToFixedList()); } }