Đề tài Quản lý sinh viên nội trú trường đại học Kinh tế Quốc dân

Vì thời gian có hạn nên báo cáo thực tập chuyên đề vẫn còn nhiều thiếu sót chưa kịp hoàn thành và sửa đổi . Em rất mong nhận được sự góp ý, nhận xét của các thầy cô khoa tin học kinh tế nói chung và thầy Bùi Thế Ngũ nói riêng. Xin chân thành cảm ơn thầy Bùi Thế Ngũ, đã hướng dẫn em tận tình trong quá trình chọn đề tài và trong quá trình thực tập tổng hợp. Em rất mong sự chỉ bảo tận tình hơn nữa của thầy để đề tài thực tập này được hoàn thành tốt. Tài liệu tham khảo • Cơ sở dữ liệu ( TS Trần Công Uẩn) • Hệ thống thông tin quản lý (TS. Trương Văn Tú) • Các tài liệu dự án của Công ty cổ phần phần mềm quản trị doanh nghiệp CyberSoft

doc159 trang | Chia sẻ: aloso | Lượt xem: 1875 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Đề tài Quản lý sinh viên nội trú trường đại học Kinh tế Quốc dân, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
uy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_khoa) MESSAGEBOX("Ban phai vao ma khãa") _form.txtma_khoa.setfocus RETURN ENDIF IF EMPTY(m.nam_hoc) MESSAGEBOX("Ban phai vao nam hoc") _form.txtnam_hoc.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_khoa)=ALLTRIM(m.ma_khoa) IF FOUND() mESSAGEBOX("Ma nay da co, hay chon ma khac") _form.txtma_khoa.setfocus RETURN ENDIF *!* IF NOT LEN(ALLTRIM(m.ma_khoa ))==2 *!* MESSAGEBOX("Ma nha phai co hai chu so") *!* _form.txtma_khoa.setfocus *!* RETURN *!* ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF !eof() IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDIF ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC dmLop IF !USED('dmLop') SELECT 0 USE p_cod+'dmLop' ALIAS dmLop INDEX ON ma_lop TO ma_lop SET ORDER TO ma_lop ELSE SELECT 0 SELECT dmLop SET ORDER TO ma_lop ENDIF ********************************************************************* PRIVATE m_nhan, m_huy, _form,_rec_no,M_moi, objBrow DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa SELECT dmLop GO TOP BROWSE NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT nomenu ; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECNO(),,oBrowse); TITLE "Danh muc lop: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; Color SCHEME 10 Obrowse.readonly = .T. DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 IF USED('dmLop') USE IN dmLop ENDIF DELETE file ma_lop.idx ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua,rec_no IF _moi_sua==[S] *!* m.ma_lop=nha.ma_lop *!* m.ten_lop=nha.ten_lop IF RECCOUNT('dmLop')=0 RETURN ENDIF rec_no=recno() GO rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK *!* m.ma_lop="" *!* m.ten_lop="" M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmLop-f3') NAME _form LINKED &&_form.show(1) &&HIEN THI FORM O CHE DO MODAL POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_lop) MESSAGEBOX("Ban phai vao ma lop") _form.txtma_lop.setfocus RETURN ENDIF IF EMPTY(m.ten_lop) MESSAGEBOX("Ban phai vao ten lop") _form.txtten_lop.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_lop)=ALLTRIM(m.ma_lop) IF FOUND() mESSAGEBOX("Ma nay da co, hay chon ma khac") _form.txtma_lop.setfocus RETURN ENDIF *!* IF NOT LEN(ALLTRIM(m.ma_lop ))==2 *!* MESSAGEBOX("Ma lop phai co hai chu so") *!* _form.txtma_lop.setfocus *!* RETURN *!* ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF !eof() IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDIF ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC dmNganh IF !USED('dmNganh') SELECT 0 USE p_cod+'dmNganh' ALIAS dmNganh INDEX ON ma_nganh TO ma_nganh SET ORDER TO ma_nganh ELSE SELECT 0 SELECT dmNganh SET ORDER TO ma_nganh ENDIF ********************************************************************* PRIVATE m_nhan, m_huy, _form,_rec_no,M_moi, objBrow DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa *!* BROWSE NAME objBrow TITLE "F3-Sua, F4-Them moi, F8-Xoa, ESC-Thoat" NOAPPEND NODELETE NOEDIT ; *!* nomenu IN SCREEN SELECT dmNganh GO TOP BROWSE NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT nomenu ; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECNO(),,oBrowse); TITLE "Danh muc nganh: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; Color SCHEME 10 Obrowse.readonly = .T. DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 IF USED('dmNganh') USE IN dmNganh ENDIF DELETE file ma_nganh.idx ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua,rec_no IF _moi_sua==[S] *!* m.ma_nganh=nha.ma_nganh *!* m.ten_nganh=nha.ten_nganh IF RECCOUNT('dmNganh')=0 RETURN ENDIF rec_no=recno() GO rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK *!* m.ma_nganh="" *!* m.ten_nganh="" M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmNganh-f3') NAME _form LINKED &&_form.show(1) &&HIEN THI FORM O CHE DO MODAL POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_nganh) MESSAGEBOX("Ban phai vao ma nganh") _form.txtma_nganh.setfocus RETURN ENDIF IF EMPTY(m.ten_nganh) MESSAGEBOX("Ban phai vao ten nganh") _form.txtten_nganh.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_nganh)=ALLTRIM(m.ma_nganh) IF FOUND() mESSAGEBOX("Ma nay da co, hay chon ma khac") _form.txtma_nganh.setfocus RETURN ENDIF *!* IF NOT LEN(ALLTRIM(m.ma_nganh ))==2 *!* MESSAGEBOX("Ma nha phai co hai chu so") *!* _form.txtma_nganh.setfocus *!* RETURN *!* ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF !eof() IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDIF ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC dmNha IF !USED('dmNha') SELECT 0 USE p_cod+'dmNha' ALIAS dmNha INDEX ON ma_nha TO ma_nha SET ORDER TO ma_nha ELSE SELECT 0 SELECT dmNha ENDIF ********************************************************************* PRIVATE m_nhan, m_huy, _form,_rec_no,M_moi, objBrow DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa SELECT dmNha GO TOP BROWSE NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT nomenu ; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECNO(),,oBrowse); TITLE "Bang danh sach nha trong KTX: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; Color SCHEME 10 Obrowse.readonly = .T. DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 IF USED('dmNha') USE IN dmNha ENDIF ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua,rec_no IF _moi_sua==[S] *!* m.ma_nha=nha.ma_nha *!* m.ten_nha=nha.ten_nha rec_no=recno() GO rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmNha-f3') NAME _form LINKED *!* _FORM.VISIBLE=.F. *!* _form.caption="Cap nhat thong tin ve cac nha trong KTX" *!* _form.icon=P_img+"a33.ico" *!* _form.show(1) &&HIEN THI FORM O CHE DO MODAL POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_nha) MESSAGEBOX("Ban phai vao ma nha") _form.txtma_nha.setfocus RETURN ENDIF IF EMPTY(m.ten_nha) MESSAGEBOX("Ban phai vao ten nha") _form.txtten_nha.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_nha)=ALLTRIM(m.ma_nha) IF FOUND() mESSAGEBOX("Ma nha nay da co, hay chon ma khac") _form.txtma_nha.setfocus RETURN ENDIF IF NOT LEN(ALLTRIM(m.ma_nha ))==2 MESSAGEBOX("Ma nha phai co hai chu so") _form.txtma_nha.setfocus RETURN ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() _oldSelect=SELECT() _nha_deleded=ALLTRIM(m.ma_nha) IF !USED('dmPhong') SELECT 0 USE (P_cod+'dmphong') ALIAS dmphong SHARED INDEX ON ma_phong TO ma_phong ELSE SELECT dmPhong ENDIF LOCATE FOR ALLTRIM(ma_nha)=_nha_deleded IF FOUND() MESSAGEBOX("Nha nay da nhap phong, khong the xoa",0+48,"TTDCDHKTQD") RETURN ENDIF USE IN dmPhong SELECT (_oldSelect) IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDPROC dmPhong ************** ************************************ IF !USED('dmPhong') SELECT 0 USE p_cod+'dmphong' ORDER ma_phong ALIAS dmphong exclusive INDEX ON ma_phong TO ma_phong ELSE SELECT dmphong ENDIF oldSEl=select() delete all for empty(alltrim(ma_phong)) ************************************************** PRIVATE m.ma_nha,m.ma_nha1, m.ten_nha ,m.ma_phong, m_nhan, m_huy,; _form,_rec_no,M_moi,objBrow PUBLIC rec_tam ********************************************************************* DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa SELECT dmphong GO TOP BROWSE FOR ALLTRIM(Ma_Nha)=ALLTRIM(M_nha_QL) NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT NOMENU; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECno(),,oBrowse); TITLE "Bang danh sach phong trong KTX: F3-Sua, F4-Them moi, F8-Xoa, Ctrl+F-Tim kiem, ESC-Thoat" ; FONT M_Font_name, M_font_Size oBrowse.DeleteMark = .F. oBrowse.RecordMark = .F. DO HookObjectBrowse WITH oBrowse IN P_prog+'S_Lib' BROWSE LAST FOR ALLTRIM(Ma_Nha)=ALLTRIM(M_nha_QL) ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 selec (oldSel) if used('dmPhong') use in dmPhong endif delete file ma_phong.idx ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua SELECT dmPhong IF _moi_sua==[S] _rec_no=RECNO() GO _rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] GO BOTTOM SCATTER MEMVAR BLANK m.Ma_phong=ALLTRIM(STR(VAL(dmPhong.ma_phong)+1)) m.ma_nha=dmPhong.ma_nha M_moi=.T. phong_moi=m.ma_phong nha=m.ma_nha ****************************update tien_dien if !used('tiendien') select 0 use P_data+'tien_dien' alias tiendien index on nam+thang+ma_phong+ma_nha to sap_xep else select tiendien endif set order to sap_xep locate for alltrim(ma_phong)=alltrim(phong_moi) and alltrim(ma_nha)=alltrim(nha) if !found() appen blank replace ma_phong with alltrim(phong_moi), ma_nha with alltrim(m.ma_nha) endif if used('tien_dien') use in tien_dien delete file sap_xep.idx endif tien_dien select (oldSEl) ****************************update tien_dien ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmPhong-f3') NAME _form LINKED select ma_nha from P_cod+'dmNha' INTO curs temp noconsole SELECT temp POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy SELECT dmPhong IF M_moi==.F. IF M_nhan_huy=.T. SELECT dmPhong GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. GO BOTTOM APPEND BLANK GATHER MEMVAR _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra SELECT dmPhong IF EMPTY(ALLTRIM(m.ma_phong)) MESSAGEBOX("Ban phai vao ma phong") _form.txtma_phong.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.ma_nha)) MESSAGEBOX("Ban phai vao ma nha") _form.cboma_nha.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_phong)=ALLTRIM(m.ma_phong) IF FOUND() IF SEEK(ALLTRIM(m.ma_nha)) MESSAGEBOX("Ma phong nay da co, hay chon ma khac") _form.txtma_phong.setfocus ENDIF RETURN ENDIF IF VAL(ALLTRIM(m.ma_phong))456 MESSAGEBOX("Ma phong chi co trong gioi han 101->456") _form.txtma_phong.setfocus RETURN ENDIF IF LEN(ALLTRIM(m.ma_phong))3 MESSAGEBOX("Ma phong phai co du 3 ky tu hoac so",0+32) _form.txtma_phong.setfocus RETURN ENDIF IF SUBSTR(m.ma_phong,1,1)SUBSTR(ALLTRIM(m.ma_nha),2,1) MESSAGEBOX("So dau tien cua ma phong phai trung voi ma nha",0+32) _form.txtma_phong.setfocus RETURN ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() _oldSelect=SELECT() _phong_deleded=ALLTRIM(m.ma_phong) *************** IF !USED('sinh_vien') SELECT 0 USE (P_data+'sinh_vien') ALIAS sinh_vien SHARED ELSE SELECT sinh_vien ENDIF LOCATE FOR ALLTRIM(ma_phong)=_phong_deleded IF FOUND() MESSAGEBOX("Phong nay da co sinh vien, khong the xoa",0+48,"TTDCDHKTQD") RETURN ENDIF USE IN sinh_vien ************** SELECT (_oldSelect) GO _rec_no IF RECCOUNT()<=0 MESSAGEBOX("Khong con ban ghi nao de xoa") ELSE IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no IF (RECCOUNT()>0) DELETE ELSE ENDIF GATHER MEMVAR FLUSH PACK DO batdau ENDIF ENDIF ENDPROC *********************************** PROCEDURE tim_phong PRIVATE m.phong_seached,m.nha_seached,__rec_no,_form_seach_phong m.phong_seached="" m.nha_seached="" PUSH KEY CLEAR DO FORM P_screen+'frmtim_phong' NAME _form_seach_phong LINKED _form_seach_phong.visible=.F. _form_seach_phong.caption="Tim kiem phong" _form_seach_phong.icon=P_img+'a33.ico' _form_seach_phong.show(1) POP KEY SELECT dmPhong LOCATE FOR ALLTRIM(ma_phong)==ALLTRIM(m.phong_seached) AND ALLTRIM(ma_nha)==ALLTRIM(m.nha_seached) IF FOUND() __rec_no=RECNO() GO __rec_no ELSE MESSAGEBOX("Khong tim thay") GO TOP ENDIF ENDPROC dmTG IF !USED('dmTG') SELECT 0 USE p_cod+'dmTG' ALIAS dmTG INDEX ON ma_tg TO ma_tg SET ORDER TO ma_tg ELSE SELECT 0 SELECT dmTG SET ORDER TO ma_tg ENDIF ********************************************************************* PRIVATE m_nhan, m_huy, _form,_rec_no,M_moi, objBrow DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa *!* BROWSE NAME objBrow TITLE "F3-Sua, F4-Them moi, F8-Xoa, ESC-Thoat" NOAPPEND NODELETE NOEDIT ; *!* nomenu IN SCREEN SELECT dmTG GO TOP BROWSE NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT nomenu ; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECNO(),,oBrowse); TITLE "Danh muc ton giao: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; Color SCHEME 10 Obrowse.readonly = .T. DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 IF USED('dmTG') USE IN dmTG ENDIF DELETE file ma_tg.idx ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua,rec_no IF _moi_sua==[S] *!* m.ma_tg=nha.ma_tg *!* m.ten_tg=nha.ten_tg IF RECCOUNT('dmTG')=0 RETURN ENDIF rec_no=recno() GO rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK *!* m.ma_tg="" *!* m.ten_tg="" M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmTG-f3') NAME _form LINKED &&_form.show(1) &&HIEN THI FORM O CHE DO MODAL POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_tg) MESSAGEBOX("Ban phai vao ma ton giao") _form.txtma_tg.setfocus RETURN ENDIF IF EMPTY(m.ten_tg) MESSAGEBOX("Ban phai vao ten ton giao") _form.txtten_tg.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_tg)=ALLTRIM(m.ma_tg) IF FOUND() mESSAGEBOX("Ma nay da co, hay chon ma khac") _form.txtma_tg.setfocus RETURN ENDIF *!* IF NOT LEN(ALLTRIM(m.ma_tg ))==2 *!* MESSAGEBOX("Ma nha phai co hai chu so") *!* _form.txtma_tg.setfocus *!* RETURN *!* ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF !eof() IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDIF ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC dmTinh IF !USED('dmTinh') SELECT 0 USE p_cod+'dmTinh' ALIAS dmTinh INDEX ON ma_tinh TO ma_tinh SET ORDER TO ma_tinh ELSE SELECT 0 SELECT dmTinh SET ORDER TO ma_tinh ENDIF ********************************************************************* PRIVATE m_nhan, m_huy, _form,_rec_no,M_moi, objBrow DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa SELECT dmTinh GO TOP BROWSE NAME oBrowse; NOAPPEND NODELETE NOMODIFY NOWAIT nomenu ; WINDOW M_WinBrw ; WHEN Change_Color_Of_Browse(RECNO(),,oBrowse); TITLE "Danh muc tinh: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; Color SCHEME 10 DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 IF USED('dmTinh') USE IN dmTinh ENDIF DELETE file ma_tinh.idx ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua,rec_no IF _moi_sua==[S] *!* m.ma_tinh=nha.ma_tinh *!* m.ten_tinh=nha.ten_tinh IF RECCOUNT('dmTinh')=0 RETURN ENDIF rec_no=recno() GO rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK *!* m.ma_tinh="" *!* m.ten_tinh="" M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'dmTinh-f3') NAME _form LINKED &&_form.show(1) &&HIEN THI FORM O CHE DO MODAL POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy IF M_moi==.F. IF M_nhan_huy=.T. GO rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra IF EMPTY(m.ma_tinh) MESSAGEBOX("Ban phai vao ma tinh") _form.txtma_tinh.setfocus RETURN ENDIF IF EMPTY(m.ten_tinh) MESSAGEBOX("Ban phai vao ten tinh") _form.txtten_tinh.setfocus RETURN ENDIF LOCATE FOR ALLTRIM(ma_tinh)=ALLTRIM(m.ma_tinh) IF FOUND() mESSAGEBOX("Ma nay da co, hay chon ma khac") _form.txtma_tinh.setfocus RETURN ENDIF *!* IF NOT LEN(ALLTRIM(m.ma_tinh ))==2 *!* MESSAGEBOX("Ma nha phai co hai chu so") *!* _form.txtma_tinh.setfocus *!* RETURN *!* ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF !eof() IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no GATHER MEMVAR FLUSH DELETE PACK DO batdau ENDIF ENDIF ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.Caption=cCaption ENDPROC do_dung.prg PUBLIC m.Nhan_thang m.Nhan_thang=.F. DO FORM P_screen+'Chon_thang' IF M.nhan_thang=.F. RETURN ENDIF IF !USED('do_dung') SELECT 0 USE P_data+'do_dung' ALIAS do_dung SET ORDER TO sap_xep ELSE SELECT 0 SELECT do_dung ENDIF SCATTER MEMVAR m.thang=M_thang_QL m.nam=M_Nam_QL DO FORM P_screen+'do_dung' NAME _form1 PROCEDURE V_nhan SELECT do_dung LOCATE FOR ALLTRIM(ma_phong)=ALLTRIM(m.ma_phong) IF FOUND() GATHER MEMVAR replace nam WITH ALLTRIM(M_nam_QL),thang WITH ALLTRIM(M_thang_QL) IF M_IsCheck='T' replace da_nhan WITH 'R' ELSE replace da_nhan WITH 'C' ENDIF ENDIF ENDPROC DS_user DO FORM P_screen+'DS_user' form_init PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC inivar if !used('inivar') select 0 USE (p_system)+'inivar' alias inivar SET SAFETY OFF INDEX ON stt TO stt set order to stt ELSE select 0 select inivar set order to stt ENDIF SCAN IF NOT EMPTY(Name) bien=inivar.name kieu=alltrim(inivar.type) giatri=ALLTRIM(value) *giatri=inivar.value1 PUBLIC (bien) if kieu=='C' &&neu kieu bien la char STORE giatri TO (bien) ENDIF if kieu=='N' &&neu kieu bien la nummeric STORE VAL(giatri) TO (bien) ENDIF if kieu=='D' &&neu kieu bien la datatime STORE ctod(giatri) TO (bien) ENDIF if kieu=='Y' &&neu kieu bien la currency STORE val(substr(giatri,1)) TO (bien) ENDIF if kieu=='T' &&neu kieu bien la kieu datetime STORE ctot(alltrim(giatri)) TO (bien) ENDIF if kieu=='L' &&neu kieu bien la kieu logical STORE alltrim(giatri) TO (bien) ENDIF ****************************** ENDIF ENDSCAN ky_luat ************** ************************************ IF !USED('ky_luat') SELECT 0 USE p_data+'ky_luat' ALIAS ky_luat ELSE SELECT ky_luat ENDIF INDEX ON stt TO order_kl SET ORDER TO order_kl ************************************************** PRIVATE M_moi,_rec_no,m_nhan, m_huy,_form,objBrow PUBLIC lcFileName ********************************************************************* lcFileName="" M_moi=.F. DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa ON KEY LABEL f7 do (P_prog+"report_kl") SELECT ky_luat SCATTER MEMVAR BROWSE NAME oBrowse ; NOAPPEND NODELETE NOMODIFY NOWAIT NOMENU ; TITLE "Danh sach sinh vien ky luat: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem, F7-Bao cao, F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; WINDOW M_WinBrw ; when Change_Color_Of_Browse(RECNO(),,oBrowse) DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST FOR ALLTRIM(Ma_nha)=ALLTRIM(M_nha_QL) ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 ON KEY LABEL f7 IF USED('ky_luat') USE IN ky_luat ENDIF ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua _oldSelectKL=SELECT() _oldRecnoKL=RECNO() SELECT ky_luat IF _moi_sua==[S] _rec_no=RECNO() IF _rec_noRECCOUNT('ky_luat') RETURN GO _rec_no ENDIF GO _rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'ky_luat') NAME _form LINKED POP KEY SELECT (_oldSelectKL) RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy SELECT ky_luat IF M_moi==.F. IF EMPTY(ALLTRIM(m.ma_phong)) OR EMPTY(ALLTRIM(m.ma_nha)) OR EMPTY(ALLTRIM(m.ma_sv)) RETURN ENDIF IF M_nhan_huy=.T. GO _rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF EMPTY(ALLTRIM(m.ma_phong)) OR EMPTY(ALLTRIM(m.ma_nha)) OR EMPTY(ALLTRIM(m.ma_sv)) RETURN ENDIF CALCULATE MAX(stt) TO m.stt m.stt=m.stt+1 m.ngay_thang=DATE() IF M_nhan_huy=.T. GO BOTTOM APPEND BLANK GATHER MEMVAR FLUSH _form="" ENDIF ENDIF lcFileName="" RETURN **************** Kiem tra *************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF RECCOUNT()<=0 MESSAGEBOX("Khong con ban ghi nao de xoa") RETURN ELSE IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no IF (RECCOUNT()>0) DELETE ELSE ENDIF GATHER MEMVAR FLUSH pacK DO batdau ENDIF ENDIF ENDPROC *********************************** login ***************************mo bang*************************** if !USED('userinfor') select 0 use p_system + "userinfor" alias userinfor ORDER user_id ENDIF ************************************************************** DO P_prog+"mahoa_pass" SELECT userinfor m.user_id="" m.Pass="" SELECT DISTINCT Ma_nha from P_Cod+'dmNha' INTO TABLE dmNhaTmp USE IN dmnha SELECT dmNhaTmp DO FORM P_Screen+"Dang_nhap" M_Skey=M_nha_QL **Kiem tra neu nguoi dung click chon 'Thoat' tren form dang nhap IF ALLTRIM(M_thoat)='T' ON SHUTDOWN QUIT RETURN ENDIF *____________________________________________________________^-^ M.user_id=ALLTRIM(M.user_id) SELECT userinfor IF SEEK(M.user_id) AND !EMPTY(m.user_id) IF ALLTRIM(mahoa(ALLTRIM(m.pass)))==ALLTRIM(userinfor.pass) OK=.T. if userinfor.Is_Admin==.F. STORE ALLTRIM(userinfor.right) TO M_menu_id endif ELSE OK=.F. USE IN userinform ENDIF ENDIF USE IN dmNhaTMP DELETE FILE dmNhaTMP.DBF logout DO End IN (P_prog+'start') *CLEAR ALL _shell="DO ..\WS\C.fxp" _shell="DO ..\WS\C.fxp" mahoa_pass FUNCTION MAHOA *-------------------------------------- PARAMETERS cMatma PRIVATE i,j j=0 FOR i=1 TO LEN(cMatma) j=j+ASC(SUBSTR(cMatma,i,1))*(i+1) ENDFOR cMatma=ALLTRIM(STR(j,LEN(cMatma)+3,0)) RETURN cMatma mainmenu if !used('command') SELECT 0 use P_system + "command.dbf" alias command ORDER menuid0 NOUPDATE endif ******************************************************* SET SYSMENU ON DO HideToolBar select Command _menu_idOld0="" *SET FILTER TO ALLTRIM(menuid)$ ALLTRIM(M_menu_id) IN command i=0 SCAN _menu_idOld0=Alltrim(command.Menuid0) IF empty(_menu_idOld0) ** Dinh nghi menu_lon menu_name='p'+alltrim(menuid) IF m_lan'1' DEFINE PAD &menu_name OF _mSysmenu PROMPT alltrim(bar) ELSE DEFINE PAD &menu_name OF _mSysmenu PROMPT alltrim(bar2) endif *________________________________________________________________________________________^-^ ON PAD &menu_name OF _msysmenu ACTIVATE POPUP &menu_name define popup &menu_name MARGIN RELATIVE COLOR SCHEME 4 *________________________________________________________________________________________- ELSE i=i+1 dieukien=ALLTRIM('M_'+ALLTRIM(STR(i))) PUBLIC (dieukien)&& dung de kiem tra xem nguoi dung hien tai co duoc phep truy cap vao bar nay hay khong if userinfor.Is_Admin==.F. STORE (ALLTRIM(menuid0)$ ALLTRIM(M_menu_id)) to (dieukien) else store .T. to (dieukien) endif IF m_lan'1' define bar i of &menu_name prompt alltrim(bar) PICTURE ALLTRIM(command.images) FONT M_font_name,M_font_size; SKIP FOR !(&dieukien) ELSE define bar i of &menu_name prompt alltrim(bar2) PICTURE ALLTRIM(command.images) FONT M_font_name,M_font_size; SKIP for !(&dieukien) ENDIF tt=alltrim(pro) ON Selection bar i OF &menu_name &tt ENDIF ENDSCAN PROCEDURE HideToolBar *-- Releases all Visual FoxPro toolbars LOCAL i TB_FORMDESIGNER_LOC = "Form Designer" TB_STANDARD_LOC = "Standard" TB_LAYOUT_LOC = "Layout" TB_QUERY_LOC = "Query Designer" TB_VIEWDESIGNER_LOC = "View Designer" TB_COLORPALETTE_LOC = "Color Palette" TB_FORMCONTROLS_LOC = "Form Controls" TB_DATADESIGNER_LOC = "Database Designer" TB_REPODESIGNER_LOC = "Report Designer" TB_REPOCONTROLS_LOC = "Report Controls" TB_PRINTPREVIEW_LOC = "Print Preview" WIN_COMMAND_LOC = "Command" && Command Window WIN_PROJECT_MAN = "Project Manager" DIMENSION aToolBars (13,2) aToolBars(1,1) = TB_FORMDESIGNER_LOC aToolBars(2,1) = TB_STANDARD_LOC aToolBars(3,1) = TB_LAYOUT_LOC aToolBars(4,1) = TB_QUERY_LOC aToolBars(5,1) = TB_VIEWDESIGNER_LOC aToolBars(6,1) = TB_COLORPALETTE_LOC aToolBars(7,1) = TB_FORMCONTROLS_LOC aToolBars(8,1) = TB_DATADESIGNER_LOC aToolBars(9,1) = TB_REPODESIGNER_LOC aToolBars(10,1) = TB_REPOCONTROLS_LOC aToolBars(11,1) = TB_PRINTPREVIEW_LOC aToolBars(12,1) = WIN_COMMAND_LOC aToolBars(13,1) = WIN_PROJECT_MAN FOR i = 1 TO ALEN(aToolBars, 1) aToolBars(i,2) = WVISIBLE(aToolBars(i,1)) IF aToolBars(i,2) HIDE WINDOW (aToolBars(i,1)) ENDIF ENDFOR RELEASE PAD _MTable OF _MSYSMENU RELEASE PAD _MEdit OF _MSYSMENU RELEASE PAD _MFile OF _MSYSMENU RELEASE PAD _MView OF _MSYSMENU RELEASE PAD _MSm_WINDO OF _MSYSMENU RELEASE PAD _MSm_FORMAT OF _MSYSMENU RELEASE PAD _MSm_TOOLS OF _MSYSMENU RELEASE PAD _MSm_PROG OF _MSYSMENU RELEASE PAD _MSm_SYSTM OF _MSYSMENU RELEASE PAD _MSm_TEXT OF _MSYSMENU ENDPROC NODEPRG procedure Fill_node(oForm,oNode,T_F) PRIVATE _oForm,_oNode,_T_F _oForm=oForm _oNode=oNode _T_F=T_F IF !Isnull(_oNode.child) THEN _oNode.checked=_T_F _oNode=_oNode.Child DO WHILE !ISNULL(_oNode) _oNode.checked=_T_F Fill_Node (_oForm,_oNode,_T_F) _oNode=_oNode.Next ENDDO ELSE _oNode.checked=_T_F ENDIF Endpro Options M_nhan_huy=.F. IF !USED('inivar') USE P_System+'inivar' ALIAS inivar INDEX ON Stt TO stt SET ORDER TO stt ELSE SELECT inivar ENDIF DELETE ALL FOR EMPTY(Diengiai) GO TOP SCATTER MEMVAR DO FORM (P_screen+'Options') USE IN inivar phan_quyen IF M_regOCX='F' WAIT WINDOW "Dang dang ki OCX cho chuc nang nay..." TIMEOUT 2 RUN /n REGSVR32 MSComctl.ocx M_regOCX='T' ENDIF DO FORM P_Screen+'Phan_quyen' RETURN select bar,menuid, menuid0 ; from P_system+"tblcommand" ; into curs phanquyen ; where empty(alltrim(menuid0)) order by menuid SELECT phanquyen _NumArray = RECCOUNT() _GT1 = "" _GT = "" DIMENSION Arraymenuid(2,_NumArray) i = 0 SCAN i = i + 1 IF i = 1 _GT = ALLTRIM(phanquyen.Bar) _GT1 = ALLTRIM(phanquyen.menuid) ENDIF Arraymenuid(1,i) = ALLTRIM(phanquyen.bar) Arraymenuid(2,i) = ALLTRIM(phanquyen.menuid) ENDSCAN select bar,menuid, menuid0,1 AS Quyen ; from P_system+"tblcommand" ; INTo TABLE ("C:\phanquyen1") ; where alltrim(menuid) = _GT1 AND !EMPTY(Menuid0); order by menuid,menuid0 REPL ALL Quyen WITH IIF(ALLTRIM(Menuid0) $ M_menu_id,1,0) DO FORM P_Screen+"Phanquyen" USE IN phanquyen report_kl push key clear if !used("ky_luat") oldSelect=select() oldRecno=recno() do usedTBL with "../data/","ky_luat" INDEX ON stt TO order_kl SET ORDER TO order_kl SELECT * from ky_luat WHERE ALLTRIM(ma_nha)=ALLTRIM(M_nha_QL) ORDER BY stt INTO TABLE ky_luatTMPrp SELECT ky_luatTMPrp INDEX ON stt TO order_klTMP SET ORDER TO order_klTMP REPORT FORM (P_Repo+"ky_luat") preview USE IN ky_luat SELECT (oldSelect) if oldRecno0 go oldRecno endif USE IN ky_luatTMPrp DELETE FILE order_klTMP.idx ELSE oldSelect=select() oldRecno=recno() SELECT * from ky_luat WHERE ALLTRIM(ma_nha)=ALLTRIM(M_nha_QL) ORDER BY stt INTO TABLE ky_luatTMPrp SELECT ky_luatTMPrp INDEX ON stt TO order_klTMP SET ORDER TO order_klTMP SET ORDER TO order_klTMP report form (P_Repo+"ky_luat") preview USE IN ky_luatTMPrp DELETE FILE order_klTMP.idx SELECT (oldSelect) if oldRecno0 go oldRecno endif ENDIF POP KEY report_sv push key clear if !used("sinh_vien") oldSelect=select() oldRecno=recno() do usedTBL with "../data/","sinh_vien" INDEX ON nam+Ma_sv+gioi_tinh+khoa+nganh+lop+ma_phong+ma_nha TO order_sv SET ORDER TO order_sv scatter memvar report form (P_Repo+"sinh_vien") preview use in sinh_vien select (oldSelect) if oldRecno0 go oldRecno endif else oldSelect=select() oldRecno=recno() select sinh_vien INDEX ON nam+Ma_sv+gioi_tinh+khoa+nganh+lop+ma_phong+ma_nha TO order_sv SET ORDER TO order_sv scatter memvar report form (P_Repo+"sinh_vien") preview select (oldSelect) if oldRecno0 go oldRecno endif endif pop key report_td push key clear if !used("tien_dien") oldSelect=select() oldRecno=recno() do usedTBL with "../data/","tien_dien" INDEX ON nam+thang+ma_phong+ma_nha TO order_td SET ORDER TO order_td SELECT DISTINCT * from tien_dien WHERE ALLTRIM(thang)=ALLTRIM(M_thang_QL) AND ALLTRIM(ma_nha)=ALLTRIM(M_nha_QL) AND ALLTRIM(nam)=ALLTRIM(M_nam_QL) ORDER BY nam,thang,ma_phong INTO TABLE tien_dienTMPrp SELECT tien_dienTMPrp INDEX ON ALLTRIM(nam)+ALLTRIM(thang)+ma_phong+ma_nha TO order_tdTMP SET ORDER TO order_tdTMP SCATTER MEMVAR REPORT FORM (P_Repo+"tien_dien") preview USE IN tien_dien SELECT (oldSelect) if oldRecno0 go oldRecno endif USE IN tien_dienTMPrp DELETE FILE order_tdTMP.idx ELSE oldSelect=select() oldRecno=recno() SELECT DISTINCT * from tien_dien WHERE ALLTRIM(thang)=ALLTRIM(M_thang_QL) AND ALLTRIM(ma_nha)=ALLTRIM(M_nha_QL) AND ALLTRIM(nam)=ALLTRIM(M_nam_QL) ORDER BY nam,thang,ma_phong INTO TABLE tien_dienTMPrp SELECT tien_dienTMPrp INDEX ON ALLTRIM(nam)+ALLTRIM(thang)+ma_phong+ma_nha TO order_tdTMP SET ORDER TO order_tdTMP SET ORDER TO order_tdTMP scatter memvar report form (P_Repo+"tien_dien") preview USE IN tien_dienTMPrp DELETE FILE order_tdTMP.idx SELECT (oldSelect) if oldRecno0 go oldRecno endif ENDIF POP KEY S_lib &&_____________________ Brow lai Table &&_____________________ && PROCEDURE HookObjectBrowse PARAMETERS oBrwTbl PRIVATE cControlSource oBrwTbl.Tag = ORDER() oBrwTbl.Comment = FILTER() oBrwTbl.DeleteMark = .F. oBrwTbl.RecordMark = .F. FOR i =1 TO oBrwTbl.ColumnCount WITH oBrwTbl.Columns(i) .BackColor = RGB(255, 255, 255) cCaption = .Header1.Caption .Header1.forecolor=16777215 .Header1.Backcolor=128 oBrwTbl.top=_screen.top-40 oBrwTbl.left=_screen.Left oBrwTbl.height=_screen.Height-10 oBrwTbl.width=_screen.Width ENDWITH ENDFOR IF oBrwTbl.Partition > 0 oBrwTbl.Panellink = .F. oBrwTbl.Panel = 0 oBrwTbl.ScrollBars = 0 oBrwTbl.Panel = 1 oBrwTbl.DeleteMark = .F. oBrwTbl.RecordMark = .F. oBrwTbl.Panellink = .T. oBrwTbl.Partition = oBrwTbl.Partition - 36 ENDIF oBrwTbl.gridlinecolor=12632235 oBrwTbl.forecolor=16711680 ENDPROC &&_____________________ Brow lai Table &&_____________________ && PROCEDURE BrowTable PARAMETERS tblTable,priKey,_fieldName,_path _oldSelect=SELECT() _oldRecno=RECNO() tmp= '&tblTable' pathTMP='&_path' IF !USED(tmp) SELECT 0 USE &pathTMP&tmp ALIAS &tblTable ELSE SELECT 0 SELECT &tblTable ENDIF GO RECNO() SCATTER MEMVAR ON KEY LABEL enter do Takerecord ON KEY LABEL ESC do TakeRecord BROWSE NOWAIT NAME oBrowse1; TITLE "Bang danh sach sinh vien trong KTX: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem, F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; WINDOW M_WinBrw DO HookObjectBrowse WITH oBrowse1 IN P_prog+'s_lib' BROWSE LAST ON KEY LABEL ESC ON KEY LABEL ENTER SELECT (_oldSelect) IF _oldRecno<=RECCOUNT() GO _oldRecno ENDIF _oldSelect='' _oldRecno=0 ENDPROC PROCEDURE takeRecord PUBLIC _m_ma PUBLIC _m_ten PUBLIC _m_ho_dem IF RECCOUNT()>0 _recno=RECNO() SCATTER MEMVAR GO _recno _m_ma=&PriKey _m_ten=&_fieldName _m_ten=ALLTRIM(_m_ten)+" " +ALLTRIM(m.ten) ENDIF USE IN &tblTable ENDPROC &&_____________________ Mo mot TABLE _______________________&& PROCEDURE UsedTBL PARAMETERS _path,tblTable &&Tham so duong dan va ten bang( tat ca deu nam trong ngoac nhay) tmp= '&tblTable' pathTMP='&_path' IF !USED(tmp) SELECT 0 USE &pathTMP&tmp ALIAS &tblTable ELSE SELECT 0 SELECT &tblTable ENDIF ENDPROC &&_____________________ Thiet lap thuoc tinh form _______________________&& PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption oForm.setall('SpecialEffect',1,'Textbox') oForm.setall('BorderColor',RGB(0,128,255),'Textbox') oForm.setall('BorderColor',RGB(0,128,255),'Combobox') ENDPROC PROCEDURE BrowTableSV PARAMETERS tblTable,priKey,_fieldName,_path _oldSelect=SELECT() _oldRecno=RECNO() tmp= '&tblTable' pathTMP='&_path' IF !USED(tmp) SELECT 0 USE &pathTMP&tmp ALIAS &tblTable ELSE SELECT 0 SELECT &tblTable ENDIF GO RECNO() ON KEY LABEL enter do TakerecordSV ON KEY LABEL ESC do TakeRecordSV BROWSE NOWAIT NAME oBrowse1; TITLE "Bang danh sach sinh vien trong KTX: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem, F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; WINDOW M_WinBrw DO HookObjectBrowse WITH oBrowse1 IN P_prog+'s_lib' BROWSE LAST FOR &M_skey ON KEY LABEL ESC ON KEY LABEL ENTER SELECT (_oldSelect) IF _oldRecno<=RECCOUNT() GO _oldRecno ENDIF _oldSelect='' _oldRecno=0 m_skey=oldSkey ENDPROC PROCEDURE takeRecordSV PUBLIC _m_ma PUBLIC _m_ten PUBLIC _m_ho_dem IF RECCOUNT()>0 _recno_sv=RECNO('&tblTable') SCATTER MEMVAR IF(recno('&tblTable')>0 and recno('&tblTable')<=RECCOUNT('&tblTable')) GO _recno_sv ENDIF _m_ma=&PriKey _m_ten=&_fieldName _m_ten=ALLTRIM(_m_ten)+" " +ALLTRIM(m.ten) ENDIF USE IN &tblTable ENDPROC &&_____________________ Mo mot TABLE _______________________&& sinh_vien ************** ************************************ IF !USED('sinh_vien') SELECT 0 USE p_data+'sinh_vien' ALIAS sinh_vien ELSE SELECT sinh_vien ENDIF INDEX ON nam+Ma_sv+gioi_tinh+khoa+nganh+lop+ma_phong+ma_nha TO order_sv SET ORDER TO order_sv ************************************************** PRIVATE M_moi,_rec_no,m_nhan, m_huy,_form,objBrow PUBLIC lcFileName ********************************************************************* lcFileName="" M_moi=.F. DO batdau PROCEDURE batdau ON KEY LABEL F3 do _moi_sua with [S] ON KEY LABEL F4 do _moi_sua with [M] ON KEY LABEL F8 do xoa ON KEY LABEL f7 do (P_prog+"report_sv") SELECT sinh_vien BROWSE NAME oBrowse ; NOAPPEND NODELETE NOMODIFY NOWAIT NOMENU ; TITLE "Bang danh sach sinh vien trong KTX: F3-Sua, F4-Them moi, Ctrl+F-Tim kiem, F7-Bao cao, F8-Xoa, ESC-Thoat" ; FONT M_Font_name, M_font_Size; WINDOW M_WinBrw ; when Change_Color_Of_Browse(RECNO(),,oBrowse) DO HookObjectBrowse WITH oBrowse IN P_prog+'S_lib' BROWSE LAST FOR ALLTRIM(nam)=ALLTRIM(M_nam_QL) AND ALLTRIM(Ma_nha)=ALLTRIM(M_nha_QL) ON KEY LABEL F3 ON KEY LABEL F4 ON KEY LABEL F8 ON KEY LABEL f7 IF USED('sinh_vien') USE IN sinh_vien ENDIF ENDPROC **------------------------------------------------------- PROCEDURE _moi_sua PARAMETERS _moi_sua SELECT sinh_vien IF _moi_sua==[S] _rec_no=RECNO() GO _rec_no SCATTER MEMVAR M_moi=.F. ELSE IF _moi_sua=[M] SCATTER MEMVAR BLANK M_moi=.T. ENDIF ENDIF PUSH KEY CLEAR DO FORM (p_screen+'sinh_vien') NAME _form LINKED POP KEY RETURN ************************************************************* PROCEDURE Nhan_Huy PARAMETERS M_nhan_huy SELECT sinh_vien IF M_moi==.F. IF M_nhan_huy=.T. GO _rec_no GATHER MEMVAR FLUSH _form="" ENDIF ELSE IF M_nhan_huy=.T. GO BOTTOM APPEND BLANK GATHER MEMVAR REPLACE sinh_vien.photo_file WITH lcFileName FLUSH _form="" ENDIF ENDIF lcFileName="" RETURN **************** Kiem tra *************************************** PROCEDURE Kiem_tra PUBLIC sv_count_phong _oldSelect2=SELECT() _oldRecno2=RECNO() sv_count_phong=0 SELECT sinh_vien IF EMPTY(ALLTRIM(m.ma_sv)) MESSAGEBOX("Ban phai vao ma sinh vien") _form.txtma_sv.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.ho_dem)) MESSAGEBOX("Ban phai vao ho dem") _form.txtho_dem.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.ten)) MESSAGEBOX("Ban phai vao ten sinh vien") _form.txtten.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(DTOC(m.ngay_sinh))) MESSAGEBOX("Ban phai vao ngay sinh") _form.txtngay_sinh.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.ten_bo)) MESSAGEBOX("Ban phai vao ho ten bo sinh vien") _form.txtten_bo.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.nghe_bo)) MESSAGEBOX("Ban phai vao nghe nghiep cua bo sinh vien") _form.txtnghe_bo.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.ten_me)) MESSAGEBOX("Ban phai vao ten me sinh vien") _form.txtten_me.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.nghe_me)) MESSAGEBOX("Ban phai vao nghe me sinh vien") _form.txtnghe_me.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.so_cmnd)) MESSAGEBOX("Ban phai vao so CMTND") _form.txtso_cmnd.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.lop)) MESSAGEBOX("Ban phai vao ten lop cua sinh vien") _form.txtlop.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.nganh)) MESSAGEBOX("Ban phai vao ten nganh") _form.txtten_nganh.setfocus RETURN ENDIF IF EMPTY(ALLTRIM(m.khoa)) MESSAGEBOX("Ban phai vao khoa hoc") _form.txtkhoa_hoc.setfocus RETURN ENDIF IF SEEK(ALLTRIM(m.ma_sv)) AND M_moi==.T. MESSAGEBOX("Ma sinh vien nay da co, hay chon ma khac") _form.txtma_sv.setfocus RETURN ENDIF SCAN FOR ALLTRIM(ma_phong)=ALLTRIM(m.ma_phong) sv_count_phong=sv_count_phong+1 IF sv_count_phong>10 AND !EMPTY(ALLTRIM(m.ma_phong)) MESSAGEBOX("Da du nguoi trong phong, hay chon phong khac") _form.txtma_phong.setfocus RETURN ENDIF IF sv_count_phong<10 LOCATE FOR ALLTRIM(gioi_tinh)=ALLTRIM(m.gioi_tinh) AND ALLTRIM(ma_phong)=ALLTRIM(m.ma_phong) IF !FOUND() &&AND ALLTRIM(ma_sv)ALLTRIM(m.ma_sv) MESSAGEBOX("Khong duoc de nam nu o chung phong") _form.txtma_phong.setfocus RETURN ENDIF ENDIF ENDSCAN SELECT (_oldSelect2) IF _oldRecno2<=RECCOUNT() GO _oldRecno2 ENDIF DO Nhan_huy WITH .T. RETURN ****************************************************************** PROCEDURE xoa PRIVATE _rec_no SCATTER MEMVAR _rec_no=RECNO() IF RECCOUNT()<=0 MESSAGEBOX("Khong con ban ghi nao de xoa") RETURN ELSE IF Messagebox(m_Suredele, 36+256, M_TencTy) = 6 GO _rec_no IF (RECCOUNT()>0) DELETE ELSE ENDIF GATHER MEMVAR FLUSH pacK DO batdau ENDIF ENDIF ENDPROC *********************************** PROCEDURE Add_photo CD &P_img lcFileName = GETFILE("JPG","Ten anh","Chon",2,M_tencty) CD &P_ws lcFileName=SUBSTR(lcFileName,RAT('\',lcFileName,1),LEN(ALLTRIM(lcFileName))-RAT('\',lcFileName,1)+2) lcFileName=P_img+lcFileName IF !EMPTY(lcFileName) AND FILE(lcFileName) IF M_moi=.F. SELECT sinh_vien REPLACE sinh_vien.photo_file WITH lcFileName ENDIF flag=1 _form.Image.Picture=lcFileName _form.Refresh() ENDIF ENDPROC *********************************** PROCEDURE test_photo RETURN *!* SET MULTILOCKS ON *!* lSuccess=CURSORSETPROP("Buffering", 5, "sinh_vien") *!* IF lSuccess=.T. *!* IF "3" $ GETFLDSTATE(-1) OR "4" $ GETFLDSTATE(-1) *!* _form.Caption = M_tencty *!* ELSE *!* _form.Caption = M_tencty *!* ENDIF *!* ENDIF ENDPROC PROCEDURE sinh_vien_refresh LOCAL lcFile IF FILE(sinh_vien.photo_file) AND M_moi=.F. lcFile = sinh_vien.photo_file _form.Image.Picture=lcFile RETURN ENDIF IF FILE(lcFileName) AND M_moi=.T. _form.image.picture=lcFileName ENDIF ENDPROC PROCEDURE testphong _oldSelect1=SELECT() _oldRecno1=RECNO() IF !USED('dmphong') SELECT 0 USE p_cod+'dmphong' ALIAS dmphong INDEX ON ma_phong TO ma_phong SET ORDER TO ma_phong ELSE SELECT dmPhong ENDIF LOCATE FOR ALLTRIM(ma_phong)=ALLTRIM(m.ma_phong) IF !FOUND() _form.txtma_phong.value="" _form.txtma_nha.value="" _form.txtma_phong.setfocus _form.refresh MESSAGEBOX("Khong co phong nay",0+256) USE IN dmphong RETURN ENDIF m.ma_nha='0'+ALLTRIM(SUBSTR(m.ma_phong,1,1)) USE IN dmphong SELECT (_oldSelect1) IF _oldRecno1<=RECCOUNT() GO _oldRecno1 ENDIF _oldRecno1=0 _oldSelect1='' ENDPROC PROCEDURE form_init PARAMETERS oForm,cCaption oForm.setall('FontName',M_font_name) oForm.setall('FontSize',M_font_size) oForm.Caption=cCaption ENDPROC start Do SetEnv PUBLIC P_COD,P_DATA,P_Screen,P_system,P_Prog,P_Img,P_Repo, P_WS, OK DO Setpath DO (P_prog + "sysvar") DO (P_prog + "inivar") DO DEFINE_WINDOW SET PROCEDURE TO (P_prog+'S_Lib') ADDITIVE DO HideToolBar IN p_prog+"mainmenu" _screen.Caption=M_tencty _screen.Icon=P_img+"A13.ICO" _screen.Picture=P_img+'3.JPG' _screen.Closable= .T. _vfp.StatusBar="Chuong trinh quan ly" ON KEY LABEL ALT+Q do end DO P_prog+"login.fxp" IF NOT OK MESSAGEBOX("Sai mat khau") DO (P_prog+'logout') RETURN ENDIF SET SYSMENU ON DO P_prog+'mainmenu' READ EVENTS ON KEY LABEL ALT+Q RETURN READ EVENTS RETURN **Thiet lap duong dan PROCEDUR Setpath P_COD ='..\cod\' P_DATA ='..\data\' P_Screen ='..\Screen\' P_system ='..\System\' P_Prog ='..\Prog\' P_Img ='..\Img\' P_Repo ='..\Repo\' P_WS ='..\WS\' return PROCEDURE End CLOSE DATABASES CLEAR CLEAR ALL CLEAR EVENTS RELEASE ALL SET SYSMENU TO DEFAULT do A return PROCEDURE SetEnv CLOSE DATABASES CLEAR ALL CLEAR EVENTS CLEAR SET DATE french _vfp.StatusBar="" SET SYSMENU ON HIDE WINDOW all SET DElETED ON SET AUTO off SET DEVELO ON SET SAFETY OFF RETURN FUNCTION Change_Color_Of_Browse(nRecord,cOldDynamicBackColor,oBrw) RETURN oBrw.SetAll("DynamicBackColor","IIF(RECNO()="+STR(nRecord)+",13172190,"+; IIF(EMPTY(cOldDynamicBackColor),"''",cOldDynamicBackColor)+")","Column") ENDFUNC ******************* KHAI BAO WINDOW KHI BROW MOT DANH MUC HOAC ******************* PROCEDURE DEFINE_WINDOW m_ScrRow = SROW() m_ScrCol = SCOL() DEFINE WINDOW m_WinBrw FROM 2, 0 TO FLOOR(m_ScrRow) - 2, FLOOR(m_ScrCoL) COLOR SCHEME 10 ; CLOSE FLOAT GROW MINIMIZE ZOOM SYSTEM FONT m_Font_Name, m_Font_Size - 2 ; ICON FILE LOCFILE(P_Img+ "A33.Ico") ENDPROC sysvar if !used('sysvar') select 0 USE (p_system)+'sysvar' order stt alias sysvar ELSE select 0 select sysvar set order to stt ENDIF SCAN bien=sysvar.name kieu=alltrim(sysvar.type) giatri=ALLTRIM(value) *giatri=sysvar.value1 PUBLIC (bien) if kieu=='C' &&neu kieu bien la char STORE giatri TO (bien) ENDIF if kieu=='N' &&neu kieu bien la nummeric STORE VAL(giatri) TO (bien) ENDIF if kieu=='D' &&neu kieu bien la datatime STORE ctod(giatri) TO (bien) ENDIF if kieu=='Y' &&neu kieu bien la currency STORE val(substr(giatri,1)) TO (bien) ENDIF if kieu=='T' &&neu kieu bien la kieu datetime STORE ctot(alltrim(giatri)) TO (bien) ENDIF if kieu=='L' &&neu kieu bien la kieu logical STORE ALLTRIM(giatri) TO (bien) ENDIF ****************************** ENDSCAN tien_dien if !used('tien_dien') USE (P_data+'tien_dien') ALIAS tien_dien ELSE SELECT tien_dien endif INDEX ON ma_phong TO ma_phong SET ORDER TO ma_phong SCAN FOR EMPTY(thang) replace thang WITH MONTH(DATE()) ENDSCAN M_skey=M_Nha_QL oldM_skey=M_skey M_skey="alltrim(ma_nha)='"+alltrim(M_sKey)+"' AND alltrim(thang)='"+alltrim(M_thang_QL)+"' AND alltrim(nam)='"+alltrim(M_nam_QL)+"'" select * from tien_dien where &M_skey into table tien_dienTMP select tien_dienTMP GO TOP SCATTER MEMVAR m.ma_nha=M_Nha_QL LOCATE FOR ma_phong=ALLTRIM(m.ma_phong) on key label f7 do (P_prog+"report_td") DO form (P_screen+'tien_dien') on key label f7 M_skey=oldM_skey if used('tien_dienTMP') USE IN tien_dienTMP endif if used('tien_dien') USE IN tien_dien endif delete file tien_dienTMP.dbf delete file ma_phong.idx &&alltrim(M_thang_QL) KẾT LUẬN Vì thời gian có hạn nên báo cáo thực tập chuyên đề vẫn còn nhiều thiếu sót chưa kịp hoàn thành và sửa đổi . Em rất mong nhận được sự góp ý, nhận xét của các thầy cô khoa tin học kinh tế nói chung và thầy Bùi Thế Ngũ nói riêng. Xin chân thành cảm ơn thầy Bùi Thế Ngũ, đã hướng dẫn em tận tình trong quá trình chọn đề tài và trong quá trình thực tập tổng hợp. Em rất mong sự chỉ bảo tận tình hơn nữa của thầy để đề tài thực tập này được hoàn thành tốt. Tài liệu tham khảo Cơ sở dữ liệu ( TS Trần Công Uẩn) Hệ thống thông tin quản lý (TS. Trương Văn Tú) Các tài liệu dự án của Công ty cổ phần phần mềm quản trị doanh nghiệp CyberSoft Mục lục

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

  • doc29492.doc
Tài liệu liên quan