📄 medicine_form5.pas
字号:
unit medicine_form5;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Spin;
type
Trep_form = class(TForm)
RB_medicine: TRadioButton;
RB_sale: TRadioButton;
GroupBox1: TGroupBox;
RB_year: TRadioButton;
RB_day: TRadioButton;
RB_month: TRadioButton;
Button1: TButton;
Button2: TButton;
Button3: TButton;
lblTimeType: TLabel;
cmbMonth: TComboBox;
seYear: TSpinEdit;
dtpSumDate: TDateTimePicker;
procedure RB_medicineClick(Sender: TObject);
procedure RB_saleClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure RB_dayClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
rep_form: Trep_form;
implementation
uses RP_medicine, rp_YearSaleSum, rp_DateSaleSum, rp_MonthSaleSum;
{$R *.DFM}
procedure Trep_form.RB_medicineClick(Sender: TObject);
begin
GroupBox1.Enabled := false;
end;
procedure Trep_form.RB_saleClick(Sender: TObject);
begin
GroupBox1.Enabled := true;
end;
procedure Trep_form.FormCreate(Sender: TObject);
begin
GroupBox1.Enabled := false;
dtpSumDate.DateTime := date();
seYear.Value := StrToInt(FormatDateTime('YYYY',date()));
cmbMonth.ItemIndex := StrToInt(FormatDateTime('MM',date()))-1;
RB_dayClick(nil);
end;
procedure Trep_form.Button2Click(Sender: TObject);
begin
self.Close;
end;
procedure Trep_form.Button1Click(Sender: TObject);
var
lstrTime: string;
begin
self.Visible := false;
if RB_medicine.Checked then
begin
QR_medicine.Query1.Close;
QR_medicine.Query1.Open;
QR_medicine.Preview;
end
else
begin
if rb_Day.Checked then
begin
lstrTime := FormatDateTime('YYYY-MM-DD',dtpSumDate.Date);
qrDateSaleSum.qrlblDateTitle.Caption := lstrTime;
qrDateSaleSum.Query1.close;
qrDateSaleSum.Query1.ParamByName('strQueryDate').AsString := lstrTime;
qrDateSaleSum.Query1.open;
qrDateSaleSum.Preview;
end;
if rb_Month.Checked then
begin
lstrTime := IntToStr(seYear.Value) + '-' + cmbMonth.Text ;
qrMonthSaleSum.qrlblMonthTitle.Caption := lstrTime;
qrMonthSaleSum.Query1.close;
qrMonthSaleSum.Query1.ParamByName('strQueryMonth').AsString := lstrTime;
qrMonthSaleSum.Query1.open;
qrMonthSaleSum.Preview;
end;
if rb_Year.Checked then
begin
lstrTime := IntToStr(seYear.Value);
qrYearSaleSum.qrlblYearTitle.Caption := FormatDateTime('YYYY-MM-DD',date());
qrYearSaleSum.Query1.close;
qrYearSaleSum.Query1.ParamByName('strQueryYear').AsString := lstrTime;
qrYearSaleSum.Query1.open;
qrYearSaleSum.Preview;
end;
end;
self.Visible := true;
end;
procedure Trep_form.RB_dayClick(Sender: TObject);
begin
if rb_Day.Checked then
begin
lblTimeType.Caption := '请选择日期:';
seYear.Visible := false;
cmbMonth.Visible :=false;
dtpSumDate.Visible := true;
end;
if rb_Month.Checked then
begin
lblTimeType.Caption := '请选择年月:';
seYear.Visible := true;
cmbMonth.Visible := true;
dtpSumDate.Visible := false;
end;
if rb_Year.Checked then
begin
lblTimeType.Caption := '请选择年度:';
seYear.Visible := true;
cmbMonth.Visible := false;
dtpSumDate.Visible := false;
end;
end;
procedure Trep_form.Button3Click(Sender: TObject);
var
lstrTime: string;
begin
self.Enabled := false;
if RB_medicine.Checked then
begin
QR_medicine.Query1.Close;
QR_medicine.Query1.Open;
QR_medicine.print;
end
else
begin
if rb_Day.Checked then
begin
lstrTime := FormatDateTime('YYYY-MM-DD',dtpSumDate.Date);
qrDateSaleSum.qrlblDateTitle.Caption := lstrTime;
qrDateSaleSum.Query1.close;
qrDateSaleSum.Query1.ParamByName('strQueryDate').AsString := lstrTime;
qrDateSaleSum.Query1.open;
qrDateSaleSum.print;
end;
if rb_Month.Checked then
begin
lstrTime := IntToStr(seYear.Value) + '-' + cmbMonth.Text ;
qrMonthSaleSum.qrlblMonthTitle.Caption := lstrTime;
qrMonthSaleSum.Query1.close;
qrMonthSaleSum.Query1.ParamByName('strQueryMonth').AsString := lstrTime;
qrMonthSaleSum.Query1.open;
qrMonthSaleSum.print;
end;
if rb_Year.Checked then
begin
lstrTime := IntToStr(seYear.Value);
qrYearSaleSum.qrlblYearTitle.Caption := FormatDateTime('YYYY-MM-DD',date());
qrYearSaleSum.Query1.close;
qrYearSaleSum.Query1.ParamByName('strQueryYear').AsString := lstrTime;
qrYearSaleSum.Query1.open;
qrYearSaleSum.print;
end;
end;
self.Enabled := true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -