コード例 #1
0
ファイル: PaymentHistory.cs プロジェクト: jsmnlcbls/Loanbook
        private void addBalanceColumn(DataTable summary)
        {
            AccountLoans loans = new AccountLoans(database, account);

            loans.IncludeClosedLoans = true;

            Dictionary <long, decimal> runningBalance = new Dictionary <long, decimal>();
            Dictionary <long, decimal> runningProfit  = new Dictionary <long, decimal>();

            foreach (Loan loan in loans)
            {
                runningBalance[loan.Id] = loan.TotalPayable;
                runningProfit[loan.Id]  = (loan.ProcessingFee + loan.ReloanFee);
            }

            summary.Columns.Add("balance", typeof(decimal));
            summary.Columns.Add("profit", typeof(decimal));
            foreach (DataRow row in summary.Rows)
            {
                long    loanId            = (long)row["loan_id"];
                decimal balanceDeductible = (decimal)row["balance_deductible"];
                decimal amount            = (decimal)row["amount"];
                decimal interestPayment   = (decimal)row["interest_payment"];
                decimal currentProfit     = runningProfit[loanId] + interestPayment;
                decimal currentBalance    = runningBalance[loanId] - balanceDeductible;
                row["balance"]         = currentBalance;
                row["profit"]          = currentProfit;
                runningBalance[loanId] = currentBalance;
                runningProfit[loanId]  = currentProfit;
            }
        }
コード例 #2
0
ファイル: LoanViewForm.cs プロジェクト: jsmnlcbls/Loanbook
 public LoanViewForm(Account account)
 {
     InitializeComponent();
     this.account                    = account;
     Text                            = account.Name + " Loans";
     accountLoans                    = new AccountLoans(DatabaseFactory.Default, account);
     accountLoans.StartDate          = LoanBookForm.TimelineStartDate;
     accountLoans.EndDate            = LoanBookForm.TimelineEndDate;
     accountLoans.IncludeClosedLoans = true;
 }
コード例 #3
0
ファイル: LoanViewForm.cs プロジェクト: jsmnlcbls/Loanbook
 private void form_UpdateForm()
 {
     accountLoans           = new AccountLoans(DatabaseFactory.Default, account);
     accountLoans.StartDate = LoanBookForm.TimelineStartDate;
     accountLoans.EndDate   = LoanBookForm.TimelineEndDate;
     loanGrid.DataSource    = accountLoans.Summary;
     if (FormUpdated != null)
     {
         FormUpdated();
     }
 }
コード例 #4
0
ファイル: ReloanSaveForm.cs プロジェクト: jsmnlcbls/Loanbook
 private void loadLoanSelector()
 {
     if (this.loan == null)
     {
         AccountLoans loanList = new AccountLoans(DatabaseFactory.Default, account);
         foreach (Loan loan in loanList)
         {
             loanSelector.Items.Add(loan);
         }
     }
     else
     {
         loanSelector.Items.Add(loan);
         loanSelector.SelectedItem = loan;
     }
 }
コード例 #5
0
ファイル: PaymentForm.cs プロジェクト: jsmnlcbls/Loanbook
 private void loadLoanSelector(Payment initialPayment = null)
 {
     if (this.loan == null)
     {
         AccountLoans loanList = new AccountLoans(DatabaseFactory.Default, account);
         loanList.IncludeClosedLoans = false;
         foreach (Loan loan in loanList)
         {
             loanSelector.Items.Add(loan);
         }
     }
     else
     {
         loanSelector.Items.Add(loan);
         loanSelector.SelectedItem = loan;
     }
 }