Đồ án Công nghệ thông tin- Quản lý tài sản cố định

1.1 Quản lý quyền truy cập.

Vì chương trình Quản lý TSCĐ phục vụ cho việc quản lý, thống kê tài sản cố định do các cơ quan, đơn vị nhà nước sử dụng, nên bảo mật dữ liệu là một công tác vô cùng quan trọng. Сhức năng quản lý quyền truy cập của những người được phép sử dụng chương trình có thể, cho phép, hạn chế, hoặc không cho phép sử dụng các chức năng của chương trình. Ta có thể chia những người được phép sử dụng chương trình thành 3 nhóm chính: người quản trị, người sử dụng cấp cao và người sử dụng thông thường.

• Người sử dụng thông thường: là nhóm người có quyền thấp nhất. Những người thuộc nhóm này chỉ có quyền được xem các dữ liệu của chương trình.

• Người sử dụng cấp cao: là nhóm người có quyền như người sử dụng thông thường nhưng được phép nhập, chỉnh sửa dữ liệu.

• Người quản trị: Đây là nhóm người có quyền cao nhất. Ngoài các quyền của nhóm người sử dụng cấp cao, nhóm này còn được phép quản lý các nhóm người khác. (Như được phép thêm, xoá, sửa chữa dữ liệu của các người dùng.)

 

 

doc92 trang | Chia sẻ: netpro | Lượt xem: 1953 | Lượt tải: 1download
Bạn đang xem trước 20 trang tài liệu Đồ án Công nghệ thông tin- Quản lý tài sản cố định, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
"FROM (tblLoaiTS_Detail INNER JOIN tblLoaiTS_master ON tblLoaiTS_Detail.MaloaiTS = tblLoaiTS_master.MaloaiTS) INNER JOIN (tblDonVi INNER JOIN tblTongHopTSCD_KLD_Master ON tblDonVi.MaDV = tblTongHopTSCD_KLD_Master.MaDV) ON tblLoaiTS_Detail.MaTS = tblTongHopTSCD_KLD_Master.MaTS;" Set rsDat = New ADODB.Recordset rsDat.Open qryDat, cnn, adOpenDynamic, adLockOptimistic Set rsKDat = New ADODB.Recordset rsKDat.Open qryKDat, cnn, adOpenDynamic, adLockOptimistic rs.MoveFirst Set NodX = Tree.Nodes.Add(, , rs!MaDV, rs!TenDV) rs.MoveNext While Not rs.EOF root = rs!DonViCT code = rs!MaDV nname = rs!TenDV Set NodX = Tree.Nodes.Add(root, tvwChild, code, nname) rs.MoveNext Wend Call MakeColumns Child_Load Me End Sub Private Sub MakeColumns() ' Clear the ColumnHeaders collection. List.ColumnHeaders.Clear ' Add four ColumnHeaders. 'List.ColumnHeaders.Add , , "STT", 550 List.ColumnHeaders.Add , , "M· TS", 1000 List.ColumnHeaders.Add , , "Tªn TS", 3000 List.ColumnHeaders.Add , , "Lo¹i TS", 2000 'List.ColumnHeaders.Add , , "Nhãm ", 2000 ' Set the EventFlag variable so this doesn't get done again and again. End Sub Private Sub AddListItem(ByRef xItem As ListItem, ByRef xRec As ADODB.Recordset, i As Integer) ' Add a ListItem setting its text, icon and small icon. Then ' add three ListSubItems setting the Key and Text of each. Set xItem = List.ListItems.Add xItem.Text = xRec!MaTS 'xItem.ListSubItems.Add key:="Ma TS", Text:=xRec!MaTS xItem.ListSubItems.Add key:="Tªn TS", Text:=xRec!TenTS xItem.ListSubItems.Add key:="Lo¹i TS", Text:=xRec!TenloaiTS 'xItem.ListSubItems.Add key:="Nhãm", Text:=xRec!Tennhom End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single) Mre Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = 0 Then Child_Unload Me End Sub Private Sub List_ColumnClick(ByVal ColumnHeader As ColumnHeader) If List.SortOrder = 0 Then List.SortOrder = 1 Else List.SortOrder = 0 List.SortKey = ColumnHeader.Index - 1 ' Set Sorted to True to sort the list. List.Sorted = True End Sub Private Sub Mybutton1_Click() Command1_Click End Sub Private Sub Timer1_Timer() If DV Tree.SelectedItem Then i = 0 DV = Tree.SelectedItem List.ListItems.Clear If Not (rsDat.BOF And rsDat.EOF) Then rsDat.MoveFirst If Not (rsKDat.BOF And rsKDat.EOF) Then rsKDat.MoveFirst While Not rsDat.EOF If rsDat!TenDV = DV Then Ma = rsDat!MaDV i = i + 1 AddListItem Li, rsDat, i End If rsDat.MoveNext Wend While Not rsKDat.EOF If rsKDat!TenDV = DV Then Ma = rsKDat!MaDV i = i + 1 AddListItem Li, rsKDat, i End If rsKDat.MoveNext Wend End If End Sub Private Sub Tree_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single) Dim Node As MSComctlLib.Node If Button = 2 Then Button = 1 frmPopUpMenu.SetDV DV, Ma Me.PopupMenu frmPopUpMenu.mnuDonvi End If End Sub 1.3 Form: frmNhapDat Dim sD As String Dim rsPh As ADODB.Recordset Dim rsDat As ADODB.Recordset Dim rsDat0 As ADODB.Recordset Dim AddFlag As Boolean Dim rsDV As ADODB.Recordset Dim rsTS As ADODB.Recordset Dim rsNhom As ADODB.Recordset Dim Dongia(100) As String Dim MaNhom(100) As String Dim nhom As String Private Sub cboNhomDat_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub cboNhomDat_GotFocus() CEmpty txtDiachi If cboNhomDat.ListIndex = -1 Then cboNhomDat.ListIndex = 0 Hien " Chän nhãm ®Êt t­¬ng øng cho tµi s¶n ®Êt" End Sub Private Sub cmdGhiDL_Click() If Dat = 1 Then rsTS.AddNew rsPh.AddNew rsDat.AddNew rsDat0.AddNew End If 'rsPh!MaPhieu = txtMaphieu.Text rsDat0!MaDV = MaDV rsDat!diachits = txtDiachi.Text rsPh!NgayLP = txtNgayLP.Text rsPh!TenNLP = txtTenNLP.Text rsDat!DientichKT = Val(txtDienTichTKT.Text) rsDat!DientichTT = Val(txtDientichTTT.Text) rsDat!GiatriTT = Val(txtGiaTriTT.Text) rsDat!GiayCN = Val(txtGiayCN.Text) rsDat!KoGiayCN = Val(txtKoGiayCN.Text) rsDat!ChiphiKT = Val(txtChiphiKT.Text) rsDat!Tang = Val(txtTang.Text) rsDat!Giam = Val(txtGiam.Text) rsDat!CSD = Val(txtCSD.Text) rsDat!Thue = Val(txtThue.Text) rsDat!Chia = Val(txtChia.Text) rsDat!Xaydungnha = Val(txtXaydungnha.Text) rsDat!Sudung = Val(txtSudung.Text) rsDat!Dichvu = Val(txtDichvu.Text) rsDat!MDC = Val(txtMDC.Text) rsDat!SDMDK = Val(txtSDMDK.Text) rsDat!GiatriCN = Val(txtGiatriCN.Text) rsDat!GiatriCCN = Val(txtGiatriCCN.Text) rsTS!TenTS = txtTenTS.Text If Dat = 1 Then CodeTS(1) = TangCode(CodeTS(1), 4) CodeP = TangCode(CodeP, 5) rsDat0!MaTS = CodeTS(1) rsDat0.Update rsTS!MaloaiTS = "001" rsPh!Maphieu = CodeP rsDat0!Maphieu = rsPh!Maphieu rsTS!MaTS = rsDat0!MaTS rsDat0.Update End If rsPh.Update rsTS!MaNhom = MaNhom(cboNhomDat.ListIndex) rsDat!STT = rsDat0!STT rsDat.Update rsTS.Update cmdNhapMoi.Enabled = True Mybutton3.Enabled = True Mybutton3.Refresh Dat = 0 Set_Code End Sub Private Sub cmdNhaplai_Click() Dim c As Control If Dat = 1 Then For Each c In Me.Controls If TypeOf c Is TextBox And c.Name txtTenDV And c.Name txtMaphieu Then c.Text = "" End If Next End If If Dat = 0 Then Form_Load End Sub Private Sub cmdNhapMoi_Click() Dim c As Control For Each c In Me.Controls If TypeOf c Is TextBox And c.Name "txtTenDV" And c.Name "txtMaphieu" Then c.Text = "" End If Next Dat = 1 Form_Load If SSTab1.Tab = 1 Then SSTab1.Tab = 0 AddFlag = True End Sub Private Sub cmdThoat_Click() Child_Unload frmNhapDat frmNhapDS.SSTab1.Tab = 0 frmNhapDS.Show End Sub Private Sub Form_Load() Child_Load Me Set rsPh = New ADODB.Recordset rsPh.Open "Select * from tblPhieu", cnn, adOpenDynamic, adLockOptimistic Set rsDat0 = New ADODB.Recordset rsDat0.Open "select * from tblTongHopDat_Master", cnn, adOpenDynamic, adLockOptimistic Set rsDat = New ADODB.Recordset rsDat.Open "Select * from tblTongHopDat_Detail", cnn, adOpenDynamic, adLockOptimistic Set rsTS = New ADODB.Recordset rsTS.Open "tblLoaiTS_Detail", cnn, adOpenDynamic, adLockOptimistic Set rsDV = New ADODB.Recordset rsDV.Open "tblDonVi", cnn, adOpenDynamic, adLockOptimistic Set rsNhom = New ADODB.Recordset rsNhom.Open "Select * from tblNhom", cnn, adOpenDynamic, adLockOptimistic If Dat = 0 Then rsDat0.MoveFirst rsDat.MoveFirst While rsDat0!MaTS MaTS rsDat.MoveNext rsDat0.MoveNext Wend rsTS.MoveFirst While rsTS!MaTS MaTS rsTS.MoveNext Wend Set rsPh = New ADODB.Recordset rsPh.Open "Select * from tblPhieu where tblPhieu!MaPhieu ='" & rsDat0!Maphieu & "' ;", cnn, adOpenDynamic, adLockOptimistic Set rsNhom = New ADODB.Recordset rsNhom.Open "Select * from tblNhom where tblNhom!Manhom ='" & rsTS!MaNhom & "' ;", cnn, adOpenDynamic, adLockOptimistic txtDiachi.Text = rsDat!diachits txtNgayLP.Text = Format(rsPh!NgayLP, "dd/mm/yyyy") txtTenNLP.Text = rsPh!TenNLP txtDienTichTKT.Text = rsDat!DientichKT txtDientichTTT.Text = rsDat!DientichTT txtGiaTriTT.Text = rsDat!GiatriTT txtGiayCN.Text = rsDat!GiayCN txtKoGiayCN.Text = rsDat!KoGiayCN txtChiphiKT.Text = rsDat!ChiphiKT txtTang.Text = rsDat!Tang txtGiam.Text = rsDat!Giam txtCSD.Text = rsDat!CSD txtXaydungnha.Text = rsDat!Xaydungnha txtMDC.Text = rsDat!MDC txtSDMDK.Text = rsDat!SDMDK txtDichvu.Text = rsDat!Dichvu txtThue.Text = rsDat!Thue txtChia.Text = rsDat!Chia txtGiatriCN.Text = rsDat!GiatriCN txtGiatriCCN.Text = rsDat!GiatriCCN txtTenTS = rsTS!TenTS txtSudung.Text = rsDat!Sudung txtMaphieu.Text = rsPh!Maphieu txtDongia.Text = rsNhom!Dongia nhom = rsNhom!MaNhom End If Set rsNhom = New ADODB.Recordset rsNhom.Open "Select * from tblNhom where tblnhom!MaloaiTS = '001' ;", cnn, adOpenDynamic, adLockOptimistic With rsDV If .EOF And .BOF Then .AddNew Else .MoveFirst While .EOF = False If rsDV!MaDV = MaDV Then txtTenDV.Text = rsDV!TenDV End If .MoveNext Wend End If End With If Dat = 1 Then txtMaphieu = TangCode(CodeP, 5) Dim i As Integer cboNhomDat.Clear i = 0 With rsNhom If Not (.EOF And .BOF) Then .MoveFirst While .EOF = False cboNhomDat.AddItem !tennhom Dongia(i) = !Dongia MaNhom(i) = !MaNhom i = i + 1 .MoveNext Wend End If End With If cboNhomDat.ListCount > 0 Then For i = 0 To cboNhomDat.ListCount - 1 If MaNhom(i) = nhom Then cboNhomDat.ListIndex = i Next End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Mre Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = 0 Then cmdThoat_Click End Sub Private Sub Mybutton1_Click() cmdGhiDL_Click End Sub Private Sub Mybutton2_Click() cmdNhaplai_Click End Sub Private Sub Mybutton3_Click() cmdNhapMoi_Click End Sub Private Sub Mybutton4_Click() cmdThoat_Click End Sub Private Sub Text3_Change() End Sub Private Sub Timer1_Timer() 'nut ghi du lieu On Error Resume Next Dim c As Control Dim ok As Boolean ok = True For Each c In Me.Controls If TypeOf c Is TextBox Or TypeOf c Is ComboBox Then If c.Text = "" Then ok = False End If Next If ok Then cmdGhiDL.Enabled = True Else cmdGhiDL.Enabled = False End If ' tinh don gia cua cac loai gia tri If cboNhomDat.ListIndex -1 Then txtDongia = Dongia(cboNhomDat.ListIndex) If txtDientichTTT "" Then txtGiaTriTT.Text = Val(txtDientichTTT.Text) * Val(txtDongia.Text) Else txtGiaTriTT.Text = "" End If If txtDienTichTKT "" Then txtChiphiKT.Text = Val(txtDienTichTKT.Text) * Val(txtDongia.Text) Else txtChiphiKT.Text = "" End If If txtGiayCN "" Then txtGiatriCN = Val(txtGiayCN.Text) * Val(txtDongia.Text) Else txtGiatriCN.Text = "" End If If txtKoGiayCN "" Then txtGiatriCCN.Text = Val(txtKoGiayCN.Text) * Val(txtDongia.Text) Else txtGiatriCCN.Text = "" End If End If 'tinh dien tich xay dung nha If txtXaydungnha.Text "" Then txtSudung.Text = Val(txtDientichTTT.Text) - Val(txtXaydungnha.Text) Else txtSudung.Text = "" End If 'tinh dien tich tang giam If txtDienTichTKT.Text "" Then Dim i As Variant i = Val(txtDientichTTT.Text) - Val(txtDienTichTKT.Text) If i > 0 Then txtTang.Text = i txtGiam.Text = 0 ElseIf i < 0 Then txtGiam.Text = -i txtTang.Text = 0 ElseIf i = 0 Then txtTang.Text = i txtGiam.Text = i End If End If 'xet dieu kien cua txtdientichttt If Val(txtDientichTTT.Text) < Val(txtXaydungnha.Text) Then txtDientichTTT.Text = "" txtDientichTTT.SetFocus txtXaydungnha.Text = "" End If If txtDientichTTT.Text = "" Then txtXaydungnha.Text = "" txtSudung.Text = "" txtTang.Text = "" txtGiam.Text = "" txtMDC.Text = "" txtGiayCN.Text = "" txtSDMDK.Text = "" 'xet dieu kien dien tich txtSDMDK If Dat = 0 Then If Val(txtSDMDK.Text) - Val(txtDichvu.Text) < Val(txtThue.Text) Then txtDichvu.Text = "" txtDichvu.SetFocus txtThue.Text = "" txtChia.Text = "" End If End If End If ' xet dieu kien txtMDC If Val(txtMDC.Text) > Val(txtDientichTTT.Text) Then txtMDC.SetFocus txtMDC.Text = "" txtSDMDK.Text = "" txtDichvu.Text = "" txtChia.Text = "" txtThue.Text = "" txtCSD.Text = "" End If If txtMDC.Text = "" Then txtSDMDK.Text = "" txtDichvu.Text = "" txtThue.Text = "" txtChia.Text = "" txtCSD.Text = "" End If ' tinh dien tich dich vu, thue, chia If txtDichvu.Text "" Then If Val(txtDichvu.Text) = Val(txtSDMDK.Text) Then txtThue.Text = 0 txtThue.Enabled = False txtChia.Text = 0 End If End If If txtThue "" Then If txtThue.Text < Val(txtSDMDK.Text) - Val(txtDichvu.Text) Then txtChia.Text = Val(txtSDMDK.Text) - Val(txtDichvu.Text) - Val(txtThue.Text) End If If txtThue.Text > Val(txtSDMDK.Text) - Val(txtDichvu.Text) Then txtThue.SetFocus txtThue.Text = "" End If If Val(txtThue.Text) + Val(txtDichvu.Text) = Val(txtSDMDK.Text) Then txtChia.Text = 0 End If End If End Sub Private Sub txtChia_GotFocus() CEmpty txtMDC End Sub Private Sub txtChia_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtChiphiKT_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtChiphiKT_GotFocus() CEmpty txtDienTichTKT End Sub Private Sub txtChiphiKT_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtCSD_GotFocus() CEmpty txtMDC End Sub Private Sub txtCSD_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtDiachi_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtDiaChi_GotFocus() CEmpty txtTenTS Hien " NhËp ®Þa chØ khu ®Êt vµo ®©y" End Sub Private Sub txtDichvu_Change() If txtDichvu.Text = "" Then txtChia.Text = "" txtThue.Text = "" End If If Val(txtDichvu.Text) > Val(txtSDMDK.Text) Then txtDichvu.SetFocus txtDichvu.Text = "" txtThue.Text = "" End If txtChia.Enabled = True txtThue.Enabled = True End Sub Private Sub txtDichvu_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtDichvu_GotFocus() CEmpty txtSDMDK Hien " NhËp diÖn tÝch ®Êt ®ang dïng cho s¶n xuÊt vµ kinh doanh ( chØ nhËp sè ) ko lín h¬n sö dông môc ®Ých kh¸c " End Sub Private Sub txtDientichCSD_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtDientichCSD_GotFocus() CEmpty txtNgayLP End Sub Private Sub txtDientichCSD_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtDienTichTKT_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtDienTichTKT_GotFocus() CEmpty txtGiaTriTT Hien " NhËp diÖn tÝch theo sæ kÕ to¸n vµo ®©y ( chØ nhËp sè )" End Sub Private Sub txtDienTichTKT_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtDienTichTKT_LostFocus() If SSTab1.Tab = 0 Then SSTab1.Tab = 1 End Sub Private Sub txtDientichTTT_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtDientichTTT_GotFocus() Hien " Nh¹p diÖn tÝch t¹i thêi ®iÓm kiÓm kª ( chØ nhËp sè ) " txtSDMDK.Enabled = True txtCSD.Enabled = True CEmpty txtDongia End Sub Private Sub txtDientichTTT_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtdungsx_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtDongia_GotFocus() CEmpty cboNhomDat txtGiaTriTT.Enabled = True End Sub Private Sub txtGiam_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtGiam_GotFocus() CEmpty txtTang End Sub Private Sub txtGiam_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtGiamCD_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtGiatriCCN_GotFocus() CEmpty txtKoGiayCN End Sub Private Sub txtGiatriCCN_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtGiatriCN_GotFocus() CEmpty txtGiayCN End Sub Private Sub txtGiatriCN_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtGiaTriTT_GotFocus() CEmpty txtXaydungnha End Sub Private Sub txtGiatriTT_KeyPress(KeyAscii As Integer) SubKeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtGiayCN_Change() If txtGiayCN.Text "" Then txtKoGiayCN.Text = Val(txtDientichTTT.Text) - Val(txtGiayCN.Text) Else txtKoGiayCN.Text = "" End If If Val(txtGiayCN.Text) > Val(txtDientichTTT.Text) Then txtGiayCN.SetFocus txtGiayCN.Text = "" End If End Sub Private Sub txtGiayCN_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtGiayCN_GotFocus() CEmpty txtCSD Hien " NhËp diÖn tÝch ch­a cã giÊy chøng nhËn quyÒn sö dông ®Êt ( chØ nhËp sè ) ko ®­îc lín h¬n tæng diÖn tÝch ®Êt " End Sub Private Sub txtGiayCN_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtKoGiayCN_GotFocus() CEmpty txtGiatriCN End Sub Private Sub txtKoGiayCN_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtMDC_Change() txtSDMDK.Enabled = True txtCSD.Enabled = True If Val(txtMDC.Text) = Val(txtDientichTTT.Text) Then txtSDMDK.Text = "0" txtSDMDK.Enabled = False txtCSD.Text = "0" txtCSD.Enabled = False txtDichvu.Enabled = False txtChia.Enabled = False txtThue.Enabled = False End If End Sub Private Sub txtMDC_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtMDC_GotFocus() Hien " NhËp diÖn tÝch sö dông cho môc ®Ých chÝnh ( chØ nhËp sè )" CEmpty txtDongia End Sub Private Sub txtMDC_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtNgayLP_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtNgayLP_GotFocus() CEmpty txtTenNLP Hien " B¹n cÇn nhËp ngµy vµo _/_/_/" End Sub Private Sub txtNgayLP_Validate(Cancel As Boolean) If Not IsDate(txtNgayLP) Then txtNgayLP.SetFocus txtNgayLP.Text = "" Cancel = True ElseIf DateValue(txtNgayLP) > Now() Or DateValue(txtNgayLP) < DateValue(Format("01/01/1998", "dd/mm/yyyy")) Then txtNgayLP.SetFocus txtNgayLP.Text = "" Cancel = True Else: txtNgayLP = Format(txtNgayLP, "dd/mm/yyyy") End If End Sub Private Sub txtQuan_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtQuan_GotFocus() CEmpty txtDiachi End Sub Private Sub txtSDMDK_Change() If Val(txtSDMDK.Text) = 0 Then txtDichvu.Text = 0 txtThue.Text = 0 txtChia.Text = 0 End If If txtSDMDK.Text "" Then If Val(txtSDMDK.Text) = Val(txtDientichTTT.Text) - Val(txtMDC.Text) Then txtCSD.Text = 0 txtCSD.Enabled = False ElseIf Val(txtSDMDK.Text) < Val(txtDientichTTT.Text) - Val(txtMDC.Text) Then txtCSD.Text = Val(txtDientichTTT.Text) - Val(txtMDC.Text) - Val(txtSDMDK.Text) txtCSD.Enabled = False ElseIf Val(txtSDMDK.Text) > Val(txtDientichTTT.Text) - Val(txtMDC.Text) Then txtSDMDK.SetFocus txtSDMDK.Text = "" txtThue.Text = "" txtDichvu.Text = "" txtChia.Text = "" End If Else txtSDMDK.Text = "" txtThue.Text = "" txtDichvu.Text = "" txtChia.Text = "" txtCSD.Text = "" End If End Sub Private Sub txtSDMDK_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtSDMDK_GotFocus() Hien " NhËp diÖn tÝch sö dung cho môc ®Ých kh¸c ( chØ nhËp sè )" txtCSD.Enabled = True CEmpty txtMDC txtChia.Enabled = True End Sub Private Sub txtSDMDK_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtSudung_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtSudung_GotFocus() CEmpty txtXaydungnha Hien " NhËp diÖn mtÝch ®É x©y dùng c«ng tr×nh vËt kiÕn tróc( chØ nhËp sè)" End Sub Private Sub txtSudung_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtTang_Click() cmdNhaplai.Enabled = True Mybutton2.Enabled = True End Sub Private Sub txtTang_GotFocus() CEmpty txtChiphiKT End Sub Private Sub txtTang_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtTenNLP_Change() If txtTenNLP.Text "" Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtTenNLP_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtTenNLP_GotFocus() Hien "B¹n cÇn nhËp lµ ch÷ vµo ®©y" End Sub Private Sub txtTenNLP_KeyPress(KeyAscii As Integer) KeyAscii = Char_Check(KeyAscii) End Sub Private Sub txtTenTS_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtTenTS_GotFocus() CEmpty txtNgayLP Hien " NhËp tªn ®¬n vÞ vµo ®©y" End Sub Private Sub txtThue_Change() If txtThue.Text = "" Then txtChia.Text = "" End If If Val(txtThue.Text) > Val(txtSDMDK.Text) - Val(txtDichvu.Text) Then txtThue.SetFocus txtThue.Text = "" txtChia.Text = "" End If End Sub Private Sub txtThue_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtThue_GotFocus() Hien " NhËp diÖn tÝch ®©ng dïng cho thuª ( chØ nhËp sè ) diÖn tÝch ko ®­îc lín h¬n (sö dông cho môc ®Ých kh¸c - ®ang dïng cho s¶n xuÊt kinh doanh.)" CEmpty txtSDMDK txtChia.Enabled = True End Sub Private Sub txtThue_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub Private Sub txtXaydungnha_Change() If Val(txtXaydungnha.Text) > Val(txtDientichTTT.Text) Then txtXaydungnha.SetFocus txtXaydungnha.Text = "" txtSudung.Text = "" End If End Sub Private Sub txtXaydungnha_Click() If Dat = 0 Then cmdNhaplai.Enabled = True Mybutton2.Enabled = True End If End Sub Private Sub txtXaydungnha_GotFocus() Hien " NhËp diÖn tÝch ®· dïng ®Ó x©y dùng nhµ ( chØ nhËp sè ) ko ®­îc lín h¬n tæng diÖn tÝch ®Êt " txtSudung.Enabled = True CEmpty txtDientichTTT End Sub Private Sub txtXaydungnha_KeyPress(KeyAscii As Integer) KeyAscii = Num_Check(KeyAscii) End Sub 1.4 Form : frmGiaoDich Dim rsDVA As ADODB.Recordset Dim rsDVB As ADODB.Recordset Dim rsDVN As ADODB.Recordset Dim rsTSD As ADODB.Recordset Dim rsTSKD As ADODB.Recordset Private rs As ADODB.Recordset Public mo As Integer Dim benA As String Dim benB As String Dim TS As String Dim DVN As String Const sql = "Select tblDonvi.MaDV, tblDonvi.TenDV from tblDonvi " Dim sqlTSD As String Dim sqlTSKD As String Dim i As Integer Dim CodeTS(100) As String Dim bA(100) As String Dim bB(100) As String Dim a As Integer Dim d As Integer Dim soluong(100) As Integer Private Sub cboBenA_GotFocus() Dim i As Integer Dim j As Integer cboBenA.Clear i = 0 Set rsDVA = New ADODB.Recordset rsDVA.Open sql, cnn, adOpenDynamic, adLockBatchOptimistic rsDVA.MoveFirst While Not rsDVA.EOF If rsDVA!TenDV benB Then cboBenA.AddItem rsDVA!TenDV If rsDVA!MaDV = MaDV Then j = i bA(i) = rsDVA!MaDV i = i + 1 End If rsDVA.MoveNext Wend rsDVA.Close Set rsDVA = Nothing cboBenA.ListIndex = j Me.Refresh End Sub Private Sub cboBenA_LostFocus() benA = cboBenA End Sub Private Sub cboBenB_Gotfocus() Dim i As Integer cboBenB.Clear Set rsDVB = New ADODB.Recordset rsDVB.Open sql, cnn, adOpenDynamic, adLockBatchOptimistic rsDVB.MoveFirst While Not rsDVB.EOF If rsDVB!TenDV benA Then cboBenB.AddItem rsDVB!TenDV bB(i) = rsDVB!MaDV i = i + 1 End If rsDVB.MoveNext Wend rsDVB.Close Set rsDVB = Nothing End Sub Private Sub cboBenB_LostFocus() benB = cboBenB End Sub Private Sub cboDVN_Lostfocus() DVN = cboDVN End Sub Private Sub cboTS_GotFocus() Dim i As Integer cboTS.Clear Set rsTSD = New ADODB.Recordset Set rsTSKD = New ADODB.Recordset i = 0 Select Case cboSort.ListIndex Case 1, 3: If benA "" Then a = 0 qryTSD = "SELECT tblDonVi.TenDV, tblLoaiTS_Detail.* " _ & "FROM (tblTongHopDat_Master INNER JOIN tblDonVi ON tblTongHopDat_Master.MaDV = tblDonVi.MaDV) INNER JOIN tblLoaiTS_Detail ON tblTongHopDat_Master.MaTS = tblLoaiTS_Detail.MaTS " _ & "Where tblDonVi.TenDV ='" & benA & "';" qryTSKD = "SELECT tblDonVi.TenDV, tblLoaiTS_Detail.* " _ & "FROM (tblLoaiTS_Detail INNER JOIN tblTongHopTSCD_KLD_Master ON tblLoaiTS_Detail.MaTS = tblTongHopTSCD_KLD_Master.MaTS) INNER JOIN tblDonVi ON tblTongHopTSCD_KLD_Master.MaDV = tblDonVi.MaDV " _ & "Where tblDonvi.tenDV ='" & benA & "';" End If Case 0, 2: a = 1 If benB "" And cboBenB.Enabled Then qryTSD = "SELECT tblDonVi.TenDV, tblLoaiTS_Detail.* " _ & "FROM (tblTongHopDat_Master INNER JOIN tblDonVi ON tblTongHopDat_Master.MaDV = tblDonVi.MaDV) INNER JOIN tblLoaiTS_Detail ON tblTongHopDat_Master.MaTS = tblLoaiTS_Detail.MaTS " _ & "Where tblDonVi.TenDV ='" & benB & "';" qryTSKD = "SELECT tblDonVi.TenDV, tblLoaiTS_Detail.* " _ & "FROM (tblLoaiTS_Detail INNER JOIN tblTongHopTSCD_KLD_Master ON tblLoaiTS_Detail.MaTS = tblTongHopTSCD_KLD_Master.MaTS) INNER JOIN tblDonVi ON tblTongHopTSCD_KLD_Master.MaDV = tblDonVi.MaDV " _ & "Where tblDonvi.tenDV ='" & benB & "';" End If End Select If qryTSD "" And qryTSKD "" Then rsTSD.Open qryTSD, cnn, adOpenDynamic, adLockOptimistic rsTSKD.Open qryTSKD, cnn, adOpenDynamic, adLockOptimistic While Not rsTSD.EOF cboTS.AddItem rsTSD!TenTS CodeTS(i) = rsTSD!MaTS i = i + 1 rsTSD.MoveNext Wend While Not rsTSKD.EOF cboTS.AddItem rsTSKD!TenTS CodeTS(i) = rsTSKD!MaTS i = i + 1 rsTSKD.Mov

Các file đính kèm theo tài liệu này:

  • docĐồ án công nghệ thông tin- Quản lý tài sản cố định.Doc
Tài liệu liên quan