private void OnCellEditEnded() { // calculate all columns and identify differences double totalCommitment = 0; CashFlowDetail sums = CashFlowInformation.DetailSummary; DifferenceCapitalCall = Math.Abs(sums.CashFlowAmountCall); DifferenceExpenses = Math.Abs(sums.PartnershipExpenses); DifferenceLookback = Math.Abs(sums.LookbackInterests); DifferenceDistribution = Math.Abs(sums.CashFlowAmountDistribution); DifferenceReturnOfCapital = Math.Abs(sums.ReturnOfCapital); DifferenceCapitalGain = Math.Abs(sums.CapitalGain); DifferenceDividends = Math.Abs(sums.Dividends); DifferenceWithholdingTax = Math.Abs(sums.WithholdingTax); DifferenceRecallable = Math.Abs(sums.RecallableAmount); foreach (CashFlowDetail detail in CashFlowInformation.InvestorDetails) { if (detail.InvestorId != 0 && detail.Investor == null) { detail.Investor = Investors.FirstOrDefault(i => i.Id == detail.InvestorId); if (detail.Investor != null) { detail.Reference = detail.Investor.InvestorReference; investorCommitments = new ObservableCollection <InvestorCommitment>(investorAccess.GetCommitmentsForInvestor(detail.InvestorId)); NewInvestorCommitments = CollectionViewSource.GetDefaultView(investorCommitments); newInvestorId = detail.InvestorId; ShowInvestorCommitments = WindowState.Open; } } DifferenceCapitalCall -= Math.Abs(detail.CashFlowAmountCall); DifferenceExpenses -= Math.Abs(detail.PartnershipExpenses); DifferenceLookback -= Math.Abs(detail.LookbackInterests); totalCommitment += Math.Abs(detail.CommitmentAmount); DifferenceDistribution -= Math.Abs(detail.CashFlowAmountDistribution); DifferenceReturnOfCapital -= Math.Abs(detail.ReturnOfCapital); DifferenceCapitalGain -= Math.Abs(detail.CapitalGain); DifferenceDividends -= Math.Abs(detail.Dividends); DifferenceWithholdingTax -= Math.Abs(detail.WithholdingTax); DifferenceRecallable -= Math.Abs(detail.RecallableAmount); } DifferenceCapitalCall = Math.Round(DifferenceCapitalCall, 2); DifferenceExpenses = Math.Round(DifferenceExpenses, 2); DifferenceLookback = Math.Round(DifferenceLookback, 2); DifferenceDistribution = Math.Round(DifferenceDistribution, 2); DifferenceReturnOfCapital = Math.Round(DifferenceReturnOfCapital, 2); DifferenceCapitalGain = Math.Round(DifferenceCapitalGain, 2); DifferenceDividends = Math.Round(DifferenceDividends, 2); DifferenceWithholdingTax = Math.Round(DifferenceWithholdingTax, 2); DifferenceRecallable = Math.Round(DifferenceRecallable, 2); sums.CommitmentAmount = totalCommitment; FundHeader = $"{CashFlowInformation.Fund.FundShortName} ({CashFlowInformation.DetailSummary.CommitmentAmount:n0})"; if (DifferenceCapitalCall == 0 && DifferenceExpenses == 0 && DifferenceLookback == 0) { CanGotoNextStep = true; } else { CanGotoNextStep = false; } }
private void OnNewInvestorAdded() { CashFlowDetail detail = new CashFlowDetail(); CashFlowInformation.InvestorDetails.Add(detail); SelectedItem = detail; }
private void OnRowValidating(Telerik.Windows.Controls.GridViewRowValidatingEventArgs e) { // check row whether distribution is consistent CashFlowDetail detail = (CashFlowDetail)e.Row.Item; if (detail.CashFlowAmountDistribution == 0) { return; //no checks in case of a capital call } double difference = (detail.CashFlowAmountDistribution - detail.ReturnOfCapital - detail.CapitalGain - detail.Dividends - detail.RecallableAmount - detail.WithholdingTax); if (Math.Round(difference, 2) == 0) { return; } e.ValidationResults.Add(new Telerik.Windows.Controls.GridViewCellValidationResult() { ErrorMessage = $"Die Ausschüttungskomponenten entsprechen nicht dem Ausschüttungsbetrag. Die Differenz beträgt {difference:n2}." }); }
private void ReloadCashFlowInformation() { CashFlowInformation.Fund = PefundAccess.GetPeFundById(CashFlowInformation.Fund.Id); CashFlowInformation.LastUpdated = DateTime.Now.Date; List <InvestorCommitment> ListOfCommitments = PefundAccess.GetCommitmentsForPeFund(CashFlowInformation.Fund.Id); CashFlowDetail totalDetail = CashFlowInformation.DetailSummary; totalDetail.CommitmentAmount = 0; // will be calculated while reading the investorcommitments CashFlowInformation.InvestorDetails = new List <CashFlowDetail>(); if (CashFlowInformation.Fund.BankAccounts.Count == 0) { totalDetail.BankAccount = null; } else { totalDetail.BankAccount = CashFlowInformation.Fund.BankAccounts.ElementAt(0); } foreach (InvestorCommitment commitment in ListOfCommitments) { CashFlowDetail investorDetail = new CashFlowDetail() { Investor = commitment.Investor, Reference = commitment.Investor.InvestorReference, BankAccount = commitment.BankAccount, CommitmentAmount = commitment.CommitmentAmount, InvestorCommitmentId = commitment.Id }; if (!string.IsNullOrEmpty(commitment.PeFundReference)) { investorDetail.Reference = commitment.PeFundReference; } totalDetail.CommitmentAmount += commitment.CommitmentAmount; CashFlowInformation.InvestorDetails.Add(investorDetail); } CashFlowInformation.DetailSummary = totalDetail; }
private void OnAutomaticSplit() { // the total Cash Flow (DetailSummary) will be split according commitments of investors (InvestorDetails) CashFlowDetail sums = CashFlowInformation.DetailSummary; DifferenceCapitalCall = Math.Abs(sums.CashFlowAmountCall); DifferenceExpenses = Math.Abs(sums.PartnershipExpenses); DifferenceLookback = Math.Abs(sums.LookbackInterests); DifferenceDistribution = Math.Abs(sums.CashFlowAmountDistribution); DifferenceReturnOfCapital = Math.Abs(sums.ReturnOfCapital); DifferenceCapitalGain = Math.Abs(sums.CapitalGain); DifferenceDividends = Math.Abs(sums.Dividends); DifferenceWithholdingTax = Math.Abs(sums.WithholdingTax); DifferenceRecallable = Math.Abs(sums.RecallableAmount); foreach (CashFlowDetail detail in CashFlowInformation.InvestorDetails) { detail.CashFlowAmountCall = Math.Round(sums.CashFlowAmountCall / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceCapitalCall -= Math.Abs(detail.CashFlowAmountCall); detail.PartnershipExpenses = Math.Round(sums.PartnershipExpenses / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceExpenses -= Math.Abs(detail.PartnershipExpenses); detail.LookbackInterests = Math.Round(sums.LookbackInterests / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceLookback -= Math.Abs(detail.LookbackInterests); detail.CashFlowAmountDistribution = Math.Round(sums.CashFlowAmountDistribution / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceDistribution -= Math.Abs(detail.CashFlowAmountDistribution); detail.ReturnOfCapital = Math.Round(sums.ReturnOfCapital / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceReturnOfCapital -= Math.Abs(detail.ReturnOfCapital); detail.CapitalGain = Math.Round(sums.CapitalGain / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceCapitalGain -= Math.Abs(detail.CapitalGain); detail.Dividends = Math.Round(sums.Dividends / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceDividends -= Math.Abs(detail.Dividends); detail.WithholdingTax = Math.Round(sums.WithholdingTax / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceWithholdingTax -= Math.Abs(detail.WithholdingTax); detail.RecallableAmount = Math.Round(sums.RecallableAmount / sums.CommitmentAmount * detail.CommitmentAmount, 2); DifferenceRecallable -= Math.Abs(detail.RecallableAmount); // set CashFlowAmount if (detail.CashFlowAmountCall != 0) { detail.CashFlowAmount = detail.CashFlowAmountCall; } else { detail.CashFlowAmount = detail.CashFlowAmountDistribution; } } FundHeader = $"{CashFlowInformation.Fund.FundShortName} ({CashFlowInformation.DetailSummary.CommitmentAmount:n0})"; // Rounding Differences are allocated to the first investor CashFlowInformation.InvestorDetails[0].CashFlowAmountCall += DifferenceCapitalCall; CashFlowInformation.InvestorDetails[0].LookbackInterests += DifferenceLookback; CashFlowInformation.InvestorDetails[0].PartnershipExpenses += DifferenceExpenses; CashFlowInformation.InvestorDetails[0].CashFlowAmountDistribution += DifferenceDistribution; CashFlowInformation.InvestorDetails[0].ReturnOfCapital += DifferenceReturnOfCapital; CashFlowInformation.InvestorDetails[0].CapitalGain += DifferenceCapitalGain; CashFlowInformation.InvestorDetails[0].Dividends += DifferenceDividends; CashFlowInformation.InvestorDetails[0].WithholdingTax += DifferenceWithholdingTax; CashFlowInformation.InvestorDetails[0].RecallableAmount += DifferenceRecallable; DifferenceExpenses = 0; DifferenceLookback = 0; DifferenceCapitalCall = 0; DifferenceDistribution = 0; DifferenceReturnOfCapital = 0; DifferenceCapitalGain = 0; DifferenceDividends = 0; DifferenceWithholdingTax = 0; DifferenceRecallable = 0; CanGotoNextStep = true; if (sums.CashFlowAmountCall == 0) { IsCapitalCall = false; } else { IsCapitalCall = true; } if (sums.CashFlowAmountDistribution == 0) { IsDistribution = false; } else { IsDistribution = true; } }
private void CreateCashFlowInformation(CashFlowInformation info) { info.Fund = Fund; info.LastUpdated = DateTime.Now.Date; if (info.EffectiveDate == DateTime.MinValue) { info.EffectiveDate = DateTime.Now.Date; } List <InvestorCommitment> ListOfCommitments = PefundAccess.GetCommitmentsForPeFund(Fund.Id); CashFlowDetail totalDetail = new CashFlowDetail() { Investor = null }; if (Fund.BankAccounts.Count == 0) { totalDetail.BankAccount = null; } else { totalDetail.BankAccount = Fund.BankAccounts.ElementAt(0); } info.InvestorDetails = new List <CashFlowDetail>(); foreach (InvestorCommitment commitment in ListOfCommitments) { PeFundResults results = new PeFundResults(commitment, DateTime.MinValue, DateTime.Now); CashFlowDetail investorDetail = new CashFlowDetail() { Investor = commitment.Investor, Reference = commitment.Investor.InvestorReference, BankAccount = commitment.BankAccount, CommitmentAmount = commitment.CommitmentAmount, OpenCommitment = results.OpenCommitment, TotalCalls = results.AmountCalled, TotalDistributions = results.AmountDistributed, InvestorCommitmentId = commitment.Id }; if (!string.IsNullOrEmpty(commitment.PeFundReference)) { investorDetail.Reference = commitment.PeFundReference; } totalDetail.CommitmentAmount += commitment.CommitmentAmount; info.InvestorDetails.Add(investorDetail); } info.DetailSummary = totalDetail; WriteInformationToTextFile(); SetProgressStatus(); if (info.OtherWorkDone) { return; //CashFlow has been processed; no further action required } if (info.LettersPrinted) { // start OtherWork return; } if (info.InvestorDetailsEntered) { // start Print Letters return; } if (info.CashFlowDataEntered) { // start Enter CashFlowData for investors NavigationParameters parameter = new NavigationParameters(); parameter.Add("Info", info); regionManager.RequestNavigate(RegionNames.CashFlowRegion, ViewNames.EditInvestorSplit, parameter); return; } if (info.InvestorsChecked) { // start Enter CashFlowData NavigationParameters parameter = new NavigationParameters(); parameter.Add("Info", info); regionManager.RequestNavigate(RegionNames.CashFlowRegion, ViewNames.EditCashFlowData, parameter); return; } }