protected void btnFinalize_Click(object sender, EventArgs e) { MySessionManager.cash = 0; MySessionManager.bank = 0; decimal amtDeductable = 0; decimal fees = 0; decimal amt = 0; int ops = 0; LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter(); int status = Convert.ToInt32(loanApp.getApplicationStatus(MySessionManager.AppID)); util.UpdateApplicationStatus("Forward Application", status); createAccount(); mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter(); mTemp.GetTransactionDetailsDataTable tblTempHolder = tempHolder.GetTempTransactions(MySessionManager.AppID); LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter(); int rows = tblTempHolder.Rows.Count; for (int i = 0; i < rows; i++) { int?datDebitAc = null; int?datCreditAc = null; if (tblTempHolder[i].datDebit > 0) { datDebitAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datDebit; ops = 1; } else if (tblTempHolder[i].datCredit > 0) { datCreditAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datCredit; ops = 2; } // if (tblTempHolder[i].datPaymentMethod == 1) { getAmtForPaymentMode(amt, "cash", ops); } else if (tblTempHolder[i].datPaymentMethod == 2) { getAmtForPaymentMode(amt, "bank", ops); } fintrans.InsertFinancialTransaction(MySessionManager.AppID, MySessionManager.ClientID, tblTempHolder[i].datAccountID, Convert.ToInt32(MySessionManager.AccountID), tblTempHolder[i].datDescription, batch(), tblTempHolder[i].datPaymentMethod, MySessionManager.AppBranchID, tblTempHolder[i].datCredit, tblTempHolder[i].datDebit, datCreditAc, datDebitAc, 0, MySessionManager.CurrentUser.UserID); } saveDisburse(Convert.ToInt32(MySessionManager.AccountID), MySessionManager.cash, MySessionManager.bank); saveCreditTransaction(Convert.ToInt32(MySessionManager.AccountID), batch(), interestamt, "1", 1); saveDebitTransaction(Convert.ToInt32(MySessionManager.AccountID), batch(), interestamt, "1", 0); interest_payment_dates(MySessionManager.AppID, Convert.ToInt32(MySessionManager.AccountID), DateTime.Now, 12); Response.Redirect("~/pages/loanapplications.aspx"); }
protected void btnFinalize_Click(object sender, EventArgs e) { try { MySessionManager.cash = 0; MySessionManager.bank = 0; decimal amtDeductable = 0; decimal fees = 0; decimal amt = 0; int ops = 0; mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter(); mTemp.GetTransactionDetailsDataTable tblTempHolder = tempHolder.GetInvTempTransactions(MySessionManager.InvAppID); LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter(); int rows = tblTempHolder.Rows.Count; for (int i = 0; i < rows; i++) { int?datDebitAc = null; int?datCreditAc = null; if (tblTempHolder[i].datDebit > 0) { datDebitAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datDebit; ops = 1; } else if (tblTempHolder[i].datCredit > 0) { datCreditAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datCredit; ops = 2; } // if (tblTempHolder[i].datPaymentMethod == 1) { getAmtForPaymentMode(amt, "cash", ops); } else if (tblTempHolder[i].datPaymentMethod == 2) { getAmtForPaymentMode(amt, "bank", ops); } fintrans.InsertFinancialTransaction(MySessionManager.InvAppID, MySessionManager.ClientID, tblTempHolder[i].datAccountID, MySessionManager.InvAppID, tblTempHolder[i].datDescription, batch(), tblTempHolder[i].datPaymentMethod, MySessionManager.AppBranchID, tblTempHolder[i].datCredit, tblTempHolder[i].datDebit, datCreditAc, datDebitAc, 0, MySessionManager.CurrentUser.UserID); } } catch (Exception ex) { } //This block of code changes the status of the application try { InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter(); InvApp.UpdateApplicationStatus(3, MySessionManager.InvAppID); Response.Redirect("~/pages/invapplications.aspx"); } catch (Exception ex) { } }
protected void btnFinalize_Click(object sender, EventArgs e) { MySessionManager.cash = 0; MySessionManager.bank = 0; decimal amtDeductable = 0; decimal fees = 0; decimal amt = 0; int ops = 0; mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter(); mTemp.GetTransactionDetailsDataTable tblTempHolder = tempHolder.GetAccTransactions(Convert.ToInt32(MySessionManager.AccountID)); LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter(); int rows = tblTempHolder.Rows.Count; for (int i = 0; i < rows; i++) { int?datDebitAc = null; int?datCreditAc = null; if (tblTempHolder[i].datDebit > 0) { datDebitAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datDebit; amtDeductable = amtDeductable + tblTempHolder[i].datDebit; ops = 1; } else if (tblTempHolder[i].datCredit > 0) { datCreditAc = tblTempHolder[i].datAccountID; amt = tblTempHolder[i].datCredit; amtDeductable = amtDeductable - tblTempHolder[i].datCredit; ops = 2; } // if (tblTempHolder[i].datPaymentMethod == 1) { getAmtForPaymentMode(amt, "cash", ops); } else if (tblTempHolder[i].datPaymentMethod == 2) { getAmtForPaymentMode(amt, "bank", ops); } fintrans.InsertFinancialTransaction(MySessionManager.AppID, MySessionManager.ClientID, tblTempHolder[i].datAccountID, Convert.ToInt32(MySessionManager.AccountID), tblTempHolder[i].datDescription, batch(), tblTempHolder[i].datPaymentMethod, MySessionManager.CurrentUser.BranchID, tblTempHolder[i].datCredit, tblTempHolder[i].datDebit, datCreditAc, datDebitAc, 0, MySessionManager.CurrentUser.UserID); } mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter(); LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter(); LoanAccountDS.GetLoanAccountDataTable tblLoaonAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID)); LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter repayment = new LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter(); if (tblLoaonAcc.Rows.Count > 0) { repayment.InsertLoanRepayment(receiptNo(), DateTime.Now, tblLoaonAcc[0].datID, tblLoaonAcc[0].datAccountNumber.ToString(), client.GetClientNo(Convert.ToInt32(MySessionManager.AccountID)), tblLoaonAcc[0].datIssueDate, tblLoaonAcc[0].datInterestRate, MySessionManager.cash, MySessionManager.bank, (MySessionManager.cash + MySessionManager.bank), fees, tblLoaonAcc[0].datLoanType, tblLoaonAcc[0].datPurpose, tblLoaonAcc[0].datTeamID, MySessionManager.CurrentUser.UserID); } loanAcc.UpdateNewAmtOutstanding(amtDeductable, Convert.ToInt32(MySessionManager.AccountID)); decimal outstanding = Convert.ToDecimal(loanAcc.GetAmtOutstanding(Convert.ToInt32(MySessionManager.AccountID))); if (outstanding <= 0) { loanAcc.UpdateCloseAccount(Convert.ToInt32(MySessionManager.AccountID)); } tempHolder.DeleteTempTransByAccID(Convert.ToInt32(MySessionManager.AccountID)); }