Imports System.Data.SqlClient
Imports System.Windows.Forms
PublicClass frmTransaction
Inherits System.Windows.Forms.Form
ProtectedConst strConnClass AsString = "workstation id=OGUNDIPE;packet size=4096;integrated security=SSPI;data source=OGUNDIPE;persist security info=False;initial catalog=AR"
Protected strCLASSCMD AsString = "SELECT fclasscd, fclassdes As 'class' FROM tblclass"
Protected dvtblclass As DataView
Protected dstblclass AsNew DataSet
ProtectedConst strConnAgent AsString = "workstation id=OGUNDIPE;packet size=4096;integrated security=SSPI;data source=OGUNDIPE;persist security info=False;initial catalog=AR"
Protected strAGENTCMD AsString = "select fagttransno, fagentdes, fagentcd as 'Agent' from tblAgent"
Protected dvtblAgent As DataView
Protected dstblAgent AsNew DataSet
ProtectedConst strConnBranch AsString = "workstation id=OGUNDIPE;packet size=4096;integrated security=SSPI;data source=OGUNDIPE;persist security info=False;initial catalog=AR"
Protected strBRANCHCMD AsString = "select fcono, coname as 'Branch' from tblBranch"
Protected dvtblBranch As DataView
Protected dstblBranch AsNew DataSet
#Region " Windows Form Designer generated code "
PublicSubNew()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
ARSqlConnection.Open()
Dim reader As SqlDataReader
EndSub
'Form overrides dispose to clean up the component list.
ProtectedOverloadsOverridesSub Dispose(ByVal disposing AsBoolean)
If disposing Then
IfNot (components IsNothing) Then
components.Dispose()
EndIf
EndIf
MyBase.Dispose(disposing)
EndSub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
FriendWithEvents lblDataPage1 As System.Windows.Forms.Label
FriendWithEvents lblDataPage2 As System.Windows.Forms.Label
FriendWithEvents lblSno As System.Windows.Forms.Label
FriendWithEvents lblTransType As System.Windows.Forms.Label
FriendWithEvents lblPolicyNo As System.Windows.Forms.Label
FriendWithEvents lblClassCode As System.Windows.Forms.Label
FriendWithEvents lblAccountNo As System.Windows.Forms.Label
FriendWithEvents lblGrossPrem As System.Windows.Forms.Label
FriendWithEvents lblCommDeduc As System.Windows.Forms.Label
FriendWithEvents lblClientName As System.Windows.Forms.Label
FriendWithEvents lblBuzType As System.Windows.Forms.Label
FriendWithEvents lblAddress As System.Windows.Forms.Label
FriendWithEvents lblInsured As System.Windows.Forms.Label
FriendWithEvents lblTransDate As System.Windows.Forms.Label
FriendWithEvents lblParticulars As System.Windows.Forms.Label
FriendWithEvents lblBusLegend As System.Windows.Forms.Label
FriendWithEvents lblAgentCode As System.Windows.Forms.Label
FriendWithEvents txtSNo As System.Windows.Forms.TextBox
FriendWithEvents txtAccountNo As System.Windows.Forms.TextBox
FriendWithEvents txtPolicyNo As System.Windows.Forms.TextBox
FriendWithEvents txtClientName As System.Windows.Forms.TextBox
FriendWithEvents txtGrossPrem As System.Windows.Forms.TextBox
FriendWithEvents txtCommDeduc As System.Windows.Forms.TextBox
FriendWithEvents txtAddress1 As System.Windows.Forms.TextBox
FriendWithEvents txtAddress2 As System.Windows.Forms.TextBox
FriendWithEvents txtInsured As System.Windows.Forms.TextBox
FriendWithEvents txtTransDate As System.Windows.Forms.TextBox
FriendWithEvents cboTransType As System.Windows.Forms.ComboBox
FriendWithEvents cboClassCode As System.Windows.Forms.ComboBox
FriendWithEvents cboAgentCode As System.Windows.Forms.ComboBox
FriendWithEvents AddRec As System.Windows.Forms.Button
FriendWithEvents cmdDeleteRec As System.Windows.Forms.Button
FriendWithEvents FindRec As System.Windows.Forms.Button
FriendWithEvents cmdExitRec As System.Windows.Forms.Button
FriendWithEvents cboBuzType As System.Windows.Forms.ComboBox
FriendWithEvents cboBuzLeg As System.Windows.Forms.ComboBox
FriendWithEvents txtPart1 As System.Windows.Forms.TextBox
FriendWithEvents txtPart2 As System.Windows.Forms.TextBox
FriendWithEvents cboBranchCode As System.Windows.Forms.ComboBox
FriendWithEvents lblBranchCode As System.Windows.Forms.Label
FriendWithEvents cmdModify As System.Windows.Forms.Button
FriendWithEvents ARDataSet As System.Data.DataSet
FriendWithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
FriendWithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
FriendWithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
FriendWithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
FriendWithEvents ARSqlDataAdapter As System.Data.SqlClient.SqlDataAdapter
FriendWithEvents ARSqlCommand As System.Data.SqlClient.SqlCommand
FriendWithEvents ARSqlConnection As System.Data.SqlClient.SqlConnection
<System.Diagnostics.DebuggerStepThrough()> PrivateSub InitializeComponent()
Me.lblDataPage1 = New System.Windows.Forms.Label
Me.lblDataPage2 = New System.Windows.Forms.Label
Me.lblSno = New System.Windows.Forms.Label
Me.lblTransType = New System.Windows.Forms.Label
Me.lblPolicyNo = New System.Windows.Forms.Label
Me.lblClassCode = New System.Windows.Forms.Label
Me.lblAccountNo = New System.Windows.Forms.Label
Me.lblGrossPrem = New System.Windows.Forms.Label
Me.lblCommDeduc = New System.Windows.Forms.Label
Me.lblClientName = New System.Windows.Forms.Label
Me.lblBuzType = New System.Windows.Forms.Label
Me.lblAddress = New System.Windows.Forms.Label
Me.lblInsured = New System.Windows.Forms.Label
Me.lblTransDate = New System.Windows.Forms.Label
Me.lblParticulars = New System.Windows.Forms.Label
Me.lblBusLegend = New System.Windows.Forms.Label
Me.lblAgentCode = New System.Windows.Forms.Label
Me.txtSNo = New System.Windows.Forms.TextBox
Me.txtAccountNo = New System.Windows.Forms.TextBox
Me.txtPolicyNo = New System.Windows.Forms.TextBox
Me.txtClientName = New System.Windows.Forms.TextBox
Me.txtGrossPrem = New System.Windows.Forms.TextBox
Me.txtCommDeduc = New System.Windows.Forms.TextBox
Me.txtAddress1 = New System.Windows.Forms.TextBox
Me.txtAddress2 = New System.Windows.Forms.TextBox
Me.txtInsured = New System.Windows.Forms.TextBox
Me.txtTransDate = New System.Windows.Forms.TextBox
Me.txtPart1 = New System.Windows.Forms.TextBox
Me.txtPart2 = New System.Windows.Forms.TextBox
Me.cboTransType = New System.Windows.Forms.ComboBox
Me.cboClassCode = New System.Windows.Forms.ComboBox
Me.cboBuzType = New System.Windows.Forms.ComboBox
Me.cboBuzLeg = New System.Windows.Forms.ComboBox
Me.cboAgentCode = New System.Windows.Forms.ComboBox
Me.AddRec = New System.Windows.Forms.Button
Me.cmdDeleteRec = New System.Windows.Forms.Button
Me.FindRec = New System.Windows.Forms.Button
Me.cmdExitRec = New System.Windows.Forms.Button
Me.cboBranchCode = New System.Windows.Forms.ComboBox
Me.lblBranchCode = New System.Windows.Forms.Label
Me.cmdModify = New System.Windows.Forms.Button
Me.ARDataSet = New System.Data.DataSet
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.ARSqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter
Me.ARSqlCommand = New System.Data.SqlClient.SqlCommand
Me.ARSqlConnection = New System.Data.SqlClient.SqlConnection
CType(Me.ARDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblDataPage1
'
Me.lblDataPage1.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblDataPage1.Location = New System.Drawing.Point(128, 8)
Me.lblDataPage1.Name = "lblDataPage1"
Me.lblDataPage1.Size = New System.Drawing.Size(456, 24)
Me.lblDataPage1.TabIndex = 0
Me.lblDataPage1.Text = "DATA ENTRY FILE MAINTENANCE"
'
'lblDataPage2
'
Me.lblDataPage2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblDataPage2.Location = New System.Drawing.Point(128, 40)
Me.lblDataPage2.Name = "lblDataPage2"
Me.lblDataPage2.Size = New System.Drawing.Size(424, 24)
Me.lblDataPage2.TabIndex = 1
Me.lblDataPage2.Text = "DR NOTE, CR NOTE, RECEIPTS AND COMMISSION VOUCHERS"
'
'lblSno
'
Me.lblSno.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblSno.Location = New System.Drawing.Point(0, 72)
Me.lblSno.Name = "lblSno"
Me.lblSno.TabIndex = 2
Me.lblSno.Text = "S/No"
'
'lblTransType
'
Me.lblTransType.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblTransType.Location = New System.Drawing.Point(0, 104)
Me.lblTransType.Name = "lblTransType"
Me.lblTransType.TabIndex = 5
Me.lblTransType.Text = "Trans.Type"
'
'lblPolicyNo
'
Me.lblPolicyNo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblPolicyNo.Location = New System.Drawing.Point(0, 128)
Me.lblPolicyNo.Name = "lblPolicyNo"
Me.lblPolicyNo.TabIndex = 7
Me.lblPolicyNo.Text = "Policy No"
'
'lblClassCode
'
Me.lblClassCode.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblClassCode.Location = New System.Drawing.Point(344, 96)
Me.lblClassCode.Name = "lblClassCode"
Me.lblClassCode.Size = New System.Drawing.Size(120, 16)
Me.lblClassCode.TabIndex = 9
Me.lblClassCode.Text = "Class Code"
'
'lblAccountNo
'
Me.lblAccountNo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblAccountNo.Location = New System.Drawing.Point(344, 128)
Me.lblAccountNo.Name = "lblAccountNo"
Me.lblAccountNo.Size = New System.Drawing.Size(120, 16)
Me.lblAccountNo.TabIndex = 11
Me.lblAccountNo.Text = "Account No"
'
'lblGrossPrem
'
Me.lblGrossPrem.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblGrossPrem.Location = New System.Drawing.Point(344, 160)
Me.lblGrossPrem.Name = "lblGrossPrem"
Me.lblGrossPrem.Size = New System.Drawing.Size(120, 16)
Me.lblGrossPrem.TabIndex = 13
Me.lblGrossPrem.Text = "Gross Premium"
'
'lblCommDeduc
'
Me.lblCommDeduc.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblCommDeduc.Location = New System.Drawing.Point(344, 192)
Me.lblCommDeduc.Name = "lblCommDeduc"
Me.lblCommDeduc.Size = New System.Drawing.Size(120, 16)
Me.lblCommDeduc.TabIndex = 15
Me.lblCommDeduc.Text = "Comm.Deductible"
'
'lblClientName
'
Me.lblClientName.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblClientName.Location = New System.Drawing.Point(0, 160)
Me.lblClientName.Name = "lblClientName"
Me.lblClientName.TabIndex = 17
Me.lblClientName.Text = "Name of Client"
'
'lblBuzType
'
Me.lblBuzType.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblBuzType.Location = New System.Drawing.Point(0, 192)
Me.lblBuzType.Name = "lblBuzType"
Me.lblBuzType.TabIndex = 19
Me.lblBuzType.Text = "Buz. Type"
'
'lblAddress
'
Me.lblAddress.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblAddress.Location = New System.Drawing.Point(0, 224)
Me.lblAddress.Name = "lblAddress"
Me.lblAddress.TabIndex = 21
Me.lblAddress.Text = "Address"
'
'lblInsured
'
Me.lblInsured.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblInsured.Location = New System.Drawing.Point(0, 280)
Me.lblInsured.Name = "lblInsured"
Me.lblInsured.TabIndex = 23
Me.lblInsured.Text = "Insured"
'
'lblTransDate
'
Me.lblTransDate.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblTransDate.Location = New System.Drawing.Point(0, 312)
Me.lblTransDate.Name = "lblTransDate"
Me.lblTransDate.TabIndex = 25
Me.lblTransDate.Text = "Trans.Date"
'
'lblParticulars
'
Me.lblParticulars.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblParticulars.Location = New System.Drawing.Point(0, 344)
Me.lblParticulars.Name = "lblParticulars"
Me.lblParticulars.TabIndex = 27
Me.lblParticulars.Text = "Particulars"
'
'lblBusLegend
'
Me.lblBusLegend.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblBusLegend.Location = New System.Drawing.Point(0, 400)
Me.lblBusLegend.Name = "lblBusLegend"
Me.lblBusLegend.Size = New System.Drawing.Size(112, 23)
Me.lblBusLegend.TabIndex = 29
Me.lblBusLegend.Text = "Business Legend"
'
'lblAgentCode
'
Me.lblAgentCode.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblAgentCode.Location = New System.Drawing.Point(0, 432)
Me.lblAgentCode.Name = "lblAgentCode"
Me.lblAgentCode.TabIndex = 31
Me.lblAgentCode.Text = "Agent Code"
'
'txtSNo
'
Me.txtSNo.Location = New System.Drawing.Point(112, 72)
Me.txtSNo.Name = "txtSNo"
Me.txtSNo.TabIndex = 32
Me.txtSNo.Text = ""
'
'txtAccountNo
'
Me.txtAccountNo.Location = New System.Drawing.Point(480, 128)
Me.txtAccountNo.Name = "txtAccountNo"
Me.txtAccountNo.TabIndex = 33
Me.txtAccountNo.Text = ""
'
'txtPolicyNo
'
Me.txtPolicyNo.Location = New System.Drawing.Point(112, 128)
Me.txtPolicyNo.Name = "txtPolicyNo"
Me.txtPolicyNo.TabIndex = 34
Me.txtPolicyNo.Text = ""
'
'txtClientName
'
Me.txtClientName.Location = New System.Drawing.Point(112, 160)
Me.txtClientName.Name = "txtClientName"
Me.txtClientName.TabIndex = 35
Me.txtClientName.Text = ""
'
'txtGrossPrem
'
Me.txtGrossPrem.Location = New System.Drawing.Point(480, 160)
Me.txtGrossPrem.Name = "txtGrossPrem"
Me.txtGrossPrem.TabIndex = 36
Me.txtGrossPrem.Text = ""
'
'txtCommDeduc
'
Me.txtCommDeduc.Location = New System.Drawing.Point(480, 192)
Me.txtCommDeduc.Name = "txtCommDeduc"
Me.txtCommDeduc.TabIndex = 37
Me.txtCommDeduc.Text = ""
'
'txtAddress1
'
Me.txtAddress1.Location = New System.Drawing.Point(112, 224)
Me.txtAddress1.Name = "txtAddress1"
Me.txtAddress1.Size = New System.Drawing.Size(296, 20)
Me.txtAddress1.TabIndex = 38
Me.txtAddress1.Text = ""
'
'txtAddress2
'
Me.txtAddress2.Location = New System.Drawing.Point(112, 248)
Me.txtAddress2.Name = "txtAddress2"
Me.txtAddress2.Size = New System.Drawing.Size(296, 20)
Me.txtAddress2.TabIndex = 39
Me.txtAddress2.Text = ""
'
'txtInsured
'
Me.txtInsured.Location = New System.Drawing.Point(112, 280)
Me.txtInsured.Name = "txtInsured"
Me.txtInsured.Size = New System.Drawing.Size(248, 20)
Me.txtInsured.TabIndex = 40
Me.txtInsured.Text = ""
'
'txtTransDate
'
Me.txtTransDate.Location = New System.Drawing.Point(112, 312)
Me.txtTransDate.Name = "txtTransDate"
Me.txtTransDate.Size = New System.Drawing.Size(96, 20)
Me.txtTransDate.TabIndex = 41
Me.txtTransDate.Text = ""
'
'txtPart1
'
Me.txtPart1.Location = New System.Drawing.Point(112, 344)
Me.txtPart1.Name = "txtPart1"
Me.txtPart1.Size = New System.Drawing.Size(296, 20)
Me.txtPart1.TabIndex = 42
Me.txtPart1.Text = ""
'
'txtPart2
'
Me.txtPart2.Location = New System.Drawing.Point(112, 368)
Me.txtPart2.Name = "txtPart2"
Me.txtPart2.Size = New System.Drawing.Size(296, 20)
Me.txtPart2.TabIndex = 43
Me.txtPart2.Text = ""
'
'cboTransType
'
Me.cboTransType.Items.AddRange(NewObject() {"DBN", "CRN", "RCP", "PMT"})
Me.cboTransType.Location = New System.Drawing.Point(112, 96)
Me.cboTransType.Name = "cboTransType"
Me.cboTransType.Size = New System.Drawing.Size(160, 21)
Me.cboTransType.TabIndex = 44
'
'cboClassCode
'
Me.cboClassCode.Location = New System.Drawing.Point(480, 96)
Me.cboClassCode.Name = "cboClassCode"
Me.cboClassCode.Size = New System.Drawing.Size(200, 21)
Me.cboClassCode.TabIndex = 45
'
'cboBuzType
'
Me.cboBuzType.Items.AddRange(NewObject() {"DRCT", "ACPT", "CO-IN"})
Me.cboBuzType.Location = New System.Drawing.Point(112, 192)
Me.cboBuzType.Name = "cboBuzType"
Me.cboBuzType.Size = New System.Drawing.Size(160, 21)
Me.cboBuzType.TabIndex = 46
'
'cboBuzLeg
'
Me.cboBuzLeg.Items.AddRange(NewObject() {"EXS", "ADD", "NEW"})
Me.cboBuzLeg.Location = New System.Drawing.Point(112, 400)
Me.cboBuzLeg.Name = "cboBuzLeg"
Me.cboBuzLeg.Size = New System.Drawing.Size(160, 21)
Me.cboBuzLeg.TabIndex = 47
'
'cboAgentCode
'
Me.cboAgentCode.Location = New System.Drawing.Point(112, 432)
Me.cboAgentCode.Name = "cboAgentCode"
Me.cboAgentCode.Size = New System.Drawing.Size(216, 21)
Me.cboAgentCode.TabIndex = 48
'
'AddRec
'
Me.AddRec.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.AddRec.Location = New System.Drawing.Point(40, 472)
Me.AddRec.Name = "AddRec"
Me.AddRec.Size = New System.Drawing.Size(96, 32)
Me.AddRec.TabIndex = 49
Me.AddRec.Text = "Add Record"
'
'cmdDeleteRec
'
Me.cmdDeleteRec.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdDeleteRec.Location = New System.Drawing.Point(416, 472)
Me.cmdDeleteRec.Name = "cmdDeleteRec"
Me.cmdDeleteRec.Size = New System.Drawing.Size(96, 32)
Me.cmdDeleteRec.TabIndex = 50
Me.cmdDeleteRec.Text = "Delete Record"
'
'FindRec
'
Me.FindRec.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FindRec.Location = New System.Drawing.Point(160, 472)
Me.FindRec.Name = "FindRec"
Me.FindRec.Size = New System.Drawing.Size(96, 32)
Me.FindRec.TabIndex = 51
Me.FindRec.Text = "Find Record"
'
'cmdExitRec
'
Me.cmdExitRec.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdExitRec.Location = New System.Drawing.Point(544, 472)
Me.cmdExitRec.Name = "cmdExitRec"
Me.cmdExitRec.Size = New System.Drawing.Size(96, 32)
Me.cmdExitRec.TabIndex = 52
Me.cmdExitRec.Text = "Exit"
'
'cboBranchCode
'
Me.cboBranchCode.Location = New System.Drawing.Point(448, 432)
Me.cboBranchCode.Name = "cboBranchCode"
Me.cboBranchCode.Size = New System.Drawing.Size(208, 21)
Me.cboBranchCode.TabIndex = 54
'
'lblBranchCode
'
Me.lblBranchCode.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblBranchCode.Location = New System.Drawing.Point(328, 432)
Me.lblBranchCode.Name = "lblBranchCode"
Me.lblBranchCode.Size = New System.Drawing.Size(192, 16)
Me.lblBranchCode.TabIndex = 53
Me.lblBranchCode.Text = "Branch Code"
'
'cmdModify
'
Me.cmdModify.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdModify.Location = New System.Drawing.Point(280, 472)
Me.cmdModify.Name = "cmdModify"
Me.cmdModify.Size = New System.Drawing.Size(112, 32)
Me.cmdModify.TabIndex = 55
Me.cmdModify.Text = "Modify Record"
'
'ARDataSet
'
Me.ARDataSet.DataSetName = "NewDataSet"
Me.ARDataSet.Locale = New System.Globalization.CultureInfo("en-US")
'
'ARSqlDataAdapter
'
Me.ARSqlDataAdapter.DeleteCommand = Me.SqlDeleteCommand1
Me.ARSqlDataAdapter.InsertCommand = Me.SqlInsertCommand1
Me.ARSqlDataAdapter.SelectCommand = Me.SqlSelectCommand1
Me.ARSqlDataAdapter.UpdateCommand = Me.SqlUpdateCommand1
'
'ARSqlConnection
'
Me.ARSqlConnection.ConnectionString = "workstation id=OGUNDIPE;packet size=4096;integrated security=SSPI;data source=OGU" & _
"NDIPE;persist security info=False;initial catalog=AR"
'
'frmTransaction
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(688, 510)
Me.Controls.Add(Me.cmdModify)
Me.Controls.Add(Me.cboBranchCode)
Me.Controls.Add(Me.lblBranchCode)
Me.Controls.Add(Me.cmdExitRec)
Me.Controls.Add(Me.FindRec)
Me.Controls.Add(Me.cmdDeleteRec)
Me.Controls.Add(Me.AddRec)
Me.Controls.Add(Me.cboAgentCode)
Me.Controls.Add(Me.cboBuzLeg)
Me.Controls.Add(Me.cboBuzType)
Me.Controls.Add(Me.cboClassCode)
Me.Controls.Add(Me.cboTransType)
Me.Controls.Add(Me.txtPart2)
Me.Controls.Add(Me.txtPart1)
Me.Controls.Add(Me.txtTransDate)
Me.Controls.Add(Me.txtInsured)
Me.Controls.Add(Me.txtAddress2)
Me.Controls.Add(Me.txtAddress1)
Me.Controls.Add(Me.txtCommDeduc)
Me.Controls.Add(Me.txtGrossPrem)
Me.Controls.Add(Me.txtClientName)
Me.Controls.Add(Me.txtPolicyNo)
Me.Controls.Add(Me.txtAccountNo)
Me.Controls.Add(Me.txtSNo)
Me.Controls.Add(Me.lblAgentCode)
Me.Controls.Add(Me.lblBusLegend)
Me.Controls.Add(Me.lblParticulars)
Me.Controls.Add(Me.lblTransDate)
Me.Controls.Add(Me.lblInsured)
Me.Controls.Add(Me.lblAddress)
Me.Controls.Add(Me.lblBuzType)
Me.Controls.Add(Me.lblClientName)
Me.Controls.Add(Me.lblCommDeduc)
Me.Controls.Add(Me.lblGrossPrem)
Me.Controls.Add(Me.lblAccountNo)
Me.Controls.Add(Me.lblClassCode)
Me.Controls.Add(Me.lblPolicyNo)
Me.Controls.Add(Me.lblTransType)
Me.Controls.Add(Me.lblSno)
Me.Controls.Add(Me.lblDataPage2)
Me.Controls.Add(Me.lblDataPage1)
Me.Name = "frmTransaction"
Me.Text = "Form1"
CType(Me.ARDataSet, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
EndSub
#EndRegion
' Add Record
PrivateSub AddRec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddRec.Click
'Try
'Return current system date
Dim txtdate AsDate
txtdate = Today
' txtdate = Date.Now.ToString
'The following codes is just to guide me in future in respect of date
'This(moment = Now) 'assign current sytem date and time
'MessageBox.Show("The current system is " & DaARring)
Dim strMessage AsString
'ensure first and last name input
If Trim(txtSNo.Text <> "" AndAlso txtClientName.Text <> "" AndAlso txtPolicyNo.Text <> "") Then
'To check date validity
If txtTransDate.Text < #1/1/1992# Then
MessageBox.Show("Please enter the correct date", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
ElseIfNot IsNumeric(txtGrossPrem.Text) Then
strMessage = "Please enter numeric values in Gross premium fields"
MessageBox.Show(strMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
ElseIfNot IsNumeric(txtCommDeduc.Text) Then
MessageBox.Show("Please enter numeric values in Commission fields", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Dim dReader As System.Data.SqlClient.SqlDataReader
ARSqlDataAdapter.SelectCommand.CommandText = "SELECT * FROM tbldebitold WHERE fserialno = '" & txtSNo.Text & "'"
'ARSqlConnection.Open()
dReader = ARSqlCommand.ExecuteReader
If dReader.HasRows Then
MessageBox.Show("Record already exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
ARSqlConnection.Close()
'create first the SQL query to insert a row
ARSqlDataAdapter.InsertCommand.CommandText = _
"INSERT INTO tbldebitold(fserialno, ftrans, fpolno, fname, faccdir, faddr1, faddr2, finsured, fmending, fpart1, fpart2, fbusleg, fagentcd, fcono, fclasscd, faccno, fgrssprm, fentrydt, fcomm)" & _
"VALUES('" & txtSNo.Text & "','" & cboTransType.Text & "','" & txtPolicyNo.Text & "','" & txtClientName.Text & "','" & cboBuzType.Text & "','" & txtAddress1.Text & "','" & txtAddress2.Text & "' " & _
"'" & txtTransDate.Text & "','" & txtPart1.Text & "','" & txtPart2.Text & "','" & cboBuzLeg.Text & "','" & cboAgentCode.Text & "','" & cboBranchCode.Text & "','" & cboClassCode.Text & "'," & _
"'" & txtAccountNo.Text & "','" & txtGrossPrem.Text & "','" & txtdate & "','" & txtCommDeduc.Text & "',"
'send Data
ARSqlDataAdapter.InsertCommand.ExecuteNonQuery()
MessageBox.Show("Adding Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
ARSqlConnection.Close()
txtSNo.Clear()
ClearTextBoxes()
EndIf
EndIf
MessageBox.Show("Information Ok", MessageBoxIcon.Information, MessageBoxButtons.OK)
' End Try
'Else
EndIf
EndSub
' Exit Application
PrivateSub cmdExitRec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExitRec.Click
Application.Exit()
EndSub'Exit click
'finds record in database
PrivateSub FindRec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindRec.Click
Try
'ensure user input last name
If Trim(txtSNo.Text) <> "" Then
'clear DataSet from last operation
ARDataSet.Clear()
'create SQL query to find contact with specified serial no
ARSqlDataAdapter.SelectCommand.CommandText = _
"SELECT * FROM tbldebitold WHERE fserialno = '" & txtSNo.Text & "'"
'fill ARDataSet with the rows resulting from the query
ARSqlDataAdapter.Fill(ARDataSet)
'displayInformation
Display(ARDataSet)
'MessageBox.Show("Query successful")
'prompt user for last name
Else
'Display popup box
MessageBox.Show("Please enter SErial No.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
'txtMessage.Text = "Enter SErial No. then press Find"
EndIf
' display vertbose information with database exception
Catch SQLExceptionParameter As System.Data.Sqlclient.SqlException
'Console.WriteLine(SQLExceptionParameter.StackTrace)
'txtMessage.Text &= SQLExceptionParameter.ToString)
'display message box when invalid operation
Catch ex As Exception
MessageBox.Show("Invalid Operation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
EndTry
EndSub
'displays data in dataset
PrivateSub Display(ByVal dataset As DataSet)
Try
'get first DataTable - there will be one
Dim dataTable As DataTable = dataset.Tables(0)
'ensure dataTable not empty
If dataTable.Rows.Count <> 0 Then
Dim recordNumber AsInteger = _
Convert.ToInt32(dataTable.Rows(0)(0))
txtSNo.Text = recordNumber.ToString
cboTransType.Text = Convert.ToString(dataTable.Rows(0)(1))
txtPolicyNo.Text = Convert.ToString(dataTable.Rows(0)(2))
txtClientName.Text = Convert.ToString(dataTable.Rows(0)(3))
cboBuzType.Text = Convert.ToString(dataTable.Rows(0)(4))
txtAddress1.Text = Convert.ToString(dataTable.Rows(0)(5))
txtAddress2.Text = Convert.ToString(dataTable.Rows(0)(6))
txtInsured.Text = Convert.ToString(dataTable.Rows(0)(7))
txtTransDate.Text = Convert.ToString(dataTable.Rows(0)(8))
txtPart1.Text = Convert.ToString(dataTable.Rows(0)(9))
txtPart2.Text = Convert.ToString(dataTable.Rows(0)(10))
cboBuzLeg.Text = Convert.ToString(dataTable.Rows(0)(11))
cboAgentCode.Text = Convert.ToString(dataTable.Rows(0)(12))
' cboBranchCode.Text = Convert.ToString(dataTable.Rows(0)(13))
cboClassCode.Text = Convert.ToString(dataTable.Rows(0)(14))
txtAccountNo.Text = Convert.ToString(dataTable.Rows(0)(15))
cboTransType.Text = Convert.ToString(dataTable.Rows(0)(16))
txtGrossPrem.Text = Convert.ToString(dataTable.Rows(0)(17))
txtCommDeduc.Text = Convert.ToString(dataTable.Rows(0)(18))
EndIf
Catch ex As Exception
EndTry
EndSub' Display
'clears text boxes
PrivateSub ClearTextBoxes()
txtSNo.Clear()
cboTransType.SelectedIndex = 4
txtPolicyNo.Clear()
txtClientName.Clear()
cboBuzType.SelectedIndex = 3
cboBuzLeg.SelectedIndex = 3
txtAddress1.Clear()
txtAddress2.Clear()
txtTransDate.Text = ""
txtPart1.Clear()
txtPart2.Clear()
cboAgentCode.SelectedIndex = 50
cboBranchCode.SelectedIndex = 21
cboClassCode.SelectedIndex = 39
txtAccountNo.Clear()
txtGrossPrem.Clear()
txtCommDeduc.Clear()
EndSub' ClearTextBoxes
'delete record
PrivateSub cmdDeleteRec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDeleteRec.Click
'Try
'make sure user has already found record to Delete
If txtSNo.Text <> "" Then
'set SQL query to Delete all fields in table where id number matches id in idTextBox
ARSqlConnection.Open()
ARSqlDataAdapter.DeleteCommand.CommandText = _
"DELETE FROM tbldebitold WHERE(fserialno = '" & txtSNo.Text & "')"
'execute query
ARSqlDataAdapter.DeleteCommand.ExecuteNonQuery()
MessageBox.Show("Delete Successful")
txtSNo.Clear()
ClearTextBoxes()
Else
'prompt user to input existing record
MessageBox.Show("You can only Delete an existing record. Use Find to locate the record then Delete the Information", MessageBoxIcon.Error, MessageBoxButtons.OK)
ARSqlConnection.Close()
EndIf
MessageBox.Show("Delete Successful", MessageBoxIcon.Information, MessageBoxButtons.OK)
' End Try
EndSub' CmdDelete_Click
'updates etry in database
PrivateSub cmdModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdModify.Click
Try
'make sure user has already found record to update
If txtSNo.Text <> "" Then
'set SQL query to modify all fields in table where id number matches id in idTextBox
ARSqlDataAdapter.UpdateCommand.CommandText = _
"UPDATE tbldebitold SET ftrans='" & cboTransType.Text & "', " & _
"fpolno= '" & txtPolicyNo.Text & "', " & _
"fname= '" & txtClientName.Text & "', " & _
"faccdir= '" & cboBuzType.Text & "', " & _
"faddr1= '" & txtAddress1.Text & "', " & _
"faddr2= '" & txtAddress2.Text & "', " & _
"finsured= '" & txtInsured.Text & "', " & _
"fmending= '" & txtTransDate.Text & "', " & _
"fpart1= '" & txtPart1.Text & "', " & _
"fpart2= '" & txtPart2.Text & "', " & _
"fbusleg= '" & cboBuzLeg.Text & "', " & _
"fagentcd= '" & cboAgentCode.Text & "', " & _
"ffaccno= '" & txtAccountNo.Text & "', " & _
"ffcono= '" & cboBranchCode.Text & "', " & _
"fclasscd= '" & cboClassCode.Text & "', " & _
"fgrssprm= '" & txtGrossPrem.Text & "', " & _
"fcomm= '" & txtCommDeduc.Text & "', "
'notify user that query is being sent
ARSqlConnection.Open()
'execute query
ARSqlDataAdapter.UpdateCommand.ExecuteNonQuery()
MessageBox.Show("Update Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
'prompt user to input existing record
MessageBox.Show("You can only update an existing reoord", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
ARSqlConnection.Close()
txtSNo.Clear()
ClearTextBoxes()
EndIf
'display verbose information when database exception
Catch ex As Exception
EndTry
EndSub'cmd Modify_Click
PrivateSub cboClassCode_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
LoadClass()
EndSub
Sub LoadClass()
Try
'Create connection objects
Dim cnClass As SqlConnection = New SqlConnection(strConnClass)
Dim ClassDA AsNew SqlDataAdapter(strCLASSCMD, cnClass)
ClassDA.Fill(dstblclass, "tblclass")
dvtblclass = New DataView(dstblclass.Tables("tblclass"), "", "fclasscd", DataViewRowState.OriginalRows)
With cboClassCode
.ValueMember = "fclasscd"
.DisplayMember = "class"
.DataSource = dvtblclass
EndWith
cboClassCode.SelectedIndex = -1
cnClass.Dispose()
ClassDA.Dispose()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
'Catch invalidOperationExceptionParameter As InvalidOperationException
' MessageBox.Show(invalidOperationExceptionParameter.Message)
EndTry
EndSub' Load Class
PrivateSub cboAgentCode_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
LoadAgent()
EndSub
Sub LoadAgent()
Try
'Create connection objects
Dim cnAgent As SqlConnection = New SqlConnection(strConnAgent)
Dim AgentDA AsNew SqlDataAdapter(strAGENTCMD, cnAgent)
AgentDA.Fill(dstblAgent, "tblAgent")
dvtblAgent = New DataView(dstblAgent.Tables("tblAgent"), "", "fagttransno", DataViewRowState.OriginalRows)
With cboAgentCode
.ValueMember = "fagttransno"
.DisplayMember = "fagentdes"
.DataSource = dvtblAgent
EndWith
cboBranchCode.SelectedIndex = -1
cnAgent.Dispose()
AgentDA.Dispose()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
Catch invalidOperationExceptionParameter As InvalidOperationException
'MessageBox.Show(invalidOperationExceptionParameter.Message)
EndTry
EndSub' Load Agentcode
PrivateSub cboBranchCode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
LoadBranch()
EndSub
Sub LoadBranch()
Try
'Create connection objects
Dim cnBranch As SqlConnection = New SqlConnection(strConnBranch)
Dim BranchDA AsNew SqlDataAdapter(strBRANCHCMD, cnBranch)
BranchDA.Fill(dstblBranch, "tblBranch")
dvtblBranch = New DataView(dstblBranch.Tables("tblBranch"), "", "fcono", DataViewRowState.OriginalRows)
With cboBranchCode
.ValueMember = "fcono"
.DisplayMember = "Branch"
.DataSource = dvtblBranch
EndWith
cboBranchCode.SelectedIndex = -1
cnBranch.Dispose()
BranchDA.Dispose()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
Catch invalidOperationExceptionParameter As InvalidOperationException
'MessageBox.Show(invalidOperationExceptionParameter.Message)
EndTry
EndSub' Load Branchcode
EndClass'frmTransaction