private void DisplayTransaction(int Index) { Main.Transaction T = RetTransaction(Index); TBName.Text = T.Name; CBCompany.Text = T.Company; CBCategory.Text = T.Category; NUPredicted.Value = T.Predicted.Capital; DTPStart.Value = T.Predicted.Time; TBNotes.Lines = T.Notes; if (T.Resolved) { NUReal.Value = T.Real.Value.Capital; DTPReal.Value = T.Real.Value.Time; } if (T.Repeat.HasValue) { DTPStart.Value = T.Repeat.Value.Duration.Value.Start; DTPEnd.Value = T.Repeat.Value.Duration.Value.End; CBRepeatFreq.Text = T.Repeat.Value.Increment; ChBRepeatActive.Checked = T.Repeat.Value.Active; } BTNWriteData.Text = "Update"; }
private void AddSFData2Trans() { foreach (Main.Year Y in Main.RC.Years) { int TermIndex = 0; string Year = Y.Terms[0].SFPayment.Year.ToString().Substring(2) + "-"; Year += (Y.Terms[0].SFPayment.Year + 1).ToString().Substring(2) + ")"; foreach (Main.Term T in Y.Terms) { TermIndex++; Main.Transaction Loan = new Main.Transaction("SF Loan (Term " + TermIndex.ToString() + ": " + Year, "Student Finance", "SLC", new Main.CapTime(T.StudentFinanceLoan, T.SFPayment), new Main.CapTime(T.StudentFinanceLoan, T.SFPayment), false, new string[0], null); Main.Transactions.In.Add(Loan); Main.Transaction Grant = new Main.Transaction("SF Grant (Term " + TermIndex.ToString() + ": " + Year, "Student Finance", "SLC", new Main.CapTime(T.StudentFinanceGrant, T.SFPayment), new Main.CapTime(T.StudentFinanceGrant, T.SFPayment), false, new string[0], null); Main.Transactions.In.Add(Grant); if (T.Bursary == 0) //Most will have Loan & Grant !Bursary { break; } Main.Transaction Bursary = new Main.Transaction("Bursary (Term " + TermIndex.ToString() + ": " + Year, "Student Finance", "SLC", new Main.CapTime(T.Bursary, T.Duration.Start), new Main.CapTime(T.Bursary, T.Duration.Start), false, new string[0], null); Main.Transactions.In.Add(Bursary); } } }
public static decimal GetAmmountToAdd(Main.Transaction T, Main.DurationN D) { if (!D.Start.HasValue || (D.Start < (T.Real.HasValue ? T.Real.Value.Time : T.Predicted.Time)) && (!D.End.HasValue || D.End > (T.Real.HasValue ? T.Real.Value.Time : T.Predicted.Time))) { // (!StartIsNull OR StartInRange) AND (!EndIsNull OR EndInRange) return(T.Real.HasValue ? T.Real.Value.Capital : T.Predicted.Capital); } else { return(0); } }
private void BTNWriteData_Click(object sender, EventArgs e) { CBCompany.Text = Main.CheckCompanies(CBCompany.Text); Main.Transaction T = new Main.Transaction( TBName.Text, CBCategory.Text, CBCompany.Text, new Main.CapTime(NUPredicted.Value, DTPPredicted.Value), SetRealCapTime(), ChBTransactionCompleted.Checked, TBNotes.Lines, SetRepeatData() ); Main.UpdateTransactions(T, IsIncome); if (GIndex.HasValue) { Main.RemoveTransaction(GIndex.Value, IsIncome); } Main.SaveTransactions(); }