partial void ActualCashflowPressed(NSButton sender)
 {
     if (this.validIDEntered)
     {
         clsCashflow cashflow = new clsCashflow(this.CashflowIDTextField.IntValue);
         if (cashflow.Comment() != null)
         {
             this.CommentTextField.StringValue = cashflow.Comment();
         }
         else
         {
             this.CommentTextField.StringValue = "";
         }
         if (cashflow.Actual())
         {
             this.SystemMessageTextField.StringValue = "CASHFLOW IS ALREADY ACTUAL";
         }
         else if (cashflow.MarkActual(System.DateTime.Today))
         {
             this.SystemMessageTextField.StringValue = "CASHFLOW MADE ACTUAL";
             this.ActualTextField.StringValue        = "Actual : " + true.ToString();
             cashflow.Save();
         }
         else
         {
             this.SystemMessageTextField.StringValue = "CASHFLOW EXPIRED, CAN'T MAKE ACTUAL";
         }
     }
     RedrawTable();
 }
예제 #2
0
 partial void markTrueClicked(AppKit.NSButton sender)
 {
     if (Int32.TryParse(CashflowIDPopUp.SelectedItem.Title, out int i))
     {
         clsCashflow cf = new clsCashflow(Int32.Parse(CashflowIDPopUp.SelectedItem.Title));
         cf.MarkActual(System.DateTime.Today);
         cf.Save();
         loadRehabInfo();
     }
 }
        partial void markTrueClicked(AppKit.NSButton sender)
        {
            int cfID = 0;

            cfID = Int32.Parse(cashflowID.StringValue);

            clsCashflow cf = new clsCashflow(cfID);

            cf.MarkActual(System.DateTime.Today);
            cf.Save();
            loadRehabInfo();
        }
        partial void AddButtonPressed(AppKit.NSButton sender)
        {
            DateTime dtPay    = ((DateTime)this.DatePicker.DateValue).Date;
            DateTime dtRecord = ((DateTime)this.RecordDateOverridePicker.DateValue).Date;
            double   dAmount  = this.AmountTextField.DoubleValue;

            // VALIDATE ENTRIES
            if (this.typeChosen == clsCashflow.Type.Unknown)
            {
                this.SystemMessageTextField.StringValue = "INVALID CASHFLOW TYPE, UNABLE TO ADD";
            }
            else if (this.entityID < 0)
            {
                this.SystemMessageTextField.StringValue = "NO ENTITY SELECTED, UNABLE TO ADD";
            }
            else
            {
                // CREATE NEW CASHFLOW
                clsCashflow cashflow = new clsCashflow(dtPay, dtRecord, System.DateTime.MaxValue, -this.entityID, dAmount,
                                                       false, this.typeChosen, this.CommentTextField.StringValue);
                if (dtPay <= System.DateTime.Today.Date)
                {
                    cashflow.MarkActual(System.DateTime.Today.Date);
                }
                // SAVE TO TABLE
                cashflow.Save();
                this.CashflowIDTextField.IntValue = cashflow.ID();
                // UPDATE COMMENT BOX
                this.SystemMessageTextField.StringValue = "CASHFLOW SAVED.";
                if ((cashflow.TypeID() == clsCashflow.Type.InterestAdditional) && (cashflow.Amount() < 0D))
                {
                    this.SystemMessageTextField.StringValue += "\nCheck Amount.  Additional Interest is usually >= 0.";
                }
                else if ((cashflow.TypeID() == clsCashflow.Type.CapitalCall) && (cashflow.Amount() < 0D))
                {
                    this.SystemMessageTextField.StringValue += "\nCheck Amount.  Capital Calls are usually >= 0.";
                }
                else if ((cashflow.TypeID() == clsCashflow.Type.CatchUp) && (cashflow.Amount() < 0D))
                {
                    this.SystemMessageTextField.StringValue += "\nCheck Amount.  Catchup Payments are usually >= 0.";
                }
                else if (cashflow.Amount() > 0)
                {
                    this.SystemMessageTextField.StringValue += "\nCheck Amount.  Expenses are normally <0.";
                }
            }
            RedrawTable();
        }
 partial void ExpireButtonPressed(AppKit.NSButton sender)
 {
     if (this.validIDEntered)
     {
         clsCashflow cashflow = new clsCashflow(this.CashflowIDTextField.IntValue);
         if (cashflow.Delete(System.DateTime.Now))
         {
             this.SystemMessageTextField.StringValue = "CASHFLOW EXPIRED";
             cashflow.Save();
         }
         else
         {
             this.SystemMessageTextField.StringValue = "CASHFLOW IS ALREADY ACTUAL, EXPIRE FAILED";
         }
     }
     RedrawTable();
 }
예제 #6
0
 partial void deleteButtonClicked(AppKit.NSButton sender)
 {
     if (Int32.TryParse(CashflowIDPopUp.SelectedItem.Title, out int i))
     {
         clsCashflow deletedCashflow = new clsCashflow(Int32.Parse(CashflowIDPopUp.SelectedItem.Title));
         if (deletedCashflow.Actual() == true)
         {
             rehabDrawDisplayFalse.StringValue += "Error: Could not delete cashflow, already payed.";
         }
         else
         {
             deletedCashflow.Delete(System.DateTime.Today);
             deletedCashflow.Save();
         }
         loadRehabInfo();
     }
 }
예제 #7
0
        partial void dateChangeClicked(AppKit.NSButton sender)
        {
            if (Int32.TryParse(CashflowIDPopUp.SelectedItem.Title, out int i))
            {
                clsLoan  loan    = new clsLoan(chosenID);
                DateTime newDate = (DateTime)(dateChanger.DateValue);

                // Delete existing (old) cashflow
                clsCashflow cf = new clsCashflow(Int32.Parse(CashflowIDPopUp.SelectedItem.Title));
                cf.Delete(System.DateTime.Today);
                cf.Save();

                // Create new cashflow with new date
                clsCashflow updatedCF = new clsCashflow(newDate, System.DateTime.Today, System.DateTime.MaxValue, cf.LoanID(), cf.Amount(), false, cf.TypeID());
                loan.AddCashflow(updatedCF);
                updatedCF.Save();
                loadRehabInfo();
            }
        }
        partial void deleteButtonClicked(AppKit.NSButton sender)
        {
            int cfID = 0;

            cfID = Int32.Parse(cashflowID.StringValue);

            clsCashflow deletedCashflow = new clsCashflow(cfID);

            if (deletedCashflow.Actual() == true)
            {
                rehabDrawDisplayFalse.StringValue += "Error: Could not delete cashflow, already payed.";
            }
            else
            {
                deletedCashflow.Delete(System.DateTime.Today);
            }
            deletedCashflow.Save();
            loadRehabInfo();
        }
        partial void dateChangeClicked(AppKit.NSButton sender)
        {
            clsLoan loan = new clsLoan(chosenID);
            int     cfID = 0;

            cfID = Int32.Parse(cashflowID.StringValue);
            DateTime newDate = (DateTime)(dateChanger.DateValue);

            clsCashflow cf = new clsCashflow(cfID);

            cf.Delete(System.DateTime.Today);
            cf.Save();

            clsCashflow updatedCF = new clsCashflow(newDate, System.DateTime.Today, System.DateTime.MaxValue, cf.LoanID(), cf.Amount(), false, cf.TypeID());

            loan.AddCashflow(updatedCF);
            updatedCF.Save();

            loadRehabInfo();
        }
예제 #10
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"));
        }
예제 #11
0
        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.";
        }