예제 #1
0
        public AccountingEntry(string description, AccountingTitle accountingTitle, CurrencyType currencyType, ElementChangeDirection?elementChangeDirection, decimal amount, int?tenantId)
            : this()
        {
            Description       = description;
            AccountingTitle   = accountingTitle;
            AccountingTitleId = accountingTitle.Id;
            CurrencyType      = currencyType;
            TenantId          = tenantId;
            switch (accountingTitle.AccountingElementType)
            {
            case AccountingElementType.Asset:
                BalanceDirectionType = elementChangeDirection == ElementChangeDirection.Increase ? BalanceDirection.Debit : BalanceDirection.Credit;
                Amount = Math.Abs(amount);
                break;

            case AccountingElementType.Liability:
            case AccountingElementType.OwnersEquity:
                BalanceDirectionType = elementChangeDirection == ElementChangeDirection.Increase ? BalanceDirection.Credit : BalanceDirection.Debit;
                Amount = Math.Abs(amount);
                break;

            case AccountingElementType.Revenue:
                BalanceDirectionType = BalanceDirection.Credit;
                Amount = elementChangeDirection == ElementChangeDirection.Increase ? Math.Abs(amount): -Math.Abs(amount);
                break;

            case AccountingElementType.Expense:
            case AccountingElementType.Cost:
                BalanceDirectionType = BalanceDirection.Debit;
                Amount = elementChangeDirection == ElementChangeDirection.Increase ? Math.Abs(amount) : -Math.Abs(amount);
                break;
            }
        }
예제 #2
0
 public AccountingEntry(int voucherNumber, string description, AccountingTitle accountingTitle, CurrencyType currencyType, ElementChangeDirection elementChangeDirection, decimal amount, int?tenantId)
     : this(description, accountingTitle, currencyType, elementChangeDirection, amount, tenantId)
 {
     VoucherNumber = voucherNumber;
 }