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() }); }
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() }); }
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() }); }
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() }); }
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() }); }
public void ToGuidReturnsExpectedResult(Guid value) { var sut = new GeneralLedgerEntryIdentifier(value); Assert.Equal(value, sut.ToGuid()); }