?? unit_querycusthistory.pas
字號:
unit unit_QueryCustHistory;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Unit_custombrowsebase, ImgList, Menus, Db, DBTables, Grids, DBGrids,
ComCtrls, TFlatCheckBoxUnit, TFlatSpinEditUnit, ToolWin, StdCtrls,
TFlatEditUnit, TFlatComboBoxUnit, TFlatButtonUnit, ExtCtrls,
TFlatRadioButtonUnit;
type
Tfrm_QueryCustHistory = class(Tform_custombrowsebase)
Label17: TLabel;
Label18: TLabel;
dtpJT_ChangeDateBegin: TDateTimePicker;
dtpJT_ChangeDateEnd: TDateTimePicker;
cbJT_ChangeDate: TFlatCheckBox;
Label10: TLabel;
edGR_ManagerNo: TFlatEdit;
Label8: TLabel;
Label9: TLabel;
dtpGR_ChangeDateBegin: TDateTimePicker;
dtpGR_ChangeDateEnd: TDateTimePicker;
cbGR_ChangeDate: TFlatCheckBox;
Label13: TLabel;
edGR_ChangeMen: TFlatEdit;
Label14: TLabel;
edJT_ChangeMen: TFlatEdit;
procedure cbJT_ChangeDateClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cbGR_ChangeDateClick(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
private
protected
procedure pro_initother(sender:tobject);override;
procedure pro_GR_OpenDataSet(sender:tobject;strsql:string);override;
procedure pro_JT_OpenDataSet(sender:tobject;strsql:string);override;
procedure pro_GR_getsqlwhere(sender:tobject);override;
procedure pro_JT_getsqlwhere(sender:tobject);override;
procedure pro_GR_checkcondition(sender:tobject);override;
procedure pro_JT_checkcondition(sender:tobject);override;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_QueryCustHistory: Tfrm_QueryCustHistory;
implementation
uses dmmain,PrintFrmForm;
Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
{$R *.DFM}
procedure Tfrm_QueryCustHistory.cbJT_ChangeDateClick(Sender: TObject);
begin
inherited;
if cbJT_ChangeDate.Checked then
begin
dtpJT_ChangeDateBegin.Color:=clwindow;
dtpJT_ChangeDateEnd.Color:=clwindow;
dtpJT_ChangeDateBegin.Enabled:=true;
dtpJT_ChangeDateEnd.Enabled:=true;
end
else
begin
dtpJT_ChangeDateBegin.Color:=clActiveBorder;
dtpJT_ChangeDateEnd.Color:=clActiveBorder;
dtpJT_ChangeDateBegin.Enabled:=false;
dtpJT_ChangeDateEnd.Enabled:=false;
end;
end;
procedure Tfrm_QueryCustHistory.FormShow(Sender: TObject);
begin
inherited;
PanelGR_base.Visible:=false;
PanelGR_Stuff.Visible:=true;
PanelGR_base1.Visible:=true;
PanelGR_Stuff.top:=0;
PanelGR_base1.top:=PanelGR_Stuff.top+PanelGR_Stuff.Height;
end;
procedure Tfrm_QueryCustHistory.pro_GR_checkcondition(sender: tobject);
begin
inherited;
if cbGR_ChangeDate.Checked then
begin
if trunc(dtpGR_ChangeDateEnd.DateTime)<trunc(dtpGR_ChangeDateBegin.DateTime) then
begin
// fun_messagebox('修改時間開始日期不能大于結(jié)束日期');
GR_condition:=false;
end;
end;
end;
procedure Tfrm_QueryCustHistory.pro_GR_getsqlwhere(sender: tobject);
var
tmpstr:string;
begin
inherited;
//
if edGR_SID.Text<>'' then
tmpstr:=tmpstr+' and '+'t.SID='+''''+edGR_SID.Text+'''';
if lGR_cityno<>'' then
tmpstr:=tmpstr+' and '+'t.cityno='+lGR_cityno;
if lGR_off_no_home<>'' then
tmpstr:=tmpstr+' and '+'t.off_no_home='+lGR_off_no_home;
if lGR_GH<>'' then
tmpstr:=tmpstr+' and '+'t.ManagerNo='+''''+lGR_GH+'''';
//
if edGR_ChangeMen.Text<>'' then
tmpstr:=tmpstr+' and '+'t.Modi_ManagerNo='+''''+edGR_ChangeMen.Text+'''';
if cbGR_ChangeDate.Checked then
tmpstr:=tmpstr+' and '+'t.Modi_Date between '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_ChangeDateBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_ChangeDateEnd.Date)+''',''yyyymmdd'')';
GR_sqlwhere:=GR_sqlwhere+tmpstr;
end;
procedure Tfrm_QueryCustHistory.pro_GR_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_GR_querycustHistory');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure Tfrm_QueryCustHistory.pro_JT_checkcondition(sender: tobject);
begin
inherited;
if cbJT_ChangeDate.Checked then
begin
if trunc(dtpJT_ChangeDateEnd.DateTime)<trunc(dtpJT_ChangeDateBegin.DateTime) then
begin
// fun_messagebox('修改時間開始日期不能大于結(jié)束日期');
JT_condition:=false;
end;
end;
end;
procedure Tfrm_QueryCustHistory.pro_JT_getsqlwhere(sender: tobject);
var
tmpstr:string;
begin
inherited;
//
if (lJT_JTYHDM<>'') then
tmpstr:=tmpstr+' and '+'t.JTYHDM='+lJT_JTYHDM;
if lGR_cityno<>'' then
tmpstr:=tmpstr+' and '+'t.cityno='+lGR_cityno;
if lGR_off_no_home<>'' then
tmpstr:=tmpstr+' and '+'t.off_no_home='+lGR_off_no_home;
if lGR_GH<>'' then
tmpstr:=tmpstr+' and '+'t.ManagerNo='+''''+lGR_GH+'''';
//
if edJT_ChangeMen.Text<>'' then
tmpstr:=tmpstr+' and '+'t.Modi_ManagerNo='+''''+edJT_ChangeMen.Text+'''';
if cbJT_ChangeDate.Checked then
tmpstr:=tmpstr+' and '+'t.Modi_Date between '+'to_date('''+formatdatetime('yyyymmdd',dtpJT_ChangeDateBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpJT_ChangeDateEnd.Date)+''',''yyyymmdd'')';
JT_sqlwhere:=JT_sqlwhere+tmpstr;
end;
procedure Tfrm_QueryCustHistory.pro_JT_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_JT_querycustHistory');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure Tfrm_QueryCustHistory.cbGR_ChangeDateClick(Sender: TObject);
begin
inherited;
if cbGR_ChangeDate.Checked then
begin
dtpGR_ChangeDateBegin.Color:=clwindow;
dtpGR_ChangeDateEnd.Color:=clwindow;
dtpGR_ChangeDateBegin.Enabled:=true;
dtpGR_ChangeDateEnd.Enabled:=true;
end
else
begin
dtpGR_ChangeDateBegin.Color:=clActiveBorder;
dtpGR_ChangeDateEnd.Color:=clActiveBorder;
dtpGR_ChangeDateBegin.Enabled:=false;
dtpGR_ChangeDateEnd.Enabled:=false;
end;
end;
procedure Tfrm_QueryCustHistory.pro_initother(sender: tobject);
begin
inherited;
dtpGR_ChangeDateBegin.Date:=now;
dtpGR_ChangeDateEnd.date:=now;
dtpJT_ChangeDateBegin.Date:=now;
dtpJT_ChangeDateEnd.date:=now;
end;
procedure Tfrm_QueryCustHistory.FlatButton3Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
begin
if PageControl1.ActivePageIndex=0 then
Fun_ExportData('大客戶歷史資料個人客戶','大客戶歷史資料個人客戶',dbgGR)
else
Fun_ExportData('大客戶歷史資料集團(tuán)客戶','大客戶歷史資料集團(tuán)客戶',dbgJT)
end;
end;
procedure Tfrm_QueryCustHistory.FlatButton2Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
begin
if PageControl1.ActivePageIndex=0 then
begin
try
PrintDbGrid(dbgGR.datasource.dataset,dbgGR,'大客戶歷史資料個人客戶');
except
Application.MessageBox('系統(tǒng)在執(zhí)行過程中發(fā)生錯誤!','提示',MB_ICONINFORMATION);
exit;
end;//try
end
else
begin
try
PrintDbGrid(dbgJT.datasource.dataset,dbgJT,'大客戶歷史資料集團(tuán)客戶');
except
Application.MessageBox('系統(tǒng)在執(zhí)行過程中發(fā)生錯誤!','提示',MB_ICONINFORMATION);
exit;
end;//try
end;
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -