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

📄 untsearchbase.pas

📁 高校党员管理系统源代码有用的可以下载来用
💻 PAS
字号:
unit UntSearchBase;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, RzDBGrid, ExtCtrls, StdCtrls, RzButton, RzRadChk,
  RzBckgnd, Mask, RzEdit, cxControls, cxContainer, cxEdit, cxTextEdit,
  cxMaskEdit, cxDropDownEdit,UntExcSQL;

type
  TFrmSearchBase = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Select2: TRzRadioButton;
    Select1: TRzRadioButton;
    RzSeparator1: TRzSeparator;
    PartyName: TRzEdit;
    Category: TcxComboBox;
    Duty: TcxComboBox;
    PartyMain: TcxComboBox;
    Level: TcxComboBox;
    Nature: TcxComboBox;
    Depart: TcxComboBox;
    PartyBranch: TcxComboBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    BtnSelect: TRzBitBtn;
    BtnPrint: TRzBitBtn;
    RzSeparator2: TRzSeparator;
    RzDBGrid1: TRzDBGrid;
    Select3: TRzRadioButton;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormShow(Sender: TObject);
    procedure NatureKeyPress(Sender: TObject; var Key: Char);
    procedure BtnSelectClick(Sender: TObject);
    procedure BtnPrintClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmSearchBase: TFrmSearchBase;
  ExcSelect:TExcSQL;
implementation

uses UntAppMDIConsts, UntPrint;



{$R *.dfm}

procedure TFrmSearchBase.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
Action:=CaFree;
end;

procedure TFrmSearchBase.FormCreate(Sender: TObject);
begin
  ExcSelect:=TExcSQL.Create;
end;

procedure TFrmSearchBase.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
  ExcSelect.Free;
end;

procedure TFrmSearchBase.FormShow(Sender: TObject);
begin
  RzDBGrid1.DataSource:=ExcSelect.DataSource;
  ShowName(Duty,'Duty');
  ShowName(Depart,'Depart');
  ShowName(PartyMain,'PartyMain');
  ShowName(PartyBranch,'PartyBranch');
end;

procedure TFrmSearchBase.NatureKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;

procedure TFrmSearchBase.BtnSelectClick(Sender: TObject);
begin
try
  ExcSelect.SQL:='Select PartyBaseInfo.* ,PartyBranch.Name as 党支部,PartyMain.Name as 党总支,Depart.Name as 部门,Duty.Name as 职称,PartyReMent.ReWard as 奖励,PartyReMent.PunishMent as 处罚 ';
  ExcSelect.SQL:=ExcSelect.SQL+' from PartyBaseInfo,PartyBranch,PartyMainBranch,PartyMain,Depart,Duty,PartyReMent';
  ExcSelect.SQL:=ExcSelect.SQL+' where PartyBaseInfo.PartyID=PartyMainBranch.PartyID and PartyMainBranch.BranchID=PartyBranch.ID and PartyMainBranch.MainID=PartyMain.ID ' ;
  ExcSelect.SQL:=ExcSelect.SQL+' and PartyMainBranch.DepartId=Depart.ID and PartyMainBranch.DutyID=Duty.ID and PartybaseInfo.PartyId=PartyReMent.PartyID';

  if Select2.Checked then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Sex="'+'男'+'"';
  If Select3.Checked then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Sex="'+'女'+'"';
  If Not TestStr(PartyName.Text) then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyName like "'+'%'+Trim(PartyName.Text)+'%'+'"';
  If Level.Properties.Items.IndexOf(Level.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Level="'+Level.Text+'"';
  If Duty.Properties.Items.IndexOf(Duty.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyMainBranch.DutyID="'+ShowTableID(Duty.Text,'Duty')+'"';
  If PartyMain.Properties.Items.IndexOf(PartyMain.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyMainBranch.MainID="'+ShowTableID(PartyMain.Text,'PartyMain')+'"';
  If PartyBranch.Properties.Items.IndexOf(PartyBranch.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyMainBranch.BranchID="'+ShowTableID(PartyBranch.Text,'PartyBranch')+'"';
  if ShowComboxID(Depart,Depart.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyMainBranch.DepartID="'+ShowTableID(Depart.Text,'Depart')+'"';
  If Category.Properties.Items.IndexOf(Category.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Category="'+Category.Text+'"';
  If Nature.Properties.Items.IndexOf(Nature.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Nature="'+Nature.Text+'"';
 { if ShowComboxID(Category,Category.Text)>=0 then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Category="'+Category.Text+'"';
  if ShowComboxID(Nature,Nature.Text)>=0     then
     ExcSelect.SQL:=ExcSelect.SQL +' and PartyBaseInfo.Nature="'+Nature.Text+'"';  }
  ExcSelect.ExcSQL(ExcSelect.SQL,'Search');

except
end;
end;

procedure TFrmSearchBase.BtnPrintClick(Sender: TObject);
begin
 if Not ExcSelect.ADOQuery.Active then
    begin
      MessageBox(Handle,'您暂时不能执行打印操作!原因是您还没有执行查询操作!','系统提示',MB_OK+MB_ICONINFORMATION);
      exit;
    end;
 if ExcSelect.ADOQuery.RecordCount <1 then
    begin
      MessageBox(Handle,'您暂时不能执行打印操作!原因是没有数据!','系统提示',MB_OK+MB_ICONINFORMATION);
      exit;
    end;
 Try
   Application.CreateForm(TFrmPrint,FrmPrint);
   FrmPrint.RMDBDataSet1.DataSet:=ExcSelect.ADOQuery;
   FrmPrint.RMReport1.LoadFromFile('PartyInfoPrint.rmf');
   FrmPrint.RMReport1.ShowReport;   
   FreeAndNil(FrmPrint);
 except
   MessageBox(Handle,'执行打印操作失败!可能原因是没有数据!','系统提示',MB_OK+MB_ICONINFORMATION);
 end;

end;

end.

⌨️ 快捷键说明

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