📄 hygl_report_hymc.pas
字号:
unit HYGL_report_HYmc;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls, StdCtrls, Buttons, jpeg, Mask;
type
TFrmHYGL_Report_HYmc = class(TForm)
QuickRep1: TQuickRep;
PageHeaderBand1: TQRBand;
Lab_BT: TQRLabel;
DetailBand1: TQRBand;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDBText1: TQRDBText;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRShape18: TQRShape;
QRShape19: TQRShape;
QRShape20: TQRShape;
QRShape21: TQRShape;
QRShape22: TQRShape;
QRShape24: TQRShape;
ChildBand1: TQRChildBand;
QRShape1: TQRShape;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
PageFooterBand1: TQRBand;
QRShape25: TQRShape;
Panel1: TPanel;
Label16: TLabel;
Image1: TImage;
Label1: TLabel;
Panel2: TPanel;
btn_preview: TSpeedButton;
btn_print: TSpeedButton;
Btn_exit: TSpeedButton;
GroupBox1: TGroupBox;
opt_dw: TRadioButton;
opt_rhsj: TRadioButton;
Edt_dw: TEdit;
opt_all: TRadioButton;
Edt_rhsj: TMaskEdit;
QRLabel9: TQRLabel;
QRLabel12: TQRLabel;
QRShape26: TQRShape;
QRShape27: TQRShape;
QRDBText11: TQRDBText;
QRDBText12: TQRDBText;
Edt_BT: TEdit;
Label2: TLabel;
QRShape23: TQRShape;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
procedure FormShow(Sender: TObject);
procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btn_previewClick(Sender: TObject);
procedure btn_printClick(Sender: TObject);
procedure Btn_exitClick(Sender: TObject);
procedure QRDBText11Print(sender: TObject; var Value: String);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure getdata;
public
{ Public declarations }
end;
var
FrmHYGL_Report_HYmc: TFrmHYGL_Report_HYmc;
implementation
uses HYGL_DModule, HYGL_main;
{$R *.dfm}
procedure TFrmHYGL_Report_HYmc.FormShow(Sender: TObject);
begin
Image1.Picture:=FRMHYGL_Main.IMG_LOGO.Picture;
with dmd do begin
if not Tbl_HY.active then Tbl_HY.open;
end;
end;
procedure TFrmHYGL_Report_HYmc.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
lab_bt.Caption:=edt_bt.Text;
end;
procedure TFrmHYGL_Report_HYmc.FormClose(Sender: TObject;
var Action: TCloseAction);
var
s1:string;
begin
//删除打印时添加的空记录
S1:='delete from 工会会员 where trim(hyzh)="zzzz"';
with dmd.qry_temp do begin
close;
SQL.CLEAR;
sql.add(s1);
try
open;
except
execsql;
end;
end; {with}
//强制更新
dmd.tbl_HY.close;
dmd.tbl_HY.open;
end;
procedure TFrmHYGL_Report_HYmc.btn_previewClick(Sender: TObject);
var
i,n:integer;
begin
getdata;
with dmd.qry_temp do begin
last;
n:=recordcount;
if (n mod 16)<>0 then //用空记录补足整页记录
for i:=1 to (16-(n mod 16)) do begin
append;
FieldValues['hyzh'] :='zzzz';
post;
end;
//close;
//open;
end;
QuickRep1.Preview;
end;
procedure TFrmHYGL_Report_HYmc.btn_printClick(Sender: TObject);
var
i,n:integer;
begin
getdata;
with dmd.qry_temp do begin
last;
n:=recordcount;
if (n mod 16)<>0 then //用空记录补足整页记录
for i:=1 to (16-(n mod 16)) do begin
append;
FieldValues['hyzh'] :='zzzz';
post;
end;
//close;
//open;
end;
QuickRep1.Print;
end;
procedure TFrmHYGL_Report_HYmc.Btn_exitClick(Sender: TObject);
begin
close;
end;
//按条件获取打印数据
procedure TFrmHYGL_Report_HYmc.getdata;
var
s:string;
begin
s:='';
if (opt_all.Checked) then begin
S:='select * from 工会会员 ';
end;
if (opt_dw.Checked)and(edt_dw.Text<>'') then begin
S:='select * from 工会会员 where dw="'+edt_dw.Text+'" ';
end;
if (opt_rhsj.Checked)and(edt_rhsj.Text<>'') then begin
S:='select * from 工会会员 where rhsj like "'+edt_rhsj.Text+'%" ';
end;
if s='' then exit;
with dmd.qry_temp do begin
close;
SQL.CLEAR;
sql.add(s);
try
open;
except
execsql;
end;
end; {with}
end;
procedure TFrmHYGL_Report_HYmc.QRDBText11Print(sender: TObject;
var Value: String);
begin
if value='zzzz' then value:='';
end;
procedure TFrmHYGL_Report_HYmc.FormCreate(Sender: TObject);
begin
height:=280;
width:=480;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -