/// <summary> /// Adds a ledger entry to the category. /// </summary> /// <param name="entry">The entry.</param> /// <exception cref="System.ArgumetNullException">. Entry must be provided.</exception> public void AddEntry(ILedgerEntry entry) { if (entry == null) { throw new ArgumentNullException("Entry must be provided"); } entry.Category = this; this.Entries.Add(entry); }
public static void DeleteLedgerEntry(ILedgerEntry ledger) { foreach (ISubledgerEntry subLedger in ledger.SubledgerEntries) { foreach (IJournalEntryLine line in subLedger.JournalEntryLines) { line.SubledgerEntry = null; } } }
public static bool Update(IDalSession session, ILedgerEntry obj) { return session.InsertOrUpdate(obj); }
private void WriteCreditEntry(ILedgerEntry creditEntry) { }
private void WriteDebitEntry(ILedgerEntry debitEntry) { }
private void LogUnknownLedgerEntryType(ILedgerEntry obj) { }
private void WriteDebitEntry(ILedgerEntry obj) { }
private void WriteCreditEntry(ILedgerEntry obj) { }
private static string formatLedgerEntry(BatchExecutionResults results, ILedgerEntry ledgerEntry) { try { string formatted = ""; formatted += ledgerEntry.FormatLine() + Environment.NewLine; foreach (var subledgerEntry in ledgerEntry.SubledgerEntries .Where(x => ((x.LineNumber > 0) && (x.Amount != 0m))) .OrderBy(y => y.LineNumber)) { formatted += subledgerEntry.FormatLine() + Environment.NewLine; } return formatted; } catch (Exception ex) { results.MarkError( new ApplicationException(string.Format("Error exporting ledger entry {0} or one of its sub-ledger entries.", ledgerEntry.Key), ex)); return ""; } }
private static void CreateSubLedgerEntries(IDalSession session, ILedgerEntry newEntry, IList<IJournalEntryLine> groupOfLines) { var summary = from s in groupOfLines //.Where(n => n.GLAccount.ExactAccount != null) group s by new { account = s.GLAccount.ExactAccount, currency = s.Balance.UnderlyingShortName } into accountGroups select new { exactAccount = accountGroups.Key.account, currency = accountGroups.Key.currency, records = accountGroups, total = (from l in accountGroups select (l.Debit - l.Credit)).Sum() }; //bool bankFlag = newEntry.LedgerType.JournalType == JournalTypes.BankStatement; int lineNumer = 1; foreach (var d in summary.OrderBy(a => a.exactAccount).ThenBy(b => b.currency)) { Decimal quantity = d.total.Quantity; ISubledgerEntry newSubEntry = new SubledgerEntry("", d.exactAccount, quantity, d.currency, false, d.total.XRate); if (newSubEntry.Amount != 0m) newSubEntry.LineNumber = lineNumer++; foreach (var f in d.records) { f.SubledgerEntry = newSubEntry; } newEntry.SubledgerEntries.AddSubLedgerEntry(newSubEntry); } }