📄 untotherselect.pas
字号:
unit UntOtherSelect;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,UntExcSQL, RzRadChk, RzBckgnd, RzButton, Grids, DBGrids, RzDBGrid;
type
TFrmOtherSelect = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
BtnSelect: TRzBitBtn;
BtnPrint: TRzBitBtn;
RzSeparator1: TRzSeparator;
Select1: TRzCheckBox;
Select2: TRzCheckBox;
Select3: TRzCheckBox;
RzDBGrid1: TRzDBGrid;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure BtnSelectClick(Sender: TObject);
procedure BtnPrintClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmOtherSelect: TFrmOtherSelect;
ExcSelect:TExcSQL;
implementation
uses UntPrint;
{$R *.dfm}
procedure TFrmOtherSelect.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=CaFree;
end;
procedure TFrmOtherSelect.FormCreate(Sender: TObject);
begin
ExcSelect:=TExcSQL.Create;
RzDBGrid1.DataSource:=ExcSelect.DataSource;
end;
procedure TFrmOtherSelect.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
ExcSelect.Free;
end;
procedure TFrmOtherSelect.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 Select1.Checked then
ExcSelect.SQL:=ExcSelect.SQL +' and (Not PartyReMent.ReWard="'+''+'")';
IF Select2.Checked then
ExcSelect.SQL:=ExcSelect.SQL +' and (Not PartyReMent.PunishMent="'+''+'")';
IF Select3.Checked then
ExcSelect.SQL:=ExcSelect.SQL +' and (Not PartyReMent.PunishMent="'+''+'") and (Not PartyReMent.ReWard="'+''+'")';
ExcSelect.ExcSQL(ExcSelect.SQL,'Search');
except
end;
end;
procedure TFrmOtherSelect.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
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -