【正文】
4),根據(jù)以下三個(gè)表建立數(shù)據(jù)字段。 ( 7) 回到子窗口中,如 果出現(xiàn)了 person_info、 depart_info、 wage、 attend_info 四個(gè)表項(xiàng)目,就表明現(xiàn)在已經(jīng)完成本數(shù)據(jù)庫文件的設(shè)計(jì),如圖 所示。 圖 21 第五章 系統(tǒng)設(shè)計(jì) 經(jīng)過了以上的分析、建模過程,已經(jīng)完成了數(shù)據(jù)庫的后臺(tái)工作。下面就要完成人機(jī)交互的界面。所以界面設(shè)計(jì)工作在進(jìn)行系統(tǒng)開發(fā)時(shí)是必不可少的,也是十分重要的。其他界面需要訪問數(shù)據(jù)庫時(shí),只須在其他單元文件中引用數(shù)據(jù)模塊的單元文件就可以直接訪問到數(shù)據(jù)庫中的數(shù)據(jù)了。管理人員 與普通職工的類型不一樣, 不同的用戶進(jìn)入不同的界面,實(shí)現(xiàn)不同的功能。用戶如果連續(xù) 3 次輸入錯(cuò)誤,應(yīng)用程序會(huì) 提示 “用戶名或密碼不對(duì)!請(qǐng)聯(lián)系管理員獲取密碼再登陸!”的信息,并 強(qiáng)迫使用者退出,并終止應(yīng)用程序的運(yùn)行。 begin times:=1。 procedure (Sender: TObject)。 23 close。 (39。+39。+39。++39。+39。+39。+)。 :=true。 // UserID 是在 public 中定義的,記錄輸入的用戶名,用于非管理人員進(jìn)入查 //詢各自相應(yīng)的信息 UserID:=。 if 1 then begin MessageDlg(39。,mtWarning,[mbOk],0)。 。 if times3 then begin showmessage(39。)。 end。EmployeeClass39。A39。密碼正確!你是合法用戶!你具有訪問和修改個(gè)人資料的權(quán)限! 39。 //將數(shù)據(jù)庫的位置定位到用戶資料 (39。,[])。 //創(chuàng)建窗口 。 end else //管理級(jí)用戶登錄 begin showmessage(39。)。 //創(chuàng)建窗口 24 。 end。 管理級(jí)用戶主界面的設(shè)計(jì) 當(dāng)用戶是管理級(jí)的人員時(shí),登錄后進(jìn)入主界面如圖 圖 該模塊主要實(shí)現(xiàn)系統(tǒng)(密碼設(shè)置、系統(tǒng)退出)、人事管理、工資管理、考勤管理,分別生成人事、工資和考勤管理報(bào)表。此模塊還加入了狀態(tài)欄和 Timer 組件,可用來顯示各種文本信息、當(dāng)前日期及當(dāng)前的時(shí)間。 begin [2].text:=datetostr(date)。 end。輸入正確的用戶名、舊密碼及兩次一致的新密碼,才可修改成功,否則出現(xiàn) 相應(yīng)問題的 錯(cuò)誤提示信息。 begin (39。,[])。Password39。 [39。]:=。 26 showmessage(39。)。 。 。 end else begin (39。,39。,MB_YESNO+MB_ICONQUESTION)。 。 end end else begin showmessage(39。)。 。 。 end。該 模塊包括了在數(shù)據(jù)庫表( person_info)中的所有個(gè)人信息,此模塊具有瀏覽數(shù)據(jù)庫信息的功能,同時(shí)可以對(duì)用戶進(jìn)行增加、查詢、修改、刪除及保存。 27 圖 部分 按鈕功能實(shí)現(xiàn)的代碼: //“修改”按鈕 procedure (Sender: TObject)。 begin userid:=。 確定修改這筆數(shù)據(jù)? 39。 注意39。EmployeeID39。 。 (39。,userid,[])。 [39。]:=。Duty39。 [39。]:=。管理人員 39。EmployeeClass39。A39。EmployeeClass39。B39。管理部門 39。DepartID39。10139。辦公室 39。DepartID39。10239。財(cái)務(wù)部 39。DepartID39。10339。市場(chǎng)管理部 39。DepartID39。10439。采購管理部 39。DepartID39。10539。公關(guān)部 39。DepartID39。10639。生產(chǎn)車間 39。DepartID39。10739。 (39。,userid,[])。 [39。]:=。 (39。,userid,[])。 [39。]:=。 showmessage(39。)。 end。 var userid:string。 if not then begin if (39。,39。,MB_YESNO+MB_ICONQUESTION)=IDYES then begin (39。,userid,[])。 (39。,userid,[])。 (39。,userid,[])。 (39。,userid,[])。 end。 showmessage(39。)。 //“保存”按鈕 procedure (Sender: TObject)。 確定增加這筆數(shù)據(jù)? 39。 注意39。 //對(duì) person_info 表進(jìn)行添加 。EmployeeID39。 [39。]:=。Duty39。 [39。]:=。管理人員 39。EmployeeClass39。A39。EmployeeClass39。B39。管理部門 39。DepartID39。10139。辦公室 39。DepartID39。10239。財(cái)務(wù)部 39。DepartID39。10339。市場(chǎng)管理部 39。DepartID39。10439。采購管理部 39。DepartID39。10539。公關(guān)部 39。DepartID39。10639。生產(chǎn)車間 39。DepartID39。10739。password39。 。 [39。]:=。Name39。 if =39。 then begin [39。]:=2021。base_prize39。 end 30 else begin [39。]:=1000。base_prize39。 end。insurance39。 [39。]:=300。 。EmployeeID39。 [39。]:=。 showmessage(39。)。 。 。新增用戶取消! 39。 end。 其中按下“查詢”按鈕,將打開一個(gè)新的查詢界面,如圖 。 圖 實(shí)現(xiàn)代碼如下: procedure (Sender: TObject)。 begin if =39。 then 31 begin with do begin :=false。 。Select * from person_info where EmployeeID=39。 open。 end。 close。 (39。+39。39。++39。39。)。 :=true。 with do begin if 1 then (39。,39。,MB_YESNO+MB_ICONQUESTION) else with personG do begin :=+1。39。 cells[0,i]:=fieldbyname(39。).AsString。Name39。 cells[2,i]:=fieldbyname(39。).AsString。Date39。 cells[4,i]:=fieldbyname(39。).AsString。Nation39。 cells[6,i]:=fieldbyname(39。).AsString。Culture39。 cells[8,i]:=fieldbyname(39。).AsString。Graduate39。 32 cells[10,i]:=fieldbyname(39。).AsString。Speci39。 cells[12,i]:=fieldbyname(39。).AsString。Address39。 cells[14,i]:=fieldbyname(39。).AsString。Mobilephone39。 cells[16,i]:=fieldbyname(39。).AsString。IDcard39。 end。 end。其中的基本工資與基本獎(jiǎng)金是根據(jù)不同的部門和職務(wù)規(guī)定好的,相應(yīng)的考勤情況所需扣除的工資也是規(guī)定好的,這兩項(xiàng)可根據(jù)用戶的具體需要進(jìn)行修改。在此界面中按下“選擇”按鈕后,可選擇不同的查詢方式,職工代碼、姓名或年月都可以進(jìn)行查詢,獲得相應(yīng)的數(shù)據(jù)。 var i,j:integer。職工代碼 39。 close。 (39。+)。 :=true。 end else if =39。 then begin with do begin :=false。 。Select * from wage where Name=39。39。39。39。39。 open。 end。年月 39。 close。 (39。+39。39。++39。39。)。 :=true。 end 。 沒 有找 到符 合條 件的 數(shù)據(jù) ? 39。 查 詢結(jié) 果39。 //清空表格中之前的查詢數(shù)據(jù) 34 for i:=1 to do for j:=0 to 11 do cells[j,i]:=39。 for i:=1 to do begin cells[0,i]:=fieldbyname(39。).AsString。EmployeeID39。 cells[2,i]:=fieldbyname(39。).AsString。Base_pay39。 cells[4,i]:=fieldbyname(39。).AsString。insurance39。 cells[6,i]:=fieldbyname(39。).AsString。deprive_attend39。 cells[8,i]:=fieldbyname(39。).AsString。 end。 end。該模塊也具有瀏覽職工信息的功能,如果是第一次瀏覽新增加的職工的考勤信息時(shí),日期需要手工進(jìn)行填寫。當(dāng)用戶按下查詢按鈕時(shí),將會(huì)出現(xiàn)與圖 相似的界面,根據(jù)需要選擇按職工代碼、姓名、或者年月進(jìn)行查詢,在表格中輸出對(duì)應(yīng)的數(shù)據(jù)信息。 begin if (=false) and (=false) and (=false) and (=false) and (=false) and (=false)and (=false) and (=false) and (=false) and (=39。) then MessageDlg(39。,mtinformation,[mbOK],0) else begin if (39。,39。,MB_YESNO+MB_ICONQUESTION)=IDYES then begin 。Time39。 (39。,[])。 [39。]:=。 if =true then begin 36 [39。]:=[39。]+1。EmployeeID39。 。deprive_attend39。deprive_attend39。 。 //以下是與 CheckBox1 相似 的代碼,根據(jù)不同的選項(xiàng)扣除規(guī)定的工資,并將結(jié)果//存入數(shù)據(jù)庫中,所以此處不作過多說明 …… end else begin 。 end。 :=false。 :=false。 :=false。 :=false。 end。 報(bào)表功能模塊的實(shí)現(xiàn) 運(yùn)行程序后,將出現(xiàn)如圖 的職工檔案資料報(bào)表,如圖 的職工人員花名冊(cè),如圖 的工資管理報(bào)表,如圖 的考勤管理報(bào)表。在此模塊中的系統(tǒng)下拉菜單下可進(jìn)行密碼重新設(shè)置,同時(shí)個(gè)人資料檔案、個(gè)人工資及個(gè)人考勤情況也可實(shí)施相應(yīng)