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

📄 unit_querycapture.pas

📁 delphi开发的中国移动大客户管理系统,后台数据库为oracle
💻 PAS
字号:
unit Unit_QueryCapture;

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;

type
  TFRM_QueryCapture = class(TForm_custbrowsebase_P)
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    dtpGR_OutDateBegin: TDateTimePicker;
    dtpGR_OutDateEnd: TDateTimePicker;
    cbGR_OutDate: TFlatCheckBox;
    coGR_WriteOffType: TFlatComboBox;
    Label11: TLabel;
    coGR_USER_FKFS: TFlatComboBox;
    procedure cbGR_OutDateClick(Sender: TObject);
    procedure FlatButton3Click(Sender: TObject);
    procedure FlatButton2Click(Sender: TObject);
  private
    { Private declarations }
  protected
  	lGR_WriteOffType:string;
        lGR_USER_FKFS:string;
        procedure pro_initother(sender:tobject);override;
        procedure pro_initcombobox(sender:tobject);override;
        procedure pro_GR_getid(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_QueryCapture: TFRM_QueryCapture;

implementation
uses dmmain,PrintFrmForm;
  Function Fun_ExportData(pFileName:String;pReportTitle:String;pObjectSource:TObject):Boolean;stdcall;external'winfun.dll';
{$R *.DFM}

procedure TFRM_QueryCapture.cbGR_OutDateClick(Sender: TObject);
begin
  inherited;
if cbGR_OutDate.Checked then
    begin
      dtpGR_OutDateBegin.Color:=clwindow;
      dtpGR_OutDateEnd.Color:=clwindow;
      dtpGR_OutDateBegin.Enabled:=true;
      dtpGR_OutDateEnd.Enabled:=true;
    end
else
    begin
      dtpGR_OutDateBegin.Color:=clActiveBorder;
      dtpGR_OutDateEnd.Color:=clActiveBorder;
      dtpGR_OutDateBegin.Enabled:=false;
      dtpGR_OutDateEnd.Enabled:=false;
    end;
end;

procedure TFRM_QueryCapture.pro_GR_checkcondition(sender: tobject);
begin
  inherited;
if cbGR_OutDate.Checked then
    begin
        if trunc(dtpGR_OutDateEnd.DateTime)<trunc(dtpGR_OutDateBegin.DateTime) then
            begin
//                fun_messagebox('出帐时间段开始日期不能大于结束日期');
                GR_condition:=false;
            end;
    end;
end;

procedure TFRM_QueryCapture.pro_GR_getid(sender: tobject);
begin
  inherited;
with query_tmp do
    begin
        // 销帐状态
        if coGR_WriteOffType.text<>'所有' then
            begin
                close;
                sql.clear;
                sql.add('select WriteOffType from T_V_WriteOffstatus');
                sql.add('where trim(PAR_DESC)='+''''+coGR_WriteOffType.text+'''');
                open;
                if recordcount>0 then
                   lGR_WriteOffType:=trim(fieldbyname('WriteOffType').asstring);
            end
        else
            lGR_WriteOffType:='';
	//付款类型
        if coGR_USER_FKFS.text<>'所有' then
            begin
                close;
                sql.clear;
                sql.add('select USER_FKFS from T_V_USER_FKFS');
                sql.add('where trim(PAR_DESC)='+''''+coGR_USER_FKFS.text+'''');
                open;
                if recordcount>0 then
                   lGR_USER_FKFS:=trim(fieldbyname('USER_FKFS').asstring);
            end
        else
            lGR_USER_FKFS:='';

    end;
end;

procedure TFRM_QueryCapture.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_USER_ZJBS<>'' then
        tmpstr:=tmpstr+' and '+'t.productno='+''''+lGR_USER_ZJBS+'''';

//
if lGR_WriteOffType<>'' then
        tmpstr:=tmpstr+' and '+'t.WriteOffType='+''''+lGR_WriteOffType+'''';
if lGR_USER_FKFS<>'' then
        tmpstr:=tmpstr+' and '+'t.USER_FKFS='+''''+lGR_USER_FKFS+'''';
if cbGR_OutDate.Checked then
    begin
        tmpstr:=tmpstr+' and '+'t.OutDate between '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_OutDateBegin.Date)+''',''yyyymmdd'')'+' and '+'to_date('''+formatdatetime('yyyymmdd',dtpGR_OutDateEnd.Date)+''',''yyyymmdd'')';
    end;
GR_sqlwhere:=GR_sqlwhere+tmpstr;
end;

procedure TFRM_QueryCapture.pro_GR_OpenDataSet(sender: tobject;
  strsql: string);
begin
with browse_normal do
    begin
        close;
        sql.clear;
        sql.add('select * from T_V_GR_QueryCapture');
        sql.Add('where 1=1');
        sql.add(strsql);
        open;
    end;
end;

procedure TFRM_QueryCapture.pro_initcombobox(sender: tobject);
begin
  inherited;
with query_tmp do
    begin
//销帐类型
        close;
        sql.clear;
        sql.add('select PAR_Desc from T_V_WRITEOFFSTATUS');
        open;
        coGR_WriteOffType.Items.Add('所有');
        first;
        while not eof do
            begin
                coGR_WriteOffType.Items.Add(fieldbyname('PAR_Desc').asstring);
                next;
            end;
        coGR_WriteOffType.ItemIndex:=0;
//付款类型
        close;
        sql.clear;
        sql.add('select PAR_Desc from T_V_USER_FKFS');
        open;
        coGR_USER_FKFS.Items.Add('所有');
        first;
        while not eof do
            begin
                coGR_USER_FKFS.Items.Add(fieldbyname('PAR_Desc').asstring);
                next;
            end;
        coGR_USER_FKFS.ItemIndex:=0;
    end;
end;

procedure TFRM_QueryCapture.pro_initother(sender: tobject);
begin
  inherited;
dtpGR_OutDateBegin.Date:=now;
dtpGR_OutDateEnd.date:=now;
end;

procedure TFRM_QueryCapture.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_QueryCapture.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 + -