Form Bỏo cỏo.

Một phần của tài liệu Luận văn tốt nghiệp phân tích, thiết kế và xây dựng chương trình quản lý nhân sự công ty VMS mobifone (Trang 89 - 118)

- Mó dõn tộc Tờn dõn tộ c

6. Một số chương trỡnh chớnh, sơ lược cỏch sử dụng cỏc chương trỡnh

6.7 Form Bỏo cỏo.

Lựa chọn vấn ủề cần bỏo cỏo: bỏo cỏo lương, bỏo cỏo danh sỏch về hưu theo cỏc năm.

Trờn ủõy là chuyờn ủề thực tập “Phõn tớch, thiết kế và xõy dng chương trỡnh Qun lý nhõn s cụng ty VMS MobiFone” của tụi. Với tỡnh hỡnh thực tiễn và những yờu cầu mà Cụng ty ủặt ra, tụi ủó cố gắng ủể thiết kế và xõy dựng một chương trỡnh phự hợp nhất ủi từ “Tổng quan về Cụng ty” ủến “ Phương phỏp luận về phõn tớch, thiết kờ” và ủến “ Phõn tớch, thiết kế chương trỡnh”. Tụi nhận thấy rằng, tụi ủó thực hiện ủược khỏ ủầy ủủ những yờu cầu mà Cụng ty ủặt ra cho vấn ủề

quản lý nhõn sự như: cập nhật cỏc thụng tin liờn quan ủến vấn ủề nhõn viờn, lương thưởng; lưu trữ cỏc thụng tin về nhõn viờn, về lương thưởng tạo ủiều kiện thuận lợi cho việc tỡm kiếm hay kết xuất bỏo cỏo lỳc cú yờu cầu; cú thể tỡm kiếm nhõn viờn dễ dàng, ủầy ủủ như cỏc yờu cầu về: tỡm kiếm nhõn viờn thuộc phũng ban X, tỡm kiếm tất cả nhõn viờn cú chức vụ chuyờn mụn là Y, hay tỡm kiếm nhõn viờn cú loại hợp ủồng là Z trong Cụng ty…; và thực hiện kết xuất cỏc bỏo cỏo khi ban Giỏm

ủốc hay cỏc phũng ban khỏc yờu cầu. Tuy nhiờn, trong quỏ trỡnh xõy dựng chương trỡnh, tụi khụng thể trỏnh khỏi những thiếu sút. Hy vọng rằng, nếu cú thời gian và cú ủiều kiện tỡm hiểu kỹ hơn, tụi sẽ cú thể khắc phục ủược những thiếu sút ủú.

Một lần nữa, tụi xin chõn thành cảm ơn Thầy giỏo khoa Tin học kinh tế

Trường Đại Học Kinh tế Quốc Dõn ủó hướng dẫn tụi trong suốt quỏ trỡnh thực hiện chuyờn ủề thực tập vừa qua; xin cảm ơn Ban Giỏm ủốc cụng ty VMS MobiFone ủó tạo ủiều kiện cho tụi ủược thực tập tại Cụng ty; cỏc anh chị trong phũng TC-HC của Cụng ty VMS ủó giỳp ủỡ, cung cấp tài liệu, hướng dẫn tụi trong suốt quỏ trỡnh thực tập tại cụng ty.

Option Explicit

Private Declare Sub InitCommonControls Lib "comctl32" () Dim dem As Integer

Private Sub Command1_Click()

Set conn = New adodb.Connection

gConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Persist Security Info=False;" & _

"Data Source= " & App.Path & "\Data\db1.mdb" conn.CursorLocation = adUseClient

conn.Open gConnectionString Dim rs As New adodb.Recordset If txtmk = "" Or txttn = "" Then

MsgBox "ban phai nhap thong tin", vbExclamation, "thong bao" Exit Sub

End If

Dim str

str = "select top 1 * from dangnhap where (user = '" & txttn & "' )and (pass = '" & txtmk & "')"

rs.Open str, conn If rs.EOF Then

Dim check As Boolean

MsgBox "Bạn nhập sai thông tin ", vbOKOnly + vbInformation, "thongbao"

txttn = "" txtmk = "" txttn.SetFocus

MsgBox "Bạn đã nhập sai quá 3 lần" End End If Else Unload Me frmmain.Show End If End Sub

Private Sub Command2_Click() Unload Me

End Sub

Private Sub Form_Initialize() InitCommonControls End Sub

Private Sub Form_Load() Call CenterMyform(form2) End Sub

Private Sub txtmk_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

command1.SetFocus End Select

Case 13

txtmk.SetFocus End Select End Sub

2. H sơ nhõn viờn

Dim addingCL As Boolean Dim str, str1, str2, str3, str4, str5

Private Sub cbocvcm_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cmdluu.SetFocus End Select

End Sub

Private Sub cmdBoqua_Click() addingCL = False Call resetvalues cmdxoa.Enabled = True cmdmoi.Enabled = True cmdsua.Enabled = False cmdboqua.Enabled = False cmdketiep.Enabled = True cmdquaylui.Enabled = True cmdluu.Enabled = False Call DisplayData

Private Sub cmdct_Click()

If txtmanv.Text <> "" And txttennv.Text <> "" Then frmquatrinhcongtac.Show

Else

MsgBox "Bạn ch-a chọn nhân viên!", vbOKOnly + vbExclamation, "Thông Báo" End If

End Sub

Private Sub cmdgd_Click()

If txtmanv.Text <> "" And txttennv.Text <> "" Then frmgiadinh.Show

Else

MsgBox "Bạn ch-a chọn nhân viên!", vbOKOnly + vbExclamation, "Thông Báo" End If

End Sub

Private Sub cmdktkl_Click()

If txtmanv.Text <> "" And txttennv.Text <> "" Then frmktkl.Show

Else

MsgBox "Bạn ch-a chọn nhân viên!", vbOKOnly + vbExclamation, "Thông Báo" End If

End Sub

Private Sub cmdin_Click() rpt_llnv.Show

cmdquaylui.Enabled = True If Adodc1.Recordset.EOF Then

MsgBox " Day la ban ghi cuoi cung ", vbInformation, "Thong bao" Adodc1.Recordset.MoveLast cmdketiep.Enabled = False Else Adodc1.Recordset.MoveNext End If Call DisplayData cmdsua.Enabled = True txtmanv.Enabled = False errs: End Sub

Private Sub cmdLuu_Click() Dim str As String

If Len(Trim(txtmanv.Text)) = 0 Then

MsgBox "Ban phai nhap du lieu ", vbOKOnly + vbInformation, "Thong bao" txtmanv.SetFocus

Exit Sub End If

If Adodc1.Recordset.RecordCount <> 0 Then

str = "select * from nhanvien where Manv ='" & Trim(txtmanv.Text) & "'" If checkey(str) And addingCL Then

MsgBox "Ma da ton tai", vbOKOnly + vbInformation, "Thong bao" txtmanv.SetFocus

End If

If Len(Trim(txttennv)) = 0 Then

MsgBox "Ban nen nhap ten", vbOKOnly + vbInformation, "Thong bao" txttennv.SetFocus Exit Sub End If With Adodc1.Recordset If addingCL Then .AddNew !Manv = txtmanv.Text !tennv = txttennv.Text !mapb = cbopb.Text !chucvudang = cboda.Text !chucvudoan = cbodo.Text !chucvucm = cbocvcm.Text !trinhdovh = cbotdvh.Text !matgiao = cbotg.Text !trinhdollct = cbollct.Text !trinhdocmnv = cbotdcm.Text !loaihd = cbohd.Text !socmnd = txtcmnd.Text !ngayvaovms = txtnvao.Text !madtoc = cbodt.Text !ngayvaodang = txtnvd.Text !sodt = txtdt.Text !Quequan = txtqq.Text

!ngaysinh = mskNgaysinh.Text Else !tennv = txttennv.Text !mapb = cbopb.Text !chucvudang = cboda.Text !chucvudoan = cbodo.Text !chucvucm = cbocvcm.Text !trinhdovh = cbotdvh.Text !matgiao = cbotg.Text !trinhdollct = cbollct.Text !trinhdocmnv = cbotdcm.Text !loaihd = cbohd.Text !socmnd = txtcmnd.Text !ngayvaovms = txtnvao.Text !madtoc = cbodt.Text !ngayvaodang = txtnvd.Text !sodt = txtdt.Text !Quequan = txtqq.Text !Diachihiennay = txtdc.Text !gioitinh = Cbogt1.Text !ngaysinh = mskNgaysinh.Text End If .Update End With addingCL = False Call resetvalues

cmdsua.Enabled = False cmdboqua.Enabled = False cmdketiep.Enabled = False cmdquaylui.Enabled = True cmdluu.Enabled = False txtmanv.Enabled = False End Sub

Private Sub cmdquaylui_Click() On Error GoTo errs

cmdketiep.Enabled = True If Adodc1.Recordset.BOF Then

MsgBox " Day la ban ghi dau tien ", vbInformation, "Thong bao" Adodc1.Recordset.MoveFirst cmdquaylui.Enabled = False Else Adodc1.Recordset.MovePrevious End If Call DisplayData txtmanv.Enabled = False errs: End Sub

Private Sub Cmdsua_Click() txtmanv.Enabled = True cmdmoi.Enabled = False cmdboqua.Enabled = True cmdluu.Enabled = True

txtmanv.SetFocus addingCL = False End Sub

Private Sub Cmdmoi_Click() cmdxoa.Enabled = False cmdsua.Enabled = False cmdboqua.Enabled = True cmdluu.Enabled = True cmdketiep.Enabled = False cmdquaylui.Enabled = False addingCL = True

'Goi phuong thuc resetvalues de xoa du lieu trong text box Call resetvalues

txtmanv.Enabled = True txtmanv.SetFocus

End Sub

Private Sub cmdthoat_Click()

If MsgBox("Ban co muon thoat khong", vbYesNo + vbInformation, "Thong bao") = vbNo Then Exit Sub Else Unload Me End If End Sub

With Adodc1.Recordset If .RecordCount <> 0 Then

If MsgBox("Ban co muon xoa ban ghi nay khong", vbYesNo, "Thong bao") = vbYes Then

.Delete

Call resetvalues End If

Else

MsgBox " Khong co ban ghi ", vbInformation, "Thong bao" cmdxoa.Enabled = False

End If End With End Sub

Private Sub Form_Load() Adodc1.Visible = False CenterMyform Me addingCL = False cmdsua.Enabled = True cmdluu.Enabled = False cmdboqua.Enabled = False cmdketiep.Enabled = True cmdquaylui.Enabled = True txtmanv.Enabled = False

Set conn = New adodb.Connection

gConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Persist Security Info=False;" & _

conn.Open gConnectionString Set rs = New adodb.Recordset str = "select mapb from phongban" rs.Open str, conn

Do While Not rs.EOF

Me.cbopb.AddItem rs("mapb") rs.MoveNext

Loop

Set rs1 = New adodb.Recordset

str1 = "select macvdoan from chucvudoan" rs1.Open str1, conn

Do While Not rs1.EOF

Me.cbodo.AddItem rs1("macvdoan") rs1.MoveNext

Loop

Set rs2 = New adodb.Recordset

str2 = "select macvcm from chucvucmon" rs2.Open str2, conn

Do While Not rs2.EOF

Me.cbocvcm.AddItem rs2("macvcm") rs2.MoveNext

Loop

Set rs3 = New adodb.Recordset

str3 = " select macvdang from chucvudang" rs3.Open str3, conn

Loop

Set rs5 = New adodb.Recordset str5 = " select matg from tongiao" rs5.Open str5, conn

Do While Not rs5.EOF

Me.cbotg.AddItem rs5("matg") rs5.MoveNext

Loop

Set rs4 = New adodb.Recordset str4 = " select madt from dantoc" rs4.Open str4, conn

Do While Not rs4.EOF

Me.cbodt.AddItem rs4("madt") rs4.MoveNext

Loop End Sub

Private Sub DisplayData() With Adodc1.Recordset If .BOF Or .EOF Then Exit Sub End If txtmanv = !Manv txttennv = !tennv Cbogt1 = !gioitinh txtdc.Text = !Diachihiennay txtdt.Text = !sodt

txtqq.Text = !Quequan cbodt.Text = !madtoc cbotg.Text = !matgiao txtnvd.Text = !ngayvaodang txtcmnd.Text = !socmnd cbotdvh.Text = !trinhdovh cbotdcm.Text = !trinhdocmnv cbollct.Text = !trinhdollct cbocvcm.Text = !chucvucm cbodo.Text = !chucvudoan cboda.Text = !chucvudang txtnvao.Text = !ngayvaovms cbohd.Text = !loaihd cbopb.Text = !mapb End With End Sub

cmdluu.Enabled = True cmdketiep.Enabled = True cmdquaylui.Enabled = True If addingCL Then

If MsgBox("Dang o che do them moi, chon OK de hien thi du lieu", vbOKCancel + vbInformation, "Thong bao") = vbCancel Then

cmdsua.Enabled = False Exit Sub Else addingCL = False cmdboqua.Enabled = False End If End If txtmanv.Enabled = False Call DisplayData End Sub

Private Sub grid1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

Call Grid1_Click End If

End Sub

Private Sub resetvalues() txtmanv.Text = ""

txttennv.Text = "" Cbogt1 = "" txtdc.Text = ""

mskNgaysinh.Text = "" txtqq.Text = "" cbodt.Text = "" cbotg.Text = "" txtnvd.Text = "" txtcmnd.Text = "" cbotdvh.Text = "" cbotdcm.Text = "" cbollct.Text = "" cbocvcm.Text = "" cbodo.Text = "" cboda.Text = "" txtnvao.Text = "" cbohd.Text = "" cbopb.Text = "" End Sub

Private Sub txtmado_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txttennv.SetFocus End Select

frmmain.Show End Sub

Private Sub txttennv_keypress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbopb.SetFocus End Select End Sub

Private Sub cmdmoi_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtmanv.SetFocus End Select

End Sub

Private Sub txtmanv_GotFocus() txtmanv.BackColor = &H8000000F End Sub

Private Sub txttennv_gotfocus() txttennv.BackColor = &H8000000F End Sub

Private Sub txtmanv_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

Private Sub cbopb_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

mskNgaysinh.SetFocus End Select

End Sub

Private Sub mskngaysinh_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

Cbogt1.SetFocus End Select

End Sub

Private Sub cbogt1_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbodt.SetFocus End Select End Sub

Private Sub cbodt_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbotg.SetFocus End Select End Sub

Case 13

txtdc.SetFocus End Select End Sub

Private Sub txtdc_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtqq.SetFocus End Select End Sub

Private Sub txtqq_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtdt.SetFocus End Select End Sub

Private Sub txtdt_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtnvd.SetFocus End Select End Sub

Private Sub txtnvd_KeyPress(KeyAscii As Integer) Select Case KeyAscii

End Select End Sub

Private Sub txtcmnd_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtnvao.SetFocus End Select

End Sub

Private Sub txtnvao_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbohd.SetFocus End Select End Sub

Private Sub cbohd_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbotdcm.SetFocus End Select

End Sub

Private Sub cbotdcm_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbotdvh.SetFocus End Select

Case 13

cbollct.SetFocus End Select End Sub

Private Sub cbollct_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cboda.SetFocus End Select End Sub

Private Sub cboda_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbodo.SetFocus End Select End Sub

Private Sub cbodo_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbocvcm.SetFocus End Select

End Sub

Private Sub cboda_gotfocus() cboda.BackColor = &H8000000F End Sub

Private Sub maskngaysinh_gotfocus() maskngaysinh.BackColor = &H8000000F End Sub

Private Sub cbogt1_gotfocus() Cbogt1.BackColor = &H8000000F End Sub

Private Sub txtdiachi_gotfocus() txttdkt.BackColor = &H8000000F End Sub

Private Sub txtqq_gotfocus() txtqq.BackColor = &H8000000F End Sub

Private Sub txtdt_gotfocus() txtdt.BackColor = &H8000000F End Sub

Private Sub cbodt_gotfocus() cbodt.BackColor = &H8000000F End Sub

Private Sub txttg_gotfocus() txttg.BackColor = &H8000000F End Sub

Private Sub txtnvao_gotfocus() txtnvao.BackColor = &H8000000F End Sub

Private Sub cbohd_gotfocus() cbohd.BackColor = &H8000000F

Cbovh.BackColor = &H8000000F End Sub

Private Sub cbollct_gotfocus() cbollct.BackColor = &H8000000F End Sub

Private Sub cbotdcm_gotfocus() cbotdcm.BackColor = &H8000000F End Sub

Private Sub cbocvda_gotfocus() cbocvda.BackColor = &H8000000F End Sub

Private Sub cbocvdo_gotfocus() cbocvdo.BackColor = &H8000000F End Sub

Private Sub cbocvcm_gotfocus() cbocvcm.BackColor = &H8000000F End Sub

Private Sub cbotg_gotfocus() cbotg.BackColor = &H8000000F End Sub

Private Sub txtdc_gotfocus() txtdc.BackColor = &H8000000F End Sub

Private Sub txtnvd_gotfocus() txtnvd.BackColor = &H8000000F End Sub

Private Sub txtcmnd_gotfocus() txtcmnd.BackColor = &H8000000F End Sub

Private Sub cbotdvh_gotfocus() cbotdvh.BackColor = &H8000000F End Sub

3. Tỡm kiếm

Private Sub cmdcv_Click(Index As Integer) frmcvcmon.Show

End Sub

Private Sub cmddsvh_Click() frmvhuu.Show

End Sub

Private Sub cmdin_Click() Dim str

'hoten

If opttc(0).Value = True Then

str = "select * from nhanvien where nhanvien.tennv like '%" & txttracuu.Text & "%'"

End If 'gioitinh

"%'" End If

'ma nhan vien

If opttc(1).Value = True Then

str = "select * from nhanvien where nhanvien.manv like '%" & txttracuu.Text & "%'"

End If 'quequan

If opttc(2).Value = True Then

str = "select * from nhanvien where nhanvien.quequan like '%" & txttracuu.Text & "%'"

End If 'diachi

If opttc(3).Value = True Then

str = "select * from nhanvien where nhanvien.diachihiennay like '%" & txttracuu.Text & "%'"

End If 'so dt

If opttc(4).Value = True Then

str = "select * from nhanvien where nhanvien.sodt like '%" & txttracuu.Text & "%'" End If

'chuc vu cmon

If opttc(5).Value = True Then

str = "select * from nhanvien where nhanvien.chucvucm like '%" & txttracuu.Text & "%'"

str = "select * from nhanvien where nhanvien.trinhdollct like '%" & txttracuu.Text & "%'"

End If 'pban

If opttc(10).Value = True Then

str = "select * from nhanvien where nhanvien.mapb like '%" & txttracuu.Text & "%'"

End If 'trinhdovh

If opttc(4).Value = True Then

str = "select * from nhanvien where nhanvien.trinhdovh like '%" & txttracuu.Text & "%'"

End If

' trinhdocmnv

If opttc(7).Value = True Then

str = "select * from nhanvien where nhanvien.trinhdocmnv like '%" & txttracuu.Text & "%'"

End If

' chucvudang

If opttc(8).Value = True Then

str = "select * from nhanvien where nhanvien.chucvudang like '%" & txttracuu.Text & "%'"

End If

'chucvudoan

End If 'loaihd

If opttc(11).Value = True Then

str = "select * from nhanvien where nhanvien.loaihd like '%" & txttracuu.Text & " %'" End If DE1.Commands(5).CommandText = str If DE1.rstracuu.State = 0 Then DE1.rstracuu.Open End If DE1.rstracuu.Requery rpt_tracuu.Show 1 End Sub

Private Sub cmdpb_Click() frmphongban.Show

End Sub

Private Sub cmdqtct_Click() frmnhanvien.Show

End Sub

Private Sub cmdthoat_Click() Unload Me

End Sub

Private Sub Command2_Click(Index As Integer) frmbangluong.Show

End Sub

Private Sub mnub_Click() frmmain.Show

End Sub

Private Sub txttracuu_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cmdin.SetFocus End Select End Sub

Một phần của tài liệu Luận văn tốt nghiệp phân tích, thiết kế và xây dựng chương trình quản lý nhân sự công ty VMS mobifone (Trang 89 - 118)

Tải bản đầy đủ (PDF)

(124 trang)