Exemplo n.º 1
0
        public void ApplyCredit(Credit credit, ChartOfAccounts chartOfAccounts)
        {
            MustNotBePosted();

            chartOfAccounts.MustNotBeDeactivated(credit.AccountNumber);

            Apply(new CreditApplied {
                GeneralLedgerEntryId = _identifier.ToGuid(),
                Amount        = credit.Amount.ToDecimal(),
                AccountNumber = credit.AccountNumber.ToInt32()
            });
        }
Exemplo n.º 2
0
 internal GeneralLedgerEntry(GeneralLedgerEntryIdentifier identifier,
                             GeneralLedgerEntryNumber number, Period period, DateTimeOffset createdOn) : this()
 {
     Apply(new GeneralLedgerEntryCreated {
         GeneralLedgerEntryId = identifier.ToGuid(),
         Number    = number.ToString(),
         CreatedOn = createdOn,
         Period    = period.ToString()
     });
 }
Exemplo n.º 3
0
        internal GeneralLedgerEntry(GeneralLedgerEntryIdentifier identifier,
                                    GeneralLedgerEntryNumber number, AccountingPeriod accountingPeriod, LocalDateTime createdOn) : this()
        {
            if (!accountingPeriod.Contains(createdOn.Date))
            {
                throw new GeneralLedgerEntryNotInPeriodException(number, createdOn, accountingPeriod);
            }

            Apply(new GeneralLedgerEntryCreated {
                GeneralLedgerEntryId = identifier.ToGuid(),
                Number    = number.ToString(),
                CreatedOn = Time.Format.LocalDateTime(createdOn),
                Period    = accountingPeriod.ToString()
            });
        }
Exemplo n.º 4
0
        internal GeneralLedgerEntry(GeneralLedgerEntryIdentifier identifier,
                                    GeneralLedgerEntryNumber number, Period period, DateTimeOffset createdOn) : this()
        {
            if (!period.Contains(createdOn))
            {
                throw new GeneralLedgerEntryNotInPeriodException(number, createdOn, period);
            }

            Apply(new GeneralLedgerEntryCreated {
                GeneralLedgerEntryId = identifier.ToGuid(),
                Number    = number.ToString(),
                CreatedOn = createdOn,
                Period    = period.ToString()
            });
        }
Exemplo n.º 5
0
        public void BeginClosingPeriod(AccountNumber retainedEarningsAccountNumber,
                                       GeneralLedgerEntryIdentifier closingGeneralLedgerEntryIdentifier,
                                       GeneralLedgerEntryIdentifier[] generalLedgerEntryIdentifiers, DateTimeOffset closingOn)
        {
            if (_periodClosing)
            {
                throw new PeriodClosingInProcessException(_period);
            }

            _period.MustNotBeAfter(closingOn);

            Apply(new AccountingPeriodClosing {
                Period = _period.ToString(),
                GeneralLedgerEntryIds         = Array.ConvertAll(generalLedgerEntryIdentifiers, id => id.ToGuid()),
                ClosingOn                     = closingOn,
                RetainedEarningsAccountNumber = retainedEarningsAccountNumber.ToInt32(),
                ClosingGeneralLedgerEntryId   = closingGeneralLedgerEntryIdentifier.ToGuid()
            });
        }
Exemplo n.º 6
0
        public void ToGuidReturnsExpectedResult(Guid value)
        {
            var sut = new GeneralLedgerEntryIdentifier(value);

            Assert.Equal(value, sut.ToGuid());
        }