private void loadRehabInfo() { chosenID = clsLoan.LoanID(propertyMenu.TitleOfSelectedItem); clsLoan l = new clsLoan(chosenID); if ((l.Status() == clsLoan.State.PendingSale) || (l.Status() == clsLoan.State.Sold)) { this.LoanStatusTextField.TextColor = NSColor.Red; this.LoanStatusTextField.StringValue = l.Status().ToString().ToUpper(); if (l.Status() == clsLoan.State.PendingSale) { this.LoanStatusTextField.StringValue += " *** CHECK PAYOFF LETTER"; } } else { this.LoanStatusTextField.TextColor = NSColor.Black; this.LoanStatusTextField.StringValue = l.Status().ToString(); } rehabDrawDisplayTrue.StringValue = "Payed draws:" + "\n"; rehabDrawDisplayFalse.StringValue = "Not payed draws:" + "\n"; // Repopulate Cashflow ID Pop Up this.CashflowIDPopUp.RemoveAllItems(); this.CashflowIDPopUp.AddItem("Select Cashflow"); double trueTotal = 0; double falseTotal = 0; foreach (clsCashflow cashFlow in l.Cashflows()) { if (cashFlow.TypeID() == clsCashflow.Type.RehabDraw && cashFlow.DeleteDate() > System.DateTime.Today) { if (cashFlow.Actual() == true) { trueTotal += cashFlow.Amount(); rehabDrawDisplayTrue.StringValue += "Date: " + cashFlow.PayDate().ToString("MM/dd/yyyy hh:mm") + ", "; rehabDrawDisplayTrue.StringValue += "Amount: " + "$" + (-cashFlow.Amount()).ToString("00,000.00") + ", "; rehabDrawDisplayTrue.StringValue += "Payed: " + cashFlow.Actual() + "\n"; } else { falseTotal += cashFlow.Amount(); rehabDrawDisplayFalse.StringValue += "Date: " + cashFlow.PayDate().ToString("MM/dd/yyyy hh:mm") + ", "; rehabDrawDisplayFalse.StringValue += "Amount: " + "$" + (-cashFlow.Amount()).ToString("00,000.00") + ", "; rehabDrawDisplayFalse.StringValue += "Payed: " + cashFlow.Actual() + ", "; rehabDrawDisplayFalse.StringValue += "Cashflow ID: " + cashFlow.ID() + "\n"; this.CashflowIDPopUp.AddItem(cashFlow.ID().ToString()); } } } //After each cashflows are filtered, display the total trueTotal = -trueTotal; falseTotal = -falseTotal; rehabDrawDisplayTrue.StringValue += "Total amount: " + "$" + trueTotal.ToString("00,000.00"); rehabDrawDisplayFalse.StringValue += "Total amount: " + "$" + falseTotal.ToString("00,000.00"); }
partial void addNewConstruction(AppKit.NSButton sender) { clsLoan loan = new clsLoan(chosenID); DateTime payDate = (DateTime)(constructionDateNew.DateValue); DateTime recordDate = System.DateTime.Today; DateTime deleteDate = System.DateTime.MaxValue; int loanID = chosenID; double amount = constructionAmountNew.DoubleValue; if (amount > 0) { amount = -amount; } bool payed = false; if (payDate > System.DateTime.Today) { payed = false; } else { payed = true; } clsCashflow.Type typeID = new clsCashflow.Type(); typeID = clsCashflow.Type.RehabDraw; clsCashflow newCashflow = new clsCashflow(payDate, recordDate, deleteDate, loanID, amount, payed, typeID); loan.Cashflows().Add(newCashflow); newCashflow.Save(); loadRehabInfo(); // if (loan.Save()) // loadRehabInfo(); // else // rehabDrawDisplayTrue.StringValue += "\nSave Failed, New Cashflow not Saved."; }