📄 personalaccount.~pas
字号:
else if trim(Fieldbyname('status').AsString)='9' then Flatedit13.Text:='工伤死亡';
//Flatedit4.Text :=Fieldbyname('nacode').AsString ;
Flatedit5.Text :=Fieldbyname('bdate').AsString ; Flatedit6.Text :=Fieldbyname('iscode').AsString ;
//20040802
//Flatedit7.Text :=Fieldbyname('wkdate').AsString ;
//Flatedit10.Text:=Fieldbyname('joindate').AsString ;
if not Fieldbyname('wkdate').IsNull then
DateEdit1.Date :=Fieldbyname('wkdate').AsDateTime ;
if not Fieldbyname('joindate').IsNull then
DateEdit2.Date :=Fieldbyname('joindate').AsDateTime ;
date_change:=false;
//20040802
Flatedit11.Text:=Fieldbyname('notes').AsString ;
close;
end;
with DataShare_frm.Query2 do
begin
close;
params.Clear ;
sql.Clear ;
sql.Add('select A.iscode,A.psname,A.psseno,B.yearno,B.ttwage,B.months,B.rewage,B.stwg,C.industry from sbdb_psarch A,sbdu_pswgcase B ,sbdb_cparch C');
sql.Add(' where A.psseno=B.psseno and A.psseno=:param and b.yearno<2004 and A.cpseno=C.cpseno order by B.yearno');
parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
if recordcount<1 then exit;
if Fields[8].AsInteger<>12 then
begin
Dbgrid1.Columns[7].Visible :=false ;
Dbgrid1.Columns[7].ReadOnly :=true;
end
else begin
Dbgrid1.Columns[7].Visible :=true;
Dbgrid1.Columns[7].ReadOnly :=false;
Dbgrid1.Columns[7].Width :=110;
end;
RMD.DisableControls ;
while not eof do
begin
RMD.AppendRecord([Fields[0].asstring,Fields[1].asstring,Fields[2].asstring,Fields[3].asstring,
Fields[4].asstring,Fields[5].asstring,Fields[6].asstring,Fields[7].asstring,Fields[8].asstring]);
next;
end;
RMD.First ;
RMD_Record_Count:=RMD.RecordCount ;
RMD.EnableControls ;
end;
with DataShare_frm.Query3 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;
flatedit4.Text :=formatfloat('0.00',Fields[0].asfloat);
end;
//-------------------------------20040607,把RMD-->RMD00,Dbgrid1关联的字段 ------------------------------
{with DataShare_frm.Query2 do
begin
close;
Params.Clear ;
sql.Clear ; //年份, 当年缴费工资总额,当年缴费总月数,月平均缴费,本年利息,历年缴费月数,历年利息 ,当年实缴,当年补缴
sql.Add('select A.yearno ,A.TTWAGE,A.MONTHS,A.TTWAGE/A.MONTHS,B.cycpints+B.cypsints ,B.lycpprin+B.lypsprin ,B.lycpints+B.lypsints,B.cyftcpfd+B.cypsarac,B.cyrelycpfd+B.cyrelypsfd,');
// 0 1 2 3 4 5 6 7 8
//本年单位利息,本年个人利息,历年单位利息,历年个人利息,上年末单位划转部分本金累计,上年末个人划转部分本金累计, 本年补缴历年缴费年限单位欠划入,本年补缴历年缴费年限个人欠划入
sql.Add('B.cycpints,B.cypsints,B.lycpints,B.lypsints,B.lycpprin,B.lypsprin,B.cyftcpfd,B.cypsarac,B.cyrelycpfd,B.cyrelypsfd,B.siinter,B.lycycpints,B.lycypsints');
// 9 10 11 12 13 14 15 16 17 18 19 20 21
// //本年单位实划入到帐额 ,本年个人应缴到帐额 当年利率 上年末单位划转部分本息本年利息 上年末个人划转部分本息本年利息
sql.Add(' from sbdu_pswgcase A ,sbda_psagacct B');
sql.Add(' where A.psseno=B.psseno and A.Yearno=B.Yearno and A.psseno=:param');
sql.Add('order by A.yearno');
parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
prepare;
open;
if Recordcount<1 then exit;
RMD.DisableControls ;
while not eof do
begin
if Fields[0].AsInteger<2002 then
RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
formatfloat('0.00',Fields[3].AsFloat),Fields[4].AsFloat,Fields[5].AsFloat,Fields[6].asfloat,Fields[7].asfloat,Fields[8].asfloat,
Fields[9].AsFloat,Fields[10].asfloat,Fields[11].Asfloat,Fields[12].asfloat,Fields[13].asfloat,Fields[14].asfloat,Fields[15].asfloat,
Fields[16].asfloat,Fields[17].asfloat,Fields[18].asfloat,Fields[19].AsFloat,Fields[20].asfloat,Fields[21].asfloat])
else
begin
interest:=0;lysum:=0;lyints:=0; lycycpints:=0;lycypsints:=0;
With DataShare_frm.Query6 do
begin
close;
sql.Clear ;
sql.Add('select distinct SIINTER from sbds_inancons where yearno=:param');
parambyname('param').AsInteger :=DataShare_frm.Query2.Fields[0].AsInteger ;
prepare;
open;
if recordcount>0 then interest:=Fields[0].AsFloat ;
end;
RMD.Last ;
lysum:=RMD.fieldbyname('cyActual').AsFloat+RMD.fieldbyname('cyrely').AsFloat+RMD.fieldbyname('lysum').AsFloat ;
//lyints:=(lysum+RMD.Fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat)*interest+RMD.fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat;
lyints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lypsprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat)*interest+
RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('cypsints').AsFloat+RMD.Fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat;
//----------------------------20040430--------------------------------------------
//lycypsints:=(RMD.fieldbyname('lypsprin').AsFloat+RMD.Fieldbyname('lypsints').AsFloat)*interest+RMD.fieldbyname('cypsints').AsFloat+RMD.fieldbyname('lypsints').AsFloat ;
//lycycpints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat)*interest+RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('lycpints').AsFloat ;
lycycpints:=(Fieldbyname('lycpprin').AsFloat+Fieldbyname('lycpints').AsFloat)*interest;
lycypsints:=(Fieldbyname('lypsprin').AsFloat+Fieldbyname('lypsints').AsFloat)*interest;
//------------------------20040430-------------------------------------
RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
formatfloat('0.00',Fields[3].AsFloat),Fields[4].AsFloat,formatfloat('0.00',lysum),formatfloat('0.00',lyints),Fields[7].asfloat,Fields[8].asfloat,
Fields[9].AsFloat,Fields[10].asfloat,Fields[11].Asfloat,Fields[12].asfloat,Fields[13].asfloat,Fields[14].asfloat,Fields[15].asfloat,
Fields[16].asfloat,Fields[17].asfloat,Fields[18].asfloat,formatfloat('0.0000',interest),formatfloat('0.00',lycycpints),formatfloat('0.00',lycycpints)])
end;
next;
end;
RMD.EnableControls ;
end;}
//-------------------------------20040607,把RMD-->RMD00,Dbgrid1关联的字段 ------------------------------
end;
function TPersonalAccount_frm.WhetherChanged ;
begin
Result:=false;
if Add_Record.RecordCount>0 then
begin
Result:=true;
exit;
end;
if Del_Record.Items.Count>0 then
begin
Result:=true;
exit;
end;
if Add_Delete then
begin
result:=true;
exit;
end;
if RMD_Record_Count<>RMD.RecordCount then
begin
Result:=true;
exit;
end;
if DataSource1.State in [dsEdit, dsInsert]then
//if (RMD.State in [dsEdit, dsInsert]) then
begin
RMD.First ;
DataShare_frm.Query2.First ;
with DataShare_frm.Query2 do
begin
while (not eof ) and (formatfloat('0.00',RMD.Fields[4].AsFloat)=formatfloat('0.00',Fields[4].asfloat)) and (RMD.Fields[5].AsInteger=Fields[5].AsInteger) and
(RMD.Fields[3].AsInteger=Fields[3].AsInteger) and (formatfloat('0.00',RMD.Fields[7].AsFloat)=formatfloat('0.00',fields[7].AsFloat)) do
begin
RMD.Next ;
next;
end;
if (not eof) or (not RMD.Eof) then Result:=true;
end;
end;
end;
procedure TPersonalAccount_frm.SaveData ;
var
lypsprin,lypsints,cypsints,lycypsints,cypsarac:double;//个人部分
lycpprin,lycpints,cycpints,lycycpints,cyftcpfd:double;//企业部分
interest:double;
datetimestr:string;
yearno,i:integer;
begin
//------------------20040610---------------------------------月份取值1-12
//yearno:=RMD.fieldbyname('yearno').AsInteger;
RMD.First ;
while not RMD.Eof do
begin
if (RMD.FieldByName('cymonths').AsInteger<0) or (RMD.FieldByName('cymonths').AsInteger>13) then
begin
application.MessageBox('本年缴费总月数的值只能在0-12之间!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
if (RMD.FieldByName('yearno').AsInteger=1994) and (RMD.FieldByName('nextyearjs').AsFloat>983) then
begin
application.MessageBox('1994年的月缴费基数不能超过983元!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
if (RMD.FieldByName('yearno').AsInteger=1995) and (RMD.FieldByName('nextyearjs').AsFloat>1400) then
begin
application.MessageBox('1995年的月缴费基数不能超过1440元!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
if (RMD.FieldByName('yearno').AsInteger=1996) and (RMD.FieldByName('nextyearjs').AsFloat>1655) then
begin
application.MessageBox('1996年的月缴费基数不能超过1655元!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
if (RMD.FieldByName('yearno').AsInteger=1997) and (RMD.FieldByName('nextyearjs').AsFloat>1854) then
begin
application.MessageBox('1997年的月缴费基数不能超过1854元!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
if (RMD.FieldByName('yearno').AsInteger=1998) and (RMD.FieldByName('nextyearjs').AsFloat>2097) then
begin
application.MessageBox('1998年的月缴费基数不能超过2097元!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
RMD.Next ;
end;
//while RMD.FieldByName('yearno').AsInteger<>yearno do RMD.Next ;
//----------------20040610-----------------------------------
//------------------------20040803----------------------------------
if Del_Record.Items.Count>0 then
begin
try
DataShare_frm.Dbs.StartTransaction ; //这段代码出现三个事务,前面两个以后来加的,客户需求变化实在大,代码写的实在差.
with DataShare_frm.Query9 do
begin
close;
sql.Clear ;
sql.Add('delete from sbdu_pswgcase where psseno=:param1 and yearno=:param2');
for i:=0 to Del_Record.Items.Count-1 do
begin
close;
parambyname('param1').AsString :=Flatcombobox2.Items[index2];
parambyname('param2').AsString :=Del_Record.Items[i];
prepare;
execsql;
end;
end;
DataShare_frm.Dbs.Commit ;
except
DataShare_frm.Dbs.Rollback ;
application.MessageBox('删除记录出现异常!','恩普软件',mb_iconerror+mb_ok);
exit;
end;
end;
if Add_Record.RecordCount>0 then
begin
try
DataShare_frm.Dbs.StartTransaction ;
Add_Record.First ;
while not Add_Record.Eof do
begin
with DataShare_frm.Query9 do
begin
close;
sql.Clear ;
sql.Add('insert into sbdu_pswgcase(cpseno,psseno,yearno,ttwage,months,rewage,opdate,opcode)');
sql.Add('values(:param1,:param2,:param3,:param4,:param5,:param6,:param7,:param8)');
parambyname('param1').AsString:=Flatcombobox5.Items[Flatcombobox3.Itemindex];
parambyname('param2').AsString:=Flatcombobox2.Items[index2];
parambyname('param3').AsString:=Add_Record.fieldbyname('yearno').AsString ;
parambyname('param4').AsString:=formatfloat('0.00',Add_Record.fieldbyname('cpsum').AsFloat);
parambyname('param5').AsString:=Add_Record.fieldbyname('cymonths').AsString ;
if Add_Record.FieldByName('cymonths').AsInteger=0 then
parambyname('param6').AsInteger:=0 else
parambyname('param6').AsString:=formatfloat('0.00',Add_Record.fieldbyname('cpsum').AsFloat/Add_Record.fieldbyname('cymonths').AsInteger);
parambyname('param7').AsString:=datetimetostr(now);
parambyname('param8').AsString:=main_frm.user.OPNAME;
prepare;
execsql;
end;
Add_Record.Next ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -