⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 joinsoci.~pas

📁 企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载 在线数据上传 在线业务申核 申报业务查询 磁盘数据导出 磁盘数据导入 在线业务模块 在线业务
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
var
  ls_sql,ls_chgreason,ls_status,ls_uptype,ls_upname:string;
  reccount:integer;
  ls_chaninfo:string;
  ld_chantime:TDate;
  ld_rewage:double;
  li_itcode:integer;
begin  //检查能否做变动
  inherited;

  if not check then
    exit;

  if Query1chgreason.AsString='' then  //参保原因为空,则退出
    exit;

  try    //检查当前职工是否存在待申报的业务
    with datashare_form.Query1 do
    begin
      close;
      sql.Clear;
      ls_sql:='select count(*) reccount,upreason from psupcase where manid='+inttostr(Query1manid.AsInteger)+' and procflg='+chr(39)+'1'+chr(39)+' group by upreason';
      sql.Add(ls_sql);
      prepare;
      open;
      RecCount:=fieldbyname('reccount').AsInteger;
      ls_chgreason:=fieldbyname('upreason').AsString;
      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 ls_chgreason=Query1chgreason.AsString then
    exit;

  if RecCount>0 then
  begin
    messagebeep(MB_ICONASTERISK);
    application.MessageBox('变动原因不能修改,若要修改,请先撤销改变动','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
    Query1.Cancel;
    //showmessage('此人已存在变动,且未审核,若要再次变动,请先撤销该变动!');
    //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
    try
      ls_status:=Query1status.AsString;
      ls_chgreason:=Query1chgreason.AsString;
      with datashare_form.Query1 do
      begin
        close;
        sql.Clear;
        ls_sql:='select uptype,upname from upreason where upcode='+chr(39)+ls_chgreason+chr(39);
        sql.Add(ls_sql);
        prepare;
        open;
        ls_uptype:=fieldbyname('uptype').AsString;
        ls_upname:=fieldbyname('upname').AsString;
        params.Clear;
        close;
      end;
      if ls_uptype='04' then  //若为本地转移,则提示
      begin
        application.MessageBox(pchar('本地转移请到人员综合管理中办理'),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        query1.Cancel;
        {check:=false;
        Query1chgreason.Clear;
        Query1chantime.Clear;
        Query1chaninfo.Clear;
        Query1itcode.Clear;
        check:=true; }
        exit;
      end;

      if not uptypecando(ls_status,ls_uptype) then  //当前状态不能做选择的变动
      begin
        application.MessageBox(pchar('参保状态为【'+Query1statusname.AsString+'】的人员不能做【'+Query1chgreasonname.AsString+'】'),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        query1.Cancel;
        {check:=false;
        Query1chgreason.Clear;
        Query1chantime.Clear;
        Query1chaninfo.Clear;
        Query1itcode.Clear;
        check:=true; }
        exit;
      end;

      if Query1chantime.AsString='' then
      begin
        Query1chantime.Value:=date();
      end;

      if query1joindate.AsString='' then
      begin
        try
          inputjoindate_form:=Tinputjoindate_form.create(Application);
          inputjoindate_form.showmodal;
        finally
          inputjoindate_form.free;
        end;
        if joindate<>'' then
        begin
          datashare_form.Dbs.StartTransaction;
          try
            with datashare_form.Query1 do
            begin
              ls_sql:='update psarch set joindate='+#39+joindate+#39+' where manid='+query1manid.AsString;
              close;
              sql.Clear;
              sql.Add(ls_sql);
              execsql;
              close;
            end;
            query1.Edit;
            query1joindate.AsString:=joindate;
            query1.Post;
            datashare_form.Dbs.Commit;
          except
            query1joindate.Clear;
            datashare_form.Dbs.Rollback;
            query1.Cancel;
            exit;
          end;
        end else
        begin
          query1.Cancel;
          exit;
        end;
      end;

    except
      on e:exception do
      begin
        application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
        exit;
      end;
    end;
    //TB_bgcancel.Enabled:=false;
    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='' 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,4] 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;
  
end;

procedure TJoinSoci_form.TB_itcodeClick(Sender: TObject);
begin
  inherited;
  try
    pyitcode_form:=Tpyitcode_form.create(Application);
    pyitcode_form.showmodal;
  finally
    pyitcode_form.free;
  end;
end;

procedure TJoinSoci_form.FormClose(Sender: TObject;
  var Action: TCloseAction);
var
  i:integer;
begin
  inherited;
  for i:=0 to treeviewCP1.Items.Count-1 do
    Dispose(treeviewCP1.Items[i].Data);    //释放Data指针所指的内存
end;

procedure TJoinSoci_form.Query1CHANTIMEChange(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;
end;

procedure TJoinSoci_form.Query1itcodeChange(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;
end;

procedure TJoinSoci_form.Query1CHANINFOChange(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;
end;

procedure TJoinSoci_form.Query1CHANTIMESetText(Sender: TField;
  const Text: String);
var
  year,month,day:word;
begin
  inherited;
  try
    DecodeDate(strtodateTime(text),year,month,day);
    sender.Value:=text;
  except
    on e:exception do
    begin
      application.MessageBox('非法日期!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
      exit;
    end;
  end;

end;

procedure TJoinSoci_form.DBGrid2KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  inherited;
  //showmessage(inttostr(key));
  {if (key=40) or (key=9) then
  begin
    if Query1.Eof then
    begin
      Query1.Cancel;
      //Query1.Last;
    end;
    exit;
  end; }
  if key=45 then
  begin
    Query1.Cancel;
    exit;
  end;
end;

procedure TJoinSoci_form.help_butExecute(Sender: TObject);
begin
  inherited;
  if (HHCtrlHandle = 0) then
    application.MessageBox('帮助文件不存在!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal)
  else
    FHelpSystemHook.HelpContext(1005);
end;


procedure TJoinSoci_form.BB_findClick(Sender: TObject);
var
  ls_keyfield,ls_cond:string;
begin
  inherited;
  ls_cond:=trim(E_cond.Text);
  if ls_cond='' then
  begin
    application.MessageBox('请输入查找内容!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
    E_cond.SetFocus;
    exit;
  end;

  if dbgrid2.Visible then
  begin
    try
      try
        if Query1.Locate('agcardno',ls_cond,[loPartialKey]) then
          exit;
      except
      end;
      try
        if Query1.Locate('iscode',ls_cond,[loPartialKey]) then
        begin
          dbgrid2.SetFocus;
          exit;
        end;
      except
      end;

      try
        if not Query1.Locate('psname',ls_cond,[loPartialKey]) then
          application.MessageBox('找不到符合条件的人!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
          exit;
      except
      end;
    finally
      dbgrid2.SetFocus;
    end;
  end else
  begin
    try
      if Query2.Locate('agcardno',ls_cond,[loPartialKey]) then
        exit;
    except
    end;
    try
      if Query2.Locate('iscode',ls_cond,[loPartialKey]) then
        exit;
    except
    end;

    try
      if not Query2.Locate('psname',ls_cond,[loPartialK

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -