?? unit_querybirthday.pas
字號(hào):
unit unit_QueryBirthday;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Unit_custbrowsebase_P, ImgList, Menus, Db, DBTables, Grids, DBGrids,
ComCtrls, TFlatCheckBoxUnit, TFlatSpinEditUnit, ToolWin, StdCtrls,
TFlatEditUnit, TFlatComboBoxUnit, TFlatButtonUnit, ExtCtrls,
TFlatRadioButtonUnit;
type
Tfrm_QueryBirthday = class(TForm_custbrowsebase_P)
Label8: TLabel;
Label9: TLabel;
dtpGR_BirthdayBegin: TDateTimePicker;
dtpGR_BirthdayEnd: TDateTimePicker;
cbGR_Birthday: TFlatCheckBox;
procedure cbGR_BirthdayClick(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
private
{ Private declarations }
protected
procedure pro_initother(sender:tobject);override;
procedure pro_GR_OpenDataSet(sender:tobject;strsql:string);override;
procedure pro_GR_getsqlwhere(sender:tobject);override;
procedure pro_GR_checkcondition(sender:tobject);override;
public
{ Public declarations }
end;
var
frm_QueryBirthday: Tfrm_QueryBirthday;
implementation
uses dmmain,PrintFrmForm;
Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
{$R *.DFM}
procedure Tfrm_QueryBirthday.pro_GR_checkcondition(sender: tobject);
begin
inherited;
if cbGR_Birthday.Checked then
begin
if trunc(dtpGR_BirthdayEnd.DateTime)<trunc(dtpGR_BirthdayBegin.DateTime) then
begin
// fun_messagebox('生日時(shí)間段開始日期不能大于結(jié)束日期');
GR_condition:=false;
end;
end;
end;
procedure Tfrm_QueryBirthday.pro_GR_getsqlwhere(sender: tobject);
var
tmpstr:string;
begin
inherited;
if cbGR_Birthday.Checked then
begin
tmpstr:=tmpstr+' and t.SR_C>='''+formatdatetime('mmdd',dtpGR_BirthdayBegin.Date)+''' and t.SR_C<='''+formatdatetime('mmdd',dtpGR_BirthdayEnd.Date)+'''';
end;
tmpstr:=tmpstr+' and t.SR_c is not null ';
GR_sqlwhere:=GR_sqlwhere+tmpstr;
end;
procedure Tfrm_QueryBirthday.pro_GR_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_GR_QueryBirthday');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure Tfrm_QueryBirthday.pro_initother(sender: tobject);
begin
inherited;
dtpGR_BirthdayBegin.Date:=now;
dtpGR_BirthdayEnd.Date:=now;
end;
procedure Tfrm_QueryBirthday.cbGR_BirthdayClick(Sender: TObject);
begin
inherited;
if cbGR_Birthday.Checked then
begin
dtpGR_BirthdayBegin.Color:=clwindow;
dtpGR_BirthdayEnd.Color:=clwindow;
dtpGR_BirthdayBegin.Enabled:=true;
dtpGR_BirthdayEnd.Enabled:=true;
end
else
begin
dtpGR_BirthdayBegin.Color:=clActiveBorder;
dtpGR_BirthdayEnd.Color:=clActiveBorder;
dtpGR_BirthdayBegin.Enabled:=false;
dtpGR_BirthdayEnd.Enabled:=false;
end;
end;
procedure Tfrm_QueryBirthday.FlatButton3Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
Fun_ExportData('大客戶生日','大客戶生日',dbgGR);
end;
procedure Tfrm_QueryBirthday.FlatButton2Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
begin
try
PrintDbGrid(dbgGR.datasource.dataset,dbgGR,'大客戶生日個(gè)人客戶');
except
Application.MessageBox('系統(tǒng)在執(zhí)行過程中發(fā)生錯(cuò)誤!','提示',MB_ICONINFORMATION);
exit;
end;//try
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -