📄 paydeclare.pas
字号:
begin
if rmdrewage.AsFloat=0 then
begin
rmd.Next;
continue;
end;
if (rmdttwage.AsFloat=rmdoldttwage.AsFloat) and (rmdmonths.AsInteger=rmdoldmonths.AsInteger) and (rmdrewage.AsFloat=rmdoldrewage.AsFloat) then
begin
rmd.Next;
continue;
end;
if not (rmdmonths.AsInteger in [0..12]) then
begin
application.MessageBox('上年工资总月数只能在0至12之间!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//rmd.Bookmark:=bookmark;
rmd.EnableControls;
check:=true;
result:=false;
exit;
end;
if (rmdrewage.AsFloat<MinRewage) or (rmdrewage.AsFloat>MaxRewage) then
begin
application.MessageBox(pchar('缴费基数只能在'+floattostr(MinRewage)+'至'+floattostr(MaxRewage)+'之间!'),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//rmd.Bookmark:=bookmark;
rmd.EnableControls;
check:=true;
result:=false;
exit;
end;
rmd.Next;
end;
//try //保存或更新数据
try
datashare_form.Dbs.StartTransaction;
rmd.First;
while not rmd.Eof do
begin
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select count(*) recount from pswgcase where manid='+rmdmanid.AsString+' and year='+FE_year.Text+' and procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
rec:=fieldbyname('recount').AsInteger;
close;
if rec>0 then
begin
if RMDrewage.AsFloat=0 then
begin
ls_sql:='delete from pswgcase where manid='+rmdmanid.AsString+' and year='+FE_year.Text+' and procflg='+chr(39)+'1'+chr(39);
end else
begin
ls_sql:='update pswgcase set ttwage='+rmdttwage.AsString+',months='+rmdmonths.AsString+',rewage='+rmdrewage.AsString+',opcode='+chr(39)+inttostr(main_form.user.OPERID)+chr(39)+',opdate=today() where manid='+rmdmanid.AsString+' and year='+FE_year.Text+' and procflg='+chr(39)+'1'+chr(39);
end;
end
else
begin
if RMDrewage.AsFloat=0 then
begin
RMD.Next;
continue;
end;
sql.Clear;
ls_sql:='select max(opid) opid from pswgcase';
sql.Add(ls_sql);
prepare;
open;
li_opid:=fieldbyname('opid').AsInteger+1;
close;
ls_sql:='insert into pswgcase(opid,manid,year,ttwage,months,rewage,opcode,opdate,procflg,psseno,cpseno) values('+inttostr(li_opid)+','+rmdmanid.AsString+','+FE_year.Text+','+rmdttwage.AsString+','+rmdmonths.AsString+','+rmdrewage.AsString+','+chr(39)+inttostr(main_form.user.OPERID)+chr(39)+',today(),'+chr(39)+'1'+chr(39)+','+rmdpsseno.AsString+','+rmdcpseno.AsString+')';
end;
sql.Clear;
sql.Add(ls_sql);
execsql;
close;
end;
rmd.Next;
end;
rmd.First;
while not rmd.Eof do
begin
rmd.Edit;//用修改后的数据覆盖修改前的数据
rmdoldttwage.Value:=rmdttwage.AsFloat;
rmdoldmonths.Value:=rmdmonths.AsInteger;
rmdoldrewage.Value:=rmdrewage.AsFloat;
rmd.Post;
rmd.Next;
end;
rmd.Bookmark:=bookmark;
rmd.EnableControls;
IsModified:=false;
check:=true;
datashare_form.Dbs.Commit;
result:=true;
exit;
except
on e:exception do
begin
datashare_form.Dbs.Rollback;
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
rmd.Bookmark:=bookmark;
rmd.EnableControls;
check:=true;
result:=false;
exit;
end;
end;
end;
procedure Tpaydeclare_form.RMDDisplay(sqlstr:string);
begin
check:=false;
rmd.Close;
rmd.Open;
rmd.DisableControls;
try
try
with datashare_form.Query1 do
begin
close;
sql.Clear;
sql.Add(sqlstr);
prepare;
open;
if RecordCount>0 then
begin
DBGrid1.ReadOnly:=false;
end else
DBGrid1.ReadOnly:=true;
while not eof do
begin
rmd.Append;
rmdmanid.Value:=fieldbyname('manid').AsInteger;
rmdiscode.Value:=fieldbyname('iscode').AsString;
rmdpsname.Value:=fieldbyname('psname').AsString;
rmdagcardno.Value:=fieldbyname('agcardno').AsString;
rmdorganid.Value:=fieldbyname('organid').AsString;
rmdttwage.Value:=fieldbyname('ttwage').AsFloat;
rmdpsseno.Value:=fieldbyname('psseno').AsInteger;
rmdcpseno.Value:=fieldbyname('cpseno').AsInteger;
if fieldbyname('months').AsString<>'' then
begin
rmdmonths.Value:=fieldbyname('months').AsInteger;
end
else
rmdmonths.Value:=12;
rmdrewage.Value:=fieldbyname('rewage').AsFloat;
rmdcurrewage.Value:=fieldbyname('currewage').AsFloat;
rmdlockflg.Value:=fieldbyname('lockflg').AsString;
rmdoldttwage.Value:=rmdttwage.AsFloat;
rmdoldmonths.Value:=rmdmonths.AsInteger;
rmdoldrewage.Value:=rmdrewage.AsFloat;
rmd.Post;
next;
end;
close;
end;
rmd.First;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
finally
rmd.EnableControls;
end;
check:=true;
end;
procedure Tpaydeclare_form.checkdata(Sender: TField); //检查输入的数据
var
ld_rewage:double;
begin
if (rmdttwage.AsFloat=rmdoldttwage.AsFloat) and (rmdmonths.AsInteger=rmdoldmonths.AsInteger) and (rmdrewage.AsFloat=rmdoldrewage.AsFloat) then
begin
exit;
end;
if rmdmonths.AsInteger=0 then
exit;
if LowerCase(sender.Name)='rmdttwage' then
begin
//application.MessageBox(pchar(sender.Name),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
if rmdmonths.asinteger>0 then
begin
ld_rewage:=round(rmdttwage.AsFloat/rmdmonths.AsInteger*100)/100;
if ld_rewage<MinRewage then
begin
application.MessageBox(pchar('系统计算出的缴费基数小于缴费基数下限【'+floattostr(MinRewage)+'】,系统已自动将其改为最小值!'),'恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
ld_rewage:=MinRewage;
end
else
if ld_rewage>MaxRewage then
begin
application.MessageBox(pchar('系统计算出的缴费基数大于缴费基数上限【'+floattostr(MaxRewage)+'】,系统已自动将其改为最大值!'),'恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
ld_rewage:=MaxRewage;
end;
rmdrewage.Value:=ld_rewage;
end;
exit;
end;
if LowerCase(sender.Name)='rmdmonths' then
begin
//application.MessageBox(pchar(sender.Name),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
if rmdttwage.AsFloat>0 then
begin
ld_rewage:=round(rmdttwage.AsFloat/rmdmonths.AsInteger*100)/100;
if ld_rewage<MinRewage then
begin
application.MessageBox(pchar('系统计算出的缴费基数小于缴费基数下限【'+floattostr(MinRewage)+'】,系统已自动将其改为最小值!'),'恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
ld_rewage:=MinRewage;
end
else
if ld_rewage>MaxRewage then
begin
application.MessageBox(pchar('系统计算出的缴费基数大于缴费基数上限【'+floattostr(MaxRewage)+'】,系统已自动将其改为最大值!'),'恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
ld_rewage:=MaxRewage;
end;
rmdrewage.Value:=ld_rewage;
end;
exit;
end;
if LowerCase(sender.Name)='rmdrewage' then
begin
//application.MessageBox(pchar(sender.Name),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
rmdttwage.Value:=rmdrewage.AsFloat*rmdmonths.AsInteger;
exit;
end;
end;
procedure Tpaydeclare_form.RMDmonthsChange(Sender: TField);
begin
inherited;
if not check then
exit;
if sender.AsInteger=0 then
begin
check:=false;
RMDttwage.AsFloat:=0;
RMDrewage.AsFloat:=0;
check:=true;
exit;
end;
if not (sender.AsInteger in [0..12]) then
begin
application.MessageBox('上年工资总月数只能在0至12之间!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
check:=false;
checkdata(sender);
check:=true;
infoupdate;
end;
procedure Tpaydeclare_form.RMDttwageChange(Sender: TField);
begin
inherited;
if not check then
exit;
if sender.AsFloat=0 then
begin
check:=false;
RMDrewage.AsFloat:=0;
check:=true;
exit;
end;
if (sender.AsFloat<0) or (sender.AsFloat>999999.99) then
begin
application.MessageBox('上年工资总额只能在0至999999.99之间!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
check:=false;
checkdata(sender);
check:=true;
infoupdate;
end;
procedure Tpaydeclare_form.RMDrewageChange(Sender: TField);
begin
inherited;
if not check then
exit;
if sender.AsFloat=0 then
begin
check:=false;
RMDttwage.AsFloat:=0;
check:=true;
exit;
end;
if (sender.AsFloat<MinRewage) or (sender.AsFloat>MaxRewage) then
begin
application.MessageBox(pchar('缴费基数只能在'+floattostr(MinRewage)+'至'+floattostr(MaxRewage)+'之间!'),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
check:=false;
checkdata(sender);
check:=true;
infoupdate;
end;
procedure Tpaydeclare_form.DBGrid1ColExit(Sender: TObject);
begin
inherited;
//checkdata(sender as Tfield);
//application.MessageBox('hello','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
procedure Tpaydeclare_form.FB_okClick(Sender: TObject);
var
ls_sql:string;
begin
inherited;
rmd.Close;
if treeviewcp1.Selected=nil then
begin
ls_sql:='select a.cpseno cpseno,a.psseno psseno,a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno,a.organid organid,b.ttwage ttwage,b.months months,b.rewage rewage,b.lockflg lockflg,a.rewage currewage ';
ls_sql:=ls_sql+' from {oj psarch a left outer join pswgcase b on (a.manid=b.manid and b.year='+FE_year.Text+' and b. procflg='+chr(39)+'1'+chr(39)+')} where a.status='+chr(39)+'1'+chr(39);
end
else
ls_sql:='select a.cpseno cpseno,a.psseno psseno,a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno,a.organid organid,b.ttwage ttwage,b.months months,b.rewage rewage,b.lockflg lockflg,a.rewage currewage ';
ls_sql:=ls_sql+' from {oj psarch a left outer join pswgcase b on (a.manid=b.manid and b.year='+FE_year.Text+' and b. procflg='+chr(39)+'1'+chr(39)+')} where a.status='+chr(39)+'1'+chr(39)+' and a.organid in ('+treeviewcp1.GenerateOrganIds(treeviewcp1.Selected,main_form.user.operid)+')';
rmd.Open;
RMDDisplay(ls_sql);
end;
procedure Tpaydeclare_form.Save_butExecute(Sender: TObject);
var
ret:integer;
begin
inherited;
if not IsModified then
exit;
if not RMD.Eof then
begin
RMD.Next;
if not RMD.Eof then
RMD.Prior;
end;
//ret:=Application.MessageBox('职工缴费工资信息已经被修改,是否要保存?','保存确认',MB_YESNOCancel+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal);
//if ret=IDYES then
//begin
if not save then
exit;
application.MessageBox('职工缴费工资信息保存成功!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
//end
//else
// if ret=IDNO then
// begin
// cancel_butExecute(nil);
// exit;
// end
// else
// begin
// exit;
// end;
end;
procedure Tpaydeclare_form.Export_butExecute(Sender: TObject);
var
ls_sql,ls_line:string;
rec:integer;
filehandle:integer;
txtfile:Textfile;
begin
inherited;
try
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select count(*) recount from pswgcase where year='+FE_year.Text+' and procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
rec:=fieldbyname('recount').AsInteger;
close;
end;
if rec<1 then
begin
application.MessageBox('目前还没有本年度的缴费工资信息,请先输入!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
SaveDialog1.FileName:='pswgcase.txt';
SaveDialog1.Filter:= '文本文件(*.txt)|*.TXT';
if SaveDialog1.Execute then
begin
if fileexists(SaveDialog1.FileName) then
begin
if Application.MessageBox('文件已经存在,是否要覆盖?','文件确认',MB_YESNO+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal)=IDYES then
begin
deletefile(SaveDialog1.FileName);
end
else
exit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -