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

📄 fmain.~pas

📁 一个基于delphi开发的人力资源管理的系统源码。
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
      RepStaffinfo.ADOQuery1.SQL.Add('select * from r_staffinfo,r_staffclasscode,r_staffbranch where 1=1');
      RepStaffinfo.ADOQuery1.SQL.Add(' and r_staffinfo.classcodeID=r_staffclasscode.id');
      RepStaffinfo.ADOQuery1.SQL.Add(' and r_staffinfo.branchid=r_staffbranch.id');
      RepStaffinfo.ADOQuery1.Filtered:=false;
      RepStaffinfo.ADOQuery1.Filter:=format('r_staffinfo.id'+'='+'''%s''',[tmpid]);
      RepStaffinfo.ADOQuery1.Filtered:=true;
      RepStaffinfo.ADOQuery1.Open;
      RepStaffinfo.QuickRep1.Preview;

end;

procedure TMain.dxDBTreeView1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var tmpid:string;
begin
  tmpid:=self.branch.fieldbyname('id').AsString;
  self.staffinfo.Close;
  self.staffinfo.SQL.Text:=self.sqlstring;
  self.staffinfo.Filtered:=false;
  self.staffinfo.Filter:=format('branchid'+'='+'''%s''',[tmpid]);
  self.staffinfo.Filtered:=true;
  self.staffinfo.Open;
end;

procedure TMain.N51Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  if self.r_staffbranchedit.Active=false then exit;
  if self.r_staffbranchedit.RecordCount=0 then exit;
  if Application.MessageBox('确认要删除所选择员工的部门变动记录吗?','提示',MB_YESNO )=IDYES then
    begin
      self.r_staffbranchedit.Delete;
      self.r_staffbranchedit.Close;
      self.r_staffbranchedit.Open;
    end;
end;

procedure TMain.N49Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  if self.r_staffbranchedit.Active=false then exit;
  if self.r_staffbranchedit.RecordCount=0 then exit;
  branmessage := tbranmessage.create(application);
  self.r_staffbranchedit.Edit;
  branmessage.showmodal;
  self.r_staffbranchedit.Close;
  self.r_staffbranchedit.Open;
end;

procedure TMain.N54Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  if self.r_staffpict.Active=false then exit;
  if self.r_staffpict.RecordCount=0 then exit;
  if Application.MessageBox('确认要删除所选择的图片资料吗?','提示',MB_YESNO )=IDYES then
    begin
      self.r_staffpict.Delete;
      self.r_staffpict.Close;
      self.r_staffpict.Open;
    end;
end;

procedure TMain.N52Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  showpic:=tshowpic.create(application);
  self.r_staffpict.Append;
  showpic.showmodal;
  self.r_staffpict.Close;
  self.r_staffpict.Open;
end;

procedure TMain.N56Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  payedit:=tpayedit.create(application);
  payedit.etype:=1;
  self.PageControl1.ActivePageIndex:=2;
  self.r_staffpay.Append;
  payedit.showmodal;
  self.r_staffpay.Close;
  self.r_staffpay.Open;
end;

procedure TMain.cxGrid5DBTableView1DblClick(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  payedit:=tpayedit.Create(application);
  self.r_staffpay.Edit;
  payedit.etype:=2;
  payedit.ShowModal;
  self.r_staffpay.Close;
  self.r_staffpay.Open;
end;

procedure TMain.N58Click(Sender: TObject);
begin
  if self.staffinfo.RecordCount=0 then exit;
  if self.r_staffpay.Active=false then exit;
  if self.r_staffpay.RecordCount=0 then exit;
  if Application.MessageBox('确认要删除所选择的薪资福利计算规则吗?','提示',MB_YESNO )=IDYES then
    begin
      self.r_staffpay.Delete;
      self.r_staffpay.Close;
      self.r_staffpay.Open;
    end;
end;

procedure TMain.N60Click(Sender: TObject);
var i,j,k:integer;
begin
 // if self.staffinfo.Active<>true then self.staffinfo.Active:=true;
  if self.staffinfo.RecordCount=0 then exit;
  //if self.N85.Checked=false then
  //  else
  //  begin
  //    if trim(self.demofile)='' then
  //      begin
  //        MessageBox(handle,'您未选择模版!','错误',MB_ICONERROR or MB_OK);
  //        exit;
  //      end;
  //  end;
  if self.demofile<>'' then
    begin
      try
        cxSpreadSheetBook1.LoadFromFile(self.demofile);
        self.tmpstaffid:=self.staffinfo.fieldbyname('r_staffinfo.id').AsString;
        self.cxSpreadSheetBook1.ActiveSheet.ReadOnly:=false;
        self.cxSpreadSheetBook1.ReadOnly:=false;
        //self.cxSpreadSheetBook1.PageCount:=1;
        //self.cxSpreadSheetBook1.ActivePage:=0;
        self.TabSheet8.tabVisible:=true;
        self.N67.Checked:=false;
        if self.N87.Checked=true then
          self.PageControl1.ActivePageIndex:=7;
        for k:=0 to self.cxSpreadSheetBook1.PageCount-1 do
          begin
            self.cxSpreadSheetBook1.ActivePage:=k;
            for i:=1 to self.cxSpreadSheetBook1.ActiveSheet.ColumnCount do
              begin
                for j:=1 to self.cxSpreadSheetBook1.ActiveSheet.RowCount do
                  begin
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[1] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('name').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[2] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('sex').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[3] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('ename').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[4] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('ifmarriage').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[5] then
                      SetCellText(i,j,datetostr(strtodate(datetostr(self.staffinfo.fieldbyname('birthday').AsDateTime))));
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[6] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('Nativeplace').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[7] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('Nationality').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[8] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('idnum').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[9] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('Residence').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[10] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('knowledge').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[11] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('School').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[12] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('forlang').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[13] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('howforlang').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[15] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('exigenceman').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[14] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('Telephone').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[16] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('Address').AsString);
                    if cxSpreadSheetBook1.ActiveSheet.GetCellObject(i,j).Text=self.ReadStencil[17] then
                      SetCellText(i,j,self.staffinfo.fieldbyname('email').AsString);
                  end;
              end;
          end;
        self.cxSpreadSheetBook1.ActivePage:=0;
        exit;
      except
        MessageBox(handle,'打开模版失败,请重新载入!','错误',MB_ICONERROR or MB_OK);
        self.StatusBar1.Panels[2].Text:='';
      end;
    end;
  self.cxSpreadSheetBook1.ActiveSheet.ClearAll;
  self.tmpstaffid:=self.staffinfo.fieldbyname('r_staffinfo.id').AsString;
  self.cxSpreadSheetBook1.ActiveSheet.ReadOnly:=false;
  self.cxSpreadSheetBook1.ReadOnly:=false;
  self.cxSpreadSheetBook1.PageCount:=1;
  self.cxSpreadSheetBook1.ActivePage:=0;
  if self.TabSheet8.TabVisible=false then TabSheet8.tabVisible:=true;
  self.N67.Checked:=false;
  self.cxSpreadSheetBook1.DefaultStyle.Font.Name:='宋体';
  self.cxSpreadSheetBook1.DefaultStyle.Font.Size:=9;
  self.cxSpreadSheetBook1.BeginUpdate;

  (*    建立数据表    *)
  SetCellText(1,1,'姓  名');
  SetCellText(2,1,self.staffinfo.fieldbyname('name').AsString);
  SetCellText(3,1,'性  别');
  SetCellText(4,1,self.staffinfo.fieldbyname('sex').AsString);
  SetCellText(5,1,'英文名');                          
  SetCellText(6,1,self.staffinfo.fieldbyname('ename').AsString);
  SetCellText(1,2,'婚  否');
  SetCellText(2,2,self.staffinfo.fieldbyname('ifmarriage').AsString);
  SetCellText(3,2,'出生日期');
  SetCellText(4,2,datetostr(strtodate(datetostr(self.staffinfo.fieldbyname('birthday').AsDateTime))));
  SetCellText(1,3,'籍  贯');
  SetCellText(2,3,self.staffinfo.fieldbyname('Nativeplace').AsString);
  SetCellText(3,3,'民  族');
  SetCellText(4,3,self.staffinfo.fieldbyname('Nationality').AsString);
  SetCellText(1,4,'身份证号码');
  SetCellText(2,4,self.staffinfo.fieldbyname('idnum').AsString);
  SetCellText(3,4,'户口所在地');
  SetCellText(4,4,self.staffinfo.fieldbyname('Residence').AsString);
  SetCellText(1,5,'学  历');
  SetCellText(2,5,self.staffinfo.fieldbyname('knowledge').AsString);
  SetCellText(3,5,'毕业院校');
  SetCellText(4,5,self.staffinfo.fieldbyname('School').AsString);
  SetCellText(1,6,'外语语种');
  SetCellText(2,6,self.staffinfo.fieldbyname('forlang').AsString);
  SetCellText(3,6,'外语程度');
  SetCellText(4,6,self.staffinfo.fieldbyname('howforlang').AsString);
  SetCellText(1,7,'紧急联系人');
  SetCellText(2,7,self.staffinfo.fieldbyname('exigenceman').AsString);
  SetCellText(3,7,'紧急联系电话');
  SetCellText(4,7,self.staffinfo.fieldbyname('exigencephone').AsString);
  SetCellText(1,8,'联系电话');
  SetCellText(2,8,self.staffinfo.fieldbyname('Telephone').AsString);
  SetCellText(3,8,'联系地址');
  SetCellText(4,8,self.staffinfo.fieldbyname('Address').AsString);
  SetCellText(1,9,'电子信箱');
  SetCellText(2,9,self.staffinfo.fieldbyname('Email').AsString);
  self.cxSpreadSheetBook1.Recalc;
  self.cxSpreadSheetBook1.EndUpdate;
  //self.cxSpreadSheetBook1.ActiveSheet.SelectCell(0,0,false);
  if self.N87.Checked=true then
      self.PageControl1.ActivePageIndex:=7;
end;

procedure TMain.N61Click(Sender: TObject);
begin
  with cxSpreadSheetBook1.ActiveSheet do
    Copy(SelectionRect, True);
end;

procedure TMain.N62Click(Sender: TObject);
begin
  with cxSpreadSheetBook1.ActiveSheet do
    Copy(SelectionRect, False);
end;

procedure TMain.N63Click(Sender: TObject);
begin
  with cxSpreadSheetBook1.ActiveSheet do
    Paste(SelectionRect.TopLeft);
end;

procedure TMain.N65Click(Sender: TObject);
begin
  self.TabSheet8.TabVisible:=false;
end;

procedure TMain.N67Click(Sender: TObject);
begin
  if self.N67.Checked=true then
    begin
      self.cxSpreadSheetBook1.ReadOnly:=false;
      self.cxSpreadSheetBook1.ActiveSheet.ReadOnly:=false;
      self.N67.Checked:=false;
    end
    else
    begin
      self.cxSpreadSheetBook1.ReadOnly:=true;
      self.cxSpreadSheetBook1.ActiveSheet.ReadOnly:=true;
      self.N67.Checked:=true;
    end;
end;

procedure TMain.N69Click(Sender: TObject);
begin
  cxSpreadSheetBook1.History.Undo(1);
end;

procedure TMain.N70Click(Sender: TObject);
begin
  cxSpreadSheetBook1.History.redo(1);
end;

procedure TMain.Splitter1Moved(Sender: TObject);
begin
  if self.dxDBTreeView1.Width<1 then self.dxDBTreeView1.Width:=1;
end;

procedure TMain.actNewExecute(Sender: TObject);
begin
  NewSheet;
  self.StatusBar1.Panels[2].Text:='';
end;

procedure TMain.actSaveSpeadSheetExecute(Sender: TObject);
var
  AFileName: string;
begin
  self.SaveDialog1.DefaultExt:='*.xls';
  self.SaveDialog1.Filter:='Excel文件|*.xls';
  if SaveDialog1.Execute then
  begin
    AFileName := ChangeFileExt(SaveDialog1.FileName, '.xls');
    cxSpreadSheetBook1.SaveToFile(AFileName);
    self.StatusBar1.Panels[2].Text:='文件:'+afilename;
  end;
end;

procedure TMain.actCutExecute(Sender: TObject);
begin
  self.N61.OnClick(self);
end;

procedure TMain.actCopyExecute(Sender: TObject);
begin
  self.N62.OnClick(self);
end;

procedure TMain.actPasteExecute(Sender: TObject);
begin
  self.N63.OnClick(self);
end;

procedure TMain.tbUndoClick(Sender: TObject);
begin
  self.N69.OnClick(self);
end;

procedure TMain.ToolButton21Click(Sender: TObject);
begin
  self.N70.OnClick(self);
end;

procedure TMain.actCellLeftAlignExecute(Sender: TObject);
begin
  SetCellsStyle([svAlign], haLeft, 0, cbxFont.Text, []);
end;

procedure TMain.actCellCenterAlignExecute(Sender: TObject);
begin
  SetCellsStyle([svAlign], haCenter, 0, cbxFont.Text, []);
end;

procedure TMain.actCellRightAlignExecute(Sender: TObject);
begin
  SetCellsStyle([svAlign], haRight, 0, cbxFont.Text, []);
end;

procedure TMain.cbxFontChange(Sender: TObject);
begin
  SetCellsStyle([svFontName], haGeneral, 0, cbxFont.Text, []);
end;

procedure TMain.cbxSizeChange(Sender: TObject);
var
  ASize: Integer;
begin
  if cxTryStrToInt(cbxSize.Text, ASize) then
    SetCellsStyle([svSize], haGeneral, ASize, 

⌨️ 快捷键说明

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