private void WriteLoanAuditHTML(int loanID, DateTime dtStart, DateTime dtEnd, System.IO.StreamWriter sw, List <double> totals, string rowIDName) { clsEntity titleHolder; clsEntity coBorrower; int totalsIndex = 0; double value; clsLoan loanStart = new clsLoan(loanID).LoanAsOf(dtStart); clsLoan loanEnd = new clsLoan(loanID).LoanAsOf(dtEnd); titleHolder = new clsEntity(loanEnd.TitleHolderID()); coBorrower = new clsEntity(loanEnd.CoBorrowerID()); if ((loanEnd.Status() != clsLoan.State.Cancelled) && (loanStart.Status() != clsLoan.State.Sold)) { sw.WriteLine("<tr ID=" + rowIDName + ">"); sw.Write("<td align=\"left\">" + loanEnd.Property().Address() + "</td>"); // write values value = loanStart.Balance(dtStart); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.Balance(dtEnd) - loanStart.Balance(dtStart) + loanEnd.PrincipalPaid(dtEnd); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.PrincipalPaid(dtEnd); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.Balance(dtEnd); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.AccruedInterest(dtEnd); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.InterestPaid(dtEnd); totals[totalsIndex] += value; totalsIndex++; sw.Write("<td align=\"right\">" + value.ToString("#,##0.00") + "</td>"); value = loanEnd.Rate(); sw.Write("<td align=\"right\">" + value.ToString("0.00%") + "</td>"); sw.Write("<td>" + titleHolder.Name() + "</td>"); sw.Write("<td>" + coBorrower.Name() + "</td>"); sw.WriteLine(); sw.WriteLine("</tr>"); sw.Flush(); } }
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(); }
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(); }