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(); }