public void Merge(AccountingTransaction movmentSet) { foreach (Booking elem in movmentSet.Bookings) { AddBooking(elem); } }
public void SetUp() { movementSet = new AccountingTransaction(); Bookings = new List<Booking>(); Booking Booking = new Booking(1, new Account("100000", "first account"), 1000, new Account("200000", "second account"), movementSet.Date, new Branch {Id = 1}); Bookings.Add(Booking); }
public void AddAccoutingTransaction_WithBooking() { AccountingTransactionManager accountingTransactionManager = (AccountingTransactionManager)container["AccountingTransactionManager"]; AccountingTransaction accountingTransaction = new AccountingTransaction { Date = new DateTime(2009, 2, 3), User = new User { Id = 1 } }; accountingTransaction.AddBooking(new Booking { Number = 1, Amount = 1000, CreditAccount = new Account {Id = 1}, DebitAccount = new Account {Id = 2}, Label = OAccountingLabels.Capital }); accountingTransaction.AddBooking(new Booking { Number = 2, Amount = 1000, CreditAccount = new Account {Id = 2}, DebitAccount = new Account {Id = 4}, Label = OAccountingLabels.Fees }); }
public void UnBook(AccountingTransaction movementSet) { foreach (Booking Booking in movementSet.Bookings) { _getAccountByNumber(Booking.CreditAccount.Number, Booking.CreditAccount.CurrencyId).Debit(Booking.Amount); _getAccountByNumber(Booking.DebitAccount.Number, Booking.DebitAccount.CurrencyId).Credit(Booking.Amount); } }
public void UnBook(AccountingTransaction movementSet) { foreach (Booking booking in movementSet.Bookings) { GetAccountByTypeCode(booking.CreditAccount.TypeCode, booking.CreditAccount.CurrencyId).Debit(booking.Amount); GetAccountByTypeCode(booking.DebitAccount.TypeCode, booking.CreditAccount.CurrencyId).Credit(booking.Amount); } }
public void TestMergeTwoMovementSet() { AccountingTransaction mvt1 = new AccountingTransaction(); mvt1.Bookings = new List<Booking>(); mvt1.AddBooking(new Booking(1, new Account("100000", "first1 account"), 1000, new Account("100000", "first2 account"), movementSet.Date, new Branch{Id = 1})); mvt1.AddBooking(new Booking(2, new Account("100000", "first3 account"), 1000, new Account("100000", "first4 account"), movementSet.Date, new Branch{Id = 1})); Assert.AreEqual(2,mvt1.Bookings.Count); AccountingTransaction mvt2 = new AccountingTransaction(); mvt2.Bookings = new List<Booking>(); mvt2.AddBooking(new Booking(1, new Account("100000", "second1 account"), 1000, new Account("100000", "second2 account"), movementSet.Date, new Branch{Id = 1})); mvt2.AddBooking(new Booking(2, new Account("100000", "second3 account"), 1000, new Account("100000", "second4 account"), movementSet.Date, new Branch{Id = 1})); Assert.AreEqual(2,mvt2.Bookings.Count); mvt1.Merge(mvt2); Assert.AreEqual(4,mvt1.Bookings.Count); }
public void TestBook() { Account cashCredit = new Account(); cashCredit.DebitPlus = true; cashCredit.Number = "1031"; cashCredit.TypeCode = "CASH_CREDIT"; cashCredit.Balance = 0; cashCredit.CurrencyId = 1; chartOfAccounts.AddAccount(cash); chartOfAccounts.AddAccount(cashCredit); // OMFS-200 AccountingTransaction movementSet = new AccountingTransaction(); Booking mvt = new Booking(2, cashCredit, 100, cash, movementSet.Date, new Branch{Id = 1}); movementSet.AddBooking(mvt); chartOfAccounts.Book(movementSet); Assert.AreEqual(1100m,chartOfAccounts.GetAccountByTypeCode("CASH",1).Balance.Value); Assert.AreEqual(-100m,chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT",1).Balance.Value); }
public void UnBook(AccountingTransaction movementSet) { foreach(Booking booking in movementSet.Bookings) { GetAccountByTypeCode(booking.CreditAccount.TypeCode, booking.CreditAccount.CurrencyId).Debit(booking.Amount); GetAccountByTypeCode(booking.DebitAccount.TypeCode, booking.CreditAccount.CurrencyId).Credit(booking.Amount); } }
private static void _AssertSelectedAccountingTransaction(AccountingTransaction pAccountingTransaction, DateTime pDate, User pUser) { Assert.AreEqual(pDate, pAccountingTransaction.Date); _AssertSelectedUser(pUser, pAccountingTransaction.User); }
public void Merge(AccountingTransaction movmentSet) { foreach (Booking elem in movmentSet.Bookings) AddBooking(elem); }
public void UnBook(AccountingTransaction movementSet) { foreach(Booking Booking in movementSet.Bookings) { _getAccountByNumber(Booking.CreditAccount.Number, Booking.CreditAccount.CurrencyId).Debit(Booking.Amount); _getAccountByNumber(Booking.DebitAccount.Number, Booking.DebitAccount.CurrencyId).Credit(Booking.Amount); } }
public void TestBookAndUnBook() { // Actors Account _cash = null, _cashCredit = null; OCurrency cashBalance1 = 0, cashBalance2 = 0; OCurrency cashBalance3 = 0, cashBalance4 = 0; Booking mvt = null; AccountingTransaction movementSet = null; // Activites chartOfAccounts.Accounts = new List<Account>(); _cash = new Account(); _cash.DebitPlus = true; _cash.Number = "1011"; _cash.Balance = 1000; _cash.TypeCode = "CASH"; _cash.CurrencyId = 1; _cashCredit = new Account(); _cashCredit.DebitPlus = true; _cashCredit.Number = "1031"; _cashCredit.TypeCode = "CASH_CREDIT"; _cashCredit.Balance = 0; _cashCredit.CurrencyId = 1; chartOfAccounts.AddAccount(_cash); chartOfAccounts.AddAccount(_cashCredit); movementSet = new AccountingTransaction(); // Asertions mvt = new Booking(2, _cashCredit, 100, cash, movementSet.Date, new Branch{Id = 1}); movementSet.AddBooking(mvt); chartOfAccounts.Book(movementSet); cashBalance1 = chartOfAccounts.GetAccountByTypeCode("CASH",1).Balance; cashBalance2 = chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT", 1).Balance; chartOfAccounts.UnBook(movementSet); cashBalance3 = chartOfAccounts.GetAccountByTypeCode("CASH", 1).Balance; cashBalance4 = chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT",1).Balance; // Asertions Assert.AreEqual (1100m, cashBalance1.Value); Assert.AreEqual (-100m, cashBalance2.Value); Assert.AreEqual (1000m, cashBalance3.Value); Assert.AreEqual (0m, cashBalance4.Value); }