📄 unit_queryactfee.pas
字号:
unit Unit_QueryACTFEE;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
TFlatRadioButtonUnit, StdCtrls, ComCtrls, TFlatCheckBoxUnit,
TFlatSpinEditUnit, ToolWin, TFlatEditUnit, TFlatComboBoxUnit, Grids,
DBGrids, TFlatButtonUnit, ExtCtrls, Db, DBTables;
type
TFrm_QueryACTFEE = class(TForm)
Panel1: TPanel;
Panel5: TPanel;
Bevel1: TBevel;
FlatButton1: TFlatButton;
DataSource1: TDataSource;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
FlatButton2: TFlatButton;
FlatButton3: TFlatButton;
FlatButton4: TFlatButton;
browse_normal: TQuery;
Bevel2: TBevel;
dbgGR: TDBGrid;
Label7: TLabel;
coGR_DJDM: TFlatComboBox;
Label5: TLabel;
edGR_SID: TFlatEdit;
Label1: TLabel;
coGR_cityno: TFlatComboBox;
Label2: TLabel;
coGR_off_no_home: TFlatComboBox;
Label3: TLabel;
coGR_GH: TFlatComboBox;
Label99: TLabel;
coGR_SXDM: TFlatComboBox;
Label_stat: TLabel;
coGR_Stat: TFlatComboBox;
Label8: TLabel;
coGR_USER_ZJBS: TFlatComboBox;
Query2: TQuery;
Query1: TQuery;
browse_normalOFF_NO_HOME: TFloatField;
browse_normalHOME_NAME: TStringField;
browse_normalGH: TStringField;
browse_normalSID: TStringField;
browse_normalDJDM: TFloatField;
browse_normalDESCRIPTION: TStringField;
browse_normalSXDM: TFloatField;
browse_normalACT_USER: TStringField;
browse_normalCITYNAME: TStringField;
browse_normalSTAT: TFloatField;
browse_normalNAME: TStringField;
browse_normalACCOUNT_ID: TStringField;
browse_normalACT_FEE: TFloatField;
browse_normalstarname: TStringField;
Query3: TQuery;
browse_normalsxdmname: TStringField;
browse_normalCITYNO: TStringField;
browse_normalUSER_ZJBS: TStringField;
browse_normalprocedurename: TStringField;
FlatCheckBox1: TFlatCheckBox;
FlatSpinEditInteger1: TFlatSpinEditInteger;
FlatSpinEditInteger2: TFlatSpinEditInteger;
Label4: TLabel;
procedure FlatButton4Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure coGR_citynoChange(Sender: TObject);
procedure coGR_off_no_homeChange(Sender: TObject);
procedure FlatButton1Click(Sender: TObject);
procedure FlatCheckBox1Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
procedure pro_initcombobox(sender:tobject);virtual; //初始化下拉框
public
{ Public declarations }
end;
var
Frm_QueryACTFEE: TFrm_QueryACTFEE;
implementation
uses main,unit_public,dmmain,PrintFrmForm;
Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
//控制回车
Function Fun_ComponentTab(pFormName:TForm;pKey:Word):Boolean;StdCall;external'winfun.dll';
{$R *.DFM}
procedure TFrm_QueryACTFEE.FlatButton4Click(Sender: TObject);
begin
close;
end;
procedure TFrm_QueryACTFEE.FormShow(Sender: TObject);
begin
//初始化下拉框
pro_initcombobox(self);
end;
procedure TFrm_QueryACTFEE.pro_initcombobox(sender: tobject);
begin
fun_getcity(coGR_cityno,'所有',0,PS_CityName);
coGR_cityno.OnChange(self);
Pro_GFillInitValue(Self,'所有');
end;
procedure TFrm_QueryACTFEE.FlatButton2Click(Sender: TObject);
begin
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;
procedure TFrm_QueryACTFEE.FlatButton3Click(Sender: TObject);
begin
if browse_normal.Active then
if not (browse_normal.Bof and browse_normal.Eof) then
begin
Fun_ExportData('大客户构成个人客户','大客户构成个人客户',dbgGR)
end;
end;
procedure TFrm_QueryACTFEE.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action :=cafree;
end;
procedure TFrm_QueryACTFEE.coGR_citynoChange(Sender: TObject);
begin
Fun_Getcounty(coGR_off_no_home,'所有',coGR_Cityno.Text,0,ps_homename);
coGR_off_no_home.OnChange(coGR_off_no_home)
end;
procedure TFrm_QueryACTFEE.coGR_off_no_homeChange(Sender: TObject);
begin
Fun_GetManager(coGR_GH,'所有',coGR_Cityno.Text,coGR_off_no_home.Text,GH);
end;
procedure TFrm_QueryACTFEE.FlatButton1Click(Sender: TObject);
var
sqlstr :string;
num :real;
begin
//构造查询语句
sqlstr :='select b.sid,b.cityno,b.off_no_home,d.home_name,b.gh,b.DJDM,'
+'b.USER_ZJBS,e.description,'
+'b.SXDM,b.ACT_USER,c.cityname,'
+'b.STAT,h.name,'
+'b.account_id,'
+'i.act_fee '
+' from t_f_custinfo b,'
+' t_d_city c,t_d_county d,'
+'t_d_grade e,'
+'T_F_MANAGER h,'
+'T_Q_ACTFEE i '
+' where b.viph>0 and b.account_id is not null'
+' and b.cityno=c.cityno(+) '
+' and b.cityno=d.cityno(+) and b.off_no_home=d.off_no_home(+) '
+' and b.DJDM=e.gradeno(+) '
+' and b.gh=h.wk_no(+) '
+' and b.sid=i.sid(+) ';
//加上城市
if coGR_cityno.ItemIndex >0 then
sqlstr :=sqlstr+' and b.cityno='+#39+Fun_GetCity(CoGR_CityNo,'',1)+#39;
//加上局向
if coGR_off_no_home.ItemIndex >0 then
sqlstr :=sqlstr+' and b.off_no_home='+Fun_GetCounty(CoGR_OFF_NO_HOME,'','',1);
//加上客户经理
if coGR_GH.ItemIndex >0 then
sqlstr :=sqlstr+' and b.gh='+#39+copy(coGR_GH.text,1,pos(':',coGR_GH.text)-1)+#39;
//品牌名称:
if coGR_USER_ZJBS.ItemIndex >0 then
sqlstr :=sqlstr+' and b.USER_ZJBS='+#39+fun_getcodename(coGR_USER_ZJBS)+#39;
//消费层次:
if coGR_DJDM.ItemIndex >0 then
sqlstr :=sqlstr+' and b.DJDM='+fun_getcodename(coGR_DJDM);
//客户手机:
if trim(edGR_SID.text)<>'' then
sqlstr :=sqlstr+' and b.SID='+#39+edGR_SID.text+#39;
//客户属性:
if coGR_SXDM.ItemIndex >0 then
sqlstr :=sqlstr+' and b.SXDM='+#39+fun_getcodename(coGR_SXDM)+#39;
//手机状态:
if coGR_Stat.ItemIndex >0 then
sqlstr :=sqlstr+' and b.STAT='+#39+fun_getcodename(coGR_Stat)+#39;
If FlatCheckBox1.Checked Then
Begin
sqlstr :=sqlstr+' and i.act_fee>='+IntToStr(FlatSpinEditInteger1.Value);
sqlstr :=sqlstr+' and i.act_fee<='+IntToStr(FlatSpinEditInteger2.Value);
End;
browse_normal.Close;
browse_normal.sql.text :=sqlstr;
browse_normal.open;
end;
procedure TFrm_QueryACTFEE.FlatCheckBox1Click(Sender: TObject);
begin
FlatSpinEditInteger1.Enabled:= FlatCheckBox1.Checked;
FlatSpinEditInteger2.Enabled:= FlatCheckBox1.Checked;
If FlatCheckBox1.Checked Then
Begin
FlatSpinEditInteger1.Value:=0;
FlatSpinEditInteger2.Value:=0;
End;
end;
procedure TFrm_QueryACTFEE.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
Fun_ComponentTab(Self,Key);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -