Thiết kế các giải thuật

Một phần của tài liệu Xây dựng chương trình quản lý nhân sự và Tiền lương của Trung tâm CNTT thuộc Công ty Điện lực Hà Nội (Trang 57 - 110)

IV. Mối liên hệ giữa Access và VisualBasic

4.3.Thiết kế các giải thuật

4. Cơ sở dữ liệu

4.3.Thiết kế các giải thuật

Trong công tác quản lý nhân sự trên máy tính, mỗi cơ quan đều có hớng quản lý tơng đối giống nhau .Tuy nhiên trong các khâu xử lý lu trữ, tìm kiếm dữ liệu lại tuỳ thuộc vào từng cơ quan mà các cơ quan lại có sự sẵp xếp về tổ chức hoàn toàn khác nhau.Vì vậy để khắc phục đợc tình trạng này ta nên viết một chơng trình riêng về quản lý nhân sự.

Để viết đợc một chng trình mang tính khả thi thì đòi hỏi trợc tiên là phải có thuật toán đúng, đủ và phải là phng pháp giải quyết bài toán nhanh nhất, tối u nhất

3.1 Sơ đồ thuật toán nhập dữ liệu

Cập nhập Begin Nhập Nhập đầy đủ các thông tin Có cập nhập k0 Kết thúc End Không Không Có Nhập tiếp hay sửa lại không

Không Có

Begin Tìm kiếm Nhập đ/k tìm kiếm Có tồn tại không Hiện đầy đủ dữ liệu thoả mãn

Hiện thông báo không có dữ liệu thoản mãn

Kết thúc

End

3.2 Sơ đồ thuật toán tìm kiếm

Không

Begin Xóa Nhập thông tin cần xoá Có xoá hay ko Xoá Kết thúc End Không Không Có

Hình 4.3 Thuật toán xoá dữ liệu

3.3 Sơ đồ thuật toán xoá dữ liệu

Nhập tiếp hay sửa lại không

Không Có

Hình 6.4 Thuật toán báo cáo

3.4 Sơ đồ thuật toán báo cáo

Begin Báo cáo Có báo cáo hay ko Có xem trước khi in ko Mở báo cáo In Kết thúc End Không Có Có Không Không Nhập lại điều kiện không Không Nhập điều kiện báo cáo Có

5.Các Form chính của chơng trình

5.1 Form Mật khẩu

5.2 Form chính

Hình 4.1 Form chính của chơng trình 5.3 Form đổi mật khẩu:

5.4Cập nhật dân tộc

5.5 Thông tin cán bộ

5.6 form Lí lịch cán bộ

Hình 4.3 Lí lịch cán bộ

5.8 Form Thân nhân

5.9 Form Khen thởng

5.11Form Bảo hiểm Y tế (adsbygoogle = window.adsbygoogle || []).push({});

53 Form Tìm kiếm

6.báo cáo:

6.3Thống kê Đảng Viên

Kết Luận

Qua quá trình nghiên cứu, khảo sát, phân tích thiết kế, xây dựng đề tài :Quản lý nhân sự Trung tâm CNTT” .Với sự cố gắng của bản thân, sự tần tình của hớng dẫn và sự trao đổi quý giá của.Đề tài đã đợc hoàn thành .Qua quá trình phân tích thực tiễn công việc và phân tích thiết kế xây dựng chơng trình . Tuy chơng trình này còn đang có rất nhiều thiếu sót cha mang đợc tính ứng dụng cao mà chỉ mới mang tính chất thử nghiệm. Mặc dù vậy chơng trình này cũng mang lại cho nhà quản lý một số hiệu quả sau:

- Giúp cho công tác quản lý đợc nhanh chóng, chính xác, tiện dụng về nhiều mặt. - Có thể tự động hóa một số công việc trong công tác quản lý.

- Đáp ứng kịp thời các thông tin tổng hợp và chi tiết theo từng yêu cầu. - Tiết kiệm đợc thời gian, công sức và chi phí trong công tác quản lý. - Tận dụng tối đa những công cụ của phần mềm Visual Basic

+Đề tài góp phần vào việc đa tin học ứng dụng vào công việc : “Quản lý nhân sự Trung tâm CNTT” .

+Đa ra các kết quản thoả đáng,mẫu mã đẹp ,dữ liệu an toàn tuyệt đố bí mật,Giải phóng thời gian nhanh chóng, kịp thời đáp ứng đối với bất kỳ điều kiện nào .

Để phục vụ tốt hơn công tác quản lý nhân sự .Chơng trình cần có thêm chi tiết cụ thể hơn và khắc phục những hạn chế nảy sinh theo thời gian .Đề tài này còn có những thiếu sót, rất mong đợc sự quan tâm giúp đỡ và chỉ bảo của các thầy cô cùng với sự đóng góp xây dựng của các bạn có kinh nghiệm về công tác quản lý nhân sự, để khi ra trờng phục vụ công tác cơ quan đợc tốt hơn .

Cuối cùng em xin chân thành cảm ơn những góp ý, chỉ bảo của thầy Bùi Thế

Ngũ các thầy cô trong khoa, bạn bè đồng nghiệp và các thầy cô nơi em thực tập đã

giúp đỡ em hoàn thành bản đề án này.

Hà Nội, ngày tháng năm 200

Sinh viên thực hiện

Danh mục tài liệu tham khảo

1. Microsoft VisualBasic 6.0 &Lập trình cơ sở dữ liệu, NXB Lao Động-Xã Hội, Hà Nội, 2002. Tác giả:Nguyễn Thị Ngọc Mai

2. Giáo trình Cơ Sở Dữ Liệu , NXB Thống Kê, Hà Nội, 2000 Tác giả:Trần Công Uốn

3. Giáo trình Hệ Thôngd Thông Tin Quản Lý, Hà Nội, 2000 Tác giả:TS.Trơng Văn Tú-TS.Trần Thị Song Minh

4.Giáo trình Phân tích thiết kế hệ thống thông tin, Hà Nội,2004 Tác giả :Nguyễn Văn Vỵ

Phụ lục

1.Code Form Mật khẩu

Option Explicit Private flag As String

Dim rs As New ADODB.Recordset Dim str

Dim rs1 As New ADODB.Recordset Dim str1

Private Sub cmdclose_Click() Unload Me

End Sub

Private Sub cmdconnect_Click() If txtuser = "" Then

MsgBox "Bạn nhập thông tin đầy đử " txtuser.SetFocus

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

If txtpass = "" Then

MsgBox "Bạn nhập thông tin đầy đử " txtpass.SetFocus

Exit Sub End If

str = "select * from tblMatkhau where user='" & Trim(txtuser) & " '" rs.Open str, Cn, adOpenKeyset, adLockOptimistic

If rs.EOF = False Then

If mahoa(txtpass, txtuser) = rs!pass Then rs.Close fMain.Enabled = True fMain.Show Unload Me Exit Sub Else

MsgBox "Bạn nhập cha đúng thông tin" txtpass = "" txtuser = "" End If End If rs.Close End Sub

Private Sub Form_Load() open_mdb

End Sub

Private Sub txtpass_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

cmdconnect.SetFocus End Select

End Sub

Private Sub txtuser_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtpass.SetFocus End Select

End Sub

2.Code Hồ sơ cán bộ

Private Sub cboTinh_Change()

lblNguyenquan = txtXa + cboHuyen + cboTinh End Sub

Private Sub cboMahuyen_Change() Set rs = New ADODB.Recordset

rs.Open "select * from tblHuyen order by Mah", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF

cboTenhuyen.AddItem rs(2) rs.MoveNext

Loop End If End Sub

Private Sub cboHuyen_Click() If txtXa1 = " " Then

lblDiachi = cboHuyen + "-" + lblTentinh1 Else

lblDiachi = txtXa1 + "-" + lblTentinh1 + "-" + cboHuyen End If

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

Private Sub cbomatinh_Click()

lblTentinh = TimTen(" tblTinh ", cboMatinh) cboTenhuyen.Clear

Set rs = New ADODB.Recordset

rs.Open "select * from tblHuyen where MaT='" & cboMatinh & "' ", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF

cboTenhuyen.AddItem rs(2) rs.MoveNext

Loop End If End Sub

Private Sub cboTenhuyen_Click() If txtXa = " " Then

lblNguyenquan = cboTenhuyen + "-" + lblTentinh Else

lblNguyenquan = txtXa + "-" + cboTenhuyen + "-" + lblTentinh End If

End Sub

Private Sub cboTinh1_Click()

lblTentinh1 = TimTen(" tblTinh ", cboTinh1) cboHuyen.Clear

Set rs = New ADODB.Recordset

rs.Open "select * from tblHuyen where MaT='" & cboTinh1 & "' ", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF cboHuyen.AddItem rs(2) rs.MoveNext

Loop End If End Sub

Private Sub cboVochong_Click() If cboVochong Like "Không" Then txtCon = "_"

End If End Sub

Private Sub cmdBHXH_Click() bhxh.Show 1

End Sub

BaohiemYT.Show 1 End Sub

Private Sub cmdDaotao_Click() KhenThuong.Show 1

End Sub

Private Sub cmdHopdong_Click(Index As Integer) Hopdong.Show 1

End Sub

Private Sub cmdLuong_Click() luong.Show 1

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

Private Sub cmdNew_Click() Set_Null

Un_lock_text End Sub

Private Sub cboChucvu_Click() Set rs = New ADODB.Recordset

rs.Open "select * from tblChucvu order by Machucvu", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF If rs(0) = cboChucvu Then cboChucvu = rs(1) End If rs.MoveNext Loop End If End Sub

Private Sub cboDantoc_Click() Set rs = New ADODB.Recordset

rs.Open "select * from tblDantoc order by MaDantoc", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF If rs(0) = cboDantoc Then cboDantoc = rs(1)

End If

rs.MoveNext Loop

End If End Sub

Private Sub cboMaphongban_Click() Set rs = New ADODB.Recordset

rs.Open "select * from tblPhongban order by Maphongban", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF

If rs(0) = cboMaphongban Then lblTenPB = rs(1) End If rs.MoveNext Loop End If End Sub

Private Sub cboTongiao_Click() Set rs = New ADODB.Recordset

rs.Open "select * from tblTongiao order by Matongiao", Cn, adOpenStatic, adLockOptimistic

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF

If rs(0) = cboTongiao Then txtTongiao = rs(1) End If rs.MoveNext Loop End If End Sub

Private Sub cmdDel_Click() If txtMacanbo.Text = "" Then

MsgBox "Bạn cha nhập dữ liệu? ", , "Thông Báo" cmdUpdate.SetFocus

Else

Xoa_Du_lieu End If

End Sub

Private Sub cmdExit_Click() Dim r

If r = vbYes Then Unload Me End If End Sub (adsbygoogle = window.adsbygoogle || []).push({});

Private Sub cmdNgoaingu_Click() Vanbangchungchi.Show 1

End Sub

Private Sub cmdNhananh_Click() CommonDialog1.Action = 1

picture1.Picture = LoadPicture(CommonDialog1.FileName) txtDuongdananh = CommonDialog1.FileName

End Sub

Private Sub cmdQuatrinhdaotao_Click() quatrinhcongtac.Show 1

End Sub

Private Sub cmdSave_Click() If flag <> "update" Then flag = "save"

End If

Luu_du_lieu Set_Null End Sub

Private Sub cmdSkip_Click() Set_Null

Lock_Text End Sub

Private Sub cmdUpdate_Click() If txtMacanbo.Text = "" Then

MsgBox "Bạn cha có dữ liệu để xoá ", , "Thông báo" cmdUpdate.SetFocus Else flag = "update" sua_du_lieu End If cboMatinh = " " cboTinh1 = "" lblTentinh = "" lblTentinh1 = "" cboHuyen = " " cboTenhuyen = "" End Sub

Private Sub Command1_Click() CongTru.Show 1

End Sub

Private Sub Command3_Click() Kiluat.Show 1

End Sub

Private Sub Command4_Click() Quatrinhdaotao.Show 1

End Sub

Private Sub Command5_Click() Thannhan.Show 1

End Sub

Private Sub Command6_Click() Doandang.Show 1

End Sub

Private Sub Command7_Click() BoDoi.Show 1

End Sub

Private Sub Form_Load() Lock_Text

Display_Listview Lock_Text

Set rs = New ADODB.Recordset

rs.Open "select Matongiao,Tentongiao from tblTongiao order by Matongiao", Cn, adOpenStatic, adLockOptimistic (adsbygoogle = window.adsbygoogle || []).push({});

If rs.RecordCount > 0 Then rs.MoveFirst

Do While Not rs.EOF

cboTongiao.AddItem rs(1) rs.MoveNext

Loop End If

BoXung1 "tblDantoc", cboDantoc BoXung "tblGioitinh", cboGioitinh

BoXung "tblPhongban", cboMaphongban BoXung1 "tblChucvu", cboChucvu

Set rs = New ADODB.Recordset

rs.Open "select MaT,tinh from tblTinh order by MaT", Cn, adOpenStatic, adLockOptimistic

rs.MoveFirst

Do While Not rs.EOF cboMatinh.AddItem rs(0) cboTinh1.AddItem rs(0) rs.MoveNext

Loop End If

BoXung "tblVochong", cboVochong BoXung1 "tblHocvan", cboTrinhdohocvan

BoXung1 "tblTrinhdovanhoa", cboTrinhdovanhoa BoXung1 "tblThanhphanGD", cboThanhphanGD BoXung1 "tblTinh", cboNoicap

End Sub

Private Sub Xoa_Du_lieu() Dim str

Dim response

If Trim(txtMacanbo) = "" Then Exit Sub

End If

response = MsgBox("Bạn có chắc chắn xoá không?", vbYesNo + vbQuestion, "Thong bao")

If response = vbNo Then Exit Sub

Else

str = "delete from tblHosocongchuc where MaCb='" & Trim(txtMacanbo) & "'" Cn.Execute (str) End If Set_Null Lock_Text Display_Listview End Sub

Private Sub Luu_du_lieu()

Dim rs As New ADODB.Recordset Dim str

If Trim(txtMacanbo) = "" Then

MsgBox "Chú ý phải nhập dữ liệu trớc khi lu", vbOKOnly + vbExclamation, "Thông báo"

'Me.MousePointer = 0 Exit Sub

str = "select * from tblHosocongchuc where MaCB='" & Trim(txtMacanbo) & "'"

rs.Open str, Cn

If rs.EOF = True Then (adsbygoogle = window.adsbygoogle || []).push({});

str = "insert into tblHosocongchuc values('" & Trim(txtMacanbo) & "','" & Trim(cboMaphongban) & "','" & Trim(txtHoten) & "','" & Trim(dptNgaysinh) & "', '" & Trim(cboGioitinh) & "','" & Trim(lblNguyenquan) & "','" &

Trim(cboChucvu) & "','" & Trim(lblDiachi) & "','" & Trim(txtDienthoai) & "','" & Trim(cboTongiao) & "','" & Trim(cboDantoc) & "','" & Trim(txtSoCMT) & "','" & Trim(cboNoicap) & "','" & Trim(dptNgaycap) & "','" &

Trim(cboTrinhdovanhoa) & "','" & Trim(cboTrinhdohocvan) & "','" &

Trim(cboThanhphanGD) & "','" & Trim(cboVochong) & "','" & Trim(txtCon) & "','" & Trim(txtDuongdananh) & "' )"

Cn.Execute (str) Else

If flag = "save" Then

MsgBox "Mã tôn giáo [" & txtMacanbo & "] Đã tồn tại.Xin vui lòng kiểm tr lại", vbOKOnly + vbExclamation, "Thông báo"

' Me.MousePointer = 0 Exit Sub

End If

str = " update tblHosocongchuc set Maphongban= '" & Trim(cboMaphongban) & "',Hoten= '" & Trim(txtHoten) & "',ngaysinh= '" & Trim(dptNgaysinh) & "',Gioitinh= '" & Trim(cboGioitinh) & "',Nguyenquan='" &

