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 internal FixedList <CurrencyRule> GetAccountCurrenciesRules(Account account)
        {
            FixedList <CurrencyRule> list;

            _currenciesRules.TryGetValue(account.StandardAccountId.ToString(), out list);

            if (list != null)
            {
                return(list);
            }
            else
            {
                return(new FixedList <CurrencyRule>());
            }


            //var currencies = from rule in _currenciesRules
            //                 where rule.StandardAccountId == account.StandardAccountId
            //                 orderby rule.Currency.Code
            //                 select rule;

            ////var list = _currenciesRules.Select(x => x.StandardAccountId == account.StandardAccountId).;

            //// list.Sort((x, y) => x.Currency.Code.CompareTo(y.Currency.Code));

            //return new FixedList<CurrencyRule>(currencies);
        }
        private void GetDetailSummaryEntries(List <TrialBalanceEntry> detailSummaryEntries,
                                             EmpiriaHashTable <TrialBalanceEntry> summaryEntries,
                                             StandardAccount currentParent, TrialBalanceEntry entry)
        {
            TrialBalanceEntry detailsEntry;
            string            key = $"{currentParent.Number}||{entry.Sector.Code}||{entry.Currency.Id}||{entry.Ledger.Id}";

            summaryEntries.TryGetValue(key, out detailsEntry);
            if (detailsEntry != null)
            {
                var existEntry = detailSummaryEntries.FirstOrDefault(a => a.Ledger.Id == detailsEntry.Ledger.Id &&
                                                                     a.Currency.Id == detailsEntry.Currency.Id &&
                                                                     a.Account.Number == detailsEntry.Account.Number &&
                                                                     a.Sector.Code == detailsEntry.Sector.Code);
                if (existEntry == null)
                {
                    detailSummaryEntries.Add(detailsEntry);
                }
            }
        }