📄 drive_card_check_rteport.pas
字号:
end;
procedure Tfrm_Drive_Card_Check_Rteport.CheckBox10Click(Sender: TObject);
begin
Edit3.Clear;
Edit4.Clear;
if CheckBox10.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_Drive_Card_Check_Rteport.CheckBox11Click(Sender: TObject);
begin
Edit5.Clear;
Edit6.Clear;
if CheckBox11.Checked=True then
begin
Edit5.Visible:=True;
Edit6.Visible:=True;
DateTimePicker5.Visible:=True;
DateTimePicker6.Visible:=True;
Label3.Visible:=True;
end
else
begin
Edit5.Visible:=False;
Edit6.Visible:=False;
DateTimePicker5.Visible:=False;
DateTimePicker6.Visible:=False;
Label3.Visible:=False;
end;
end;
procedure Tfrm_Drive_Card_Check_Rteport.Cmd_SearchClick(Sender: TObject);
begin
inherited;
tempsql:='Select * from [Drive_Card_Check_View] where ';
if Trim(ComboBox1.Text)<>'' then
begin
tempSql:=tempSql+' Drive_ID Like '+''''+'%'+ Trim(ComboBox1.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox2.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Man Like '+''''+'%'+ Trim(ComboBox2.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox3.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Card_Type Like '+''''+'%'+ Trim(ComboBox3.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox4.Text)<>'' then
begin
tempSql:=tempSql+' Check_Mond Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox5.Text)<>'' then
begin
tempSql:=tempSql+' Check_Result Like '+''''+'%'+ Trim(ComboBox5.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox6.Text)<>'' then
begin
tempSql:=tempSql+' Check_Date = '+''''+ Trim(ComboBox6.Text)+''''+' and ';
end;
if Trim(ComboBox7.Text)<>'' then
begin
tempSql:=tempSql+' Value_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+' Check_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+' Value_Date between '''+Trim(Edit3.Text)+''' and '''+Trim(Edit4.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit3.SetFocus;
Exit;
end;
end;
if CheckBox11.Checked=True then
begin
if Trim(Edit5.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date between '''+Trim(Edit5.Text)+''' and '''+Trim(Edit6.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit5.SetFocus;
Exit;
end;
end;
tempSql:=Copy(tempSql,0,length(tempSql)-4);
with frm_data.Query_Drive_Card_Check_View do
begin
Close;
Sql.Clear;
Sql.Add(tempSql);
Prepared;
Open;
if frm_data.Query_Drive_Card_Check_View.RecordCount<>0 then
begin
Cmd_Preview.Enabled:=True;
Cmd_Print.Enabled:=True;
Showmessage('符合条件的记录有:'+IntToStr(frm_data.Query_Drive_Card_Check_View.RecordCount)+'条');
end
else
begin
Cmd_Preview.Enabled:=False;
Cmd_Print.Enabled:=False;
Showmessage('符合条件的记录有:'+IntToStr(frm_data.Query_Drive_Card_Check_View.RecordCount)+'条');
end;
end;
end;
procedure Tfrm_Drive_Card_Check_Rteport.Cmd_PreviewClick(Sender: TObject);
begin
inherited;
tempsql:='Select * from [Drive_Card_Check_View] where ';
if Trim(ComboBox1.Text)<>'' then
begin
tempSql:=tempSql+' Drive_ID Like '+''''+'%'+ Trim(ComboBox1.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox2.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Man Like '+''''+'%'+ Trim(ComboBox2.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox3.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Card_Type Like '+''''+'%'+ Trim(ComboBox3.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox4.Text)<>'' then
begin
tempSql:=tempSql+' Check_Mond Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox5.Text)<>'' then
begin
tempSql:=tempSql+' Check_Result Like '+''''+'%'+ Trim(ComboBox5.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox6.Text)<>'' then
begin
tempSql:=tempSql+' Check_Date = '+''''+ Trim(ComboBox6.Text)+''''+' and ';
end;
if Trim(ComboBox7.Text)<>'' then
begin
tempSql:=tempSql+' Value_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+' Check_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+' Value_Date between '''+Trim(Edit3.Text)+''' and '''+Trim(Edit4.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit3.SetFocus;
Exit;
end;
end;
if CheckBox11.Checked=True then
begin
if Trim(Edit5.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date between '''+Trim(Edit5.Text)+''' and '''+Trim(Edit6.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit5.SetFocus;
Exit;
end;
end;
tempSql:=Copy(tempSql,0,length(tempSql)-4);
with frm_data.Query_Drive_Card_Check_View 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_DriveCheck_HeaderTitle.Caption:=func.Use_mond+frm_ReportInFormation.L_DriveCheck_HeaderTitle.Caption;
frm_ReportInFormation.lab_DriveCheck_Ren.Caption:=frm_ReportInFormation.lab_DriveCheck_Ren.Caption+func.Login_Name;
frm_ReportInFormation.Lab_DriveCheck_Time.Caption:=frm_ReportInFormation.Lab_DriveCheck_Time.Caption+formatdatetime('yyyy''-''mm''-''dd',now);
frm_ReportInFormation.QuickRep_DriveCheck.Prepare;
frm_Preview.ShowModal(frm_ReportInFormation.QuickRep_DriveCheck,'驾照审查信息报表');
end;
end;
procedure Tfrm_Drive_Card_Check_Rteport.Cmd_PrintClick(Sender: TObject);
begin
inherited;
tempsql:='Select * from [Drive_Card_Check_View] where ';
if Trim(ComboBox1.Text)<>'' then
begin
tempSql:=tempSql+' Drive_ID Like '+''''+'%'+ Trim(ComboBox1.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox2.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Man Like '+''''+'%'+ Trim(ComboBox2.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox3.Text)<>'' then
begin
tempSql:=tempSql+' Drive_Card_Type Like '+''''+'%'+ Trim(ComboBox3.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox4.Text)<>'' then
begin
tempSql:=tempSql+' Check_Mond Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox5.Text)<>'' then
begin
tempSql:=tempSql+' Check_Result Like '+''''+'%'+ Trim(ComboBox5.Text)+'%'+''''+' and ';
end;
if Trim(ComboBox6.Text)<>'' then
begin
tempSql:=tempSql+' Check_Date = '+''''+ Trim(ComboBox6.Text)+''''+' and ';
end;
if Trim(ComboBox7.Text)<>'' then
begin
tempSql:=tempSql+' Value_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+' Check_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+' Value_Date between '''+Trim(Edit3.Text)+''' and '''+Trim(Edit4.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit3.SetFocus;
Exit;
end;
end;
if CheckBox11.Checked=True then
begin
if Trim(Edit5.Text)<>'' then
begin
tempSql:=tempSql+' Record_Date between '''+Trim(Edit5.Text)+''' and '''+Trim(Edit6.Text)+''''+' and ';
end
else
begin
Application.MessageBox('操作错误,已经选择了按时间段查询,开始时间不能为空',''mb_ok);
Edit5.SetFocus;
Exit;
end;
end;
tempSql:=Copy(tempSql,0,length(tempSql)-4);
with frm_data.Query_Drive_Card_Check_View 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_DriveCheck_HeaderTitle.Caption:=func.Use_mond+frm_ReportInFormation.L_DriveCheck_HeaderTitle.Caption;
frm_ReportInFormation.lab_DriveCheck_Ren.Caption:=frm_ReportInFormation.lab_DriveCheck_Ren.Caption+func.Login_Name;
frm_ReportInFormation.Lab_DriveCheck_Time.Caption:=frm_ReportInFormation.Lab_DriveCheck_Time.Caption+formatdatetime('yyyy''-''mm''-''dd',now);
frm_ReportInFormation.QuickRep_DriveCheck.Prepare;
frm_ReportInFormation.QuickRep_DriveCheck.print;
end;
end;
procedure Tfrm_Drive_Card_Check_Rteport.Cmd_CancelClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_Drive_Card_Check_Rteport.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
action:=cafree;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -