📄 provicesearchoption.pas
字号:
{-----------------------------------------------------------------------------
文件: ProviceSearchOption
功能: 监管查询选项
接口:
关联: uUserFunc, uDMFunc, uConstUtils
备注:
编码: 乔永齐
日期: 2003.07.17
-----------------------------------------------------------------------------}
unit ProviceSearchOption;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;//, DateUtils;
type
TFrmSearchOption = class(TForm)
cmbCity: TComboBox;
rdgType: TRadioGroup;
cmbType: TComboBox;
rdgLevel: TRadioGroup;
rdgSort: TRadioGroup;
btnOk: TBitBtn;
btnCancel: TBitBtn;
Label1: TLabel;
Label2: TLabel;
cmbYearMonth: TComboBox;
procedure FormCreate(Sender: TObject);
procedure AddYearMonth;
procedure AddCityInfo;
procedure btnOkClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure rdgTypeClick(Sender: TObject);
private
{ Private declarations }
fOk: Boolean;
public
{ Public declarations }
function GetOption(var sCityNum, sYearMonth: String;
var nPromptLevel, nType, nSort: smallint): Boolean;
procedure SetOption(const sCityNum, sYearMonth: String;
const nPromptLevel, nType, nSort: smallint);
end;
var
FrmSearchOption: TFrmSearchOption;
implementation
{$R *.dfm}
uses uUserFunc, uDMFunc, uConstUtils;
procedure TFrmSearchOption.AddCityInfo;
var
aCity: TString2Array;
i: smallint;
begin
DsInfo(aCity);
for i:=0 to high(aCity) do
begin
// if copy(pubLoginSsds,i+1,1) = '1' then //只将本操作员所管地市列出
cmbCity.Items.Add(aCity[i,0]+' .. '+aCity[i,1]);
end;
end;
procedure TFrmSearchOption.AddYearMonth;
var
dtDate, dtDateE: TDate;
sStr: string;
i: smallint;
begin
dtDate := strtodate('1990-01-01');
dtDateE := strtodate('2010-01-01');
while dtDate < dtDateE do
begin
sStr := DToS(dtDate,6);
cmbYearMonth.Items.Add(sStr);
dtDate := IncMonth(dtDate);
end;
sStr := DToS(Date,6);
for i:=0 to cmbYearMonth.Items.Count do
begin
if cmbYearMonth.Items.Strings[i] = sStr then
begin
cmbYearMonth.ItemIndex := i;
break;
end;
end;
end;
procedure TFrmSearchOption.FormCreate(Sender: TObject);
begin
AddYearMonth;
AddCityInfo;
end;
function TFrmSearchOption.GetOption(var sCityNum, sYearMonth: String;
var nPromptLevel, nType, nSort: smallint): Boolean;
var
nPos: smallint;
begin
nPos := pos('..',cmbCity.Text)-1;
sCityNum := trim(copy(cmbCity.Text, 1, nPos));
sYearMonth := trim(cmbYearMonth.Text);
nPromptLevel := rdgLevel.ItemIndex-1;
if rdgType.ItemIndex = 0 then
nType := -1
else
nType := cmbType.ItemIndex;
nSort := rdgSort.ItemIndex;
Result := fOk;
end;
procedure TFrmSearchOption.SetOption(const sCityNum, sYearMonth: String;
const nPromptLevel, nType, nSort: smallint);
var
i, nPos: smallint;
sStr: string;
begin
cmbCity.ItemIndex := 0;
for i:=0 to cmbCity.Items.Count-1 do
begin
nPos := pos('..', cmbCity.Items.Strings[i])-1;
sStr := trim(copy(cmbCity.Items.Strings[i],1,nPos));
if sCityNum = sStr then
begin
cmbCity.ItemIndex := i;
break;
end;
end;
for i:=0 to cmbYearMonth.Items.Count do
begin
if cmbYearMonth.Items.Strings[i] = sYearMonth then
begin
cmbYearMonth.ItemIndex := i;
break;
end;
end;
rdgLevel.ItemIndex := nPromptLevel+1;
if nType = -1 then
rdgType.ItemIndex := 0
else
begin
rdgType.ItemIndex := 1;
cmbType.ItemIndex := nType;
end;
rdgSort.ItemIndex := nSort;
end;
procedure TFrmSearchOption.btnOkClick(Sender: TObject);
begin
fOk := true;
close;
end;
procedure TFrmSearchOption.btnCancelClick(Sender: TObject);
begin
fOk := False;
close;
end;
procedure TFrmSearchOption.rdgTypeClick(Sender: TObject);
begin
if rdgType.ItemIndex =0 then
cmbType.Enabled := False
else
cmbType.Enabled := True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -