Beispiel #1
0
 private void WriteLoanHTML(string address, clsLoan.State status, System.IO.StreamWriter streamWriter, List <clsDocumentRecord> documentRecords, List <clsDocument.Type> docTypes)
 {
     streamWriter.WriteLine("<tr>");
     streamWriter.WriteLine("<td align=\"left\">" + address + "</td>");
     streamWriter.WriteLine("<td align=\"left\">" + status.ToString() + "</td>");
     // loop through document types checking for docstatus given loan status
     foreach (clsDocument.Type t in Enum.GetValues(typeof(clsDocument.Type)))
     {
         string[] docStatus = DocStatus(status, documentRecords, docTypes, t);
         streamWriter.Write("<td id=" + docStatus[0] + ">");
         streamWriter.Write(docStatus[1]);
         streamWriter.WriteLine("</td>");
     }
     streamWriter.WriteLine("</tr>");
     streamWriter.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();
        }
Beispiel #4
0
        private string DocStatus(clsLoan.State loanStatus, List <clsDocumentRecord> documentRecords, List <clsDocument.Type> docTypes)
        {
            clsDocumentRecord.Transmission TAny = clsDocumentRecord.Transmission.Unknown;
            clsDocumentRecord.Status       SAny = clsDocumentRecord.Status.Unkown;
            int  EAny   = -1;
            bool red    = false;
            bool yellow = false;
            bool green  = false;

            // if Pending Acquisition or Later
            if ((loanStatus == clsLoan.State.PendingAcquisition) ||
                (loanStatus == clsLoan.State.Listed) ||
                (loanStatus == clsLoan.State.Rehab) ||
                (loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                if (!DocListContains(documentRecords, docTypes, clsDocument.Type.Calculator, TAny, SAny, EAny, this.lenderID))
                {
                    red = true;
                }
                else if (!DocListContains(documentRecords, docTypes, clsDocument.Type.BPO, TAny, SAny, EAny, this.lenderID))
                {
                    yellow = true;
                }
                else if (!((DocListContains(documentRecords, docTypes, clsDocument.Type.Mortgage, TAny, SAny, this.lenderID, EAny)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.PurchaseStatement, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.EscrowInstructionLetter, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.EscrowInstructionLetter, TAny, clsDocumentRecord.Status.Executed, this.lenderID, EAny)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.ClosingProtectionLetter, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.TitleCommitment, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.TitleWork, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.ProFormaLenderPolicy, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.RehabBid, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.HomeownersInsurance, TAny, SAny, EAny, this.lenderID))))
                {
                    green = true;
                }
            }

            // if Acquired or Later
            if ((loanStatus == clsLoan.State.Listed) ||
                (loanStatus == clsLoan.State.Rehab) ||
                (loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                if (!((DocListContains(documentRecords, docTypes, clsDocument.Type.ProFormaLenderPolicy, TAny, SAny, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.ClosingProtectionLetter, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.EscrowInstructionLetter, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.PurchaseStatement, clsDocumentRecord.Transmission.Electronic, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.Mortgage, clsDocumentRecord.Transmission.Electronic, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.PurchaseStatement, clsDocumentRecord.Transmission.Electronic, clsDocumentRecord.Status.Executed, this.lenderID, EAny)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.Mortgage, clsDocumentRecord.Transmission.Electronic, clsDocumentRecord.Status.Executed, this.lenderID, EAny))))
                {
                    red = true;
                }
                else if (!((DocListContains(documentRecords, docTypes, clsDocument.Type.RehabBid, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.HomeownersInsurance, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.TitleCommitment, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.TitleWork, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.Mortgage, clsDocumentRecord.Transmission.Post, clsDocumentRecord.Status.Executed, EAny, this.lenderID))))
                {
                    yellow = true;
                }
            }

            // if Under Contract to Sell or Sold
            if ((loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                if (!((DocListContains(documentRecords, docTypes, clsDocument.Type.SaleContract, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                      (DocListContains(documentRecords, docTypes, clsDocument.Type.LoanPayoffLetter, TAny, SAny, this.lenderID, EAny))))
                {
                    green = true;
                }
            }

            // if Sold
            if (loanStatus == clsLoan.State.Sold)
            {
                if (!DocListContains(documentRecords, docTypes, clsDocument.Type.SaleContract, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                {
                    red = true;
                }
                else if (!((DocListContains(documentRecords, docTypes, clsDocument.Type.Discharge, clsDocumentRecord.Transmission.Post, clsDocumentRecord.Status.Notarized, this.lenderID, EAny)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.SaleStatement, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.SaleStatement, TAny, clsDocumentRecord.Status.Executed, this.lenderID, EAny)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.ProfitStatement, TAny, SAny, EAny, this.lenderID)) &&
                           (DocListContains(documentRecords, docTypes, clsDocument.Type.ProfitStatement, TAny, SAny, this.lenderID, EAny))
                           ))
                {
                    green = true;
                }
            }

            string docstatus = "COMPLETE";

            if (red)
            {
                docstatus = "MUSTHAVE";
            }
            else if (yellow)
            {
                docstatus = "SHOULDHAVE";
            }
            else if (green)
            {
                docstatus = "TODO";
            }

            return(docstatus);
        }
Beispiel #5
0
        private string[] DocStatus(clsLoan.State loanStatus, List <clsDocumentRecord> documentRecords, List <clsDocument.Type> docTypes, clsDocument.Type docType)
        {
            bool orange = false;
            bool red    = false;
            bool yellow = false;
            bool green  = false;

            clsDocumentRecord.Transmission TAny = clsDocumentRecord.Transmission.Unknown;
            clsDocumentRecord.Status       SAny = clsDocumentRecord.Status.Unkown;
            int    EAny   = -1;
            string reason = " ";

            ///////////////////////////////////////////////////////////////////////////////////
            // Pending Acquisition or Later
            ///////////////////////////////////////////////////////////////////////////////////
            if ((loanStatus == clsLoan.State.PendingAcquisition) ||
                (loanStatus == clsLoan.State.Listed) ||
                (loanStatus == clsLoan.State.Rehab) ||
                (loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                switch (docType)
                {
                //RED
                case clsDocument.Type.Calculator:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                    {
                        red    = true;
                        reason = "!r";
                    }
                    break;

                //YELLOW
                case clsDocument.Type.BPO:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                    {
                        reason = "!r";
                        yellow = true;
                    }
                    break;

                //GREEN
                case clsDocument.Type.TitleCommitment:
                case clsDocument.Type.TitleWork:
                case clsDocument.Type.ProFormaLenderPolicy:
                case clsDocument.Type.RehabBid:
                case clsDocument.Type.HomeownersInsurance:
                case clsDocument.Type.PurchaseStatement:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                    {
                        reason = "!r";
                        green  = true;
                    }
                    break;

                //case clsDocument.Type.Mortgage:
                //if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, this.lenderID, EAny))
                //    green = true;
                //break;
                case clsDocument.Type.ClosingProtectionLetter:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                    {
                        reason = "!R";
                        green  = true;
                    }
                    break;

                case clsDocument.Type.EscrowInstructionLetter:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, this.lenderID, EAny))
                    {
                        reason = "!s";
                        green  = true;
                    }
                    else if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                    {
                        reason = "!R";
                        green  = true;
                    }
                    break;
                }
            }

            ///////////////////////////////////////////////////////////////////////////////////
            // Acquired or Later
            ///////////////////////////////////////////////////////////////////////////////////
            if ((loanStatus == clsLoan.State.Listed) ||
                (loanStatus == clsLoan.State.Rehab) ||
                (loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                switch (docType)
                {
                //RED OR ORANGE
                case clsDocument.Type.ProFormaLenderPolicy:
                case clsDocument.Type.ClosingProtectionLetter:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                    {
                        reason = "!r";
                        red    = true;
                    }
                    break;

                case clsDocument.Type.EscrowInstructionLetter:
                case clsDocument.Type.Mortgage:     // no requirement to send executed mortgage to fund admin
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                    {
                        if (DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Unkown, EAny, this.lenderID))
                        {
                            reason = "U!R";
                            orange = true;
                        }
                        else
                        {
                            reason = "!R";
                            red    = true;
                        }
                    }
                    break;

                case clsDocument.Type.PurchaseStatement:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                    {
                        if (DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Unkown, EAny, this.lenderID))
                        {
                            reason = "U!R";
                            orange = true;
                        }
                        else
                        {
                            reason = "!R";
                            red    = true;
                        }
                    }
                    else if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, this.lenderID, EAny))
                    {
                        if (DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Unkown, this.lenderID, EAny))
                        {
                            reason = "U!S";
                            orange = true;
                        }
                        else
                        {
                            reason = "!S";
                            red    = true;
                        }
                    }
                    break;

                //YELLOW
                case clsDocument.Type.RehabBid:
                case clsDocument.Type.HomeownersInsurance:
                case clsDocument.Type.TitleWork:
                case clsDocument.Type.TitleCommitment:
                    if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                    {
                        reason = "!r";
                        yellow = true;
                    }
                    break;
                }
                if ((!red) && (!orange) && (!yellow) && (docType == clsDocument.Type.Mortgage) &&
                    (!DocListContains(documentRecords, docTypes, docType, clsDocumentRecord.Transmission.Post, clsDocumentRecord.Status.Executed, EAny, this.lenderID)))
                {
                    reason = "!RP";
                    yellow = true;
                }
            }

            ///////////////////////////////////////////////////////////////////////////////////
            // Pending Sale or Sold
            ///////////////////////////////////////////////////////////////////////////////////
            if ((loanStatus == clsLoan.State.PendingSale) ||
                (loanStatus == clsLoan.State.Sold))
            {
                if ((!red) && (!yellow) && (!green))
                {
                    if ((docType == clsDocument.Type.SaleContract) && (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)))
                    {
                        reason = "!R";
                        green  = true;
                    }
                    else if ((docType == clsDocument.Type.LoanPayoffLetter) && (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, this.lenderID, EAny)))
                    {
                        reason = "!s";
                        green  = true;
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////////////////////
            // Sold
            ///////////////////////////////////////////////////////////////////////////////////
            if (loanStatus == clsLoan.State.Sold)
            {
                if (!red)
                {
                    if ((docType == clsDocument.Type.SaleContract) && (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID)))
                    {
                        reason = "!R";
                        yellow = true;
                    }
                    else if ((!yellow) && (!green))
                    {
                        if ((docType == clsDocument.Type.Discharge) &&
                            (!DocListContains(documentRecords, docTypes, docType, clsDocumentRecord.Transmission.Post, clsDocumentRecord.Status.Notarized, this.lenderID, EAny)))
                        {
                            reason = "!SN";
                            green  = true;
                        }
                        else if (docType == clsDocument.Type.SaleStatement)
                        {
                            if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, this.lenderID, EAny))
                            {
                                reason = "!S";
                                green  = true;
                            }
                            else if (!DocListContains(documentRecords, docTypes, docType, TAny, clsDocumentRecord.Status.Executed, EAny, this.lenderID))
                            {
                                reason = "!R";
                                green  = true;
                            }
                        }
                        else if (docType == clsDocument.Type.ProfitStatement)
                        {
                            if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, this.lenderID, EAny))
                            {
                                reason = "!s";
                                green  = true;
                            }
                            else if (!DocListContains(documentRecords, docTypes, docType, TAny, SAny, EAny, this.lenderID))
                            {
                                reason = "!r";
                                green  = true;
                            }
                        }
                    }
                }
            }

            // calculate return value
            string[] docstatus = new string[2];
            if (orange)
            {
                docstatus[0] = "MIGHTHAVE";
            }
            else if (red)
            {
                docstatus[0] = "MUSTHAVE";
            }
            else if (yellow)
            {
                docstatus[0] = "SHOULDHAVE";
            }
            else if (green)
            {
                docstatus[0] = "TODO";
            }
            else
            {
                docstatus[0] = "COMPLETE";
            }
            docstatus[1] = reason;
            return(docstatus);
        }
Beispiel #6
0
 partial void StatusChosen(NSComboBox sender)
 {
     this.statusFilter = (clsLoan.State)((int)this.StatusComboBox.SelectedIndex);
     this.UpdateAddressList();
 }
Beispiel #7
0
        public clsLoan.State Status()
        {
            // takes the current status of a Loan - does not look forward or back
            // Use LoanAsOf.Status() to do that
            // public enum State { Unknown, Cancelled, PendingAcquisition, Rehab, Listed, PendingSale, Sold }

            clsLoan.State s              = clsLoan.State.Unknown;
            bool          bAllExpired    = true;
            bool          bRehabRemains  = false;
            bool          bSaleScheduled = false;

            if (this.cfCashflows.Count != 0)
            {
                foreach (clsCashflow cf in this.cfCashflows)
                {
                    if (cf.Actual())
                    {
                        bAllExpired = false;
                        if ((cf.TypeID() == clsCashflow.Type.AcquisitionPrice) && (s == clsLoan.State.Unknown))
                        {
                            s = clsLoan.State.Rehab;
                        }
                        else if (cf.TypeID() == clsCashflow.Type.Principal)
                        {
                            s = clsLoan.State.Sold;
                        }
                        else if (cf.TypeID() == clsCashflow.Type.InterestHard)
                        {
                            s = clsLoan.State.Sold;
                        }
                        else if (cf.TypeID() == clsCashflow.Type.InterestAdditional)
                        {
                            s = clsLoan.State.Sold;
                        }
                        else if (cf.TypeID() == clsCashflow.Type.NetDispositionProj)
                        {
                            // iff we do a loan as of a future date, after it's projected disposition, and no current sale is scheduled
                            s = clsLoan.State.Sold;
                        }
                    }
                    else if (cf.DeleteDate().Year == DateTime.MaxValue.Year) // not deleted, but not yet actual
                    {
                        bAllExpired = false;
                        if (cf.TypeID() == clsCashflow.Type.RehabDraw)
                        {
                            bRehabRemains = true;
                        }
                        else if (cf.TypeID() == clsCashflow.Type.Principal)
                        {
                            bSaleScheduled = true;
                        }
                    }
                }
                if (bAllExpired)
                {
                    s = clsLoan.State.Cancelled;
                }
                else if (bSaleScheduled)
                {
                    s = clsLoan.State.PendingSale;
                }
                else if ((!bRehabRemains) && (s != clsLoan.State.Sold))
                {
                    s = clsLoan.State.Listed;
                }
                else if (s == clsLoan.State.Unknown)
                {
                    s = clsLoan.State.PendingAcquisition;
                }
                return(s);
            }
            else
            {
                return(clsLoan.State.Cancelled);
            }
        }