⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_custbrowsebase_p.pas

📁 delphi开发的中国移动大客户管理系统,后台数据库为oracle
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit Unit_custbrowsebase_P;
{
*****************************************************************************
*功能:个人客户查询基窗体
*作者:郭新源
*版本:1.000
*继承于:unit_base
*输入:各种查询条件
*输出:查询结果
*视图:根据窗体名去除前缀加视图前缀进行调用。
    如:单元unit_QueryBirthday  个人客户页面视图名为:t_V_GR_QueryBirthday
*****************************************************************************
}
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, DBGrids, Buttons, StdCtrls, TFlatEditUnit,
  TFlatComboBoxUnit, ComCtrls, TFlatButtonUnit, ExtCtrls,
  TFlatCheckBoxUnit, TFlatSpinEditUnit, tflatpanelunit,ToolWin, ImgList, Menus, Db,
  DBTables, TFlatRadioButtonUnit, TFlatListBoxUnit;
const
    REMIDEROW=1000;
type
  TForm_custbrowsebase_P = class(TForm)
    Panel1: TPanel;
    Panel5: TPanel;
    Bevel1: TBevel;
    FlatButton1: TFlatButton;
    Panel2: TPanel;
    Panel3: TPanel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Panel6: TPanel;
    ScrollBox_GR: TScrollBox;
    PanelGR_base1: TPanel;
    PanelGR_base: TPanel;
    Label5: TLabel;
    Label4: TLabel;
    Label7: TLabel;
    coGR_DJDM: TFlatComboBox;
    coGR_USER_ZJBS: TFlatComboBox;
    edGR_SID: TFlatEdit;
    PanelGR_Stuff: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    coGR_cityno: TFlatComboBox;
    coGR_off_no_home: TFlatComboBox;
    PanelGRBTN_highlevel: TPanel;
    PanelGR_highlevel2: TPanel;
    Label92: TLabel;
    Label91: TLabel;
    Label87: TLabel;
    Label86: TLabel;
    Label88: TLabel;
    coGR_ZY: TFlatComboBox;
    coGR_XB: TFlatComboBox;
    spiGR_AgeBegin: TFlatSpinEditInteger;
    spiGR_AgeEnd: TFlatSpinEditInteger;
    cbGR_Age: TFlatCheckBox;
    PanelGR_highlevel: TPanel;
    PanelGR_highlevel1: TPanel;
    Label93: TLabel;
    Label96: TLabel;
    Label95: TLabel;
    Label99: TLabel;
    Label94: TLabel;
    Label75: TLabel;
    Label_stat: TLabel;
    dtpGR_BE_DH_TBegin: TDateTimePicker;
    dtpGR_BE_DH_TEnd: TDateTimePicker;
    cbGR_BE_DH_T: TFlatCheckBox;
    coGR_SXDM: TFlatComboBox;
    cbGR_ZWSJ: TFlatCheckBox;
    spiGR_ZWSJBegin: TFlatSpinEditInteger;
    spiGR_ZWSJEnd: TFlatSpinEditInteger;
    coGR_Stat: TFlatComboBox;
    dsbrowse_normal: TDataSource;
    Query_tmp: TQuery;
    ImageList: TImageList;
    coGR_GH: TFlatComboBox;
    dbgGR: TDBGrid;
    browse_normal: TQuery;
    StatusBar1: TStatusBar;
    PanelGR_SelectOrder: TPanel;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    btnGR_HighLevel: TToolButton;
    ToolButton3: TToolButton;
    PanelGRBTN_SelectOrder: TPanel;
    ToolBar22: TToolBar;
    ToolButton20: TToolButton;
    btnGR_SelectOrder: TToolButton;
    ToolButton21: TToolButton;
    spiGR_Return: TFlatSpinEditInteger;
    Label999: TLabel;
    cbGR_return: TFlatCheckBox;
    cbGR_Order: TFlatCheckBox;
    btnGR_to: TFlatButton;
    btnGR_From: TFlatButton;
    lbGR_canselect: TListBox;
    lbGR_selected: TListBox;
    lbGR_field: TListBox;
    lbGR_fieldcomment: TListBox;
    rbGR_Asce: TFlatRadioButton;
    rbGR_Desc: TFlatRadioButton;
    Splitter1: TSplitter;
    ImageList1: TImageList;
    PopupMenu1: TPopupMenu;
    pmi_CustInfo: TMenuItem;
    pmi_consumestru: TMenuItem;
    pmi_consumetrake: TMenuItem;
    pmi_gradechange: TMenuItem;
    N1: TMenuItem;
    N2: TMenuItem;
    Panel4: TPanel;
    FlatButton4: TFlatButton;
    FlatButton3: TFlatButton;
    FlatButton2: TFlatButton;
    procedure cbGR_ZWSJClick(Sender: TObject);
    procedure cbGR_BE_DH_TClick(Sender: TObject);
    procedure cbGR_AgeClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btnGR_stuffClick(Sender: TObject);
    procedure btnGR_HighLevelClick(Sender: TObject);
    procedure FlatButton1Click(Sender: TObject);
    procedure spiGR_ZWSJBeginChange(Sender: TObject);
    procedure coGR_citynoKeyPress(Sender: TObject; var Key: Char);
    procedure FlatButton4Click(Sender: TObject);
    procedure coGR_citynoChange(Sender: TObject);
    procedure coGR_GHEnter(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure coGR_off_no_homeChange(Sender: TObject);
    procedure edGR_SIDKeyPress(Sender: TObject; var Key: Char);
    procedure pmi_CustInfoClick(Sender: TObject);
    procedure btnGR_toClick(Sender: TObject);
    procedure btnGR_FromClick(Sender: TObject);
    procedure cbGR_returnClick(Sender: TObject);
    procedure cbGR_OrderClick(Sender: TObject);
    procedure btnGR_SelectOrderClick(Sender: TObject);
    procedure pmi_consumestruClick(Sender: TObject);
    procedure pmi_consumetrakeClick(Sender: TObject);
    procedure dbgGRMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  protected
        lGR_GH:string;  //工号
        lGR_cityno:string; //地市
        lGR_Off_no_home:string;  //局向
        lGR_USER_ZJBS:string;  //品牌
        lGR_DJDM:string;   //等级
        lGR_SXDM:string;  //属性代码
        lGR_ZY:string;  //职业
        lGR_XB:string;        //性别
        lGR_Stat:string;      //状态
        GR_sqlquery:string;   //SQL语句中的前一段
        GR_sqlwhere:string;   //条件语句
        GR_condition:boolean; //检查输入值的有效性
        GR_Sqlorder:string;
        procedure pro_GR_getid(sender:tobject);virtual;//获得个人客户页下拉框所对应的代码
        procedure pro_initcombobox(sender:tobject);virtual;//初始化下拉框
        procedure pro_initother(sender:tobject);virtual; //初始化工作
        procedure pro_GR_OpenDataSet(sender:tobject;strsql:string);virtual;abstract;//获得数据库数据
        procedure pro_getsqlQuery(sender:tobject);virtual;//获得查询表
        procedure pro_GR_getsqlwhere(sender:tobject);virtual;//根据个人客户页的查询条件获得相关查询条件
        procedure pro_GR_checkcondition(sender:tobject);virtual;//检查相关输入信息
        procedure pro_GR_orderpanel(sender:tobject); //排列个人客户页中的panel
        procedure pro_CheckPanel(sender:tobject);  //初始化panel值
        procedure pro_GR_getSqlorder(sender:tobject);virtual;
  public
    { Public declarations }
  end;

var
  Form_custbrowsebase_P: TForm_custbrowsebase_P;

implementation
uses main,dmmain,unit_public,unit_ca_consumeaction,unit_ca_consumestru;
 //按钮控制
  function Fun_ButtonStatus(pFormName:TForm;pStatus:Boolean=False):Boolean;stdcall;export;external'winfun.dll';
  //输框状态控制
  Function Fun_ComponentStatus(pFormName:TForm;pStatusStyle:Integer=0;pStatus:Boolean=False):Integer;stdCall;external'winfun.dll';
 //控制回车
  Function Fun_ComponentTab(pFormName:TForm;pKey:Word):Boolean;StdCall;external'winfun.dll';

{$R *.DFM}

{ TForm_custbrowsebase_P }

procedure TForm_custbrowsebase_P.pro_GR_checkcondition(sender: tobject);
begin
GR_condition:=true;
if cbGR_BE_DH_T.Checked then
    begin
        if trunc(dtpGR_BE_DH_TEnd.DateTime)<trunc(dtpGR_BE_DH_TBegin.DateTime) then
            begin
//                fun_messagebox('成为大客户时间开始日期不能大于结束日期');
                GR_condition:=false;
            end;
    end;
end;

procedure TForm_custbrowsebase_P.pro_GR_getid(sender: tobject);
var
    i:integer;
begin
lGR_GH:='';
lGR_cityno:='';
lGR_off_no_home:='';
lGR_USER_ZJBS:='';
lGR_DJDM:='';
lGR_SXDM:='';
lGR_Stat:='';
lGR_ZY:='';
lGR_XB:='';
if coGR_GH.text<>'所有' then
   lGR_GH:=copy(coGR_GH.text,1,pos(':',coGR_GH.text)-1);
if  CoGR_CityNo.text<>'所有' then
   lGR_cityno:=Fun_GetCity(CoGR_CityNo,'',1);
if  CoGR_OFF_NO_HOME.text<>'所有' then
   lGR_off_no_home:=Fun_GetCounty(CoGR_OFF_NO_HOME,'','',1);
if  CoGR_USER_ZJBS.text<>'所有' then
    lGR_USER_ZJBS:=fun_getcodename(coGR_USER_ZJBS);
if  coGR_DJDM.text<>'所有' then
	lGR_DJDM:=fun_getcodename(coGR_DJDM);
if  coGR_SXDM.text<>'所有' then
	lGR_SXDM:=fun_getcodename(coGR_SXDM);
if  coGR_Stat.text<>'所有' then
	lGR_Stat:=fun_getcodename(coGR_Stat);
if  coGR_ZY.text<>'所有' then
	lGR_ZY:=fun_getcodename(coGR_ZY);
if  coGR_XB.text<>'所有' then
	lGR_XB:=fun_getcodename(coGR_XB);

end;

procedure TForm_custbrowsebase_P.pro_GR_getsqlwhere(sender: tobject);
var
    tmpstr:string;
begin
GR_sqlwhere:='';
//if coGR_cityno.Text<>'所有' then
if lGR_cityno<>'' then
        tmpstr:=tmpstr+' and '+'t.cityno_c='+lGR_cityno+' and '+'t.cityno_city_c='+lGR_cityno+' and '+'t.cityno_county_c='+lGR_cityno;
//if coGR_off_no_home.Text<>'所有' then
if lGR_off_no_home<>'' then
        tmpstr:=tmpstr+' and '+'t.off_no_home_c='+lGR_off_no_home+' and '+'t.off_no_home_county_c='+lGR_off_no_home;
if edGR_SID.Text<>'' then
      tmpstr:=tmpstr+' and '+'t.SID_c='+''''+edGR_SID.Text+'''';
//if coGR_USER_ZJBS.Text<>'所有' then
if lGR_USER_ZJBS<>'' then
        tmpstr:=tmpstr+' and '+'t.USER_ZJBS='+''''+lGR_USER_ZJBS+''''+' and '+'t.productno_c='+''''+lGR_USER_ZJBS+'''';
//if coGR_GH.Text<>'所有' then
if lGR_GH<>'' then
        tmpstr:=tmpstr+' and '+'t.GH_c='+''''+lGR_GH+'''';
//
//if coGR_DJDM.Text<>'所有' then
if lGR_DJDM<>'' then
        tmpstr:=tmpstr+' and '+'t.DJDM='+lGR_DJDM+' and '+'t.gradeno_c='+lGR_DJDM;
//if coGR_SXDM.Text<>'所有' then
if lGR_SXDM<>'' then
        tmpstr:=tmpstr+' and '+'t.SXDM='+lGR_SXDM;
//if coGR_Stat.Text<>'所有' then
if lGR_Stat<>'' then
        tmpstr:=tmpstr+' and '+'t.Stat='+lGR_Stat+' and '+'t.Stat_stat_c='+lGR_Stat;
//if coGR_ZY.Text<>'所有' then
if lGR_ZY<>'' then
        tmpstr:=tmpstr+' and '+'t.ZY='+''''+lGR_ZY+'''';
//if coGR_XB.Text<>'所有' then
if lGR_XB<>'' then
        tmpstr:=tmpstr+' and '+'t.XB='+''''+lGR_XB+'''';

//


//
if cbGR_ZWSJ.Checked then
	tmpstr:=tmpstr+' and '+'t.zwsj>='+inttostr(spiGR_ZWSJBegin.Value)+' and t.zwsj<='+inttostr(spiGR_ZWSJEnd.Value);

if cbGR_BE_DH_T.Checked then
    begin
        tmpstr:=tmpstr+' and '+'t.BE_DH_T between '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_BE_DH_TBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_BE_DH_TEnd.Date)+''',''yyyymmdd'')';
    end;
if cbGR_Age.Checked then
    begin
        tmpstr:=tmpstr+' and t.Age between '+inttostr(spiGR_AgeBegin.value)+' and '+inttostr(spiGR_AgeEnd.value);

    end;
if cbGR_return.checked then
       tmpstr:=tmpstr+' and rownum<'+inttostr(spiGR_Return.value);
GR_sqlwhere:=tmpstr;


end;

procedure TForm_custbrowsebase_P.pro_initcombobox(sender: tobject);
begin

  Fun_GetCity(CoGR_CITYNO,'所有',0,PS_CityName);//初始化所管辖的地市
   coGR_citynoChange(nil);
   Pro_GFillInitValue(Self,'所有');
end;

procedure TForm_custbrowsebase_P.pro_initother(sender: tobject);
var
    i:integer;
begin
edGR_sid.text:='';
dtpGR_BE_DH_TBegin.Date:=now;
dtpGR_BE_DH_TEnd.Date:=now;
StatusBar1.Panels[0].text:=self.Caption;
StatusBar1.Panels[1].text:=PageControl1.ActivePage.Caption;
//初始化排序列表
lbGR_canselect.Clear;
for i:=0 to lbGR_fieldcomment.Items.Count-1 do
	lbGR_canselect.Items.Add(lbGR_fieldcomment.Items[i]);
cbGR_Order.Checked:=false;
cbGR_return.Checked:=false;
end;

procedure TForm_custbrowsebase_P.cbGR_ZWSJClick(Sender: TObject);
begin
  if cbGR_ZWSJ.Checked then
      begin
        spiGR_ZWSJBegin.colorflat:=clwindow;
        spiGR_ZWSJEnd.colorflat:=clwindow;
        spiGR_ZWSJBegin.Enabled:=true;
        spiGR_ZWSJEnd.Enabled:=true;
      end
  else
      begin
        spiGR_ZWSJBegin.colorflat:=clActiveBorder;
        spiGR_ZWSJEnd.colorflat:=clActiveBorder;
        spiGR_ZWSJBegin.Enabled:=false;
        spiGR_ZWSJEnd.Enabled:=false;
      end;

end;

procedure TForm_custbrowsebase_P.cbGR_BE_DH_TClick(Sender: TObject);
begin
if cbGR_BE_DH_T.Checked then
    begin
      dtpGR_BE_DH_TBegin.Color:=clwindow;
      dtpGR_BE_DH_TEnd.Color:=clwindow;
      dtpGR_BE_DH_TBegin.Enabled:=true;
      dtpGR_BE_DH_TEnd.Enabled:=true;
    end
else
    begin
      dtpGR_BE_DH_TBegin.Color:=clActiveBorder;
      dtpGR_BE_DH_TEnd.Color:=clActiveBorder;
      dtpGR_BE_DH_TBegin.Enabled:=false;
      dtpGR_BE_DH_TEnd.Enabled:=false;
    end;

end;

procedure TForm_custbrowsebase_P.cbGR_AgeClick(Sender: TObject);
begin
  if cbGR_Age.Checked then
      begin
        spiGR_AgeBegin.colorflat:=clwindow;
        spiGR_AgeEnd.colorflat:=clwindow;
        spiGR_AgeBegin.Enabled:=true;
        spiGR_AgeEnd.Enabled:=true;
      end
  else
      begin
        spiGR_AgeBegin.colorflat:=clActiveBorder;
        spiGR_AgeEnd.colorflat:=clActiveBorder;
        spiGR_AgeBegin.Enabled:=false;
        spiGR_AgeEnd.Enabled:=false;
    end;

end;

procedure TForm_custbrowsebase_P.FormShow(Sender: TObject);
begin
  pro_checkpanel(self);
  pro_GR_orderpanel(self);
  pro_initcombobox(self);
  pro_initother(self);
  //btnGR_stuff.Click;
  btnGR_HighLevel.Click;
btnGR_SelectOrder.Click;

//
lbGR_field.Visible:=false;
lbGR_fieldcomment.Visible:=false;
end;

procedure TForm_custbrowsebase_P.btnGR_stuffClick(Sender: TObject);
begin
{if btnGR_stuff.tag=2  then
   begin
       PanelGR_stuff.Visible:=true;
       PanelGR_stuff.top:=PanelGRBTN_stuff.top+PanelGRBTN_stuff.Height;
       btnGR_stuff.down:=true;
       btnGR_stuff.tag:=1;
   end
else
if btnGR_stuff.tag=1 then
    begin
       PanelGR_stuff.Visible:=false;
       btnGR_stuff.down:=false;
       btnGR_stuff.tag:=2;
    end;
       ScrollBox_GR.VertScrollBar.Position:=PanelGRBTN_stuff.Top;//个人高级选项
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -