📄 joinsoci.~pas
字号:
end;
PriorColumn.Title.Caption:=copy(PriorColumn.Title.Caption,1,length(PriorColumn.Title.Caption)-3);
column.Title.Caption:=column.Title.Caption+' △';
PriorColumn:=column;
IsAsc:=true;
exit;
end;
except
on e:exception do
begin
application.MessageBox('该字段无法排序!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
with dbgrid.DataSource.DataSet as TQuery do
begin
close;
sql.Clear;
sql.Add(ls_oldsql);
prepare;
open;
end;
exit
end;
end;
end;
procedure TJoinSoci_form.InfoUpdate();
var
ls_sql,ls_cpseno:String;
begin
ls_cpseno:=inttostr(treeviewcp1.GetOrganCpseno(treeviewcp1,treeviewcp1.selected));
try
with datashare_form.Query1 do
begin
close;
sql.Clear;
//ls_sql:='select count(*) totemployee from psarch where cpseno='+ls_cpseno+' and status in ('+chr(39)+'1'+chr(39)+','+chr(39)+'2'+chr(39)+')';
ls_sql:='select count(*) totemployee from psarch where cpseno='+ls_cpseno+' and status='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
E_totemployee.Text:=fieldbyname('totemployee').AsString;
params.Clear;
close;
sql.Clear;
ls_sql:='select sum(rewage) totrewage from psarch where cpseno='+ls_cpseno+' and status ='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
E_totrewage.Text:=FormatFloat('0.00',fieldbyname('totrewage').AsFloat);
close;
end;
except
on e:exception do
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
end;
procedure TJoinSoci_form.Exit_butExecute(Sender: TObject);
begin
inherited;
//退出当前模块
if Application.MessageBox('您真的要退出当前模块操作吗?','退出确认',MB_OKCancel+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal)=IdOk then
begin
close;
end;
end;
procedure TJoinSoci_form.FormCreate(Sender: TObject);
begin
inherited;
StatusBar1.Panels[0].Text:=main_form.StatusBar1.Panels[0].Text;
StatusBar1.Panels[1].Text:=main_form.StatusBar1.Panels[1].Text;
StatusBar1.Panels[2].Text:=main_form.StatusBar1.Panels[2].Text;
TB_save.Enabled:=false;
TB_cancel.Enabled:=false;
TB_curcancel.Enabled:=false;
M_save.Enabled:=false;
M_cancel.Enabled:=false;
M_curcancel.Enabled:=false;
IsModified:=false;
check:=true;
//ChgreasonChangeCheck:=true;
PriorItemIndex:=0;
DBGrid2.Visible:=true;
DBGrid3.Visible:=false;
panel7.Visible:=false;
with datashare_form.Query1 do //取缴费基数上下限、当前年份
begin
close;
sql.Clear;
sql.Add('select topvalue,butvalue from SCOIPARASETUP');
prepare;
open;
MinRewage:=fieldbyname('butvalue').AsFloat;
MaxRewage:=fieldbyname('topvalue').AsFloat;
params.Clear;
close;
end;
//InfoUpdate;
end;
procedure TJoinSoci_form.FormActivate(Sender: TObject);
var
ls_sql:string;
p_organ:^TOrganization;
begin
inherited;
treeviewcp1.OPERID:=main_form.user.OPERID;
treeviewcp1.IsDispDept:=true;
treeviewcp1.Query:=datashare_form.Query1;
treeviewcp1.Display;
treeviewcp1.FullExpand;
//Query1.Open;
statuslist:=TStringList.Create;
Flatcombobox1.Text:='';
Flatcombobox1.Items.Clear;
statuslist.Clear;
FlatCombobox1.Items.Add('全部');
statuslist.Add('0');
try //将参保状态的中文值保存在FlatComboBox1中,将对应的代码值保存在statuslist中
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select code,name from sbcode where type='+chr(39)+'status'+chr(39)+' order by code';;
sql.Add(ls_sql);
prepare;
open;
while not eof do
begin
FlatCombobox1.Items.Add(Fieldbyname('name').AsString);
statuslist.Add(Fieldbyname('code').AsString);
next;
end;
params.Clear;
close;
end;
flatcombobox1.ItemIndex:=0;
except
on e:exception do
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
flatcombobox1.SetFocus;
{if treeviewcp1.Items.Count>0 then
begin
p_organ:=treeviewcp1.Items[0].Data;
if p_organ^.canaccess then
begin
treeviewcp1.Items[0].Selected;
SetFilter;
end else
Query1.Filter:='status='+chr(39)+'-1'+chr(39);
end else }
// Query1.Filter:='status='+chr(39)+'-1'+chr(39);
end;
procedure TJoinSoci_form.cancel_butExecute(Sender: TObject);//放弃修改
begin
inherited;
if not IsModified then
exit;
IsModified:=false;
//dbgrid2.SetFocus;
//Query1.CancelUpdates;
//Query1.Close;
//Query1.Open;
ReOpen(Query1);
TB_save.Enabled:=false;
TB_cancel.Enabled:=false;
TB_curcancel.Enabled:=false;
M_save.Enabled:=false;
M_cancel.Enabled:=false;
M_curcancel.Enabled:=false;
//TB_bgcancel.Enabled:=false;
end;
procedure TJoinSoci_form.save_butExecute(Sender: TObject); //保存变动
var
ret:integer;
begin
inherited;
if not IsModified then
exit;
//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 TJoinSoci_form.Query1AfterEdit(DataSet: TDataSet);
var
RecCount:integer;
ls_sql,ls_chgreason,ls_chaninfo:string;
ld_chantime:TDate;
ld_rewage:double;
li_itcode:integer;
begin
inherited;
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);
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
messagebeep(MB_ICONASTERISK);
//showmessage('此人已存在变动,且未审核,若要再次变动,请先撤销该变动!');
application.MessageBox('此业务已经锁定,请在审核返回或解除申报锁定后再操作!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
Query1.Cancel;
//TB_bgcancel.Enabled:=true;
//TB_save.Enabled:=false;
//TB_cancel.Enabled:=false;
//IsModified:=false;
//Query1.CancelUpdates;
{try
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select chgreason,chantime,chaninfo,rewage,itcode from psarch where manid='+inttostr(Query1manid.AsInteger);
sql.Add(ls_sql);
prepare;
open;
ls_chgreason:=fieldbyname('chgreason').AsString;
ld_chantime:=fieldbyname('chantime').AsDateTime;
ls_chaninfo:=fieldbyname('chaninfo').AsString;
ld_rewage:=fieldbyname('rewage').AsFloat;
li_itcode:=fieldbyname('itcode').AsInteger;
Params.Clear;
close;
Query1.Edit;
//Query1chgreason.Value:=fieldbyname('chgreason').AsString;
//Query1chantime.Value:=fieldbyname('chantime').AsDateTime;
//Query1chaninfo.Value:=fieldbyname('chaninfo').AsString;
Query1chgreason.Value:=ls_chgreason;
Query1chantime.Value:=ld_chantime;
Query1chaninfo.Value:=ls_chaninfo;
Query1rewage.Value:=ld_rewage;
Query1itcode.Value:=li_itcode;
Query1.Post;
end;
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;}
end
else
begin
{//TB_bgcancel.Enabled:=false;
TB_save.Enabled:=true;
TB_cancel.Enabled:=true;
M_save.Enabled:=true;
M_cancel.Enabled:=true;
IsModified:=true; }
end;
//end;
end;
function TJoinSoci_form.save():boolean; //变动业务保存函数
var
ls_sql,ls_upcode,ls_status,ls_uptype:String;
li_opid,RecCount:integer;
ld_chantime:Tdate;
lr_rewage:real;
li_itcode:integer;
ls_chaninfo:string;
begin
try
Query1.Post;
except
on e:exception do
//exit;
end;
bookmark:=Query1.Bookmark;
//try
Query1.DisableControls;
//Query1.Filtered:=false;
try
Query1.First;
while not Query1.Eof do //检查信息是否有效
begin
if (Query1chgreason.AsString<>'') or (Query1chantime.AsString<>'') then
begin
if (Query1chgreason.AsString='') or (Query1chantime.AsString='') then
begin
application.MessageBox('变动原因和变动日期都必须填写,或都不填写!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//Query1.Filtered:=true;
Query1.EnableControls;
//Query1.Bookmark:=bookmark;
result:=false;
exit;
end;
if (Query1chantime.AsString<>'') and (Query1chantime.AsDateTime>now) then
begin
application.MessageBox('变动日期不能大于当前日期!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//Query1.Filtered:=true;
Query1.EnableControls;
//Query1.Bookmark:=bookmark;
result:=false;
exit;
end;
if ((strtoint(copy(Query1chgreason.AsString,1,1)) in [1,2,3]) or ((strtoint(copy(Query1chgreason.AsString,1,1)) in [4]) and (Query1status.AsString='1'))) and ((Query1rewage.AsFloat<MinRewage) or (Query1rewage.AsFloat>MaxRewage)) then
begin
application.MessageBox(pchar('新参保、续保、异地转入、在保人员本地转移必须填写缴费基数,且缴费基数只能在'+floattostr(MinRewage)+'至'+floattostr(MaxRewage)+'之间!'),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//Query1.Filtered:=true;
Query1.EnableControls;
//Query1.Bookmark:=bookmark;
result:=false;
exit;
end;
if ((strtoint(copy(Query1chgreason.AsString,1,1)) in [1,2,3]) or ((strtoint(copy(Query1chgreason.AsString,1,1)) in [4]) and (Query1status.AsString='1'))) and (Query1itcode.AsString='') then
begin
application.MessageBox('新参保、续保、异地转入、在保人员本地转移必须选择补缴档次!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
//Query1.Filtered:=true;
Query1.EnableControls;
//Query1.Bookmark:=bookmark;
result:=false;
exit;
end;
end;
Query1.Next;
end;
datashare_form.Dbs.StartTransaction;
Query1.First;
while not Query1.Eof do
begin
if (Query1chgreason.AsString='') or (Query1manid.AsInteger=0) then
begin
Query1.Next;
continue;
end;
ls_upcode:=Query1chgreason.AsString;
with datashare_form.Query1 do //检查当前职工是否存在变动,
begin
close;
sql.Clear;
ls_sql:='select count(*) reccount from psupcase where manid='+Query1manid.AsString+' and procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
RecCount:=fieldbyname('reccount').AsInteger;
Params.Clear;
close;
end;
if RecCount>0 then
begin
with datashare_form.Query1 do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -