📄 joinsoci.pas
字号:
end;
sql.Add(Str);
prepare;
open;
end; }
end;
end;
InfoUpdate;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
end;
procedure TJoinSoci_form.bgcancel_butExecute(Sender: TObject); //撤销变动
var
ls_sql,ls_status,ls_oricpseno,ls_oriorganid,ls_uptype:String;
RecCount:integer;
old_IsModified,old_savebut:boolean;
begin
inherited;
if Query1.Eof then
begin
application.MessageBox('请选择需撤销的业务!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
try
with datashare_form.Query1 do //查询业务是否已经锁定
begin
close;
sql.Clear;
ls_sql:='select count(*) reccount from psupcase where manid='+inttostr(Query1manid.AsInteger)+' and procflg='+chr(39)+'1'+chr(39)+' and lockflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
RecCount:=fieldbyname('reccount').AsInteger;
Params.Clear;
close;
end;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
if RecCount>0 then
begin
application.MessageBox('此业务已经锁定,请在审核返回后再操作!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
try
with datashare_form.Query1 do //查询当前职工是否存在变动业务
begin
close;
sql.Clear;
ls_sql:='select count(*) reccount from psupcase where manid='+inttostr(Query1manid.AsInteger)+' and procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
RecCount:=fieldbyname('reccount').AsInteger;
Params.Clear;
close;
end;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
if RecCount<1 then
begin
application.MessageBox('此人不存在可撤销的业务!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
if Application.MessageBox('是否真的要撤销此业务?','保存确认',MB_YESNO+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal)=IDNO then
begin
exit;
end;
datashare_form.Dbs.StartTransaction;
try
with datashare_form.Query1 do
begin
close;
sql.clear; //取出变动前的参保状态
ls_sql:='select oristatus,oricpseno,oriorganid,uptype from psupcase where manid='+Query1manid.AsString+' and procflg='+chr(39)+'1'+chr(39);
sql.add(ls_sql);
prepare;
open;
ls_status:=fieldbyname('oristatus').AsString;
ls_oricpseno:=fieldbyname('oricpseno').AsString;
ls_oriorganid:=fieldbyname('oriorganid').AsString;
ls_uptype:=fieldbyname('uptype').AsString;
//恢复信息
if ls_uptype='04' then
begin
ls_sql:='update psarch set status='+chr(39)+ls_status+chr(39)+',chgreason=null,chantime=null,chaninfo=null,itcode=null,cpseno='+ls_oricpseno+',organid='+ls_oriorganid+' where manid='+Query1manid.AsString;
end
else
//if (ls_uptype='01') or (ls_uptype='02') or (ls_uptype='03') then
//begin
// ls_sql:='update psarch set status='+chr(39)+ls_status+chr(39)+',chgreason=null,chantime=null,chaninfo=null,ifmodify='+chr(39)+'0'+chr(39)+' where manid='+Query1manid.AsString;
//end
//else
//begin
ls_sql:='update psarch set status='+chr(39)+ls_status+chr(39)+',chgreason=null,chantime=null,chaninfo=null,itcode=null where manid='+Query1manid.AsString;
//end;
close;
sql.Clear;
sql.Add(ls_sql);
Execsql;
close;
//删除变动业务
ls_sql:='delete from psupcase where manid='+Query1manid.AsString+' and procflg='+chr(39)+'1'+chr(39);
sql.Clear;
sql.Add(ls_sql);
Execsql;
close;
datashare_form.Dbs.Commit;
end;
except
on e:exception do
begin
datashare_form.Dbs.Rollback;
//Query1.CancelUpdates;
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
old_savebut:=TB_save.Enabled;
old_IsModified:=IsModified;//保存修改标志
try
check:=false;
Query1.Edit; //显示信息恢复到变动前的状态
Query1status.Value:=ls_status;
if ls_uptype='04' then
begin
Query1cpseno.Value:=strtoint(ls_oricpseno);
Query1organid.Value:=strtoint(ls_oriorganid);
end;
Query1chgreason.Clear;
Query1chantime.Clear;
Query1chaninfo.Clear;
Query1itcode.Clear;
Query1.Post;
check:=true;
except
on e:exception do
end;
IsModified:=old_IsModified;//恢复修改标志
TB_save.Enabled:=old_savebut;
TB_cancel.Enabled:=old_savebut;
M_save.Enabled:=old_savebut;
M_cancel.Enabled:=old_savebut;
if TB_cancel.Enabled then
begin
TB_curcancel.Enabled:=true;
M_curcancel.Enabled:=true;
end else
begin
TB_curcancel.Enabled:=false;
M_curcancel.Enabled:=false;
end;
//TB_bgcancel.Enabled:=false;
InfoUpdate;
//Query1.Refresh;
//Query1.CancelUpdates;
end;
procedure TJoinSoci_form.Query1chgreasonnameChange(Sender: TField);
begin
inherited;
//application.MessageBox(pchar(Query1chgreasonname.AsString),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
procedure TJoinSoci_form.DataSource1DataChange(Sender: TObject;
Field: TField);
var
ls_sql,ls_uptype:String;
RecCount:integer;
begin
inherited;
if Query1.Eof then
Query1.Cancel;
if Query1chgreason.AsString='' then
begin
dbgrid2.Columns[5].ReadOnly:=true;
dbgrid2.Columns[6].ReadOnly:=true;
dbgrid2.Columns[7].ReadOnly:=true;
DBRE_chaninfo.ReadOnly:=true;
end else
begin
if (strtoint(copy(Query1chgreason.AsString,1,1)) in [1,2,3]) or ((strtoint(copy(Query1chgreason.AsString,1,1)) in [4]) and (Query1status.AsString='1')) then
begin
dbgrid2.Columns[5].ReadOnly:=false;
dbgrid2.Columns[6].ReadOnly:=false;
dbgrid2.Columns[7].ReadOnly:=false;
DBRE_chaninfo.ReadOnly:=false;
end else
begin
dbgrid2.Columns[5].ReadOnly:=false;
dbgrid2.Columns[6].ReadOnly:=true;
dbgrid2.Columns[7].ReadOnly:=true;
DBRE_chaninfo.ReadOnly:=false;
end;
end;
if not check then
exit;
try
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select count(*) reccount from psupcase where manid='+inttostr(Query1manid.AsInteger)+' and procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
RecCount:=fieldbyname('reccount').AsInteger;
Params.Clear;
close;
end;
if RecCount<1 then
begin
//UpreasonFilter(Query1status.AsString);
Panel7.Visible:=false;
E_opcode.Text:=main_form.user.OPNAME;
//E_opdate.Text:=FormatDateTime('yyyy-mm-dd',Date);
E_opdate.Text:=datetostr(Date);
exit;
end else
begin
//UpreasonFilter('all');
end;
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select a.uptype uptype,b.opname opcode,a.opdate opdate from psupcase a,users b where a.opcode=b.operid and a.manid='+inttostr(Query1manid.AsInteger)+' and a.procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
ls_uptype:=fieldbyname('uptype').AsString;
E_opcode.Text:=fieldbyname('opcode').AsString;
E_opdate.Text:=fieldbyname('opdate').AsString;
Params.Clear;
close;
end;
if ls_uptype='04' then
begin
Panel7.Visible:=true;
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select a.opcode opcode,a.opdate opdate,b.name cpseno,c.name organid,d.name oricpseno,e.name oriorganid from psupcase a,organization b,organization c,organization d,organization e where a.manid='+inttostr(Query1manid.AsInteger)+' and a.procflg='+chr(39)+'1'+chr(39);
ls_sql:=ls_sql+' and a.cpseno=b.cpseno and a.organid=c.id and a.oricpseno=d.cpseno and a.oriorganid=e.id';
sql.Add(ls_sql);
prepare;
open;
//E_oricpseno.Text:=fieldbyname('oricpseno').AsString;
if fieldbyname('oricpseno').AsString=fieldbyname('oriorganid').AsString then
begin
//E_oriorganid.Text:='';
E_origin.Text:=fieldbyname('oricpseno').AsString;
end
else
begin
E_origin.Text:=fieldbyname('oricpseno').AsString+'【'+fieldbyname('oriorganid').AsString+'】';
//E_oriorganid.Text:=fieldbyname('oriorganid').AsString;
end;
//E_cpseno.Text:=fieldbyname('cpseno').AsString;
if fieldbyname('cpseno').AsString=fieldbyname('organid').AsString then
begin
E_new.Text:=fieldbyname('cpseno').AsString;
//E_organid.Text:='';
end
else
begin
E_new.Text:=fieldbyname('cpseno').AsString+'【'+fieldbyname('organid').AsString+'】';
//E_organid.Text:=fieldbyname('organid').AsString;
end;
Params.Clear;
close;
end;
end
else
begin
Panel7.Visible:=false;
end;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
end;
end;
procedure TJoinSoci_form.Query1REWAGEChange(Sender: TField);
begin
inherited;
if not check then
exit;
if not IsModified then
begin
TB_save.Enabled:=true;
TB_cancel.Enabled:=true;
TB_curcancel.Enabled:=true;
M_save.Enabled:=true;
M_cancel.Enabled:=true;
M_curcancel.Enabled:=true;
IsModified:=true;
end;
if (Query1chgreason.AsString<>'') and (strtoint(copy(Query1chgreason.AsString,1,1)) in [1,2,3,4]) then
begin
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;
end;
end;
procedure TJoinSoci_form.DBGrid2ColEnter(Sender: TObject);
begin
inherited;
if dbgrid2.SelectedIndex in [0..3] then
dbgrid2.SelectedIndex:=4;
//if dbgrid2.Columns[dbgrid2.SelectedIndex].ReadOnly then
// begin
// dbgrid2.SelectedIndex:=dbgrid2.SelectedIndex+1;
//end;
end;
procedure TJoinSoci_form.DBGrid2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
//showmessage(inttostr(key));
{if key=13 then
begin
if dbgrid2.SelectedIndex=7 then
begin
if not Query1.Eof then
begin
dbgrid2.SelectedIndex:=4;
Query1.Next;
end;
end
else
dbgrid2.SelectedIndex:=dbgrid2.SelectedIndex+1;
exit;
end;}
{if key=13 then
begin
if dbgrid2.SelectedIndex=dbgrid2.FieldCount-1 then
begin
if not dbgrid2.DataSource.DataSet.Eof then
begin
dbgrid2.DataSource.DataSet.DisableControls;
dbgrid2.SelectedIndex:=0;
dbgrid2.DataSource.DataSet.EnableControls;
dbgrid2.DataSource.DataSet.Next;
end;
end
else
dbgrid2.SelectedIndex:=dbgrid2.SelectedIndex+1;
end; }
end;
procedure TJoinSoci_form.DBGrid2Enter(Sender: TObject);
begin
inherited;
if dbgrid2.SelectedIndex in [0..3] then
dbgrid2.SelectedIndex:=4;
//if dbgrid2.Columns[dbgrid2.SelectedIndex].ReadOnly then
//begin
// dbgrid2.SelectedIndex:=dbgrid2.SelectedIndex+1;
// end;
end;
procedure TJoinSoci_form.Query1chgreasonChange(Sender: TField);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -