You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.8 KiB
Plaintext

unit u_crm_query;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinGrids, bsDBGrids, bsSkinCtrls, StdCtrls, Mask,
bsSkinBoxCtrls, DB, ADODB;
type
Tfrm_crm_query = class(TForm)
bsSkinPanel15: TbsSkinPanel;
bsSkinPanel16: TbsSkinPanel;
bsSkinEdit1: TbsSkinEdit;
bsSkinButton52: TbsSkinButton;
bsSkinButton53: TbsSkinButton;
bsSkinButton54: TbsSkinButton;
bsSkinDBGrid1: TbsSkinDBGrid;
t_crm_client1: TDataSource;
t_crm_client: TADOQuery;
DataSource1: TDataSource;
procedure bsSkinButton52Click(Sender: TObject);
procedure bsSkinButton54Click(Sender: TObject);
procedure bsSkinButton53Click(Sender: TObject);
procedure bsSkinDBGrid1DblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinEdit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_crm_query: Tfrm_crm_query;
implementation
uses u_crm_client,u_main, my_sys_function;
{$R *.dfm}
procedure Tfrm_crm_query.bsSkinButton52Click(Sender: TObject);
var
str:widestring;
begin
str:='where 客户性质<>'+''''+'目标'+'''';
if Trim(bsSkinEdit1.text)<>''then
begin
str:=str+' and (客户简称 like '+''''+'%'+bsSkinEdit1.text+'%'+''' or 客户全称 like '+''''+'%'+bsSkinEdit1.text+'%'+''')';
end;
str:=str+'and 委托单位=1';
t_crm_client.close;
t_crm_client.sql.clear;
t_crm_client.sql.add('select * from t_crm_client '+str+' and '+open_data('0008','录入人','揽货人','客服员','no','no')+' order by 代码');
t_crm_client.open;
end;
procedure Tfrm_crm_query.bsSkinButton54Click(Sender: TObject);
begin
if not if_open('018') then
begin
showmessage('你没有此模块的操作权限!');
exit;
end;
try
frm_crm_Client:=Tfrm_crm_client.Create (application);
frm_crm_Client.bsSkinButton1Click(Sender);
frm_crm_Client.ShowModal;
finally
frm_crm_Client.Free;
frm_crm_Client:=nil;
end;
end;
procedure Tfrm_crm_query.bsSkinButton53Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_crm_query.bsSkinDBGrid1DblClick(Sender: TObject);
begin
try
if not t_crm_client.IsEmpty then
begin
DataSource1.DataSet.Edit;
DataSource1.DataSet.FieldByName('委托单位').AsString:=t_crm_client.FieldByName('客户简称').AsString;
DataSource1.DataSet.Post;
end;
finally
close;
end;
end;
procedure Tfrm_crm_query.FormShow(Sender: TObject);
begin
t_crm_client.Close;
t_crm_client.Open;
end;
procedure Tfrm_crm_query.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
action:=cafree;
frm_crm_query:=nil;
end;
procedure Tfrm_crm_query.bsSkinEdit1KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bsSkinButton52Click(Sender);
end;
end;
end.