main
 1namespace solidware.financials.service.domain.accounting
 2{
 3    public class Entry
 4    {
 5        static public Entry New<Transaction>(decimal amount, UnitOfMeasure units) where Transaction : TransactionType, new()
 6        {
 7            return New<Transaction>(new Quantity(amount, units));
 8        }
 9
10        static public Entry New<Transaction>(Quantity amount) where Transaction : TransactionType, new()
11        {
12            return new Entry
13                   {
14                       when_booked = Calendar.today(),
15                       transaction_type = new Transaction(),
16                       amount = amount,
17                   };
18        }
19
20        public virtual Quantity adjust(Quantity balance)
21        {
22            return transaction_type.adjust(balance, amount);
23        }
24
25        public virtual bool booked_in(Range<Date> period)
26        {
27            return period.includes(when_booked);
28        }
29
30        Date when_booked;
31        TransactionType transaction_type;
32        Quantity amount;
33    }
34}