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

📄 sysw00_01.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
//转到
  if trim(ComboBox1.Text)='' then Exit;
  AFLAG:='N';
  for I:=0 to TreeView1.Items.Count-1 do
  begin
    if TreeView1.Items.Item[I].Text=trim(ComboBox1.Text) then
    begin
      TreeView1.Items.Item[I].Selected:=True;
      AFLAG:='Y';
      Break;
    end;
  end;
  if AFLAG='N' then
  begin
    SYSDM.qryQuery.Close;
    SYSDM.qryQuery.SQL.Clear;
    if ASuper then
      SYSDM.qryQuery.SQL.Add('select S500D_001 from SYS500B,SYS500D '+
                             'where S500B_002=S500D_011 '+
                             ' and S500B_011<>''C'' and S500D_006='+GetBoolean(True)+
                             ' and S500D_001='+''''+trim(ComboBox1.Text)+''''+
                             ' and S500B_001='+IntToStr(AUserID))
    else
      SYSDM.qryQuery.SQL.Add('select S500D_001 from SYS500B,SYS500D '+
                             'where S500B_002=S500D_011 '+
                             ' and S500B_011<>''C'' and S500D_006='+GetBoolean(True)+
                             ' and S500D_001='+''''+trim(ComboBox1.Text)+''''+
                             ' and S500B_001='+IntToStr(AUserID)+' and S500B_004='+GetBoolean(True));
    SYSDM.qryQuery.Open;
    if SYSDM.qryQuery.IsEmpty then
    begin
      ShowMsg('UMS10000027');  //无效的程序编号
      Exit;
    end;
    FLAG1:=True;
    APRGM:=UpperCase(trim(ComboBox1.Text));
    if (APRGM='SYS100') or (APRGM='SYS600') or (APRGM='SYS700') then FLAG1:=False;
    SYSDM.qryQuery.Close;
    SYSDM.qryQuery.SQL.Clear;
    case ADatabase of  //0=Access,1=SQL Server
      0:SYSDM.qryQuery.SQL.Add('update SYS500D set S500D_003=now(),S500D_004='+''''+AUserName+''''+' where S500D_001='+''''+trim(ComboBox1.Text)+'''');
      1:SYSDM.qryQuery.SQL.Add('update SYS500D set S500D_003=getdate(),S500D_004='+''''+AUserName+''''+' where S500D_001='+''''+trim(ComboBox1.Text)+'''');
    end;
    SYSDM.qryQuery.ExecSQL;
    qrySys500B.DisableControls;
    if CreateFormInPackage('T'+APRGM+'_01Form',FLAG1)=1 then
    begin
      if APRGM='SYS700' then
      begin
        ErpMainForm.FormCreate(ErpMainForm);
        ShowChildForm;
      end else
      if APRGM='CSH550' then  //新建帐户
      begin
        if Assigned(CshW00_01Form) then CshW00_01Form.RefreshAccount;
      end else
      if APRGM='CWA150' then  //考勤项目
      begin
        if Assigned(CwaW00_01Form) then CwaW00_01Form.RefreshCheckItem;
      end else
      if APRGM='PAY150' then  //薪资项目
      begin
        if Assigned(PayW00_01Form) then PayW00_01Form.RefreshPayItem;
      end else
      if (APRGM='HRM100') or (APRGM='HRM120') or (APRGM='HRM130') then  //部门资料,岗位资料,员工状态
      begin
        if Assigned(HrmW00_01Form) then HrmW00_01Form.RefreshDepartment;
      end;
    end;
    qrySys500B.EnableControls;
  end;
end;

procedure TSysW00_01Form.ComboBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=vk_return then spbGoTo.Click;
end;

procedure TSysW00_01Form.TreeView1GetImageIndex(Sender: TObject;
  Node: TTreeNode);
begin
  Node.ImageIndex:=1;
end;

procedure TSysW00_01Form.ListView1Click(Sender: TObject);
var
  AFLAG:boolean;
  APRGM:string;
begin
  if ListView1.Selected=nil then Exit;
  SYSDM.qryQuery.Close;
  SYSDM.qryQuery.SQL.Clear;
  if ASuper then
    SYSDM.qryQuery.SQL.Add('select S500D_001 from SYS500B,SYS500D '+
                           'where S500B_002=S500D_011 '+
                           ' and S500B_011<>''C'' and S500D_006='+GetBoolean(True)+
                           ' and S500D_001='+''''+ListView1.Selected.SubItems[0]+''''+
                           ' and S500B_001='+IntToStr(AUserID))
  else
    SYSDM.qryQuery.SQL.Add('select S500D_001 from SYS500B,SYS500D '+
                           'where S500B_002=S500D_011 '+
                           ' and S500B_011<>''C'' and S500D_006='+GetBoolean(True)+
                           ' and S500D_001='+''''+ListView1.Selected.SubItems[0]+''''+
                           ' and S500B_001='+IntToStr(AUserID)+' and S500B_004='+GetBoolean(True));
  SYSDM.qryQuery.Open;
  if SYSDM.qryQuery.IsEmpty then
  begin
    ShowMsg('UMS10000027');  //无效的程序编号
    Exit;
  end;
  AFLAG:=True;
  APRGM:=UpperCase(ListView1.Selected.SubItems[0]);
  if (APRGM='SYS100') or (APRGM='SYS600') or (APRGM='SYS700') then AFLAG:=False;
  //记录开启时间
  SYSDM.qryQuery.Close;
  SYSDM.qryQuery.SQL.Clear;
  case ADatabase of  //0=Access,1=SQL Server
    0:SYSDM.qryQuery.SQL.Add('update SYS500D set S500D_003=now(),S500D_004='+''''+AUserName+''''+' where S500D_001='+''''+ListView1.Selected.SubItems[0]+'''');
    1:SYSDM.qryQuery.SQL.Add('update SYS500D set S500D_003=getdate(),S500D_004='+''''+AUserName+''''+' where S500D_001='+''''+ListView1.Selected.SubItems[0]+'''');
  end;
  SYSDM.qryQuery.ExecSQL;
  //打开工作平台
  if not IsWorkBench(APRGM) then
  begin
    //打开对应程序
    if CreateFormInPackage('T'+APRGM+'_01Form',AFLAG)=1 then
    begin
      if APRGM='SYS700' then  //重新登录
      begin
        ErpMainForm.FormCreate(ErpMainForm);
        ShowChildForm;
      end else
      if APRGM='CSH550' then  //新建帐户
      begin
        if Assigned(CshW00_01Form) then CshW00_01Form.RefreshAccount;
      end else
      if APRGM='CWA150' then  //考勤项目
      begin
        if Assigned(CwaW00_01Form) then CwaW00_01Form.RefreshCheckItem;
      end else
      if APRGM='PAY150' then  //薪资项目
      begin
        if Assigned(PayW00_01Form) then PayW00_01Form.RefreshPayItem;
      end else
      if (APRGM='HRM100') or (APRGM='HRM120') or (APRGM='HRM130') then  //部门资料,岗位资料,员工状态
      begin
        if Assigned(HrmW00_01Form) then HrmW00_01Form.RefreshDepartment;
      end;
    end;
  end;
end;

procedure TSysW00_01Form.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
  Key:=UpCase(Key);
end;

procedure TSysW00_01Form.ListView1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then ListView1Click(Self);
end;

procedure TSysW00_01Form.ListView1Resize(Sender: TObject);
begin
  ListView1.Refresh;
end;

procedure TSysW00_01Form.qrySys500BAfterScroll(DataSet: TDataSet);
var
  AListItem:TListItem;
begin
  LockWindowUpdate(ListView1.Handle);
  ListView1.Items.Clear;
  qrySys500D.Close;
  qrySys500D.SQL.Clear;
  if qrySys500B.IsEmpty then
    qrySys500D.SQL.Add('select S500D_001,S500D_003,S500D_004 from SYS500B,SYS500D where S500B_002=S500D_011 and S500B_011<>''C'' and S500B_004='+GetBoolean(True)+' and S500B_003=null and S500B_001='+IntToStr(AUserID)+' order by S500D_005,S500D_001')
  else
  begin
    if ASuper then
      qrySys500D.SQL.Add('select S500D_001,S500D_003,S500D_004 from SYS500B,SYS500D where S500B_002=S500D_011 and S500D_006='+GetBoolean(True)+' and S500B_011<>''C'' and S500D_002='+''''+qrySys500B.FieldByName('S500D_001').Value+''''+' and S500B_001='+IntToStr(AUserID)+' order by S500D_005,S500D_001')
    else
      qrySys500D.SQL.Add('select S500D_001,S500D_003,S500D_004 from SYS500B,SYS500D where S500B_002=S500D_011 and S500D_006='+GetBoolean(True)+' and S500B_011<>''C'' and S500B_004='+GetBoolean(True)+' and S500D_002='+''''+qrySys500B.FieldByName('S500D_001').Value+''''+' and S500B_001='+IntToStr(AUserID)+' order by S500D_005,S500D_001');
  end;
  qrySys500D.Open;
  while not qrySys500D.Eof do
  begin
    AListItem:=ListView1.Items.Add;
    AListItem.Caption:=qrySys500D.FieldByName('S500D_007').AsString;
    AListItem.SubItems.Add(trim(qrySys500D.FieldByName('S500D_001').AsString));   //程序编号
    AListItem.SubItems.Add(qrySys500D.FieldByName('S500D_003').AsString);   //操作时间
    AListItem.SubItems.Add(qrySys500D.FieldByName('S500D_004').AsString);   //操作人员
    qrySys500D.Next;
  end;
  LockWindowUpdate(0);
end;

procedure TSysW00_01Form.ActRestoreExecute(Sender: TObject);
begin
//数据恢复(&S)...
  Screen.Cursor:=crHourGlass;
  AStartTime:=GetTickCount;
  qrySys500B.DisableControls;
  Sys410_01Form:=TSys410_01Form.Create(Application);
  ShowRunTime;  //显示程序执行时间
  Screen.Cursor:=crDefault;
  if Sys410_01Form.ShowModal=1 then
  begin
    DoCreate;
    qrySys500B.EnableControls;
  end;
end;

procedure TSysW00_01Form.ActExitExecute(Sender: TObject);
begin
//退出(&X)
  Application.MainForm.Close;
end;

procedure TSysW00_01Form.ActEmailExecute(Sender: TObject);
begin
//写信给作者(&E)...
  Screen.Cursor:=crHourGlass;
  ShellExecute(Handle, nil, PChar('mailto:'+AEmail),nil,nil,SW_NORMAL);
  Screen.Cursor:=crDefault;
end;

procedure CompAccessDB;
begin
  try
    SYSDM.ADOC.Connected:=False;
    SYSDM.SYSADOC.Connected:=False;
    CompactDatabase(ExtractFilePath(Application.ExeName)+'Data\'+AFileName+'.mdb','HowWell19740507');
    DaoCompactDB(ExtractFilePath(Application.ExeName)+'HwSys.hws');
    SYSDM.ADOC.Connected:=True;
    SYSDM.SYSADOC.Connected:=True;
  except
    WaitForm.Close;
    ShowMsg('UMS10000028');  //压缩整理失败
    Abort;
  end;
end;

procedure CompSQLDB;
begin
  try
    SYSDM.qryQuery.Close;
    SYSDM.qryQuery.SQL.Clear;
    SYSDM.qryQuery.SQL.Add('dbcc shrinkdatabase('+AFileName+',10)');
    SYSDM.qryQuery.ExecSQL;
  except
    WaitForm.Close;
    ShowMsg('UMS10000028');  //压缩整理失败
    Abort;
  end;
end;

procedure TSysW00_01Form.ActCompressExecute(Sender: TObject);
begin
//压缩整理
  Screen.Cursor:=crHourGlass;
  CloseHwTSC;  //关闭浩晖事务服务控制器
  AStartTime:=GetTickCount;
  try
    WaitForm.Show;
    WaitForm.Update;
    qrySys500B.DisableControls;
    case ADatabase of  //0=Access,1=SQL Server
      0:CompAccessDB;
      1:CompSQLDB;
    end;
  finally
    SYSDM.ADOC.Connected:=True;
    qrySys500B.Open;
    qrySys500B.EnableControls;
    WaitForm.Close;
  end;
  ShowRunTime;  //显示程序执行时间
  Screen.Cursor:=crDefault;
  ShowMsg('UMS10000029');  //压缩整理成功
end;

procedure TSysW00_01Form.ActHomePageExecute(Sender: TObject);
begin
//网上浩晖(&P)...
  Screen.Cursor:=crHourGlass;
  ShellExecute(Handle, nil, PChar(AHome),nil,nil,SW_NORMAL);
  Screen.Cursor:=crDefault;
end;

procedure TSysW00_01Form.ActOptionsExecute(Sender: TObject);
begin
//系统参数(&P)...
  Screen.Cursor:=crHourGlass;
  AStartTime:=GetTickCount;
  Sys900_01Form:=TSys900_01Form.Create(Application);
  ShowRunTime;  //显示程序执行时间
  Screen.Cursor:=crDefault;
  Sys900_01Form.ShowModal;
end;

procedure TSysW00_01Form.ActRefreshExecute(Sender: TObject);
begin
//刷新(&R)
  qrySys500BAfterScroll(qrySys500B);
end;

procedure TSysW00_01Form.qrySys500DCalcFields(DataSet: TDataSet);
begin
  qrySys500DS500D_007.Value:=GetDBString(qrySys500DS500D_001.Value);
end;

procedure TSysW00_01Form.ActAlterExecute(Sender: TObject);
begin
//预警条件设置(&A)...
  Screen.Cursor:=crHourGlass;
  AStartTime:=GetTickCount;
  Sys910_01Form:=TSys910_01Form.Create(Application);
  ShowRunTime;  //显示程序执行时间
  Screen.Cursor:=crDefault;
  Sys910_01Form.ShowModal;
end;

procedure TSysW00_01Form.dxDBGrid1CustomDraw(Sender: TObject;
  ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
  AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
  var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
  if SYSDM.qrySys910.IsEmpty then Exit;
  //1=新消息,2=旧消息
  case SYSDM.qrySys910S910_006.Value of
    1:AFont.Style:=[fsBold];
  else
    AFont.Style:=[];
  end;
end;

procedure TSysW00_01Form.mmiReadedClick(Sender: TObject);
begin
//标识为“已阅读”
  if not SYSDM.qrySys910.Active then Exit;
  if SYSDM.qrySys910.IsEmpty then Exit;
  SYSDM.qrySys910.Edit;
  SYSDM.qrySys910S910_006.Value:=2;
  SYSDM.qrySys910.Post;
end;

procedure TSysW00_01Form.ActUpgradeExecute(Sender: TObject);
begin
//在线智能升级(&U)...
  ShowUpgradeForm;
end;

end.

⌨️ 快捷键说明

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