You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

406 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_sys_dep_emp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, BusinessSkinForm, bsSkinCtrls, dxExEdtr, dxCntner,
dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Grids, DBGridEh;
type
Tfrm_sys_dep_emp = class(TForm)
t_sys_department: TADOQuery;
t_sys_department1: TDataSource;
t_sys_employee1: TDataSource;
t_sys_employee: TADOQuery;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinPanel2: TbsSkinPanel;
dxDBGrid3: TdxDBGrid;
dxDBGrid3Column1: TdxDBGridMaskColumn;
dxDBGrid3Column2: TdxDBGridMaskColumn;
dxDBGrid3Column3: TdxDBGridMaskColumn;
dxDBGrid3Column4: TdxDBGridMaskColumn;
dxDBGrid3Column5: TdxDBGridMaskColumn;
dxDBGrid3Column6: TdxDBGridMaskColumn;
dxDBGrid3Column7: TdxDBGridDateColumn;
dxDBGrid3Column8: TdxDBGridMaskColumn;
dxDBGrid3Column9: TdxDBGridMaskColumn;
dxDBGrid3Column10: TdxDBGridMaskColumn;
bsSkinPanel4: TbsSkinPanel;
v_all_employee: TADOQuery;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinPanel3: TbsSkinPanel;
bsSkinButton9: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
p_employee_change: TADOStoredProc;
p_employee_delete: TADOStoredProc;
t_sys_code_data: TADOQuery;
t_sys_code: TADOQuery;
t_sys_code_emp: TADOQuery;
t_sys_code_data_all: TADOQuery;
p_employee_change_no: TADOStoredProc;
p_employee_delete_no: TADOStoredProc;
bsSkinButton7: TbsSkinButton;
dxDBGrid3Column11: TdxDBGridColumn;
DBGridEh1: TDBGridEh;
t_sys_departmentDSDesigner: TStringField;
t_sys_departmentDSDesigner2: TStringField;
t_sys_departmentDSDesigner3: TStringField;
t_sys_departmentdept: TStringField;
dxDBGrid3Column12: TdxDBGridPickColumn;
dxDBGrid3Column13: TdxDBGridPickColumn;
dxDBGrid3Column14: TdxDBGridPickColumn;
dxDBGrid3Column15: TdxDBGridCheckColumn;
dxDBGrid3Column16: TdxDBGridCheckColumn;
t_sys_departmentDSDesigner4: TStringField;
t_sys_departmentDSDesigner5: TStringField;
dxDBGrid1: TdxDBGrid;
t_sys_employee_link: TADOQuery;
t_sys_employee_link1: TDataSource;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid3Column17: TdxDBGridPickColumn;
dxDBGrid3Column18: TdxDBGridColumn;
t_sys_departmentDSDesigner6: TStringField;
dxDBGrid3Column19: TdxDBGridPickColumn;
dxDBGrid3Column20: TdxDBGridColumn;
dxDBGrid3Column21: TdxDBGridColumn;
procedure t_sys_departmentBeforePost(DataSet: TDataSet);
procedure t_sys_employeeBeforePost(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure t_sys_department_twoBeforeInsert(DataSet: TDataSet);
procedure t_sys_employeeBeforeInsert(DataSet: TDataSet);
procedure t_sys_departmentDeleteError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure bsSkinButton5Click(Sender: TObject);
procedure v_all_employeeAfterScroll(DataSet: TDataSet);
procedure bsSkinButton6Click(Sender: TObject);
procedure t_sys_employeeAfterPost(DataSet: TDataSet);
procedure t_sys_employeeBeforeEdit(DataSet: TDataSet);
procedure bsSkinButton7Click(Sender: TObject);
procedure t_sys_departmentBeforeEdit(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_sys_dep_emp: Tfrm_sys_dep_emp;
dep_emp_insert:boolean;
dep_emp_name:string;
implementation
uses u_main, my_sys_function, u_data_share, u_sys_dep_emp_delete,
u_sys_progress, u_sys_dep_emp_department;
{$R *.dfm}
procedure Tfrm_sys_dep_emp.t_sys_departmentBeforePost(
DataSet: TDataSet);
begin
table_before_post(t_sys_department,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_sys_dep_emp.t_sys_employeeBeforePost(DataSet: TDataSet);
begin
table_before_post(t_sys_employee,'<27><><EFBFBD><EFBFBD>');
if t_sys_employee.State=dsinsert then
dep_emp_insert:=true
else
dep_emp_insert:=false;
end;
procedure Tfrm_sys_dep_emp.FormShow(Sender: TObject);
begin
t_sys_department.open;
t_sys_employee.open;
v_all_employee.Open;
if not frm_data_share.t_code_subcomp.Active then
frm_data_share.t_code_subcomp.Open;
t_sys_employee_link.Open;
end;
procedure Tfrm_sys_dep_emp.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_data_share.t_sys_employee.requery;
frm_data_share.t_sys_department.requery;
end;
procedure Tfrm_sys_dep_emp.bsSkinButton1Click(Sender: TObject);
begin
t_sys_department.insert;
end;
procedure Tfrm_sys_dep_emp.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_sys_department);
end;
procedure Tfrm_sys_dep_emp.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_sys_department);
end;
procedure Tfrm_sys_dep_emp.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_sys_department);
end;
procedure Tfrm_sys_dep_emp.bsSkinButton9Click(Sender: TObject);
begin
t_sys_employee.insert;
end;
procedure Tfrm_sys_dep_emp.bsSkinButton10Click(Sender: TObject);
begin
table_post(t_sys_employee);
end;
procedure Tfrm_sys_dep_emp.bsSkinButton11Click(Sender: TObject);
begin
if t_sys_employee.IsEmpty then
exit;
if v_all_employee.IsEmpty then
begin
if t_sys_employee.State=dsinsert then
begin
t_sys_employee.cancel;
end
else
begin
t_sys_employee.cancel;
p_employee_delete_no.Parameters.ParamByName('name').Value:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
p_employee_delete_no.ExecProc;
t_sys_employee.delete;
end;
end
else
begin
try
frm_sys_dep_emp_delete:=Tfrm_sys_dep_emp_delete.Create(self);
frm_sys_dep_emp_delete.ShowModal;
finally
frm_sys_dep_emp_delete.Free;
frm_sys_dep_emp_delete:=nil;
end;
end;
end;
procedure Tfrm_sys_dep_emp.bsSkinButton12Click(Sender: TObject);
begin
table_cancel(t_sys_employee);
end;
procedure Tfrm_sys_dep_emp.t_sys_department_twoBeforeInsert(
DataSet: TDataSet);
begin
table_before_insert(t_sys_department);
end;
procedure Tfrm_sys_dep_emp.t_sys_employeeBeforeInsert(DataSet: TDataSet);
begin
table_before_insert(t_sys_department);
end;
procedure Tfrm_sys_dep_emp.t_sys_departmentDeleteError(
DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction);
begin
showmessage('<27><><EFBFBD><EFBFBD>ְԱ<D6B0><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>');
abort;
end;
procedure Tfrm_sys_dep_emp.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=frm_close_query(t_sys_department);
CanClose:=frm_close_query(t_sys_employee);
end;
procedure Tfrm_sys_dep_emp.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_sys_dep_emp.v_all_employeeAfterScroll(DataSet: TDataSet);
begin
if v_all_employee.IsEmpty then
dxDBGrid3Column1.ReadOnly:=false
else
dxDBGrid3Column1.ReadOnly:=true;
end;
procedure Tfrm_sys_dep_emp.bsSkinButton6Click(Sender: TObject);
var
old_str,str:string;
begin
if t_sys_employee.IsEmpty then
exit;
if v_all_employee.IsEmpty then
begin
showmessage('<27><>ְԱ<D6B0><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>л<EFBFBD>û<EFBFBD><C3BB>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӹ<EFBFBD><D3B8>ģ<EFBFBD>');
exit;
end;
str:=trim(InputBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְԱ<D6B0>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>', '<27>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>֣<EFBFBD>', ''));
if str=''then
begin
exit;
end;
try
old_str:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_employee.Edit;
t_sys_employee['<27><><EFBFBD><EFBFBD>']:=str;
t_sys_employee.post;
p_employee_change.Parameters.ParamByName('old_name').Value:=old_str;
p_employee_change.Parameters.ParamByName('new_name').Value:=str;
p_employee_change.ExecProc;
v_all_employee.requery;
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>');
end;
end;
procedure Tfrm_sys_dep_emp.t_sys_employeeAfterPost(DataSet: TDataSet);
begin
if dep_emp_insert then
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>Ȩ<EFBFBD>޴<EFBFBD><DEB4><EFBFBD><EBA1A3><EFBFBD><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=20000;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
t_sys_code.close;
t_sys_code.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code_data_all.close;
t_sys_code_data_all.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code_data.close;
t_sys_code_data.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code_emp.Close;
t_sys_code_emp.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_data_share.t_sys_employee.requery;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.MaxValue:=10+t_sys_code.RecordCount
+frm_data_share.t_sys_employee.RecordCount*(t_sys_code_data_all.RecordCount*2-1);
t_sys_code.first;
while not t_sys_code.eof do
begin
t_sys_code_emp.insert;
t_sys_code_emp['Ȩ<>޴<EFBFBD><DEB4><EFBFBD>']:=t_sys_code['Ȩ<>޴<EFBFBD><DEB4><EFBFBD>'];
t_sys_code_emp['һ<><D2BB>ģ<EFBFBD><C4A3>']:=t_sys_code['һ<><D2BB>ģ<EFBFBD><C4A3>'];
t_sys_code_emp['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>']:=t_sys_code['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>'];
t_sys_code_emp['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_code['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_sys_code_emp['<27><>Ա']:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_code_emp['<27>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>']:=0;
t_sys_code_emp.post;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code.next;
end;
frm_data_share.t_sys_employee.first;
while not frm_data_share.t_sys_employee.eof do
begin
if frm_data_share.t_sys_employee['<27><><EFBFBD><EFBFBD>']<>t_sys_employee['<27><><EFBFBD><EFBFBD>'] then
begin
t_sys_code_data_all.first;
while not t_sys_code_data_all.eof do
begin
t_sys_code_data.insert;
t_sys_code_data['<27><>Ա']:=frm_data_share.t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data['<27><><EFBFBD><EFBFBD>']:=t_sys_code_data_all['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_sys_code_data['ְԱ']:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data.post;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code_data_all.next;
end;
end;
frm_data_share.t_sys_employee.next;
end;
frm_data_share.t_sys_employee.first;
while not frm_data_share.t_sys_employee.eof do
begin
t_sys_code_data_all.first;
while not t_sys_code_data_all.eof do
begin
t_sys_code_data.insert;
t_sys_code_data['<27><>Ա']:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data['<27><><EFBFBD><EFBFBD>']:=t_sys_code_data_all['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_sys_code_data['ְԱ']:=frm_data_share.t_sys_employee['<27><><EFBFBD><EFBFBD>'];
t_sys_code_data.post;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_sys_code_data_all.next;
end;
frm_data_share.t_sys_employee.next;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.close;
frm_sys_progress:=nil;
end;
if dep_emp_name<>t_sys_employee['<27><><EFBFBD><EFBFBD>'] then
begin
p_employee_change_no.Parameters.ParamByName('old_name').Value:=dep_emp_name;
p_employee_change_no.Parameters.ParamByName('new_name').Value:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
p_employee_change_no.ExecProc;
end;
end;
procedure Tfrm_sys_dep_emp.t_sys_employeeBeforeEdit(DataSet: TDataSet);
begin
dep_emp_name:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
end;
procedure Tfrm_sys_dep_emp.bsSkinButton7Click(Sender: TObject);
begin
if t_sys_employee.isempty then
exit;
try
frm_sys_dep_emp_department:=Tfrm_sys_dep_emp_department.Create(self);
frm_sys_dep_emp_department.ShowModal;
finally
frm_sys_dep_emp_department.Free;
frm_sys_dep_emp_department:=nil;
end;
end;
procedure Tfrm_sys_dep_emp.t_sys_departmentBeforeEdit(DataSet: TDataSet);
begin
if not t_sys_employee.IsEmpty then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>Ա,<2C><><EFBFBD><EFBFBD><EFBFBD>޸IJ<DEB8><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbOk],0);
Abort;
end;
end;
end.