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 RedrawTable() { // instantiate loan that matches address chosen if (this.PropertyChooser.SelectedIndex != 0) { clsLoan loan = new clsLoan(dictLoanIDsByAddress[this.PropertyChooser.StringValue]); // load all documents pertaining to that property, and all document records pertaining to each document List <int> documentIDs = tblDocuments.Matches(clsDocument.PropertyColumn, loan.PropertyID().ToString()); List <clsDocument> documents = new List <clsDocument>(); Dictionary <int, List <clsDocumentRecord> > documentRecords = new Dictionary <int, List <clsDocumentRecord> >(); foreach (int id in documentIDs) { documents.Add(new clsDocument(id)); documentRecords.Add(id, new List <clsDocumentRecord>()); foreach (int docrecid in tblDocumentRecords.Matches(clsDocumentRecord.DocumentColumn, id.ToString())) { documentRecords[id].Add(new clsDocumentRecord(docrecid)); } } // apply filters (date range, type, status, transmission, sender, receiver) to construct datasource // construct datasource this.dataSource.data = new List <clsDocumentRecord>(); foreach (int id in documentIDs) { foreach (clsDocumentRecord rec in documentRecords[id]) { bool ok = true; ok = (ok) && (((int)rec.StatusType() == this.StatusFilter.SelectedIndex - 1) || (this.StatusFilter.SelectedIndex == 0)); ok = (ok) && (((int)rec.SenderID() == this.SenderFilter.SelectedIndex - 1) || (this.SenderFilter.SelectedIndex == 0)); ok = (ok) && (((int)rec.ReceiverID() == this.ReceiverFilter.SelectedIndex - 1) || (this.ReceiverFilter.SelectedIndex == 0)); // ok = (ok) && (((int)rec.DocumentID() == this.TypeFilter.SelectedIndex - 1) || (this.TypeFilter.SelectedIndex == 0)); if (ok) { this.dataSource.data.Add(rec); } } } // ALLOW SORTING this.DocRecTableView.ReloadData(); } }