📄 unit_qureyoperation.pas
字号:
unit Unit_QureyOperation;
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,
TFlatCheckListBoxUnit;
const
INVALI='1'; //无效值
VALI='2'; //有效值
FUNCLOSE='0'; // 关
FUNOPEN='1'; //开通
MAXFunCount=40;//最大功能数
type
TFRM_QureyOperation = class(TForm_custbrowsebase_P)
dtpGR_OperationBegin: TDateTimePicker;
dtpGR_OperationEnd: TDateTimePicker;
cbGR_Operation: TFlatCheckBox;
cbGR_Fun: TFlatCheckBox;
clbGR_Fun: TFlatCheckListBox;
btnGR_FunFull: TFlatButton;
BtnGR_FunNone: TFlatButton;
procedure btnGR_FunFullClick(Sender: TObject);
procedure BtnGR_FunNoneClick(Sender: TObject);
procedure cbGR_FunClick(Sender: TObject);
procedure cbGR_OperationClick(Sender: TObject);
private
ifunCount:integer;
arrayfun:string[40];
arrayfundesc:array [1..MAXFunCount] of string;
{ 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;
function fun_getFunField(sender:tobject):string;
function fun_getFunCheck(sender:tobject):string;
public
{ Public declarations }
end;
var
FRM_QureyOperation: TFRM_QureyOperation;
implementation
uses dmmain;
{$R *.DFM}
procedure TFRM_QureyOperation.btnGR_FunFullClick(Sender: TObject);
var
i:integer;
begin
inherited;
with clbGR_Fun do
begin
for i:=0 to items.Count-1 do
begin
checked[i]:=true;
end;
end;
end;
procedure TFRM_QureyOperation.BtnGR_FunNoneClick(Sender: TObject);
var
i:integer;
begin
inherited;
with clbGR_Fun do
begin
for i:=0 to items.Count-1 do
begin
checked[i]:=false;
end;
end;
end;
procedure TFRM_QureyOperation.pro_GR_checkcondition(sender: tobject);
begin
inherited;
if cbGR_Operation.Checked then
begin
if trunc(dtpGR_OperationEnd.DateTime)<trunc(dtpGR_OperationBegin.DateTime) then
begin
fun_messagebox('业务受理时间段开始日期不能大于结束日期');
GR_condition:=false;
end;
end;
end;
procedure TFRM_QureyOperation.pro_GR_getsqlwhere(sender: tobject);
begin
inherited;
end;
procedure TFRM_QureyOperation.pro_GR_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_GR_QueryOperation');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure TFRM_QureyOperation.pro_initother(sender: tobject);
begin
inherited;
dtpGR_OperationBegin.Date:=now;
dtpGR_OperationEnd.Date:=now;
end;
procedure TFRM_QureyOperation.cbGR_FunClick(Sender: TObject);
begin
inherited;
if cbGR_Fun.Checked then
begin
clbGR_Fun.Color:=clwindow;
clbGR_Fun.Enabled:=true;
end
else
begin
clbGR_Fun.Color:=clwindow;
clbGR_Fun.Enabled:=false;
end;
end;
function TFRM_QureyOperation.fun_getFunCheck(sender: tobject): string;
var
i,j:integer;
tmpstr:string;
begin
result:='';
i:=0;
j:=0;
while j<MAXFunCount do
begin
if arrayFun[j]=VALI then
begin
if clbGR_Fun.checked[i] then
tmpstr:=tmpstr+' and fun'+inttostr(i+1)+'='+FUNOPEN
else
tmpstr:=tmpstr+' and fun'+inttostr(i+1)+'='+FUNCLOSE;
inc(i);
end;
inc(j);
end;
end;
function TFRM_QureyOperation.fun_getFunField(sender: tobject): string;
var
i:integer;
tmpstr:string;
begin
result:='';
for i:=0 to iFunCount-1 do
begin
if arrayfun[i]=VALI then
begin
tmpstr:=tmpstr+',Fun'+inttostr(i+1)+' '+arrayfunDesc[i];
end;
end;
result:=tmpstr;
end;
procedure TFRM_QureyOperation.cbGR_OperationClick(Sender: TObject);
begin
inherited;
if cbGR_Operation.Checked then
begin
dtpGR_OperationBegin.Color:=clwindow;
dtpGR_OperationEnd.Color:=clwindow;
dtpGR_OperationBegin.Enabled:=true;
dtpGR_OperationEnd.Enabled:=true;
end
else
begin
dtpGR_OperationBegin.Color:=clActiveBorder;
dtpGR_OperationEnd.Color:=clActiveBorder;
dtpGR_OperationBegin.Enabled:=false;
dtpGR_OperationEnd.Enabled:=false;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -