manamanvn01

New Member
Quản lý nhà hàng là một công việc phức tạp, khối lượng thông tin cần xử lý lớn và yêu cầu độ chính xác tương đối cao vì vậy cần có một chương trình quản lý phù hợp và đạt hiệu quả. Sau một thời gian thực hiện đề tài, hệ thống mà mình đã xây dựng được có thể đáp ứng các vấn đề đặt ra như:


- Hỗ trợ các nghiệp vụ chính trong nhà hàng: nhập hàng, xuất hàng và bán hàng, quản lý nhân viên.


- Cung cấp chức năng hỗ trợ khách hàng tìm kiếm thông tin sản phẩm.


- Giao diện người dùng thân thiện, dễ thao tác.


Sau đây mình xin được trình bày sơ lược qua về phần mềm này:


+ Công cụ lưu trữ: Hệ quản trị cơ sở dữ liệu SQL Server 2005


+ Môi trường cài đặt: Ngôn ngữ lập trình VB.Net


Đều là những công cụ khá nổi tiếng, sau đây ta sẽ giới thiệu qua về các phần


Phần 1: Thiết kế một số giao diện chương trình


1. Form LOGIN






2.Form GIAO DIỆN CHÍNH




3. Form HỆ THỐNG




4.Form TẠO TÀI KHOẢN MỚI




5. Form BÁN HÀNG




6. Form NHÂN VIÊN






7 .Form KHÁCH HÀNG






8. Form ĐẶT BÀN






9. Form DANH MỤC HÀNG HÓA






10 Form THANH TOÁN




11. Form CHẤM CÔNG NHÂN VIÊN




12 .Form TỈ GIÁ




Một số code của các chức năng sử dụng trong chương trình


+ Code chức năng cập nhật trong form chấm công


Private Sub cmdcapnhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcapnhat.Click


If txtthang.Text = " " Then


MessageBox.Show("Thang khong duoc de trong", "Thong bao!", MessageBoxButtons.OK, MessageBoxIcon.Warning)


ElseIf txtthang.Text <> Today.Month Then


MessageBox.Show("Day không phai la thang hien tai", "Thong bao!", MessageBoxButtons.OK, MessageBoxIcon.Warning)


ElseIf txttangca.Text = "" Then


MessageBox.Show("Tang ca không duoc de rong", "Chu y!", MessageBoxButtons.OK, MessageBoxIcon.Warning)


ElseIf IsNumeric(txttangca.Text) = False Then


MessageBox.Show("Tang ca phai thuoc kieu du lieu so", "Chu y!", MessageBoxButtons.OK, MessageBoxIcon.Warning)


Else


If ckb1.Checked = True Then txt1.Text = "co "


If ckb2.Checked = True Then txt2.Text = "co "


If ckb3.Checked = True Then txt3.Text = "co "


If ckb4.Checked = True Then txt4.Text = "co "


If ckb4.Checked = True Then txt4.Text = "co "


If ckb5.Checked = True Then txt5.Text = "co "


If ckb6.Checked = True Then txt6.Text = "co "


If ckb7.Checked = True Then txt7.Text = "co "


If ckb8.Checked = True Then txt8.Text = "co "


If ckb9.Checked = True Then txt9.Text = "co "


If ckb10.Checked = True Then txt10.Text = "co "


If ckb11.Checked = True Then txt11.Text = "co "


If ckb12.Checked = True Then txt12.Text = "co "


If ckb13.Checked = True Then txt13.Text = "co "


If ckb14.Checked = True Then txt14.Text = "co "


If ckb15.Checked = True Then txt15.Text = "co "


If ckb16.Checked = True Then txt16.Text = "co "


If ckb17.Checked = True Then txt17.Text = "co "


If ckb18.Checked = True Then txt18.Text = "co "


If ckb19.Checked = True Then txt19.Text = "co "


If ckb20.Checked = True Then txt20.Text = "co "


If ckb21.Checked = True Then txt21.Text = "co "


If ckb22.Checked = True Then txt22.Text = "co "


If ckb23.Checked = True Then txt23.Text = "co "


If ckb24.Checked = True Then txt24.Text = "co "


If ckb25.Checked = True Then txt25.Text = "co "


If ckb26.Checked = True Then txt26.Text = "co "


If ckb27.Checked = True Then txt27.Text = "co "


If ckb28.Checked = True Then txt28.Text = "co "


If ckb29.Checked = True Then txt29.Text = "co "


If ckb30.Checked = True Then txt30.Text = "co "


If ckb31.Checked = True Then txt31.Text = "co "


Dim row As DataRow = dt.Select("Ma_nv = '" & txtmanv.Text & "'")(0)


row.BeginEdit()


row("Thang") = txtthang.Text


row("n1") = txt1.Text


row("n2") = txt2.Text


row("n3") = txt3.Text


row("n4") = txt4.Text


row("n5") = txt5.Text


row("n6") = txt6.Text


row("n7") = txt7.Text


row("n8") = txt8.Text


row("n9") = txt9.Text


row("n10") = txt10.Text


row("n11") = txt11.Text


row("n12") = txt12.Text


row("n13") = txt13.Text


row("n14") = txt14.Text


row("n15") = txt15.Text


row("n16") = txt16.Text


row("n17") = txt17.Text


row("n18") = txt18.Text


row("n19") = txt19.Text


row("n20") = txt20.Text


row("n21") = txt21.Text


row("n22") = txt22.Text


row("n23") = txt23.Text


row("n24") = txt24.Text


row("n25") = txt25.Text


row("n26") = txt26.Text


row("n27") = txt27.Text


row("n28") = txt28.Text


row("n29") = txt29.Text


row("n30") = txt30.Text


row("n31") = txt31.Text


row("Tang_ca") = txttangca.Text


row.EndEdit()


dtdanhsach.DataSource = dt


'Tao command để update sự thay đổi trên vào file data nguồn


Dim commandUpdate As New SqlCommand()


commandUpdate.Connection = cn


commandUpdate.CommandText = "Update chamcong Set Thang= @thang, n1= @n1 , n2= @n2, n3= @n3, n4= @n4, n5= @n5, n6= @n6, n7= @n7, n8= @n8, n9= @n9, n10= @n10, n11= @n11, n12= @n12, n13= @n13, n14= @n14, n15= @n15, n16= @n16, n17= @n17, n18= @n18, n19= @n19, n20= @n20, n21= @n21, n22= @n22, n23= @n23, n24= @n24, n25= @n25, n26= @n26, n27= @n27, n28= @n28, n29= @n29, n30= @n30, n31= @n31, Tang_ca= @Tang_ca Where Ma_nv= @Ma_nv"


commandUpdate.CommandType = CommandType.Text


commandUpdate.Parameters.AddWithValue("@Thang", txtthang.Text)


commandUpdate.Parameters.AddWithValue("@n1", txt1.Text)


commandUpdate.Parameters.AddWithValue("@n2", txt2.Text)


commandUpdate.Parameters.AddWithValue("@n3", txt3.Text)


commandUpdate.Parameters.AddWithValue("@n4", txt4.Text)


commandUpdate.Parameters.AddWithValue("@n5", txt5.Text)


commandUpdate.Parameters.AddWithValue("@n6", txt6.Text)


commandUpdate.Parameters.AddWithValue("@n7", txt7.Text)


commandUpdate.Parameters.AddWithValue("@n8", txt8.Text)


commandUpdate.Parameters.AddWithValue("@n9", txt9.Text)


commandUpdate.Parameters.AddWithValue("@n10", txt10.Text)


commandUpdate.Parameters.AddWithValue("@n11", txt11.Text)


commandUpdate.Parameters.AddWithValue("@n12", txt12.Text)


commandUpdate.Parameters.AddWithValue("@n13", txt13.Text)


commandUpdate.Parameters.AddWithValue("@n14", txt14.Text)


commandUpdate.Parameters.AddWithValue("@n15", txt15.Text)


commandUpdate.Parameters.AddWithValue("@n16", txt16.Text)


commandUpdate.Parameters.AddWithValue("@n17", txt17.Text)


commandUpdate.Parameters.AddWithValue("@n18", txt18.Text)


commandUpdate.Parameters.AddWithValue("@n19", txt19.Text)


commandUpdate.Parameters.AddWithValue("@n20", txt20.Text)


commandUpdate.Parameters.AddWithValue("@n21", txt21.Text)


commandUpdate.Parameters.AddWithValue("@n22", txt22.Text)


commandUpdate.Parameters.AddWithValue("@n23", txt23.Text)


commandUpdate.Parameters.AddWithValue("@n24", txt24.Text)


commandUpdate.Parameters.AddWithValue("@n25", txt25.Text)


commandUpdate.Parameters.AddWithValue("@n26", txt26.Text)


commandUpdate.Parameters.AddWithValue("@n27", txt27.Text)


commandUpdate.Parameters.AddWithValue("@n28", txt28.Text)


commandUpdate.Parameters.AddWithValue("@n29", txt29.Text)


commandUpdate.Parameters.AddWithValue("@n30", txt30.Text)


commandUpdate.Parameters.AddWithValue("@n31", txt31.Text)


commandUpdate.Parameters.AddWithValue("@Tang_ca", txttangca.Text)


commandUpdate.Parameters.AddWithValue("@Ma_nv", BindingContext(dt).Current("Ma_nv"))


'Dùng da để áp đặt sự thay đổi trên vào File data nguồn


da.UpdateCommand = commandUpdate 'gán command


da.Update(dt)


End If


End Sub


+ Code chức năng đặt bàn


ơ Private Sub cmdcapnhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcapnhat.Click


kiem_tra()


If kt = True Then


Dim Key(0) As DataColumn


Key(0) = dt.Columns("Stt")


dt.PrimaryKey = Key


Dim rowkk() As DataRow = dt.Select("Stt='" & txtstt.Text & "'")


If IsNothing(rowkk) OrElse rowkk.Length = 0 Then


Dim row As DataRow = dt.NewRow()


row("Stt") = txtstt.Text


row("Ngay") = datengay.Value


row("Bar_nhap") = txtbar.Text


row("Tien_bar") = txttienbar.Text


row("Ban_nhap") = txtban.Text


row("Tien_ban") = txttienban.Text


row("Bep_nhap") = txtbep.Text


row("Tien_bep") = txttienbep.Text


row("Orther") = txtorther.Text


row("Tien_orther") = txttienorther.Text


row("Tong_tiennhap") = txttongtiennhap.Text


row("Thu_kho") = txtthukho.Text


row("Ghi_chu") = txtghichu.Text


dt.Rows.Add(row) ' add row mới này vào dt


frmqlxuatnhap.dtnhap.DataSource


Dim commandInsert As New SqlCommand()'Tao command để update sự thay đổi


commandInsert.Connection = cn


commandInsert.CommandType = CommandType.Text


'Nap tham so cho các command


commandInsert.CommandText = "Insert Into nhap Values @Stt,@Ngay,@Bar_nhap,@Tien_bar,@Ban_nhap,@Tien_ban ,@Bep_nhap,@Tien_bep,@Orther,@Tien_orther,@Tong_ti ennhap,@Thu_kho,@Ghi_chu)"


commandInsert.Parameters.Add("@Stt", SqlDbType.Int, 50, "Stt")


' Nạp giá trị cho tham số @STT thông qua giá trị của cột nguồn STT


commandInsert.Parameters.Add("@Ngay", SqlDbType.DateTime, 50, "Ngay")


commandInsert.Parameters.Add("@Bar_nhap", SqlDbType.VarChar, 50, "Bar_nhap")


commandInsert.Parameters.Add("@Tien_bar", SqlDbType.Int, 50, "Tien_bar")


commandInsert.Parameters.Add("@Ban_nhap", SqlDbType.VarChar, 50, "Ban_nhap")


commandInsert.Parameters.Add("@Tien_ban", SqlDbType.Int, 50, "Tien_ban")


commandInsert.Parameters.Add("@Bep_nhap", SqlDbType.VarChar, 50, "Bep_nhap")


commandInsert.Parameters.Add("@Tien_bep", SqlDbType.Int, 50, "Tien_bep")


commandInsert.Parameters.Add("@Orther", SqlDbType.VarChar, 50, "Orther")


commandInsert.Parameters.Add("@Tien_orther", SqlDbType.Int, 50, "Tien_orther")


commandInsert.Parameters.Add("@Tong_tiennhap", SqlDbType.VarChar, 50, "Tong_tiennhap")


commandInsert.Parameters.Add("@Thu_kho", SqlDbType.VarChar, 50, "Thu_kho")


commandInsert.Parameters.Add("@Ghi_chu", SqlDbType.VarChar, 50, "Ghi_chu")


da.InsertCommand = commandInsert 'gán command


da.Update(dt) 'Dùng da để áp đặt sự thay đổi trên vào File data nguồn


Else


MessageBox.Show("Stt nay da ton tai!", "Thong bao", MessageBoxButtons.OK)


End If


End If


End Sub


End Class


+ Code chức năng xóa nhân viên


Private Sub cmdxoa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdxoa.Click


If txtmanv.Text.Length > 0 Then


Dim row2 As DataRow = dtc.Select("Ma_nv = '" & txtmanv.Text & "'")(0)


row2.BeginEdit()


row2.Delete()


row2.EndEdit()


frmchamcong.dtdanhsach.DataSource = dtc


Dim commandDelete2 As New SqlCommand()


commandDelete2.Connection = cn


commandDelete2.CommandType = CommandType.Text


commandDelete2.CommandText = "Delete from chamcong Where Ma_nv = @Ma_nv"


commandDelete2.Parameters.Add("@Ma_nv", SqlDbType.VarChar, 50, "Ma_nv")


da.DeleteCommand = commandDelete2


da.Update(dtc)


Dim row3 As DataRow = dtl.Select("Ma_nv = '" & txtmanv.Text & "'")(0)


row3.BeginEdit()


row3.Delete()


row3.EndEdit()


frmbangluongnhanvien.dtdanhmuc.DataSource = dtl


Dim commandDelete3 As New SqlCommand()


commandDelete3.Connection = cn


commandDelete3.CommandType = CommandType.Text


commandDelete3.CommandText = "Delete from luong Where Ma_nv=@Ma_nv"


commandDelete3.Parameters.Add("@Ma_nv", SqlDbType.VarChar, 50, "Ma_nv")


da.DeleteCommand = commandDelete3


da.Update(dtl)


Dim row4 As DataRow = dtltt.Select("Ma_nv = '" & txtmanv.Text & "'")(0)


row4.BeginEdit()


row4.Delete()


row4.EndEdit()


frmbangluongnvchuatt.dtdm.DataSource = dtltt


frmthanhtoanluongnhanvien.dtdanhmuc.DataSource = dtltt


Dim commandDelete4 As New SqlCommand()


commandDelete4.Connection = cn


commandDelete4.CommandType = CommandType.Text


commandDelete4.CommandText = "Delete from luongtt Where Ma_nv=@Ma_nv"


commandDelete4.Parameters.Add("@Ma_nv", SqlDbType.VarChar, 50, "Ma_nv")


da.DeleteCommand = commandDelete4


da.Update(dtltt)


Dim row As DataRow = dt.Select("Ma_nv = '" & txtmanv.Text & "'")(0)


row.BeginEdit()


row.Delete()


row.EndEdit()


frmnhanvien.dtdanhmuc.DataSource = dt


Dim commandDelete As New SqlCommand()


commandDelete.Connection = cn


commandDelete.CommandType = CommandType.Text


commandDelete.CommandText = "Delete from nhanvien Where Ma_nv=@Ma_nv"


commandDelete.Parameters.Add("@Ma_nv", SqlDbType.VarChar, 50, "Ma_nv")


da.DeleteCommand = commandDelete


da.Update(dt)


End If


End Sub


+ Code chức năng tìm kiếm nhân viên


Private Sub cmdtim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdtim.Click


tim.Clear()


lbkq.Text = ""


If txttukhoa.Text = "" Then


lbkq.Text = "Bạn chưa nhập vào từ khóa cần tìm"


Else


dtketqua.DataSource = ""


If btbophan.Checked = True Then


Dim command As New SqlCommand()


command.Connection = cn


command.CommandType = CommandType.Text


command.CommandText = "Select * From nhanvien Where (Bo_phan ='" & txttukhoa.Text & "')"


da.SelectCommand = command


da.Fill(tim)


If tim.Rows.Count > 0 Then 'trả về số bản ghi được tìm thấy


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Tìm thấy " & tim.Rows.Count & " nhân viên trong bộ phận " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


Else


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Không tim thấy nhân viên nào trong bộ phận " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


End If


ElseIf btten.Checked = True Then


Dim command As New SqlCommand()


command.Connection = cn


command.CommandType = CommandType.Text


command.CommandText = "Select * From nhanvien Where (Ten_nv = '" & txttukhoa.Text & "')"


da.SelectCommand = command


da.Fill(tim)


If tim.Rows.Count > 0 Then


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Tìm thấy " & tim.Rows.Count & " nhân viên có tên là " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


Else


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Không tim thấy nhân viên nào có tên là " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


End If


ElseIf btca.Checked = True Then


Dim command As New SqlCommand()


command.Connection = cn


command.CommandType = CommandType.Text


command.CommandText = "Select * From nhanvien Where (Ca = '" & txttukhoa.Text & "')"


da.SelectCommand = command


da.Fill(tim)


If tim.Rows.Count > 0 Then


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


bkq.Text = "Tìm thấy " & tim.Rows.Count & " nhân viên làm ca " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


Else


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Không tim thấy nhân viên nào làm ca " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


End If


ElseIf btque.Checked = True Then


Dim command As New SqlCommand()


command.Connection = cn


command.CommandType = CommandType.Text


command.CommandText = "Select * From nhanvien Where (Que_quan = '" & txttukhoa.Text & "')"


da.SelectCommand = command


da.Fill(tim)


If tim.Rows.Count > 0 Then


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Tìm thấy " & tim.Rows.Count & " nhân viên có quê là " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


Else


ptbtim.Visible = True


lbtim.Visible = True


pcbtim.Visible = True


Me.pcbtim.Maximum = 100000


For i As Integer = 0 To 100000


pcbtim.Value = i


Application.DoEvents()


Next


lbkq.Text = "Không tim thấy nhân viên nào có quê là " & txttukhoa.Text


lbtim.Visible = False


pcbtim.Visible = False


ptbtim.Visible = False


End If


End If


dtketqua.DataSource = tim


End If


End Sub


Phan Thắng
 

Các chủ đề có liên quan khác

Top