private static bool CreateManagementFeeBookingsforDate(IDalSession session, IList listofFees, IMemorialBooking feeBookings, IGLAccount clientTaxAccount, IGLAccount clientFeeAccount, IGLAccount clientFixedCostsAccount, IGLAccount taxAccount) { //foreach (IManagementFee imf in listofFees) //{ // foreach (MgtFeeBreakupLine line in imf.FeeDetails.BreakupLines) // { // if (line.Amount.IsNotZero) // { // IAccountTypeInternal account = line.Transaction.AccountA; // IJournalEntryLine newLineClient = new JournalEntryLine(); // IJournalEntryLine newLineCP = new JournalEntryLine(); // IJournalEntryLine newLineClientTax = new JournalEntryLine(); // IJournalEntryLine newLineCPTax = new JournalEntryLine(); // switch (line.MgtFeeType.Key) // { // case FeeTypes.AdministrationCosts: // case FeeTypes.FixedFee: // newLineClient.GLAccount = clientFixedCostsAccount; // newLineCP.GLAccount = account.AccountOwner.ManagementFeeFixedCostsAccount; // break; // default: // newLineClient.GLAccount = clientFeeAccount; // newLineCP.GLAccount = account.AccountOwner.ManagementFeeIncomeAccount; // break; // } // newLineClientTax.GLAccount = clientTaxAccount; // newLineCPTax.GLAccount = taxAccount; // newLineClient.Balance = line.Amount; // newLineCP.Balance = line.Amount.Negate(); // if ((line.Tax != null) && (line.Tax.IsNotZero)) // { // newLineClientTax.Balance = line.Tax; // newLineCPTax.Balance = line.Tax.Negate(); // } // newLineClient.GiroAccount = account; // newLineClientTax.GiroAccount = account; // newLineClient.TotalGiroTrade = line.Transaction; // newLineCP.TotalGiroTrade = line.Transaction; // newLineClientTax.TotalGiroTrade = line.Transaction; // newLineCPTax.TotalGiroTrade = line.Transaction; // feeBookings.Lines.Add(newLineClient); // feeBookings.Lines.Add(newLineCP); // feeBookings.Lines.Add(newLineClientTax); // feeBookings.Lines.Add(newLineCPTax); // } // } //} return true; }
public GeneralOperationsBookingTaxeable(IAccountTypeCustomer account, IMemorialBooking journalEntry, string description, decimal taxPercentage) : base(account, journalEntry, description) { if (taxPercentage < 0 || taxPercentage > 1) throw new ApplicationException("The Tax Percentage can only be between 0 and 1"); this.TaxPercentage = taxPercentage; }
/// <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 CashDividend(IAccountTypeCustomer account, IMemorialBooking journalEntry, string description, decimal taxPercentage, IDividendHistory dividendDetails, InstrumentSize units, IGLLookupRecords lookups) : base(account, journalEntry, description, taxPercentage) { if (dividendDetails == null) throw new ApplicationException("Dividend details are mandatory."); if (units == null || units.IsZero) throw new ApplicationException("The number of units is mandatory."); this.DividendDetails = dividendDetails; this.UnitsInPossession = units; //this.CashGeneratingInstrument = dividendDetails.Instrument; createComponents(lookups); }
public ManagementFee(IAccountTypeCustomer account, DateTime startDate, DateTime endDate, IList<IManagementPeriodUnit> units, IMemorialBooking journalEntry, decimal taxPercentage, IGLLookupRecords lookups) : base(account, journalEntry, journalEntry.Description, taxPercentage) { this.StartDate = startDate; this.EndDate = endDate; if (units == null) throw new ApplicationException("The units can not be null"); foreach (IManagementPeriodUnit unit in units) { if (unit.ManagementFee != null) throw new ApplicationException(string.Format("The unit {0} is already used for a management fee transaction.", unit.Key.ToString())); if (!(unit.Success && unit.FeesCalculated == FeesCalculatedStates.Yes)) throw new ApplicationException(string.Format("The unit {0} is not correct for the management fee transaction.", unit.Key.ToString())); } this.Units = units; this.GeneralOpsJournalEntry = journalEntry; createComponents(lookups); }
/// <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 BondCouponPayment(IFundPosition position, ICouponHistory couponHistory, IMemorialBooking journalEntry) : base(position.Account, journalEntry, "") { if (position == null) throw new ApplicationException("The position is mandatory."); if (couponHistory == null) throw new ApplicationException("The coupon history item is mandatory."); if (position.Instrument.SecCategory.Key != SecCategories.Bond) throw new ApplicationException("The Bond is mandatory."); this.Position = position; this.CouponHistory = couponHistory; this.Description = couponHistory.Description; this.Status = BondCouponPaymentStati.Active; // Only print the nota after the Booking Settles this.IsNotarizable = false; IBondCouponPaymentComponent newComponent = new BondCouponPaymentComponent(this, BookingComponentTypes.AccruedInterest, this.CreationDate); this.Components.Add(newComponent); }
protected IGeneralOperationsBooking storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry, IGeneralOperationsBooking stornoBooking) { if (employee == null) throw new ApplicationException( "Creating a Storno is not possible if employee not specified."); if (employee != null) employee.VerifyStornoLimit(this.Components.TotalBaseAmount.Abs(), true); stornoBooking.Account = Account; stornoBooking.GeneralOpsJournalEntry = journalEntry; stornoBooking.Description = Description; stornoBooking.TaxPercentage = TaxPercentage; stornoBooking.IsStorno = true; stornoBooking.StornoReason = reason; stornoBooking.OriginalBooking = this; stornoBooking.CreationDate = DateTime.Now; foreach (IGeneralOperationsComponent comp in this.Components) { IGeneralOperationsComponent newComp = comp.CloneAndStorno(stornoBooking); newComp.MainLine = newComp.JournalLines.Where(x => x.GiroAccount != null).FirstOrDefault(); stornoBooking.Components.Add(newComp); newComp.ParentBooking = stornoBooking; } this.StornoBooking = stornoBooking; return StornoBooking; }
public abstract IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry);
public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry) { CashDividend newStorno = new CashDividend(); newStorno.DividendDetails = this.DividendDetails; newStorno.UnitsInPossession = this.UnitsInPossession; return this.storno(employee, reason, journalEntry, newStorno); }
public override IGeneralOperationsBooking Storno(B4F.TotalGiro.Stichting.Login.IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry) { ForeignExchange newStorno = new ForeignExchange(); return this.storno(employee, reason, journalEntry, newStorno); ; }
private static void doBook(IDalSession session, IMemorialBooking memorialBooking) { if (memorialBooking.Status == JournalEntryStati.Booked) throw new ApplicationException("This Memorial Booking has been already booked."); if (memorialBooking.Balance.IsNotZero) throw new ApplicationException( string.Format("Cannot book Memorial Booking because its Total Balance is not zero ({0:#,##0.00}).", memorialBooking.Balance)); foreach (IJournalEntryLine line in memorialBooking.Lines) if (line.Status == JournalEntryLineStati.New) { if (line.GLAccount == null) throw new ApplicationException(string.Format("Memorial Booking Line number {0} does not have a GL Account.", line.LineNumber)); if (!line.IsStorno) { if (line.GLAccount.RequiresGiroAccount && line.GiroAccount == null) throw new ApplicationException( string.Format("Memorial Booking Line number {0} is required by its GL Account ('{1}') to have a non-empty Giro Account.", line.LineNumber, line.GLAccount.FullDescription)); else if (!line.GLAccount.RequiresGiroAccount && line.GiroAccount != null) throw new ApplicationException( string.Format("Memorial Booking Line number {0} is prohibited by its GL Account ('{1}') to have a Giro Account.", line.LineNumber, line.GLAccount.FullDescription)); } } JournalEntryLinesAdapter.BookJournalEntry(session, memorialBooking); }
public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry) { if (Status != BondCouponPaymentStati.Settled) throw new ApplicationException("It is not possible to storno a bond interest payements that has not a status of paid."); if (Position.BondCouponPayments.Where(x => x.CouponHistory.StartAccrualDate > this.CouponHistory.EndAccrualDate && ((x.Status == BondCouponPaymentStati.Settled && !(x.StornoBooking != null || x.IsStorno)) || x.Status == BondCouponPaymentStati.Active)).Count() > 0) throw new ApplicationException(string.Format("Bond interest payements exists after {0} that should be stornoed first.", CouponHistory.EndAccrualDate.ToShortDateString())); BondCouponPayment newStorno = new BondCouponPayment(); newStorno.Position = this.Position; newStorno.CouponHistory = this.CouponHistory; newStorno.Status = this.Status; newStorno.IsNotarizable = this.IsNotarizable; DateTime newLastDate = CouponHistory.StartAccrualDate.AddDays(-1); if (newLastDate < Position.OpenDate) newLastDate = Position.OpenDate; Position.LastBondCouponCalcDate = newLastDate; return this.storno(employee, reason, journalEntry, newStorno); }
public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry) { CashTransfer newStorno = new CashTransfer(); return this.storno(employee, reason, journalEntry, newStorno); }
public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry) { ManagementFee newStorno = new ManagementFee(); newStorno.StartDate = this.StartDate; newStorno.EndDate = this.EndDate; newStorno.Units = this.Units; IManagementFee stornoBooking = (IManagementFee)this.storno(employee, reason, journalEntry, newStorno); stornoBooking.BookLines(); return stornoBooking; }