Trim(lblNguyenquan) & "',Chucvu= '" & Trim(cboChucvu) & "',Diachithuongtru= '" & Trim(lblDiachi) & "',Dienthoai= '" &

Trim(txtDienthoai) & "',Tongiao= '" & Trim(cboTongiao) & "',Dantoc= '" & Trim(cboDantoc) & "',Socmt= '" & Trim(txtSoCMT) & "',Noicap= '" &

Trim(cboNoicap) & "',Ngaycap= '" & Trim(dptNgaycap) & "',Trinhdovanhoa= '" & Trim(cboTrinhdovanhoa) & "',Trinhdohocvan= '" &

Trim(cboTrinhdohocvan) & "',Thanhphangiadinh= '" &

Trim(cboThanhphanGD) & "',Vochong= '" & Trim(cboVochong) & "',Con= '" & Trim(txtCon) & "',Hinh= '" & Trim(txtDuongdananh) & "' where MaCB='" & Trim(txtMacanbo) & "' "

Cn.Execute (str) End If Lock_Text Display_Listview cmdNew.SetFocus Me.MousePointer = 0 End Sub

Private Sub Set_Null() txtMacanbo = "" txtHoten = "" cboGioitinh.Text = " " cboTongiao = " " 'dptNgaysinh = " " lblNguyenquan = "" lblDiachi = "" txtDienthoai = "" cboDantoc = " " cboChucvu = " " cboMaphongban = " " cboTrinhdohocvan = " " cboTrinhdovanhoa = " " cboVochong = " " txtCon = "" cboThanhphanGD = " " cboNoicap = " " txtSoCMT = " " lblTenPB = "" txtXa = "" txtXa1 = "" cboHuyen = " " cboTenhuyen = "" lblDiachi.Caption = "" End Sub

Private Sub Lock_Text() txtMacanbo.Enabled = False txtMacanbo.Enabled = False txtHoten.Enabled = False cboGioitinh.Enabled = False cboTongiao.Enabled = False dptNgaysinh.Enabled = False lblNguyenquan.Enabled = False lblDiachi.Enabled = False txtDienthoai.Enabled = False cboDantoc.Enabled = False cboChucvu.Enabled = False cboMaphongban.Enabled = False cboTrinhdohocvan.Enabled = False cboTrinhdovanhoa.Enabled = False

cboThanhphanGD.Enabled = False cmdSave.Enabled = False cmdSkip.Enabled = False cmdNew.Enabled = True cmdUpdate.Enabled = True cmdDel.Enabled = True flag = "" End Sub

Private Sub Un_lock_text() txtMacanbo.Enabled = True txtHoten.Enabled = True cboGioitinh.Enabled = True cboTongiao.Enabled = True dptNgaysinh.Enabled = True lblNguyenquan.Enabled = True lblDiachi.Enabled = True txtDienthoai.Enabled = True cboDantoc.Enabled = True cboChucvu.Enabled = True cboMaphongban.Enabled = True cboTrinhdohocvan.Enabled = True cboTrinhdovanhoa.Enabled = True cboThanhphanGD.Enabled = True cboMaphongban.SetFocus cmdSave.Enabled = True cmdSkip.Enabled = True cmdNew.Enabled = False cmdUpdate.Enabled = False cmdDel.Enabled = False End Sub

Private Sub Display_Listview() Dim rs As New ADODB.Recordset Dim str As String

Dim mitem As ListItem lvltem.ListItems.Clear

str = "select *from tblHosocongchuc order by Macb asc " rs.Open str, Cn, adOpenKeyset, adLockOptimistic, adCmdText lvltem.ListItems.Clear

If rs.EOF = False Then While Not rs.EOF

mitem.SubItems(1) = rs!Maphongban mitem.SubItems(2) = rs!Hoten mitem.SubItems(3) = rs!Ngaysinh mitem.SubItems(4) = rs!Gioitinh mitem.SubItems(5) = rs!Nguyenquan mitem.SubItems(6) = rs!Chucvu mitem.SubItems(7) = rs!Diachithuongtru mitem.SubItems(8) = rs!Dienthoai mitem.SubItems(9) = rs!Tongiao mitem.SubItems(10) = rs!Dantoc mitem.SubItems(11) = rs!SoCMT mitem.SubItems(12) = rs!Noicap mitem.SubItems(13) = rs!Ngaycap mitem.SubItems(14) = rs!Trinhdovanhoa mitem.SubItems(15) = rs!Trinhdohocvan mitem.SubItems(16) = rs!Thanhphangiadinh mitem.SubItems(17) = rs!Vochong mitem.SubItems(18) = rs!Con mitem.SubItems(19) = rs!Hinh

str = "select * from tblHosocongchuc where MaCB='" & rs!Macb & "'" rs.MoveNext

Wend End If End Sub

Private Sub sua_du_lieu() Un_lock_text

txtMacanbo.Enabled = False End Sub

Private Sub lvltem_ItemClick(ByVal Item As MSComctlLib.ListItem) Dim rs As ADODB.Recordset Dim str txtMacanbo = Item.Text cboMaphongban = Item.SubItems(1) txtHoten = Item.SubItems(2) dptNgaysinh = Item.SubItems(3) cboGioitinh = Item.SubItems(4) lblNguyenquan = Item.SubItems(5) cboChucvu = Item.SubItems(6) lblDiachi = Item.SubItems(7) txtDienthoai = Item.SubItems(8) cboTongiao = Item.SubItems(9) (adsbygoogle = window.adsbygoogle || []).push({});

cboDantoc = Item.SubItems(10) txtSoCMT = Item.SubItems(11) cboNoicap = Item.SubItems(12) dptNgaycap = Item.SubItems(13) cboTrinhdovanhoa = Item.SubItems(14) cboTrinhdohocvan = Item.SubItems(15) cboThanhphanGD = Item.SubItems(16) cboVochong = Item.SubItems(17) txtCon = Item.SubItems(18) txtDuongdananh = Item.SubItems(19) picture1 = LoadPicture(txtDuongdananh) End Sub

Private Sub cboMaphongban_GotFocus() cboMaphongban.BackColor = &H80000018 End Sub

Private Sub cboMaphongban_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboMaphongban.Text = "" Then MsgBox "ban chua nhap du lieu" cboMaphongban.SetFocus Else txtMacanbo.SetFocus End If End Select End Sub

Private Sub cboMaphongban_LostFocus() cboMaphongban.BackColor = &HFFFFFF cboMaphongban = Trim(cboMaphongban) End Sub

Private Sub txtMacanbo_GotFocus()

txtMacanbo.BackColor = &H80000018

txtMacanbo = UCase(Trim(cboMaphongban)) txtMacanbo.SelStart = Len(txtMacanbo) End Sub

Private Sub txtMacanbo_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

txtHoten.SetFocus End Select

Private Sub txtHoten_LostFocus() txtHoten.BackColor = &HFFFFFF End Sub

Private Sub txtHoten_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If txtHoten = "" Then

MsgBox "ban chua nhap du lieu" txtHoten.SetFocus Else dptNgaysinh.SetFocus End If End Select End Sub

Private Sub txtHoten_GotFocus()

txtHoten.BackColor = &H80000018 txtHoten = UCase(Trim(txtHoten)) End Sub

Private Sub dptNgaysinh_LostFocus()

dptNgaysinh.CalendarBackColor = &H80000018 End Sub

Private Sub dptNgaysinh_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

Me.cboGioitinh.SetFocus End Select

End Sub

Private Sub cboGioitinh_GotFocus() cboGioitinh.BackColor = &H80000018 End Sub

Private Sub cboGioitinh_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboGioitinh.Text <> "Nam" And cboGioitinh.Text <> "Nu" Then MsgBox "ban chua nhap du lieu sai rồi !"

cboGioitinh.SetFocus Else cboChucvu.SetFocus End If 'cboTongiao.SetFocus End Select (adsbygoogle = window.adsbygoogle || []).push({});

