Диплом: Автоматизация расчета заработной платы отдела технического сопровождения в ООО «DataPro»

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
98
+' FROM dolgnost INNER JOIN sotrudnik ON dolgnost.id_dolgnost = sotrudnik.id_dolgnost '
+' WHERE sotrudnik.tabel_nomer ='+form_zapros1.StringGrid_time.Cells[0,i]+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_Zapros;
datamodule1.Query_buf.Open;
form_zapros1.StringGrid_time.Cells[3,i] := floatto-
str(kolvo_hours1*datamodule1.Query_buf.FieldByName('oklad').AsFloat);
end;
end;
procedure TForm_zapros1.view_otdel;
var buf_zapros : string;
begin
if form_zapros1.DBGrid_zavod.DataSource.DataSet.RecordCount <> 0 then
begin
buf_zapros := 'SELECT otdel.id_otdel, otdel.name_otdel as Название_отдела '
+' FROM otdel '
+' WHERE otdel.id_zavod =
'+form_zapros1.DBGrid_zavod.DataSource.DataSet.FieldByName('id_zavod').AsString
+' ORDER BY otdel.name_otdel;';
datamodule1.Query_otdel_view.Close;
datamodule1.Query_otdel_view.SQL.Clear;
datamodule1.Query_otdel_view.SQL.Text := buf_zapros;
datamodule1.Query_otdel_view.Open;
view_dbgrid_otdel;
view_time;
end;
end;
procedure TForm_zapros1.view_dbgrid_otdel;
begin
form_zapros1.DBGrid_otdel.Columns[0].Visible := False;
form_zapros1.DBGrid_otdel.Columns[1].Width := 280;
end;
end.
99
Приложение 2
Файл Form_sotrudnik.pas
unit Form__sotrudnik;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, Data.DB;
type
TForm_sotrudnik = class(TForm)
DBGrid_sotrudnik: TDBGrid;
Button_delete: TButton;
Button_update: TButton;
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label_tabel: TLabel;
Edit_tabel: TEdit;
Edit_family: TEdit;
Edit_name: TEdit;
Edit_secondname: TEdit;
Edit_phone: TEdit;
DBGrid_dolgnost: TDBGrid;
GroupBox_login: TGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label26: TLabel;
Label27: TLabel;
100
Label_login: TLabel;
Edit_login: TEdit;
Edit_password: TEdit;
DBGrid_dostup: TDBGrid;
Button_add: TButton;
DBGrid_otdel: TDBGrid;
Label16: TLabel;
Label1: TLabel;
Label10: TLabel;
CheckBox_login: TCheckBox;
DBGrid_zavod: TDBGrid;
Label17: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button_deleteClick(Sender: TObject);
procedure Button_updateClick(Sender: TObject);
procedure Button_addClick(Sender: TObject);
procedure clear_label;
procedure view_dbgrid;
procedure add_sotrudnik;
procedure update_sotrudnik;
procedure view_sotrudnik;
procedure FormShow(Sender: TObject);
procedure view_dolgnost;
procedure DBGrid_otdelCellClick(Column: TColumn);
procedure CheckBox_loginClick(Sender: TObject);
procedure view_otdel;
procedure view_dbgrid_otdel;
procedure view_dbgrid_dolgnost;
procedure view_dolgnost_view;
procedure DBGrid_zavodCellClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_sotrudnik: TForm_sotrudnik;
implementation
101
uses datamodule;
{$R *.dfm}
procedure TForm_sotrudnik.view_dbgrid;
begin
form_sotrudnik.DBGrid_sotrudnik.Columns[0].Width := 70;
form_sotrudnik.DBGrid_sotrudnik.Columns[1].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[2].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[3].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[4].Width := 70; //телефон
form_sotrudnik.DBGrid_sotrudnik.Columns[5].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[6].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[7].Width := 150;//должность
form_sotrudnik.DBGrid_sotrudnik.Columns[8].Width := 150;
form_sotrudnik.DBGrid_sotrudnik.Columns[9].Width := 100;
form_sotrudnik.DBGrid_sotrudnik.Columns[10].Width := 100;
end;
procedure TForm_sotrudnik.clear_label;
begin
form_sotrudnik.Label2.Caption := '';
form_sotrudnik.Label3.Caption := '';
form_sotrudnik.Label7.Caption := '';
form_sotrudnik.Label8.Caption := '';
form_sotrudnik.Label9.Caption := '';
form_sotrudnik.Label10.Caption := '';
form_sotrudnik.Label26.Caption := '';
form_sotrudnik.Label27.Caption := '';
end;
procedure TForm_sotrudnik.DBGrid_otdelCellClick(Column: TColumn);
begin
view_dolgnost;
end;
procedure TForm_sotrudnik.DBGrid_zavodCellClick(Column: TColumn);
begin
view_otdel;
view_dolgnost;
end;
102
procedure TForm_sotrudnik.Button_addClick(Sender: TObject);
var run_procedure : boolean;
buf_zapros, buf_kav : string;
begin
clear_label;
run_procedure := True;
buf_kav := '''';
//проверяю введенные данные
if length(form_sotrudnik.Edit_tabel.Text) < 8 then
begin
run_procedure := False;
form_sotrudnik.Label2.Caption := 'Табельный номер меньше 8';
end
else
if form_sotrudnik.Button_add.Caption = 'Добавить' then
begin
buf_zapros :='SELECT tabel_nomer FROM sotrudnik WHERE tabel_nomer
='+buf_kav+form_sotrudnik.Edit_tabel.Text+buf_kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.Open;
if datamodule1.Query_buf.RecordCount <> 0 then
begin
run_procedure := False;
form_sotrudnik.Label2.Caption := 'Такой номер есть в БД';
end;
end;
if length(Form_sotrudnik.Edit_family.Text) = 0 then
begin
run_procedure := False;
form_sotrudnik.Label3.Caption := 'Не введена фамилия';
end;
if length(form_sotrudnik.Edit_name.Text) = 0 then
begin
run_procedure := False;
form_sotrudnik.Label7.Caption := 'Не введено имя';
end;
103
if length(form_sotrudnik.Edit_secondname.Text) = 0 then
begin
run_procedure := False;
form_sotrudnik.Label8.Caption := 'Не введено отчество';
end;
if length(form_sotrudnik.Edit_phone.Text) = 0 then
begin
run_procedure := False;
form_sotrudnik.Label9.Caption := 'Не введен телефон';
end;
if (length(Form_sotrudnik.Edit_login.Text) <> 0) AND (length(form_sotrudnik.Edit_password.Text) <> 0) then
begin
if length(Form_sotrudnik.Edit_login.Text) = 0 then
begin
run_procedure := False;
form_sotrudnik.Label26.Caption := 'Не введен логин';
end
else
if form_sotrudnik.Button_add.Caption = 'Добавить' then
begin
buf_zapros := 'SELECT login FROM login_password WHERE login =
'+buf_kav+form_sotrudnik.Edit_login.Text+buf_kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.Open;
if datamodule1.Query_buf.RecordCount <> 0 then
begin
run_procedure := False;
form_sotrudnik.Label26.Caption := 'Такой логин есть в БД';
end;
end;
if length(form_sotrudnik.Edit_password.Text) < 8 then
begin
run_procedure := False;
form_sotrudnik.Label27.Caption := 'Пароль меньше 8 символов';
end;
end;
104
if form_sotrudnik.DBGrid_dolgnost.DataSource.DataSet.RecordCount = 0 then
begin
run_procedure := False;
form_sotrudnik.Label10.Caption := 'Не выбрана должность';
end;
//проверка закнчена
if run_procedure then
begin
if form_sotrudnik.Button_add.Caption = 'Добавить' then
add_sotrudnik;
if form_sotrudnik.Button_add.Caption = 'Исправить' then
update_sotrudnik;
end;
end;
procedure TForm_sotrudnik.update_sotrudnik;
var buf_kav, buf_zapros : string;
begin
buf_kav := '''';
if (length(Form_sotrudnik.Edit_login.Text) <> 0) AND (length(form_sotrudnik.Edit_password.Text) <> 0) then
begin
buf_zapros := 'UPDATE login_password SET login = '+buf_kav+form_sotrudnik.Edit_login.Text+buf_kav+','
+'password_user= '+buf_kav+form_sotrudnik.Edit_password.Text+buf_kav
+' WHERE login = '+buf_kav+form_sotrudnik.Label_login.Caption+buf_kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
buf_zapros :='UPDATE sotrudnik SET tabel_nomer = '+buf_kav+form_sotrudnik.Edit_tabel.Text+buf_kav+','
+'Family = '+buf_kav+form_sotrudnik.Edit_family.Text+buf_kav+','
+'First_name ='+buf_kav+form_sotrudnik.Edit_name.Text+buf_kav+','
+'second_name = '+buf_kav+form_sotrudnik.Edit_secondname.Text+buf_kav+','
+'id_dolgnost =
'+form_sotrudnik.DBGrid_dolgnost.DataSource.DataSet.FieldByName('id_dolgnost').AsString+','
+'phone = '+buf_kav+form_sotrudnik.Edit_phone.Text+buf_kav+','
+'login = '+buf_kav+form_sotrudnik.Edit_login.Text+buf_kav+','
+'dostup = ' +form_sotrudnik.DBGrid_dostup.DataSource.DataSet.FieldByName('id_dostup').AsString
+' WHERE tabel_nomer = '+buf_kav+form_sotrudnik.Label_tabel.Caption+buf_kav+';';
end
else
buf_zapros :='UPDATE sotrudnik SET tabel_nomer = '+buf_kav+form_sotrudnik.Edit_tabel.Text+buf_kav+','
105
+'Family = '+buf_kav+form_sotrudnik.Edit_family.Text+buf_kav+','
+'First_name ='+buf_kav+form_sotrudnik.Edit_name.Text+buf_kav+','
+'second_name = '+buf_kav+form_sotrudnik.Edit_secondname.Text+buf_kav+','
+'id_dolgnost =
'+form_sotrudnik.DBGrid_dolgnost.DataSource.DataSet.FieldByName('id_dolgnost').AsString+','
+'phone = '+buf_kav+form_sotrudnik.Edit_phone.Text+buf_kav
+' WHERE tabel_nomer = '+buf_kav+form_sotrudnik.Label_tabel.Caption+buf_kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
//чищу поля ввода
form_sotrudnik.Edit_tabel.Text := '';
form_sotrudnik.Edit_family.Text := '';
form_sotrudnik.Edit_name.Text := '';
form_sotrudnik.Edit_secondname.Text := '';
form_sotrudnik.Edit_phone.Text := '';
form_sotrudnik.Edit_login.Text := '';
form_sotrudnik.Edit_password.Text := '';
//обновляю данные на фоме
datamodule1.Query_view_sotrudnik.Active := False;
datamodule1.Query_view_sotrudnik.Active := True;
view_dbgrid;
//переименовываю кнопку
form_sotrudnik.Button_add.Caption := 'Добавить';
end;
procedure TForm_sotrudnik.add_sotrudnik;
var buf_kav, buf_zapros : string;
begin
buf_kav := '''';
if (length(Form_sotrudnik.Edit_login.Text) <> 0) AND (length(form_sotrudnik.Edit_password.Text) <> 0) then
begin
buf_zapros := 'INSERT INTO login_password (login,password_user) VALUES ('
+buf_kav+form_sotrudnik.Edit_login.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_password.Text+buf_kav+');';
datamodule1.Query_buf.Close;
106
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
buf_zapros :='INSERT INTO sotrudnik (tabel_nomer,Family,First_name,second_name, id_dolgnost, phone, log-
in,dostup) VALUES ('
+buf_kav+form_sotrudnik.Edit_tabel.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_family.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_name.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_secondname.Text+buf_kav+','
+form_sotrudnik.DBGrid_dolgnost.DataSource.DataSet.FieldByName('id_dolgnost').AsString+','
+buf_kav+form_sotrudnik.Edit_phone.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_login.Text+buf_kav+','
+form_sotrudnik.DBGrid_dostup.DataSource.DataSet.FieldByName('id_dostup').AsString+');';
end
else
buf_zapros :='INSERT INTO sotrudnik (tabel_nomer,Family,First_name,second_name, id_dolgnost, phone)
VALUES ('
+buf_kav+form_sotrudnik.Edit_tabel.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_family.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_name.Text+buf_kav+','
+buf_kav+form_sotrudnik.Edit_secondname.Text+buf_kav+','
+form_sotrudnik.DBGrid_dolgnost.DataSource.DataSet.FieldByName('id_dolgnost').AsString+','
+buf_kav+form_sotrudnik.Edit_phone.Text+buf_kav
+');';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
//чищу поля ввода
form_sotrudnik.Edit_tabel.Text := '';
form_sotrudnik.Edit_family.Text := '';
form_sotrudnik.Edit_name.Text := '';
form_sotrudnik.Edit_secondname.Text := '';
form_sotrudnik.Edit_phone.Text := '';
form_sotrudnik.Edit_login.Text := '';
form_sotrudnik.Edit_password.Text := '';
//обновляю данные на фоме
datamodule1.Query_view_sotrudnik.Active := False;
datamodule1.Query_view_sotrudnik.Active := True;
107
view_dbgrid;
end;
procedure TForm_sotrudnik.Button_deleteClick(Sender: TObject);
var buf_zapros, buf_kav, buf_login : string;
begin
buf_kav := '''';
if form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.RecordCount <> 0 then
begin
buf_login := form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Логин').AsString;
buf_zapros := 'DELETE FROM sotrudnik WHERE tabel_nomer
='+buf_kav+form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Табель_номер').AsString+buf_
kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
datamodule1.Query_buf.Close;
buf_zapros := 'DELETE FROM login_password WHERE login = '+buf_kav+buf_login+buf_kav+';';
datamodule1.Query_buf.Close;
datamodule1.Query_buf.SQL.Clear;
datamodule1.Query_buf.SQL.Text := buf_zapros;
datamodule1.Query_buf.ExecSQL;
datamodule1.Query_buf.Close;
datamodule1.Query_view_sotrudnik.Active := False;
datamodule1.Query_view_sotrudnik.Active := True;
view_dbgrid;
end;
end;
procedure TForm_sotrudnik.Button_updateClick(Sender: TObject);
begin
form_sotrudnik.Edit_tabel.Text :=
form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Табель_номер').AsString;
form_sotrudnik.Label_tabel.Caption :=
form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Табель_номер').AsString;
form_sotrudnik.Edit_family.Text :=

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Agile-методология в управлении проектами на примере ООО «Ресурсный центр «Академия КлассИнфо»
Aвтoмaтизaция пpoцecca вeдeния инфopмaциoннoй бaзы o дoлжнocтяx и вaкaнcияx c укaзaниeм тpeбoвaний к уpoвню знaний и нaвыкoв кaндидaтoв для гpуппы кaдpoв вoйcкoвoй чacти 3474»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
Cовершенствование управления рентабельности предприятия (на примере гуипп «бендерская типография «полиграфист»)
Event - менеджмент: реализация проекта (на примере ООО "АГРОПАК")