Пример #1
0
        private static IJournalEntryLine getLineById(IJournalEntry journalEntry, int journalEntryLineId, JournalEntryLineStati illegalStatus,
                                                     string action)
        {
            IJournalEntryLine line = journalEntry.Lines.GetLineById(journalEntryLineId);

            if (line == null)
                throw new ApplicationException(string.Format("Journal Entry Line with ID '{0}' could not be found.", journalEntryLineId));
            else if (line.Status == illegalStatus)
                throw new ApplicationException(string.Format(
                    "Journal Entry Line number '{0}' cannot be {1}d because its status is {2}.",
                    line.LineNumber, action, line.Status));
            else if (line.GLAccount != null && line.GLAccount.IsFixed)
                throw new ApplicationException(string.Format(
                    "Journal Entry Line number '{0}' cannot be {1}d because its GL Account ('{2}') is a fixed account.",
                    line.LineNumber, action, line.GLAccount.FullDescription));

            return line;
        }
Пример #2
0
        public void BookLine()
        {
            if ((this.Status == JournalEntryLineStati.New) || (this.Status == JournalEntryLineStati.Booked))
            {
                if ((this.GLAccount.RequiresGiroAccount) && (this.GiroAccount != null) && (this.GiroAccount.AccountType != AccountTypes.Trading))
                {
                    ICashSubPosition acctPosition = this.GiroAccount.Portfolio.PortfolioCashGL.GetSubPosition(this.Debit.Underlying.ToCurrency, this.GLAccount);
                    acctPosition.JournalLines.AddLine(this);

                    // check for afsluit provisie
                    if (this.GLAccount.CashTransferType == CashTransferTypes.TransferFee)
                    {
                        IJournalEntryLine mainLine = ((ICashTransfer)((ICashTransferComponent)this.BookComponent.Parent).ParentBooking).MainTransferLine;

                        if (mainLine.SkipOrders || (mainLine.Instruction != null && mainLine.Instruction.Orders != null && mainLine.Instruction.Orders.Count > 0))
                            this.SkipOrders = true;
                    }
                }

                // check ManagementStartDate
                // For Cash -> Add 1 day
                if (!Parent.Journal.IsAdminAccount &&
                    GiroAccount != null &&
                    !GLAccount.IsToSettleWithClient &&
                    (GiroAccount.AccountType == AccountTypes.Customer || GiroAccount.AccountType == AccountTypes.Nostro))
                {
                    // When Account.Status is inactive -> revive the account
                    if (GiroAccount.Status != AccountStati.Active)
                    {
                        GiroAccount.Status = AccountStati.Active;
                        GiroAccount.NeedsAttention = true;
                    }

                    DateTime possibleMgtStartDate = Parent.TransactionDate.AddDays(1);
                    if (Util.IsNullDate(((IAccountTypeCustomer)GiroAccount).FirstManagementStartDate) || ((IAccountTypeCustomer)GiroAccount).FirstManagementStartDate > possibleMgtStartDate)
                        ((IAccountTypeCustomer)GiroAccount).FirstManagementStartDate = possibleMgtStartDate;
                    if (Util.IsNotNullDate(((IAccountTypeInternal)GiroAccount).ValuationsEndDate) && ((IAccountTypeInternal)GiroAccount).ValuationsEndDate < Parent.TransactionDate)
                        ((IAccountTypeInternal)GiroAccount).ValuationsEndDate = Parent.TransactionDate;
                }
                this.BookDate = this.BookDate;
                this.status = JournalEntryLineStati.Booked;
                if (!this.IsAdminBooking) checkCreateCashMutationComponent();
                this.BookedBy = B4F.TotalGiro.Security.SecurityManager.CurrentUser;
            }
        }