u_dasjlr_cx.pas

来自「人事管理程序源码」· PAS 代码 · 共 1,015 行 · 第 1/2 页

PAS
1,015
字号
  czfs:=2;
  with gzda_dm.ADODataSet1 do begin
    if recordcount<>0 then
       begin
         last;
         ls_bh:=inttostr(strtoint(copy(fieldbyname('zgxh').AsString,5,4))+1);
         ls_bh_str:=copy(cx_dw.Text,1,2)+copy(cx_bm.Text,1,2)+copy('0000000',1,4-length(ls_bh))+ls_bh;
       end
    else
      ls_bh_str:=copy(cx_dw.Text,1,2)+copy(cx_bm.Text,1,2)+'0001';
    cx_bh.Text:=ls_bh_str;  
    if fieldbyname('xm').AsString<>'********' then
       begin
         Append;
         fieldbyname('xm').AsString:='********';
         fieldbyname('zgxh').AsString:=ls_bh_str;
         post;
       end;  
  end;
  panel4.Enabled:=true;
  cx_xm.SetFocus;
  bitbtn3.Enabled :=true;
end;

procedure TForm_dasjlr_cx.DeleteNUll;
begin
  with gzda_dm.ADODataSet1 do begin
    if fieldbyname('xm').AsString='********' then
       begin
         delete;
         dbgrid1.Refresh;
       end;
  end;
end;

procedure TForm_dasjlr_cx.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  with gzda_dm.ADODataSet1 do begin
    case key of
      37,38:
        if not bof  then
           begin
             Prior;
             DisplayToScreen;
             next;
           end;
      39,40:
        if not eof  then
           begin
             next;
             DisplayToScreen;
             Prior;
           end
    end;
  end;
end;

procedure TForm_dasjlr_cx.RadioButton4Click(Sender: TObject);
var
  zgbh:integer;
begin
  if Application.MessageBox('数据删除后不能再恢复,继续吗?','提示',MB_YesNO+ MB_DEFBUTTON2) <> IDYes then
     begin
       RadioButton1.Checked :=true;
       Abort;
     end;
  if Application.MessageBox('确实要删除本条记录吗!?','提示',MB_YesNO+ MB_DEFBUTTON2) <> IDYes then
     begin
       RadioButton1.Checked :=true;
       Abort;
     end;
  with gzda_dm.ADODataSet1 do begin
    zgbh:=fieldbyname('zgbh').AsInteger;
    delete;
    UpdateBatch(arALL);
    DisplayToscreen;
  end;
  dbgrid1.Refresh;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from gzjl where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from xxjl where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from zcprjl where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from gztzqk where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from jxjy where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from jfjl where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from poqk where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from shgx where zgbh=:bh';
    Parameters.ParamByName('bh').Value:=zgbh;
    Execute;
  end;
  RadioButton1.Checked :=true;
end;


procedure TForm_dasjlr_cx.cx_pxfsChange(Sender: TObject);
var
  pxfs:string;
  x1,x2:integer;
begin
  if (cx_dw.Text='') or (cx_bm.Text='') then abort;
  x1:=pos('(',cx_pxfs.Text);
  x2:=pos(')',cx_pxfs.Text);
  pxfs:=copy(cx_pxfs.Text,x1+1,x2-x1-1);
  OpenDateSet(pxfs);
end;

procedure TForm_dasjlr_cx.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  with gzda_dm.ADODataSet1 do begin
    if active then UpdateBatch(arAll);
  end;
  gzda_dm.DataModuleDestroy(self);
end;

procedure TForm_dasjlr_cx.Image1DblClick(Sender: TObject);
var
    graphic1:TGraphic;
begin
  openpicturedialog1.execute;
  image1.picture.loadfromfile(openpicturedialog1.filename);
end;


procedure TForm_dasjlr_cx.DBImage1DblClick(Sender: TObject);
var
    graphic1:TGraphic;
begin
  if openpicturedialog1.execute then
     begin
        image1.picture.loadfromfile(openpicturedialog1.filename);
        dbimage1.Picture.LoadFromFile(openpicturedialog1.filename);
        if RadioButton2.Checked then
           begin
              with gzda_dm.ADODataSet1 do begin
                edit;
                FieldByName('zp').Assign(image1.Picture);
                post;
              end;
           end;
     end;
end;

procedure TForm_dasjlr_cx.BitBtn1Click(Sender: TObject);
var
  BookMk:Tbookmark;
begin
  with gzda_dm.ADODataSet1 do begin
    Bookmk:=GetBookmark;
    if not Locate('xm',cz_xm.Text,[loPartialKey]) then
       begin
         showmessage('没有要查找的姓名!!');
         GotoBookmark(Bookmk);
       end
    else
       begin
         displayToscreen;
       end;
    FreeBookmark(BookMk);
  end;
  panel11.Visible:=false;
  dbgrid1.SetFocus;
end;

procedure TForm_dasjlr_cx.BitBtn9Click(Sender: TObject);
begin
  panel11.Visible:=true;
  cz_xm.Text:='';
  panel11.Refresh;
  cz_xm.SetFocus;
end;

procedure TForm_dasjlr_cx.BitBtn8Click(Sender: TObject);
begin
   with gzda_dm.ADODataSet1 do begin
     if not active then abort;
     xd_zgbh:=fieldbyname('zgbh').AsInteger;
     xd_zgxm:=fieldbyname('xm').AsString;
   end;
   if xd_zgxm='' then abort;
   Form_qtxx_cx:=TForm_qtxx_cx.create(application); //建立
   Form_qtxx_cx.showmodal; //以有模式方式显示
   Form_qtxx_cx.free ;    //释放窗体
end;

procedure TForm_dasjlr_cx.cx_bmChange(Sender: TObject);
begin
  bmChange(true);
  OpenDateSet('zgxh');
end;

procedure TForm_dasjlr_cx.bmChange(bz:boolean);
begin
  panel7.Enabled:=bz;
  cx_pxfs.Enabled:=bz;
  dbgrid1.Enabled:=bz;
  bitbtn5.Enabled:=bz;
  bitbtn6.Enabled:=bz;
  bitbtn8.Enabled:=bz;
  bitbtn9.Enabled:=bz;
  dbimage1.Visible:=bz;
end;

procedure TForm_dasjlr_cx.FormActivate(Sender: TObject);
begin
  cx_dw.SetFocus;
end;

procedure TForm_dasjlr_cx.cx_bmExit(Sender: TObject);
begin
  if cx_bm.Text='' then
     begin
       showmessage('请选定部门编码!!');
       cx_bm.SetFocus;
       abort;
     end;

end;

procedure TForm_dasjlr_cx.cx_zzmmExit(Sender: TObject);
begin
  if pos('党',cx_zzmm.Text)=0 then
     cx_rdsj.Enabled:=false
  else
     cx_rdsj.Enabled:=true;
end;

procedure TForm_dasjlr_cx.cx_dwChange(Sender: TObject);
var
 dwbm:string;
begin
  dwbm:=copy(cx_dw.Text,1,2);
  with gzda_dm.ADODataSet10 do begin
    if active then active:=false;
    commandtext:='select * from bmbmb where (dwbm=:dwbm) order by dwbm,bmbm';
    Parameters.ParamByName('dwbm').Value:=dwbm;
    open;
    first;
    cx_bm.Items.Clear;
    cx_bm.Items.Add('00.所有部门');
    while not eof do begin
      cx_bm.Items.Add(fieldbyname('bmbm').AsString+'.'+fieldbyname('bmmc').AsString);
      next;
    end;
  end;
  cx_bm.ItemIndex:=-1;
  cx_bm.Refresh;
end;

procedure TForm_dasjlr_cx.cx_gzzeKeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9','.',#8,#13]) then key:=#0;
end;

procedure TForm_dasjlr_cx.cx_gzzeExit(Sender: TObject);
begin
  if cx_gzze.Text='' then cx_gzze.Text:='0.00';
end;

procedure TForm_dasjlr_cx.BitBtn5Click(Sender: TObject);
begin
  if form_dyjl.PrinterSetupDialog1.Execute then
     begin
        open_qtxx;
        form_dyjl.QR_dw.Caption:='单位:'+copy(cx_dw.Text,4,length(cx_dw.Text)-3);
        form_dyjl.QR_bm.Caption:='部门:'+copy(cx_bm.Text,4,length(cx_bm.Text)-3);
        form_dyjl.QuickRep1.Print;
        if dybz[6] and (gzda_dm.ADODataSet9.RecordCount<>0) then form_dyjl.QuickRep2.print ;
        if dybz[7] and (gzda_dm.ADODataSet8.RecordCount<>0) then form_dyjl.QuickRep3.print
     end;
end;

procedure TForm_dasjlr_cx.BitBtn6Click(Sender: TObject);
begin
  open_qtxx;
  form_dyjl.QR_dw.Caption:='单位:'+copy(cx_dw.Text,4,length(cx_dw.Text)-3);
  form_dyjl.QR_bm.Caption:='部门:'+copy(cx_bm.Text,4,length(cx_bm.Text)-3);
  form_dyjl.QuickRep1.Preview;
  if dybz[6] and (gzda_dm.ADODataSet9.RecordCount<>0) then form_dyjl.QuickRep2.Preview ;
  if dybz[7] and (gzda_dm.ADODataSet8.RecordCount<>0) then form_dyjl.QuickRep3.Preview
end;
procedure TForm_dasjlr_cx.open_qtxx;
var
  i:integer;
begin
  panel12.Visible:=true;
  panel12.Refresh;
  with gzda_dm.ADODataSet1 do begin
     xd_zgbh:=fieldbyname('zgbh').AsInteger;
     xd_zgxm:=fieldbyname('xm').AsString;
  end;

  with gzda_dm.ADODataSet_cx do begin
    if active then active:=false;
    commandtext:='select * from dyxm order by xh';
    open;
    first;
    i:=0;
    while not eof do begin
      dybz[i]:=fieldbyname('dybz').AsBoolean;
      i:=i+1;
      next;
    end;
  end;

  with gzda_dm.ADOCommand1 do begin
    commandtext:='delete from ls_zgjl';
    Execute;
  end;
  with gzda_dm.ADODataSet_cx do begin
    if active then active:=false;
    commandtext:='select * from ls_zgjl';
    open;
    first;
  end;
  if dybz[0] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开工作经历
          if active then active:=false;
          commandtext:='select * from gzjl where (zgbh=:bh) order by qssj';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','工作简历','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['开始时间','终止时间','工作单位','职务','证明人']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('qssj').asstring,fieldbyname('zzsj').asstring,fieldbyname('gzdw').asstring,fieldbyname('zw').asstring,fieldbyname('zmr').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
     end;
  if dybz[1] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开学习经历
          if active then active:=false;
          commandtext:='select * from xxjl where (zgbh=:bh) order by qssj';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','学习简历','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['开始时间','终止时间','毕业学校','专业','证明人']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('qssj').asstring,fieldbyname('zzsj').asstring,fieldbyname('byxx').asstring,fieldbyname('zy').asstring,fieldbyname('zmr').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
    end;
  if dybz[2] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开 职称评聘
          if active then active:=false;
          commandtext:='select * from zcprjl where (zgbh=:bh) ';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','职称评聘简历','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['职称(技术等级)','评审机关','评审时间及资格证书编号','聘任机关','聘任时间']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('zc').asstring,fieldbyname('psjg').asstring,fieldbyname('pssj').asstring+'/'+fieldbyname('zgzsbh').asstring,fieldbyname('prjg').asstring,fieldbyname('prsj').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
    end;
  if dybz[3] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开继续教育
          if active then active:=false;
          commandtext:='select * from jxjy where (zgbh=:bh) order by qssj';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','继续教育简历','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['起始时间','终止时间','主办单位','学习形式','学习内容']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('qssj').asstring,fieldbyname('zzsj').asstring,fieldbyname('zbdw').asstring,fieldbyname('xxxs').asstring,fieldbyname('xxnr').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
    end;
  if dybz[4] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开奖罚记录
          if active then active:=false;
          commandtext:='select * from jfjl where (zgbh=:bh) order by rq';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','奖罚简历','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['日期','原因','授予单位','名称','级别']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('rq').asstring,fieldbyname('yy').asstring,fieldbyname('sydw').asstring,fieldbyname('mc').asstring,fieldbyname('jb').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
    end;
//==
  if dybz[5] then
     begin
        with gzda_dm.ADODataSet2 do begin  //打开社会关系
          if active then active:=false;
          commandtext:='select * from shgx where (zgbh=:bh) ';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
        with gzda_dm.ADODataSet2 do begin  //把工作简历加到gzda_dm.ADODataSet_cx中
          first;
          gzda_dm.ADODataSet_cx.AppendRecord(['','','社会关系','','']);
          gzda_dm.ADODataSet_cx.AppendRecord(['社会关系','姓名','工作单位','出生日期','职务']);
          while not eof do begin
            gzda_dm.ADODataSet_cx.AppendRecord([fieldbyname('shgx').asstring,fieldbyname('xm').asstring,fieldbyname('gzdw').asstring,fieldbyname('csrq').asstring,fieldbyname('zw').asstring]);
            next;
          end;
          gzda_dm.ADODataSet_cx.UpdateBatch(arALL);
        end;
     end;
  //==
  with gzda_dm.ADODataSet_cx do begin
    if active then active:=false;
    commandtext:='select * from ls_zgjl';
    open;
    first;
  end;
  if dybz[6] then
     begin
        with gzda_dm.ADODataSet9 do begin  //打开工资调整
          if active then active:=false;
          commandtext:='select * from gztzqk where (zgbh=:bh) order by tzsj';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
     end;
  if dybz[7] then
     begin
        with gzda_dm.ADODataSet8 do begin  //打开工资调整
          if active then active:=false;
          commandtext:='select * from poqk where (zgbh=:bh)';
          Parameters.ParamByName('bh').Value:=Form_dasjlr_cx.xd_zgbh;
          open;
          first;
        end;
     end;
  panel12.Visible:=false;
end;

procedure TForm_dasjlr_cx.cx_bmEnter(Sender: TObject);
begin
  if cx_dw.Text='' then
     begin
       showmessage('请首先选定单位名称!!');
       cx_dw.SetFocus;
       abort;
     end;
end;

end.

⌨️ 快捷键说明

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