?? unit_querycapture.pas
字號(hào):
unit Unit_QueryCapture;
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_QueryCapture = class(TForm_custbrowsebase_P)
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
dtpGR_OutDateBegin: TDateTimePicker;
dtpGR_OutDateEnd: TDateTimePicker;
cbGR_OutDate: TFlatCheckBox;
coGR_WriteOffType: TFlatComboBox;
Label11: TLabel;
coGR_USER_FKFS: TFlatComboBox;
procedure cbGR_OutDateClick(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
private
{ Private declarations }
protected
lGR_WriteOffType:string;
lGR_USER_FKFS:string;
procedure pro_initother(sender:tobject);override;
procedure pro_initcombobox(sender:tobject);override;
procedure pro_GR_getid(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_QueryCapture: TFRM_QueryCapture;
implementation
uses dmmain,PrintFrmForm;
Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
{$R *.DFM}
procedure TFRM_QueryCapture.cbGR_OutDateClick(Sender: TObject);
begin
inherited;
if cbGR_OutDate.Checked then
begin
dtpGR_OutDateBegin.Color:=clwindow;
dtpGR_OutDateEnd.Color:=clwindow;
dtpGR_OutDateBegin.Enabled:=true;
dtpGR_OutDateEnd.Enabled:=true;
end
else
begin
dtpGR_OutDateBegin.Color:=clActiveBorder;
dtpGR_OutDateEnd.Color:=clActiveBorder;
dtpGR_OutDateBegin.Enabled:=false;
dtpGR_OutDateEnd.Enabled:=false;
end;
end;
procedure TFRM_QueryCapture.pro_GR_checkcondition(sender: tobject);
begin
inherited;
if cbGR_OutDate.Checked then
begin
if trunc(dtpGR_OutDateEnd.DateTime)<trunc(dtpGR_OutDateBegin.DateTime) then
begin
// fun_messagebox('出帳時(shí)間段開始日期不能大于結(jié)束日期');
GR_condition:=false;
end;
end;
end;
procedure TFRM_QueryCapture.pro_GR_getid(sender: tobject);
begin
inherited;
with query_tmp do
begin
// 銷帳狀態(tài)
if coGR_WriteOffType.text<>'所有' then
begin
close;
sql.clear;
sql.add('select WriteOffType from T_V_WriteOffstatus');
sql.add('where trim(PAR_DESC)='+''''+coGR_WriteOffType.text+'''');
open;
if recordcount>0 then
lGR_WriteOffType:=trim(fieldbyname('WriteOffType').asstring);
end
else
lGR_WriteOffType:='';
//付款類型
if coGR_USER_FKFS.text<>'所有' then
begin
close;
sql.clear;
sql.add('select USER_FKFS from T_V_USER_FKFS');
sql.add('where trim(PAR_DESC)='+''''+coGR_USER_FKFS.text+'''');
open;
if recordcount>0 then
lGR_USER_FKFS:=trim(fieldbyname('USER_FKFS').asstring);
end
else
lGR_USER_FKFS:='';
end;
end;
procedure TFRM_QueryCapture.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_USER_ZJBS<>'' then
tmpstr:=tmpstr+' and '+'t.productno='+''''+lGR_USER_ZJBS+'''';
//
if lGR_WriteOffType<>'' then
tmpstr:=tmpstr+' and '+'t.WriteOffType='+''''+lGR_WriteOffType+'''';
if lGR_USER_FKFS<>'' then
tmpstr:=tmpstr+' and '+'t.USER_FKFS='+''''+lGR_USER_FKFS+'''';
if cbGR_OutDate.Checked then
begin
tmpstr:=tmpstr+' and '+'t.OutDate between '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_OutDateBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_OutDateEnd.Date)+''',''yyyymmdd'')';
end;
GR_sqlwhere:=GR_sqlwhere+tmpstr;
end;
procedure TFRM_QueryCapture.pro_GR_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_GR_QueryCapture');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure TFRM_QueryCapture.pro_initcombobox(sender: tobject);
begin
inherited;
with query_tmp do
begin
//銷帳類型
close;
sql.clear;
sql.add('select PAR_Desc from T_V_WRITEOFFSTATUS');
open;
coGR_WriteOffType.Items.Add('所有');
first;
while not eof do
begin
coGR_WriteOffType.Items.Add(fieldbyname('PAR_Desc').asstring);
next;
end;
coGR_WriteOffType.ItemIndex:=0;
//付款類型
close;
sql.clear;
sql.add('select PAR_Desc from T_V_USER_FKFS');
open;
coGR_USER_FKFS.Items.Add('所有');
first;
while not eof do
begin
coGR_USER_FKFS.Items.Add(fieldbyname('PAR_Desc').asstring);
next;
end;
coGR_USER_FKFS.ItemIndex:=0;
end;
end;
procedure TFRM_QueryCapture.pro_initother(sender: tobject);
begin
inherited;
dtpGR_OutDateBegin.Date:=now;
dtpGR_OutDateEnd.date:=now;
end;
procedure TFRM_QueryCapture.FlatButton3Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
Fun_ExportData('大客戶繳費(fèi)銷賬','大客戶繳費(fèi)銷賬',dbgGR);
end;
procedure TFRM_QueryCapture.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,'大客戶繳費(fèi)銷賬個(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 + -