📄 car_ch~2.~pa
字号:
begin
ComboBox5.Visible:=False;
ComboBox5.Clear;
end;
end;
procedure Tfrm_Car_Change_Report.CheckBox6Click(Sender: TObject);
begin
if CheckBox6.Checked=True then
begin
ComboBox6.Visible:=True;
ComboBox6.Clear;
with frm_data.ADOQuery1 do
begin
Close;
Sql.Clear;
Sql.Add('select Distinct Charager from [Car_Change_View]');
Prepared;
Open;
while not eof do
begin
ComboBox6.Items.Add(frm_data.ADOQuery1.FieldByName('Charager').AsString);
Next;
end;
end;
end
else
begin
ComboBox6.Visible:=False;
ComboBox6.Clear;
end;
end;
procedure Tfrm_Car_Change_Report.CheckBox7Click(Sender: TObject);
begin
if CheckBox7.Checked=True then
begin
ComboBox7.Visible:=True;
ComboBox7.Clear;
with frm_data.ADOQuery1 do
begin
Close;
Sql.Clear;
Sql.Add('select Distinct Change_Date from [Car_Change_View]');
Prepared;
Open;
while not eof do
begin
ComboBox7.Items.Add(frm_data.ADOQuery1.FieldByName('Change_Date').AsString);
Next;
end;
end;
end
else
begin
ComboBox7.Visible:=False;
ComboBox7.Clear;
end;
end;
procedure Tfrm_Car_Change_Report.CheckBox8Click(Sender: TObject);
begin
if CheckBox8.Checked=True then
begin
ComboBox8.Visible:=True;
ComboBox8.Clear;
with frm_data.ADOQuery1 do
begin
Close;
Sql.Clear;
Sql.Add('select Distinct Record_Date from [Car_Change_View]');
Prepared;
Open;
while not eof do
begin
ComboBox8.Items.Add(frm_data.ADOQuery1.FieldByName('Record_Date').AsString);
Next;
end;
end;
end
else
begin
ComboBox8.Visible:=False;
ComboBox8.Clear;
end;
end;
procedure Tfrm_Car_Change_Report.CheckBox9Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
if CheckBox9.Checked=True then
begin
Edit1.Visible:=True;
Edit2.Visible:=True;
DateTimePicker1.Visible:=True;
DateTimePicker2.Visible:=True;
Label1.Visible:=True;
end
else
begin
Edit1.Visible:=False;
Edit2.Visible:=False;
DateTimePicker1.Visible:=False;
DateTimePicker2.Visible:=False;
Label1.Visible:=False;
end;
end;
procedure Tfrm_Car_Change_Report.CheckBox10Click(Sender: TObject);
begin
Edit3.Clear;
Edit4.Clear;
if CheckBox9.Checked=True then
begin
Edit3.Visible:=True;
Edit4.Visible:=True;
DateTimePicker3.Visible:=True;
DateTimePicker4.Visible:=True;
Label2.Visible:=True;
end
else
begin
Edit3.Visible:=False;
Edit4.Visible:=False;
DateTimePicker3.Visible:=False;
DateTimePicker4.Visible:=False;
Label2.Visible:=False;
end;
end;
procedure Tfrm_Car_Change_Report.Cmd_PreviewClick(Sender: TObject);
begin
inherited;
tempsql:='Select * from [Car_Change] where ';
if Trim(ComboBox1.Text)<>'' then
begin
tempSql:=tempSql+' B_ID Like '+''''+'%'+ Trim(ComboBox1.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox2.Text)<>'' then
begin
tempSql:=tempSql+' B_Man Like '+''''+'%'+ Trim(ComboBox2.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox3.Text)<>'' then
begin
tempSql:=tempSql+' C_ID Like '+''''+'%'+ Trim(ComboBox3.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox4.Text)<>'' then
begin
tempSql:=tempSql+' Car_Man Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox5.Text)<>'' then
begin
tempSql:=tempSql+' MondName Like '+''''+'%'+ Trim(ComboBox5.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox6.Text)<>'' then
begin
tempSql:=tempSql+' Charager Like '+''''+'%'+ Trim(ComboBox6.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox7.Text)<>'' then
begin
tempSql:=tempSql+' Change_Date = '+''''+ Trim(ComboBox7.Text)+''''+' and ';
end;
if Trim(ComboBox8.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date = '+''''+ Trim(ComboBox8.Text)+''''+' and ';
end;
if CheckBox9.Checked=True then
begin
if Trim(Edit1.Text)<>'' then
begin
tempSql:=tempSql+' Change_Date between '''+Trim(Edit1.Text)+''' and '''+Trim(Edit2.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit1.SetFocus;
Exit;
end;
end;
if CheckBox10.Checked=True then
begin
if Trim(Edit3.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date between '''+Trim(Edit3.Text)+''' and '''+Trim(Edit4.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit3.SetFocus;
Exit;
end;
end;
tempSql:=Copy(tempSql,0,length(tempSql)-4);
with frm_data.Query_Car_Change do
begin
Close;
Sql.Clear;
Sql.Add(tempSql);
Prepared;
Open;
frm_Preview:=Tfrm_Preview.Create(self);
frm_ReportInFormation:=Tfrm_ReportInFormation.Create(self);
frm_ReportInFormation.L_CarChange_HeaderTitle.Caption:=func.Use_mond+frm_ReportInFormation.L_CarChange_HeaderTitle.Caption;
frm_ReportInFormation.lab_CarChange_Ren.Caption:=frm_ReportInFormation.lab_CarChange_Ren.Caption+func.Login_Name;
frm_ReportInFormation.Lab_CarChange_Time.Caption:=frm_ReportInFormation.Lab_CarChange_Time.Caption+formatdatetime('yyyy''-''mm''-''dd',now);
frm_ReportInFormation.QuickRep_Car_Change.Prepare;
frm_Preview.ShowModal(frm_ReportInFormation.QuickRep_Car_Change,'车辆过户信息报表');
end;
end;
procedure Tfrm_Car_Change_Report.Cmd_PrintClick(Sender: TObject);
begin
inherited;
tempsql:='Select * from [Car_Change] where ';
if Trim(ComboBox1.Text)<>'' then
begin
tempSql:=tempSql+' B_ID Like '+''''+'%'+ Trim(ComboBox1.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox2.Text)<>'' then
begin
tempSql:=tempSql+' B_Man Like '+''''+'%'+ Trim(ComboBox2.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox3.Text)<>'' then
begin
tempSql:=tempSql+' C_ID Like '+''''+'%'+ Trim(ComboBox3.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox4.Text)<>'' then
begin
tempSql:=tempSql+' Car_Man Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox5.Text)<>'' then
begin
tempSql:=tempSql+' MondName Like '+''''+'%'+ Trim(ComboBox5.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox6.Text)<>'' then
begin
tempSql:=tempSql+' Charager Like '+''''+'%'+ Trim(ComboBox6.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox7.Text)<>'' then
begin
tempSql:=tempSql+' Change_Date = '+''''+ Trim(ComboBox7.Text)+''''+' and ';
end;
if Trim(ComboBox8.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date = '+''''+ Trim(ComboBox8.Text)+''''+' and ';
end;
if CheckBox9.Checked=True then
begin
if Trim(Edit1.Text)<>'' then
begin
tempSql:=tempSql+' Change_Date between '''+Trim(Edit1.Text)+''' and '''+Trim(Edit2.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit1.SetFocus;
Exit;
end;
end;
if CheckBox10.Checked=True then
begin
if Trim(Edit3.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date between '''+Trim(Edit3.Text)+''' and '''+Trim(Edit4.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit3.SetFocus;
Exit;
end;
end;
tempSql:=Copy(tempSql,0,length(tempSql)-4);
with frm_data.Query_Car_Change do
begin
Close;
Sql.Clear;
Sql.Add(tempSql);
Prepared;
Open;
frm_Preview:=Tfrm_Preview.Create(self);
frm_ReportInFormation:=Tfrm_ReportInFormation.Create(self);
frm_ReportInFormation.L_CarChange_HeaderTitle.Caption:=func.Use_mond+frm_ReportInFormation.L_CarChange_HeaderTitle.Caption;
frm_ReportInFormation.lab_CarChange_Ren.Caption:=frm_ReportInFormation.lab_CarChange_Ren.Caption+func.Login_Name;
frm_ReportInFormation.Lab_CarChange_Time.Caption:=frm_ReportInFormation.Lab_CarChange_Time.Caption+formatdatetime('yyyy''-''mm''-''dd',now);
frm_ReportInFormation.QuickRep_Car_Change.Prepare;
frm_ReportInFormation.QuickRep_Car_Change.Print;
end;
end;
procedure Tfrm_Car_Change_Report.Cmd_CancelClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_Car_Change_Report.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=Cafree;
end;
procedure Tfrm_Car_Change_Report.Cmd_ExitClick(Sender: TObject);
begin
Cmd_Preview.Enabled:=False;
Cmd_Print.Enabled:=False;
end;
procedure Tfrm_Car_Change_Report.DateTimePicker1Change(Sender: TObject);
begin
Edit1.Text:=ForMatDateTime('yyyy''-''mm''-''dd',DateTimePicker1.DateTime);
end;
procedure Tfrm_Car_Change_Report.DateTimePicker2Change(Sender: TObject);
begin
Edit2.Text:=ForMatDateTime('yyyy''-''mm''-''dd',DateTimePicker2.DateTime);
end;
procedure Tfrm_Car_Change_Report.DateTimePicker3Change(Sender: TObject);
begin
Edit3.Text:=ForMatDateTime('yyyy''-''mm''-''dd',DateTimePicker3.DateTime);
end;
procedure Tfrm_Car_Change_Report.DateTimePicker4Change(Sender: TObject);
begin
Edit4.Text:=ForMatDateTime('yyyy''-''mm''-''dd',DateTimePicker4.DateTime);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -