insdefine.pas
来自「pasa人力资源考勤管理系统」· PAS 代码 · 共 546 行 · 第 1/2 页
PAS
546 行
unit insdefine;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Gauges, ExtCtrls, StdCtrls, Mask, RxLookup, CheckLst, Db, ADODB, ComCtrls,
Buttons;
type
TForminsdefine = class(TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label7: TLabel;
Label8: TLabel;
Memo1: TMemo;
Panel1: TPanel;
Gauge1: TGauge;
Label9: TLabel;
DateTimePicker1: TDateTimePicker;
cominsno: TRxDBLookupCombo;
Qryinskind: TADOQuery;
DSinskind: TDataSource;
Label3: TLabel;
Memo2: TMemo;
Edit2: TMaskEdit;
Panel5: TPanel;
RG1: TRadioGroup;
GroupBox3: TGroupBox;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Label4: TLabel;
Label5: TLabel;
ListBox1: TListBox;
ListBox2: TListBox;
ComboBox1: TComboBox;
Button1: TButton;
Qry1: TADOQuery;
Edit1: TEdit;
GroupBox2: TGroupBox;
MaskEdit1: TMaskEdit;
DateTimePicker2: TDateTimePicker;
Label10: TLabel;
Label11: TLabel;
Edit3: TEdit;
Label12: TLabel;
Memo3: TMemo;
Label1: TLabel;
procedure DateTimePicke1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure OKClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure ComboBox1Change(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure RG1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
procedure DateTimePicker2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure formchangelan;
end;
var
Forminsdefine: TForminsdefine;
whichform:string; //区分是那个窗口调用的
implementation
uses datamol, insrecord, main, publicfunction,cvcode;
{$R *.DFM}
procedure TForminsdefine.DateTimePicke1Change(Sender: TObject);
begin
edit2.text:=formatdatetime('yyyy'+dateseparator+'mm'+dateseparator+'dd',datetimepicker1.date)
end;
procedure TForminsdefine.FormCreate(Sender: TObject);
begin
qryinskind.open;
datamod.ADOpublic.open;
Edit2.Text:=formatdatetime('yyyy'+dateseparator+'mm'+dateseparator+'dd',now);
maskedit1.text:=edit2.text;
formchangelan;
end;
procedure TForminsdefine.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
qryinskind.close;
datamod.ADOpublic.close;
forminsdefine:=nil;
action:=cafree;
end;
procedure TForminsdefine.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (activecontrol=edit1) or (activecontrol=combobox1) then exit;
if key=#13 then
begin
key:=#0;
selectnext(activecontrol,true,true);
end;
end;
procedure TForminsdefine.OKClick(Sender: TObject);
var
i:integer;
hanGh:string;
ygbhcd:integer;
begin
if Listbox2.Items.Count<=0 then Exit;
cursor:=crHourGlass;
with datamod do
begin
Panel1.Visible:=true;
Gauge1.MaxValue:=Listbox2.Items.Count;
Gauge1.Progress :=0;
ygbhcd:=Datamod.adopublicworknolength.AsInteger;
For i:=0 to Listbox2.Items.Count -1 do
begin
hanGh:=Copy(Listbox2.Items[i],1,ygbhcd );
if whichform='insrecord' then
begin
if (Trim(Edit2.Text)<>'') and (cominsno.value<>'') then
begin
Query1.Close ;
Query1.SQL.Text :='select * from ins02010 where (workno='''+hangh+''') and (insno='''+cominsno.value+''') ';
Query1.Open;
if not Query1.Eof then
begin
Application.MessageBox(pchar('发现工号为:'+hangh+'的员工已投保!!'),'投保资料重复',mb_iconquestion);
end else
if Query1.eof then
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Text :='Insert into ins02010(workno,cardno,name,Rq,insno,insname,instype,insmoney,insreason,operator,memo) '+
' Select b.workno,b.cardno,b.name,'''+edit2.text+''','''+cominsno.value+''',c.insname,c.instype,c.insmoney,'''+memo2.Text+''', '+
''''+pubworkname+''','''+memo1.text+''' from per24010 as b,ins01010 as c where b.workno='''+hanGh+''' and c.insno='''+cominsno.value+''' ';
ADOQuery1.ExecSQL;
end;
end else//if
Application.MessageBox('请输入投保日期,或选择投保编号!','输入错误',MB_OK+MB_ICONWARNING);
end else
if whichform='result' then
begin
if trim(maskedit1.text)<>'' then
begin
Query1.Close ;
Query1.SQL.Text :='Select * from sal11010 where (workno='''+hangh+''') and rq='''+Maskedit1.text+''' ';
query1.sql.savetofile('C:\xx.sql');
Query1.Open;
if not Query1.Eof then
begin
Application.MessageBox(pchar('发现工号为:'+hangh+'的员工发过绩效奖金!!'),'绩效奖金重复',mb_iconquestion);
end else
if Query1.eof then
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Text :='Insert into sal11010 Select b.workno,b.cardno,b.name,b.sexname,'''+maskedit1.text+''','''+edit3.text+''','''+memo1.Text+''','''+pubworkname+''','''+datetostr(date)+''' from per24010 as b where b.workno='''+hanGh+''' ';
ADOQuery1.ExecSQL;
end;
end else
Application.MessageBox('请输入发放日期','输入错误',MB_OK+MB_ICONWARNING);
end else
if whichform='endmoney' then
begin
if trim(maskedit1.text)<>'' then
begin
Query1.Close ;
Query1.SQL.Text :='Select * from sal15010 where (workno='''+hangh+''') and rq='''+Maskedit1.text+''' ';
Query1.Open;
if not Query1.Eof then
begin
Application.MessageBox(pchar('发现工号为:'+hangh+'的员工发过年终奖金!!'),'年终奖金重复',mb_iconquestion);
end else
if Query1.eof then
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Text :='Insert into sal15010 Select b.workno,b.cardno,b.name,b.sexname,'''+maskedit1.text+''','''+edit3.text+''','''+memo1.Text+''','''+pubworkname+''','''+datetostr(date)+''' from per24010 as b where b.workno='''+hanGh+''' ';
ADOQuery1.ExecSQL;
end;
end else
Application.MessageBox('请输入发放日期','输入错误',MB_OK+MB_ICONWARNING);
end else
if whichform='yearend' then
begin
if trim(maskedit1.text)<>'' then
begin
Query1.Close ;
Query1.SQL.Text :='Select * from sal12010 where (workno='''+hangh+''') and rq='''+Maskedit1.text+''' ';
Query1.Open;
if not Query1.Eof then
begin
Application.MessageBox(pchar('发现工号为:'+hangh+'的员工发过年节奖金!!'),'年节奖金重复',mb_iconquestion);
end else
if Query1.eof then
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Text :='Insert into sal12010 Select b.workno,b.cardno,b.name,b.sexname,'''+maskedit1.text+''','''+edit3.text+''','''+memo1.Text+''','''+pubworkname+''','''+datetostr(date)+''' from per24010 as b where b.workno='''+hanGh+''' ';
ADOQuery1.ExecSQL;
end;
end else
Application.MessageBox('请输入发放日期','输入错误',MB_OK+MB_ICONWARNING);
end else
if whichform='product' then
begin
if trim(maskedit1.text)<>'' then
begin
Query1.Close ;
Query1.SQL.Text :='Select * from sal13010 where (workno='''+hangh+''') and rq='''+Maskedit1.text+''' ';
Query1.Open;
if not Query1.Eof then
begin
Application.MessageBox(pchar('发现工号为:'+hangh+'的员工发过生产奖金!!'),'生产奖金重复',mb_iconquestion);
end else
if Query1.eof then
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Text :='Insert into sal13010 Select b.workno,b.cardno,b.name,b.sexname,'''+maskedit1.text+''','''+edit3.text+''','''+memo1.Text+''','''+pubworkname+''','''+datetostr(date)+''' from per24010 as b where b.workno='''+hanGh+''' ';
ADOQuery1.ExecSQL;
end;
end else
Application.MessageBox('请输入发放日期','输入错误',MB_OK+MB_ICONWARNING);
end;
Gauge1.AddProgress(1);
end;
end;//with
Listbox2.Items.Clear;
Panel1.Visible:=False;
cursor:=crdefault;
end;
procedure TForminsdefine.FormActivate(Sender: TObject);
begin
Qry1.close;
Qry1.sql.text:='Select * from pub05010 ';
Qry1.open;
combobox1.items.clear;
While not Qry1.eof do
begin
Combobox1.Items.add(Qry1.fieldbyname('dno').asstring+copychar(' ',Qry1.fieldbyname('dno').size-length(Qry1.fieldbyname('dno').asstring))+' '+Qry1.fieldbyname('dept').asstring);
Qry1.next;
end;
end;
procedure TForminsdefine.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
listbox1.Items.Clear;
Qry1.close;
Qry1.SQL.Text:='select * from pub05010 where dno='''+trim(copy(combobox1.text,1,8))+''' ';
Qry1.Open;
if Qry1.eof then
Application.MessageBox('没有该部门,部门编号有误','Error',mb_ok+mb_iconerror)
else begin
Qry1.close; //选出该部门所有的员工
Qry1.SQL.Clear;
Qry1.SQL.Text:='select workno,name,sexname from per24010 where deptno='''+trim(copy(combobox1.text,1,8))+''' and leave=0 order by workno';
Qry1.Open;
if Qry1.Eof then //如果为空,提示user信息
Application.MessageBox('该部门没有员工','Error',mb_ok+mb_iconerror)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?