End Sub

Private Sub cbogioitinh_LostFocus() cboGioitinh.BackColor = &HFFFFFF cboGioitinh = Trim(cboGioitinh.Text) End Sub

Private Sub cboChucvu_GotFocus() cboChucvu.BackColor = &H80000018 End Sub

Private Sub cboChucvu_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboChucvu = "" Then

MsgBox "ban chua nhap du lieu" cboChucvu.SetFocus Else cmdNhananh.SetFocus End If End Select End Sub

Private Sub cboChucvu_LostFocus() cboChucvu.BackColor = &HFFFFFF cboChucvu = Trim(cboChucvu)

End Sub

Private Sub txtXa_GotFocus() txtXa.BackColor = &H80000018 txtXa = UCase(Trim(txtXa)) End Sub

Private Sub txtXa_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If txtXa = "" Then

MsgBox "ban chua nhap du lieu" txtXa.SetFocus Else cboMatinh.SetFocus End If End Select End Sub

Private Sub txtXa_LostFocus() txtXa.BackColor = &HFFFFFF txtXa = UCase(Trim(txtXa))

End Sub

Private Sub cboMatinh_GotFocus() cboMatinh.BackColor = &H80000018 End Sub

Private Sub cboMatinh_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboMatinh.Text = "" Then MsgBox "ban chua nhap du lieu" cboMatinh.SetFocus Else cboTenhuyen.SetFocus End If End Select End Sub

Private Sub cboMatinh_LostFocus() cboMatinh.BackColor = &HFFFFFF cboMatinh = Trim(cboMatinh)

End Sub

Private Sub cboTenhuyen_GotFocus() cboTenhuyen.BackColor = &H80000018 End Sub

Private Sub cboTenhuyen_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboTenhuyen.Text = "" Then MsgBox "ban chua nhap du lieu" cboTenhuyen.SetFocus Else txtXa1.SetFocus End If End Select End Sub

Private Sub cboTenhuyen_LostFocus() cboTenhuyen.BackColor = &HFFFFFF End Sub

Private Sub txtXa1_GotFocus() txtXa1.BackColor = &H80000018 End Sub

Private Sub txtXa1_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13 (adsbygoogle = window.adsbygoogle || []).push({});

If txtXa1 = " " Then

MsgBox "ban chua nhap du lieu" txtXa1.SetFocus Else cboTinh1.SetFocus End If End Select End Sub

Private Sub txtXa1_LostFocus() txtXa1.BackColor = &HFFFFFF End Sub

Private Sub cboTinh1_GotFocus() cboTinh1.BackColor = &H80000018 End Sub

Private Sub cboTinh1_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboTinh1.Text = "" Then

MsgBox "ban chua nhap du lieu" cboTinh1.SetFocus Else cboHuyen.SetFocus End If End Select End Sub

Private Sub cboTinh1_LostFocus() cboTinh1.BackColor = &HFFFFFF cboTinh1 = Trim(cboMatinh) End Sub

Private Sub cboHuyen_GotFocus() cboHuyen.BackColor = &H80000018 End Sub

Private Sub cboHuyen_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If cboHuyen.Text = "" Then MsgBox "ban chua nhap du lieu" cboHuyen.SetFocus

Else

End If End Select End Sub

Private Sub cboHuyen_LostFocus() cboHuyen.BackColor = &HFFFFFF End Sub

Private Sub txtSoCMT_GotFocus() txtSoCMT.BackColor = &H80000018 End Sub

Private Sub txtSoCMT_KeyPress(KeyAscii As Integer) Select Case KeyAscii

Case 13

If txtSoCMT = "" Or Not IsNumeric(txtSoCMT) = True Then MsgBox "ban chua nhap du lieu"

txtSoCMT.SetFocus Else dptNgaycap.SetFocus End If End Select End Sub

Một phần của tài liệu Xây dựng chương trình quản lý nhân sự và Tiền lương của Trung tâm CNTT thuộc Công ty Điện lực Hà Nội (Trang 57 - 110)