📄 unit_queryappeal.pas
字号:
unit Unit_QueryAppeal;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Unit_custbrowsebase_P, ImgList, Menus, Db, DBTables, Grids, DBGrids,
ComCtrls, TFlatCheckBoxUnit, TFlatSpinEditUnit, ToolWin, StdCtrls,
TFlatEditUnit, TFlatComboBoxUnit, TFlatButtonUnit, ExtCtrls,
TFlatRadioButtonUnit;
const
APPEALDONE=1;
APPEALUNDO=0;
type
Tfrm_QueryAppeal = class(TForm_custbrowsebase_P)
Label8: TLabel;
coGR_Subject_No: TFlatComboBox;
Label9: TLabel;
Label10: TLabel;
dtpGR_AppTimeBegin: TDateTimePicker;
dtpGR_AppTimeEnd: TDateTimePicker;
cbGR_Apptime: TFlatCheckBox;
cbGR_Done: TFlatCheckBox;
rbGR_DoneYes: TFlatRadioButton;
rbGR_DoneNo: TFlatRadioButton;
Label6: TLabel;
coGR_Applevel: TFlatComboBox;
pmi_reply: TMenuItem;
procedure cbGR_ApptimeClick(Sender: TObject);
procedure cbGR_DoneClick(Sender: TObject);
procedure pmi_replyClick(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
private
{ Private declarations }
protected
lGR_Subject_No:string;
lGR_AppLevel:string;
procedure pro_GR_getid(sender:tobject);override;
procedure pro_initcombobox(sender:tobject);override;
procedure pro_initother(sender:tobject);override;
procedure pro_GR_OpenDataSet(sender:tobject;strsql:string);override;
procedure pro_GR_getsqlwhere(sender:tobject);override;
procedure pro_GR_checkcondition(sender:tobject);override;
public
{ Public declarations }
end;
var
frm_QueryAppeal: Tfrm_QueryAppeal;
implementation
uses main,unit_public,unit_ServiceAppeal,PrintFrmForm;
Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
{$R *.DFM}
{ Tfrm_QueryAppeal }
procedure Tfrm_QueryAppeal.pro_GR_checkcondition(sender: tobject);
begin
inherited;
if cbGR_AppTime.Checked then
begin
if trunc(dtpGR_AppTimeEnd.DateTime)<trunc(dtpGR_AppTimeBegin.DateTime) then
begin
// fun_messagebox('投诉时间段开始日期不能大于结束日期');
GR_condition:=false;
end;
end;
end;
procedure Tfrm_QueryAppeal.pro_GR_getid(sender: tobject);
begin
inherited;
lGR_AppLevel:='';
lGR_Subject_No:='';
lGR_AppLevel:=fun_getcodename(coGR_AppLevel);//投诉级别
lGR_Subject_No:=fun_getcodename(coGR_Subject_No);//投诉类型
{ with query_tmp do
begin
// 品牌
if coGR_Subject_No.text<>'所有' then
begin
close;
sql.clear;
sql.add('select Subject_No from T_V_AppealType');
sql.add('where trim(PAR_DESC)='+''''+coGR_Subject_No.text+'''');
open;
if recordcount>0 then
lGR_Subject_No:=trim(fieldbyname('Subject_No').asstring);
end
else
lGR_Subject_No:='';
end;}
end;
procedure Tfrm_QueryAppeal.pro_GR_getsqlwhere(sender: tobject);
var
tmpstr:string;
begin
inherited;
if edGR_SID.Text<>'' then
tmpstr:=tmpstr+' and '+'t.SID='+''''+edGR_SID.Text+'''';
if lGR_cityno<>'' then
tmpstr:=tmpstr+' and '+'t.cityno='+lGR_cityno;
if lGR_off_no_home<>'' then
tmpstr:=tmpstr+' and '+'t.off_no_home='+lGR_off_no_home;
if lGR_GH<>'' then
tmpstr:=tmpstr+' and '+'t.WK_NO='+''''+lGR_GH+'''';
//
//
if lGR_AppLevel<>'' then
tmpstr:=tmpstr+' and '+'t.AppLevel='+lGR_AppLevel;
if lGR_Subject_No<>'' then
tmpstr:=tmpstr+' and '+'t.Subject_No='+lGR_Subject_No;
if cbGR_AppTime.Checked then
begin
tmpstr:=tmpstr+' and '+'t.AppTime between '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_AppTimeBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_AppTimeEnd.Date)+''',''yyyymmdd'')';
end;
if cbGR_Done.Checked then
if rbGR_DoneYes.Checked then
tmpstr:=tmpstr+' and '+'t.RepMark='+inttostr(APPEALDONE)
else
tmpstr:=tmpstr+' and '+'t.RepMark='+inttostr(APPEALUNDO);
GR_sqlwhere:=GR_sqlwhere+tmpstr;
end;
procedure Tfrm_QueryAppeal.pro_GR_OpenDataSet(sender: tobject;
strsql: string);
begin
with browse_normal do
begin
close;
sql.clear;
sql.add('select * from T_V_GR_QueryAppeal');
sql.Add('where 1=1');
sql.add(strsql);
open;
end;
end;
procedure Tfrm_QueryAppeal.pro_initcombobox(sender: tobject);
begin
inherited;
{with query_tmp do
begin
// 投诉类别
close;
sql.clear;
sql.add('select PAR_Desc from T_V_AppealType');
open;
coGR_Subject_No.Items.Add('所有');
first;
while not eof do
begin
coGR_Subject_No.Items.Add(trim(fieldbyname('PAR_Desc').asstring));
next;
end;
coGR_Subject_No.ItemIndex:=0;
end; }
end;
procedure Tfrm_QueryAppeal.pro_initother(sender: tobject);
begin
inherited;
dtpGR_AppTimeBegin.Date:=now;
dtpGR_AppTimeEnd.Date:=now;
end;
procedure Tfrm_QueryAppeal.cbGR_ApptimeClick(Sender: TObject);
begin
inherited;
if cbGR_AppTime.Checked then
begin
dtpGR_AppTimeBegin.Color:=clwindow;
dtpGR_AppTimeEnd.Color:=clwindow;
dtpGR_AppTimeBegin.Enabled:=true;
dtpGR_AppTimeEnd.Enabled:=true;
end
else
begin
dtpGR_AppTimeBegin.Color:=clActiveBorder;
dtpGR_AppTimeEnd.Color:=clActiveBorder;
dtpGR_AppTimeBegin.Enabled:=false;
dtpGR_AppTimeEnd.Enabled:=false;
end;
end;
procedure Tfrm_QueryAppeal.cbGR_DoneClick(Sender: TObject);
begin
inherited;
if cbGR_Done.Checked then
begin
rbGR_DoneYes.Enabled:=true;
rbGR_DoneNo.Enabled:=true;
end
else
begin
rbGR_DoneYes.Enabled:=false;
rbGR_DoneNo.Enabled:=false;
end;
end;
procedure Tfrm_QueryAppeal.pmi_replyClick(Sender: TObject);
begin
inherited;
FormMain.ServiceAppeal.onclick(self);
if not browse_normal.IsEmpty then
with Frm_ServiceAppeal do
begin
EdBR_Sid.text:=browse_normal.fieldbyname('sid_c').asstring;
Btn_Query_Normal.OnClick(nil);
pcAppeal.ActivePageIndex:=1;
end;
end;
procedure Tfrm_QueryAppeal.FlatButton3Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
Fun_ExportData('大客户投诉','大客户投诉',dbgGR);
end;
procedure Tfrm_QueryAppeal.FlatButton2Click(Sender: TObject);
begin
inherited;
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
begin
try
PrintDbGrid(dbgGR.datasource.dataset,dbgGR,'大客户投诉个人客户');
except
Application.MessageBox('系统在执行过程中发生错误!','提示',MB_ICONINFORMATION);
exit;
end;//try
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -