示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dividendDetails">The details of the cash dividend (date, price)</param>
        /// <param name="units">The total number of units over which dividend is paid</param>
        public CashTransfer(IJournalEntryLine line)
            : base((ICustomerAccount)line.GiroAccount, line.Parent, getDescription(line))
        {
            if (!(line.Status == JournalEntryLineStati.Booked && line.BookComponent == null &&
                (line.GLAccount.CashTransferType == CashTransferTypes.Deposit || line.GLAccount.CashTransferType == CashTransferTypes.Withdrawal)))
                throw new ApplicationException("This journal entry line is not a valid cashmutation.");

            ICashTransferComponent newComponent = new CashTransferComponent(this, BookingComponentTypes.CashTransfer, this.CreationDate);
            line.BookComponent = newComponent.Component;
            newComponent.JournalLines.Add(line);
            line.BookComponent.MainLine = line;
            newComponent.Component.SetDescription(this.Description);
            this.Components.Add(newComponent);
        }
示例#2
0
 protected IGeneralOperationsComponent clone(bool doStorno, IGeneralOperationsBooking parentBooking)
 {
     ICashTransferComponent clone = new CashTransferComponent(parentBooking, this.BookingComponentType);
     foreach (IJournalEntryLine line in this.Component.JournalLines)
     {
         IJournalEntryLine cloneLine = line.Clone();
         if (doStorno)
         {
             cloneLine.Balance = cloneLine.Balance.Negate();
             line.StornoedLine = cloneLine;
         }
         clone.Component.JournalLines.AddJournalEntryLine(cloneLine);
     }
     return clone;
 }
示例#3
0
        public bool AddTransferFee(Money transferFee, IGLLookupRecords lookups, string description)
        {
            bool success = false;
            if (transferFee == null || lookups == null)
                throw new ApplicationException("It is not possible to add transfer fee since not all parameters are valid.");

            IGeneralOperationsComponent comp = Components.Where(u => u.BookingComponentType == BookingComponentTypes.CashTransfer).FirstOrDefault();
            if (!(comp != null && comp.MainLine != null && comp.MainLine.IsAllowedToAddTransferFee))
                throw new ApplicationException("It is not possible to add transfer fee to this transfer.");

            if (TransferFee != null && TransferFee.IsNotZero)
                throw new ApplicationException("It is not possible to add transfer fee more than once.");

            if (transferFee.Sign || transferFee.Abs().Quantity > TransferAmount.Abs().Quantity)
                throw new ApplicationException("The transfer fee can not be higher than the transfer amount.");

            if (transferFee != null && transferFee.IsNotZero)
            {
                ICashTransferComponent newComponent = new CashTransferComponent(this, BookingComponentTypes.CashTransferFee, this.CreationDate);
                newComponent.AddLinesToComponent(transferFee, BookingComponentTypes.CashTransferFee, true, false, false, lookups, Account);
                newComponent.Component.SetDescription(description);
                this.Components.Add(newComponent);
                success = true;
            }
            return success;
        }