frm_k_jrdjpas.pas

来自「是一个用delphi设计的考勤系统」· PAS 代码 · 共 543 行 · 第 1/2 页

PAS
543
字号
      orq[i].Width:=60;
    end;
  finally
    query.free;
  end;
end;

procedure TFrm_K_Jrdj.cmbrqClick(Sender: TObject);
begin
  inherited;
  BtnRefreshClick(BtnRefresh);
end;

procedure TFrm_K_Jrdj.TVClick(Sender: TObject);
begin
  inherited;
  ///////////加载人员信息//////////////////////////////////////////////////
  NodeValue := ptTreeNode(TV.Selected.data)^.nodeValue;
  if (copy(NodeValue, 1, 1) = 'd') then gtKqgl.LoadUserTree(TV,copy(NodeValue, 2, Length(NodeValue)-1));

end;

procedure TFrm_K_Jrdj.BtnNextClick(Sender: TObject);
var
  Query: TADOQuery;
  qrybc: TADOQuery;
  sYhxm: string;
  ListItem: TListItem;
  iCount: integer;
begin
  inherited;
  Query := TADOQuery.Create(Screen.activeForm);
  Query.Connection := WindData.AdoConn;
  qrybc := TADOQuery.Create(Screen.activeForm);
  qrybc.Connection := WindData.AdoConn;;
  if (copy(NodeValue, 1, 1) = 'e') then
  begin
    sYhxm := tv.selected.text;
    with query do
    begin
      sql.clear;
      sql.add('select yhbh,yhxm from zx_s_yhxx');
      sql.add('where yhxm=''' + sYhxm + '''');
      sql.add(' order by yhbh');
      open;
      first;
      if recordcount = 0 then
      begin
        application.messagebox('该用户未发卡,不能在本系统进行考勤管理,所以不能设定班次', '系统提示', mb_ok + mb_iconinformation);
        exit;
      end;
      ////////////////////////////////////////////////}
      while not eof do
      begin
        with YhLv do
        begin
          if not gtKqgl.isListViewExistSameItem(yhlv,Query.FieldByName('yhbh').asstring,Query.FieldByName('yhxm').asstring,0) then
          begin
            ListItem := Items.Add;
            Checkboxes := true;
            ListItem.caption := Query.FieldByName('yhbh').asstring;
            ListItem.SubItems.Add(Query.FieldByName('yhxm').asstring);
            ListItem.SubItems.Add(tv.selected.Parent.text);
            listitem.SubItems.Add(''); 
          end;
        end;
        next;
      end;
      for iCount := 0 to YhLv.Items.count - 1 do
        YhLv.items[iCount].Checked := true;
      ////////////////////////////////////////////////
    end;
  end;
end;


procedure TFrm_K_Jrdj.BtnLastClick(Sender: TObject);
var
  Query: TADOQuery;
  qrybc: TADOQuery;
  sBmmc: string;
  ListItem: TListItem;
  iCount: integer;
begin
  inherited;
  Query := TADOQuery.Create(Screen.activeForm);
  Query.Connection := WindData.AdoConn;
  qrybc := TADOQuery.Create(Screen.activeForm);
  qrybc.Connection := WindData.AdoConn;
  if (copy(NodeValue, 1, 1) = 'd') then
  begin
    sBmmc := tv.selected.text;
    with query do
    begin
      sql.clear;
      sql.add('select yhbh,yhxm,bjmc from Vzx_s_yhxx');
      sql.add(' where bjmc=''' + sBmmc + '''');
      sql.add(' order by yhbh');
      open;
      first;
      if recordcount = 0 then
      begin
        application.messagebox('该部门人员未发卡,不能在本系统进行考勤管理,所以不能设定班次', '系统提示', mb_ok + mb_iconinformation);
        exit;
      end;
      ////////////////////////////////////////////////
      while not eof do
      begin
        with YhLv do
        begin
          if not gtKqgl.isListViewExistSameItem(YhLv,Query.FieldByName('yhbh').asstring, Query.FieldByName('yhxm').asstring,0) then
          begin
            ListItem := Items.Add;
            ListItem.caption := Query.FieldByName('yhbh').asstring;
            ListItem.SubItems.Add(Query.FieldByName('yhxm').asstring);
            ListItem.SubItems.Add(tv.selected.text);
            listitem.SubItems.Add('');  
          end;
        end;
        next;
      end;
      //////////////////选定用户---------------
      for iCount := 0 to YhLv.Items.count - 1 do
        YhLv.items[iCount].Checked := true;
      ////////////////////////////////////////////////
    end;
  end;
end;

procedure TFrm_K_Jrdj.BtnPrevClick(Sender: TObject);
var
  iCount,i: integer;
begin
  inherited;
  try
    i:= YhLv.Items.count;
    for iCount := 0 to i - 1 do
    begin
      If YhLv.Items.count<iCount+1 then Exit;
      if not YhLv.items[iCount].Checked then
        YhLv.items[iCount].Delete;
    end;
    YhLv.Refresh;
  except
  end;
end;

procedure TFrm_K_Jrdj.BtnFirstClick(Sender: TObject);
begin
  inherited;
    YhLv.items.clear;
end;

procedure TFrm_K_Jrdj.BitBtn1Click(Sender: TObject);
var
  misaturday, misunday, mistartsj, miendsj,i: integer;
  query:Tquery;
begin
  if application.MessageBox('设置后的时间将不需要考勤,是否继续?','系统提示',mb_okcancel+mb_iconwarning)=id_cancel then exit;
  progressbar1.Max:=31;
  progressbar1.Position:=0;
  with pkq_M_IniDay do
  begin
    for i:=1 to 31 do
    begin
      progressbar1.Position:=progressbar1.Position+1;
      if orq[i].Checked then
      begin 
        if i<10 then
          Parameters.ParamByName('@sDay').Value:='0'+inttostr(i)
        else
          Parameters.ParamByName('@sDay').Value:=inttostr(i);
        Parameters.ParamByName('@svalue').Value:='X';
        old_values[i]:=1;
        Parameters.ParamByName('@n').Value:=labn.caption;
        Parameters.ParamByName('@y').Value:=laby.caption;
        execproc;

      end
      else
      begin
        if old_values[i]=1 then
        begin
          if i<10 then
            Parameters.ParamByName('@sDay').Value:='0'+inttostr(i)
          else
            Parameters.ParamByName('@sDay').Value:=inttostr(i);
          Parameters.ParamByName('@svalue').Value:='O';
          old_values[i]:=0;
          Parameters.ParamByName('@n').Value:=labn.caption;
          Parameters.ParamByName('@y').Value:=laby.caption;
          execproc;
        end;
      end;
    end;
    application.MessageBox('节假日时间设置完毕!','系统提示',mb_ok);
    progressbar1.Position:=0;
  end;
end;

procedure TFrm_K_Jrdj.BitBtn2Click(Sender: TObject);
var
  iBcCount, iYhCount,iCount: integer;
  misaturday, misunday, mistartsj, miendsj,i: integer;
  query:Tquery;
  yhbh:string;
begin

  if application.MessageBox('设置后的时间将不需要考勤,是否继续?','系统提示',mb_okcancel+mb_iconwarning)=id_cancel then exit;
  progressbar1.Max:=31;
  progressbar1.Position:=0;
  yhbh:='';
   for iCount := 0 to YhLv.Items.count - 1 do //选定用户
   begin
     if  YhLv.items[iCount].Checked then
       begin
        yhbh:=yhbh+''''+YhLv.items[iCount].caption+''',';
       end;
   end;
   if length(yhbh)<>0 then
   begin
    yhbh:=copy(yhbh,1,length(yhbh)-1) ;  
   end
   else
   begin
        application.MessageBox('请先选择用户!!','系统提示',MB_OK+mb_iconwarning);
         exit; 
   end;
  with pkq_M_IniDay do
  begin
    for i:=1 to 31 do
    begin
      progressbar1.Position:=progressbar1.Position+1;
      if orq[i].Checked then
      begin 
        if i<10 then
          Parameters.ParamByName('@sDay').Value:='0'+inttostr(i)
        else
          Parameters.ParamByName('@sDay').Value:=inttostr(i);
        Parameters.ParamByName('@svalue').Value:='X';
        old_values[i]:=1;
        Parameters.ParamByName('@n').Value:=labn.caption;
        Parameters.ParamByName('@y').Value:=laby.caption;
        Parameters.ParamByName('@szfs').Value:=1;
        Parameters.ParamByName('@yhbh').Value:=yhbh;
        execproc;

      end
      else
      begin
        if old_values[i]=1 then
        begin
          if i<10 then
            Parameters.ParamByName('@sDay').Value:='0'+inttostr(i)
          else
            Parameters.ParamByName('@sDay').Value:=inttostr(i);
          Parameters.ParamByName('@svalue').Value:='O';
          old_values[i]:=0;
          Parameters.ParamByName('@n').Value:=labn.caption;
          Parameters.ParamByName('@y').Value:=laby.caption;
          execproc;
        end;
      end;
    end;
    application.MessageBox('节假日时间设置完毕!','系统提示',mb_ok);
    progressbar1.Position:=0;
  end;
end;

end.

⌨️ 快捷键说明

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