📄 retireaccount.~pas
字号:
end;
with Datashare_frm.Query2 do
begin
close;
sql.Clear ;
sql.Add('select pyname as "发放项目名称",pymount as "发放金额" from sbdb_rtwage A,sbdc_pyitem B');
sql.Add(' where a.pyitem=b.pyitem and psseno=:param');
parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
DataSource2.DataSet :=DataShare_frm.Query2 ;
Dbgrid1.Columns[0].Field:=Fields[0];
Dbgrid1.Columns[1].Field:=Fields[1];
end;
ratio:=ratio/100;
with DataShare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select pyitem,pymount from sbdb_rtwage where psseno=:param');
parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
while not eof do
begin
if Fieldbyname('pyitem').AsInteger=1032 then
begin
flatedit41.Text :=Fieldbyname('pymount').AsString ;
flatedit51.Text :=formatfloat('0.00',Fieldbyname('pymount').asfloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=1033 then
begin
flatedit42.Text :=Fieldbyname('pymount').AsString ;
flatedit52.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=91 then
begin
flatedit43.Text :=Fieldbyname('pymount').AsString ;
flatedit53.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=76 then
begin
flatedit44.Text :=Fieldbyname('pymount').AsString ;
flatedit54.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=73 then
begin
flatedit40.Text :=Fieldbyname('pymount').AsString ;
flatedit50.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=72 then
begin
flatedit45.Text :=Fieldbyname('pymount').AsString ;
flatedit55.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=71 then
begin
flatedit46.Text :=Fieldbyname('pymount').AsString ;
flatedit56.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=63 then //水平差
begin
Flatedit47.Text :=Fieldbyname('pymount').AsString ;
Flatedit57.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=81 then
begin
flatedit48.Text :=Fieldbyname('pymount').AsString ;
flatedit58.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
if Fieldbyname('pyitem').AsInteger=74 then //最低保
begin
flatedit49.Text :=Fieldbyname('pymount').AsString ;
flatedit59.Text :=formatfloat('0.00',Fieldbyname('pymount').AsFloat*ratio);
end;
next;
end;
{if locate('pyitem',1032,[]) then flatedit41.Text :=Fieldbyname('pyitem').AsString ;
if locate('pyitem',1033,[]) then flatedit42.Text :=Fieldbyname('pyitem').AsString ;
if locate('pyitem',91, []) then flatedit43.Text :=Fieldbyname('pyitem').AsString ;
if locate('pyitem',76, []) then flatedit44.Text :=Fieldbyname('pyitem').AsString ;
if locate('pyitem',72, []) then flatedit45.Text :=Fieldbyname('pyitem').AsString ;
if locate('pyitem',71, []) then flatedit46.Text :=Fieldbyname('pyitem').AsString ;}
end;
with DataShare_frm.Query4 do
begin
close;
sql.Clear ;
sql.Add('select accpinup+acpswginup from sbda_psagacct where psseno=:param and yearno=2003');
parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
flatedit8.Text :=formatfloat('0.00',Fields[0].asfloat);
end;
end;
procedure TRetireaccount_frm.SaveData ;
var
interest_1998,interest_1999,interest_2000,interest_2001,interest_2002,interest_2003:double;//每年的利率
baseout,total,out_1998,out_1999,out_2000,out_2001,out_2002,out_level,out_lowest,out_daiyu,psacct,ratio:double;//基本扣除,帐户总客户,每年的调整明细,帐户各人交费部分,比例.
loop,i,l:integer;
messages:string;
begin
if not RMD.Active then exit;
if trim(RMD.Fields[5].AsString)='0' then
if application.MessageBox('核定时基本养老金为零,您的扣减为零,是否计算?','恩普软件',mb_iconquestion+mb_okcancel)=idcancel then exit;
if index<0 then exit;
ratio:=0;
interest_1998:=0;
interest_1999:=0;
interest_2000:=0;
interest_2001:=0;
interest_2002:=0;
interest_2003:=0;
baseout:=0;
out_1998:=0;
out_1999:=0;
out_2000:=0;
out_2001:=0;
out_2002:=0;
out_level:=0;
out_lowest:=0;
out_daiyu:=0;
total:=RMD.Fields[3].AsFloat ;
psacct:=RMD.Fields[2].AsFloat ;
if RMD.FieldByName('BasicAccount').AsFloat>0 then
ratio:=RMD.fieldbyname('drawout').AsFloat/RMD.FieldByName('BasicAccount').AsFloat;
{ ---------------------20040816------------------------------------
if trim(flatedit41.Text)<>'' then out_1998:=round(100*strtofloat(flatedit41.Text)*ratio)/100;
if trim(flatedit42.Text)<>'' then out_1999:=round(100*strtofloat(flatedit42.Text)*ratio)/100;
if trim(flatedit43.Text)<>'' then out_2001:=round(100*strtofloat(flatedit43.Text)*ratio)/100;
if trim(flatedit44.Text)<>'' then out_2002:=out_2002+round(100*strtofloat(flatedit44.Text)*ratio)/100;
if trim(flatedit45.Text)<>'' then out_2002:=out_2002+round(100*strtofloat(flatedit45.Text)*ratio)/100;
if trim(flatedit46.Text)<>'' then out_2002:=out_2002+round(100*strtofloat(flatedit46.Text)*ratio)/100;
if trim(flatedit57.Text)<>'' then out_level:=strtofloat(flatedit57.Text);
if trim(flatedit58.Text)<>'' then out_daiyu:=strtofloat(flatedit58.Text);
if trim(flatedit59.Text)<>'' then out_lowest:=strtofloat(flatedit59.Text); }
if trim(flatedit41.Text)<>'' then out_1998:=strtofloat(flatedit41.Text);
if trim(flatedit42.Text)<>'' then out_1999:=strtofloat(flatedit42.Text);
if trim(flatedit43.Text)<>'' then out_2001:=strtofloat(flatedit43.Text);
if trim(flatedit44.Text)<>'' then out_2002:=out_2002+strtofloat(flatedit44.Text);
//-------------20041227 加上pyitem=73一栏,对应flatedit40
if trim(flatedit40.Text)<>'' then out_2002:=out_2002+strtofloat(flatedit40.text);
if trim(flatedit45.Text)<>'' then out_2002:=out_2002+strtofloat(flatedit45.Text);
if trim(flatedit46.Text)<>'' then out_2002:=out_2002+strtofloat(flatedit46.Text);
if trim(flatedit47.Text)<>'' then out_level:=strtofloat(flatedit47.Text);
if trim(flatedit48.Text)<>'' then out_daiyu:=strtofloat(flatedit48.Text);
if trim(flatedit49.Text)<>'' then out_lowest:=strtofloat(flatedit49.Text);
//---------------------20040816------------------------------------
//if trim(flatedit41.Text)<>'' then //获得各年的利率
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where industry=:param1 and yearno=:param2');
parambyname('param1').AsString :=Flatcombobox3.Items[Flatcombobox6.itemindex];
messages:=Flatcombobox3.Items[Flatcombobox6.itemindex];
parambyname('param2').AsInteger :=1998;
prepare;
open;
if recordcount>0 then interest_1998:=Fields[0].AsFloat ;
end;
//if trim(flatedit42.Text)<>''then
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where industry=:param1 and yearno=:param2');
parambyname('param1').AsString :=Flatcombobox3.Items[Flatcombobox6.itemindex];
parambyname('param2').AsInteger :=1999;
prepare;
open;
if recordcount>0 then interest_1999:=Fields[0].AsFloat ;
end;
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where yearno=:param');
parambyname('param').AsInteger :=2000;
prepare;
open;
if recordcount>0 then interest_2000:=Fields[0].AsFloat ;
end;
//if trim(flatedit43.Text)<>'' then
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where yearno=:param');
parambyname('param').AsInteger :=2001;
prepare;
open;
if recordcount>0 then interest_2001:=Fields[0].AsFloat ;
end;
//if (trim(flatedit44.Text)<>'') or (trim(flatedit45.Text)<>'') or (trim(flatedit46.Text)<>'') then
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where yearno=:param');
parambyname('param').AsInteger :=2002;
prepare;
open;
if recordcount>0 then interest_2002:=Fields[0].AsFloat ;
end;
with Datashare_frm.Query3 do
begin
close;
sql.Clear ;
sql.Add('select INTEREST from sbds_inancons where yearno=:param');
parambyname('param').AsInteger :=2003;
prepare;
open;
if recordcount>0 then interest_2003:=Fields[0].AsFloat ;
end;
with DataShare_frm.Query4 do
begin
close;
sql.Clear ;
sql.Add('select pymount from sbdb_rtwage where pyitem=78 and psseno=:p1');
parambyname('p1').asstring:=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
if recordcount>0 then baseout:=Fields[0].AsFloat ;
end;
//------------------------20040816-------------------------
baseout:=baseout+(out_level+out_lowest+out_daiyu)*ratio;
//------------------------20040816-------------------------
if year=1998 then //若是1998年开始退休,则从98年的计算利息
begin
if mon<11 then // 11月份前退休 //月积数法计息
begin
i:=0;
for loop:=1 to 12-mon do
begin
i:=loop;
total:=total-(baseout+out_1998*ratio)+(total-(baseout+out_1998*ratio))*interest_1998*i/12/(12-mon);
//i:=i+loop;
end;
//total:=total-(baseout+out_1998*ratio)*(12-mon);
//total:=total*(1+interest_1998)+(baseout+out_1998*ratio)*interest_1998;
//total:=(total-baseout-out_1998*ratio)*(interest_1998*i/78+12-mon) ;//1998年未个人帐户总额
end;
for loop:=1 to 12 do
begin
i:=loop;
total:=total-(baseout+(out_1998+out_1999)*ratio)+(total-(baseout+(out_1998+out_1999)*ratio))*interest_1999*i/12/12;
end;
for loop:=1 to 12 do
begin
i:=loop;
total:=total-(baseout+(out_1998+out_1999+out_2000)*ratio)+(total-(baseout+(out_1998+out_1999+out_2000)*ratio))*interest_2000*i/12/12;
end;
for loop:=1 to 12 do
begin
i:=loop;
total:=total-(baseout+(out_1998+out_1999+out_2000+out_2001)*ratio)+(total-(baseout+(out_1998+out_1999+out_2000+out_2001)*ratio))*interest_2001*i/12/12;
end;
for loop:=1 to 12 do
begin
i:=loop;
total:=total-(baseout-(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)+
(total-(baseout-(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio))*interest_2002*i/144;
end;
for loop:=1 to 12 do
begin
i:=loop;
total:=total-(baseout+(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)+
(total-(baseout+(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio))*interest_2003*i/144;
end;
{
total:=total-(baseout+(out_1998+out_1999)*ratio)*12;
total:=total*(1+interest_1999)+(baseout+(out_1998+out_1999)*ratio)*interest_1999;
total:=total-(baseout+(out_1998+out_1999+out_2000)*ratio)*12;
total:=total*(1+interest_2000)+(baseout+(out_1998+out_1999+out_2000)*ratio)*interest_2000;
total:=total-(baseout+(out_1998+out_1999+out_2000+out_2001)*ratio)*12;
total:=total*(1+interest_2001)+(baseout+(out_1998+out_1999+out_2000+out_2001)*ratio)*interest_2001;
total:=total-(baseout-(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*12;
total:=total*(1+interest_2002)+(baseout+(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*interest_2002;
total:=total-(baseout+(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*12;
total:=total*(1+interest_2003)+(baseout+(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*interest_2003;
}
//total:=(total-baseout-(out_1998+out_1999)*ratio)*(interest_1999+12); //1999年未个人帐户总额
//total:=(total-baseout-(out_1998+out_1999+out_2000)*ratio)*(interest_2000+12); //2000年未个人帐户总额
//total:=(total-baseout-(out_1998+out_1999+out_2000+out_2001)*ratio)*(interest_1999+12); //2001年未个人帐户总额
//total:=(total-baseout-(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*(interest_2002+12); //2002年未个人帐户总额
//total:=(total-baseout-(out_1998+out_1999+out_2000+out_2001+out_2002)*ratio)*(interest_2003+12); //2003年未个人帐户总额
end;
if year=1999 then //1999年开始退休
begin
if mon<11 then
begin
i:=0;
for loop:=1 to 12-mon do
begin
i:=loop;
total:=total-(baseout+out_1999*ratio)+(total-(baseout+out_1999*ratio))*interest_1999*i/12/(12-mon);
end;
{i:=i+loop;
total:=total-(baseout+out_1999*ratio)*(12-mon);
total:=total*(1+interest_1999)+(baseout+out_1999*ratio)*interest_1999*i/78;}
//total:=(total-baseout-out_1999*ratio)*(interest_1999*i/78+12-mon);//1999年未个人帐户总额
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -