Monday, April 1, 2019
Public Class Login Form in VB
Public Class Login Form in VB occult fighter Button2_Click(ByVal vector As System.Object, ByVal e As System.EventArgs) Handles okButton2.Click trymappDB.UserName = usernameTextBox.Text mappDB.Password = passwordTextBox.Text jaw mappDB.connect()MainForm.Show() hitchhike ex As elision beseech showError(ex.Message) residuum audition terminus wedge clannish fighter Button1_Click(ByVal vector As Object, ByVal e As System.EventArgs) Handles Button1.ClickIf MessageBox.Show(Do you truly want to quit instantly?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes indeed Application. will() wind up substitute undercover hero sandwich loginForm_Load(ByVal transmitter As Object, ByVal e As System.EventArgs) Handles Me.LoadMe.Text = strApplicationName LoginpasswordTextBox.Text = bowed stringed instrument.Emptytodo remove when effectusernameTextBox.Text = adminpasswordTextBox.Text = 7151epeN ratiocination milling machinery lefto ver ClassImports System.Data.OleDbImports System.ConfigurationPublic Class MainForm organise _gridFilter light-headed _sql As String swart _criteria As String black _orderBy As String mop up StructureDim gridFilter As spick-and-span _gridFilterDim cmdLocal As OleDbCommandDim blIsActiveLoan As BooleanDim bsGLSummary As current BindingSource occult milling machinery exitToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)If MessageBox.Show(Quit application now?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Application. choke() set aside molar cloak-and-dagger substitute MainForm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ActivatedloginForm.Visible = bastard remove poor boy cloistered gun for hire MainForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing entreat mappDB.close() chitchat mappDB .dispose()mappDB = nothing ending crampfish mystical champion NewLoanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewLoanToolStripMenuItem.ClickborrowForm.ShowDialog() death interchangePrivate molar BorrowerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BorrowerToolStripMenuItem.ClickborrowerForm.ShowDialog() kibosh grinderPrivate hit man MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadMe.Text = strApplicationName for ConfigurationManager.AppSettings(client).ToStringdateLabel.Text = System.DateTime.Now.ToString(MMM dd yyyy)loginUserNameLabel.Text = mappDB.UserNameloginsinceLabel.Text = System.DateTime.Now.ToString(MMM dd yyyy hhmm tt)filtercriteriaComboBox. shootedIndex = 1With glSum constitutionalDataGridView.ReadOnly = straight.Rows.Add() .Rows.Add() .Rows.Add().Item(0, 0).Value = Total Cr.Item(0, 1).Value = Total Dr.Item(0, 2).Value = offset .Columns(0).Width = 550.Columns(1).Width = 150.Cursor = Cursors.Hand. involveionMode = DataGridViewSelectionMode.FullRowSelect closing curtain WithEnd SubPrivate Sub searchfilterButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchfilterButton.ClickMe.Cursor = Cursors.WaitCursorgridFilter._sql = SELECT pk_borrowerID,lastname as Last name,firstname as First Name FROM tblborrowergridFilter._orderBy = entrap BY lastnameSelect Case filtercriteriaComboBox.SelectedIndexCase 0 firstnamegridFilter._criteria = WHERE firstname alike(p) filtervalueTextBox.Text %Case 1 lastnamegridFilter._criteria = WHERE lastname like filtervalueTextBox.Text %Case 2 companygridFilter._criteria = WHERE company like filtervalueTextBox.Text %End SelectCall fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, searchBrDataGridView, lawful)Me.Cursor = Cursors.DefaultEnd SubPrivate Sub refreshGLSumToolStripButton_Click(ByVal sender As System.Object, By Val e As System.EventArgs) Handles glsum_refreshToolStripButton.ClickMe.Cursor = Cursors.WaitCursorgridFilter._sql = SELECT fk_borrowerid,fullname as Borrower Name,sumofcr as Sum of Cr, sumofdr as Sum of Dr, rest period FROM qGLsummary If Not incZeroBalToolStripButton.Checked ThengridFilter._criteria = ElsegridFilter._criteria = WHERE counterweight 0 End IfgridFilter._orderBy = say BY Fullname Call fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, glSumDataGridView, straightforward, bsGLSummary)glsumRowCountToolStripLabel.Text = of glSumDataGridView.Rows.Count 1Call firstToolStripButton_Click(sender, e)Call glsum_totals()Me.Cursor = Cursors.DefaultCall TotalOfGLSum()End SubPrivate Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drtotalal_glsumLabel.ClickEnd SubPrivate Sub viewGLSummaryToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles glsum_openToolStripButton.Click extendMe.Cu rsor = Cursors.WaitCursorCall TabControl1.SelectTab(1)gridFilter._sql = Select pk_mloanid , pk_loanref as Loan Ref,isactive as Active, Dated FROM tblloanmaster gridFilter._orderBy = modulate BY dated DESC gridFilter._criteria = WHERE fk_borrowerid= glSumDataGridView(0, glSumDataGridView.CurrentRow.Index).Value.ToStringCall fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, brloanlistDataGridView, True)brloanlistDataGridView.Columns(2).Width = 40brloanlistDataGridView.Columns(3).Width = 40brloanlistDataGridView.Columns(3).DefaultCellStyle.Format = MMM dd yyyybrNameToolStripLabel.Text = glSumDataGridView(1, glSumDataGridView.CurrentRow.Index).Value.ToString full generalledgerDataGridView.DataSource = energy gull ex As ExceptionCall showError(ex.Message.ToString)FinallyMe.Cursor = Cursors.DefaultEnd find outEnd SubPrivate Sub borrowerDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles s earchBrDataGridView.CellContentClickEnd SubPrivate Sub borrowerDataGridView_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles searchBrDataGridView.CellDoubleClickgridFilter._sql = SELECT fk_borrowerid,fullname as Borrower Name,sumofcr as Sum of Cr, sumofdr as Sum of Dr, Balance FROM qGLsummary gridFilter._criteria = WHERE fk_borrowerid = searchBrDataGridView(0, searchBrDataGridView.CurrentRow.Index).Value.ToStringgridFilter._orderBy = ORDER BY Fullname Call fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, glSumDataGridView, True)Call TotalOfGLSum()Call glsum_totals()End SubPrivate Sub borrowerloanDataGridView_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles brloanlistDataGridView.CellContentDoubleClickEnd SubPrivate Sub generalledgersummaryDataGridView_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventAr gs) Handles glSumDataGridView.CellDoubleClickCall viewGLSummaryToolStripButton1_Click(sender, e)End SubPrivate Sub upd_newToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_newToolStripButton.ClickTryupd_datedDateTimePicker.Value = Nowupd_ToComboBox.SelectedIndex = 1upd_isactiveCheckBox.Checked = TrueCall combolist(SELECT pk_accntID,pk_code FROM tblaccount ORDER BY description, pk_accntid, pk_code, upd_AccntComboBox)Call upd_AccntComboBox_SelectionChangeCommitted(sender, e)upd_AmtNumericUpDown.Value = 0upd_next overduedateDateTimePicker.Value = DateAdd(DateInterval.Month, 1, CType(duedateTextBox.Text.ToString, Date))upd_ spatial relationComboBox.SelectedIndex = 0Call toggleOnUpdate() gravel ex As ExceptionCall showError(ex.ToString)End TryEnd SubPrivate Sub upd_editToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upd_editToolStripButton.ClickTryDim a As Integer = brloanDetailsDataGridView.CurrentRow.IndexCa ll combolist(SELECT pk_accntID,pk_code FROM tblaccount ORDER BY description, pk_accntid, pk_code, upd_AccntComboBox)Call toggleOnUpdate()With brloanDetailsDataGridViewupd_recidLabel.Text = .Item(0, a).Value.ToStringupd_AccntComboBox.Text = .Item(1, a).Value.ToStringupd_datedDateTimePicker.Value = CType(.Item(2, a).Value, Date)If CType(.Item(3, a).Value, Double) 0 Then entry is Crupd_ToComboBox.Text = Crupd_AmtNumericUpDown.Value = CType(.Item(3, a).Value, Decimal)Elseupd_ToComboBox.Text = Drupd_AmtNumericUpDown.Value = CType(.Item(4, a).Value, Decimal)End Ifupd_nextduedateDateTimePicker.Value = CType(duedateTextBox.Text.ToString, Date)upd_isactiveCheckBox.Checked = isactiveCheckBox.CheckedEnd WithCatch ex As ExceptionIf Err.Number = 91 ThenCall showError(Please click entry in General book Details and click edit.)ElseCall showError(Err.Number ex.Message)End IfEnd TryEnd SubPrivate Sub upd_applyToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Han dles upd_applyToolStripButton.ClickIf Not IsNumeric(upd_recidLabel.Text) ThenMessageBox.Show(Please select entry from GL Details. Click OK to continue., strApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information) issue SubEnd IfIf upd_AmtNumericUpDown.Value = 0 ThenCall showError(Enter amount value.) go across SubEnd IfDim i As Integer, _PostAmountTo As String = String.EmptyIf MessageBox.Show(Are all entries correct?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes ThenTryIf upd_ToComboBox.Text.ToUpper = DR Then _PostAmountTo = dr Else _PostAmountTo = CrIf upd_recidLabel.Text = 0 ThencmdLocal = New OleDbCommand(INSERT INTO tblloandetails(fk_mloanid,fk_accntid,dated, _PostAmountTo ) VALUES(fk_mloanid,fk_accntid,dated,amt), mappDB.conn)ElsecmdLocal = New OleDbCommand(UPDATE tblloandetails SET emailprotected_mloanid,emailprotected_accntid,emailprotected, _PostAmountTo emailprotected WHERE pk_dloanid= upd_recidLabel.T ext.ToString, mappDB.conn)End IfWith cmdLocal.Parameters.Add(fk_mloanid, OleDbType.Integer, 0, fk_mloanid).Value = recIDLabel.Text.Add(fk_accntid, OleDbType.Integer, 0, fk_accntid).Value = upd_AccntComboBox.SelectedValue.Add(dated, OleDbType.Date, 0, dated).Value = upd_datedDateTimePicker.Value.ToString(MMM/dd/yyyy).Add(amt, OleDbType.Decimal, 0, _PostAmountTo).Value = upd_AmtNumericUpDown.ValueEnd Withi = cmdLocal.ExecuteNonQuerygridFilter._sql = SELECT pk_dloanid,pk_code as Particular,Dated,Cr,Dr FROM qloandetails gridFilter._criteria = WHERE fk_mloanid = brloanlistDataGridView(0, brloanlistDataGridView.CurrentRow.Index).Value.ToStringgridFilter._orderBy = ORDER BY dated,pk_dloanid Call fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, brloanDetailsDataGridView, True)Call gldetails_totals()blIsActiveLoan = infatuatedFor i = 0 To brLoanDetailsSumDataGridView.Rows.Count 1If CType(brLoanDetailsSumDataGridView.Item(4, i).Value, Double) 0 ThenblIsActiveLoan = TrueExit ForEnd If coterminouscmdLocal = New OleDbCommand(UPDATE tblloanmaster SET emailprotected WHERE pk_mloanid= recIDLabel.Text.ToString, mappDB.conn)With cmdLocal.Parameters.Add(isactive, OleDbType.Boolean, 0, isactive).Value = blIsActiveLoanEnd WithcmdLocal.ExecuteNonQuery()brloanlistDataGridView.Item(2, brloanlistDataGridView.CurrentRow.Index).Value = blIsActiveLoanend status checkIf blIsActiveLoan And MessageBox.Show(Update due date?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Thenupdate loan due datecmdLocal = New OleDbCommand(UPDATE tblloanmaster SET emailprotected WHERE pk_mloanid= recIDLabel.Text.ToString, mappDB.conn)With cmdLocal.Parameters.Add(duedate, OleDbType.Date, 0, duedate).Value = upd_nextduedateDateTimePicker.Value.ToString(MMM dd yyyy)End WithcmdLocal.ExecuteNonQuery()End IfCall toggleOnUpdate()MessageBox.Show(brNameToolStripLabel.Text.ToUpper general ledger update success. Click OK to continue., strApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information)Catch ex As ExceptionCall showError(ex.ToString)Finallyi = NothingcmdLocal = NothingmappDB.close()End TryEnd IfEnd SubPrivate Sub gldetails_totals()With brloanDetailsDataGridView.Columns(2).DefaultCellStyle.Format = MMM dd yyyy.Columns(3).Width = 80.Columns(3).DefaultCellStyle.Format = 0,0.00.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight.Columns(4).Width = 80.Columns(4).DefaultCellStyle.Format = 0,0.00.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightEnd WithgridFilter._sql = SELECT fk_mloanid,pk_code as Particular, sumofcr as Cr, sumofDr as Dr,Balance FROM qloandetailssum gridFilter._criteria = WHERE fk_mloanid = brloanlistDataGridView(0, brloanlistDataGridView.CurrentRow.Index).Value.ToStringgridFilter._orderBy = Call fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, brLoanDetailsSumDataGridView, True)With brLoanDetailsSumDa taGridView.Columns(2).DefaultCellStyle.Format = MMM dd yyyyFor i As Integer = 2 To 4.Columns(i).Width = 80.Columns(i).DefaultCellStyle.Format = 0,0.00.Columns(i).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight contiguousEnd WithEnd SubPrivate Sub glsum_totals()Dim _totalCr As Double = 0Dim _totalDr As Double = 0TryFor i As Integer = 0 To glSumDataGridView.Rows.Count 1_totalCr += CType(glSumDataGridView.Item(2, i).Value, Double)_totalDr += CType(glSumDataGridView.Item(3, i).Value, Double)NextCatchEnd TryTryadd grid formattingWith glSumDataGridView.Columns(1).Width = 350.Columns(2).DefaultCellStyle.Format = 0,0.00.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight.Columns(3).DefaultCellStyle.Format = 0,0.00.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight.Columns(4).DefaultCellStyle.Format = 0,0.00.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightEnd WithWith glSumTotalD ataGridView.Item(1, 0).Value = FormatNumber(_totalCr, 2).Item(1, 1).Value = FormatNumber(_totalDr, 2).Item(1, 2).Value = FormatNumber(_totalCr _totalDr, 2).Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightEnd WithCatch ex As ExceptionCall showError(ex.Message)End TryEnd SubPrivate Sub upd_calcToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_calcToolStripButton.ClickTrySystem.Diagnostics.Process.Start(calc)Catch ex As ExceptionCall showError(ex.ToString)End TryEnd SubSub haltKeys(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles datedTextBox.KeyPress, duedateTextBox.KeyPress, _comakerTextBox.KeyPress, remarkTextBox.KeyPress, payableTextBox.KeyPress, monthlyintTextBox.KeyPress, monthlypenaltyTextBox.KeyPress, _principalTextBox.KeyPress, monthlyintTextBox.KeyPress, monthlypenaltyTextBox.KeyPresse.Handled = TrueEnd SubPrivate Sub export_glsumToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles glsum_exportToolStripButton.ClickIf (glSumDataGridView.Rows.Count 1) Dim h As Integer = 0, r As Integer = 4excelApp = New Excel.ApplicationexcelWB = excelApp.Workbooks.Open(Application.StartupPath templatesglsummary.xlt)excelWS = CType(excelWB.Sheets(1), Excel.Worksheet)With excelWSFor h = 0 To glSumDataGridView.Rows.Count 1r = h + 4 4 is the base row.Cells(r, 1) = h + 1 sn.Cells(r, 2) = glSumDataGridView.Item(1, h).Value.ToString.Cells(r, 3) = glSumDataGridView.Item(2, h).Value.ToString.Cells(r, 4) = glSumDataGridView.Item(3, h).Value.ToString.Cells(r, 5) = glSumDataGridView.Item(4, h).Value.ToStringNextbalance.Cells(6, ExcelColumns.colE) = =C r -D rr += 1.Cells(r, ExcelColumns.colC) = =SUM(C4C r 1 ) Cr total.Cells(r, ExcelColumns.colD) = =SUM(D4D r 1 ) Dr Total.Cells(r, ExcelColumns.colE) = =C r -D r Balance Total.Cells(r, ExcelColumns.colA) = Total.Range(A r B r).Merge().Range(A r).HorizontalAlignment = -4131End WithCall drawBord er(A4E r)excelApp.Visible = Trueclean up variablesh = NothingexcelWS = NothingexcelWB = NothingexcelApp = NothingEnd SubPrivate Sub gl_viewToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gldetails_viewToolStripButton.ClickIf (brloanDetailsDataGridView.Rows.Count 1) Dim h As Integer = 0, r As Integer = 0Dim s As String = String.EmptyexcelApp = New Excel.ApplicationexcelWB = excelApp.Workbooks.Open(Application.StartupPath templatesgldetails.xlt)excelWS = CType(excelWB.Sheets(1), Excel.Worksheet)With excelWS.Cells(3, ExcelColumns.colC) = brNameToolStripLabel.Text.ToString.Cells(4, ExcelColumns.colC) = loanRefLabel.Text.ToString.Cells(5, ExcelColumns.colC) = datedTextBox.Text.ToString.Cells(3, ExcelColumns.colG) = principalTextBox.Text.ToString.Cells(4, ExcelColumns.colG) = monthlyintTextBox.Text.ToString.Cells(5, ExcelColumns.colG) = monthlypenaltyTextBox.Text.ToStringFor h = 0 To brloanDetailsDataGridView.Rows.Count 1r = h + 9 is the base row.Cells(r, ExcelColumns.colA) = h + 1 sn.Cells(r, ExcelColumns.colB) = brloanDetailsDataGridView.Item(1, h).Value.ToString.Cells(r, ExcelColumns.colD) = CType(brloanDetailsDataGridView.Item(2, h).Value.ToString, Date).ToString(MMM dd yyyy).Cells(r, ExcelColumns.colE) = brloanDetailsDataGridView.Item(3, h).Value.ToString cr.Cells(r, ExcelColumns.colF) = brloanDetailsDataGridView.Item(4, h).Value.ToString drbalance colIf r 10 Then .Cells(r, ExcelColumns.colG) = =G (r 1) +E r -F rNextr += 1balance.Cells(6, ExcelColumns.colG) = =E r -F r.Cells(r, ExcelColumns.colE) = =SUM(E8E r 1 ).Cells(r, ExcelColumns.colF) = =SUM(F8F r 1 ).Cells(r, ExcelColumns.colG) = =E r -F r.Cells(r, ExcelColumns.colA) = Total.Range(A r D r).Merge().Range(A r).HorizontalAlignment = -4131End WithCall drawBorder(A10G r)excelApp.Visible = Trueh = NothingexcelWS = NothingexcelWB = NothingexcelApp = NothingEnd SubPrivate Sub what_accntButton_Click(ByVal sender As System.Object, ByVal e As Sys tem.EventArgs) Handles what_accntButton.ClickTrycmdLocal = New OleDbCommand(SELECT description from tblaccount WHERE pk_accntID= upd_AccntComboBox.SelectedValue.ToString, mappDB.conn)Dim rd As OleDbDataReader = cmdLocal.ExecuteReaderrd.Read()If rd.HasRows Then MessageBox.Show(upd_AccntComboBox.Text = rd(0).ToString . Click OK to continue., strApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information)rd = NothingcmdLocal = NothingCatchEnd TryEnd SubPrivate Sub AccountToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AccountToolStripMenuItem.ClickrptAccountForm.ShowDialog()End SubSub toggleOnUpdate()brloanlistDataGridView.Enabled = Not brloanlistDataGridView.EnabledbrloanDetailsDataGridView.Enabled = Not brloanDetailsDataGridView.Enabledupd_newToolStripButton.Enabled = Not upd_newToolStripButton.Enabledupd_editToolStripButton.Enabled = Not upd_editToolStripButton.Enabledupd_applyToolStripButton.Enabled = Not upd_applyToolStripBut ton.Enabledupd_ partToolStripButton.Enabled = Not upd_cancelToolStripButton.EnabledEnd SubPrivate Sub upd_cancelToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_cancelToolStripButton.ClickIf MessageBox.Show(Cancel update?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Thenupd_recidLabel.Text = 0Call toggleOnUpdate()End IfEnd SubPrivate Sub borrowerloanDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles brloanlistDataGridView.CellContentClickEnd SubPrivate Sub TabControl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.ClickIf upd_applyToolStripButton.Enabled = True ThenMessageBox.Show(Please complete updating/cancel GL of brNameToolStripLabel.Text.ToUpper . Click OK to continue., strApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information)TabControl1.SelectedIndex = 1End IfEnd SubPrivate Sub DueDateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DueDateToolStripMenuItem.ClickrptDueDateForm.ShowDialog()End SubPrivate Sub rptBorrowerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rptBorrowerToolStripMenuItem.ClickMe.Cursor = Cursors.WaitCursorDim r As Integer = 4excelApp = New Excel.ApplicationexcelWB = excelApp.Workbooks.Open(Application.StartupPath templatesborrower.xlt)excelWS = CType(excelWB.Sheets(1), Excel.Worksheet)cmdLocal = New OleDbCommand(SELECT * from tblborrower ORDER BY lastname, mappDB.conn)Dim rd As OleDbDataReader = cmdLocal.ExecuteReaderWhile rd.ReadWith excelWS.Cells(r, ExcelColumns.colA) = r 3.Cells(r, ExcelColumns.colB) = rd(lastname).ToString.Cells(r, ExcelColumns.colC) = rd(firstname).ToString.Cells(r, ExcelColumns.colD) = rd(jobtitle).ToString rd(company).ToString.Cells(r, ExcelColumns.colE) = rd(contactnos).ToString.Cells(r, Ex celColumns.colF) = rd(address).ToStringr += 1End WithEnd WhileIf r 4 Then Call drawBorder(A5F r 1)excelApp.Visible = TruemappDB.close()rd = NothingcmdLocal = Nothingr = NothingexcelWS = NothingexcelWB = NothingexcelApp = NothingMe.Cursor = Cursors.DefaultEnd SubPrivate Sub AccountToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AccountToolStripMenuItem1.ClickaccountForm.ShowDialog()End SubPrivate Sub LogOffToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogOffToolStripMenuItem.ClickMe.Visible = FalseloginForm.Show()End SubPrivate Sub borrowerloanDataGridView_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles brloanlistDataGridView.CellEnterDim rd As OleDbDataReaderrecIDLabel.Text = 0TrygridFilter._sql = SELECT pk_dloanid,pk_code as Particular,Dated,Cr,Dr FROM qloandetails gridFilter._criteria = WHERE fk_mloanid = brloanlistDataGridView(0, br loanlistDataGridView.CurrentRow.Index).Value.ToStringgridFilter._orderBy = ORDER BY dated,pk_dloanid Call fillGrid(gridFilter._sql, gridFilter._criteria, gridFilter._orderBy, brloanDetailsDataGridView, True)cmdLocal = New OleDbCommand(SELECT * FROM tblloanmaster WHERE pk_mloanid= brloanlistDataGridView(0, brloanlistDataGridView.CurrentRow.Index).Value.ToString, mappDB.conn)rd = cmdLocal.ExecuteReaderrd.Read()If rd.HasRows ThenrecIDLabel.Text = rd(pk_mloanid).ToStringloanRefLabel.Text = rd(pk_loanref).ToStringdatedTextBox.Text = CType(rd(dated).ToString, Date).ToString(MMM dd yyyy)duedateTextBox.Text = CType(rd(duedate).ToString, Date).ToString(MMM dd yyyy)comakerTextBox.Text = rd(comaker).ToStringremarkTextBox.Text = rd(remark).ToStringprincipalTextBox.Text = FormatNumber(rd(principal).ToString, 2).ToStringmonthlyintTextBox.Text = FormatNumber(rd(interest).ToString, 2).ToStringmonthlypenaltyTextBox.Text = FormatNumber(rd(penalty).ToString, 2).ToStringisactiveCheckBox.Checked = CTy pe(rd(isactive), Boolean)monthInterestNumericUpDown.Value = CType(rd(interest).ToString, Decimal)payableTextBox.Text = FormatNumber(CType(principalTextBox.Text, Double) * (CType(monthlyintTextBox.Text, Double) / 100), 2).ToStringmonthPenaltyNumericUpDown.Value = CType(rd(penalty).ToString, Decimal)End IfCall gldetails_totals()Catch ex As ExceptionCall showError(ex.Message)FinallymappDB.close()rd = NothingEnd TryEnd SubPrivate Sub quitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitToolStripMenuItem.ClickIf MessageBox.Show(Do you really want to quit now?, strApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Application.Exit()End SubPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TicknowToolStripLabel.Text = System.DateTime.Now.ToString(MMM dd yyyy HHmmss tt)End SubPrivate Sub previousToolStripButton_Click(ByVal sender As System.Obje ct, ByVal e As System.EventArgs) Handles previousToolStripButton.ClickbsGLSummary.MovePrevious()End SubPrivate Sub generalledgersummaryDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles glSumDataGridView.CellContentClickEnd SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)brloanDetailsDataGridView.Rows(1).Selected = TrueEnd SubPrivate Sub BackupDatabaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackupDatabaseToolStripMenuItem.ClickEnd SubPrivate Sub ToolStripLabel8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)End SubPrivate Sub upd_isactiveCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_isactiveCheckBox.CheckedChangedEnd SubPrivate Sub upd_isactiveCheckBox_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles upd_isactiveCheckBox .CheckStateChangedEnd SubPrivate Sub upd_isactiveCheckBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upd_isactiveCheckBox.ClickIf upd_ToComboBox.Text.ToUpper = DR Thenupd_isactiveCheckBox.Checked = TrueGoTo closeEnd IfDim x As Double = 0For i As Integer = 0 To brLoanDetailsSumDataGridView.Rows.Count 1x += CType(brLoanDetailsSumDataGridView.Item(2, i).Value, Double)NextIf x upd_AmtNumericUpDown.Value 0 Thenupd_isactiveCheckBox.Checked = TrueGoTo closeEnd IfExit SubcloseMessageBox.Show(Zero balance loan cannot be close., strApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information)End SubPrivate Sub upd_AccntComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_AccntComboBox.SelectedIndexChangedEnd SubPrivate Sub upd_AccntComboBox_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles upd_AccntComboBox.SelectionChangeCommittedretrieve balance of selected accountFor i As In teger = 0 To brLoanDetailsSumDataGridView.Rows.Count 1If brLoanDetailsSumDataGridView.Item(1, i).Value.ToString = upd_AccntComboBox.Text.ToString Thenupd_AmtNumericUpDown.Value = CType(brLoanDetailsSumDataGridView.Item(4, i).Value, Decimal)Exit ForEnd IfNextEnd SubPrivate Sub generalledgersummaryDataGridView_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles glSumDataGridView.CellEnterTryselectedrowindexToolStripTextBox.Text = CStr(e.RowIndex + 1)CatchEnd TryEnd SubPrivate Sub filtervalueTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles filtervalueTextBox.KeyDownIf e.KeyCode = Keys.Enter Then Call searchfilterButton_Click(sender, e)End SubPrivate Sub nextToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles nextToolStripButton.ClickbsGLSummary.MoveNext()End SubPrivate Sub firstToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles fi rstToolStripButton.ClickbsGLSummary.MoveFirst()End SubPrivate Sub lastToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Han
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment