Home
Imports System.Data.OleDb
Imports System.IO
Public Class home
Private Sub LogoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoutToolStripMenuItem.Click
Form1.Show()
Form1.TextBox1.Text = ""
Form1.TextBox2.Text = ""
Form1.ProgressBar1.Value = 0
Me.Hide()
End Sub
Private Sub EndToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EndToolStripMenuItem.Click
End
End Sub
Private Sub PasswordChangeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasswordChangeToolStripMenuItem.Click
pwordchange.Show()
End Sub
Private Sub home_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GroupBox1.Visible = False
' Form1.Close()
End Sub
Private Sub MedicineEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MedicineEntryToolStripMenuItem.Click
medentry.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
GroupBox1.Visible = True
Try
cmd = New OleDbCommand("select * from billno", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox1.Text = rs(0)
End While
End If
rs.Close()
con.Close()
TextBox1.Text += 1
cmd = New OleDbCommand("update billno set numb ='" & Trim(TextBox1.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
cmd = New OleDbCommand("select * from billno", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox1.Text = rs(0)
End While
End If
rs.Close()
con.Close()
TextBox1.Text += 1
cmd = New OleDbCommand("update billno set numb ='" & Trim(TextBox1.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
ComboBox6.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox2.Text = ""
TextBox20.Text = ""
TextBox21.Text = ""
TextBox3.Text = ""
TextBox5.Text = ""
TextBox4.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
End Sub
Private Sub TextBox14_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox14.TextChanged
TextBox20.Text = Val(TextBox3.Text) * Val(TextBox14.Text)
End Sub
Private Sub TextBox13_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox13.TextChanged
TextBox19.Text = Val(TextBox4.Text) * Val(TextBox13.Text)
End Sub
Private Sub TextBox12_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox12.TextChanged
TextBox18.Text = Val(TextBox5.Text) * Val(TextBox12.Text)
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
TextBox17.Text = Val(TextBox6.Text) * Val(TextBox11.Text)
End Sub
Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
TextBox16.Text = Val(TextBox7.Text) * Val(TextBox10.Text)
End Sub
Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged
TextBox15.Text = Val(TextBox8.Text) * Val(TextBox9.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
GroupBox1.Visible = False
End Sub
Private Sub TextBox20_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox20.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub TextBox19_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox19.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub TextBox18_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox18.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub TextBox17_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox17.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub TextBox16_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox16.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub TextBox15_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox15.TextChanged
TextBox21.Text = Val(TextBox15.Text) + Val(TextBox16.Text) + Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text)
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
Try
cmd = New OleDbCommand("select * from med", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
ComboBox1.Items.Add(rs(1))
ComboBox2.Items.Add(rs(1))
ComboBox3.Items.Add(rs(1))
ComboBox4.Items.Add(rs(1))
ComboBox5.Items.Add(rs(1))
ComboBox6.Items.Add(rs(1))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox1.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox14.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox2.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox13.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox3.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox12.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox4.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox11.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox5.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox10.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox6.SelectedIndexChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox6.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox9.Text = Trim(rs(5))
End While
End If
rs.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox1.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox22.Text = Trim(rs(4))
End While
End If
TextBox23.Text = Val(TextBox22.Text) - Val(TextBox3.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox23.Text) & "' where mname='" & Trim(ComboBox1.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox20.Text = Val(TextBox3.Text) * Val(TextBox14.Text)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox2.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox25.Text = Trim(rs(4))
End While
End If
TextBox24.Text = Val(TextBox25.Text) - Val(TextBox4.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox24.Text) & "' where mname='" & Trim(ComboBox2.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox19.Text = Val(TextBox4.Text) * Val(TextBox13.Text)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox3.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox27.Text = Trim(rs(4))
End While
End If
TextBox26.Text = Val(TextBox27.Text) - Val(TextBox5.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox26.Text) & "' where mname='" & Trim(ComboBox3.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox18.Text = Val(TextBox5.Text) * Val(TextBox12.Text)
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox4.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox29.Text = Trim(rs(4))
End While
End If
TextBox28.Text = Val(TextBox29.Text) - Val(TextBox6.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox28.Text) & "' where mname='" & Trim(ComboBox4.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox17.Text = Val(TextBox6.Text) * Val(TextBox11.Text)
End Sub
Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox5.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox31.Text = Trim(rs(4))
End While
End If
TextBox30.Text = Val(TextBox31.Text) - Val(TextBox7.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox30.Text) & "' where mname='" & Trim(ComboBox5.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox16.Text = Val(TextBox7.Text) * Val(TextBox10.Text)
End Sub
Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
Try
cmd = New OleDbCommand("select * from med where mname='" & Trim(ComboBox6.Text) & "'", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
TextBox33.Text = Trim(rs(4))
End While
End If
TextBox32.Text = Val(TextBox33.Text) - Val(TextBox8.Text)
rs.Close()
con.Close()
cmd = New OleDbCommand("update med set quan='" & Trim(TextBox32.Text) & "' where mname='" & Trim(ComboBox6.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
TextBox15.Text = Val(TextBox8.Text) * Val(TextBox9.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Try
cmd = New OleDbCommand("insert into savebill values('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox21.Text) & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub StockDetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StockDetailsToolStripMenuItem.Click
stock.Show()
End Sub
Private Sub ExpensesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExpensesToolStripMenuItem.Click
expen.Show()
expen.TabControl1.SelectedIndex = 2
End Sub
Private Sub IncomeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IncomeToolStripMenuItem.Click
expen.Show()
expen.TabControl1.SelectedIndex = 1
End Sub
End Class
Medicine entry
Imports System.Data.OleDb
Imports System.IO
Public Class medentry
Dim id As Integer
Private Sub medentry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
cmd = New OleDbCommand("select * from mid", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
id = rs(0)
End While
End If
rs.Close()
con.Close()
id += 1
TextBox1.Text = "MID" & id
cmd = New OleDbCommand("update mid set id ='" & Trim(id) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cmd = New OleDbCommand("insert into med values('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & Trim(TextBox3.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox5.Text) & "','" & Trim(TextBox6.Text) & "','" & Trim(TextBox7.Text) & "','" & Trim(TextBox8.Text) & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
GroupBox1.Visible = False
GroupBox2.Visible = False
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
GroupBox1.Visible = True
GroupBox2.Visible = True
Try
cmd = New OleDbCommand("select * from mid", con)
con.Open()
rs = cmd.ExecuteReader()
If rs.HasRows Then
While rs.Read
id = rs(0)
End While
End If
rs.Close()
con.Close()
id += 1
TextBox1.Text = "MID" & id
cmd = New OleDbCommand("update mid set id ='" & Trim(id) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
TextBox8.Text = Val(TextBox5.Text) * Val(TextBox6.Text)
End Sub
End Class
Password change
Imports System.Data.OleDb
Imports System.IO
Public Class pwordchange
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cmd = New OleDbCommand("update login set pword='" & Trim(TextBox3.Text) & "' where id='" & Trim(TextBox1.Text) & "'", con)
con.Open()
cmd.ExecuteNonQuery()
Me.Close()
con.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub pwordchange_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Stock maintance source
Imports System.Data.OleDb
Imports System.IO
Public Class stock
Private Sub stock_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim re As OleDbDataAdapter
Dim ds As New DataSet
Try
ds.Reset()
ds.Clear()
re = New OleDbDataAdapter("SELECT [mid] as Medicine_Id, [mname] as Medicine_Name, [cname] as Company_Name, [expdate] as Expire_Date, [quan] as Quantity, [unitp] as Unit_Price,[taxa] as Tax_Amount,[tot] as Total FROM med", con)
con.Open()
re.Fill(ds)
con.Close()
DataGridView1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error(s) Found")
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
No comments:
Post a Comment