Esempio n. 1
0
        private void WriteLoanStatusHTML(int loanID, DateTime dtAsOf, System.IO.StreamWriter sw, List <double> totals, string rowIDName)
        {
            clsEntity titleHolder;
            clsEntity coBorrower;
            clsEntity titleCompany;
            int       totalsIndex = 0;
            double    value;

            clsLoan loan = new clsLoan(loanID).LoanAsOf(dtAsOf);

            titleHolder  = new clsEntity(loan.TitleHolderID());
            titleCompany = new clsEntity(loan.TitleCompanyID());
            coBorrower   = new clsEntity(loan.CoBorrowerID());
            clsLoan.State eStatus = loan.Status();

            sw.WriteLine("<tr ID=" + rowIDName + ">");

            sw.Write("<td align=\"left\">" + loan.Property().Address() + "</td>");
            if (eStatus.ToString().Length > 10)
            {
                sw.Write("<td align=\"left\">" + eStatus.ToString().ToUpper().Substring(0, 10) + "</td>");
            }
            else
            {
                sw.Write("<td align=\"left\">" + eStatus.ToString().ToUpper() + "</td>");
            }

            if (eStatus == clsLoan.State.Cancelled)
            {
                for (int i = 0; i < 16; i++)
                {
                    sw.Write("<td></td>");
                    totalsIndex++;
                }
            }
            else
            {
                if (loan.Status() == clsLoan.State.Sold)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        sw.Write("<td></td>");
                        totalsIndex++;
                    }
                    if (loan.AccruedAdditionalInterest(dtAsOf) > 0D)
                    {
                        value = loan.AccruedAdditionalInterest(dtAsOf);
                        totals[totalsIndex] += value;
                        sw.Write("<td align=\"right\">" + value + "</td>");
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        sw.Write("<td></td>");
                        totalsIndex++;
                    }
                    value = loan.PrincipalPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.InterestPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.PointsPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.AdditionalInterestPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.Return(false);
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.IRR(false);
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                }
                else if (loan.Status() == clsLoan.State.PartiallySold)
                {
                    value = loan.Balance(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.AccruedInterest(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.ProjectedHardInterest();
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.AccruedAdditionalInterest(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value + "</td>");
                    value = loan.Return(false);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    value = loan.IRR(false);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    value = loan.PrincipalPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.InterestPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.PointsPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.AdditionalInterestPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.Return(false);
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    value = loan.IRR(false);
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                }
                else
                {
                    value = loan.Balance(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.AccruedInterest(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.ProjectedHardInterest();
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.ProjectedAdditionalInterest(dtAsOf);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    value = loan.Return(false);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    value = loan.IRR(false);
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    sw.Write("<td align=\"right\">" + value.ToString("#0.00%") + "</td>");
                    for (int i = 0; i < 2; i++)
                    {
                        sw.Write("<td></td>");
                        totalsIndex++;
                    }
                    value = loan.PointsPaid(dtAsOf);
                    sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                    totals[totalsIndex] += value;
                    totalsIndex++;
                    for (int i = 0; i < 3; i++)
                    {
                        sw.Write("<td></td>");
                        totalsIndex++;
                    }
                }
                value = loan.RehabRemain(dtAsOf);
                totals[totalsIndex] += value;
                totalsIndex++;
                sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                value = loan.RehabSpent(dtAsOf);
                totals[totalsIndex] += value;
                totalsIndex++;
                sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>");
                sw.Write("<td align=\"right\">" + loan.SaleDate().ToShortDateString() + "</td>");
                sw.Write("<td align=\"right\">" + loan.OriginationDate().ToShortDateString() + "</td>");
                sw.Write("<td align=\"right\">" + (loan.SaleDate() - loan.OriginationDate()).TotalDays.ToString() + "</td>");
            }

            sw.Write("<td>" + titleHolder.Name() + "</td>");
            sw.Write("<td>" + coBorrower.Name() + "</td>");
            sw.Write("<td>" + titleCompany.Name() + "</td>");
            sw.Write("<td>" + loan.Rate().ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.PenaltyRate().ToString("#0.00%") + "</td>");
            sw.Write("<td>" + (loan.Points() * 0.01).ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.ProfitSplit().ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.OriginationDate().ToShortDateString() + "</td>");
            sw.Write("<td>" + loan.MaturityDate().ToShortDateString() + "</td>");
            sw.Write("<td>" + loan.GrossReturn(false).ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.GrossReturn(true).ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.Return(true).ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.IRR(true).ToString("#0.00%") + "</td>");
            sw.Write("<td>" + loan.FirstRehabEstimate().ToString("#,##0.00") + "</td>");
            sw.WriteLine();

            sw.WriteLine("</tr>");
            sw.Flush();
        }
        partial void PropertyChosen(AppKit.NSComboBox sender)
        {
            if (this.AddressComboBox.StringValue != "")
            {
                this.loanToUpdate = new clsLoan(clsLoan.LoanID(this.AddressComboBox.StringValue));
                DateTime OGDate = loanToUpdate.OriginationDate();
                this.ClosingDatePicker.DateValue = (NSDate)DateTime.SpecifyKind(OGDate, DateTimeKind.Utc);
                foreach (clsCashflow cf in this.loanToUpdate.Cashflows())
                {
                    if (cf.DeleteDate() > System.DateTime.Today.AddYears(100))
                    {
                        string amount = (Math.Abs(cf.Amount())).ToString("#,##0.00");
                        switch (cf.TypeID())
                        {
                        case clsCashflow.Type.AcquisitionConcession:
                            this.ConcessionLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionPrice:
                            this.PriceLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionProcessing:
                            this.ProcessingLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionRecording:
                            this.RecordingLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionTaxes:
                            this.AcqTaxLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.TitlePolicy:
                            this.TitlePolicyLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.HomeownersInsurance:
                            this.HOILabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.InitialExpenseDraw:
                            this.InitialDrawLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.PropertyTax:
                            this.PropertyTaxLabel.StringValue = amount;
                            break;

                        default:
                            break;
                        }
                    }
                }
                this.HOIField.StringValue         = this.HOILabel.StringValue;
                this.PriceField.StringValue       = this.PriceLabel.StringValue;
                this.AcqTaxField.StringValue      = this.AcqTaxLabel.StringValue;
                this.RecordingField.StringValue   = this.RecordingLabel.StringValue;
                this.ConcessionField.StringValue  = this.ConcessionLabel.StringValue;
                this.ProcessingField.StringValue  = this.ProcessingLabel.StringValue;
                this.ClosingDatePicker.DateValue  = (NSDate)DateTime.SpecifyKind(this.loanToUpdate.OriginationDate(), DateTimeKind.Utc);
                this.InitialDrawField.StringValue = this.InitialDrawLabel.StringValue;
                this.PropertyTaxField.StringValue = this.PropertyTaxLabel.StringValue;
                this.TitlePolicyField.StringValue = this.TitlePolicyLabel.StringValue;
            }
        }
Esempio n. 3
0
        private void WriteLoan(int loanID, DateTime dtAsOf, System.IO.StreamWriter sw)
        {
            clsEntity titleHolder;
            clsEntity coBorrower;
            clsEntity titleCompany;

            clsLoan loan = new clsLoan(loanID).LoanAsOf(dtAsOf);

            titleHolder  = new clsEntity(loan.TitleHolderID());
            titleCompany = new clsEntity(loan.TitleCompanyID());
            coBorrower   = new clsEntity(loan.CoBorrowerID());
            clsLoan.State eStatus = loan.Status();

            sw.Write(loan.Property().Address() + ",");
            sw.Write(eStatus.ToString().ToUpper() + ",");

            if (eStatus == clsLoan.State.Cancelled)
            {
                sw.Write(",,,,,,,,,,,,,,,,");
            }
            else
            {
                if (loan.Status() == clsLoan.State.Sold)
                {
                    sw.Write(",,,");
                    if (loan.AccruedAdditionalInterest(dtAsOf) > 0D)
                    {
                        sw.Write(loan.AccruedAdditionalInterest(dtAsOf));
                    }
                    sw.Write(",,,");
                    sw.Write(loan.PrincipalPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.InterestPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.AdditionalInterestPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.Return(false).ToString() + ",");
                    sw.Write(loan.IRR(false).ToString() + ",");
                }
                else if (loan.Status() == clsLoan.State.PartiallySold)
                {
                    sw.Write(loan.Balance(dtAsOf).ToString() + ",");
                    sw.Write(loan.AccruedInterest(dtAsOf).ToString() + ",");
                    sw.Write(loan.ProjectedHardInterest().ToString() + ",");
                    if (loan.AccruedAdditionalInterest(dtAsOf) > 0D)
                    {
                        sw.Write(loan.AccruedAdditionalInterest(dtAsOf));
                    }
                    sw.Write(",");
                    sw.Write(loan.Return(false).ToString() + ",");
                    sw.Write(loan.IRR(false).ToString() + ",");
                    sw.Write(loan.PrincipalPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.InterestPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.AdditionalInterestPaid(dtAsOf).ToString() + ",");
                    sw.Write(loan.Return(false).ToString() + ",");
                    sw.Write(loan.IRR(false).ToString() + ",");
                }
                else
                {
                    sw.Write(loan.Balance(dtAsOf).ToString() + ",");
                    sw.Write(loan.AccruedInterest(dtAsOf).ToString() + ",");
                    sw.Write(loan.ProjectedHardInterest().ToString() + ",");
                    sw.Write(loan.ProjectedAdditionalInterest(dtAsOf).ToString() + ",");
                    sw.Write(loan.Return(false).ToString() + ",");
                    sw.Write(loan.IRR(false).ToString() + ",");
                    sw.Write(",,,,,");
                }
                sw.Write(loan.RehabRemain(dtAsOf).ToString() + ",");
                sw.Write(loan.RehabSpent(dtAsOf).ToString() + ",");
                sw.Write(loan.SaleDate().ToShortDateString() + ",");
                sw.Write(loan.OriginationDate().ToShortDateString() + ",");
                sw.Write((loan.SaleDate() - loan.OriginationDate()).TotalDays.ToString() + ",");
            }

            sw.Write(titleHolder.Name() + ",");
            sw.Write(coBorrower.Name() + ",");
            sw.Write(titleCompany.Name() + ",");
            sw.Write(loan.Rate().ToString() + ",");
            sw.Write(loan.PenaltyRate().ToString() + ",");
            sw.Write(loan.OriginationDate().ToShortDateString() + ",");
            sw.Write(loan.MaturityDate().ToShortDateString() + ",");
            sw.Write(loan.GrossReturn(false).ToString() + ",");
            sw.Write(loan.GrossReturn(true).ToString() + ",");
            sw.Write(loan.Return(true).ToString() + ",");
            sw.Write(loan.IRR(true).ToString() + ",");
            sw.Write(loan.FirstRehabEstimate().ToString() + ",");

            sw.WriteLine();
            sw.Flush();
        }
Esempio n. 4
0
        partial void PropertyChosen(AppKit.NSComboBox sender)
        {
            if (this.AddressComboBox.StringValue != "")
            {
                this.loanToUpdate = new clsLoan(clsLoan.LoanID(this.AddressComboBox.StringValue));
                DateTime OGDate = loanToUpdate.OriginationDate();
                this.ClosingDatePicker.DateValue = (NSDate)OGDate.ToUniversalTime();

                //clear labels
                this.ConcessionLabel.StringValue  = "";
                this.HOILabel.StringValue         = "";
                this.PriceLabel.StringValue       = "";
                this.AcqTaxLabel.StringValue      = "";
                this.RecordingLabel.StringValue   = "";
                this.ProcessingLabel.StringValue  = "";
                this.ClosingDateLabel.StringValue = "";
                this.InitialDrawLabel.StringValue = "";
                this.PropertyTaxLabel.StringValue = "";
                this.TitlePolicyLabel.StringValue = "";
                this.PointsLabel.StringValue      = "";

                //reload labels
                foreach (clsCashflow cf in this.loanToUpdate.Cashflows())
                {
                    if (cf.DeleteDate() > System.DateTime.Today.AddYears(100))
                    {
                        string amount = (Math.Abs(cf.Amount())).ToString("#,##0.00");
                        switch (cf.TypeID())
                        {
                        case clsCashflow.Type.AcquisitionConcession:
                            this.ConcessionLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionPrice:
                            this.PriceLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionProcessing:
                            this.ProcessingLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionRecording:
                            this.RecordingLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.AcquisitionTaxes:
                            this.AcqTaxLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.TitlePolicy:
                            this.TitlePolicyLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.HomeownersInsurance:
                            this.HOILabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.InitialExpenseDraw:
                            this.InitialDrawLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.PropertyTax:
//                                amount = (-cf.Amount()).ToString("#,##0.00");
                            this.PropertyTaxLabel.StringValue = amount;
                            break;

                        case clsCashflow.Type.Points:
                            this.PointsLabel.StringValue = amount;
                            break;

                        default:
                            break;
                        }
                    }
                }
                this.HOIField.StringValue         = this.HOILabel.StringValue;
                this.PriceField.StringValue       = this.PriceLabel.StringValue;
                this.AcqTaxField.StringValue      = this.AcqTaxLabel.StringValue;
                this.RecordingField.StringValue   = this.RecordingLabel.StringValue;
                this.ConcessionField.StringValue  = this.ConcessionLabel.StringValue;
                this.ProcessingField.StringValue  = this.ProcessingLabel.StringValue;
                this.ClosingDatePicker.DateValue  = (NSDate)this.loanToUpdate.OriginationDate().ToUniversalTime();
                this.InitialDrawField.StringValue = this.InitialDrawLabel.StringValue;
                this.PropertyTaxField.StringValue = this.PropertyTaxLabel.StringValue;
                this.TitlePolicyField.StringValue = this.TitlePolicyLabel.StringValue;
                clsEntity lender = new clsEntity(this.loanToUpdate.LenderID);
                this.LenderComboBox.Select((NSString)lender.Name());
                clsEntity borrower = new clsEntity(this.loanToUpdate.BorrowerID);
                this.BorrowerComboBox.Select((NSString)borrower.Name());
                this.LenderLabel.StringValue        = (NSString)this.LenderComboBox.SelectedValue;
                this.BorrowerLabel.StringValue      = (NSString)this.BorrowerComboBox.SelectedValue;
                this.UpdatedPointsLabel.StringValue = this.PointsLabel.StringValue;
                this.UpdateTotalCostLabel();
            }
        }