Human Resource Management System (Delphi) - Partial Source Code

xiaoxiao2021-03-06  107

The tools developed in this system are: the front desk has Delphi, the background database SQL Server 2000 database.

The following program code: It is the main code in this person's system section. If necessary, you can contact me: The third party FastReport report control used in the system.

Contact QQ; 282935410 E-MALI: FANYW81730@eyou.com

This system cannot be copied, provided by Yongjie Studio! ! ~

1.// landing window (f_login;); code.

Unit w_login;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, stdctrls, buttons;

Type

TF_Login = Class (TFORM)

StaticText1: TSTATICTEXT;

GB_1: TGroupBox;

Label1: TLABEL;

Label2: TLABEL;

Bitbtn1: tbitbtn;

Bitbtn2: tbitbtn;

ComboBOBOX1: TcomboboX;

EDIT1: TEDIT;

Procedure Bitbtn2Click (Sender: TOBJECT);

Procedure Bitbtn1click (Sender: TOBJECT);

Procedure FormShow (Sender: TOBJECT);

Procedure formcreate (Sender: TOBJECT);

Procedure ComboBox1KeyPress (Sender: Tobject; Var Key: char);

Procedure ComboBox1Select (Sender: TOBJECT);

Procedure Edit1KeyPress (Sender: Tobject; Var Key: char);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

F_Login: TF_LOGIN;

S_Name: String;

S_Mima: string;

S_GB: STRING;

Il: integer;

IMPLEMentation

Uses w_main, data1;

{$ R * .dfm}

Procedure tf_login.bitbtn2click (sender: TOBJECT);

Begin

CLOSE;

END;

Procedure tf_login.bitbtn1click (sender: TOBJECT);

Begin

If ComboBox1.text = '' THEN

Begin

ShowMessage ('Please enter your username!');

ComboBoX1.Setfocus;

EXIT;

END;

if Edit1.Text = '' THEN

Begin

SHOWMESSAGE ('Please enter your password!');

Edit1.setfocus;

EXIT;

end

Else

Begin

DATA_1.ADO_TAB.CLOSE;

DATA_1.ADO_TAB.SQL.CLEAR;

Data_1.ado_tab.sql.add ('Select * from username where name =' char (39) trim (ComboBox1.text) char (39)

'and password =' ​​ char (39) trim (edit1.text) char (39)); DATA_1.ADO_TAB.Open;

IF data_1.ado_tab.recordcount> 0 THEN

Begin

S_Name: = Trim (data_1.ado_tab.fieldbyName ('name'). asstring);

S_MIMA: = Trim (data_1.ado_tab.fieldbyname ('password'). asstring);

S_GB: = 'YES';

f_main.show;

f_login.hide;

end

Else

Begin

IL: = IL 1;

IF = = 3 Then Begin

Application.Messagebox ('The password you entered has three errors, return to the system !!', char (48));

f_login.close;

END;

Application.Messagebox ('You entered the password, please re-enter !!', char (48));

Edit1.Text: = '';

Edit1.setfocus;

END;

END;

END;

Procedure TF_Login.FormShow (Sender: TOBJECT);

VAR

i: integer;

Begin

ComboBox1.text: = '';

Edit1.Text: = '';

ComboBox1.clear;

DATA_1.ADO_TAB.CLOSE;

DATA_1.ADO_TAB.SQL.CLEAR;

Data_1.ado_tab.sql.add ('Select Distinct Name from UserName ");

DATA_1.ADO_TAB.OPEN

IF data_1.ado_tab.recordcount-1> 0 THEN

ComboBox1.clear;

DATA_1.ADO_TAB.FIRST;

For i: = 0 to data_1.ado_tab.recordcount-1 do

Begin

ComboBox1.Items.Add (Trim (data_1.ado_tab.fieldbyname ('name'). asstring));

DATA_1.ADO_TAB.NEXT;

END;

END;

Procedure tf_login.formcreate (Sender: TOBJECT);

Begin

IL: = 0;

END;

Procedure TF_Login.comBobox1KeyPress (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF ComboBox1.text <> 'Then

Begin

Edit1.setfocus;

end

Else

Begin

ShowMessage ('Please select User Name ";

ComboBoX1.Setfocus;

END;

END;

Procedure tf_login.comboBOBOX1SELECT (Sender: TOBJECT);

Begin

IF ComboBox1.text <> 'Then

Begin

Edit1.setfocus;

end

Else

Begin

ShowMessage ('Please select User Name ";

ComboBox1.Setfocus; END;

END;

Procedure TF_Login.edit1KeyPress (Sender: Tobject; Var Key: char);

Begin

if ORD (Key) = 13 THEN

Bitbtn1click (sender);

END;

End.

2 // User Management (F_YHGL)

Unit w_yhgl;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Comctrls, Stdctrls, Buttons, DB, AdoDB, Grids, DBGRIDS;

Type

TF_YHGL = Class (TFORM)

DBGRID1: TDBGRID;

Adoquery1: TadoQuery;

DataSource1: TDataSource;

GB_1: TGroupBox;

Label1: TLABEL;

Label2: TLABEL;

Label3: TLABEL;

Label4: TLABEL;

E_BH: TEDIT;

C_XB: TcombobOx;

e_password: tedit;

e_user: tedit;

GB_2: TGROUPBOX;

B_XZ: Tbitbtn;

B_XG: Tbitbtn;

B_GB: Tbitbtn;

B_QX: Tbitbtn;

B_BC: Tbitbtn;

B_sc: tbitbtn;

STB: TSTATUSBAR;

Adoquery1bh: Tstringfield;

AdoQuery1name: Tstringfield;

AdoQuery1Password: Tstringfield;

AdoQuery1XB: TSTRINGFIELD;

PROCEDURE S_SHOW;

Procedure s_sava;

Procedure s_clear (bb: boolean);

Procedure FormShow (Sender: TOBJECT);

Procedure DBGRID1CELLCLICK (Column: Tcolumn);

Procedure B_xzclick (Sender: TOBJECT);

Procedure b_gbclick (sender: TOBJECT);

Procedure B_QXClick (Sender: TOBJECT);

Procedure B_ScClick (Sender: TOBJECT);

Procedure b_bcclick (sender: TOBJECT);

Procedure b_xgclick (sender: TOBJECT);

Procedure E_BHKEYPRESS (Sender: TOBJECT; VAR Key: char);

Procedure E_USERKEYPRESS (Sender: TOBJECT; VAR Key: char);

Procedure E_PasswordKeyPress (Sender: Tobject; Var Key: char);

Procedure C_XBKEYPRESS (Sender: TOBJECT; VAR Key: char);

Procedure c_xbselect (sender: TOBJECT);

Procedure DataSource1Datachange (Sender: TField);

Procedure DataSource1StateChange (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

F_YHGL: TF_YHGL; BSF: String;

IMPLEMentation

{$ R * .dfm}

Procedure TF_YHGL.S_CLEAR (BB: BOOLEAN);

VAR

i: integer;

Begin

B_XZ.ENABLED: = True;

B_xg.enabled: = true;

B_sc.enabled: = true;

B_bc.enabled: = false;

B_qx.enabled: = false;

B_Gb.enabled: = true;

E_BH.TEXT: = '';

E_USER.TEXT: = '';

E_PASSWORD.TEXT: = '';

c_xb.text: = '';

For i: = 0 to gb_1.controlcount-1 do begin

IF (GB_1.Controls [i] .CLASSTYPE = TEDIT) OR (GB_1.Controls [i] .CLASSTYPE = Tcombobox) THEN

Begin

IF bb = false kil

GB_1.Controls [i] .enabled: = false

Else

GB_1.Controls [i] .enabled: = true;

END;

END;

END;

Procedure tf_yhgl.s_sava;

Begin

Adoquery1.edit;

AdoQuery1.fieldbyName ('bh'). asstring: = trim (e_bh.text);

AdoQuery1.fieldByname ('name'). asstring: = trim (e_user.text);

AdoQuery1.fieldByname ('password'). asstring: = trim (e_password.text);

AdoQuery1.fieldbyName ('XB'). Asstring: = Trim (c_xb.text);

Adoquery1.post;

END;

Procedure TF_YHGL.S_SHOW;

Begin

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add ('select * from username);

AdoQuery1.open;

END;

Procedure TF_YHGL.FORMSHOW (Sender: TOBJECT);

VAR

SS: boolean;

Begin

S_Show;

SS: = FALSE;

s_clear (ss);

END;

Procedure TF_YHGL.DBGRID1CELLCLICK (Column: Tcolumn);

VAR

vv: boolean;

Begin

IF adoquery1.recordcount -1> 0 THEN

Begin

VV: = false;

s_clear (vv);

E_BH.TEXT: = Trim (AdoQuery1.fieldbyName ('BH'). asstring);

E_USER.TEXT: = Trim (AdoQuery1.fieldbyName ('name'); asstring);

e_password.text: = trim (AdoQuery1.fieldByname ('password'). asstring);

c_xb.text: = trim (AdoQuery1.fieldbyName ('XB'). asstring);

END;

END;

Procedure TF_YHGL.B_XZCLICK (Sender: TOBJECT); VAR

BB: boolean;

Begin

BSF: = 'xz';

BB: = true;

s_clear (bb);

E_BH.SETFOCUS;

B_xz.enabled: = false;

B_xg.enabled: = false;

B_bc.enabled: = true;

B_sc.enabled: = false;

b_qx.enabled: = true;

B_Gb.enabled: = true;

END;

Procedure TF_YHGL.B_GBCLICK (Sender: TOBJECT);

Begin

CLOSE;

END;

Procedure tf_yhgl.b_qxclick (sender: TOBJECT);

VAR

SS: boolean;

Begin

SS: = FALSE;

s_clear (ss);

END;

Procedure TF_YHGL.B_SCCLICK (Sender: TOBJECT);

VAR

BB: boolean;

Begin

IF E_BH.TEXT <> '' THEN

Begin

If Messagedlg ('Is the data entered true?', MTConfirmation, [mbyes, mbno], 0) = mryes thein

Begin

AdoQuery1.delete;

S_Show;

BB: = FALSE;

s_clear (bb);

end

Else

exit

end

Else

Application.MessageBox ('Please double-click Delete Data', Char (48));

END;

Procedure TF_YHGL.B_BCCLICK (Sender: TOBJECT);

VAR

BB: boolean;

Begin

IF TRIM (E_BH.TEXT) = '' THEN

Begin

ShowMessage ('Please enter employee number');

EXIT;

E_BH.SETFOCUS;

END;

IF BSF <> 'XG' Then

Begin

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add ('Select * from username where bh =' char (39) TRIM (E_BH.TEXT) CHAR (39));

AdoQuery1.open;

END;

IF adoquery1.recordcount <0 THEN

Begin

Application.MessageBox ('Please enter the data', char (48));

EXIT;

S_Show;

END;

IF TRIM (e_user.text) = '' THEN

Begin

Application.MessageBox ('Please enter the employee name ", char (48));

EXIT;

S_Show;

E_USER.SETFOCUS;

END;

IF trim (e_password.text) = '' THEN

Begin

Application.MessageBox ('Please enter the employee password', Char (48));

EXIT;

S_Show;

e_password.setfocus;

END;

IF trim (c_xb.text) = '' THEN

Begin

Application.MessageBox ('Please select Gender', Char (48)); exit;

S_Show;

END;

If MessageDlg ('Your input data saves records?', MTConfirmation, [mbyes, mbno], 0) = mryes thein

Begin

S_SAVA;

S_Show;

BB: = FALSE;

s_clear (bb);

end

Else

S_Show;

EXIT;

END;

Procedure TF_YHGL.B_XGCLICK (Sender: TOBJECT);

VAR

i: integer;

Begin

IF TRIM (E_BH.TEXT) <> 'THEN

Begin

BSF: = 'xg';

For i: = 0 to gb_1.controlcount-1 do begin

IF (GB_1.Controls [i] .CLASSTYPE = TEDIT) OR (GB_1.Controls [i] .CLASSTYPE = Tcombobox) THEN

Begin

GB_1.Controls [i] .enabled: = true;

B_xz.enabled: = false;

B_xg.enabled: = false;

B_bc.enabled: = true;

B_sc.enabled: = false;

b_qx.enabled: = true;

B_Gb.enabled: = true;

END;

END;

end

Else

Application.MessageBox ('Please select the modified data', Char (39));

END;

Procedure tf_yhgl.e_bhKeyPress (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF TRIM (E_BH.TEXT) <> 'THEN

Begin

E_USER.SETFOCUS;

end

Else Begin

Application.MessageBox ('Please enter employee number ", char (48));

E_BH.SETFOCUS;

END;

END;

Procedure TF_YHGL.E_UserKeyPress (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF Trim (e_user.text) <> '.

Begin

e_password.setfocus;

end

Else Begin

Application.MessageBox ('Please enter your username', char (48));

E_USER.SETFOCUS;

END;

END;

Procedure tf_yhgl.e_passwordKeyPress (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF TRIM (e_password.text) <> 'Then

Begin

c_xb.setfocus;

end

Else Begin

Application.MessageBox ('Please enter the employee password', Char (48));

e_password.setfocus;

END;

END;

Procedure TF_YHGL.C_XBKEYPRESS (Sender: TOBJECT; VAR Key: char);

Begin

IF key = char (13) THEN

IF TRIM (c_xb.text) <> 'Thenbegin

B_bc.setfocus;

end

Else Begin

Application.MessageBox ('Please select Employee Gender', Char (48));

c_xb.setfocus;

END;

END;

Procedure TF_YHGL.C_XBSELECT (Sender: TOBJECT);

Begin

IF TRIM (c_xb.text) <> '.

Begin

B_bc.setfocus;

end

Else Begin

Application.MessageBox ('Please select Employee Gender', Char (48));

c_xb.setfocus;

END;

END;

Procedure tf_yhgl.datasource1datachange (Sender: TFIELD);

Begin

Stb.Panels [2] .text: = 'Current record of' INTOSTR (ADOQUERY1.RECNO) 'strip record';

Stb.Panels [1] .text: = 'records a total of' INTOSTR (AdoQuery1.Recordcount) 'record'

END;

Procedure tf_yhgl.datasource1stateChange (Sender: TOBJECT);

Begin

Case Datasource1.State of

DSBROWSE: STB.PANELS.ITEMS [0] .text: = '[Browse Mode]';

dsedit: stb.panels.Items [0] .text: = '[edit mode]';

DSINSERT: stb.panels.Items [0] .text: = '[insert mode]';

Else stb.panels.Items [0] .text: = '[other mode]';

END;

END;

End.

3. Modify the password (f_xgmm) program code;

Unit w_xgmm;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Stdctrls, DB, AdoDB;

Type

TF_XGMM = Class (TFORM)

Label1: TLABEL;

Label2: TLABEL;

Label3: TLABEL;

Label4: TLABEL;

EDIT1: TEDIT;

EDIT2: TEDIT;

EDIT3: TEDIT;

Button1: tbutton;

Button2: tbutton;

Adoquery1: TadoQuery;

Procedure Button1Click (Sender: TOBJECT);

Procedure Button2Click (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

f_xgmm: tf_xgmm;

IMPLEMentation

Uses Data1, W_Login;

{$ R * .dfm}

Procedure TF_XGMM.Button1Click (Sender: TOBJECT);

Begin

IF trim (edit1.text) <> TRIM (S_Mima) THEN

Begin

ShowMessage ('The old password you entered is incorrect, please re-enter !!'); END

Else

Begin

IF Trim (edit2.text) <> Trim (edit3.text) THEN

Begin

ShowMessage ('The new password you entered is inconsistent !!');

end

Else

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add ('update username set password =' ​​ char (39) TRIM (Edit2.Text) Char (39)

'where name =' char (39) TRIM (S_Name) Char (39));

AdoQuery1.execsql;

Application.MessageBox ('Password Modification is successful !!', chr (48));

END;

END;

Procedure TF_XGMM.Button2Click (Sender: TOBJECT);

Begin

CLOSE;

END;

End.

4.// Department setting (f_dept):

Unit w_dept;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Stdctrls, DB, AdoDB, Buttons;

Type

TF_DEPT = Class (TFORM)

Label1: TLABEL;

Label2: TLABEL;

Label3: TLABEL;

EDIT1: TEDIT;

EDIT2: TEDIT;

Adoquery1: TadoQuery;

Bitbtn1: tbitbtn;

Bitbtn2: tbitbtn;

Procedure Bitbtn1click (Sender: TOBJECT);

Procedure Bitbtn2Click (Sender: TOBJECT);

Procedure Edit1KeyPress (Sender: Tobject; Var Key: char);

Procedure Edit 2KeyPress (Sender: Tobject; Var Key: char);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

f_dept: TF_DEPT;

IMPLEMentation

{$ R * .dfm}

Procedure TF_DEPT.BITBTN1CLICK (Sender: TOBJECT);

Begin

IF adoquery1.active the begin

if Edit1.Text <> '' THEN

Begin

AdoQuery1.append;

AdoQuery1.fieldByname ('DEPA_ID'). asstring: = trim (edit1.text);

AdoQuery1.fieldbyName ('DEPA_NAME'). Asstring: = Trim (Edit2.Text);

Adoquery1.post;

ShowMessage ('data saved !!');

Edit1.Text: = '';

Edit2.text: = '';

Edit1.setfocus;

END;

END;

END;

Procedure TF_DEPT.BITBTN2CLICK (Sender: TOBJECT);

Begin

CLOSE;

END;

Procedure TF_DEPT.EDIT1KEYPRESS (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF trim (edit1.text) <> 'Then

Begin

Edit2.Setfocus;

end

Else

Begin

ShowMessage ('Please enter the department number!');

Edit1.setfocus;

END;

END;

Procedure TF_DEPT.EDIT2KEYPRESS (Sender: Tobject; Var Key: char);

Begin

IF key = char (13) THEN

IF Trim (edit2.text) <> 'Then

Begin

Bitbtn1.setfocus;

end

Else

Begin

Bitbtn1.setfocus;

END;

END;

End.

5. Salary query (f_gzcx)

Unit w_gzcx;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Stdctrls, Buttons, Grids, DBGRIDS, DB, ADODB, FR_CLAS, fr_dset,

FR_DBSET;

Type

TF_GZCX = Class (TFORM)

Adoquery1: TadoQuery;

DataSource1: TDataSource;

DBGRID1: TDBGRID;

Groupbox1: TgroupBox;

Label16: TLABEL;

Label17: TLABEL;

Label1: TLABEL;

ComboBOBOX1: TcomboboX;

ComboBox2: TcomboboX;

Bitbtn9: tbitbtn;

Bitbtn6: tbitbtn;

Bitbtn7: tbitbtn;

Bitbtn1: tbitbtn;

EDIT21: TEDIT;

Adoquery1bh: Tstringfield;

AdoQuery1name: Tstringfield;

AdoQuery1sex: Tstringfield;

AdoQuery1DEPA_ID: TSTRINGFIELD;

AdoQuery1b_salary: tintegerfield;

AdoQuery1Workday: Tintegerfield;

AdoQuery1addtime: tintegerfield;

AdoQuery1Butie: Tintegerfield;

AdoQuery1fuli: Tintegerfield;

AdoQuery1Tex: Tintegerfield;

AdoQuery1kouchu: tintegerfield;

Adoquery1jj: tintegerfield;

Adoquery1sj: tintegerfield;

AdoQuery1bj: tintegerfield;

AdoQuery1R_salary: tintegerfield;

Radiobutton1: TRADIOBUTTON

Radiobutton2: tradiobutton;

FrDbDataSet1: tfrdbdatan;

FRREPORT1: TFRREPORT;

Procedure Adoquery1Calcfields (DataSet: TDataSet);

Procedure Bitbtn9Click (Sender: TOBJECT); Procedure Formcreate (Sender: TOBJECT);

Procedure Radiobutton1Click (Sender: TOBJECT);

Procedure Bitbtn1click (Sender: TOBJECT);

Procedure Radiobutton2Click (Sender: TOBJECT);

Procedure Bitbtn7Click (Sender: TOBJECT);

Procedure Bitbtn6Click (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

F_GZCX: TF_GZCX;

Bystr: String;

IMPLEMentation

{$ R * .dfm}

Procedure tf_gzcx.adoQuery1calcfields (DataSet: TDataSet);

Begin

AdoQuery1.fieldbyName ('Kouchu'). value: = adoQuery1.fieldbyname ('tex'). Value

(AdoQuery1.fieldByname ('b_salary'). Value /adoQuery1.fieldbyName ('WorkDay' ).value);

AdoQuery1.fieldByname ('r_salary'). value: = adoquery1.fieldbyname ('b_salary'). Value

adoQuery1.fieldbyName ('butie'). Value adoquery1.fieldbyname ('fuli'). Value

AdoQuery1.fieldbyName ('addtime'). Value * (ADOQUERY1.FIELDBYNAME ('b_salary'). Value / AdoQuery1.fieldbyName ('Workday'). Value)

AdoQuery1.fieldbyName ('jj'). Value-adoquery1.fieldbyName ('Kouchu'). Value;

END;

Procedure tf_gzcx.bitbtn9click (sender: TOBJECT);

Begin

CLOSE;

END;

Procedure TF_GZCX.FormCreate (Sender: TOBJECT);

Begin

Bystr: = 'BH';

END;

Procedure TF_GZCX.Radiobutton1Click (Sender: TOBJECT);

Begin

if Radiobutton1.checked Then

Bystr: = 'BH'

Else

BYSTR: = 'DEPA_ID';

END;

Procedure tf_gzcx.bitbtn1click (sender: TOBJECT);

Begin

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add ('Select * from Empsalary Order By' Bystr);

AdoQuery1.open;

END;

Procedure TF_GZCX.Radiobutton2Click (Sender: TOBJECT);

Begin

If Radiobutton1.checked thenbystr: = 'BH'

Else

BYSTR: = 'DEPA_ID';

END;

Procedure tf_gzcx.bitbtn7click (sender: TOBJECT);

VAR

S, S1, S2, S3: STRING

Begin

S1: = ComboBoX1.Text;

S2: = ComboBoX2.Text;

S3: = edit21.text;

IF S1 = '' THEN

Begin

ShowMessage ('Please select the query field!');

end

Else

Begin

IF S2 = '' THEN

Begin

ShowMessage ('Please select Query Conditions!');

end

Else

Begin

IF S3 = '' THEN

Begin

ShowMessage ('Please enter the query value!');

end

Else

Begin

S: = 'SELECT * from Empsalary WHERE' S1 S2 '' '' S3 '' ';

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add (s);

AdoQuery1.open;

ShowMessage ('a total of' INTOSTR (AdoQuery1.Recordcount) 'record')

END;

END;

END;

END;

Procedure tf_gzcx.bitbtn6click (sender: TOBJECT);

Begin

f_gzcx.frreport1.showreport;

END;

End.

6. Wage entry (f_gzrl)

Unit w_gzrl;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, DB, Stdctrls, Mask, Dbctrls, AdoDB, Buttons, ExtCtrls;

Type

TF_GZRL = Class (TFORM)

Adoquery1: TadoQuery;

Label1: TLABEL;

Label2: TLABEL;

Dbedit1: tdbedit;

DataSource1: TDataSource;

Label3: TLABEL;

DBEDIT2: TDBEDIT;

Label4: TLABEL;

DbEdit3: TDBEDIT;

Label5: TLABEL;

Dbedit4: tdbedit;

Label6: TLABEL;

DBEDIT5: TDBEDIT;

Label7: TLABEL;

DbEDit6: tdbedit;

Label8: TLABEL;

DBEDIT7: TDBEDIT;

Label9: TLABEL;

Dbedit8: tdbedit;

Label10: TLABEL;

Dbedit9: tdbedit;

Label11: TLABEL;

DBEDIT10: TDBEDIT;

Label12: TLABEL;

Dbedit11: tdbedit;

Label13: TLABEL;

DBEDIT12: TDBEDIT;

Label14: TLABEL;

Dbedit13: tdbedit;

Label16: TLABEL;

DBEDIT14: TDBEDIT; Label17: TLABEL;

DBEDIT15: TDBEDIT;

Bevel1: TBevel;

Button3: tbutton;

Button2: tbutton;

Button7: ​​tbutton;

Button4: tbutton;

Button5: tbutton;

Button6: tbutton;

Button8: tbutton;

Button1: tbutton;

Bitbtn1: tbitbtn;

Bevel2: Tbevel;

Bevel3: Tbevel;

EDIT1: TEDIT;

EDIT2: TEDIT;

Adoquery1bh: Tstringfield;

AdoQuery1name: Tstringfield;

AdoQuery1sex: Tstringfield;

AdoQuery1DEPA_ID: TSTRINGFIELD;

AdoQuery1b_salary: tintegerfield;

AdoQuery1Workday: Tintegerfield;

AdoQuery1addtime: tintegerfield;

AdoQuery1Butie: Tintegerfield;

AdoQuery1fuli: Tintegerfield;

AdoQuery1Tex: Tintegerfield;

AdoQuery1kouchu: tintegerfield;

Adoquery1jj: tintegerfield;

Adoquery1sj: tintegerfield;

AdoQuery1bj: tintegerfield;

AdoQuery1R_salary: tintegerfield;

Procedure Button2Click (Sender: TOBJECT);

Procedure Button3Click (Sender: TOBJECT);

Procedure Button7Click (Sender: TOBJECT);

Procedure Button4Click (Sender: TOBJECT);

Procedure Button5Click (Sender: TOBJECT);

Procedure Button6Click (Sender: TOBJECT);

Procedure Button8Click (Sender: TOBJECT);

Procedure Bitbtn1click (Sender: TOBJECT);

Procedure Adoquery1Calcfields (DataSet: TDataSet);

Procedure Button1Click (Sender: TOBJECT);

Procedure FormShow (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

f_gzrl: TF_GZRL;

IMPLEMentation

{$ R * .dfm}

Procedure TF_GZRL.BUTTON2CLICK (Sender: TOBJECT);

Begin

DbEdit1.text: = '';

DbEdit2.text: = '';

DbEdit3.Text: = '';

DbEdit4.text: = '';

DbEdit5.text: = '';

DbEdit6.text: = '';

DbEdit7.text: = '';

DbEdit8.Text: = '';

DbEdit9.text: = '';

DbEdit10.Text: = '';

DbEdit11.Text: = '; dbedit12.text: =' ';

DbEdit13.Text: = '';

DbEdit14.Text: = '';

DbEdit15.Text: = '';

Edit1.Text: = '';

Edit2.text: = '';

AdoQuery1.append;

END;

Procedure TF_GZRL.BUTTON3CLICK (Sender: TOBJECT);

Begin

Adoquery1.edit;

Adoquery1.post;

ShowMessage ('Data Modification Success!');

Edit1.Text: = '';

Edit2.text: = '';

END;

Procedure TF_GZRL.BUTTON7CLICK (Sender: TOBJECT);

Begin

IF adoquery1.modified then

Adoquery1.post;

END;

Procedure TF_GZRL.BUTTON4CLICK (Sender: TOBJECT);

Begin

AdoQuery1.prior;

Edit1.Text: = '';

Edit2.text: = '';

END;

Procedure TF_GZRL.BUTTON5CLICK (Sender: TOBJECT);

Begin

AdoQuery1.next;

Edit1.Text: = '';

Edit2.text: = '';

END;

Procedure TF_GZRL.BUTTON6CLICK (Sender: TOBJECT);

Begin

Adoquery1.first;

ShowMessage ('is currently the first record');

Edit1.Text: = '';

Edit2.text: = '';

END;

Procedure TF_GZRL.BUTTON8CLICK (Sender: TOBJECT);

Begin

AdoQuery1.last;

ShowMessage ('is currently the last record');

Edit1.Text: = '';

Edit2.text: = '';

END;

Procedure tf_gzrl.bitbtn1click (sender: TOBJECT);

Begin

CLOSE;

END;

Procedure tf_gzrl.adoQuery1calcfields (Dataset: TDataSet);

Begin

AdoQuery1.fieldbyName ('Kouchu'). value: = adoQuery1.fieldbyname ('tex'). Value

(AdoQuery1.fieldByname ('b_salary'). Value /adoQuery1.fieldbyName ('WorkDay' ).value);

AdoQuery1.fieldByname ('r_salary'). value: = adoquery1.fieldbyname ('b_salary'). Value

adoQuery1.fieldbyName ('butie'). Value adoquery1.fieldbyname ('fuli'). Value

adoquery1.fieldbyname ( 'addtime'). value * (adoquery1.FieldByName ( 'b_salary'). Value / adoquery1.fieldbyname ( 'workday'). value) adoquery1.fieldbyname ( 'jj'). value-adoquery1.FieldByName ( 'Kouchu'). Value;

END;

Procedure TF_GZRL.BUTTON1CLICK (Sender: TOBJECT);

Begin

Edit1.text: = dbEDit11.text;

Edit2.Text: = dbedit15.text;

END;

Procedure TF_GZRL.FORMSHOW (Sender: TOBJECT);

Begin

Adoquery1.refresh;

Edit1.Text: = '';

Edit2.text: = '';

END;

End.

7. Main window (f_main)

Unit w_main;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Comctrls, Menus, Toolwin, Extctrls, Imglist, DB, ADODB, fr_dset,

FR_DBSET, FR_CLASS;

Type

TF_MAIN = Class (TFORM)

Mainmenu: TmainMenu;

Mnuset: tMenuitem;

Mnunewuser: TMenuItem;

Mnueditpass: tMenuItem

Mnuexit: tMenuItem

N5: TMENUITEM;

N6: TMENUITEM;

N8: TMENUITEM;

N11: TMENUITEM;

N12: TMENUITEM;

Mnuuser: tmenuitem;

Mnuuserset: tMenuitem;

MnuuserSetDepa: TMenuItem

MnuuserSetposi: TMenuItem

N3: TMENUITEM;

Mnuuserinfo: tmenuitem;

Mnuuserinfonew: tmenuitem;

MnuuserInfoman: tmenuitem;

Mnuusersal: TMenuItem

Mnuusersalcom: tmenuitem;

MnuusersalSearch: tmenuitem;

N4: TMENUITEM;

Mnuuserpx: TMenuItem

Mnuuserzpplan: TMenuItem

Mnuuserpxplan: TMenuItem

N13: TMENUITEM;

Mnuusersearch: tMenuItem

N14: TMENUITEM;

N15: TMENUITEM;

STB_1: TSTATUSBAR;

N1: tMenuitem;

N2: TMENUITEM;

Timer1: TTIMER;

Toolbar1: Ttoolbar;

Toolbutton1: Ttoolbutton;

Toolbutton2: TtoolButton;

Toolbutton3: ttoolbutton;

Toolbutton4: TtoolButton;

ImageList2: timagelist;

Procedure formclose (Sender: Tobject; VAR Action: Tclosection);

Procedure MnueDitPassClick (Sender: TOBJECT); Procedure N1click (Sender: TOBJECT);

Procedure N2Click (Sender: TOBJECT);

Procedure MNUNewuserClick (Sender: TOBJECT);

Procedure Timer1Timer (Sender: TOBJECT);

Procedure MnuuserSetDepaclick (Sender: TOBJECT);

Procedure MnuuserinfonewClick (Sender: TOBJECT);

Procedure Mnuusersalcomclick (Sender: TOBJECT);

Procedure MnuuSersalSearchClick (Sender: TOBJECT);

Procedure Toolbutton1Click (Sender: TOBJECT);

Procedure Toolbutton2Click (Sender: TOBJECT);

Procedure Toolbutton3Click (Sender: TOBJECT);

Procedure Toolbutton4Click (Sender: TOBJECT);

Procedure Mnuuserzpplanclick (Sender: TOBJECT);

Procedure MnuuSerpxplanclick (Sender: TOBJECT);

Procedure MnuuserInfomanClick (Sender: TOBJECT);

Procedure Mnuusersearchclick (Sender: TOBJECT);

Procedure Mnuexitclick (Sender: TOBJECT);

Private

Function Whatwek: String;

{Private Declarations}

public

{Public declarations}

END;

VAR

F_main: tf_main;

IMPLEMentation

Uses w_xgmm, w_login, w_yhgl, w_dept, w_xzyg, w_gzrl, w_gzcx, data1,

W_zpinfo, w_pxinfo, w_yggl, unit1, w_zhgl;

{$ R * .dfm}

Function TF_MAIN.WHATWEEK: STRING;

VAR

i_week: integer;

Begin

i_week: = dayofweek (date ());

Case i_week of

1: Result: = 'Sunday';

2: Result: = 'Monday';

3: Result: = 'Tuesday';

4: Result: = 'Wednesday';

5: Result: = 'Thursday';

6: Result: = 'Friday';

7: Result: = 'Saturday'

END;

END;

Procedure TF_MAIN.FORMCLOSE (Sender: Tobject; VAR Action: tclosection);

Begin

IF messageDLG ('really closed window?', MTConfirmation, [mbyes, mbno], 0) = mryes then

Begin Action: = CAFREE;

Application.Terminate;

end

Else

Action: = Canone;

END;

Procedure TF_MAIN.MNUEDITPASSCLICK (Sender: TOBJECT);

Begin

f_xgmm: = tf_xgmm.create (self); f_xgmm.showmodal;

END;

Procedure TF_MAIN.N1Click (Sender: TOBJECT);

Begin

f_main.hide;

f_login.show;

END;

Procedure TF_MAIN.N2CLICK (Sender: TOBJECT);

Begin

N2.CHECKED: = not n2.checked;

If n2.checked then

Begin

Self.alphablend: = true;

Self.alphablendValue: = 125;

end

Else

Self.alphablend: = false;

END;

Procedure TF_MAIN.MNUNEWUSERCLICK (Sender: TOBJECT);

Begin

F_YHGL: = TF_YHGL.CREATE (Self);

F_yhgl.showmodal;

END;

Procedure tf_main.timer1timer (sender: TOBJECT);

VAR

S_Data, STR1, STR2: STRING

Begin

Str1: = formatdatetime ('YYYY / MM / DD / HH: MM', NOW ());

Str2: = 'Today is' Copy (STR1, 1, 4) ' Copy (STR1, 6, 2) 'Moon' Copy (STR1, 9, 2) 'Day' COPY (STR1 , 12, 2) ':' Copy (STR1, 15, 2);

s_data: = '' str2 whatwek;

STB_1.PANELS [0] .TEXT: = S_DATA;

END;

Procedure TF_MAIN.MNUSERSETDEPACLICK (Sender: TOBJECT);

Begin

f_dept: = tf_dept.create (Self);

f_dept.showmodal;

END;

Procedure TF_MAIN.MNUUSERINFONEWCLICK (Sender: TOBJECT);

Begin

f_xzyg: = tf_xzyg.create (Self);

f_xzyg.showmodal;

END;

Procedure TF_MAIN.MNUUSERSALCOMCLICK (Sender: TOBJECT);

Begin

f_gzrl: = tf_gzrl.create (Self);

f_gzrl.show;

END;

Procedure TF_MAIN.MNUSERSALSEARCHCLICK (Sender: TOBJECT);

Begin

f_gzcx: = tf_gzcx.create (Self);

f_gzcx.show;

END;

Procedure tf_main.toolbutton1click (sender: TOBJECT);

Begin

Data_1.frreport1.showreport;

END;

Procedure tf_main.toolbutton2click (sender: TOBJECT);

Begin

Data_1.frreport2.showreport;

END;

Procedure tf_main.toolbutton3click (sender: TOBJECT);

Begin

Data_1.frreport3.showreport;

END;

Procedure tf_main.toolbutton4click (sender: TOBJECT);

Begin

DATA_1.FRREPORT4.SHOWREPORT;

END;

Procedure TF_MAIN.MNUUSERZPLANCLICK (Sender: TOBJECT);

Begin

f_zpinfo: = tf_zpinfo.create (Self);

f_zpinfo.show;

END;

Procedure TF_MAIN.MNUSERPXPLANCLICK (Sender: TOBJECT);

Begin

f_pxinfo: = TF_PXINFO.CREATE (Self);

f_pxinfo.show;

END;

Procedure TF_MAIN.MNUUSERINFOMANCLICK (Sender: TOBJECT);

Begin

Form1.show;

END;

Procedure TF_MAIN.MNUUSERSEARCHCLICK (Sender: TOBJECT);

Begin

f_zhgl: = tf_zhgl.create (Self);

f_zhgl.show;

END;

Procedure TF_MAIN.MNUEXITCLICK (Sender: TOBJECT);

Begin

Application.Terminate;

END;

End.

8. Comprehensive query (f_zhou) program code:

Unit w_zhgl;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, DB, Grids, DBGRIDS, AdoDB, Comctrls, Stdctrls, buttons

Type

TF_ZHGL = Class (TFORM)

PageControl1: tpageControl;

Tabsheet1: ttabsheet;

Tabsheet2: ttabsheet;

Adoquery1: TadoQuery;

DataSource1: TDataSource;

DBGRID1: TDBGRID;

DBGRID2: TDBGRID;

AdoQuery2: tadoquery;

DataSource2: TDataSource;

ComboBOBOX1: TcomboboX;

EDIT1: TEDIT;

ComboBox2: TcomboboX;

EDIT2: TEDIT;

Label1: TLABEL;

Label2: TLABEL;

Label3: TLABEL;

Bitbtn1: tbitbtn;

Bitbtn2: tbitbtn;

Label4: TLABEL;

Label5: TLABEL;

Label6: TLABEL;

EDIT3: TEDIT;

Label7: TLABEL;

EDIT4: TEDIT;

Bitbtn3: tbitbtn;

Bitbtn4: tbitbtn;

B_FANHUI1: Tbitbtn;

AdoQuery2bh: tstringfield;

AdoQuery2name: Tstringfield;

AdoQuery2sex: tstringfield;

AdoQuery2birdhday: tdatetimefield;

AdoQuery2DEPA_ID: TSTRINGFIELD;

AdoQuery2Job: Tstringfield;

Adoquery2nation: TStringfield;

AdoQuery2zzmm: tstringfield;

AdoQuery2b_salary: tfloatfield;

AdoQuery2work_time: tintegerfield;

AdoQuery2Memo: Tstringfield;

AdoQuery1zp_id: tstringfield;

AdoQuery1Time: TDATETIMEFIELD; AdoQuery1DEPA_NAME: TSTRINGFIELD;

AdoQuery1man: tintegerfield;

AdoQuery1xueli: Tstringfield;

Button1: tbutton;

Procedure Bitbtn4Click (Sender: TOBJECT);

Procedure Bitbtn3Click (Sender: TOBJECT);

Procedure Bitbtn1click (Sender: TOBJECT);

Procedure Bitbtn2Click (Sender: TOBJECT);

Procedure Bitbtn5click (Sender: TOBJECT);

Procedure Button1Click (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

f_zhgl: tf_zhgl;

IMPLEMentation

{$ R * .dfm}

Procedure tf_zhgl.bitbtn4click (sender: TOBJECT);

Begin

CLOSE;

END;

Procedure tf_zhgl.bitbtn3click (sender: TOBJECT);

VAR

SS: STRING;

Begin

SS: = '';

IF ComboBox1.text Edit3.Text Edit4.Text = '' THEN

Begin

Application.MessageBox ('You don't enter query conditions !!', 'prompt', MB_OK MB_ICONInformation);

end

Else

Begin

IF ComboBox1.text <> 'Then

SS: = SS 'AND DEPA_NAME =' '' '' ComboBox1.Text '' ';

if Edit3.Text <> '' THEN

SS: = SS 'AND ZP_ID =' '' '' Edit3.Text '' ';

if edit4.text <> '' THEN

SS: = SS 'AND MAN =' '' '' edit4.text '' ';

SS: = 'Select * from zpinfo where 1 = 1' ss;

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add (ss);

AdoQuery1.open;

if adoquery1.recordcount = 0 THEN Begin

Application.MessageBox ('does not meet the requirements for query conditions, please re-enter!', 'prompt', MB_OK MB_ICONITIONFORMATION);

END;

END;

END;

Procedure tf_zhgl.bitbtn1click (sender: TOBJECT);

VAR

SS: STRING;

Begin

SS: = '';

if Edit1.Text ComboBOBOX2.Text Edit2.Text = '' Thenbegin

Application.MessageBox ('No input query conditions !!', 'prompt', MB_OK MB_ICONInformation);

end

Else

Begin

if Edit1.Text <> '' THEN

SS: = SS 'AND BH =' '' '' edit1.text '' ';

IF ComboBox2.text <> 'Then

SS: = SS 'AND DEPA_ID =' '' '' ComboBox2.Text '' ';

If edit2.text <> '' THEN

SS: = SS 'AND NAME =' '' '' edit2.text '' ';

SS: = 'SELECT * from Empinfo where 1 = 1' SS;

Adoquery2.close;

Adoquery2.sql.clear;

AdoQuery2.sql.add (ss);

Adoquery2.open;

IF adoquery2.recordcount = 0 THEN Begin

SHOWMESSAGE ('You entered the conditions do not meet the conditions, please re-enter !!');

END;

END;

END;

Procedure tf_zhgl.bitbtn2click (sender: TOBJECT);

Begin

CLOSE;

END;

Procedure tf_zhgl.bitbtn5click (sender: TOBJECT);

Begin

AdoQuery1.close;

AdoQuery1.sql.clear;

AdoQuery1.sql.add ('Select * from zpinfo');

AdoQuery1.open;

END;

Procedure TF_ZHGL.BUTTON1CLICK (Sender: TOBJECT);

Begin

Adoquery2.close;

Adoquery2.sql.clear;

AdoQuery2.sql.add ('select * from empinfo');

Adoquery2.open;

END;

End.

转载请注明原文地址:https://www.9cbs.com/read-102469.html

New Post(0)