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

📄 unit_querybirthday.pas

📁 delphi开发的中国移动大客户管理系统,后台数据库为oracle
💻 PAS
字号:
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('生日时间段开始日期不能大于结束日期');
                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,'大客户生日个人客户');
    except
      Application.MessageBox('系统在执行过程中发生错误!','提示',MB_ICONINFORMATION);
      exit;
    end;//try
  end;
end;

end.

⌨️ 快捷键说明

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