📄 baofeicx.~pas
字号:
unit BaofeiCX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Grids, DBGrids;
type
TCarBaofeiCX = class(TForm)
Label1: TLabel;
DBGrid1: TDBGrid;
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
ComboBox1: TComboBox;
DateTimePicker1: TDateTimePicker;
ComboBox4: TComboBox;
CheckBox2: TCheckBox;
GroupBox2: TGroupBox;
Memo1: TMemo;
procedure FormShow(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure CheckBox1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CarBaofeiCX: TCarBaofeiCX;
implementation
uses Unit2;
{$R *.dfm}
procedure TCarBaofeiCX.FormShow(Sender: TObject);
begin
combobox1.Items.Clear;
with datamodule2.CarclassQ do
begin
close;
sql.Clear;
sql.Add('select * from carbaofei.dbf');
open;
while not eof do
begin
combobox1.Items.Add(fieldbyname('carnum').AsString);
next;
end;
first;
memo1.Text:=fieldbyname('memo').AsString
end;
combobox1.ItemIndex:=0;
end;
procedure TCarBaofeiCX.DBGrid1CellClick(Column: TColumn);
begin
memo1.Text:=datamodule2.CarclassQ.fieldbyname('memo').AsString;
end;
procedure TCarBaofeiCX.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked then
begin
datetimepicker1.Enabled:=false;
combobox4.Enabled:=false;
combobox1.Enabled:=true;
if checkbox2.Checked then
begin
datetimepicker1.Enabled:=true;
combobox4.Enabled:=true;
with datamodule2.CarclassQ do
begin
close;
sql.Clear;
if combobox4.Text='之前' then
sql.Add('select * from carbaofei.dbf where baofeidt < :bdate and carnum like :can');
if combobox4.Text='当天' then
sql.Add('select * from carbaofei.dbf where baofeidt = :bdate and carnum like :can');
if combobox4.Text='之后' then
sql.Add('select * from carbaofei.dbf where baofeidt > :bdate and carnum like :can');
parambyname('bdate').AsDate:=datetimepicker1.Date;
parambyname('can').AsString:=combobox1.Text+'%';
open;
end;
end
else
begin
with datamodule2.CarclassQ do
begin
close;
sql.Clear;
sql.Add('select * from carbaofei.dbf where carnum like :can');
parambyname('can').AsString:=combobox1.Text+'%';
open;
end;
end;
end
else
if checkbox2.Checked then
begin
datetimepicker1.Enabled:=true;
combobox4.Enabled:=true;
combobox1.Enabled:=false;
with datamodule2.CarclassQ do
begin
close;
sql.Clear;
if combobox4.Text='之前' then
sql.Add('select * from carbaofei.dbf where baofeidt < :bdate');
if combobox4.Text='当天' then
sql.Add('select * from carbaofei.dbf where baofeidt = :bdate');
if combobox4.Text='之后' then
sql.Add('select * from carbaofei.dbf where baofeidt > :bdate');
parambyname('bdate').AsDate:=datetimepicker1.Date;
open;
end;
end
else
begin
datetimepicker1.Enabled:=false;
combobox4.Enabled:=false;
combobox1.Enabled:=false;
carbaofeicx.FormShow(sender);
end;
memo1.Text:=datamodule2.CarclassQ.fieldbyname('memo').AsString;
end;
procedure TCarBaofeiCX.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
checkbox1.Checked:=false;
checkbox2.Checked:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -