Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // load Loans By Address
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                clsLoan l = new clsLoan(i);
                loansByAddress.Add(l.Property().Address(), l);
            }

            // Do any additional setup after loading the view.
            this.UpdateAddressList();
            this.SaleDatePicker.DateValue = (NSDate)System.DateTime.Today.Date;
            this.ChooseActionPopUp.RemoveAllItems();
            this.RecordDatePicker.DateValue = (NSDate)System.DateTime.Today.Date;
            this.LenderComboBox.RemoveAll();
            clsCSVTable tblEntities = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < tblEntities.Length(); i++)
            {
                if (tbl.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.LenderComboBox.Add((NSString)(new clsEntity(i)).Name());
                }
            }
            this.StatusComboBox.RemoveAll();
            foreach (clsLoan.State c in Enum.GetValues(typeof(clsLoan.State)))
            {
                this.StatusComboBox.Add((NSString)c.ToString());
            }
        }
        private void RunAnnualLoanAuditReport(DateTime dtStart, DateTime dtEnd)
        {
            // create report file
            string fileName = "/Volumes/GoogleDrive/Shared Drives/Resilience/Reports/LoanAudit";

            fileName += dtEnd.ToString("yyyyMMdd");
            fileName += "." + this.LenderPopUpButton.TitleOfSelectedItem;
            fileName += ".txt";
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName);

            // write header
            sw.WriteLine("Property,Begin Balance,Additions,Repayments,End Balance,Accrued Interest,Interest Paid");

            // loop through loans
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                if (this.lenderLoanIDs.Contains(i))
                {
                    this.WriteLoanAudit(i, dtStart, dtEnd, sw);
                }
            }
            sw.Close();
        }
        private void RunLoanStatusReport(DateTime dtReport)
        {
            // create report file
            string fileName = "/Volumes/GoogleDrive/Shared Drives/Resilience/Reports/LoanStatus";

            fileName += dtReport.ToString("yyyyMMdd");
            fileName += "." + this.LenderPopUpButton.TitleOfSelectedItem;
            fileName += ".txt";
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName);

            // write header
            sw.WriteLine("Property,State,Principal Balance,Accrued Interest,Proj Hard Int,Proj Additional Int,Proj Return,Proj IRR,Principal  Paid,Interest  Paid,Addl Int  Paid,Act Return,Act IRR,Rehab Remain,Rehab  Spent,Sale Date,Purchase Date,Days");

            // loop through loans
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                if (this.lenderLoanIDs.Contains(i))
                {
                    this.WriteLoan(i, dtReport, sw);
                }
            }
            sw.Close();
        }
        private void RedrawTable()
        {
            clsCSVTable tbl      = new clsCSVTable(clsCashflow.strCashflowPath);
            string      selected = this.TypePopUpButton.TitleOfSelectedItem;

            this.typeChosen = clsCashflow.Type.Unknown;
            foreach (clsCashflow.Type t in Enum.GetValues(typeof(clsCashflow.Type)))
            {
                if (t.ToString() == selected)
                {
                    this.typeChosen = t;
                }
            }
            List <int> IDs = tbl.Matches(clsCashflow.TransactionTypeColumn, ((int)this.typeChosen).ToString());

            this.dataSource.Cashflows.Clear();
            foreach (int id in IDs)
            {
                clsCashflow newCf = new clsCashflow(id);
                if (((this.showExpired) || (newCf.DeleteDate() > System.DateTime.Today.AddYears(50))) && (newCf.LoanID() == -this.entityID))
                {
                    this.dataSource.Cashflows.Add(newCf);
                }
            }
            this.CashflowsTableView.ReloadData();
        }
        private void RunLoanAuditReportHTML(DateTime dtStart, DateTime dtEnd)
        {
            // create report file
            List <double> totals = new List <double>();

            for (int i = 0; i < 7; i++)
            {
                totals.Add(0D);
            }
            string fileName = "/Volumes/GoogleDrive/Shared Drives/Resilience/Reports/LoanAudit";

            fileName += dtEnd.ToString("yyyyMMdd");
            fileName += "." + this.LenderPopUpButton.TitleOfSelectedItem;
            fileName += ".htm";
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName);

            // write beginning tags and header
            sw.WriteLine("<!DOCTYPE html><html>");
            sw.WriteLine("<head>");
            sw.WriteLine("<style>");
            sw.WriteLine("th {text-decoration:underline;}");
            sw.WriteLine("tr {background-color:WhiteSmoke;}");
            sw.WriteLine("tr#ROW2 {background-color:LightGray;}");
            sw.WriteLine("tr#HEADER {background-color:White;}");
            sw.WriteLine("</style>");
            sw.WriteLine("</head>");

            // html body
            sw.WriteLine("<body>");
            sw.WriteLine("<h1>Loan Audit Report for the Year Ending " + dtEnd.ToString("MM/dd/yyyy") + "</h1>");
            sw.WriteLine("<table style=\"width:auto\">");
            WriteHTMLHeaderRowAudit(sw);

            // loop through loans
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                if (this.lenderLoanIDs.Contains(i))
                {
                    string rowID = "";
                    if ((i % 3) == 2)
                    {
                        rowID = "ROW2";
                    }
                    this.WriteLoanAuditHTML(i, dtStart, dtEnd, sw, totals, rowID);
                }
            }

            // end of doc tags
            sw.WriteLine("<tr><td>TOTALS</td></tr>");
            sw.Write("<tr text-decoration:underline><td></td>");
            foreach (double d in totals)
            {
                sw.Write("<td align=\"right\"><b><u>" + d.ToString("#,##0.00") + "</u></b></td>");
            }
            sw.WriteLine("</tr></table></html></body>");
            sw.Close();
        }
Beispiel #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            List <string> addressList = clsProperty.AddressList();

            this.AddressComboBox.RemoveAll();
            foreach (string address in addressList)
            {
                this.AddressComboBox.Add((NSString)address);
            }

            this.HOILabel.StringValue         = "0";
            this.PriceLabel.StringValue       = "0";
            this.AcqTaxLabel.StringValue      = "0";
            this.RecordingLabel.StringValue   = "0";
            this.ConcessionLabel.StringValue  = "0";
            this.ProcessingLabel.StringValue  = "0";
            this.ClosingDateLabel.StringValue = "--/--/--";
            this.InitialDrawLabel.StringValue = "0";
            this.PropertyTaxLabel.StringValue = "0";
            this.TitlePolicyLabel.StringValue = "0";
            this.LenderLabel.StringValue      = "---";
            this.BorrowerLabel.StringValue    = "---";
            this.PointsLabel.StringValue      = "0";

            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)System.DateTime.Today;
            this.InitialDrawField.StringValue   = this.InitialDrawLabel.StringValue;
            this.PropertyTaxField.StringValue   = this.PropertyTaxLabel.StringValue;
            this.TitlePolicyField.StringValue   = this.TitlePolicyLabel.StringValue;
            this.UpdatedPointsLabel.StringValue = this.PointsLabel.StringValue;

            clsCSVTable tblEntity = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < tblEntity.Length(); i++)
            {
                if ((clsEntity.Type)Int32.Parse(tblEntity.Value(i, clsEntity.EntityTypeColumn)) == clsEntity.Type.Lender)
                {
                    this.LenderComboBox.Add((NSString)tblEntity.Value(i, clsEntity.NameColumn));
                }
                else if ((clsEntity.Type)Int32.Parse(tblEntity.Value(i, clsEntity.EntityTypeColumn)) == clsEntity.Type.Borrower)
                {
                    this.BorrowerComboBox.Add((NSString)tblEntity.Value(i, clsEntity.NameColumn));
                }
            }
        }
Beispiel #7
0
        public CashflowTableDataSource()
        {
            this.data            = new List <clsCashflow>();
            this.balance         = new List <double>();
            this.startingBalance = 0D;
            this.addresses       = new List <string>();
            clsCSVTable loanTable = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < loanTable.Length(); i++)
            {
                this.addresses.Add((new clsLoan(i)).Property().Address());
            }
        }
Beispiel #8
0
        private void _TestLoan()
        {
            System.IO.StreamWriter sr = new System.IO.StreamWriter("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/DebugLog.txt");
            //write header
            sr.WriteLine("Property,State,Principal Balance,Accrued Interest,Proj Hard Int,Proj Additional Int,Proj Return,Proj IRR,Principal  Paid,Interest  Paid,Addl Int  Paid,Act Return,Act IRR,Rehab Remain,Rehab  Spent,Sale Date,Purchase Date,Days");
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                this._WriteLoan(sr, i);
            }
            sr.Close();
        }
Beispiel #9
0
        private void ReloadCashflows()
        {
            clsCSVTable cfTable = new clsCSVTable(clsCashflow.strCashflowPath);

            this.activeCashflows.Clear();
            for (int i = 0; i < cfTable.Length(); i++)
            {
                if (DateTime.Parse(cfTable.Value(i, clsCashflow.DeleteDateColumn)) > System.DateTime.Today.AddYears(50))
                {
                    this.activeCashflows.Add(new clsCashflow(i));
                }
            }
            this.RefreshTable();
        }
Beispiel #10
0
        private void _TestEntity()
        {
            for (int i = 0; i < 3; i++)
            {
                clsEntity entity = new clsEntity(i);
                Console.WriteLine(entity.Name() + "," + entity.Address() + "," + entity.Phone());
            }

            clsCSVTable testTable = new clsCSVTable(clsEntity.strEntityPath);

            testTable.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblEntityTest.csv");
            clsEntity newEntity = new clsEntity("test entity", "42 wallaby way", "sydney", "AU", 33000, "312-fnd-nemo", "marlin", "*****@*****.**");

            Console.WriteLine(newEntity.Save("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblEntityTest.csv"));
        }
Beispiel #11
0
        private void _TestDocument()
        {
            for (int i = 0; i < 25; i++)
            {
                clsDocument document = new clsDocument(i);
                Console.WriteLine(document.Name() + "," + document.PropertyAddress() + "," + document.DocumentType().ToString() + "," +
                                  ((int)document.DocumentType()).ToString());
            }
            clsCSVTable testTable = new clsCSVTable(clsDocument.strDocumentPath);

            testTable.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblDocumentTest.csv");

            clsDocument newDoc = new clsDocument("test", 1, clsDocument.Type.ClosingProtectionLetter);

            Console.WriteLine(newDoc.Save("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblDocumentTest.csv"));
        }
Beispiel #12
0
        private void _TestDocumentRecord()
        {
            for (int i = 0; i < 25; i++)
            {
                clsDocumentRecord docRec = new clsDocumentRecord(i);
                Console.WriteLine(docRec.StatusType().ToString() + "," + docRec.TransmissionType().ToString() + "," +
                                  docRec.DocumentID().ToString() + "," + docRec.ReceiverID().ToString());
            }

            clsCSVTable testTable = new clsCSVTable(clsDocumentRecord.strDocumentRecordPath);

            testTable.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblDocumentRecordTest.csv");
            clsDocumentRecord newRec = new clsDocumentRecord(1, System.DateTime.Now, System.DateTime.Today, 1, 2,
                                                             clsDocumentRecord.Status.Notarized,
                                                             clsDocumentRecord.Transmission.Electronic);

            Console.WriteLine(newRec.Save("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblDocumentRecordTest.csv"));
        }
Beispiel #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            clsCSVTable EntityTable = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < EntityTable.Length(); i++)
            {
                this.TitleHolderPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                this.CoBorrowerPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                this.TitlePopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                this.LenderPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
            }
            this.PurchaseDatePicker.DateValue = (NSDate)System.DateTime.Today.AddMonths(1);
            this.TitleHolderPopUp.SelectItem(6);
            this.CoBorrowerPopUp.SelectItem(5);
            this.LenderPopUp.SelectItem(4);
        }
        partial void LenderChosen(NSPopUpButton sender)
        {
            this.lenderLoanIDs.Clear();
            clsCSVTable tblLoans = new clsCSVTable(clsLoan.strLoanPath);

            if (this.LenderPopUpButton.IndexOfSelectedItem > 0)
            {
                this.lenderID      = this.lenderIndexToID[(int)this.LenderPopUpButton.IndexOfSelectedItem - 1];
                this.lenderLoanIDs = tblLoans.Matches(clsLoan.LenderColumn, this.lenderID.ToString());
            }
            else
            {
                this.lenderID = -1;
                for (int i = 0; i < tblLoans.Length(); i++)
                {
                    this.lenderLoanIDs.Add(i);
                }
            }
        }
Beispiel #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            this.PropertyChooser.DataSource = new ComboBoxStringListDataSource(clsProperty.AddressList());

            DocumentChooser.RemoveAll();
            foreach (clsDocument.Type t in Enum.GetValues(typeof(clsDocument.Type)))
            {
                DocumentChooser.Add((NSString)t.ToString());
            }

            this.entityList = new List <clsEntity>();
            SenderChooser.RemoveAll();
            ReceiverChooser.RemoveAll();
            clsCSVTable tblEntities = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < tblEntities.Length(); i++)
            {
                SenderChooser.Add((NSString)tblEntities.Value(i, clsEntity.NameColumn));
                ReceiverChooser.Add((NSString)tblEntities.Value(i, clsEntity.NameColumn));
                this.entityList.Add(new clsEntity(i));
            }

            foreach (clsDocumentRecord.Status s in Enum.GetValues(typeof(clsDocumentRecord.Status)))
            {
                StatusChooser.Add((NSString)s.ToString());
            }

            foreach (clsDocumentRecord.Transmission t in Enum.GetValues(typeof(clsDocumentRecord.Transmission)))
            {
                TransmitChooser.Add((NSString)t.ToString());
            }

            ActionDateChooser.DateValue = (NSDate)System.DateTime.Today;
            RecordDateChooser.DateValue = (NSDate)System.DateTime.Now;

            this.loanList = clsLoan.LoanIDsByAddress();

            ChosenDocumentLabel.StringValue = "";
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            this.ReportDatePicker.DateValue  = (NSDate)System.DateTime.Today.Date.ToUniversalTime();
            this.ReportDatePicker2.DateValue = (NSDate)System.DateTime.Today.Date.AddDays(91).ToUniversalTime();

            clsCSVTable tblLenders = new clsCSVTable(clsEntity.strEntityPath);
            clsCSVTable tblLoans   = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tblLenders.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.LenderPopUpButton.AddItem(tblLenders.Value(i, clsEntity.NameColumn));
                    this.lenderIndexToID.Add(i);
                }
            }
        }
        partial void BorrowerSelected(NSPopUpButton sender)
        {
            this.borrowerLoanIDs.Clear();
            clsCSVTable tblLoans = new clsCSVTable(clsLoan.strLoanPath);

            if (this.BorrowerPopUp.IndexOfSelectedItem > 0)
            {
                this.borrowerID      = this.borrowerIndexToID[(int)this.BorrowerPopUp.IndexOfSelectedItem - 1];
                this.borrowerLoanIDs = tblLoans.Matches(clsLoan.TitleHolderColumn, this.borrowerID.ToString());
            }
            else
            {
                this.borrowerID = -1;
                for (int i = 0; i < tblLoans.Length(); i++)
                {
                    this.borrowerLoanIDs.Add(i);
                }
            }
            this.RefreshTable();
        }
Beispiel #18
0
        private void _TestCashflow()
        {
            clsCashflow cf = new clsCashflow(47);

            Console.WriteLine(cf.TransactionID() + "," + cf.Amount() + "," + cf.PayDate());

            clsCSVTable testTable = new clsCSVTable(clsCashflow.strCashflowPath);

            testTable.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblCashflowTest.csv");

            DateTime pd  = DateTime.Today;
            DateTime rd  = DateTime.Today;
            DateTime dd  = DateTime.MaxValue;
            int      pid = 17;
            double   a   = 100000;
            bool     act = false;

            clsCashflow.Type t      = clsCashflow.Type.RehabDraw;
            clsCashflow      cfTest = new clsCashflow(pd, rd, dd, pid, a, act, t);

            Console.WriteLine(cfTest.Save("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblCashflowTest.csv"));
        }
Beispiel #19
0
        private void _TestProperty()
        {
            clsProperty property = new clsProperty(14);

            Console.WriteLine(property.PropertyID() + "," + property.Address());

            clsCSVTable tbl = new clsCSVTable(clsProperty.strPropertyPath);

            tbl.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblPropertyTest.csv");
            clsProperty badproperty = new clsProperty("no", "no", "no", "no", -1, "no");

            Console.WriteLine(badproperty.Save("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblPropertyTest.csv"));

            tbl = new clsCSVTable(clsProperty.strPropertyPath);
            string[] strNewRecord = new string[tbl.Width() - 1];
            for (int i = 0; i < strNewRecord.Length; i++)
            {
                strNewRecord[i] = "new " + i.ToString();
            }
            tbl.New(strNewRecord);
            tbl.SaveAs("/Users/" + Environment.UserName + "/Documents/Professional/Resilience/tblPropertyTest.csv");
        }
Beispiel #20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            clsCSVTable tblLenders = new clsCSVTable(clsEntity.strEntityPath);
            clsCSVTable tblLoans   = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tblLenders.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.LenderPopUpButton.AddItem(tblLenders.Value(i, clsEntity.NameColumn));
                    this.lenderIndexToID.Add(i);
                }
            }
            for (int i = 0; i < tblLoans.Length(); i++)
            {
                this.lenderLoanIDs.Add(i);
            }

            // Do any additional setup after loading the view.
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            clsCSVTable EntityTable = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < EntityTable.Length(); i++)
            {
                switch (Int32.Parse(EntityTable.Value(i, clsEntity.EntityTypeColumn)))
                {
                case (Int32)clsEntity.Type.Borrower:
                    this.TitleHolderPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                    this.CoBorrowerPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                    break;

                case (Int32)clsEntity.Type.Title:
                    this.TitlePopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                    break;

                case (Int32)clsEntity.Type.Lender:
                    this.LenderPopUp.AddItem(EntityTable.Value(i, clsEntity.NameColumn));
                    break;
                }
            }
            this.PurchaseDatePicker.DateValue = (NSDate)System.DateTime.Today.AddMonths(1);
            this.TitleHolderPopUp.SelectItem(2);
            this.CoBorrowerPopUp.SelectItem(0);
            this.LenderPopUp.SelectItem(2);
            this.PointsBox.DoubleValue             = 0D;
            this.DefaultRateBox.DoubleValue        = 0.05;
            this.LoanRateBox.DoubleValue           = 0.09;
            this.ProfitSplitBox.DoubleValue        = 0.50;
            this.AcquisitionOnlyCheckBox.State     = NSCellStateValue.Off;
            this.InitialLoanPercentBox.DoubleValue = 1D;
            this.InitialLoanPercentBox.Editable    = false;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            this.InitializeValues();
            this.TypePopUpButton.RemoveAllItems();
            List <string> typeList = new List <string>();

            foreach (clsCashflow.Type t in Enum.GetValues(typeof(clsCashflow.Type)))
            {
                if ((t == clsCashflow.Type.ManagementFee) ||
                    (t == clsCashflow.Type.AccountingFees) ||
                    (t == clsCashflow.Type.BankFees) ||
                    (t == clsCashflow.Type.CapitalCall) ||
                    (t == clsCashflow.Type.CatchUp) ||
                    (t == clsCashflow.Type.Distribution) ||
//                    (t == clsCashflow.Type.InterestAdditional) ||
                    (t == clsCashflow.Type.LegalFees) ||
                    (t == clsCashflow.Type.ManagementFee) ||
                    (t == clsCashflow.Type.Misc) ||
                    (t == clsCashflow.Type.PromoteFee))
                {
                    typeList.Add(t.ToString());
                }
            }
            typeList.Sort();
            foreach (string s in typeList)
            {
                this.TypePopUpButton.AddItem(s);
            }
            this.CashflowsTableView.Delegate = new NonLoanCashflowTableViewDelegate(this.dataSource);
            this.CashflowsTableView.TableColumns()[0].Title = "ID";
            this.CashflowsTableView.TableColumns()[0].Width = 60;
            this.CashflowsTableView.TableColumns()[1].Title = "PayDate";
            this.CashflowsTableView.TableColumns()[1].Width = 60;
            this.CashflowsTableView.TableColumns()[2].Title = "RecDate";
            this.CashflowsTableView.TableColumns()[2].Width = 60;
            this.CashflowsTableView.TableColumns()[3].Title = "Amount";
            this.CashflowsTableView.TableColumns()[3].Width = 80;
            this.CashflowsTableView.TableColumns()[4].Title = "Type";
            this.CashflowsTableView.TableColumns()[4].Width = 80;
            this.CashflowsTableView.TableColumns()[5].Title = "Actual";
            this.CashflowsTableView.TableColumns()[5].Width = 40;
            this.CashflowsTableView.TableColumns()[6].Title = "DelDate";
            this.CashflowsTableView.TableColumns()[6].Width = 60;
            this.CashflowsTableView.TableColumns()[7].Title = "Comment";
            this.CashflowsTableView.TableColumns()[7].Width = 200;
//            this.CashflowsTableView.RemoveColumn(this.CashflowsTableView.TableColumns()[0]);
            this.CashflowsTableView.DataSource = this.dataSource;

            clsCSVTable tblLenders = new clsCSVTable(clsEntity.strEntityPath);
            clsCSVTable tblLoans   = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tblLenders.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.EntityPopUpButton.AddItem(tblLenders.Value(i, clsEntity.NameColumn));
                    this.entityIndexToID.Add(i);
                }
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            this.ScenarioButton.State      = NSCellStateValue.On;
            this.OutflowsOnlyButton.State  = NSCellStateValue.Off;
            this.ScheduledOnlyButton.State = NSCellStateValue.Off;
            this.showAll           = true;
            this.showScheduledOnly = false;
            this.showExpensesOnly  = false;
            this.showExpired       = false;

            clsCSVTable cfTable = new clsCSVTable(clsCashflow.strCashflowPath);

            for (int i = 0; i < cfTable.Length(); i++)
            {
                DateTime         pd = DateTime.Parse(cfTable.Value(i, clsCashflow.TransactionDateColumn));
                DateTime         rd = DateTime.Parse(cfTable.Value(i, clsCashflow.RecordDateColumn));
                DateTime         dd = DateTime.Parse(cfTable.Value(i, clsCashflow.DeleteDateColumn));
                int              id = Int32.Parse(cfTable.Value(i, clsCashflow.LoanColumn));
                double           a  = Double.Parse(cfTable.Value(i, clsCashflow.AmountColumn));
                bool             b  = Boolean.Parse(cfTable.Value(i, clsCashflow.ActualColumn));
                clsCashflow.Type t  = (clsCashflow.Type)Int32.Parse(cfTable.Value(i, clsCashflow.TransactionTypeColumn));
                string           c  = cfTable.Value(i, clsCashflow.CommentColumn);
                clsCashflow      cf = new clsCashflow(pd, rd, dd, id, a, b, t, c);
                if (DateTime.Parse(cfTable.Value(i, clsCashflow.DeleteDateColumn)) > System.DateTime.Today.AddYears(50))
                {
                    this.activeCashflows.Add(cf);
                    //this.activeCashflows.Add(new clsCashflow(i));
                }
                else
                {
                    this.expiredCashflows.Add(cf);
                }
            }

            this.DateFilterDatePicker.DateValue = (NSDate)System.DateTime.Today;
            this.startDate = System.DateTime.Today.AddYears(-10);
            this.StartDatePicker.DateValue = (NSDate)this.startDate;
            this.endDate = System.DateTime.Today.AddYears(10);
            this.EndDatePicker.DateValue = (NSDate)this.endDate;

            this.ActualFilterComboxBox.RemoveAll();
            this.ActualFilterComboxBox.Add((NSString)"All");
            this.ActualFilterComboxBox.Add((NSString)"True");
            this.ActualFilterComboxBox.Add((NSString)"False");
            this.ActualFilterComboxBox.SelectItem(0);

            this.AddressFilterComboBox.RemoveAll();
            this.AddressFilterComboBox.Add((NSString)"All");
            List <string> addresses = clsProperty.AddressList();

            foreach (string s in addresses)
            {
                this.AddressFilterComboBox.Add((NSString)s);
            }
            this.AddressFilterComboBox.SelectItem(0);

            this.TypeFilterComboBox.RemoveAll();
            this.TypeFilterComboBox.Add((NSString)"All");
            foreach (clsCashflow.Type t in Enum.GetValues(typeof(clsCashflow.Type)))
            {
                this.TypeFilterComboBox.Add((NSString)t.ToString());
            }
            this.TypeFilterComboBox.Remove((NSString)"Unknown");
            this.TypeFilterComboBox.SelectItem(0);

            this.dataSource                   = new CashflowTableDataSource();
            this.dataSourceDelegate           = new CashflowTableDataSourceDelegate(this.dataSource);
            this.CashflowTableView.DataSource = this.dataSource;
            this.CashflowTableView.Delegate   = this.dataSourceDelegate;

            clsCSVTable tblLenders = new clsCSVTable(clsEntity.strEntityPath);
            clsCSVTable tblLoans   = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tblLenders.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.LenderPopUp.AddItem(tblLenders.Value(i, clsEntity.NameColumn));
                    this.lenderIndexToID.Add(i);
                }
            }
            for (int i = 0; i < tblLoans.Length(); i++)
            {
                this.lenderLoanIDs.Add(i);
            }

            clsCSVTable tblBorrowers = new clsCSVTable(clsEntity.strEntityPath);

            for (int i = 0; i < tblBorrowers.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.TitleHolderColumn, i.ToString()).Count > 0)
                {
                    this.BorrowerPopUp.AddItem(tblBorrowers.Value(i, clsEntity.NameColumn));
                    this.borrowerIndexToID.Add(i);
                }
            }
            for (int i = 0; i < tblLoans.Length(); i++)
            {
                this.borrowerLoanIDs.Add(i);
            }
        }
Beispiel #24
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            this.ScenarioButton.State      = NSCellStateValue.On;
            this.OutflowsOnlyButton.State  = NSCellStateValue.Off;
            this.ScheduledOnlyButton.State = NSCellStateValue.Off;
            this.showAll           = true;
            this.showScheduledOnly = false;
            this.showExpensesOnly  = false;

            clsCSVTable cfTable = new clsCSVTable(clsCashflow.strCashflowPath);

            for (int i = 0; i < cfTable.Length(); i++)
            {
                if (DateTime.Parse(cfTable.Value(i, clsCashflow.DeleteDateColumn)) > System.DateTime.Today.AddYears(50))
                {
                    this.activeCashflows.Add(new clsCashflow(i));
                }
            }

            this.DateFilterDatePicker.DateValue = (NSDate)System.DateTime.Today;
            this.startDate = System.DateTime.Today.AddYears(-10);
            this.StartDatePicker.DateValue = (NSDate)this.startDate;
            this.endDate = System.DateTime.Today.AddYears(10);
            this.EndDatePicker.DateValue = (NSDate)this.endDate;

            this.ActualFilterComboxBox.RemoveAll();
            this.ActualFilterComboxBox.Add((NSString)"All");
            this.ActualFilterComboxBox.Add((NSString)"True");
            this.ActualFilterComboxBox.Add((NSString)"False");
            this.ActualFilterComboxBox.SelectItem(0);

            this.AddressFilterComboBox.RemoveAll();
            this.AddressFilterComboBox.Add((NSString)"All");
            List <string> addresses = clsProperty.AddressList();

            foreach (string s in addresses)
            {
                this.AddressFilterComboBox.Add((NSString)s);
            }
            this.AddressFilterComboBox.SelectItem(0);

            this.TypeFilterComboBox.RemoveAll();
            this.TypeFilterComboBox.Add((NSString)"All");
            foreach (clsCashflow.Type t in Enum.GetValues(typeof(clsCashflow.Type)))
            {
                this.TypeFilterComboBox.Add((NSString)t.ToString());
            }
            this.TypeFilterComboBox.Remove((NSString)"Unknown");
            this.TypeFilterComboBox.SelectItem(0);

            this.dataSource                   = new CashflowTableDataSource();
            this.dataSourceDelegate           = new CashflowTableDataSourceDelegate(this.dataSource);
            this.CashflowTableView.DataSource = this.dataSource;
            this.CashflowTableView.Delegate   = this.dataSourceDelegate;

            this.LenderPopUp.RemoveItem("Item 2");
            this.LenderPopUp.RemoveItem("Item 3");
            clsCSVTable tblLenders = new clsCSVTable(clsEntity.strEntityPath);
            clsCSVTable tblLoans   = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tblLenders.Length(); i++)
            {
                if (tblLoans.Matches(clsLoan.LenderColumn, i.ToString()).Count > 0)
                {
                    this.LenderPopUp.AddItem(tblLenders.Value(i, clsEntity.NameColumn));
                    this.lenderIndexToID.Add(i);
                }
            }
            for (int i = 0; i < tblLoans.Length(); i++)
            {
                this.lenderLoanIDs.Add(i);
            }
        }
Beispiel #25
0
        partial void RunReportPressed(NSButton sender)
        {
            // open file
            string fileName = "/Volumes/GoogleDrive/Shared Drives/Resilience/Reports/DocumentStatus";

            fileName += System.DateTime.Today.ToString("yyyyMMdd");
            fileName += "." + this.LenderPopUpButton.TitleOfSelectedItem;
            fileName += ".htm";
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName);

            // write beginning tags and header
            sw.WriteLine("<!DOCTYPE html><html>");
            sw.WriteLine("<head>");
            sw.WriteLine("<style>");
            sw.WriteLine("th {text-decoration:underline;}");
            sw.WriteLine("tr {background-color:WhiteSmoke;}");
            sw.WriteLine("td#MUSTHAVE {background-color:Red;}");
            sw.WriteLine("td#MIGHTHAVE {background-color:Orange;}");
            sw.WriteLine("td#SHOULDHAVE {background-color:Yellow;}");
            sw.WriteLine("td#TODO {background-color:Green;}");
            sw.WriteLine("td#COMPLETE {background-color:White;}");
            sw.WriteLine("tr#HEADER {background-color:White;}");
            sw.WriteLine("</style>");
            sw.WriteLine("</head>");

            // html body
            sw.WriteLine("<body>");
            sw.WriteLine("<h1>Document Status Report  " + System.DateTime.Today.ToString("MM/dd/yyyy") + "</h1>");
            sw.WriteLine("<table style=\"width:auto\">");
            WriteHTMLHeaderRow(sw);

            // loop through loans
            clsCSVTable tbl                = new clsCSVTable(clsLoan.strLoanPath);
            clsCSVTable tblDocuments       = new clsCSVTable(clsDocument.strDocumentPath);
            clsCSVTable tblDocumentRecords = new clsCSVTable(clsDocumentRecord.strDocumentRecordPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                if (this.lenderLoanIDs.Contains(i))
                {
                    // load document list
                    clsLoan loan = new clsLoan(i);
                    Dictionary <int, clsDocument> documentList = new Dictionary <int, clsDocument>();
                    List <int> documentListIDs = new List <int>();
                    documentListIDs = tblDocuments.Matches(clsDocument.PropertyColumn, loan.PropertyID().ToString());

                    // load document records
                    List <clsDocumentRecord> documentRecordList = new List <clsDocumentRecord>();
                    List <int> documentRecordIDs          = new List <int>();
                    List <clsDocument.Type> documentTypes = new List <clsDocument.Type>();

                    foreach (int id in documentListIDs)
                    {
                        documentList.Add(id, new clsDocument(id));
                        foreach (int recID in tblDocumentRecords.Matches(clsDocumentRecord.DocumentColumn, id.ToString()))
                        {
                            documentRecordIDs.Add(recID);
                            documentRecordList.Add(new clsDocumentRecord(recID));
                            documentTypes.Add(documentList[id].DocumentType());
                        }
                    }

                    // write loan to report
                    this.WriteLoanHTML(loan.Property().Address(), loan.Status(), sw, documentRecordList, documentTypes);
                }
            }

            // end of doc tags
            this.WriteHTMLFooter(sw);
            sw.WriteLine("</table></body></html>");
            sw.Flush();
        }
        private void CalculateAggregates(DateTime startDate, DateTime endDate)
        {
            // Balances:  Total made, less each quarters repayment, adding to Net Balance
            double dTotalLent        = 0D;
            double dRepaidPeriod     = 0D;
            double dRepaidPreviously = 0D;
            double dNetBalance       = 0D;
            double dTotalCommitted   = 0D;
            double dTotalRehabRemain = 0D;
            double dSaleContracts    = 0D;
            double dSaleListings     = 0D;
            double dPendingAcq       = 0D;
            double dPartialBalance   = 0D;

            // Accrued:   Total accrued FTD, less this period payments, less prior payments, (=accrued end of period),
            //            less accrued end of prev period,  adding to net accrued this period
            //            (+) paid this period (+) additional interest paid this period (+) add'l accrued this period = Net Income Period
            double dHardInterestPaidThisPeriod              = 0D;
            double dHardInterestPaidPreviously              = 0D;
            double dAccruedThisPeriod                       = 0D;
            double dAdditionalInterestPaidThisPeriod        = 0D;
            double dAdditionalInterestAccruedThisPeriod     = 0D;
            double dAdditionalInterestAccruedPreviousPeriod = 0D;
            double dPointsPaidThisPeriod                    = 0D;
            double dAccruedFTD            = 0D;
            double dAccruedNetAtStartDate = 0D;

            // Loan-by-loan:
            //            (+) Total Accrual FTD (+) interest paid this period (-) interest paid previous periods
            //            (+) Additional Paid this period (+) additional accrued this period (-) additional accrued last period
            int iStateCount = Enum.GetNames(typeof(clsLoan.State)).Length;

            int[,] iLoansByStatus = new int[iStateCount, 2];
            int[] iUncancelledCount = new int[2];
            for (int i = 0; i < iStateCount; i++)
            {
                iLoansByStatus[i, 0] = iLoansByStatus[i, 1] = 0;
            }

            // loop through loans
            clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath);

            for (int i = 0; i < tbl.Length(); i++)
            {
                if (this.lenderLoanIDs.Contains(i))
                {
                    clsLoan loan            = new clsLoan(i);
                    clsLoan loanAsOfEndDate = loan.LoanAsOf(endDate);
                    if (loan.FindDate(clsCashflow.Type.AcquisitionPrice, true, false) <= endDate)
                    {
                        iLoansByStatus[(int)loan.LoanAsOf(startDate).Status(), 0]++;
                        iLoansByStatus[(int)loanAsOfEndDate.Status(), 1]++;
                        dTotalLent                               += loan.Balance(endDate) + loan.PrincipalPaid(endDate);
                        dTotalRehabRemain                        += loanAsOfEndDate.RehabRemain(endDate);
                        dRepaidPeriod                            += loan.PrincipalPaid(endDate) - loan.PrincipalPaid(startDate);
                        dRepaidPreviously                        += loan.PrincipalPaid(startDate);
                        dHardInterestPaidPreviously              += loan.HardInterestPaid(startDate);
                        dHardInterestPaidThisPeriod              += loan.HardInterestPaid(endDate) - loan.HardInterestPaid(startDate);
                        dPointsPaidThisPeriod                    += loan.PointsPaid(endDate) - loan.PointsPaid(startDate);
                        dAccruedThisPeriod                       += loan.AccruedInterest(endDate) - loan.AccruedInterest(startDate);
                        dAdditionalInterestPaidThisPeriod        += loan.AdditionalInterestPaid(endDate) - loan.AdditionalInterestPaid(startDate);
                        dAdditionalInterestAccruedThisPeriod     += loan.AccruedAdditionalInterest(endDate);   // needs fixing
                        dAdditionalInterestAccruedPreviousPeriod += loan.AccruedAdditionalInterest(startDate); // needs fixing
                        dAccruedFTD                              += loan.AccruedInterest(endDate) + loan.HardInterestPaid(endDate);
                        dAccruedNetAtStartDate                   += loan.AccruedInterest(startDate);
                        if (loanAsOfEndDate.Status() == clsLoan.State.Listed)
                        {
                            dSaleListings += loan.Balance(endDate);
                        }
                        if (loanAsOfEndDate.Status() == clsLoan.State.PendingSale)
                        {
                            dSaleContracts += loan.Balance(endDate);
                        }
                        if (loanAsOfEndDate.Status() == clsLoan.State.PendingAcquisition)
                        {
                            dPendingAcq += loan.AcquisitionCost(false);
                        }
                        if (loanAsOfEndDate.Status() == clsLoan.State.PartiallySold)
                        {
                            dPartialBalance += loan.Balance(endDate);
                        }
                    }
                }
            }
            dTotalCommitted = dTotalLent + dTotalRehabRemain + dPendingAcq;
            dNetBalance     = dTotalLent - dRepaidPeriod - dRepaidPreviously;
            for (int i = 0; i < 2; i++)
            {
                iUncancelledCount[i]  = iLoansByStatus[(int)clsLoan.State.Listed, i];
                iUncancelledCount[i] += iLoansByStatus[(int)clsLoan.State.PendingAcquisition, i];
                iUncancelledCount[i] += iLoansByStatus[(int)clsLoan.State.PendingSale, i];
                iUncancelledCount[i] += iLoansByStatus[(int)clsLoan.State.Rehab, i];
                iUncancelledCount[i] += iLoansByStatus[(int)clsLoan.State.Sold, i];
                iUncancelledCount[i] += iLoansByStatus[(int)clsLoan.State.PartiallySold, i];
            }
            int iRepaidCount      = iLoansByStatus[(int)clsLoan.State.Sold, 1] - iLoansByStatus[(int)clsLoan.State.Sold, 0];
            int iOutstandingCount = iUncancelledCount[1] - iLoansByStatus[(int)clsLoan.State.Sold, 1];

            // Display Results
            this.ReportSummaryTextLabel.StringValue = "";

            this.ReportSummaryTextLabel.StringValue += " Total Committed:    \t" + dTotalCommitted.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iUncancelledCount[1].ToString("000") + ")" + "\t";

            this.ReportSummaryTextLabel.StringValue += "\n Total Loan Given:   \t" + dTotalLent.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + (iUncancelledCount[1] - iLoansByStatus[(int)clsLoan.State.PendingAcquisition, 1]).ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "FTD Accrual:    \t" + dAccruedFTD.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n Repaid Period:     \t" + dRepaidPeriod.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iRepaidCount.ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "(-)Paid Period: \t" + dHardInterestPaidThisPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n Repaid Previously: \t" + dRepaidPreviously.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iLoansByStatus[(int)clsLoan.State.Sold, 0].ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "(-)Paid Prev:   \t" + dHardInterestPaidPreviously.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n Loans Outstanding: \t" + dNetBalance.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iOutstandingCount.ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "Net Accrued:    \t" + (dAccruedFTD - dHardInterestPaidThisPeriod - dHardInterestPaidPreviously).ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t";
            this.ReportSummaryTextLabel.StringValue += "(-)Start Accr:  \t" + dAccruedNetAtStartDate.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n Sale Contracts     \t" + dSaleContracts.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iLoansByStatus[(int)clsLoan.State.PendingSale, 1].ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "Period Accr:    \t" + (dAccruedFTD - dHardInterestPaidThisPeriod - dHardInterestPaidPreviously - dAccruedNetAtStartDate).ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n Sale Listings      \t" + dSaleListings.ToString("00,000,000.00");
            this.ReportSummaryTextLabel.StringValue += "(" + iLoansByStatus[(int)clsLoan.State.Listed, 1].ToString("000") + ")" + "\t";
            this.ReportSummaryTextLabel.StringValue += "                           \t";
            this.ReportSummaryTextLabel.StringValue += "(+) Addl Paid  : \t" + dAdditionalInterestPaidThisPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t                           \t";
            this.ReportSummaryTextLabel.StringValue += "(+) Addl Accrue: \t" + dAdditionalInterestAccruedThisPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t                           \t";
            this.ReportSummaryTextLabel.StringValue += "(-) Prior Accru: \t" + dAdditionalInterestAccruedPreviousPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t";
            this.ReportSummaryTextLabel.StringValue += "(+) Additional:  \t" + (dAdditionalInterestPaidThisPeriod + dAdditionalInterestAccruedThisPeriod - dAdditionalInterestAccruedPreviousPeriod).ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t";
            this.ReportSummaryTextLabel.StringValue += "(+) Hard Paid :  \t" + dHardInterestPaidThisPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t";
            this.ReportSummaryTextLabel.StringValue += "(+) Points Paid :\t" + dPointsPaidThisPeriod.ToString("000,000.00");

            this.ReportSummaryTextLabel.StringValue += "\n                    \t                   \t";
            this.ReportSummaryTextLabel.StringValue += "Net Income Per:  \t" + (dAccruedFTD - dHardInterestPaidPreviously - dAccruedNetAtStartDate + dAdditionalInterestPaidThisPeriod + dAdditionalInterestAccruedThisPeriod - dAdditionalInterestAccruedPreviousPeriod + dPointsPaidThisPeriod).ToString("000,000.00");
        }
        partial void propertyMenuChosen(AppKit.NSPopUpButton sender)
        {
            documentRecordHistory.StringValue  = " ";
            documentRecordHistory.StringValue += "\t" + "\t" + "\t" + "Sender           " + "Reciever         " + " Action Date     " + "Record Date     " + "\n";

            clsCSVTable tbl      = new clsCSVTable(clsDocument.strDocumentPath);
            int         chosenID = clsLoan.LoanID(propertyMenu.TitleOfSelectedItem);

            Console.WriteLine(chosenID.ToString());

            System.Collections.Generic.List <clsDocument> documentList    = new System.Collections.Generic.List <clsDocument>();
            System.Collections.Generic.List <int>         documentlistIDs = new System.Collections.Generic.List <int>();
            for (int i = 0; i < tbl.Length(); i++)
            {
                if (chosenID.ToString() == tbl.Value(i, clsDocument.PropertyColumn))
                {
                    clsDocument document = new clsDocument(i);
                    documentList.Add(document);
                    Console.Write(tbl.Value(i, clsDocument.PropertyColumn));
                    documentlistIDs.Add(i);
                }
            }

            clsCSVTable documentRecordTable = new clsCSVTable(clsDocumentRecord.strDocumentRecordPath);
            clsCSVTable tblEntities         = new clsCSVTable(clsEntity.strEntityPath);

            for (int iDocIndex = 0; iDocIndex < documentlistIDs.Count; iDocIndex++)
            {
                int docID = documentlistIDs[iDocIndex];
                documentRecordHistory.StringValue += documentList[iDocIndex].Name() + "\n";
                for (int i = 0; i < documentRecordTable.Length(); i++)
                {
                    if (documentRecordTable.Value(i, clsDocumentRecord.DocumentColumn) == docID.ToString())
                    {
                        int senderID     = Int32.Parse(documentRecordTable.Value(i, clsDocumentRecord.SenderColumn));
                        int receiverID   = Int32.Parse(documentRecordTable.Value(i, clsDocumentRecord.ReceiverColumn));
                        int status       = Int32.Parse(documentRecordTable.Value(i, clsDocumentRecord.StatusColumn));
                        int transmission = Int32.Parse(documentRecordTable.Value(i, clsDocumentRecord.TransmissionColumn));
                        Console.WriteLine(documentRecordTable.Value(i, clsDocumentRecord.DocumentColumn));
                        //documentRecordHistory.StringValue += "Doc record ID: " + i + ", Action date: " + (documentRecordTable.Value(i, clsDocumentRecord.ActionDateColumn)) + ", Record date: "+ (documentRecordTable.Value(i, clsDocumentRecord.RecordDateColumn)) + ", Sender ID: " + (documentRecordTable.Value(i, clsDocumentRecord.SenderColumn)) + ", Reciever ID: " + (documentRecordTable.Value(i, clsDocumentRecord.ReceiverColumn)) + ", Status: " + (documentRecordTable.Value(i, clsDocumentRecord.StatusColumn)) + ", Transmission method: " + (documentRecordTable.Value(i, clsDocumentRecord.TransmissionColumn)) + "\n";

                        string Sender   = tblEntities.Value(senderID, clsEntity.NameColumn);
                        string Reciever = tblEntities.Value(receiverID, clsEntity.NameColumn);
                        clsDocumentRecord.Status Status = (clsDocumentRecord.Status)(status);
                        string StatusString             = Status.ToString();
                        //Titles


                        if (Sender.Length > 15)
                        {
                            Sender = Sender.Substring(0, 15);
                        }
                        else
                        {
                            while (Sender.Length < 15)
                            {
                                Sender = Sender + " ";
                            }
                        }
                        documentRecordHistory.StringValue += "\t" + "\t" + "\t" + Sender;
                        // Now it is the reciever length
                        if (Reciever.Length > 15)
                        {
                            Reciever = Reciever.Substring(0, 15);
                        }
                        else
                        {
                            while (Reciever.Length < 15)
                            {
                                Reciever = Reciever + " ";
                            }
                        }
                        documentRecordHistory.StringValue += ", " + Reciever;

                        documentRecordHistory.StringValue += ",  " + DateTime.Parse(documentRecordTable.Value(i, clsDocumentRecord.ActionDateColumn)).ToString("MM/dd/yy hh:mm");
                        documentRecordHistory.StringValue += ", " + DateTime.Parse(documentRecordTable.Value(i, clsDocumentRecord.RecordDateColumn)).ToString("MM/dd/yy hh:mm");
                        while (StatusString.Length < 12)
                        {
                            StatusString = StatusString + " ";
                        }
                        documentRecordHistory.StringValue += ", " + StatusString;
                        documentRecordHistory.StringValue += ", " + (clsDocumentRecord.Transmission)(transmission) + "\n";
                    }
                }
            }
        }