public BookDto(Guid id, string userId, JournalEntry journalEntry, Dictionary <string, LedgerEntry> ledgerEntries) { Journal = new List <JournalEntry>(); Ledger = new Dictionary <string, List <LedgerEntry> >(); TrialBalance = new Dictionary <string, List <TrialBalanceEntry> >(); AggregateId = id; UserId = userId; Journal.Add(journalEntry); foreach (var ledgerEntry in ledgerEntries) { // Ledger List <LedgerEntry> ledgerList = new List <LedgerEntry>(); ledgerList.Add(ledgerEntry.Value); Ledger.Add(ledgerEntry.Key, ledgerList); // Trial Balance List <TrialBalanceEntry> trialBalanceList = new List <TrialBalanceEntry>(); TrialBalanceEntry trialBalanceEntry = new TrialBalanceEntry(); trialBalanceEntry.CurrencyId = ledgerEntry.Value.CurrencyId; if (ledgerEntry.Value.Journal == JournalType.Debit) { trialBalanceEntry.TotalDebit = ledgerEntry.Value.TotalValue; } else { trialBalanceEntry.TotalCredit = ledgerEntry.Value.TotalValue; } trialBalanceList.Add(trialBalanceEntry); TrialBalance.Add(ledgerEntry.Key, trialBalanceList); } }
static internal TrialBalanceEntry MapToTrialBalanceEntry(TrialBalanceEntry entry) { var newEntry = new TrialBalanceEntry(); newEntry.Account = entry.Account; newEntry.Ledger = entry.Ledger; newEntry.Currency = entry.Currency; newEntry.Sector = entry.Sector; newEntry.AccountId = entry.AccountId; newEntry.SubledgerAccountId = entry.SubledgerAccountId; newEntry.InitialBalance = entry.InitialBalance; newEntry.Debit = entry.Debit; newEntry.Credit = entry.Credit; newEntry.CurrentBalance = entry.CurrentBalance; newEntry.GroupNumber = entry.GroupNumber; newEntry.GroupName = entry.GroupName; newEntry.ItemType = entry.ItemType; newEntry.ExchangeRate = entry.ExchangeRate; return(newEntry); }
static private TrialBalanceEntryDto MapToTrialBalanceComparative(TrialBalanceEntry trialBalanceEntry) { var dto = new TrialBalanceEntryDto(); SubsidiaryAccount subledgerAccount = SubsidiaryAccount.Parse(trialBalanceEntry.SubledgerAccountId); dto.ItemType = trialBalanceEntry.ItemType; dto.LedgerUID = trialBalanceEntry.Ledger.UID; dto.LedgerNumber = trialBalanceEntry.Ledger.Number; dto.AccountId = trialBalanceEntry.AccountId; dto.CurrencyCode = trialBalanceEntry.ItemType == TrialBalanceItemType.BalanceTotalConsolidated ? "" : trialBalanceEntry.Currency.Code; if (subledgerAccount.IsEmptyInstance) { dto.AccountName = trialBalanceEntry.GroupName != "" ? trialBalanceEntry.GroupName : trialBalanceEntry.Account.Name; dto.AccountNumber = trialBalanceEntry.GroupNumber != "" ? trialBalanceEntry.GroupNumber : trialBalanceEntry.Account.Number != "Empty" ? trialBalanceEntry.Account.Number : ""; } else { dto.AccountName = subledgerAccount.Name; dto.AccountNumber = subledgerAccount.Number; } dto.AccountRole = trialBalanceEntry.Account.Role; dto.AccountLevel = trialBalanceEntry.Account.Level; dto.SectorCode = trialBalanceEntry.Sector.Code; dto.SubledgerAccountId = trialBalanceEntry.SubledgerAccountId; dto.InitialBalance = trialBalanceEntry.InitialBalance; dto.Debit = trialBalanceEntry.Debit; dto.Credit = trialBalanceEntry.Credit; dto.CurrentBalance = trialBalanceEntry.CurrentBalance; dto.ExchangeRate = trialBalanceEntry.ExchangeRate; return(dto); }