Form Bỏo cỏo.

Một phần của tài liệu Phân tích thiết kế và xây dựng chương trình quản lý nhân sự (Trang 97 - 127)

- Phớch xử lý

6.7Form Bỏo cỏo.

5. Một số giải thuật xử lý chớnh

6.7Form 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.

Vớ dụ: Bỏo cỏo về lương. Click về Bỏo cỏo lương trờn Form main, sau đú lựa chọn tiờu chớ cần bỏo cỏo như: bỏo cỏo theo phũng ban, bỏo cỏo theo thỏng, theo năm.

LỜI KẾT:

Trờn đõy là chuyờn đề thực tậ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” 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 TS Trương Văn Tỳ- 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ảm ơn bỏc Nguyễn Cảnh Dinh - trưởng phũng TC- HC và 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

Hà Nội ngày 27/04/2007

Code của một số chương trỡnh chớnh 1. Đăng nhập

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

MsgBox "Bạn nhập sai thông tin ", vbOKOnly + vbInformation, "thongbao" txttn = "" txtmk = "" txttn.SetFocus dem = dem + 1 If dem >= 3 Then

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)

Private Sub txtmk_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

command1.SetFocus End Select

End Sub

Private Sub txttn_KeyPress(KeyAscii As Integer) Select Case KeyAscii (adsbygoogle = window.adsbygoogle || []).push({});

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

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 txtmanv.Enabled = False End Sub

Private Sub cmdct_Click()

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

Else

MsgBox "Bạn cha 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 cha chọn nhân viên!", vbOKOnly + vbExclamation, "Thông Báo" End If

Private Sub cmdktkl_Click()

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

Else

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

End Sub

Private Sub cmdin_Click() rpt_llnv.Show

End Sub

Private Sub cmdKetiep_Click() On Error GoTo errs

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:

Private Sub cmdLuu_Click() Dim str As String

If Len(Trim(txtmanv.Text)) = 0 Then (adsbygoogle = window.adsbygoogle || []).push({});

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 Call resetvalues Exit Sub End If 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

!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 Else !tennv = txttennv.Text !mapb = cbopb.Text !chucvudang = cboda.Text !chucvudoan = cbodo.Text !chucvucm = cbocvcm.Text !trinhdovh = cbotdvh.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 cmdxoa.Enabled = True cmdmoi.Enabled = True cmdsua.Enabled = False cmdboqua.Enabled = False cmdketiep.Enabled = False cmdquaylui.Enabled = True cmdluu.Enabled = False txtmanv.Enabled = False

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 cmdketiep.Enabled = False cmdquaylui.Enabled = False txtmanv.SetFocus addingCL = False End Sub

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

Private Sub Cmdxoa_Click() 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 (adsbygoogle = window.adsbygoogle || []).push({});

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

Me.cboda.AddItem rs3("macvdang") rs3.MoveNext

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

txtdc.Text = !Diachihiennay txtdt.Text = !sodt mskNgaysinh.Mask = "" mskNgaysinh.Text = !ngaysinh 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

Private Sub Grid1_Click() 'Call DisplayData cmdsua.Enabled = True 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

End Sub (adsbygoogle = window.adsbygoogle || []).push({});

Private Sub resetvalues() txtmanv.Text = "" txttennv.Text = "" Cbogt1 = "" txtdc.Text = "" txtdt.Text = "" mskNgaysinh.Mask = "" 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

Case 13

txttennv.SetFocus End Select

End Sub

Private Sub mnuback_Click() 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

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

txttennv.SetFocus End Select

End Sub

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

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 (adsbygoogle = window.adsbygoogle || []).push({});

cbotg.SetFocus End Select End Sub

Private Sub cbotg_KeyPress(KeyAscii As Integer) Select Case KeyAscii

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

Case 13

txtcmnd.SetFocus End Select

End Sub

Private Sub txtcmnd_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtnvao.SetFocus End Select

End Sub

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 (adsbygoogle = window.adsbygoogle || []).push({});

End Sub

Private Sub cbotdvh_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cbollct.SetFocus End Select End Sub

Private Sub cbollct_KeyPress(KeyAscii As Integer) Select Case KeyAscii

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 cbopb_gotfocus() cbopb.BackColor = &H8000000F End Sub

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

Private Sub cbogt1_gotfocus() Cbogt1.BackColor = &H8000000F

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 End Sub

Private Sub cbovh_gotfocus() Cbovh.BackColor = &H8000000F End Sub

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 (adsbygoogle = window.adsbygoogle || []).push({});

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

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

Private Sub mskngaysinh_gotfocus() mskNgaysinh.BackColor = &H8000000F End Sub

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

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

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 (adsbygoogle = window.adsbygoogle || []).push({});

'chuc vu cmon

If opttc(5).Value = True Then

End If 'tdllct

If opttc(6).Value = True Then

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 & "%'"

'chucvudoan

If opttc(9).Value = True Then

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

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

Private Sub cmdthoat_Click() Unload Me

End Sub (adsbygoogle = window.adsbygoogle || []).push({});

Private Sub Command1_Click(Index As Integer) frmktkl.Show

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 Phân tích thiết kế và xây dựng chương trình quản lý nhân sự (Trang 97 - 127)